Spaces:
Running
Running
File size: 7,510 Bytes
5c2ed06 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
/**
* Status worked very differently in Gen 1.
* - Sleep lasted longer, had no reset on switch and took a whole turn to wake up.
* - Frozen only thaws when hit by fire or Haze.
*
* Stat boosts (-speed, -atk) also worked differently, so they are
* separated as volatile statuses that are applied on switch in, removed
* under certain conditions and re-applied under other conditions.
*/
export const Conditions: import('../../../sim/dex-conditions').ModdedConditionDataTable = {
brn: {
name: 'brn',
effectType: 'Status',
onStart(target) {
this.add('-status', target, 'brn');
},
onAfterMoveSelfPriority: 2,
onAfterMoveSelf(pokemon) {
const toxicCounter = pokemon.volatiles['residualdmg'] ? pokemon.volatiles['residualdmg'].counter : 1;
this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1) * toxicCounter, pokemon);
if (pokemon.volatiles['residualdmg']) {
this.hint("In Gen 1, Toxic's counter is retained after Rest and applies to PSN/BRN.", true);
}
},
onAfterSwitchInSelf(pokemon) {
this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
},
},
par: {
name: 'par',
effectType: 'Status',
onStart(target) {
this.add('-status', target, 'par');
},
onBeforeMovePriority: 2,
onBeforeMove(pokemon) {
if (this.randomChance(63, 256)) {
this.add('cant', pokemon, 'par');
pokemon.removeVolatile('bide');
if (pokemon.removeVolatile('twoturnmove')) {
if (pokemon.volatiles['invulnerability']) {
this.hint(`In Gen 1, when a Dig/Fly user is fully paralyzed while semi-invulnerable, ` +
`it will remain semi-invulnerable until it switches out or fully executes Dig/Fly`, true);
}
}
pokemon.removeVolatile('partialtrappinglock');
pokemon.removeVolatile('lockedmove');
return false;
}
},
},
slp: {
name: 'slp',
effectType: 'Status',
onStart(target, source, sourceEffect) {
if (sourceEffect && sourceEffect.effectType === 'Move') {
this.add('-status', target, 'slp', `[from] move: ${sourceEffect.name}`);
} else {
this.add('-status', target, 'slp');
}
// 1-7 turns
this.effectState.startTime = this.random(1, 8);
this.effectState.time = this.effectState.startTime;
if (target.removeVolatile('nightmare')) {
this.add('-end', target, 'Nightmare', '[silent]');
}
},
onBeforeMovePriority: 10,
onBeforeMove(pokemon, target, move) {
pokemon.statusState.time--;
if (pokemon.statusState.time > 0) {
this.add('cant', pokemon, 'slp');
}
pokemon.lastMove = null;
return false;
},
onAfterMoveSelfPriority: 3,
onAfterMoveSelf(pokemon) {
if (pokemon.statusState.time <= 0) pokemon.cureStatus();
},
},
frz: {
name: 'frz',
effectType: 'Status',
onStart(target) {
this.add('-status', target, 'frz');
},
onBeforeMovePriority: 12,
onBeforeMove(pokemon, target, move) {
this.add('cant', pokemon, 'frz');
pokemon.lastMove = null;
return false;
},
onAfterMoveSecondary(target, source, move) {
if (move.secondary && move.secondary.status === 'brn') {
target.cureStatus();
}
},
},
psn: {
name: 'psn',
effectType: 'Status',
onStart(target) {
this.add('-status', target, 'psn');
},
onAfterMoveSelfPriority: 2,
onAfterMoveSelf(pokemon) {
const toxicCounter = pokemon.volatiles['residualdmg'] ? pokemon.volatiles['residualdmg'].counter : 1;
this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1) * toxicCounter, pokemon);
if (pokemon.volatiles['residualdmg']) {
this.hint("In Gen 1, Toxic's counter is retained after Rest and applies to PSN/BRN.", true);
}
},
onAfterSwitchInSelf(pokemon) {
this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
},
},
tox: {
inherit: true,
onAfterMoveSelfPriority: 2,
},
confusion: {
name: 'confusion',
// this is a volatile status
onStart(target, source, sourceEffect) {
if (sourceEffect && sourceEffect.id === 'lockedmove') {
this.add('-start', target, 'confusion', '[silent]');
} else {
this.add('-start', target, 'confusion');
}
this.effectState.time = this.random(2, 6);
},
onEnd(target) {
this.add('-end', target, 'confusion');
},
onBeforeMovePriority: 3,
onBeforeMove(pokemon, target) {
pokemon.volatiles['confusion'].time--;
if (!pokemon.volatiles['confusion'].time) {
pokemon.removeVolatile('confusion');
return;
}
this.add('-activate', pokemon, 'confusion');
if (!this.randomChance(128, 256)) {
const damage = Math.floor(Math.floor((
(Math.floor(2 * pokemon.level / 5) + 2) * pokemon.getStat('atk') * 40
) / pokemon.getStat('def', false)) / 50) + 2;
this.directDamage(damage, pokemon, target);
pokemon.removeVolatile('bide');
pokemon.removeVolatile('twoturnmove');
pokemon.removeVolatile('invulnerability');
pokemon.removeVolatile('partialtrappinglock');
pokemon.removeVolatile('lockedmove');
return false;
}
},
},
flinch: {
name: 'flinch',
duration: 1,
onStart(target) {
target.removeVolatile('mustrecharge');
},
onBeforeMovePriority: 8,
onBeforeMove(pokemon) {
if (!this.runEvent('Flinch', pokemon)) {
return;
}
this.add('cant', pokemon, 'flinch');
return false;
},
},
trapped: {
name: 'trapped',
noCopy: true,
onTrapPokemon(pokemon) {
if (!this.effectState.source?.isActive) {
delete pokemon.volatiles['trapped'];
return;
}
pokemon.trapped = true;
},
},
partiallytrapped: {
name: 'partiallytrapped',
duration: 2,
onBeforeMovePriority: 9,
onBeforeMove(pokemon) {
this.add('cant', pokemon, 'partiallytrapped');
return false;
},
},
partialtrappinglock: {
name: 'partialtrappinglock',
durationCallback() {
const duration = this.sample([2, 2, 2, 3, 3, 3, 4, 5]);
return duration;
},
onStart(target, source, effect) {
this.effectState.move = effect.id;
},
onDisableMove(pokemon) {
if (!pokemon.hasMove(this.effectState.move)) {
return;
}
for (const moveSlot of pokemon.moveSlots) {
if (moveSlot.id !== this.effectState.move) {
pokemon.disableMove(moveSlot.id);
}
}
},
},
mustrecharge: {
inherit: true,
duration: 0,
onBeforeMovePriority: 7,
onStart() {},
},
lockedmove: {
// Thrash and Petal Dance.
name: 'lockedmove',
onStart(target, source, effect) {
this.effectState.move = effect.id;
this.effectState.time = this.random(2, 4);
this.effectState.accuracy = 255;
},
onLockMove() {
return this.effectState.move;
},
onBeforeTurn(pokemon) {
const move = this.dex.moves.get(this.effectState.move);
if (move.id) {
this.debug('Forcing into ' + move.id);
this.queue.changeAction(pokemon, { choice: 'move', moveid: move.id });
}
},
},
twoturnmove: {
// Skull Bash, Solar Beam, ...
name: 'twoturnmove',
onStart(attacker, defender, effect) {
// ("attacker" is the Pokemon using the two turn move and the Pokemon this condition is being applied to)
this.effectState.move = effect.id;
this.effectState.sourceEffect = effect.sourceEffect;
this.attrLastMove('[still]');
},
onLockMove() {
return this.effectState.move;
},
},
invulnerability: {
// Dig/Fly
name: 'invulnerability',
onInvulnerability(target, source, move) {
if (target === source) return true;
if (move.id === 'swift' || move.id === 'transform') return true;
this.add('-message', 'The foe ' + target.name + ' can\'t be hit while invulnerable!');
return false;
},
},
};
|