[Bug] Make Destiny Bond fail when used consecutively in accordance with Gen VII+ implementation (#3504)
* make destiny bond fail on consecutive turns * Update move.ts to remove .length shorthand Co-authored-by: schmidtc1 <62030095+schmidtc1@users.noreply.github.com> * change 'turnMove' variable name Co-authored-by: Mumble <171087428+frutescens@users.noreply.github.com> * update variable names Co-authored-by: Mumble <171087428+frutescens@users.noreply.github.com> * add comments * Replace tabs with spaces --------- Co-authored-by: schmidtc1 <62030095+schmidtc1@users.noreply.github.com> Co-authored-by: Mumble <171087428+frutescens@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
This commit is contained in:
parent
4cea71c400
commit
0d7c335cd9
|
@ -3,7 +3,7 @@ import { BattleStat, getBattleStatName } from "./battle-stat";
|
|||
import { EncoreTag, GulpMissileTag, HelpingHandTag, SemiInvulnerableTag, ShellTrapTag, StockpilingTag, TrappedTag, TypeBoostTag } from "./battler-tags";
|
||||
import { getPokemonNameWithAffix } from "../messages";
|
||||
import Pokemon, { AttackMoveResult, EnemyPokemon, HitResult, MoveResult, PlayerPokemon, PokemonMove, TurnMove } from "../field/pokemon";
|
||||
import { StatusEffect, getStatusEffectHealText, isNonVolatileStatusEffect, getNonVolatileStatusEffects} from "./status-effect";
|
||||
import { StatusEffect, getStatusEffectHealText, isNonVolatileStatusEffect, getNonVolatileStatusEffects } from "./status-effect";
|
||||
import { getTypeResistances, Type } from "./type";
|
||||
import { Constructor } from "#app/utils";
|
||||
import * as Utils from "../utils";
|
||||
|
@ -6854,7 +6854,16 @@ export function initMoves() {
|
|||
.attr(ExposedMoveAttr, BattlerTagType.IGNORE_GHOST),
|
||||
new SelfStatusMove(Moves.DESTINY_BOND, Type.GHOST, -1, 5, -1, 0, 2)
|
||||
.ignoresProtect()
|
||||
.attr(DestinyBondAttr),
|
||||
.attr(DestinyBondAttr)
|
||||
.condition((user, target, move) => {
|
||||
// Retrieves user's previous move, returns empty array if no moves have been used
|
||||
const lastTurnMove = user.getLastXMoves(1);
|
||||
// Checks last move and allows destiny bond to be used if:
|
||||
// - no previous moves have been made
|
||||
// - the previous move used was not destiny bond
|
||||
// - the previous move was unsuccessful
|
||||
return lastTurnMove.length === 0 || lastTurnMove[0].move !== move.id || lastTurnMove[0].result !== MoveResult.SUCCESS;
|
||||
}),
|
||||
new StatusMove(Moves.PERISH_SONG, Type.NORMAL, -1, 5, -1, 0, 2)
|
||||
.attr(FaintCountdownAttr)
|
||||
.ignoresProtect()
|
||||
|
|
Loading…
Reference in New Issue