mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-09-24 07:23:24 +02:00
Make abilities use builder class
This commit is contained in:
parent
207808f37d
commit
0bde4562bb
@ -28,7 +28,7 @@ import { biomeDepths, getBiomeName } from "#balance/biomes";
|
|||||||
import { pokemonPrevolutions } from "#balance/pokemon-evolutions";
|
import { pokemonPrevolutions } from "#balance/pokemon-evolutions";
|
||||||
import { FRIENDSHIP_GAIN_FROM_BATTLE } from "#balance/starters";
|
import { FRIENDSHIP_GAIN_FROM_BATTLE } from "#balance/starters";
|
||||||
import { initCommonAnims, initMoveAnim, loadCommonAnimAssets, loadMoveAnimAssets } from "#data/battle-anims";
|
import { initCommonAnims, initMoveAnim, loadCommonAnimAssets, loadMoveAnimAssets } from "#data/battle-anims";
|
||||||
import { allAbilities, allMoves, allSpecies, modifierTypes } from "#data/data-lists";
|
import { allMoves, allSpecies, modifierTypes } from "#data/data-lists";
|
||||||
import { battleSpecDialogue } from "#data/dialogue";
|
import { battleSpecDialogue } from "#data/dialogue";
|
||||||
import type { SpeciesFormChangeTrigger } from "#data/form-change-triggers";
|
import type { SpeciesFormChangeTrigger } from "#data/form-change-triggers";
|
||||||
import { SpeciesFormChangeManualTrigger, SpeciesFormChangeTimeOfDayTrigger } from "#data/form-change-triggers";
|
import { SpeciesFormChangeManualTrigger, SpeciesFormChangeTimeOfDayTrigger } from "#data/form-change-triggers";
|
||||||
@ -1228,7 +1228,6 @@ export class BattleScene extends SceneBase {
|
|||||||
const localizable: Localizable[] = [
|
const localizable: Localizable[] = [
|
||||||
...allSpecies,
|
...allSpecies,
|
||||||
...allMoves,
|
...allMoves,
|
||||||
...allAbilities,
|
|
||||||
...getEnumValues(ModifierPoolType)
|
...getEnumValues(ModifierPoolType)
|
||||||
.map(mpt => getModifierPoolForType(mpt))
|
.map(mpt => getModifierPoolForType(mpt))
|
||||||
.flatMap(mp =>
|
.flatMap(mp =>
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -7513,7 +7513,7 @@ export class AbilityChangeAttr extends MoveEffectAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getCondition(): MoveConditionFunc {
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7547,9 +7547,9 @@ export class AbilityCopyAttr extends MoveEffectAttr {
|
|||||||
getCondition(): MoveConditionFunc {
|
getCondition(): MoveConditionFunc {
|
||||||
return (user, target, move) => {
|
return (user, target, move) => {
|
||||||
const ally = user.getAlly();
|
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) {
|
if (this.copyToPartner && globalScene.currentBattle?.double) {
|
||||||
ret = ret && (!ally?.hp || ally?.getAbility().isReplaceable);
|
ret = ret && (!ally?.hp || ally?.getAbility().replaceable);
|
||||||
} else {
|
} else {
|
||||||
ret = ret && user.getAbility().id !== target.getAbility().id;
|
ret = ret && user.getAbility().id !== target.getAbility().id;
|
||||||
}
|
}
|
||||||
@ -7578,7 +7578,7 @@ export class AbilityGiveAttr extends MoveEffectAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getCondition(): MoveConditionFunc {
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7601,7 +7601,7 @@ export class SwitchAbilitiesAttr extends MoveEffectAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getCondition(): MoveConditionFunc {
|
getCondition(): MoveConditionFunc {
|
||||||
return (user, target, move) => [user, target].every(pkmn => pkmn.getAbility().isSwappable);
|
return (user, target, move) => [user, target].every(pkmn => pkmn.getAbility().swappable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7627,7 +7627,7 @@ export class SuppressAbilitiesAttr extends MoveEffectAttr {
|
|||||||
|
|
||||||
/** Causes the effect to fail when the target's ability is unsupressable or already suppressed. */
|
/** Causes the effect to fail when the target's ability is unsupressable or already suppressed. */
|
||||||
getCondition(): MoveConditionFunc {
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2201,10 +2201,10 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const arena = globalScene?.arena;
|
const arena = globalScene?.arena;
|
||||||
if (arena.ignoreAbilities && arena.ignoringEffectSource !== this.getBattlerIndex() && ability.isIgnorable) {
|
if (arena.ignoreAbilities && arena.ignoringEffectSource !== this.getBattlerIndex() && ability.ignorable) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this.summonData.abilitySuppressed && ability.isSuppressable) {
|
if (this.summonData.abilitySuppressed && ability.suppressable) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const suppressAbilitiesTag = arena.getTag(ArenaTagType.NEUTRALIZING_GAS) as SuppressAbilitiesTag;
|
const suppressAbilitiesTag = arena.getTag(ArenaTagType.NEUTRALIZING_GAS) as SuppressAbilitiesTag;
|
||||||
@ -2216,14 +2216,14 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
// (Balance decided that the other ability of a neutralizing gas pokemon should not be neutralized)
|
// (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)
|
// If the ability itself is neutralizing gas, don't suppress it (handled through arena tag)
|
||||||
const unsuppressable =
|
const unsuppressable =
|
||||||
!ability.isSuppressable
|
!ability.suppressable
|
||||||
|| thisAbilitySuppressing
|
|| thisAbilitySuppressing
|
||||||
|| (hasSuppressingAbility && !suppressAbilitiesTag.shouldApplyToSelf());
|
|| (hasSuppressingAbility && !suppressAbilitiesTag.shouldApplyToSelf());
|
||||||
if (!unsuppressable) {
|
if (!unsuppressable) {
|
||||||
return false;
|
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