From e76fa25bc870f6e594d4eedb05f0874d09728d06 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Thu, 4 Apr 2024 20:33:08 -0400 Subject: [PATCH] Fix attack type boosters applying universally and buff Soul Dew --- src/data/nature.ts | 5 +++-- src/field/pokemon.ts | 2 +- src/modifier/modifier-type.ts | 4 ++-- src/modifier/modifier.ts | 11 +++++++---- src/ui/pokemon-info-container.ts | 6 +++--- src/ui/starter-select-ui-handler.ts | 2 +- src/ui/text.ts | 4 ++-- 7 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/data/nature.ts b/src/data/nature.ts index 87e875e52..b18ce5abd 100644 --- a/src/data/nature.ts +++ b/src/data/nature.ts @@ -1,6 +1,7 @@ import { Stat, getStatName } from "./pokemon-stat"; import * as Utils from "../utils"; import { TextStyle, getBBCodeFrag } from "../ui/text"; +import { UiTheme } from "#app/enums/ui-theme"; export enum Nature { HARDY, @@ -30,7 +31,7 @@ export enum Nature { QUIRKY } -export function getNatureName(nature: Nature, includeStatEffects: boolean = false, forStarterSelect: boolean = false, ignoreBBCode: boolean = false): string { +export function getNatureName(nature: Nature, includeStatEffects: boolean = false, forStarterSelect: boolean = false, ignoreBBCode: boolean = false, uiTheme: UiTheme = UiTheme.DEFAULT): string { let ret = Utils.toReadableString(Nature[nature]); if (includeStatEffects) { const stats = Utils.getEnumValues(Stat).slice(1); @@ -44,7 +45,7 @@ export function getNatureName(nature: Nature, includeStatEffects: boolean = fals decreasedStat = stat; } const textStyle = forStarterSelect ? TextStyle.SUMMARY_ALT : TextStyle.WINDOW; - const getTextFrag = !ignoreBBCode ? getBBCodeFrag : (text: string, style: TextStyle) => text; + const getTextFrag = !ignoreBBCode ? (text: string, style: TextStyle) => getBBCodeFrag(text, style, uiTheme) : (text: string, style: TextStyle) => text; if (increasedStat && decreasedStat) ret = `${getTextFrag(`${ret}${!forStarterSelect ? '\n' : ' '}(`, textStyle)}${getTextFrag(`+${getStatName(increasedStat, true)}`, TextStyle.SUMMARY_PINK)}${getTextFrag('/', textStyle)}${getTextFrag(`-${getStatName(decreasedStat, true)}`, TextStyle.SUMMARY_BLUE)}${getTextFrag(')', textStyle)}`; else diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 2b0dbe3be..95f8e5a06 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -1092,7 +1092,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { this.scene.applyModifiers(PokemonMultiHitModifier, source.isPlayer(), source, new Utils.IntegerHolder(0), power); if (!typeless) { this.scene.arena.applyTags(WeakenMoveTypeTag, move.type, power); - this.scene.applyModifiers(AttackTypeBoosterModifier, source.isPlayer(), source, power); + this.scene.applyModifiers(AttackTypeBoosterModifier, source.isPlayer(), source, move.type, power); } if (source.getTag(HelpingHandTag)) power.value *= 1.5; diff --git a/src/modifier/modifier-type.ts b/src/modifier/modifier-type.ts index e777c1125..a3ac864b1 100644 --- a/src/modifier/modifier-type.ts +++ b/src/modifier/modifier-type.ts @@ -845,7 +845,7 @@ export const modifierTypes = { SOOTHE_BELL: () => new PokemonFriendshipBoosterModifierType('Soothe Bell'), - SOUL_DEW: () => new PokemonHeldItemModifierType('Soul Dew', 'Increases the influence of a Pokémon\'s nature on its stats by 5% (additive)', (type, args) => new Modifiers.PokemonNatureWeightModifier(type, (args[0] as Pokemon).id)), + SOUL_DEW: () => new PokemonHeldItemModifierType('Soul Dew', 'Increases the influence of a Pokémon\'s nature on its stats by 10% (additive)', (type, args) => new Modifiers.PokemonNatureWeightModifier(type, (args[0] as Pokemon).id)), NUGGET: () => new MoneyRewardModifierType('Nugget', 1, 'small'), BIG_NUGGET: () => new MoneyRewardModifierType('Big Nugget', 2.5, 'moderate'), @@ -1012,7 +1012,6 @@ const modifierPool: ModifierPool = { new WeightedModifierType(modifierTypes.TM_ULTRA, 8), new WeightedModifierType(modifierTypes.RARER_CANDY, 4), new WeightedModifierType(modifierTypes.SOOTHE_BELL, (party: Pokemon[]) => party.find(p => (pokemonEvolutions.hasOwnProperty(p.species.speciesId) && pokemonEvolutions[p.species.speciesId].find(e => e.condition && e.condition instanceof SpeciesFriendshipEvolutionCondition)) || p.moveset.find(m => m.moveId === Moves.RETURN)) ? 16 : 0, 16), - new WeightedModifierType(modifierTypes.SOUL_DEW, 2), new WeightedModifierType(modifierTypes.GOLDEN_PUNCH, 2), new WeightedModifierType(modifierTypes.IV_SCANNER, 4), new WeightedModifierType(modifierTypes.EXP_CHARM, 8), @@ -1029,6 +1028,7 @@ const modifierPool: ModifierPool = { new WeightedModifierType(modifierTypes.BERRY_POUCH, 4), new WeightedModifierType(modifierTypes.GRIP_CLAW, 5), new WeightedModifierType(modifierTypes.BATON, 2), + new WeightedModifierType(modifierTypes.SOUL_DEW, 8), //new WeightedModifierType(modifierTypes.OVAL_CHARM, 6), new WeightedModifierType(modifierTypes.ABILITY_CHARM, 6), new WeightedModifierType(modifierTypes.FOCUS_BAND, 5), diff --git a/src/modifier/modifier.ts b/src/modifier/modifier.ts index 64d7a9332..5fd65ee66 100644 --- a/src/modifier/modifier.ts +++ b/src/modifier/modifier.ts @@ -681,9 +681,12 @@ export class AttackTypeBoosterModifier extends PokemonHeldItemModifier { } apply(args: any[]): boolean { - (args[1] as Utils.NumberHolder).value = Math.floor((args[1] as Utils.NumberHolder).value * (1 + (this.getStackCount() * this.boostMultiplier))); + if (args[1] === this.moveType) { + (args[2] as Utils.NumberHolder).value = Math.floor((args[2] as Utils.NumberHolder).value * (1 + (this.getStackCount() * this.boostMultiplier))); + return true; + } - return true; + return false; } getScoreMultiplier(): number { @@ -1424,7 +1427,7 @@ export class PokemonNatureWeightModifier extends PokemonHeldItemModifier { apply(args: any[]): boolean { const multiplier = args[1] as Utils.IntegerHolder; if (multiplier.value !== 1) { - multiplier.value += 0.05 * this.getStackCount() * (multiplier.value > 1 ? 1 : -1); + multiplier.value += 0.1 * this.getStackCount() * (multiplier.value > 1 ? 1 : -1); return true; } @@ -1432,7 +1435,7 @@ export class PokemonNatureWeightModifier extends PokemonHeldItemModifier { } getMaxHeldItemCount(pokemon: Pokemon): integer { - return 5; + return 10; } } diff --git a/src/ui/pokemon-info-container.ts b/src/ui/pokemon-info-container.ts index 26de881cc..f2921e124 100644 --- a/src/ui/pokemon-info-container.ts +++ b/src/ui/pokemon-info-container.ts @@ -123,10 +123,10 @@ export default class PokemonInfoContainer extends Phaser.GameObjects.Container { const ability = pokemon.getAbility(true); const abilityTextStyle = ability.id === pokemon.getSpeciesForm().abilityHidden ? TextStyle.MONEY : TextStyle.WINDOW; this.pokemonAbilityText.setText(ability.name); - this.pokemonAbilityText.setColor(getTextColor(abilityTextStyle)); - this.pokemonAbilityText.setShadowColor(getTextColor(abilityTextStyle, true)); + this.pokemonAbilityText.setColor(getTextColor(abilityTextStyle, false, this.scene.uiTheme)); + this.pokemonAbilityText.setShadowColor(getTextColor(abilityTextStyle, true, this.scene.uiTheme)); - this.pokemonNatureText.setText(getNatureName(pokemon.getNature(), true)); + this.pokemonNatureText.setText(getNatureName(pokemon.getNature(), true, false, false, this.scene.uiTheme)); const originalIvs: integer[] = this.scene.gameData.dexData[pokemon.species.speciesId].caughtAttr ? this.scene.gameData.dexData[pokemon.species.speciesId].ivs diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index 2b0f4e2ae..bdf10fede 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -1135,7 +1135,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { this.pokemonAbilityText.setColor(this.getTextColor(!isHidden ? TextStyle.SUMMARY_ALT : TextStyle.SUMMARY_GOLD)); this.pokemonAbilityText.setShadowColor(this.getTextColor(!isHidden ? TextStyle.SUMMARY_ALT : TextStyle.SUMMARY_GOLD, true)); - this.pokemonNatureText.setText(getNatureName(natureIndex as unknown as Nature, true, true)); + this.pokemonNatureText.setText(getNatureName(natureIndex as unknown as Nature, true, true, false, this.scene.uiTheme)); let levelMoves: LevelMoves; if (pokemonFormLevelMoves.hasOwnProperty(species.speciesId) && pokemonFormLevelMoves[species.speciesId].hasOwnProperty(formIndex)) diff --git a/src/ui/text.ts b/src/ui/text.ts index 21672847f..6162d21b7 100644 --- a/src/ui/text.ts +++ b/src/ui/text.ts @@ -114,8 +114,8 @@ function getTextStyleOptions(style: TextStyle, uiTheme: UiTheme, extraStyleOptio return [ styleOptions, shadowColor, shadowSize ]; } -export function getBBCodeFrag(content: string, textStyle: TextStyle): string { - return `[color=${getTextColor(textStyle)}][shadow=${getTextColor(textStyle, true)}]${content}`; +export function getBBCodeFrag(content: string, textStyle: TextStyle, uiTheme: UiTheme = UiTheme.DEFAULT): string { + return `[color=${getTextColor(textStyle, false, uiTheme)}][shadow=${getTextColor(textStyle, true, uiTheme)}]${content}`; } export function getTextColor(textStyle: TextStyle, shadow?: boolean, uiTheme: UiTheme = UiTheme.DEFAULT): string {