Balance Battle a bit more

This commit is contained in:
Dragon Fire
2020-04-23 21:02:54 -04:00
parent 3055951e8a
commit 0e2cbcf808
3 changed files with 19 additions and 16 deletions
+14 -11
View File
@@ -48,15 +48,19 @@ module.exports = class BattleCommand extends Command {
battle.attacker.changeGuard();
battle.reset(false);
} else if (choice === 'special') {
const miss = Math.floor(Math.random() * 3);
if (miss) {
const miss = Math.floor(Math.random() * 5);
if (miss === 0 || miss === 3) {
await msg.say(`${battle.attacker}'s special attack missed!`);
} else {
const damage = randomRange(battle.defender.guard ? 50 : 100, battle.defender.guard ? 100 : 150);
await msg.say(`${battle.attacker} deals **${damage}** damage!`);
} else if (miss === 1 || miss === 5) {
const damage = randomRange(battle.defender.guard ? 10 : 40, battle.defender.guard ? 40 : 100);
await msg.say(`${battle.attacker}'s special attack grazed the opponent, dealing **${damage}** damage!`);
battle.defender.dealDamage(damage);
} else if (miss === 2) {
const damage = randomRange(battle.defender.guard ? 20 : 80, battle.defender.guard ? 80 : 200);
await msg.say(`${battle.attacker}'s special attack hit directly, dealing **${damage}** damage!`);
battle.defender.dealDamage(damage);
}
battle.attacker.useMP(50);
battle.attacker.useMP(25);
battle.reset();
} else if (choice === 'cure') {
const amount = Math.round(battle.attacker.mp / 2);
@@ -65,9 +69,9 @@ module.exports = class BattleCommand extends Command {
battle.attacker.useMP(battle.attacker.mp);
battle.reset();
} else if (choice === 'final') {
await msg.say(`${battle.attacker} uses their final move, dealing **150** damage!`);
battle.defender.dealDamage(150);
battle.attacker.useMP(100);
await msg.say(`${battle.attacker} uses their final move, dealing **100** damage!`);
battle.defender.dealDamage(100);
battle.attacker.useMP(50);
battle.attacker.usedFinal = true;
battle.reset();
} else if (choice === 'run') {
@@ -80,9 +84,8 @@ module.exports = class BattleCommand extends Command {
await msg.say('I do not understand what you want to do.');
}
}
const { winner } = battle;
this.client.games.delete(msg.channel.id);
return msg.say(`The match is over! Congrats, ${winner}!`);
return msg.say(`The match is over! Congrats, ${battle.winner}!`);
} catch (err) {
this.client.games.delete(msg.channel.id);
throw err;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "113.15.3",
"version": "113.15.4",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {
+4 -4
View File
@@ -27,7 +27,7 @@ module.exports = class Battler {
**${this.battle.opponent.user.tag}:** ${this.battle.opponent.hp} HP
`;
if (this.battle.turn === 1 || this.battle.turn === 2) {
content += '\n\n_Special uses 50 MP whether or not it hits. Cure takes remaining MP and heals half that amount._';
content += '\n\n_Special uses 25 MP whether or not it hits. Cure takes remaining MP and heals half that amount._';
}
await msg.say(content);
const filter = res => {
@@ -38,7 +38,7 @@ module.exports = class Battler {
return false;
}
if (choice === 'final' && !this.canFinal) {
msg.say('You must have under 100 HP and over 100 MP. Final can only be used once!').catch(() => null);
msg.say('You must have under 100 HP and over 50 MP. Final can only be used once!').catch(() => null);
return false;
}
return true;
@@ -83,11 +83,11 @@ module.exports = class Battler {
}
get canSpecial() {
return this.mp >= 50;
return this.mp >= 25;
}
get canFinal() {
return this.hp < 100 && this.mp >= 100 && !this.usedFinal;
return this.hp < 100 && this.mp >= 50 && !this.usedFinal;
}
toString() {