mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-05 07:52:17 +02:00
Merge branch 'pr/298'
This commit is contained in:
commit
0266d5b8c2
@ -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, applyMoveAttrs, IncrementMovePriorityAttr } from "./move";
|
||||
import Move, { AttackMove, MoveCategory, MoveFlags, MoveTarget, RecoilAttr, StatusMoveTypeImmunityAttr, FlinchAttr, OneHitKOAttr, HitHealAttr, StrengthSapHealAttr, allMoves, applyMoveAttrs, IncrementMovePriorityAttr, ForceSwitchOutAttr } from "./move";
|
||||
import { ArenaTagSide, ArenaTrapTag } from "./arena-tag";
|
||||
import { ArenaTagType } from "./enums/arena-tag-type";
|
||||
import { Stat } from "./pokemon-stat";
|
||||
@ -1050,6 +1050,64 @@ 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
|
||||
if(moveId){
|
||||
const targetMove = allMoves[moveId];
|
||||
const usedSwitchMove = targetMove.findAttr(attr => attr instanceof ForceSwitchOutAttr) as ForceSwitchOutAttr;
|
||||
if(usedSwitchMove && usedSwitchMove.returnUser() && 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 AnalyticAbAttr extends MovePowerBoostAbAttr {
|
||||
constructor(powerMultiplier: number = 1.3) {
|
||||
const condition: PokemonAttackCondition = (user, target, move) => {
|
||||
const otherPokemons = target.scene.getField(true).filter(pokemon => pokemon.id !== user.id);
|
||||
let fasterPokemon = 0; // increment for each pokemon that has moved before user
|
||||
|
||||
otherPokemons.forEach(pokemon => {
|
||||
|
||||
let switchMove = false;
|
||||
const moveMatches = pokemon.getLastXMoves(1).find(m => m.turn === pokemon.scene.currentBattle.turn);
|
||||
const prioCommand = user.scene.currentBattle.turnCommands[pokemon.getBattlerIndex()].command !== Command.FIGHT;
|
||||
const moveId = user.scene.currentBattle.turnCommands[pokemon.getBattlerIndex()]?.move?.move
|
||||
if(moveId){
|
||||
const targetMove = allMoves[moveId];
|
||||
const usedSwitchMove = targetMove.findAttr(attr => attr instanceof ForceSwitchOutAttr) as ForceSwitchOutAttr;
|
||||
if(usedSwitchMove && usedSwitchMove.returnUser() && usedSwitchMove?.isSelfSwitch?.() && (pokemon.battleSummonData?.turnCount === 1)){ // check if the target was switched in by a move
|
||||
if(usedSwitchMove.returnUser().id === target.id)
|
||||
switchMove = true;
|
||||
}
|
||||
}
|
||||
if(moveMatches || prioCommand || switchMove) // check to see if they've used a move this round, ball/pokemon/run command, or switched out with a move
|
||||
fasterPokemon++
|
||||
});
|
||||
if(fasterPokemon === otherPokemons.length) // only activate if ALL other pokemon have moved
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
};
|
||||
|
||||
super(condition, powerMultiplier);
|
||||
}
|
||||
}
|
||||
|
||||
export class LowHpMoveTypePowerBoostAbAttr extends MoveTypePowerBoostAbAttr {
|
||||
constructor(boostedType: Type) {
|
||||
super(boostedType);
|
||||
@ -3079,7 +3137,7 @@ export function initAbilities() {
|
||||
.ignorable()
|
||||
.unimplemented(),
|
||||
new Ability(Abilities.ANALYTIC, 5)
|
||||
.attr(MovePowerBoostAbAttr, (user, target, move) => !!target.getLastXMoves(1).find(m => m.turn === target.scene.currentBattle.turn) || user.scene.currentBattle.turnCommands[target.getBattlerIndex()].command !== Command.FIGHT, 1.3),
|
||||
.attr(AnalyticAbAttr),
|
||||
new Ability(Abilities.ILLUSION, 5)
|
||||
.attr(UncopiableAbilityAbAttr)
|
||||
.attr(UnswappableAbilityAbAttr)
|
||||
@ -3225,7 +3283,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)
|
||||
|
@ -3123,6 +3123,7 @@ export class StealStatBoostsAttr 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);
|
||||
@ -3135,6 +3136,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
|
||||
@ -3193,6 +3195,14 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
||||
return (user, target, move) => move.category !== MoveCategory.STATUS || this.getSwitchOutCondition()(user, target, move);
|
||||
}
|
||||
|
||||
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