Merge 6a2cd634e2 into 06ec265bcd
commit
1e9901970b
|
|
@ -2343,13 +2343,13 @@ export class CheckTrappedAbAttr extends AbAttr {
|
|||
super(false);
|
||||
}
|
||||
|
||||
applyCheckTrapped(pokemon: Pokemon, passive: boolean, trapped: Utils.BooleanHolder, args: any[]): boolean | Promise<boolean> {
|
||||
applyCheckTrapped(pokemon: Pokemon, target: Pokemon, passive: boolean, trapped: Utils.BooleanHolder, args: any[]): boolean | Promise<boolean> {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export class ArenaTrapAbAttr extends CheckTrappedAbAttr {
|
||||
applyCheckTrapped(pokemon: Pokemon, passive: boolean, trapped: Utils.BooleanHolder, args: any[]): boolean {
|
||||
applyCheckTrapped(pokemon: Pokemon, target: Pokemon, passive: boolean, trapped: Utils.BooleanHolder, args: any[]): boolean {
|
||||
trapped.value = true;
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2359,6 +2359,23 @@ export class ArenaTrapAbAttr extends CheckTrappedAbAttr {
|
|||
}
|
||||
}
|
||||
|
||||
export class ConditionalArenaTrapAbAttr extends ArenaTrapAbAttr {
|
||||
private condition: (opponent: Pokemon) => boolean;
|
||||
|
||||
constructor(condition: (opponent: Pokemon) => boolean) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
}
|
||||
|
||||
applyCheckTrapped(pokemon: Pokemon, opponent: Pokemon, passive: boolean, trapped: Utils.BooleanHolder, args: any[]): boolean {
|
||||
if (this.condition(opponent) && !opponent.isOfType(Type.GHOST)) {
|
||||
trapped.value = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export class MaxMultiHitAbAttr extends AbAttr {
|
||||
apply(pokemon: Pokemon, passive: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean {
|
||||
(args[0] as Utils.IntegerHolder).value = 0;
|
||||
|
|
@ -2859,8 +2876,8 @@ export function applyPostTerrainChangeAbAttrs(attrType: { new(...args: any[]): P
|
|||
}
|
||||
|
||||
export function applyCheckTrappedAbAttrs(attrType: { new(...args: any[]): CheckTrappedAbAttr },
|
||||
pokemon: Pokemon, trapped: Utils.BooleanHolder, ...args: any[]): Promise<void> {
|
||||
return applyAbAttrsInternal<CheckTrappedAbAttr>(attrType, pokemon, (attr, passive) => attr.applyCheckTrapped(pokemon, passive, trapped, args), args, true);
|
||||
pokemon: Pokemon, target: Pokemon, trapped: Utils.BooleanHolder, ...args: any[]): Promise<void> {
|
||||
return applyAbAttrsInternal<CheckTrappedAbAttr>(attrType, pokemon, (attr, passive) => attr.applyCheckTrapped(pokemon, target, passive, trapped, args), args, true);
|
||||
}
|
||||
|
||||
export function applyPostBattleAbAttrs(attrType: { new(...args: any[]): PostBattleAbAttr },
|
||||
|
|
@ -2954,7 +2971,7 @@ export function initAbilities() {
|
|||
new Ability(Abilities.INTIMIDATE, 3)
|
||||
.attr(PostSummonStatChangeAbAttr, BattleStat.ATK, -1, false, true),
|
||||
new Ability(Abilities.SHADOW_TAG, 3)
|
||||
.attr(ArenaTrapAbAttr),
|
||||
.attr(ConditionalArenaTrapAbAttr, (opponent: Pokemon) => true),
|
||||
new Ability(Abilities.ROUGH_SKIN, 3)
|
||||
.attr(PostDefendContactDamageAbAttr, 8)
|
||||
.bypassFaint(),
|
||||
|
|
@ -3011,9 +3028,7 @@ export function initAbilities() {
|
|||
.attr(StatusEffectImmunityAbAttr, StatusEffect.BURN)
|
||||
.ignorable(),
|
||||
new Ability(Abilities.MAGNET_PULL, 3)
|
||||
/*.attr(ArenaTrapAbAttr)
|
||||
.condition((pokemon: Pokemon) => pokemon.getOpponent()?.isOfType(Type.STEEL))*/
|
||||
.unimplemented(),
|
||||
.attr(ConditionalArenaTrapAbAttr, (opponent: Pokemon) => opponent.isOfType(Type.STEEL)),
|
||||
new Ability(Abilities.SOUNDPROOF, 3)
|
||||
.attr(MoveImmunityAbAttr, (pokemon, attacker, move) => pokemon !== attacker && move.getMove().hasFlag(MoveFlags.SOUND_BASED))
|
||||
.ignorable(),
|
||||
|
|
@ -3087,7 +3102,7 @@ export function initAbilities() {
|
|||
.attr(PostSummonWeatherChangeAbAttr, WeatherType.SUNNY)
|
||||
.attr(PostBiomeChangeWeatherChangeAbAttr, WeatherType.SUNNY),
|
||||
new Ability(Abilities.ARENA_TRAP, 3)
|
||||
.attr(ArenaTrapAbAttr)
|
||||
.attr(ConditionalArenaTrapAbAttr, (opponent: Pokemon) => opponent.isGrounded())
|
||||
.attr(DoubleBattleChanceAbAttr),
|
||||
new Ability(Abilities.VITAL_SPIRIT, 3)
|
||||
.attr(StatusEffectImmunityAbAttr, StatusEffect.SLEEP)
|
||||
|
|
|
|||
|
|
@ -1792,7 +1792,7 @@ export class CommandPhase extends FieldPhase {
|
|||
const trapped = new Utils.BooleanHolder(false);
|
||||
const batonPass = isSwitch && args[0] as boolean;
|
||||
if (!batonPass)
|
||||
enemyField.forEach(enemyPokemon => applyCheckTrappedAbAttrs(CheckTrappedAbAttr, enemyPokemon, trapped));
|
||||
enemyField.forEach(enemyPokemon => applyCheckTrappedAbAttrs(CheckTrappedAbAttr, enemyPokemon, playerPokemon, trapped));
|
||||
if (batonPass || (!trapTag && !trapped.value)) {
|
||||
this.scene.currentBattle.turnCommands[this.fieldIndex] = isSwitch
|
||||
? { command: Command.POKEMON, cursor: cursor, args: args }
|
||||
|
|
@ -1890,7 +1890,7 @@ export class EnemyCommandPhase extends FieldPhase {
|
|||
|
||||
const trapTag = enemyPokemon.findTag(t => t instanceof TrappedTag) as TrappedTag;
|
||||
const trapped = new Utils.BooleanHolder(false);
|
||||
opponents.forEach(playerPokemon => applyCheckTrappedAbAttrs(CheckTrappedAbAttr, playerPokemon, trapped));
|
||||
opponents.forEach(playerPokemon => applyCheckTrappedAbAttrs(CheckTrappedAbAttr, playerPokemon, enemyPokemon, trapped));
|
||||
if (!trapTag && !trapped.value) {
|
||||
const partyMemberScores = trainer.getPartyMemberMatchupScores(enemyPokemon.trainerSlot, true);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue