mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-16 06:45:24 +01:00
[Refactor] [Ability] Initializing abilities now uses a builder class (#6534)
This commit is contained in:
parent
fc6cf8b907
commit
219cfb04cb
@ -27,7 +27,7 @@ import { UiInputs } from "#app/ui-inputs";
|
||||
import { pokemonPrevolutions } from "#balance/pokemon-evolutions";
|
||||
import { FRIENDSHIP_GAIN_FROM_BATTLE } from "#balance/starters";
|
||||
import { initCommonAnims, initMoveAnim, loadCommonAnimAssets, loadMoveAnimAssets } from "#data/battle-anims";
|
||||
import { allAbilities, allMoves, allSpecies, biomeDepths, modifierTypes } from "#data/data-lists";
|
||||
import { allMoves, allSpecies, biomeDepths, modifierTypes } from "#data/data-lists";
|
||||
import { battleSpecDialogue } from "#data/dialogue";
|
||||
import type { SpeciesFormChangeTrigger } from "#data/form-change-triggers";
|
||||
import { SpeciesFormChangeManualTrigger, SpeciesFormChangeTimeOfDayTrigger } from "#data/form-change-triggers";
|
||||
@ -1211,7 +1211,6 @@ export class BattleScene extends SceneBase {
|
||||
const localizable: Localizable[] = [
|
||||
...allSpecies,
|
||||
...allMoves,
|
||||
...allAbilities,
|
||||
...getEnumValues(ModifierPoolType)
|
||||
.map(mpt => getModifierPoolForType(mpt))
|
||||
.flatMap(mp =>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -7705,7 +7705,7 @@ export class AbilityChangeAttr extends MoveEffectAttr {
|
||||
}
|
||||
|
||||
getCondition(): MoveConditionFunc {
|
||||
return (user, target, move) => (this.selfTarget ? user : target).getAbility().isReplaceable && (this.selfTarget ? user : target).getAbility().id !== this.ability;
|
||||
return (user, target, move) => (this.selfTarget ? user : target).getAbility().replaceable && (this.selfTarget ? user : target).getAbility().id !== this.ability;
|
||||
}
|
||||
}
|
||||
|
||||
@ -7739,9 +7739,9 @@ export class AbilityCopyAttr extends MoveEffectAttr {
|
||||
getCondition(): MoveConditionFunc {
|
||||
return (user, target, move) => {
|
||||
const ally = user.getAlly();
|
||||
let ret = target.getAbility().isCopiable && user.getAbility().isReplaceable;
|
||||
let ret = target.getAbility().copiable && user.getAbility().replaceable;
|
||||
if (this.copyToPartner && globalScene.currentBattle?.double) {
|
||||
ret = ret && (!ally?.hp || ally?.getAbility().isReplaceable);
|
||||
ret = ret && (!ally?.hp || ally?.getAbility().replaceable);
|
||||
} else {
|
||||
ret = ret && user.getAbility().id !== target.getAbility().id;
|
||||
}
|
||||
@ -7770,7 +7770,7 @@ export class AbilityGiveAttr extends MoveEffectAttr {
|
||||
}
|
||||
|
||||
getCondition(): MoveConditionFunc {
|
||||
return (user, target, move) => user.getAbility().isCopiable && target.getAbility().isReplaceable && user.getAbility().id !== target.getAbility().id;
|
||||
return (user, target, move) => user.getAbility().copiable && target.getAbility().replaceable && user.getAbility().id !== target.getAbility().id;
|
||||
}
|
||||
}
|
||||
|
||||
@ -7793,7 +7793,7 @@ export class SwitchAbilitiesAttr extends MoveEffectAttr {
|
||||
}
|
||||
|
||||
getCondition(): MoveConditionFunc {
|
||||
return (user, target, move) => [user, target].every(pkmn => pkmn.getAbility().isSwappable);
|
||||
return (user, target, move) => [user, target].every(pkmn => pkmn.getAbility().swappable);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7819,7 +7819,7 @@ export class SuppressAbilitiesAttr extends MoveEffectAttr {
|
||||
|
||||
/** Causes the effect to fail when the target's ability is unsupressable or already suppressed. */
|
||||
getCondition(): MoveConditionFunc {
|
||||
return (_user, target, _move) => !target.summonData.abilitySuppressed && (target.getAbility().isSuppressable || (target.hasPassive() && target.getPassiveAbility().isSuppressable));
|
||||
return (_user, target, _move) => !target.summonData.abilitySuppressed && (target.getAbility().suppressable || (target.hasPassive() && target.getPassiveAbility().suppressable));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2202,10 +2202,10 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
return false;
|
||||
}
|
||||
const arena = globalScene?.arena;
|
||||
if (arena.ignoreAbilities && arena.ignoringEffectSource !== this.getBattlerIndex() && ability.isIgnorable) {
|
||||
if (arena.ignoreAbilities && arena.ignoringEffectSource !== this.getBattlerIndex() && ability.ignorable) {
|
||||
return false;
|
||||
}
|
||||
if (this.summonData.abilitySuppressed && ability.isSuppressable) {
|
||||
if (this.summonData.abilitySuppressed && ability.suppressable) {
|
||||
return false;
|
||||
}
|
||||
const suppressAbilitiesTag = arena.getTag(ArenaTagType.NEUTRALIZING_GAS) as SuppressAbilitiesTag;
|
||||
@ -2217,14 +2217,14 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
// (Balance decided that the other ability of a neutralizing gas pokemon should not be neutralized)
|
||||
// If the ability itself is neutralizing gas, don't suppress it (handled through arena tag)
|
||||
const unsuppressable =
|
||||
!ability.isSuppressable
|
||||
!ability.suppressable
|
||||
|| thisAbilitySuppressing
|
||||
|| (hasSuppressingAbility && !suppressAbilitiesTag.shouldApplyToSelf());
|
||||
if (!unsuppressable) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return (this.hp > 0 || ability.isBypassFaint) && !ability.conditions.find(condition => !condition(this));
|
||||
return (this.hp > 0 || ability.bypassFaint) && !ability.conditions.find(condition => !condition(this));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user