From 67ee104178b51698f581b696402e5cbd3480eadd Mon Sep 17 00:00:00 2001 From: LaukkaE <73663099+LaukkaE@users.noreply.github.com> Date: Mon, 6 May 2024 03:26:11 +0300 Subject: [PATCH] Fix Protosynthesis and Quark Drive (#289) * Fix Protosynthesis and Quark Drive * add partial tags --- src/data/ability.ts | 6 ++++-- src/data/battler-tags.ts | 2 +- src/field/pokemon.ts | 8 ++++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index ff183a28432..eec1240e1d3 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -3511,13 +3511,15 @@ export function initAbilities() { .attr(PostWeatherChangeAddBattlerTagAttr, BattlerTagType.PROTOSYNTHESIS, 0, WeatherType.SUNNY, WeatherType.HARSH_SUN) .attr(UncopiableAbilityAbAttr) .attr(UnswappableAbilityAbAttr) - .attr(NoTransformAbilityAbAttr), + .attr(NoTransformAbilityAbAttr) + .partial(), // While setting the tag, the getbattlestat should ignore all modifiers to stats except stat stages new Ability(Abilities.QUARK_DRIVE, 9) .conditionalAttr(getTerrainCondition(TerrainType.ELECTRIC), PostSummonAddBattlerTagAbAttr, BattlerTagType.QUARK_DRIVE, 0, true) .attr(PostTerrainChangeAddBattlerTagAttr, BattlerTagType.QUARK_DRIVE, 0, TerrainType.ELECTRIC) .attr(UncopiableAbilityAbAttr) .attr(UnswappableAbilityAbAttr) - .attr(NoTransformAbilityAbAttr), + .attr(NoTransformAbilityAbAttr) + .partial(), // While setting the tag, the getbattlestat should ignore all modifiers to stats except stat stages new Ability(Abilities.GOOD_AS_GOLD, 9) .attr(MoveImmunityAbAttr, (pokemon, attacker, move) => pokemon !== attacker && move.getMove().category === MoveCategory.STATUS) .ignorable() diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index 183306d5066..0fea80c3759 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -920,7 +920,7 @@ export class HighestStatBoostTag extends AbilityBattlerTag { stats.map(s => pokemon.getBattleStat(s)).reduce((highestValue: integer, value: integer, i: integer) => { if (value > highestValue) { highestStat = stats[i]; - return highestValue += value; + return value; } return highestValue; }, 0); diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 606185e0984..b20096513ef 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -19,7 +19,7 @@ import { pokemonEvolutions, pokemonPrevolutions, SpeciesFormEvolution, SpeciesEv import { reverseCompatibleTms, tmSpecies } from '../data/tms'; import { DamagePhase, FaintPhase, LearnMovePhase, ObtainStatusEffectPhase, StatChangePhase, SwitchSummonPhase } from '../phases'; import { BattleStat } from '../data/battle-stat'; -import { BattlerTag, BattlerTagLapseType, EncoreTag, HelpingHandTag, TypeBoostTag, getBattlerTag } from '../data/battler-tags'; +import { BattlerTag, BattlerTagLapseType, EncoreTag, HelpingHandTag, HighestStatBoostTag, TypeBoostTag, getBattlerTag } from '../data/battler-tags'; import { BattlerTagType } from "../data/enums/battler-tag-type"; import { Species } from '../data/enums/species'; import { WeatherType } from '../data/weather'; @@ -600,7 +600,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { ret >>= 1; break; } - + + const highestStatBoost = this.findTag(t => t instanceof HighestStatBoostTag && (t as HighestStatBoostTag).stat === stat) as HighestStatBoostTag; + if (highestStatBoost) + ret *= highestStatBoost.multiplier; + return Math.floor(ret); }