Rename ON_GET_HIT to AFTER_HIT

Change `isOpponentTo` to `isOpponent`
This commit is contained in:
NightKev 2024-10-13 22:41:34 -07:00
parent e91415b121
commit 5de76ca9ae
3 changed files with 9 additions and 9 deletions

View File

@ -132,7 +132,7 @@ export class RechargingTag extends BattlerTag {
*/ */
export class BeakBlastChargingTag extends BattlerTag { export class BeakBlastChargingTag extends BattlerTag {
constructor() { constructor() {
super(BattlerTagType.BEAK_BLAST_CHARGING, [BattlerTagLapseType.PRE_MOVE, BattlerTagLapseType.TURN_END, BattlerTagLapseType.ON_GET_HIT], 1, Moves.BEAK_BLAST); super(BattlerTagType.BEAK_BLAST_CHARGING, [BattlerTagLapseType.PRE_MOVE, BattlerTagLapseType.TURN_END, BattlerTagLapseType.AFTER_HIT], 1, Moves.BEAK_BLAST);
} }
onAdd(pokemon: Pokemon): void { onAdd(pokemon: Pokemon): void {
@ -151,7 +151,7 @@ export class BeakBlastChargingTag extends BattlerTag {
* @returns `true` if invoked with the ON_GET_HIT lapse type; `false` otherwise * @returns `true` if invoked with the ON_GET_HIT lapse type; `false` otherwise
*/ */
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean { lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
if (lapseType === BattlerTagLapseType.ON_GET_HIT) { if (lapseType === BattlerTagLapseType.AFTER_HIT) {
const phaseData = getMoveEffectPhaseData(pokemon); const phaseData = getMoveEffectPhaseData(pokemon);
if (phaseData?.move.hasFlag(MoveFlags.MAKES_CONTACT)) { if (phaseData?.move.hasFlag(MoveFlags.MAKES_CONTACT)) {
phaseData.attacker.trySetStatus(StatusEffect.BURN, true, pokemon); phaseData.attacker.trySetStatus(StatusEffect.BURN, true, pokemon);
@ -171,7 +171,7 @@ export class ShellTrapTag extends BattlerTag {
public activated: boolean; public activated: boolean;
constructor() { constructor() {
super(BattlerTagType.SHELL_TRAP, [BattlerTagLapseType.TURN_END, BattlerTagLapseType.ON_GET_HIT], 1); super(BattlerTagType.SHELL_TRAP, [BattlerTagLapseType.TURN_END, BattlerTagLapseType.AFTER_HIT], 1);
this.activated = false; this.activated = false;
} }
@ -186,11 +186,11 @@ export class ShellTrapTag extends BattlerTag {
* @returns `true` if invoked with the `CUSTOM` lapse type; `false` otherwise * @returns `true` if invoked with the `CUSTOM` lapse type; `false` otherwise
*/ */
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean { lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
if (lapseType === BattlerTagLapseType.ON_GET_HIT) { if (lapseType === BattlerTagLapseType.AFTER_HIT) {
const phaseData = getMoveEffectPhaseData(pokemon); const phaseData = getMoveEffectPhaseData(pokemon);
/* Trap should only be triggered by opponent's Physical moves */ /* Trap should only be triggered by opponent's Physical moves */
if (phaseData?.move.category === MoveCategory.PHYSICAL && pokemon.isOpponentTo(phaseData.attacker)) { if (phaseData?.move.category === MoveCategory.PHYSICAL && pokemon.isOpponent(phaseData.attacker)) {
this.triggerTrap(pokemon); this.triggerTrap(pokemon);
} }

View File

@ -1867,11 +1867,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
/** /**
* Compares if 'this' and {@linkcode target} are on the same team. * Compares if `this` and {@linkcode target} are on the same team.
* @param target the {@linkcode Pokemon} to compare against. * @param target the {@linkcode Pokemon} to compare against.
* @returns true if the two pokemon are both player owned or both not, false otherwise * @returns `true` if the two pokemon are allies, `false` otherwise
*/ */
isOpponentTo(target: Pokemon) : boolean { isOpponent(target: Pokemon): boolean {
return this.isPlayer() !== target.isPlayer(); return this.isPlayer() !== target.isPlayer();
} }

View File

@ -258,7 +258,7 @@ export class MoveEffectPhase extends PokemonPhase {
// Apply the target's post-defend ability effects (as long as the target is active or can otherwise apply them) // Apply the target's post-defend ability effects (as long as the target is active or can otherwise apply them)
return Utils.executeIf(!target.isFainted() || target.canApplyAbility(), () => applyPostDefendAbAttrs(PostDefendAbAttr, target, user, this.move.getMove(), hitResult).then(() => { return Utils.executeIf(!target.isFainted() || target.canApplyAbility(), () => applyPostDefendAbAttrs(PostDefendAbAttr, target, user, this.move.getMove(), hitResult).then(() => {
// If the invoked move is an enemy attack, apply the enemy's status effect-inflicting tags and tokens // If the invoked move is an enemy attack, apply the enemy's status effect-inflicting tags and tokens
target.lapseTags(BattlerTagLapseType.ON_GET_HIT); target.lapseTags(BattlerTagLapseType.AFTER_HIT);
if (!user.isPlayer() && this.move.getMove() instanceof AttackMove) { if (!user.isPlayer() && this.move.getMove() instanceof AttackMove) {
user.scene.applyShuffledModifiers(this.scene, EnemyAttackStatusEffectChanceModifier, false, target); user.scene.applyShuffledModifiers(this.scene, EnemyAttackStatusEffectChanceModifier, false, target);