mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-05 07:52:17 +02:00
defeated the stakeout demons
This commit is contained in:
parent
e01731639f
commit
f4f40634b7
@ -9,7 +9,7 @@ import { BattlerTag } from "./battler-tags";
|
||||
import { BattlerTagType } from "./enums/battler-tag-type";
|
||||
import { StatusEffect, getStatusEffectDescriptor, getStatusEffectHealText } from "./status-effect";
|
||||
import { Gender } from "./gender";
|
||||
import Move, { AttackMove, MoveCategory, MoveFlags, MoveTarget, RecoilAttr, StatusMoveTypeImmunityAttr, FlinchAttr, OneHitKOAttr, HitHealAttr, StrengthSapHealAttr, allMoves } from "./move";
|
||||
import Move, { AttackMove, MoveCategory, MoveFlags, MoveTarget, RecoilAttr, StatusMoveTypeImmunityAttr, FlinchAttr, OneHitKOAttr, HitHealAttr, StrengthSapHealAttr, allMoves, ForceSwitchOutAttr } from "./move";
|
||||
import { ArenaTagSide, ArenaTrapTag } from "./arena-tag";
|
||||
import { ArenaTagType } from "./enums/arena-tag-type";
|
||||
import { Stat } from "./pokemon-stat";
|
||||
@ -920,6 +920,31 @@ export class MoveTypePowerBoostAbAttr extends MovePowerBoostAbAttr {
|
||||
}
|
||||
}
|
||||
|
||||
export class StakeoutAbAttr extends MovePowerBoostAbAttr {
|
||||
constructor(powerMultiplier: number = 2) {
|
||||
const condition: PokemonAttackCondition = (user, target, move) => {
|
||||
|
||||
if(user.scene.currentBattle.turnCommands[target.getBattlerIndex()].command === Command.POKEMON) // covers hard switching
|
||||
return true;
|
||||
// find what move the target's slot used this turn and check if it's a switch-in move.
|
||||
const moveId = user.scene.currentBattle.turnCommands[target.getBattlerIndex()].move.move
|
||||
const targetMove = allMoves[moveId];
|
||||
const usedSwitchMove = targetMove.findAttr(attr => attr instanceof ForceSwitchOutAttr) as ForceSwitchOutAttr;
|
||||
|
||||
if(usedSwitchMove?.isSelfSwitch?.() && target.battleSummonData?.turnCount === 1){ // check if the move switches the user out
|
||||
if(usedSwitchMove.returnUser().id === target.id) // dont activate if the move was used by the target (meaning it hasnt switched out yet)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
super(condition, powerMultiplier);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export class LowHpMoveTypePowerBoostAbAttr extends MoveTypePowerBoostAbAttr {
|
||||
constructor(boostedType: Type) {
|
||||
super(boostedType);
|
||||
@ -3005,7 +3030,7 @@ export function initAbilities() {
|
||||
.attr(NoFusionAbilityAbAttr)
|
||||
.partial(),
|
||||
new Ability(Abilities.STAKEOUT, 7)
|
||||
.attr(MovePowerBoostAbAttr, (user, target, move) => user.scene.currentBattle.turnCommands[target.getBattlerIndex()].command === Command.POKEMON, 2),
|
||||
.attr(StakeoutAbAttr),
|
||||
new Ability(Abilities.WATER_BUBBLE, 7)
|
||||
.attr(ReceivedTypeDamageMultiplierAbAttr, Type.FIRE, 0.5)
|
||||
.attr(MoveTypePowerBoostAbAttr, Type.WATER, 1)
|
||||
|
@ -2810,6 +2810,7 @@ export class RemoveScreensAttr extends MoveEffectAttr {
|
||||
export class ForceSwitchOutAttr extends MoveEffectAttr {
|
||||
private user: boolean;
|
||||
private batonPass: boolean;
|
||||
private userReference: Pokemon;
|
||||
|
||||
constructor(user?: boolean, batonPass?: boolean) {
|
||||
super(false, MoveEffectTrigger.POST_APPLY, true);
|
||||
@ -2822,6 +2823,7 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
||||
if (!this.user && target.isMax())
|
||||
return resolve(false);
|
||||
|
||||
this.userReference = user;
|
||||
// Check if the move category is not STATUS or if the switch out condition is not met
|
||||
if (move.category !== MoveCategory.STATUS && !this.getSwitchOutCondition()(user, target, move)) {
|
||||
//Apply effects before switch out i.e. poison point, flame body, etc
|
||||
@ -2882,6 +2884,14 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
||||
return (user, target, move) => move.category !== MoveCategory.STATUS || this.getSwitchOutCondition()(user, target, move);
|
||||
}
|
||||
|
||||
public isSelfSwitch(): boolean {
|
||||
return this.user;
|
||||
}
|
||||
|
||||
returnUser(): Pokemon {
|
||||
return this.userReference;
|
||||
}
|
||||
|
||||
getSwitchOutCondition(): MoveConditionFunc {
|
||||
return (user, target, move) => {
|
||||
const switchOutTarget = (this.user ? user : target);
|
||||
|
Loading…
Reference in New Issue
Block a user