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;
fullHpBonus: Boolean = false;
//TODO - add new buffs here
/*
CURRENT_BUFFS: {
atk: number; //flat value to add to weapon
hp: number; //flat value
def: number; //flat value
speed: number; //flat value
range:number; //range will be a multiplier value: 1.5 = 150% range
}
*/
poisonTimer : Timer;
poisonCounter : number = 0;
burnTimer : Timer ;
burnCounter : number =0;
bleedTimer : Timer;
bleedCounter :number = 0;
@ -174,6 +173,11 @@ export default class PlayerController extends StateMachineAI implements BattlerA
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
//this.addBuff( {type:BuffType.HEALTH, value:1} );
//this.addBuff({type:BuffType.BURN, value:1, category:BuffCategory.DOT});
@ -238,6 +242,23 @@ export default class PlayerController extends StateMachineAI implements BattlerA
}
}
//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) );
}
}