fixed shield generation, fixed addhealth

This commit is contained in:
OfficialCHenry 2022-04-22 12:35:36 -04:00
parent 07827de7dc
commit d4e69bb3ff
2 changed files with 8 additions and 5 deletions

View File

@ -22,11 +22,9 @@ export default class BattleManager {
enemy.damage(Math.round(weapon.type.damage * (<PlayerController>this.players[0]).CURRENT_ATK/100));
//console.log("enemy took dmg");
//TODO - test shield,
//add checking for each onhit buff here
let player = (<PlayerController>this.players[0]);
player.addShield(1);
//DOTS
if(player.hasBleed){
(<EnemyAI>enemy).bleedCounter +=3;
@ -52,7 +50,9 @@ export default class BattleManager {
for (let player of this.players) {
if (weapon.hits(player.owner)) {
(<PlayerController>player).damage(weapon.type.damage, user);
if((<PlayerController>player).hasShield){
(<PlayerController>player).addShield(weapon.type.damage * .5); //half of dmg taken is converted to shield
}
}
}
}

View File

@ -300,7 +300,10 @@ export default class PlayerController extends StateMachineAI implements BattlerA
* @param health health to give player
*/
addHealth(health : number){
this.CURRENT_HP = (this.CURRENT_HP + health) %this.MAX_HP + this.CURRENT_BUFFS.hp;
this.CURRENT_HP += health;
if(this.CURRENT_HP > this.MAX_HP + this.CURRENT_BUFFS.hp){
this.CURRENT_HP = this.MAX_HP + this.CURRENT_BUFFS.hp;
}
}
/**