mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Fixes
This commit is contained in:
@@ -64,6 +64,12 @@ module.exports = class BattleCommand extends Command {
|
||||
battle.attacker.heal(battle.attacker.mp);
|
||||
battle.attacker.useMP(battle.attacker.mp);
|
||||
battle.reset();
|
||||
} else if (choice === 'final') {
|
||||
await msg.say(`${battle.attacker} uses their final move, dealing **100** damage!`);
|
||||
battle.defender.dealDamage(100);
|
||||
battle.attacker.useMP(100);
|
||||
battle.attacker.usedFinal = true;
|
||||
battle.reset();
|
||||
} else if (choice === 'run') {
|
||||
await msg.say(`${battle.attacker} flees!`);
|
||||
battle.attacker.forfeit();
|
||||
|
||||
@@ -10,6 +10,7 @@ module.exports = class Battler {
|
||||
this.hp = 500;
|
||||
this.mp = 500;
|
||||
this.guard = false;
|
||||
this.usedFinal = false;
|
||||
}
|
||||
|
||||
async chooseAction(msg) {
|
||||
@@ -37,7 +38,7 @@ module.exports = class Battler {
|
||||
return false;
|
||||
}
|
||||
if (choice === 'final' && !this.canFinal) {
|
||||
msg.say('To use your final attack, you must have under 100 HP and over 100 MP.').catch(() => null);
|
||||
msg.say('You must have under 100 HP and over 100 MP. Final can only be used once!').catch(() => null);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -86,7 +87,7 @@ module.exports = class Battler {
|
||||
}
|
||||
|
||||
get canFinal() {
|
||||
return this.hp < 100 && this.mp >= 100;
|
||||
return this.hp < 100 && this.mp >= 100 && !this.usedFinal;
|
||||
}
|
||||
|
||||
toString() {
|
||||
|
||||
Reference in New Issue
Block a user