diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 0f75447a500..a214e3c8ed7 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -4,7 +4,7 @@ import { NextEncounterPhase, NewBiomeEncounterPhase, SelectBiomePhase, MessagePh import Pokemon, { PlayerPokemon, EnemyPokemon } from './field/pokemon'; import PokemonSpecies, { PokemonSpeciesFilter, allSpecies, getPokemonSpecies, initSpecies, speciesStarters } from './data/pokemon-species'; import * as Utils from './utils'; -import { Modifier, ModifierBar, ConsumablePokemonModifier, ConsumableModifier, PokemonHpRestoreModifier, HealingBoosterModifier, PersistentModifier, PokemonHeldItemModifier, ModifierPredicate, DoubleBattleChanceBoosterModifier, FusePokemonModifier, PokemonFormChangeItemModifier, TerastallizeModifier, overrideModifiers, overrideHeldItems } from './modifier/modifier'; +import { Modifier, ModifierBar, ConsumablePokemonModifier, ConsumableModifier, PokemonHpRestoreModifier, HealingBoosterModifier, PersistentModifier, PokemonHeldItemModifier, ModifierPredicate, DoubleBattleChanceBoosterModifier, FusePokemonModifier, PokemonFormChangeItemModifier, TerastallizeModifier, overrideModifiers, overrideHeldItems, DoubleBattlePreventionModifierType } from './modifier/modifier'; import { PokeballType } from './data/pokeball'; import { initCommonAnims, initMoveAnim, loadCommonAnimAssets, loadMoveAnimAssets, populateAnims } from './data/battle-anims'; import { Phase } from './phase'; @@ -869,10 +869,15 @@ export default class BattleScene extends SceneBase { if (double === undefined && newWaveIndex > 1) { if (newBattleType === BattleType.WILD && !this.gameMode.isWaveFinal(newWaveIndex)) { - const doubleChance = new Utils.IntegerHolder(newWaveIndex % 10 === 0 ? 32 : 8); - this.applyModifiers(DoubleBattleChanceBoosterModifier, true, doubleChance); - playerField.forEach(p => applyAbAttrs(DoubleBattleChanceAbAttr, p, null, doubleChance)); - newDouble = !Utils.randSeedInt(doubleChance.value); + // Check if Repel and prevent double battle + if (this.getModifiers(DoubleBattlePreventionModifierType, true).length > 0) { + newDouble = false; + } else { + const doubleChance = new Utils.IntegerHolder(newWaveIndex % 10 === 0 ? 32 : 8); + this.applyModifiers(DoubleBattleChanceBoosterModifier, true, doubleChance); + playerField.forEach(p => applyAbAttrs(DoubleBattleChanceAbAttr, p, null, doubleChance)); + newDouble = !Utils.randSeedInt(doubleChance.value); + } } else if (newBattleType === BattleType.TRAINER) newDouble = newTrainer.variant === TrainerVariant.DOUBLE; } else if (!battleConfig) diff --git a/src/locales/de/modifier-type.ts b/src/locales/de/modifier-type.ts index 5006ee294f6..8ba6c22ed62 100644 --- a/src/locales/de/modifier-type.ts +++ b/src/locales/de/modifier-type.ts @@ -51,6 +51,9 @@ export const modifierType: ModifierTypeTranslationEntries = { "DoubleBattleChanceBoosterModifierType": { description: "Verdoppelt die Wahrscheinlichkeit, dass die nächsten {{battleCount}} Begegnungen mit wilden Pokémon ein Doppelkampf sind.", }, + "DoubleBattlePreventionModifierType": { + description: "Erschweren Sie die Teilnahme an zwei Schlachten pro {{battleCount}} Schlacht", + }, "TempBattleStatBoosterModifierType": { description: "Erhöht die {{tempBattleStatName}} aller Teammitglieder für 5 Kämpfe um eine Stufe", }, @@ -162,6 +165,10 @@ export const modifierType: ModifierTypeTranslationEntries = { "SUPER_LURE": { name: "Super-Lockparfüm" }, "MAX_LURE": { name: "Top-Lockparfüm" }, + "REPEL": { name: "Schutz" }, + "SUPER_REPEL": { name: "Superschutz" }, + "MAX_REPEL": { name: "Top-Schutz" }, + "MEMORY_MUSHROOM": { name: "Erinnerungspilz", description: "Lässt ein Pokémon eine vergessene Attacke wiedererlernen" }, "EXP_SHARE": { name: "EP-Teiler", description: "Pokémon, die nicht am Kampf teilgenommen haben, bekommen 20% der Erfahrungspunkte eines Kampfteilnehmers" }, diff --git a/src/locales/en/modifier-type.ts b/src/locales/en/modifier-type.ts index 31d4abbce29..7b8f228039d 100644 --- a/src/locales/en/modifier-type.ts +++ b/src/locales/en/modifier-type.ts @@ -51,6 +51,9 @@ export const modifierType: ModifierTypeTranslationEntries = { "DoubleBattleChanceBoosterModifierType": { description: "Doubles the chance of an encounter being a double battle for {{battleCount}} battles", }, + "DoubleBattlePreventionModifierType": { + description: "Prevent double battles from appearing for {{battleCount}} battles", + }, "TempBattleStatBoosterModifierType": { description: "Increases the {{tempBattleStatName}} of all party members by 1 stage for 5 battles", }, @@ -162,6 +165,10 @@ export const modifierType: ModifierTypeTranslationEntries = { "SUPER_LURE": { name: "Super Lure" }, "MAX_LURE": { name: "Max Lure" }, + "REPEL": { name: "Repel" }, + "SUPER_REPEL": { name: "Super Repel" }, + "MAX_REPEL": { name: "Max Repel" }, + "MEMORY_MUSHROOM": { name: "Memory Mushroom", description: "Recall one Pokémon's forgotten move" }, "EXP_SHARE": { name: "EXP. All", description: "Non-participants receive 20% of a single participant's EXP. Points" }, diff --git a/src/locales/es/modifier-type.ts b/src/locales/es/modifier-type.ts index 31d4abbce29..437ea7d16ff 100644 --- a/src/locales/es/modifier-type.ts +++ b/src/locales/es/modifier-type.ts @@ -51,6 +51,9 @@ export const modifierType: ModifierTypeTranslationEntries = { "DoubleBattleChanceBoosterModifierType": { description: "Doubles the chance of an encounter being a double battle for {{battleCount}} battles", }, + "DoubleBattlePreventionModifierType": { + description: "Evitar que aparezcan batallas dobles para {{battleCount}} batallas", + }, "TempBattleStatBoosterModifierType": { description: "Increases the {{tempBattleStatName}} of all party members by 1 stage for 5 battles", }, @@ -162,6 +165,10 @@ export const modifierType: ModifierTypeTranslationEntries = { "SUPER_LURE": { name: "Super Lure" }, "MAX_LURE": { name: "Max Lure" }, + "REPEL": { name: "Repelente" }, + "SUPER_REPEL": { name: "Superrepelente" }, + "MAX_REPEL": { name: "Repelente Máximo" }, + "MEMORY_MUSHROOM": { name: "Memory Mushroom", description: "Recall one Pokémon's forgotten move" }, "EXP_SHARE": { name: "EXP. All", description: "Non-participants receive 20% of a single participant's EXP. Points" }, diff --git a/src/locales/fr/modifier-type.ts b/src/locales/fr/modifier-type.ts index f8697c04259..0bc948188a7 100644 --- a/src/locales/fr/modifier-type.ts +++ b/src/locales/fr/modifier-type.ts @@ -51,6 +51,9 @@ export const modifierType: ModifierTypeTranslationEntries = { "DoubleBattleChanceBoosterModifierType": { description: "Double les chances de tomber sur un combat double pendant {{battleCount}} combats", }, + "DoubleBattlePreventionModifierType": { + description: "Empêcher l'apparition de doubles batailles pour {{battleCount}} batailles", + }, "TempBattleStatBoosterModifierType": { description: "Augmente d’1 cran {{tempBattleStatName}} pour toute l’équipe pendant 5 combats", }, @@ -162,6 +165,10 @@ export const modifierType: ModifierTypeTranslationEntries = { "SUPER_LURE": { name: "Super Parfum" }, "MAX_LURE": { name: "Parfum Max" }, + "REPEL": { name: "Repousse" }, + "SUPER_REPEL": { name: "Super Repousse" }, + "MAX_REPEL": { name: "Repousse Max" }, + "MEMORY_MUSHROOM": { name: "Champi Mémoriel", description: "Remémore une capacité à un Pokémon" }, "EXP_SHARE": { name: "Multi Exp", description: "Tous les non-participants reçoivent 20% des Points d’Exp d’un participant" }, diff --git a/src/locales/it/modifier-type.ts b/src/locales/it/modifier-type.ts index 87deece71fe..a5b18c465a5 100644 --- a/src/locales/it/modifier-type.ts +++ b/src/locales/it/modifier-type.ts @@ -51,6 +51,9 @@ export const modifierType: ModifierTypeTranslationEntries = { "DoubleBattleChanceBoosterModifierType": { description: "Raddoppia la possibilità di imbattersi in doppie battaglie per {{battleCount}} battaglie", }, + "DoubleBattlePreventionModifierType": { + description: "Impedisce di imbattersi in doppie battaglie per {{battleCount}} battaglie", + }, "TempBattleStatBoosterModifierType": { description: "Aumenta {{tempBattleStatName}} di un livello a tutti i Pokémon nel gruppo per 5 battaglie", }, @@ -162,6 +165,10 @@ export const modifierType: ModifierTypeTranslationEntries = { "SUPER_LURE": { name: "Profumo Invito Super" }, "MAX_LURE": { name: "Profumo Invito Max" }, + "REPEL": { name: "Repellente" }, + "SUPER_REPEL": { name: "Superrepellente" }, + "MAX_REPEL": { name: "Repellente max" }, + "MEMORY_MUSHROOM": { name: "Fungo della Memoria", description: "Ricorda la mossa dimenticata di un Pokémon" }, "EXP_SHARE": { name: "Condividi Esperienza", description: "Tutti i Pokémon della squadra ricevono il 20% dei Punti Esperienza dalla lotta anche se non vi hanno partecipato" }, diff --git a/src/locales/pt_BR/modifier-type.ts b/src/locales/pt_BR/modifier-type.ts index 1ffc6d3187f..6b3c7534b56 100644 --- a/src/locales/pt_BR/modifier-type.ts +++ b/src/locales/pt_BR/modifier-type.ts @@ -51,6 +51,9 @@ export const modifierType: ModifierTypeTranslationEntries = { "DoubleBattleChanceBoosterModifierType": { description: "Dobra as chances de encontrar uma batalha em dupla por {{battleCount}} batalhas", }, + "DoubleBattlePreventionModifierType": { + description: "Prevent double battles from appearing for {{battleCount}} battles", + }, "TempBattleStatBoosterModifierType": { description: "Aumenta o atributo de {{tempBattleStatName}} para todos os membros da equipe por 5 batalhas", }, @@ -158,9 +161,13 @@ export const modifierType: ModifierTypeTranslationEntries = { "PP_UP": { name: "Mais PP" }, "PP_MAX": { name: "PP Máximo" }, - "LURE": { name: "Incenso" }, - "SUPER_LURE": { name: "Super Incenso" }, - "MAX_LURE": { name: "Incenso Máximo" }, + "LURE": { name: "Lure" }, + "SUPER_LURE": { name: "Super Lure" }, + "MAX_LURE": { name: "Max Lure" }, + + "REPEL": { name: "Repel" }, + "SUPER_REPEL": { name: "Super Repel" }, + "MAX_REPEL": { name: "Max Repel" }, "MEMORY_MUSHROOM": { name: "Cogumemória", description: "Relembra um movimento esquecido" }, diff --git a/src/locales/zh_CN/modifier-type.ts b/src/locales/zh_CN/modifier-type.ts index e826c743fbc..5aa30f43289 100644 --- a/src/locales/zh_CN/modifier-type.ts +++ b/src/locales/zh_CN/modifier-type.ts @@ -51,6 +51,9 @@ export const modifierType: ModifierTypeTranslationEntries = { "DoubleBattleChanceBoosterModifierType": { description: "接下来的{{battleCount}}场战斗是双打的概率翻倍", }, + "DoubleBattlePreventionModifierType": { + description: "防止 {{battleCount}} 场战斗出现双重战斗", + }, "TempBattleStatBoosterModifierType": { description: "为所有成员宝可梦提升一级{{tempBattleStatName}},持续5场战斗", }, @@ -159,8 +162,12 @@ export const modifierType: ModifierTypeTranslationEntries = { "PP_MAX": { name: "PP极限提升剂" }, "LURE": { name: "引虫香水" }, - "SUPER_LURE": { name: "白银香水" }, - "MAX_LURE": { name: "黄金香水" }, + "SUPER_LURE": { name: "白银喷雾" }, + "MAX_LURE": { name: "黄金喷雾" }, + + "REPEL": { name: "除虫喷雾" }, + "SUPER_REPEL": { name: "Super Repel" }, + "MAX_REPEL": { name: "Max Repel" }, "MEMORY_MUSHROOM": { name: "回忆蘑菇", description: "回忆一个宝可梦已经遗忘的招式" }, diff --git a/src/modifier/modifier-type.ts b/src/modifier/modifier-type.ts index 278de2f18e8..e4bbeb0b4b7 100644 --- a/src/modifier/modifier-type.ts +++ b/src/modifier/modifier-type.ts @@ -407,6 +407,20 @@ export class DoubleBattleChanceBoosterModifierType extends ModifierType { } } +export class DoubleBattlePreventionModifierType extends ModifierType { + public battleCount: integer; + + constructor(localeKey: string, iconImage: string, battleCount: integer) { + super(localeKey, iconImage, (_type, _args) => new Modifiers.DoubleBattlePreventionModifierType(this, this.battleCount), 'lure'); + + this.battleCount = battleCount; + } + + getDescription(scene: BattleScene): string { + return i18next.t(`modifierType:ModifierType.DoubleBattlePreventionModifierType.description`, { battleCount: this.battleCount }); + } +} + export class TempBattleStatBoosterModifierType extends ModifierType implements GeneratedPersistentModifierType { public tempBattleStat: TempBattleStat; @@ -1031,9 +1045,9 @@ export const modifierTypes = { PP_UP: () => new PokemonPpUpModifierType(`modifierType:ModifierType.PP_UP`, 'pp_up', 1), PP_MAX: () => new PokemonPpUpModifierType(`modifierType:ModifierType.PP_MAX`, 'pp_max', 3), - /*REPEL: () => new DoubleBattleChanceBoosterModifierType('Repel', 5), - SUPER_REPEL: () => new DoubleBattleChanceBoosterModifierType('Super Repel', 10), - MAX_REPEL: () => new DoubleBattleChanceBoosterModifierType('Max Repel', 25),*/ + REPEL: () => new DoubleBattlePreventionModifierType('modifierType:ModifierType.REPEL', 'repel', 5), + SUPER_REPEL: () => new DoubleBattlePreventionModifierType('modifierType:ModifierType.SUPER_REPEL', 'super_repel', 10), + MAX_REPEL: () => new DoubleBattlePreventionModifierType('modifierType:ModifierType.MAX_REPEL', 'max_repel', 25), LURE: () => new DoubleBattleChanceBoosterModifierType(`modifierType:ModifierType.LURE`, 'lure', 5), SUPER_LURE: () => new DoubleBattleChanceBoosterModifierType(`modifierType:ModifierType.SUPER_LURE`, 'super_lure', 10), @@ -1202,6 +1216,7 @@ const modifierPool: ModifierPool = { return thresholdPartyMemberCount; }, 3), new WeightedModifierType(modifierTypes.LURE, 2), + new WeightedModifierType(modifierTypes.REPEL, 2), new WeightedModifierType(modifierTypes.TEMP_STAT_BOOSTER, 4), new WeightedModifierType(modifierTypes.BERRY, 2), new WeightedModifierType(modifierTypes.TM_COMMON, 1), @@ -1246,6 +1261,7 @@ const modifierPool: ModifierPool = { }, 3), new WeightedModifierType(modifierTypes.DIRE_HIT, 4), new WeightedModifierType(modifierTypes.SUPER_LURE, 4), + new WeightedModifierType(modifierTypes.SUPER_REPEL, 4), new WeightedModifierType(modifierTypes.NUGGET, 5), new WeightedModifierType(modifierTypes.EVOLUTION_ITEM, (party: Pokemon[]) => { return Math.min(Math.ceil(party[0].scene.currentBattle.waveIndex / 15), 8); @@ -1265,6 +1281,7 @@ const modifierPool: ModifierPool = { [ModifierTier.ULTRA]: [ new WeightedModifierType(modifierTypes.ULTRA_BALL, 24), new WeightedModifierType(modifierTypes.MAX_LURE, 4), + new WeightedModifierType(modifierTypes.MAX_REPEL, 4), new WeightedModifierType(modifierTypes.BIG_NUGGET, 12), new WeightedModifierType(modifierTypes.PP_UP, 9), new WeightedModifierType(modifierTypes.PP_MAX, 3), diff --git a/src/modifier/modifier.ts b/src/modifier/modifier.ts index 0736831a01e..f3a806c9c9a 100644 --- a/src/modifier/modifier.ts +++ b/src/modifier/modifier.ts @@ -310,6 +310,33 @@ export class DoubleBattleChanceBoosterModifier extends LapsingPersistentModifier } } +export class DoubleBattlePreventionModifierType extends LapsingPersistentModifier { + constructor(type: ModifierTypes.DoubleBattlePreventionModifierType, battlesLeft: integer, stackCount?: integer) { + super(type, battlesLeft, stackCount); + } + + match(modifier: Modifier): boolean { + if (modifier instanceof DoubleBattlePreventionModifierType) + return (modifier as DoubleBattlePreventionModifierType).battlesLeft === this.battlesLeft; + return false; + } + + clone(): DoubleBattlePreventionModifierType { + return new DoubleBattlePreventionModifierType(this.type as ModifierTypes.DoubleBattlePreventionModifierType, this.battlesLeft, this.stackCount); + } + + getArgs(): any[] { + return [ this.battlesLeft ]; + } + + apply(args: any[]): boolean { + const doubleBattleChance = args[0] as Utils.NumberHolder; + doubleBattleChance.value = Math.ceil(doubleBattleChance.value / 2); + + return true; + } +} + export class TempBattleStatBoosterModifier extends LapsingPersistentModifier { private tempBattleStat: TempBattleStat;