changed give_buff event to give_regular_buff and give_special_buff

This commit is contained in:
OfficialCHenry 2022-04-25 21:18:23 -04:00
parent eff4d44bfb
commit 5704b076b2
3 changed files with 36 additions and 5 deletions

View File

@ -322,7 +322,7 @@ export default class PlayerController extends StateMachineAI implements BattlerA
this.MAX_EXP += 50; //increase max exp needed for level up this.MAX_EXP += 50; //increase max exp needed for level up
this.level++ ; this.level++ ;
this.emitter.fireEvent(GameEventType.PLAY_SOUND, {key: "level_up", loop: false, holdReference: false}); this.emitter.fireEvent(GameEventType.PLAY_SOUND, {key: "level_up", loop: false, holdReference: false});
this.emitter.fireEvent(Player_Events.GIVE_BUFF); this.emitter.fireEvent(Player_Events.GIVE_REGULAR_BUFF);
} }
} }
@ -369,7 +369,9 @@ export default class PlayerController extends StateMachineAI implements BattlerA
// Get sub-array of first 3 elements after shuffled // Get sub-array of first 3 elements after shuffled
let shuffled = PlayerController.buffPool.slice(0, 3); //3 buff categories let shuffled = PlayerController.buffPool.slice(0, 3); //3 buff categories
let num = parseFloat(Math.random().toPrecision(1)) * 10; //random number from 1 to 10 if no value given //random number from 5 to 15 if no value given
let num = Math.floor(Math.random() *10) +5;
num = Math.round(num);
if(typeof val !== 'undefined'){ if(typeof val !== 'undefined'){
num = val; num = val;
} }

View File

@ -296,7 +296,7 @@ export default class GameLevel extends Scene {
//this.emitter.fireEvent(Player_Events.GIVE_BUFF); //this.emitter.fireEvent(Player_Events.GIVE_BUFF);
break; break;
case Player_Events.GIVE_BUFF: case Player_Events.GIVE_REGULAR_BUFF:
this.buffs = (<PlayerController>this.player._ai).generateRegularBuffs(); this.buffs = (<PlayerController>this.player._ai).generateRegularBuffs();
if(this.buffs[0].string === undefined){ if(this.buffs[0].string === undefined){
this.buffLabel1.text = "\n\nIncrease "+this.buffs[0].type + "\n by "+this.buffs[0].value; this.buffLabel1.text = "\n\nIncrease "+this.buffs[0].type + "\n by "+this.buffs[0].value;
@ -319,6 +319,33 @@ export default class GameLevel extends Scene {
this.buffLabel3.text = this.buffs[2].string; this.buffLabel3.text = this.buffs[2].string;
} }
//pause game here
this.setGameState(GameState.BUFF);
this.buffLayer.enable();
break;
case Player_Events.GIVE_SPECIAL_BUFF:
this.buffs = (<PlayerController>this.player._ai).generateSpecialBuffs();
if(this.buffs[0].string === undefined){
this.buffLabel1.text = "\n\nIncrease "+this.buffs[0].type + "\n by "+this.buffs[0].value;
}
else{
this.buffLabel1.text = this.buffs[0].string;
}
if(this.buffs[1].string === undefined){
this.buffLabel2.text = "\n\nIncrease "+this.buffs[1].type + "\n by "+this.buffs[1].value;
}
else{
this.buffLabel2.text = this.buffs[1].string;
}
if(this.buffs[2].string === undefined){
this.buffLabel3.text = "\n\nIncrease "+this.buffs[2].type + "\n by "+this.buffs[2].value;
}
else{
this.buffLabel3.text = this.buffs[2].string;
}
//pause game here //pause game here
this.setGameState(GameState.BUFF); this.setGameState(GameState.BUFF);
this.buffLayer.enable(); this.buffLayer.enable();
@ -500,7 +527,8 @@ export default class GameLevel extends Scene {
Player_Events.LEVEL_START, Player_Events.LEVEL_START,
Player_Events.LEVEL_END, Player_Events.LEVEL_END,
Player_Events.PLAYER_KILLED, Player_Events.PLAYER_KILLED,
Player_Events.GIVE_BUFF, Player_Events.GIVE_REGULAR_BUFF,
Player_Events.GIVE_SPECIAL_BUFF
]); ]);
this.receiver.subscribe("buff1"); this.receiver.subscribe("buff1");
this.receiver.subscribe("buff2"); this.receiver.subscribe("buff2");

View File

@ -10,7 +10,8 @@ export enum Player_Events {
ENEMY_KILLED = "EnemyKilled", ENEMY_KILLED = "EnemyKilled",
PLAYER_HIT_ENEMY = "PlayerHitEnemy", PLAYER_HIT_ENEMY = "PlayerHitEnemy",
BOSS_KILLED = "BossKilled", BOSS_KILLED = "BossKilled",
GIVE_BUFF = "GiveBuff", GIVE_REGULAR_BUFF = "GiveRegularBuff",
GIVE_SPECIAL_BUFF = "GiveSpecialBuff",
PLAYER_COLLIDE = "PlayerCollide" PLAYER_COLLIDE = "PlayerCollide"
} }
export enum Damage_Type { export enum Damage_Type {