Finish Sweet Veil and Pastel Veil
Implemented the ally check for Sweet Veil and Pastel Veil On status check the Pokémon checks if it's ally has an ability to prevent the statuspull/753/head
parent
3f9158083e
commit
662da02042
|
@ -1675,6 +1675,29 @@ export class StatusEffectImmunityAbAttr extends PreSetStatusAbAttr {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class AllyStatusEffectImmunityAbAttr extends PreSetStatusAbAttr {
|
||||||
|
private immuneEffects: StatusEffect[];
|
||||||
|
|
||||||
|
constructor(...immuneEffects: StatusEffect[]) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.immuneEffects = immuneEffects;
|
||||||
|
}
|
||||||
|
|
||||||
|
applyPreSetStatus(pokemon: Pokemon, passive: boolean, effect: StatusEffect, cancelled: Utils.BooleanHolder, args: any[]): boolean {
|
||||||
|
if (!this.immuneEffects.length || this.immuneEffects.indexOf(effect) > -1) {
|
||||||
|
cancelled.value = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
getTriggerMessage(pokemon: Pokemon, abilityName: string, ...args: any[]): string {
|
||||||
|
return getPokemonMessage(pokemon, `'s ${abilityName}\nprevents ${this.immuneEffects.length ? getStatusEffectDescriptor(args[0] as StatusEffect) : 'status problems'}!`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class PreApplyBattlerTagAbAttr extends AbAttr {
|
export class PreApplyBattlerTagAbAttr extends AbAttr {
|
||||||
applyPreApplyBattlerTag(pokemon: Pokemon, passive: boolean, tag: BattlerTag, cancelled: Utils.BooleanHolder, args: any[]): boolean | Promise<boolean> {
|
applyPreApplyBattlerTag(pokemon: Pokemon, passive: boolean, tag: BattlerTag, cancelled: Utils.BooleanHolder, args: any[]): boolean | Promise<boolean> {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1704,6 +1727,29 @@ export class BattlerTagImmunityAbAttr extends PreApplyBattlerTagAbAttr {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class AllyBattlerTagImmunityAbAttr extends PreApplyBattlerTagAbAttr {
|
||||||
|
private immuneTagType: BattlerTagType;
|
||||||
|
|
||||||
|
constructor(immuneTagType: BattlerTagType) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.immuneTagType = immuneTagType;
|
||||||
|
}
|
||||||
|
|
||||||
|
applyPreApplyBattlerTag(pokemon: Pokemon, passive: boolean, tag: BattlerTag, cancelled: Utils.BooleanHolder, args: any[]): boolean {
|
||||||
|
if (tag.tagType === this.immuneTagType) {
|
||||||
|
cancelled.value = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
getTriggerMessage(pokemon: Pokemon, abilityName: string, ...args: any[]): string {
|
||||||
|
return getPokemonMessage(pokemon, `'s ${abilityName}\nprevents ${(args[0] as BattlerTag).getDescriptor()}!`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class BlockCritAbAttr extends AbAttr {
|
export class BlockCritAbAttr extends AbAttr {
|
||||||
apply(pokemon: Pokemon, passive: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean {
|
apply(pokemon: Pokemon, passive: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean {
|
||||||
(args[0] as Utils.BooleanHolder).value = true;
|
(args[0] as Utils.BooleanHolder).value = true;
|
||||||
|
@ -3255,9 +3301,10 @@ export function initAbilities() {
|
||||||
.attr(MoveTypeChangePowerMultiplierAbAttr, Type.NORMAL, Type.ICE, 1.2),
|
.attr(MoveTypeChangePowerMultiplierAbAttr, Type.NORMAL, Type.ICE, 1.2),
|
||||||
new Ability(Abilities.SWEET_VEIL, 6)
|
new Ability(Abilities.SWEET_VEIL, 6)
|
||||||
.attr(StatusEffectImmunityAbAttr, StatusEffect.SLEEP)
|
.attr(StatusEffectImmunityAbAttr, StatusEffect.SLEEP)
|
||||||
|
.attr(AllyStatusEffectImmunityAbAttr, StatusEffect.SLEEP)
|
||||||
.attr(BattlerTagImmunityAbAttr, BattlerTagType.DROWSY)
|
.attr(BattlerTagImmunityAbAttr, BattlerTagType.DROWSY)
|
||||||
.ignorable()
|
.attr(AllyBattlerTagImmunityAbAttr, BattlerTagType.DROWSY)
|
||||||
.partial(),
|
.ignorable(),
|
||||||
new Ability(Abilities.STANCE_CHANGE, 6)
|
new Ability(Abilities.STANCE_CHANGE, 6)
|
||||||
.attr(UncopiableAbilityAbAttr)
|
.attr(UncopiableAbilityAbAttr)
|
||||||
.attr(UnswappableAbilityAbAttr)
|
.attr(UnswappableAbilityAbAttr)
|
||||||
|
@ -3524,6 +3571,7 @@ export function initAbilities() {
|
||||||
.partial(),
|
.partial(),
|
||||||
new Ability(Abilities.PASTEL_VEIL, 8)
|
new Ability(Abilities.PASTEL_VEIL, 8)
|
||||||
.attr(StatusEffectImmunityAbAttr, StatusEffect.POISON, StatusEffect.TOXIC)
|
.attr(StatusEffectImmunityAbAttr, StatusEffect.POISON, StatusEffect.TOXIC)
|
||||||
|
.attr(AllyStatusEffectImmunityAbAttr, StatusEffect.POISON, StatusEffect.TOXIC)
|
||||||
.ignorable(),
|
.ignorable(),
|
||||||
new Ability(Abilities.HUNGER_SWITCH, 8)
|
new Ability(Abilities.HUNGER_SWITCH, 8)
|
||||||
.attr(PostTurnFormChangeAbAttr, p => p.getFormKey ? 0 : 1)
|
.attr(PostTurnFormChangeAbAttr, p => p.getFormKey ? 0 : 1)
|
||||||
|
|
|
@ -27,7 +27,7 @@ import { TempBattleStat } from '../data/temp-battle-stat';
|
||||||
import { ArenaTagSide, WeakenMoveScreenTag, WeakenMoveTypeTag } from '../data/arena-tag';
|
import { ArenaTagSide, WeakenMoveScreenTag, WeakenMoveTypeTag } from '../data/arena-tag';
|
||||||
import { ArenaTagType } from "../data/enums/arena-tag-type";
|
import { ArenaTagType } from "../data/enums/arena-tag-type";
|
||||||
import { Biome } from "../data/enums/biome";
|
import { Biome } from "../data/enums/biome";
|
||||||
import { Ability, AbAttr, BattleStatMultiplierAbAttr, BlockCritAbAttr, BonusCritAbAttr, BypassBurnDamageReductionAbAttr, FieldPriorityMoveImmunityAbAttr, FieldVariableMovePowerAbAttr, IgnoreOpponentStatChangesAbAttr, MoveImmunityAbAttr, MoveTypeChangeAttr, NonSuperEffectiveImmunityAbAttr, PreApplyBattlerTagAbAttr, PreDefendFullHpEndureAbAttr, ReceivedMoveDamageMultiplierAbAttr, ReduceStatusEffectDurationAbAttr, StabBoostAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, VariableMovePowerAbAttr, VariableMoveTypeAbAttr, WeightMultiplierAbAttr, allAbilities, applyAbAttrs, applyBattleStatMultiplierAbAttrs, applyPostDefendAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs, UnsuppressableAbilityAbAttr, SuppressFieldAbilitiesAbAttr, NoFusionAbilityAbAttr, MultCritAbAttr, IgnoreTypeImmunityAbAttr } from '../data/ability';
|
import { Ability, AbAttr, BattleStatMultiplierAbAttr, BlockCritAbAttr, BonusCritAbAttr, BypassBurnDamageReductionAbAttr, FieldPriorityMoveImmunityAbAttr, FieldVariableMovePowerAbAttr, IgnoreOpponentStatChangesAbAttr, MoveImmunityAbAttr, MoveTypeChangeAttr, NonSuperEffectiveImmunityAbAttr, PreApplyBattlerTagAbAttr, PreDefendFullHpEndureAbAttr, ReceivedMoveDamageMultiplierAbAttr, ReduceStatusEffectDurationAbAttr, StabBoostAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, VariableMovePowerAbAttr, VariableMoveTypeAbAttr, WeightMultiplierAbAttr, allAbilities, applyAbAttrs, applyBattleStatMultiplierAbAttrs, applyPostDefendAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs, UnsuppressableAbilityAbAttr, SuppressFieldAbilitiesAbAttr, NoFusionAbilityAbAttr, MultCritAbAttr, IgnoreTypeImmunityAbAttr, AllyStatusEffectImmunityAbAttr } from '../data/ability';
|
||||||
import { Abilities } from "#app/data/enums/abilities";
|
import { Abilities } from "#app/data/enums/abilities";
|
||||||
import PokemonData from '../system/pokemon-data';
|
import PokemonData from '../system/pokemon-data';
|
||||||
import Battle, { BattlerIndex } from '../battle';
|
import Battle, { BattlerIndex } from '../battle';
|
||||||
|
@ -2021,6 +2021,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
|
|
||||||
const cancelled = new Utils.BooleanHolder(false);
|
const cancelled = new Utils.BooleanHolder(false);
|
||||||
applyPreSetStatusAbAttrs(StatusEffectImmunityAbAttr, this, effect, cancelled, quiet);
|
applyPreSetStatusAbAttrs(StatusEffectImmunityAbAttr, this, effect, cancelled, quiet);
|
||||||
|
if (!cancelled.value)
|
||||||
|
applyPreSetStatusAbAttrs(AllyStatusEffectImmunityAbAttr, this.getAlly(), effect, cancelled, quiet);
|
||||||
|
|
||||||
if (cancelled.value)
|
if (cancelled.value)
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue