Add more hints to Gen 1 & 4, migrate others to Battle#hint (#5258)

This commit is contained in:
Kirk Scheibelhut 2019-03-06 09:24:47 -08:00 committed by Guangcong Luo
parent f2d491db29
commit a04d4da992
13 changed files with 53 additions and 33 deletions

View File

@ -564,12 +564,14 @@ let BattleMovedex = {
}
// We check if leeched Pokémon has Toxic to increase leeched damage.
let toxicCounter = 1;
if (pokemon.volatiles['residualdmg']) {
pokemon.volatiles['residualdmg'].counter++;
toxicCounter = pokemon.volatiles['residualdmg'].counter;
let residualdmg = pokemon.volatiles['residualdmg'];
if (residualdmg) {
residualdmg.counter++;
toxicCounter = residualdmg.counter;
}
let toLeech = this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1) * toxicCounter;
let damage = this.damage(toLeech, pokemon, leecher);
if (residualdmg) this.hint("In Gen 1, Leech Seed's damage is affected by Toxic's counter.", true);
if (damage) this.heal(damage, leecher, pokemon);
},
},
@ -738,6 +740,7 @@ let BattleMovedex = {
onHit(target) {
// Fail when health is 255 or 511 less than max
if (target.hp === (target.maxhp - 255) || target.hp === (target.maxhp - 511) || target.hp === target.maxhp) {
this.hint("In Gen 1, recovery moves fail if (user's maximum HP - user's current HP + 1) is divisible by 256.");
return false;
}
this.heal(Math.floor(target.maxhp / 2), target, target);
@ -858,6 +861,7 @@ let BattleMovedex = {
onHit(target) {
// Fail when health is 255 or 511 less than max
if (target.hp === (target.maxhp - 255) || target.hp === (target.maxhp - 511) || target.hp === target.maxhp) {
this.hint("In Gen 1, recovery moves fail if (user's maximum HP - user's current HP + 1) is divisible by 256.");
return false;
}
this.heal(Math.floor(target.maxhp / 2), target, target);

View File

@ -129,6 +129,7 @@ let BattleScripts = {
moveSlot.pp = 63;
pokemon.isStale = 2;
pokemon.isStaleSource = 'ppoverflow';
this.hint('In Gen 1, if a player is forced to use a move with 0 PP, the move will underflow to have 63 PP.');
}
}
this.useMove(move, pokemon, target, sourceEffect);
@ -257,7 +258,6 @@ let BattleScripts = {
// It deals with partial trapping weirdness and accuracy bugs as well.
tryMoveHit(target, pokemon, move) {
let boostTable = [1, 4 / 3, 5 / 3, 2, 7 / 3, 8 / 3, 3];
let doSelfDestruct = true;
/** @type {number | false | undefined} */
let damage = 0;
@ -327,6 +327,7 @@ let BattleScripts = {
if (accuracy !== true && !this.randomChance(accuracy, 256)) {
this.attrLastMove('[miss]');
this.add('-miss', pokemon);
if (accuracy === 255) this.hint('In Gen 1, moves with 100% accurracy can still miss 1/256 of the time.');
damage = false;
}
@ -372,10 +373,12 @@ let BattleScripts = {
target.gotAttacked(move, damage, pokemon);
}
// Checking if substitute fainted
if (target.subFainted) doSelfDestruct = false;
if (move.selfdestruct && doSelfDestruct) {
this.faint(pokemon, pokemon, move);
if (move.selfdestruct) {
if (!target.subFainted) {
this.faint(pokemon, pokemon, move);
} else {
this.hint(`In Gen 1, the user of ${move.name} will not take damage if it breaks a Substitute.`);
}
}
// The move missed.
@ -526,6 +529,9 @@ let BattleScripts = {
// Do not clear recharge in that case.
if (target.setStatus(moveData.status, pokemon, move)) {
target.removeVolatile('mustrecharge');
this.hint(
'In Gen 1, if a Pokémon that has just used Hyper Beam and has yet to recharge is targeted with a sleep inducing move, ' +
'any other status it may already have will be ignored and sleep will be induced regardless.');
}
} else if (!target.status) {
if (target.setStatus(moveData.status, pokemon, move)) {

View File

@ -25,6 +25,9 @@ let BattleStatuses = {
onAfterMoveSelf(pokemon) {
let 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);
}
},
onSwitchIn(pokemon) {
pokemon.addVolatile('brnattackdrop');
@ -116,6 +119,9 @@ let BattleStatuses = {
onAfterMoveSelf(pokemon) {
let 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));

View File

@ -852,8 +852,8 @@ let BattleMovedex = {
move.secondaries = move.secondaries.filter(p => !p.kingsrock);
}
if (move.drain) {
this.add('-hint', "In Gold/Silver/Crystal, draining moves always miss against Substitute.");
this.add('-miss', source);
this.hint("In Gen 2, draining moves always miss against Substitute.");
return null;
}
if (move.category === 'Status') {

View File

@ -602,7 +602,7 @@ let BattleScripts = {
if (move.crit) {
level *= 2;
}
this.add('hint', 'Gen 2 Present has a glitched damage calculation using the secondary types of the Pokemon for the Attacker\'s Level and Defender\'s Defense.', true);
this.hint('Gen 2 Present has a glitched damage calculation using the secondary types of the Pokemon for the Attacker\'s Level and Defender\'s Defense.', true);
}
// When either attack or defense are higher than 256, they are both divided by 4 and modded by 256.
@ -613,7 +613,7 @@ let BattleScripts = {
attack = this.clampIntRange(Math.floor(attack / 4) % 256, 1);
defense = this.clampIntRange(Math.floor(defense / 4) % 256, 1);
if (defense < defenseBefore || attack < attackBefore) {
this.add('hint', 'In Gen 2, a stat will rollover if it is larger than 1024.', false, attacker.side.id);
this.hint('In Gen 2, a stat will rollover if it is larger than 1024.', false, attacker.side.id);
}
}

View File

@ -247,7 +247,7 @@ let BattleStatuses = {
function residualdmg(battle, pokemon) {
if (pokemon.volatiles['residualdmg']) {
battle.damage(battle.clampIntRange(Math.floor(pokemon.maxhp / 16) * pokemon.volatiles['residualdmg'].counter, 1), pokemon);
battle.hint('In GSC, Toxic\'s counter is retained through Baton Pass/Heal Bell and applies to PSN/BRN.', true);
battle.hint("In Gen 2, Toxic's counter is retained through Baton Pass/Heal Bell and applies to PSN/BRN.", true);
} else {
battle.damage(battle.clampIntRange(Math.floor(pokemon.maxhp / 8), 1), pokemon);
}

View File

@ -434,7 +434,11 @@ let BattleAbilities = {
inherit: true,
shortDesc: "This Pokemon is only damaged by Fire Fang, supereffective moves, indirect damage.",
onTryHit(target, source, move) {
if (target === source || move.category === 'Status' || move.type === '???' || move.id === 'struggle' || move.id === 'firefang') return;
if (move.id === 'firefang') {
this.hint("In Gen 4, Fire Fang is always able to hit through Wonder Guard.");
return;
}
if (target === source || move.category === 'Status' || move.type === '???' || move.id === 'struggle') return;
this.debug('Wonder Guard immunity: ' + move.id);
if (target.runEffectiveness(move) <= 0) {
this.add('-immune', target, '[from] ability: Wonder Guard');

View File

@ -556,7 +556,7 @@ let BattleMovedex = {
onTryHit(target, source) {
if (source.name !== 'Bimp') {
this.add('-fail', source);
this.add('-hint', 'Only Bimp can use Trivia Room.');
this.hint('Only Bimp can use Trivia Room.');
return null;
}
},
@ -696,7 +696,7 @@ let BattleMovedex = {
onTryHit(target, source) {
if (source.name !== 'bumbadadabum') {
this.add('-fail', source);
this.add('-hint', 'Only bumbadadabum can use Wonder Trade.');
this.hint('Only bumbadadabum can use Wonder Trade.');
return null;
}
},
@ -2105,7 +2105,7 @@ let BattleMovedex = {
onTryHit(target, source) {
if (source.name !== 'Lycanium Z') {
this.add('-fail', source);
this.add('-hint', 'Only Lycanium Z can use Purple Pills.');
this.hint('Only Lycanium Z can use Purple Pills.');
return null;
}
},
@ -2235,7 +2235,7 @@ let BattleMovedex = {
this.attrLastMove('[still]');
if (pokemon.hp < pokemon.maxhp && pokemon.status !== 'slp' && !pokemon.hasAbility('comatose')) return;
this.add('-fail', pokemon);
this.add('-hint', 'Nap Time fails if the user has full health, is already asleep, or has Comatose.');
this.hint('Nap Time fails if the user has full health, is already asleep, or has Comatose.');
return null;
},
onPrepareHit(target, source) {
@ -3997,7 +3997,7 @@ let BattleMovedex = {
beforeMoveCallback(pokemon) {
if (!pokemon.volatiles['cutieescape'] || !pokemon.volatiles['cutieescape'].tookDamage) {
this.add('-fail', pokemon, 'move: Cutie Escape');
this.add('-hint', 'Cutie Escape only works when Yuki is hit in the same turn the move is used.');
this.hint('Cutie Escape only works when Yuki is hit in the same turn the move is used.');
return true;
}
},
@ -4049,7 +4049,7 @@ let BattleMovedex = {
onTryHit(target, pokemon) {
if (pokemon.name !== 'Zarel') {
this.add('-fail', pokemon);
this.add('-hint', 'Only Zarel can use Relic Song Dance.');
this.hint('Only Zarel can use Relic Song Dance.');
return null;
}
this.attrLastMove('[still]');
@ -4069,7 +4069,7 @@ let BattleMovedex = {
if (pokemon.template.speciesid === 'meloettapirouette') {
pokemon.formeChange('Meloetta');
}
this.add('-hint', 'Zarel still has the Serene Grace ability.');
this.hint('Zarel still has the Serene Grace ability.');
},
effect: {
duration: 1,

View File

@ -56,7 +56,7 @@ let BattleScripts = {
if (!pokemon.deductPP(baseMove, null, target) && (move.id !== 'struggle')) {
this.add('cant', pokemon, 'nopp', move);
let gameConsole = [null, 'Game Boy', 'Game Boy', 'Game Boy Advance', 'DS', 'DS'][this.gen] || '3DS';
this.add('-hint', "This is not a bug, this is really how it works on the " + gameConsole + "; try it yourself if you don't believe us.");
this.hint(`This is not a bug, this is really how it works on the ${gameConsole}; try it yourself if you don't believe us.`);
this.clearActiveMove(true);
pokemon.moveThisTurnResult = false;
return;

View File

@ -3138,7 +3138,7 @@ let BattleMovedex = {
return;
}
this.add('-fail', pokemon, 'move: Dark Void');
this.add('-hint', "Only a Pokemon whose form is Darkrai can use this move.");
this.hint("Only a Pokemon whose form is Darkrai can use this move.");
return null;
},
secondary: null,
@ -4868,7 +4868,7 @@ let BattleMovedex = {
if (pokemon.activeTurns > 1) {
this.attrLastMove('[still]');
this.add('-fail', pokemon);
this.add('-hint', "Fake Out only works on your first turn out.");
this.hint("Fake Out only works on your first turn out.");
return null;
}
},
@ -5237,7 +5237,7 @@ let BattleMovedex = {
if (pokemon.activeTurns > 1) {
this.add('-fail', pokemon);
this.attrLastMove('[still]');
this.add('-hint', "First Impression only works on your first turn out.");
this.hint("First Impression only works on your first turn out.");
return null;
}
},
@ -8267,7 +8267,7 @@ let BattleMovedex = {
if (pokemon.template.species === 'Hoopa-Unbound') {
return;
}
this.add('-hint', "Only a Pokemon whose form is Hoopa Unbound can use this move.");
this.hint("Only a Pokemon whose form is Hoopa Unbound can use this move.");
if (pokemon.template.species === 'Hoopa') {
this.add('-fail', pokemon, 'move: Hyperspace Fury', '[forme]');
return null;
@ -10054,7 +10054,7 @@ let BattleMovedex = {
sideCondition: 'matblock',
onTryHitSide(side, source) {
if (source.activeTurns > 1) {
this.add('-hint', "Mat Block only works on your first turn out.");
this.hint("Mat Block only works on your first turn out.");
return false;
}
},
@ -16461,7 +16461,7 @@ let BattleMovedex = {
this.boost({def: this.effectData.def, spd: this.effectData.spd}, target, target);
this.add('-end', target, 'Stockpile');
if (this.effectData.def !== this.effectData.layers * -1 || this.effectData.spd !== this.effectData.layers * -1) {
this.add('-hint', "In Gen 7, Stockpile keeps track of how many times it successfully altered each stat individually.");
this.hint("In Gen 7, Stockpile keeps track of how many times it successfully altered each stat individually.");
}
},
},

View File

@ -68,7 +68,7 @@ let BattleScripts = {
if (!pokemon.deductPP(baseMove, null, target) && (move.id !== 'struggle')) {
this.add('cant', pokemon, 'nopp', move);
let gameConsole = [null, 'Game Boy', 'Game Boy', 'Game Boy Advance', 'DS', 'DS'][this.gen] || '3DS';
this.add('-hint', "This is not a bug, this is really how it works on the " + gameConsole + "; try it yourself if you don't believe us.");
this.hint(`This is not a bug, this is really how it works on the ${gameConsole}; try it yourself if you don't believe us.`);
this.clearActiveMove(true);
pokemon.moveThisTurnResult = false;
return;
@ -370,7 +370,7 @@ let BattleScripts = {
}
if (this.gen >= 7 && move.pranksterBoosted && pokemon.hasAbility('prankster') && target.side !== pokemon.side && !this.getImmunity('prankster', target)) {
this.debug('natural prankster immunity');
if (!target.illusion) this.add('-hint', "In gen 7, Dark is immune to Prankster moves.");
if (!target.illusion) this.hint("In Gen 7, Dark is immune to Prankster moves.");
this.add('-immune', target);
return false;
}

View File

@ -395,7 +395,7 @@ let BattleStatuses = {
// time's up; time to hit! :D
const move = this.getMove(posData.move);
if (target.fainted || target === posData.source) {
this.add('-hint', '' + move.name + ' did not hit because the target is ' + (target.fainted ? 'fainted' : 'the user') + '.');
this.hint(`${move.name} did not hit because the target is ${(target.fainted ? 'fainted' : 'the user')}.`);
this.effectData.positions[i] = null;
continue;
}

View File

@ -1739,7 +1739,7 @@ export class Battle extends Dex.ModdedDex {
break;
case 'bellydrum2':
this.add(msg, target, i, boostBy, '[silent]');
this.add('-hint', "In Gen 2, Belly Drum boosts by 2 when it fails.");
this.hint("In Gen 2, Belly Drum boosts by 2 when it fails.");
break;
case 'intimidate': case 'gooey': case 'tanglinghair':
this.add(msg, target, i, boostBy);
@ -2717,7 +2717,7 @@ export class Battle extends Dex.ModdedDex {
// in gen 2-4, the switch still happens
action.priority = -101;
this.queue.unshift(action);
this.add('-hint', 'Pursuit target fainted, switch continues in gen 2-4');
this.hint("Previously chosen switches continue in Gen 2-4 after a Pursuit target faints.");
break;
}
// in gen 5+, the switch is cancelled
@ -2725,7 +2725,7 @@ export class Battle extends Dex.ModdedDex {
break;
}
if (action.target.isActive) {
this.add('-hint', 'Switch failed; switch target is already active');
this.hint("A switch failed because the Pokémon trying to switch in is already in.");
break;
}
if (action.choice === 'switch' && action.pokemon.activeTurns === 1) {