From b2d7895c7be7adce92b470a07e7883901130cbb3 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Fri, 1 Dec 2023 10:07:21 -0500 Subject: [PATCH] Add spliced type sharing and fix move description scrolling --- src/modifier/modifier-type.ts | 2 +- src/pokemon.ts | 11 ++++++++++- src/system/game-speed.ts | 14 +++++++++++++- src/ui/summary-ui-handler.ts | 18 ++++++++---------- 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/src/modifier/modifier-type.ts b/src/modifier/modifier-type.ts index ca404b8ed..ff6894584 100644 --- a/src/modifier/modifier-type.ts +++ b/src/modifier/modifier-type.ts @@ -453,7 +453,7 @@ export class EvolutionItemModifierType extends PokemonModifierType implements Ge export class FusePokemonModifierType extends PokemonModifierType { constructor(name: string, iconImage?: string) { - super(name, 'Combines two Pokémon, giving the first Pokémon the ability of the second', (_type, args) => new Modifiers.FusePokemonModifier(this, (args[0] as PlayerPokemon).id, (args[1] as PlayerPokemon).id), + super(name, 'Combines two Pokémon (transfers ability, splits base stats and types, shares move pool)', (_type, args) => new Modifiers.FusePokemonModifier(this, (args[0] as PlayerPokemon).id, (args[1] as PlayerPokemon).id), (pokemon: PlayerPokemon) => { if (pokemon.isFusion()) return PartyUiHandler.NoEffectMessage; diff --git a/src/pokemon.ts b/src/pokemon.ts index 38e1baecc..7e4e8aeb8 100644 --- a/src/pokemon.ts +++ b/src/pokemon.ts @@ -518,7 +518,16 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { const speciesForm = this.getSpeciesForm(); types.push(speciesForm.type1); - if (speciesForm.type2 !== null) + + const fusionSpeciesForm = this.getFusionSpeciesForm(); + if (fusionSpeciesForm) { + if (fusionSpeciesForm.type2 !== null && fusionSpeciesForm.type2 !== speciesForm.type1) + types.push(fusionSpeciesForm.type2); + else if (fusionSpeciesForm.type1 !== speciesForm.type1) + types.push(fusionSpeciesForm.type1); + } + + if (types.length === 1 && speciesForm.type2 !== null) types.push(speciesForm.type2); } diff --git a/src/system/game-speed.ts b/src/system/game-speed.ts index 728e03907..437f85970 100644 --- a/src/system/game-speed.ts +++ b/src/system/game-speed.ts @@ -23,11 +23,17 @@ export function initGameSpeed() { return originalAddEvent.apply(this, [ config ]); }; const originalTweensAdd = this.tweens.add; - this.tweens.add = function (config: Phaser.Types.Tweens.TweenBuilderConfig | object) { + this.tweens.add = function (config: Phaser.Types.Tweens.TweenBuilderConfig | Phaser.Types.Tweens.TweenChainBuilderConfig | Phaser.Tweens.Tween | Phaser.Tweens.TweenChain) { if (config.duration) config.duration = transformValue(config.duration); if (config.delay) config.delay = transformValue(config.delay); + if (config.repeatDelay) + config.repeatDelay = transformValue(config.repeatDelay); + if (config.loopDelay) + config.loopDelay = transformValue(config.loopDelay); + if (config.hold) + config.hold = transformValue(config.hold); return originalTweensAdd.apply(this, [ config ]); }; const originalAddCounter = this.tweens.addCounter; @@ -36,6 +42,12 @@ export function initGameSpeed() { config.duration = transformValue(config.duration); if (config.delay) config.delay = transformValue(config.delay); + if (config.repeatDelay) + config.repeatDelay = transformValue(config.repeatDelay); + if (config.loopDelay) + config.loopDelay = transformValue(config.loopDelay); + if (config.hold) + config.hold = transformValue(config.hold); return originalAddCounter.apply(this, [ config ]); }; diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts index 0615bfaab..f22d5c22d 100644 --- a/src/ui/summary-ui-handler.ts +++ b/src/ui/summary-ui-handler.ts @@ -380,14 +380,11 @@ export default class SummaryUiHandler extends UiHandler { this.moveDescriptionText.setY(84); this.moveDescriptionScrollTween = this.scene.tweens.add({ targets: this.moveDescriptionText, - delay: 2000, + delay: Utils.fixedInt(2000), loop: -1, - loopDelay: 2000, - duration: (moveDescriptionLineCount - 3) * 2000, - y: `-=${14.83 * (moveDescriptionLineCount - 3)}`, - onLoop: () => { - this.moveDescriptionText.setY(84); - } + hold: Utils.fixedInt(2000), + duration: Utils.fixedInt((moveDescriptionLineCount - 3) * 2000), + y: `-=${14.83 * (moveDescriptionLineCount - 3)}` }); } } @@ -496,9 +493,10 @@ export default class SummaryUiHandler extends UiHandler { return typeIcon; }; - profileContainer.add(getTypeIcon(0, this.pokemon.species.type1)); - if (this.pokemon.species.type2) - profileContainer.add(getTypeIcon(1, this.pokemon.species.type2)); + const types = this.pokemon.getTypes(true); + profileContainer.add(getTypeIcon(0, types[0])); + if (types.length > 1) + profileContainer.add(getTypeIcon(1, types[1])); const ability = this.pokemon.getAbility();