From 5c7b2ccecc9504ad227109308df64a26e71052e1 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Fri, 19 May 2023 16:13:11 -0400 Subject: [PATCH] Fix some minor bugs --- src/battle-phases.ts | 2 +- src/modifier/modifier.ts | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/battle-phases.ts b/src/battle-phases.ts index 61f1c6e0a70..6d1760a493c 100644 --- a/src/battle-phases.ts +++ b/src/battle-phases.ts @@ -9,7 +9,7 @@ import { BerryModifier, ContactHeldItemTransferChanceModifier, ExpBalanceModifie import PartyUiHandler, { PartyOption, PartyUiMode } from "./ui/party-ui-handler"; import { doPokeballBounceAnim, getPokeballAtlasKey, getPokeballCatchMultiplier, getPokeballName, getPokeballTintColor, PokeballType } from "./data/pokeball"; import { CommonAnim, CommonBattleAnim, MoveAnim, initMoveAnim, loadMoveAnimAssets } from "./data/battle-anims"; -import { Status, StatusEffect, getStatusEffectActivationText, getStatusEffectCatchRateMultiplier, getStatusEffectHealText, getStatusEffectObtainText, getStatusEffectOverlapText } from "./data/status-effect"; +import { StatusEffect, getStatusEffectActivationText, getStatusEffectCatchRateMultiplier, getStatusEffectHealText, getStatusEffectObtainText, getStatusEffectOverlapText } from "./data/status-effect"; import { SummaryUiMode } from "./ui/summary-ui-handler"; import EvolutionSceneHandler from "./ui/evolution-scene-handler"; import { EvolutionPhase } from "./evolution-phase"; diff --git a/src/modifier/modifier.ts b/src/modifier/modifier.ts index c274b9aecb2..9baf34890d1 100644 --- a/src/modifier/modifier.ts +++ b/src/modifier/modifier.ts @@ -255,7 +255,7 @@ export class MapModifier extends PersistentModifier { return true; } - getmaxStackCount(): integer { + getMaxStackCount(): integer { return 1; } } @@ -426,7 +426,7 @@ export class SurviveDamageModifier extends PokemonHeldItemModifier { return true; } - getmaxStackCount(): integer { + getMaxStackCount(): integer { return 5; } } @@ -1003,10 +1003,13 @@ export abstract class HeldItemTransferModifier extends PokemonHeldItemModifier { apply(args: any[]): boolean { const pokemon = args[0] as Pokemon; - const targetPokemon = pokemon.getOpponent(args.length > 1 ? args[1] as integer : !pokemon.scene.currentBattle.double ? 0 : Utils.randInt(2)); - if (!targetPokemon) + const opponents = pokemon.getOpponents(); + + if (!opponents.length) return false; + const targetPokemon = opponents[Utils.randInt(opponents.length)]; + const transferredItemCount = this.getTransferredItemCount(); if (!transferredItemCount) return false;