mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-16 05:12:19 +02:00
Fix tag cleanup after fainting
This commit is contained in:
parent
83d76fd535
commit
86b4ab357c
@ -2696,7 +2696,7 @@ export class FriendGuardAbAttr extends AbAttr {
|
|||||||
if (!ally) {
|
if (!ally) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ally.addTag(BattlerTagType.FRIEND_GUARD, 1, undefined, pokemon.id);
|
ally.addTag(BattlerTagType.FRIEND_GUARD, 0, undefined, pokemon.id);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1276,12 +1276,23 @@ export class CursedTag extends BattlerTag {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class FriendGuardTag extends BattlerTag {
|
export class AuraTag extends BattlerTag {
|
||||||
|
constructor(tagType: BattlerTagType, sourceId: number) {
|
||||||
|
super(tagType, BattlerTagLapseType.CUSTOM, 0, undefined, sourceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
|
||||||
|
const source = pokemon.scene.getPokemonById(this.sourceId);
|
||||||
|
return source.isActive(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ReceivedMoveDamageMultiplierTag extends AuraTag {
|
||||||
public powerMultiplier: number;
|
public powerMultiplier: number;
|
||||||
|
|
||||||
constructor() {
|
constructor(tagType: BattlerTagType, sourceId: number, powerMultiplier: number) {
|
||||||
super(BattlerTagType.FRIEND_GUARD, BattlerTagLapseType.TURN_END, 1, undefined);
|
super(tagType, sourceId);
|
||||||
this.powerMultiplier = 0.75;
|
this.powerMultiplier = powerMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1406,7 +1417,7 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourc
|
|||||||
case BattlerTagType.MINIMIZED:
|
case BattlerTagType.MINIMIZED:
|
||||||
return new MinimizeTag();
|
return new MinimizeTag();
|
||||||
case BattlerTagType.FRIEND_GUARD:
|
case BattlerTagType.FRIEND_GUARD:
|
||||||
return new FriendGuardTag();
|
return new ReceivedMoveDamageMultiplierTag(tagType, sourceId, 0.75);
|
||||||
case BattlerTagType.NONE:
|
case BattlerTagType.NONE:
|
||||||
default:
|
default:
|
||||||
return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId);
|
return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId);
|
||||||
|
@ -19,7 +19,7 @@ import { pokemonEvolutions, pokemonPrevolutions, SpeciesFormEvolution, SpeciesEv
|
|||||||
import { reverseCompatibleTms, tmSpecies, tmPoolTiers } from '../data/tms';
|
import { reverseCompatibleTms, tmSpecies, tmPoolTiers } from '../data/tms';
|
||||||
import { DamagePhase, FaintPhase, LearnMovePhase, ObtainStatusEffectPhase, StatChangePhase, SwitchSummonPhase } from '../phases';
|
import { DamagePhase, FaintPhase, LearnMovePhase, ObtainStatusEffectPhase, StatChangePhase, SwitchSummonPhase } from '../phases';
|
||||||
import { BattleStat } from '../data/battle-stat';
|
import { BattleStat } from '../data/battle-stat';
|
||||||
import { BattlerTag, BattlerTagLapseType, EncoreTag, FriendGuardTag, HelpingHandTag, HighestStatBoostTag, TypeBoostTag, getBattlerTag } from '../data/battler-tags';
|
import { BattlerTag, BattlerTagLapseType, EncoreTag, ReceivedMoveDamageMultiplierTag, HelpingHandTag, HighestStatBoostTag, TypeBoostTag, getBattlerTag } from '../data/battler-tags';
|
||||||
import { BattlerTagType } from "../data/enums/battler-tag-type";
|
import { BattlerTagType } from "../data/enums/battler-tag-type";
|
||||||
import { Species } from '../data/enums/species';
|
import { Species } from '../data/enums/species';
|
||||||
import { WeatherType } from '../data/weather';
|
import { WeatherType } from '../data/weather';
|
||||||
@ -1454,13 +1454,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
this.scene.getField(true).map(p => applyPreAttackAbAttrs(FieldVariableMovePowerAbAttr, this, source, battlerMove, power));
|
this.scene.getField(true).map(p => applyPreAttackAbAttrs(FieldVariableMovePowerAbAttr, this, source, battlerMove, power));
|
||||||
|
|
||||||
applyPreDefendAbAttrs(ReceivedMoveDamageMultiplierAbAttr, this, source, battlerMove, cancelled, power);
|
applyPreDefendAbAttrs(ReceivedMoveDamageMultiplierAbAttr, this, source, battlerMove, cancelled, power);
|
||||||
const reducedDamageTag = this.getTag(BattlerTagType.FRIEND_GUARD) as FriendGuardTag;
|
|
||||||
console.log(this.findTags(t => true));
|
const reducedDamageTag = this.getTag(BattlerTagType.FRIEND_GUARD) as ReceivedMoveDamageMultiplierTag;
|
||||||
if (reducedDamageTag) {
|
if (reducedDamageTag) {
|
||||||
console.log(power);
|
|
||||||
console.log(reducedDamageTag.powerMultiplier);
|
|
||||||
power.value *= reducedDamageTag.powerMultiplier;
|
power.value *= reducedDamageTag.powerMultiplier;
|
||||||
console.log(power);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
power.value *= typeChangeMovePowerMultiplier.value;
|
power.value *= typeChangeMovePowerMultiplier.value;
|
||||||
|
@ -21,7 +21,7 @@ import { Biome } from "./data/enums/biome";
|
|||||||
import { ModifierTier } from "./modifier/modifier-tier";
|
import { ModifierTier } from "./modifier/modifier-tier";
|
||||||
import { FusePokemonModifierType, ModifierPoolType, ModifierType, ModifierTypeFunc, ModifierTypeOption, PokemonModifierType, PokemonMoveModifierType, PokemonPpRestoreModifierType, PokemonPpUpModifierType, RememberMoveModifierType, TmModifierType, getDailyRunStarterModifiers, getEnemyBuffModifierForWave, getModifierType, getPlayerModifierTypeOptions, getPlayerShopModifierTypeOptionsForWave, modifierTypes, regenerateModifierPoolThresholds } from "./modifier/modifier-type";
|
import { FusePokemonModifierType, ModifierPoolType, ModifierType, ModifierTypeFunc, ModifierTypeOption, PokemonModifierType, PokemonMoveModifierType, PokemonPpRestoreModifierType, PokemonPpUpModifierType, RememberMoveModifierType, TmModifierType, getDailyRunStarterModifiers, getEnemyBuffModifierForWave, getModifierType, getPlayerModifierTypeOptions, getPlayerShopModifierTypeOptionsForWave, modifierTypes, regenerateModifierPoolThresholds } from "./modifier/modifier-type";
|
||||||
import SoundFade from "phaser3-rex-plugins/plugins/soundfade";
|
import SoundFade from "phaser3-rex-plugins/plugins/soundfade";
|
||||||
import { BattlerTagLapseType, EncoreTag, HideSpriteTag as HiddenTag, ProtectedTag, TrappedTag } from "./data/battler-tags";
|
import { AuraTag, BattlerTagLapseType, EncoreTag, HideSpriteTag as HiddenTag, ProtectedTag, TrappedTag } from "./data/battler-tags";
|
||||||
import { BattlerTagType } from "./data/enums/battler-tag-type";
|
import { BattlerTagType } from "./data/enums/battler-tag-type";
|
||||||
import { getPokemonMessage, getPokemonPrefix } from "./messages";
|
import { getPokemonMessage, getPokemonPrefix } from "./messages";
|
||||||
import { Starter } from "./ui/starter-select-ui-handler";
|
import { Starter } from "./ui/starter-select-ui-handler";
|
||||||
@ -2510,6 +2510,7 @@ export class MoveEffectPhase extends PokemonPhase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const isProtected = !this.move.getMove().hasFlag(MoveFlags.IGNORE_PROTECT) && target.findTags(t => t instanceof ProtectedTag).find(t => target.lapseTag(t.tagType));
|
const isProtected = !this.move.getMove().hasFlag(MoveFlags.IGNORE_PROTECT) && target.findTags(t => t instanceof ProtectedTag).find(t => target.lapseTag(t.tagType));
|
||||||
|
target.findTags(t => t instanceof AuraTag).forEach(t => target.lapseTag(t.tagType));
|
||||||
|
|
||||||
const firstHit = moveHistoryEntry.result !== MoveResult.SUCCESS;
|
const firstHit = moveHistoryEntry.result !== MoveResult.SUCCESS;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user