added dot timers to player

This commit is contained in:
OfficialCHenry 2022-04-25 21:23:28 -04:00
parent 435157b192
commit e4500c9e6f

View File

@ -133,16 +133,15 @@ export default class PlayerController extends StateMachineAI implements BattlerA
cooldownMultiplier : number = 1; cooldownMultiplier : number = 1;
fullHpBonus: Boolean = false; fullHpBonus: Boolean = false;
//TODO - add new buffs here poisonTimer : Timer;
/* poisonCounter : number = 0;
CURRENT_BUFFS: {
atk: number; //flat value to add to weapon burnTimer : Timer ;
hp: number; //flat value burnCounter : number =0;
def: number; //flat value
speed: number; //flat value bleedTimer : Timer;
range:number; //range will be a multiplier value: 1.5 = 150% range bleedCounter :number = 0;
}
*/
@ -174,6 +173,11 @@ export default class PlayerController extends StateMachineAI implements BattlerA
PlayerController.buffPool.push(BuffCategory.HEALTH); PlayerController.buffPool.push(BuffCategory.HEALTH);
} }
//initialize dot timers
this.burnTimer = new Timer(1000);
this.bleedTimer = new Timer(1000);
this.poisonTimer = new Timer(1000);
//to test the buffs //to test the buffs
//this.addBuff( {type:BuffType.HEALTH, value:1} ); //this.addBuff( {type:BuffType.HEALTH, value:1} );
//this.addBuff({type:BuffType.BURN, value:1, category:BuffCategory.DOT}); //this.addBuff({type:BuffType.BURN, value:1, category:BuffCategory.DOT});
@ -237,6 +241,23 @@ export default class PlayerController extends StateMachineAI implements BattlerA
item.use(this.owner, "player", this.lookDirection); item.use(this.owner, "player", this.lookDirection);
} }
} }
//check dot effects
if(this.burnTimer.isStopped() && this.burnCounter >0){
this.burnCounter --;
this.burnTimer.start();
this.damage(10);
}
if(this.poisonTimer.isStopped() && this.poisonCounter >0){
this.poisonCounter --;
this.poisonTimer.start();
this.damage( Math.round(this.CURRENT_HP/20) );
}
if(this.bleedTimer.isStopped() && this.bleedCounter >0){
this.bleedCounter --;
this.bleedTimer.start();
this.damage( 2 + Math.round(this.CURRENT_HP/33) );
}
} }