Skip to content

Commit

Permalink
Reset the killer flag if a healing action saved the target's life (#292)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyvg authored Sep 19, 2023
1 parent ab6d9ac commit 976a819
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/arena/Constuructors/HealMagicConstructor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ export abstract class Heal {
return 0;
}

checkTargetIsDead({ target } = this.params) {
const hpNow = target.stats.val('hp');
if (hpNow > 0 && target.getKiller()) {
target.resetKiller();
}
}

/**
* Функция положительного прохождения
*/
Expand Down
4 changes: 4 additions & 0 deletions src/arena/PlayersService/Player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ export default class Player {
this.flags.isDead = player.id;
}

resetKiller(): void {
this.flags.isDead = '';
}

setProc(proc: number) {
this.proc = proc;
}
Expand Down
7 changes: 7 additions & 0 deletions src/arena/magics/heal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ export class HealMagic extends CommonMagic {
initiator.stats.mode('up', 'exp', this.status.exp);
}

checkTargetIsDead({ target } = this.params) {
const hpNow = target.stats.val('hp');
if (hpNow > 0 && target.getKiller()) {
target.resetKiller();
}
}

next(): void {
const { target, initiator, game } = this.params;
const args: HealMagicNext = {
Expand Down

0 comments on commit 976a819

Please sign in to comment.