[Balance] Fix N-Solarizer etc appearing without secondary mon registered in dex (#2713)
* Fix reins et al being available without unlocking second mon * Small fix * Parentheses for safety * Add documentation to new function
This commit is contained in:
parent
3caa51be81
commit
64d9c11713
|
@ -138,7 +138,7 @@ export class SpeciesFormChange {
|
|||
public formKey: string;
|
||||
public trigger: SpeciesFormChangeTrigger;
|
||||
public quiet: boolean;
|
||||
private conditions: SpeciesFormChangeCondition[];
|
||||
public conditions: SpeciesFormChangeCondition[];
|
||||
|
||||
constructor(speciesId: Species, preFormKey: string, evoFormKey: string, trigger: SpeciesFormChangeTrigger, quiet: boolean = false, ...conditions: SpeciesFormChangeCondition[]) {
|
||||
this.speciesId = speciesId;
|
||||
|
@ -375,6 +375,16 @@ export function getSpeciesFormChangeMessage(pokemon: Pokemon, formChange: Specie
|
|||
return `${prefix}${preName} changed form!`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives a condition for form changing checking if a species is registered as caught in the player's dex data.
|
||||
* Used for fusion forms such as Kyurem and Necrozma.
|
||||
* @param species
|
||||
* @returns A {@linkcode SpeciesFormChangeCondition} checking if that species is registered as caught
|
||||
*/
|
||||
function getSpeciesDependentFormChangeCondition(species: Species): SpeciesFormChangeCondition {
|
||||
return new SpeciesFormChangeCondition(p => !!p.scene.gameData.dexData[species].caughtAttr);
|
||||
}
|
||||
|
||||
interface PokemonFormChanges {
|
||||
[key: string]: SpeciesFormChange[]
|
||||
}
|
||||
|
@ -609,8 +619,8 @@ export const pokemonFormChanges: PokemonFormChanges = {
|
|||
new SpeciesFormChange(Species.LANDORUS, SpeciesFormKey.INCARNATE, SpeciesFormKey.THERIAN, new SpeciesFormChangeItemTrigger(FormChangeItem.REVEAL_GLASS))
|
||||
],
|
||||
[Species.KYUREM]: [
|
||||
new SpeciesFormChange(Species.KYUREM, "", "black", new SpeciesFormChangeItemTrigger(FormChangeItem.DARK_STONE)),
|
||||
new SpeciesFormChange(Species.KYUREM, "", "white", new SpeciesFormChangeItemTrigger(FormChangeItem.LIGHT_STONE))
|
||||
new SpeciesFormChange(Species.KYUREM, "", "black", new SpeciesFormChangeItemTrigger(FormChangeItem.DARK_STONE), false, getSpeciesDependentFormChangeCondition(Species.ZEKROM)),
|
||||
new SpeciesFormChange(Species.KYUREM, "", "white", new SpeciesFormChangeItemTrigger(FormChangeItem.LIGHT_STONE), false, getSpeciesDependentFormChangeCondition(Species.RESHIRAM))
|
||||
],
|
||||
[Species.KELDEO]: [
|
||||
new SpeciesFormChange(Species.KELDEO, "ordinary", "resolute", new SpeciesFormChangeMoveLearnedTrigger(Moves.SECRET_SWORD)),
|
||||
|
@ -700,8 +710,8 @@ export const pokemonFormChanges: PokemonFormChanges = {
|
|||
new SpeciesFormChange(Species.MIMIKYU, "busted", "disguised", new SpeciesFormChangeManualTrigger(), true)
|
||||
],
|
||||
[Species.NECROZMA]: [
|
||||
new SpeciesFormChange(Species.NECROZMA, "", "dawn-wings", new SpeciesFormChangeItemTrigger(FormChangeItem.N_LUNARIZER)),
|
||||
new SpeciesFormChange(Species.NECROZMA, "", "dusk-mane", new SpeciesFormChangeItemTrigger(FormChangeItem.N_SOLARIZER))
|
||||
new SpeciesFormChange(Species.NECROZMA, "", "dawn-wings", new SpeciesFormChangeItemTrigger(FormChangeItem.N_LUNARIZER), false, getSpeciesDependentFormChangeCondition(Species.LUNALA)),
|
||||
new SpeciesFormChange(Species.NECROZMA, "", "dusk-mane", new SpeciesFormChangeItemTrigger(FormChangeItem.N_SOLARIZER), false, getSpeciesDependentFormChangeCondition(Species.SOLGALEO))
|
||||
],
|
||||
[Species.MELMETAL]: [
|
||||
new SpeciesFormChange(Species.MELMETAL, "", SpeciesFormKey.GIGANTAMAX, new SpeciesFormChangeItemTrigger(FormChangeItem.MAX_MUSHROOMS))
|
||||
|
@ -787,8 +797,8 @@ export const pokemonFormChanges: PokemonFormChanges = {
|
|||
new SpeciesFormChange(Species.URSHIFU, "rapid-strike", SpeciesFormKey.GIGANTAMAX_RAPID, new SpeciesFormChangeItemTrigger(FormChangeItem.MAX_MUSHROOMS))
|
||||
],
|
||||
[Species.CALYREX]: [
|
||||
new SpeciesFormChange(Species.CALYREX, "", "ice", new SpeciesFormChangeItemTrigger(FormChangeItem.ICY_REINS_OF_UNITY)),
|
||||
new SpeciesFormChange(Species.CALYREX, "", "shadow", new SpeciesFormChangeItemTrigger(FormChangeItem.SHADOW_REINS_OF_UNITY))
|
||||
new SpeciesFormChange(Species.CALYREX, "", "ice", new SpeciesFormChangeItemTrigger(FormChangeItem.ICY_REINS_OF_UNITY), false, getSpeciesDependentFormChangeCondition(Species.GLASTRIER)),
|
||||
new SpeciesFormChange(Species.CALYREX, "", "shadow", new SpeciesFormChangeItemTrigger(FormChangeItem.SHADOW_REINS_OF_UNITY), false, getSpeciesDependentFormChangeCondition(Species.SPECTRIER))
|
||||
],
|
||||
[Species.ENAMORUS]: [
|
||||
new SpeciesFormChange(Species.ENAMORUS, SpeciesFormKey.INCARNATE, SpeciesFormKey.THERIAN, new SpeciesFormChangeItemTrigger(FormChangeItem.REVEAL_GLASS))
|
||||
|
|
|
@ -15,7 +15,7 @@ import { StatusEffect, getStatusEffectDescriptor } from "../data/status-effect";
|
|||
import { SpeciesFormKey } from "../data/pokemon-species";
|
||||
import BattleScene from "../battle-scene";
|
||||
import { VoucherType, getVoucherTypeIcon, getVoucherTypeName } from "../system/voucher";
|
||||
import { FormChangeItem, SpeciesFormChangeItemTrigger, pokemonFormChanges } from "../data/pokemon-forms";
|
||||
import { FormChangeItem, SpeciesFormChangeCondition, SpeciesFormChangeItemTrigger, pokemonFormChanges } from "../data/pokemon-forms";
|
||||
import { ModifierTier } from "./modifier-tier";
|
||||
import { Nature, getNatureName, getNatureStatMultiplier } from "#app/data/nature";
|
||||
import i18next from "i18next";
|
||||
|
@ -1028,7 +1028,8 @@ class FormChangeItemModifierTypeGenerator extends ModifierTypeGenerator {
|
|||
const formChangeItemPool = party.filter(p => pokemonFormChanges.hasOwnProperty(p.species.speciesId)).map(p => {
|
||||
const formChanges = pokemonFormChanges[p.species.speciesId];
|
||||
return formChanges.filter(fc => ((fc.formKey.indexOf(SpeciesFormKey.MEGA) === -1 && fc.formKey.indexOf(SpeciesFormKey.PRIMAL) === -1) || party[0].scene.getModifiers(Modifiers.MegaEvolutionAccessModifier).length)
|
||||
&& ((fc.formKey.indexOf(SpeciesFormKey.GIGANTAMAX) === -1 && fc.formKey.indexOf(SpeciesFormKey.ETERNAMAX) === -1) || party[0].scene.getModifiers(Modifiers.GigantamaxAccessModifier).length))
|
||||
&& ((fc.formKey.indexOf(SpeciesFormKey.GIGANTAMAX) === -1 && fc.formKey.indexOf(SpeciesFormKey.ETERNAMAX) === -1) || party[0].scene.getModifiers(Modifiers.GigantamaxAccessModifier).length)
|
||||
&& (!fc.conditions.length || fc.conditions.filter(cond => cond instanceof SpeciesFormChangeCondition && cond.predicate(p)).length))
|
||||
.map(fc => fc.findTrigger(SpeciesFormChangeItemTrigger) as SpeciesFormChangeItemTrigger)
|
||||
.filter(t => t && t.active && !p.scene.findModifier(m => m instanceof Modifiers.PokemonFormChangeItemModifier && m.pokemonId === p.id && m.formChangeItem === t.item));
|
||||
}).flat().flatMap(fc => fc.item);
|
||||
|
|
Loading…
Reference in New Issue