Skip to content

Commit

Permalink
Improve battle modules
Browse files Browse the repository at this point in the history
Add handlers for futuresight, snore and dreameater
  • Loading branch information
AgustinSRG committed Aug 27, 2016
1 parent 6f56a23 commit 2525b90
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/bot-modules/battle/battle-ai/calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,12 @@ exports.calculate = function (pokeA, pokeB, move, conditionsA, conditionsB, gcon
bp = (Math.floor(25 * statsB.spe / statsA.spe) || 1);
if (bp > 150) bp = 150;
break;
case "snore":
if (pokeA.status !== 'slp') bp = 0;
break;
case "dreameater":
if (pokeB.status !== 'slp') bp = 0;
break;
}

if (!bp) {
Expand Down
4 changes: 2 additions & 2 deletions src/bot-modules/battle/battle-ai/modules/ingame-nostatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ exports.id = "ingame-nostatus";
/*
* Bad moves for 1v1
*/
const BadMoves = ['focuspunch', 'explosion', 'selfdestruct', 'lastresort', 'dreameater', 'snore'];
const BadMoves = ['focuspunch', 'explosion', 'selfdestruct', 'lastresort', 'futuresight'];

/*
* Moves which require 2 turs without any protection
* Moves which require 2 turns without any protection
*/
const DoubleTurnMoves = ['solarbeam'];

Expand Down
5 changes: 5 additions & 0 deletions src/bot-modules/battle/battle-ai/modules/singles-eff.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,11 @@ let getViableDamageMoves = exports.getViableDamageMoves = function (battle, deci
res.immune.push(decisions[i]);
continue;
}
} else if (move.id === "futuresight") {
if (battle.self.active[0].volatiles && battle.self.active[0].volatiles['futuresight']) {
res.immune.push(decisions[i]);
continue;
}
}
res.total++;
if (pc >= 100) {
Expand Down

0 comments on commit 2525b90

Please sign in to comment.