Merge branch 'pagefaultgames:main' into propellertail-stalwart

This commit is contained in:
Athebyne 2024-05-08 19:43:05 -04:00 committed by GitHub
commit 1e0fa81350
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 4 deletions

View File

@ -562,19 +562,28 @@ export class PostDefendStatChangeAbAttr extends PostDefendAbAttr {
private stat: BattleStat; private stat: BattleStat;
private levels: integer; private levels: integer;
private selfTarget: boolean; private selfTarget: boolean;
private allOthers: boolean;
constructor(condition: PokemonDefendCondition, stat: BattleStat, levels: integer, selfTarget: boolean = true) { constructor(condition: PokemonDefendCondition, stat: BattleStat, levels: integer, selfTarget: boolean = true, allOthers: boolean = false) {
super(true); super(true);
this.condition = condition; this.condition = condition;
this.stat = stat; this.stat = stat;
this.levels = levels; this.levels = levels;
this.selfTarget = selfTarget; this.selfTarget = selfTarget;
this.allOthers = allOthers;
} }
applyPostDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean { applyPostDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean {
if (this.condition(pokemon, attacker, move.getMove())) { if (this.condition(pokemon, attacker, move.getMove())) {
pokemon.scene.unshiftPhase(new StatChangePhase(pokemon.scene, (this.selfTarget ? pokemon : attacker).getBattlerIndex(), true, [ this.stat ], this.levels)); if (this.allOthers) {
let otherPokemon = pokemon.getAlly() ? pokemon.getOpponents().concat([ pokemon.getAlly() ]) : pokemon.getOpponents();
for (let other of otherPokemon) {
other.scene.unshiftPhase(new StatChangePhase(other.scene, (other).getBattlerIndex(), false, [ this.stat ], this.levels));
}
return true;
}
pokemon.scene.unshiftPhase(new StatChangePhase(pokemon.scene, (this.selfTarget ? pokemon : attacker).getBattlerIndex(), this.selfTarget, [ this.stat ], this.levels));
return true; return true;
} }
@ -3407,7 +3416,8 @@ export function initAbilities() {
new Ability(Abilities.BALL_FETCH, 8) new Ability(Abilities.BALL_FETCH, 8)
.unimplemented(), .unimplemented(),
new Ability(Abilities.COTTON_DOWN, 8) new Ability(Abilities.COTTON_DOWN, 8)
.unimplemented(), .attr(PostDefendStatChangeAbAttr, (target, user, move) => move.category !== MoveCategory.STATUS, BattleStat.SPD, -1, false, true)
.bypassFaint(),
new Ability(Abilities.PROPELLER_TAIL, 8) new Ability(Abilities.PROPELLER_TAIL, 8)
.attr(BlockRedirectAbAttr), .attr(BlockRedirectAbAttr),
new Ability(Abilities.MIRROR_ARMOR, 8) new Ability(Abilities.MIRROR_ARMOR, 8)

View File

@ -220,7 +220,7 @@ export function executeIf<T>(condition: boolean, promiseFunc: () => Promise<T>):
} }
export const sessionIdKey = 'pokerogue_sessionId'; export const sessionIdKey = 'pokerogue_sessionId';
export const isLocal = window.location.hostname === 'localhost'; export const isLocal = window.location.hostname === 'localhost' || window.location.hostname === '';
export const serverUrl = isLocal ? 'http://localhost:8001' : ''; export const serverUrl = isLocal ? 'http://localhost:8001' : '';
export const apiUrl = isLocal ? serverUrl : 'https://api.pokerogue.net'; export const apiUrl = isLocal ? serverUrl : 'https://api.pokerogue.net';
export const fallbackApiUrl = isLocal ? serverUrl : 'api'; export const fallbackApiUrl = isLocal ? serverUrl : 'api';