diff --git a/data/abilities.ts b/data/abilities.ts index 3b40db8770..437408f24d 100644 --- a/data/abilities.ts +++ b/data/abilities.ts @@ -1944,7 +1944,7 @@ export const Abilities: {[abilityid: string]: AbilityData} = { shortDesc: "This Pokemon's sound-based moves become Water type.", onModifyTypePriority: -1, onModifyType(move, pokemon) { - if (move.flags['sound'] && !pokemon.volatiles.dynamax) { // hardcode + if (move.flags['sound'] && !pokemon.volatiles['dynamax']) { // hardcode move.type = 'Water'; } }, diff --git a/data/conditions.ts b/data/conditions.ts index c685d89bb6..f6cc83d282 100644 --- a/data/conditions.ts +++ b/data/conditions.ts @@ -162,8 +162,8 @@ export const Conditions: {[k: string]: ConditionData} = { }, onBeforeMovePriority: 3, onBeforeMove(pokemon) { - pokemon.volatiles.confusion.time--; - if (!pokemon.volatiles.confusion.time) { + pokemon.volatiles['confusion'].time--; + if (!pokemon.volatiles['confusion'].time) { pokemon.removeVolatile('confusion'); return; } diff --git a/data/items.ts b/data/items.ts index 0a6e7c9475..4129dc92da 100644 --- a/data/items.ts +++ b/data/items.ts @@ -886,7 +886,7 @@ export const Items: {[itemid: string]: ItemData} = { }, onStart(pokemon) { if (pokemon.volatiles['choicelock']) { - this.debug('removing choicelock: ' + pokemon.volatiles.choicelock); + this.debug('removing choicelock: ' + pokemon.volatiles['choicelock']); } pokemon.removeVolatile('choicelock'); }, @@ -911,7 +911,7 @@ export const Items: {[itemid: string]: ItemData} = { }, onStart(pokemon) { if (pokemon.volatiles['choicelock']) { - this.debug('removing choicelock: ' + pokemon.volatiles.choicelock); + this.debug('removing choicelock: ' + pokemon.volatiles['choicelock']); } pokemon.removeVolatile('choicelock'); }, @@ -935,7 +935,7 @@ export const Items: {[itemid: string]: ItemData} = { }, onStart(pokemon) { if (pokemon.volatiles['choicelock']) { - this.debug('removing choicelock: ' + pokemon.volatiles.choicelock); + this.debug('removing choicelock: ' + pokemon.volatiles['choicelock']); } pokemon.removeVolatile('choicelock'); }, @@ -1232,7 +1232,7 @@ export const Items: {[itemid: string]: ItemData} = { onAttract(target, source) { this.debug('attract intercepted: ' + target + ' from ' + source); if (!source || source === target) return; - if (!source.volatiles.attract) source.addVolatile('attract', target); + if (!source.volatiles['attract']) source.addVolatile('attract', target); }, num: 280, gen: 4, diff --git a/data/mods/gen1/conditions.ts b/data/mods/gen1/conditions.ts index 0d56329c33..8d56698934 100644 --- a/data/mods/gen1/conditions.ts +++ b/data/mods/gen1/conditions.ts @@ -138,8 +138,8 @@ export const Conditions: {[k: string]: ModdedConditionData} = { }, onBeforeMovePriority: 3, onBeforeMove(pokemon, target) { - pokemon.volatiles.confusion.time--; - if (!pokemon.volatiles.confusion.time) { + pokemon.volatiles['confusion'].time--; + if (!pokemon.volatiles['confusion'].time) { pokemon.removeVolatile('confusion'); return; } diff --git a/data/mods/gen2/conditions.ts b/data/mods/gen2/conditions.ts index f284ffca9b..ff5bf2a901 100644 --- a/data/mods/gen2/conditions.ts +++ b/data/mods/gen2/conditions.ts @@ -123,8 +123,8 @@ export const Conditions: {[k: string]: ModdedConditionData} = { } }, onBeforeMove(pokemon, target, move) { - pokemon.volatiles.confusion.time--; - if (!pokemon.volatiles.confusion.time) { + pokemon.volatiles['confusion'].time--; + if (!pokemon.volatiles['confusion'].time) { pokemon.removeVolatile('confusion'); return; } diff --git a/data/mods/gen4/items.ts b/data/mods/gen4/items.ts index 29350b8fbf..e052b550ee 100644 --- a/data/mods/gen4/items.ts +++ b/data/mods/gen4/items.ts @@ -203,7 +203,7 @@ export const Items: {[k: string]: ModdedItemData} = { }, }, onUpdate(pokemon) { - if (pokemon.volatiles.attract && pokemon.useItem()) { + if (pokemon.volatiles['attract'] && pokemon.useItem()) { pokemon.removeVolatile('attract'); this.add('-end', pokemon, 'move: Attract', '[from] item: Mental Herb'); } diff --git a/data/mods/gen4/moves.ts b/data/mods/gen4/moves.ts index 2d8bf8eecd..739c0e451c 100644 --- a/data/mods/gen4/moves.ts +++ b/data/mods/gen4/moves.ts @@ -1570,7 +1570,7 @@ export const Moves: {[k: string]: ModdedMoveData} = { desc: "Fails if the target did not select a physical or special attack for use this turn, or if the target moves before the user.", onTry(source, target) { const action = this.queue.willMove(target); - if (!action || action.choice !== 'move' || action.move.category === 'Status' || target.volatiles.mustrecharge) { + if (!action || action.choice !== 'move' || action.move.category === 'Status' || target.volatiles['mustrecharge']) { this.add('-fail', source); return null; } diff --git a/data/mods/gen6/conditions.ts b/data/mods/gen6/conditions.ts index 06583acd90..8de8ae1e66 100644 --- a/data/mods/gen6/conditions.ts +++ b/data/mods/gen6/conditions.ts @@ -16,8 +16,8 @@ export const Conditions: {[k: string]: ModdedConditionData} = { confusion: { inherit: true, onBeforeMove(pokemon) { - pokemon.volatiles.confusion.time--; - if (!pokemon.volatiles.confusion.time) { + pokemon.volatiles['confusion'].time--; + if (!pokemon.volatiles['confusion'].time) { pokemon.removeVolatile('confusion'); return; } diff --git a/data/mods/gennext/abilities.ts b/data/mods/gennext/abilities.ts index 0ba7d1951e..00eafce9ac 100644 --- a/data/mods/gennext/abilities.ts +++ b/data/mods/gennext/abilities.ts @@ -597,7 +597,7 @@ export const Abilities: {[k: string]: ModdedAbilityData} = { inherit: true, onResidualPriority: -1, onResidual(pokemon) { - if (pokemon.activeTurns && !pokemon.volatiles.stall) { + if (pokemon.activeTurns && !pokemon.volatiles['stall']) { this.boost({spe: 1}); } }, @@ -677,7 +677,7 @@ export const Abilities: {[k: string]: ModdedAbilityData} = { onFoeMaybeTrapPokemon(pokemon, source) { if (!source) source = this.effectData.target; if (!source || !this.isAdjacent(pokemon, source)) return; - if (pokemon.ability !== 'shadowtag' && !source.volatiles.shadowtag) { + if (pokemon.ability !== 'shadowtag' && !source.volatiles['shadowtag']) { pokemon.maybeTrapped = true; } }, diff --git a/data/mods/gennext/conditions.ts b/data/mods/gennext/conditions.ts index 8bc6bdcb9a..dd01a03018 100644 --- a/data/mods/gennext/conditions.ts +++ b/data/mods/gennext/conditions.ts @@ -62,8 +62,8 @@ export const Conditions: {[k: string]: ModdedConditionData} = { this.add('-end', target, 'confusion'); }, onBeforeMove(pokemon) { - pokemon.volatiles.confusion.time--; - if (!pokemon.volatiles.confusion.time) { + pokemon.volatiles['confusion'].time--; + if (!pokemon.volatiles['confusion'].time) { pokemon.removeVolatile('confusion'); return; } diff --git a/data/mods/gennext/moves.ts b/data/mods/gennext/moves.ts index 3b8c800606..9a69b7f12f 100644 --- a/data/mods/gennext/moves.ts +++ b/data/mods/gennext/moves.ts @@ -194,7 +194,7 @@ export const Moves: {[k: string]: ModdedMoveData} = { }, onTryHitPriority: 3, onTryHit(target, source, move) { - if (target.volatiles.substitute || !move.flags['protect']) return; + if (target.volatiles['substitute'] || !move.flags['protect']) return; this.add('-activate', target, 'Protect'); const lockedmove = source.getVolatile('lockedmove'); if (lockedmove) { @@ -216,7 +216,7 @@ export const Moves: {[k: string]: ModdedMoveData} = { }, onTryHitPriority: 3, onTryHit(target, source, move) { - if (target.volatiles.substitute || !move.flags['protect'] || move.category === 'Status') return; + if (target.volatiles['substitute'] || !move.flags['protect'] || move.category === 'Status') return; this.add('-activate', target, 'Protect'); const lockedmove = source.getVolatile('lockedmove'); if (lockedmove) { @@ -241,7 +241,7 @@ export const Moves: {[k: string]: ModdedMoveData} = { }, onTryHitPriority: 3, onTryHit(target, source, move) { - if (target.volatiles.substitute || !move.flags['protect']) return; + if (target.volatiles['substitute'] || !move.flags['protect']) return; if (move && (move.target === 'self' || move.id === 'suckerpunch')) return; this.add('-activate', target, 'move: Protect'); if (move.flags['contact']) { diff --git a/data/mods/ssb/scripts.ts b/data/mods/ssb/scripts.ts index 6b57aeed8e..2bacf10dac 100644 --- a/data/mods/ssb/scripts.ts +++ b/data/mods/ssb/scripts.ts @@ -68,7 +68,7 @@ export const Scripts: ModdedBattleScriptsData = { // Dancer Petal Dance hack // TODO: implement properly - const noLock = externalMove && !pokemon.volatiles.lockedmove; + const noLock = externalMove && !pokemon.volatiles['lockedmove']; if (zMove) { if (pokemon.illusion) { @@ -104,7 +104,7 @@ export const Scripts: ModdedBattleScriptsData = { this.runMove(move.id, dancer, 0, this.dex.getAbility('dancer'), undefined, true); } } - if (noLock && pokemon.volatiles.lockedmove) delete pokemon.volatiles.lockedmove; + if (noLock && pokemon.volatiles['lockedmove']) delete pokemon.volatiles['lockedmove']; }, // Modded to allow arrays as Mega Stone options canMegaEvo(pokemon) { diff --git a/data/moves.ts b/data/moves.ts index e44c206eda..1dd8265f84 100644 --- a/data/moves.ts +++ b/data/moves.ts @@ -3140,7 +3140,7 @@ export const Moves: {[moveid: string]: MoveData} = { delete move.volatileStatus; delete move.onHit; move.self = {boosts: {spe: -1, atk: 1, def: 1}}; - } else if (move.volatileStatus && target.volatiles.curse) { + } else if (move.volatileStatus && target.volatiles['curse']) { return false; } }, @@ -6176,10 +6176,10 @@ export const Moves: {[moveid: string]: MoveData} = { accuracy: 95, basePower: 40, basePowerCallback(pokemon, target, move) { - if (!pokemon.volatiles.furycutter || move.hit === 1) { + if (!pokemon.volatiles['furycutter'] || move.hit === 1) { pokemon.addVolatile('furycutter'); } - return this.clampIntRange(move.basePower * pokemon.volatiles.furycutter.multiplier, 1, 160); + return this.clampIntRange(move.basePower * pokemon.volatiles['furycutter'].multiplier, 1, 160); }, category: "Physical", desc: "Power doubles with each successful hit, up to a maximum of 160 power. The power is reset if this move misses or another move is used.", @@ -9274,11 +9274,11 @@ export const Moves: {[moveid: string]: MoveData} = { basePower: 30, basePowerCallback(pokemon, target, move) { let bp = move.basePower; - if (pokemon.volatiles.iceball && pokemon.volatiles.iceball.hitCount) { - bp *= Math.pow(2, pokemon.volatiles.iceball.hitCount); + if (pokemon.volatiles['iceball'] && pokemon.volatiles['iceball'].hitCount) { + bp *= Math.pow(2, pokemon.volatiles['iceball'].hitCount); } if (pokemon.status !== 'slp') pokemon.addVolatile('iceball'); - if (pokemon.volatiles.defensecurl) { + if (pokemon.volatiles['defensecurl']) { bp *= 2; } this.debug("Ice Ball bp: " + bp); @@ -15433,11 +15433,11 @@ export const Moves: {[moveid: string]: MoveData} = { basePower: 30, basePowerCallback(pokemon, target, move) { let bp = move.basePower; - if (pokemon.volatiles.rollout && pokemon.volatiles.rollout.hitCount) { - bp *= Math.pow(2, pokemon.volatiles.rollout.hitCount); + if (pokemon.volatiles['rollout'] && pokemon.volatiles['rollout'].hitCount) { + bp *= Math.pow(2, pokemon.volatiles['rollout'].hitCount); } if (pokemon.status !== 'slp') pokemon.addVolatile('rollout'); - if (pokemon.volatiles.defensecurl) { + if (pokemon.volatiles['defensecurl']) { bp *= 2; } this.debug("Rollout bp: " + bp); @@ -18503,7 +18503,7 @@ export const Moves: {[moveid: string]: MoveData} = { onTry(source, target) { const action = this.queue.willMove(target); const move = action?.choice === 'move' ? action.move : null; - if (!move || (move.category === 'Status' && move.id !== 'mefirst') || target.volatiles.mustrecharge) { + if (!move || (move.category === 'Status' && move.id !== 'mefirst') || target.volatiles['mustrecharge']) { this.add('-fail', source); this.attrLastMove('[still]'); return null; diff --git a/data/scripts.ts b/data/scripts.ts index d628fea8c5..a155ae33fc 100644 --- a/data/scripts.ts +++ b/data/scripts.ts @@ -86,7 +86,7 @@ export const Scripts: BattleScriptsData = { // Dancer Petal Dance hack // TODO: implement properly - const noLock = externalMove && !pokemon.volatiles.lockedmove; + const noLock = externalMove && !pokemon.volatiles['lockedmove']; if (zMove) { if (pokemon.illusion) { @@ -127,7 +127,7 @@ export const Scripts: BattleScriptsData = { this.runMove(move.id, dancer, this.getTargetLoc(dancersTarget, dancer), this.dex.getAbility('dancer'), undefined, true); } } - if (noLock && pokemon.volatiles.lockedmove) delete pokemon.volatiles.lockedmove; + if (noLock && pokemon.volatiles['lockedmove']) delete pokemon.volatiles['lockedmove']; }, /** * useMove is the "inside" move caller. It handles effects of the diff --git a/sim/pokemon.ts b/sim/pokemon.ts index 3c1f9f58e0..bec6e21c32 100644 --- a/sim/pokemon.ts +++ b/sim/pokemon.ts @@ -1071,7 +1071,7 @@ export class Pokemon { this.weighthg = pokemon.weighthg; const types = pokemon.getTypes(true); - this.setType(pokemon.volatiles.roost ? pokemon.volatiles.roost.typeWas : types, true); + this.setType(pokemon.volatiles['roost'] ? pokemon.volatiles['roost'].typeWas : types, true); this.addedType = pokemon.addedType; this.knownType = this.side === pokemon.side && pokemon.knownType; this.apparentType = pokemon.apparentType; @@ -1275,8 +1275,8 @@ export class Pokemon { this.removeLinkedVolatiles(this.volatiles[i].linkedStatus, this.volatiles[i].linkedPokemon); } } - if (this.species.name === 'Eternatus-Eternamax' && this.volatiles.dynamax) { - this.volatiles = {dynamax: this.volatiles.dynamax}; + if (this.species.name === 'Eternatus-Eternamax' && this.volatiles['dynamax']) { + this.volatiles = {dynamax: this.volatiles['dynamax']}; } else { this.volatiles = {}; } diff --git a/test/sim/abilities/dazzling.js b/test/sim/abilities/dazzling.js index 1da72adbee..90e92c506a 100644 --- a/test/sim/abilities/dazzling.js +++ b/test/sim/abilities/dazzling.js @@ -29,6 +29,6 @@ describe('Dazzling', function () { battle.makeChoices('move swordsdance', 'move perishsong'); battle.makeChoices('move sleeptalk', 'move haze'); assert.equal(battle.p1.active[0].boosts.atk, 0); - assert.false(battle.p1.active[0].volatiles.perishsong); + assert.false(battle.p1.active[0].volatiles['perishsong']); }); }); diff --git a/test/sim/abilities/prankster.js b/test/sim/abilities/prankster.js index 46d8c3aa46..0b3c805147 100644 --- a/test/sim/abilities/prankster.js +++ b/test/sim/abilities/prankster.js @@ -69,7 +69,7 @@ describe('Prankster', function () { battle.makeChoices('move encore 1, move calmmind', 'move frustration 2, move agility'); battle.makeChoices('move encore 1, move calmmind', 'move leer, move agility'); - assert(battle.p2.active[0].volatiles.encore, `Meowstic should be encored`); + assert(battle.p2.active[0].volatiles['encore'], `Meowstic should be encored`); assert.fullHP(battle.p1.active[0]); }); });