Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qol(sword-slitter): Added a 1 second delay before the second sword slitter #2489

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/abilities/Bounty-Hunter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ export default (G: Game) => {
const targetOriginalHealth = target.health;

const ability = this;
ability.end();
G.Phaser.camera.shake(0.01, 150, true, G.Phaser.camera.SHAKE_HORIZONTAL, true);

const damage = new Damage(
ability.creature, // Attacker
Expand All @@ -156,15 +154,22 @@ export default (G: Game) => {
[], // Effects
G,
);
target.takeDamage(damage);
ability.end();
G.Phaser.camera.shake(0.01, 150, true, G.Phaser.camera.SHAKE_HORIZONTAL, true);
/** damage dealt is original health - current health
* if current health is lower than damage dealt,
* and the ability is upgraded,
* make a second attack
*/
if (targetOriginalHealth - target.health >= target.health && this.isUpgraded()) {
target.takeDamage(damage);
}
// Added a delay for the second attack with a custom game log
setTimeout(() => {
G.Phaser.camera.shake(0.01, 150, true, G.Phaser.camera.SHAKE_HORIZONTAL, true);
ability.end(true);
target.takeDamage(damage);
G.log('%CreatureName' + ability.creature.id + '% used ' + ability.title + ' twice');
}, 1000);
} else target.takeDamage(damage);
},
},

Expand Down
Loading