Fix Formatting and Reorder Parameters

This commit is contained in:
Benjamin Odom 2024-05-13 22:18:16 -05:00
parent ae6315ef58
commit 30330152f6
6 changed files with 12 additions and 16 deletions

View File

@ -715,7 +715,7 @@ export class PostDefendContactApplyStatusEffectAbAttr extends PostDefendAbAttr {
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 (move.getMove().checkFlag(MoveFlags.MAKES_CONTACT, attacker, pokemon) && !attacker.status && (this.chance === -1 || pokemon.randSeedInt(100) < this.chance)) { if (move.getMove().checkFlag(MoveFlags.MAKES_CONTACT, attacker, pokemon) && !attacker.status && (this.chance === -1 || pokemon.randSeedInt(100) < this.chance)) {
const effect = this.effects.length === 1 ? this.effects[0] : this.effects[pokemon.randSeedInt(this.effects.length)]; const effect = this.effects.length === 1 ? this.effects[0] : this.effects[pokemon.randSeedInt(this.effects.length)];
return attacker.trySetStatus(effect, true, 0, null, pokemon); return attacker.trySetStatus(effect, true, pokemon);
} }
return false; return false;
@ -1177,7 +1177,7 @@ export class PostAttackApplyStatusEffectAbAttr extends PostAttackAbAttr {
applyPostAttack(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean { applyPostAttack(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean {
if (pokemon != attacker && (!this.contactRequired || move.getMove().checkFlag(MoveFlags.MAKES_CONTACT, attacker, pokemon)) && pokemon.randSeedInt(100) < this.chance && !pokemon.status) { if (pokemon != attacker && (!this.contactRequired || move.getMove().checkFlag(MoveFlags.MAKES_CONTACT, attacker, pokemon)) && pokemon.randSeedInt(100) < this.chance && !pokemon.status) {
const effect = this.effects.length === 1 ? this.effects[0] : this.effects[pokemon.randSeedInt(this.effects.length)]; const effect = this.effects.length === 1 ? this.effects[0] : this.effects[pokemon.randSeedInt(this.effects.length)];
return attacker.trySetStatus(effect, true, 0, null, pokemon); return attacker.trySetStatus(effect, true, pokemon);
} }
return false; return false;

View File

@ -316,7 +316,7 @@ class ToxicSpikesTag extends ArenaTrapTag {
} }
} else if (!pokemon.status) { } else if (!pokemon.status) {
const toxic = this.layers > 1; const toxic = this.layers > 1;
if (pokemon.trySetStatus(!toxic ? StatusEffect.POISON : StatusEffect.TOXIC, true, null, `the ${this.getMoveName()}`)) if (pokemon.trySetStatus(!toxic ? StatusEffect.POISON : StatusEffect.TOXIC, true))
return true; return true;
} }
} }

View File

@ -819,7 +819,7 @@ export class ContactPoisonProtectedTag extends ProtectedTag {
const effectPhase = pokemon.scene.getCurrentPhase(); const effectPhase = pokemon.scene.getCurrentPhase();
if (effectPhase instanceof MoveEffectPhase && effectPhase.move.getMove().hasFlag(MoveFlags.MAKES_CONTACT)) { if (effectPhase instanceof MoveEffectPhase && effectPhase.move.getMove().hasFlag(MoveFlags.MAKES_CONTACT)) {
const attacker = effectPhase.getPokemon(); const attacker = effectPhase.getPokemon();
attacker.trySetStatus(StatusEffect.POISON, true, 0, null, pokemon); attacker.trySetStatus(StatusEffect.POISON, true, pokemon);
} }
} }

View File

@ -1156,7 +1156,7 @@ export class StatusEffectAttr extends MoveEffectAttr {
return false; return false;
} }
if (!pokemon.status || (pokemon.status.effect === this.effect && move.chance < 0)) if (!pokemon.status || (pokemon.status.effect === this.effect && move.chance < 0))
return pokemon.trySetStatus(this.effect, true, this.cureTurn, null, user); return pokemon.trySetStatus(this.effect, true, user, this.cureTurn);
} }
return false; return false;
} }
@ -1197,7 +1197,7 @@ export class PsychoShiftEffectAttr extends MoveEffectAttr {
return false; return false;
} }
if (!target.status || (target.status.effect === statusToApply && move.chance < 0)) { if (!target.status || (target.status.effect === statusToApply && move.chance < 0)) {
var statusAfflictResult = target.trySetStatus(statusToApply, true, 0, null, user); var statusAfflictResult = target.trySetStatus(statusToApply, true, user);
if (statusAfflictResult) { if (statusAfflictResult) {
user.scene.queueMessage(getPokemonMessage(user, getStatusEffectHealText(user.status.effect))); user.scene.queueMessage(getPokemonMessage(user, getStatusEffectHealText(user.status.effect)));
user.resetStatus(); user.resetStatus();

View File

@ -2039,26 +2039,22 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
case StatusEffect.TOXIC: case StatusEffect.TOXIC:
// Check if the Pokemon is immune to Poison/Toxic or if the source pokemon is canceling the immunity // Check if the Pokemon is immune to Poison/Toxic or if the source pokemon is canceling the immunity
let poisonImmunity = types.map(defType => { let poisonImmunity = types.map(defType => {
const cancelImmunity = new Utils.BooleanHolder(false);
// Check if the Pokemon is not immune to Poison/Toxic // Check if the Pokemon is not immune to Poison/Toxic
if (defType !== Type.POISON && defType !== Type.STEEL) if (defType !== Type.POISON && defType !== Type.STEEL)
return false; return false;
// Check if the source Pokemon has an ability that cancels the Poison/Toxic immunity // Check if the source Pokemon has an ability that cancels the Poison/Toxic immunity
const cancelImmunity = new Utils.BooleanHolder(false);
if (sourcePokemon) { if (sourcePokemon) {
applyAbAttrs(IgnoreTypeStatusEffectImmunityAbAttr, sourcePokemon, cancelImmunity, effect, defType); applyAbAttrs(IgnoreTypeStatusEffectImmunityAbAttr, sourcePokemon, cancelImmunity, effect, defType);
if (cancelImmunity.value) if (cancelImmunity.value)
return false; return false;
else
return true;
}
else {
return true;
} }
return true;
}) })
if (this.isOfType(Type.POISON) || this.isOfType(Type.STEEL)){ if (this.isOfType(Type.POISON) || this.isOfType(Type.STEEL)) {
if (poisonImmunity.includes(true)) if (poisonImmunity.includes(true))
return false; return false;
} }
@ -2090,7 +2086,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
return true; return true;
} }
trySetStatus(effect: StatusEffect, asPhase: boolean = false, cureTurn: integer = 0, sourceText: string = null, sourcePokemon: Pokemon = null): boolean { trySetStatus(effect: StatusEffect, asPhase: boolean = false, sourcePokemon: Pokemon = null, cureTurn: integer = 0, sourceText: string = null): boolean {
if (!this.canSetStatus(effect, asPhase, false, sourcePokemon)) if (!this.canSetStatus(effect, asPhase, false, sourcePokemon))
return false; return false;

View File

@ -2945,7 +2945,7 @@ export class ObtainStatusEffectPhase extends PokemonPhase {
start() { start() {
const pokemon = this.getPokemon(); const pokemon = this.getPokemon();
if (!pokemon.status) { if (!pokemon.status) {
if (pokemon.trySetStatus(this.statusEffect, false, 0, null, this.sourcePokemon)) { if (pokemon.trySetStatus(this.statusEffect, false, this.sourcePokemon, 0, null)) {
if (this.cureTurn) if (this.cureTurn)
pokemon.status.cureTurn = this.cureTurn; pokemon.status.cureTurn = this.cureTurn;
pokemon.updateInfo(true); pokemon.updateInfo(true);