From c3b303414ee55f4dc3340aa83774d17a9e59fea9 Mon Sep 17 00:00:00 2001 From: Wlowscha <54003515+Wlowscha@users.noreply.github.com> Date: Sat, 31 May 2025 01:33:28 +0200 Subject: [PATCH] Added some suggestions --- src/modifier/all-held-items.ts | 30 +++++++++++++++--------------- src/modifier/modifier-type.ts | 29 +++++++++-------------------- 2 files changed, 24 insertions(+), 35 deletions(-) diff --git a/src/modifier/all-held-items.ts b/src/modifier/all-held-items.ts index 5144e326182..d8f207ec7fc 100644 --- a/src/modifier/all-held-items.ts +++ b/src/modifier/all-held-items.ts @@ -115,7 +115,7 @@ export class HeldItem implements Localizable { if (stackCount >= this.getMaxStackCount()) { text.setTint(0xf89890); } - text.setOrigin(0, 0); + text.setOrigin(0); return text; } @@ -206,21 +206,21 @@ export class TurnHealHeldItem extends HeldItem { } apply(stackCount: number, pokemon: Pokemon): boolean { - if (!pokemon.isFullHp()) { - globalScene.unshiftPhase( - new PokemonHealPhase( - pokemon.getBattlerIndex(), - toDmgValue(pokemon.getMaxHp() / 16) * stackCount, - i18next.t("modifier:turnHealApply", { - pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), - typeName: this.name, - }), - true, - ), - ); - return true; + if (pokemon.isFullHp()) { + return false; } - return false; + globalScene.unshiftPhase( + new PokemonHealPhase( + pokemon.getBattlerIndex(), + toDmgValue(pokemon.getMaxHp() / 16) * stackCount, + i18next.t("modifier:turnHealApply", { + pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), + typeName: this.name, + }), + true, + ), + ); + return true; } } diff --git a/src/modifier/modifier-type.ts b/src/modifier/modifier-type.ts index 15689f79d6e..b7626a022a3 100644 --- a/src/modifier/modifier-type.ts +++ b/src/modifier/modifier-type.ts @@ -1406,6 +1406,7 @@ class AttackTypeBoosterRewardGenerator extends ModifierTypeGenerator { return new AttackTypeBoosterReward(pregenArgs[0] as PokemonType, TYPE_BOOST_ITEM_BOOST_PERCENT); } + // TODO: make this consider moves or abilities that change types const attackMoveTypes = party.flatMap(p => p .getMoveset() @@ -1420,17 +1421,11 @@ class AttackTypeBoosterRewardGenerator extends ModifierTypeGenerator { const attackMoveTypeWeights = new Map(); let totalWeight = 0; for (const t of attackMoveTypes) { - if (attackMoveTypeWeights.has(t)) { - if (attackMoveTypeWeights.get(t)! < 3) { - // attackMoveTypeWeights.has(t) was checked before - attackMoveTypeWeights.set(t, attackMoveTypeWeights.get(t)! + 1); - } else { - continue; - } - } else { - attackMoveTypeWeights.set(t, 1); + const weight = attackMoveTypeWeights.get(t) ?? 0; + if (weight < 3) { + attackMoveTypeWeights.set(t, weight + 1); + totalWeight++; } - totalWeight++; } if (!totalWeight) { @@ -1477,17 +1472,11 @@ class AttackTypeBoosterModifierTypeGenerator extends ModifierTypeGenerator { const attackMoveTypeWeights = new Map(); let totalWeight = 0; for (const t of attackMoveTypes) { - if (attackMoveTypeWeights.has(t)) { - if (attackMoveTypeWeights.get(t)! < 3) { - // attackMoveTypeWeights.has(t) was checked before - attackMoveTypeWeights.set(t, attackMoveTypeWeights.get(t)! + 1); - } else { - continue; - } - } else { - attackMoveTypeWeights.set(t, 1); + const weight = attackMoveTypeWeights.get(t) ?? 0; + if (weight < 3) { + attackMoveTypeWeights.set(t, weight + 1); + totalWeight++; } - totalWeight++; } if (!totalWeight) {