Have Friendship Value be shown in summary

This commit is contained in:
Jannik Tappert 2024-09-28 15:09:34 +02:00
parent 4364ab36b9
commit e17859ee65
3 changed files with 41 additions and 2 deletions

View File

@ -40,5 +40,6 @@
"Sassy": "{{nature}}", "Sassy": "{{nature}}",
"Careful": "{{nature}}", "Careful": "{{nature}}",
"Quirky": "{{nature}}" "Quirky": "{{nature}}"
} },
"friendship": "Freundschaft"
} }

View File

@ -40,5 +40,6 @@
"Sassy": "{{nature}}", "Sassy": "{{nature}}",
"Careful": "{{nature}}", "Careful": "{{nature}}",
"Quirky": "{{nature}}" "Quirky": "{{nature}}"
} },
"friendship": "Friendship"
} }

View File

@ -87,6 +87,10 @@ export default class SummaryUiHandler extends UiHandler {
private moveAccuracyText: Phaser.GameObjects.Text; private moveAccuracyText: Phaser.GameObjects.Text;
private moveCategoryIcon: Phaser.GameObjects.Sprite; private moveCategoryIcon: Phaser.GameObjects.Sprite;
private summaryPageTransitionContainer: Phaser.GameObjects.Container; private summaryPageTransitionContainer: Phaser.GameObjects.Container;
private friendshipShadow: Phaser.GameObjects.Sprite;
private friendshipText: Phaser.GameObjects.Text;
private friendshipIcon: Phaser.GameObjects.Sprite;
private friendshipOverlay: Phaser.GameObjects.Sprite;
private descriptionScrollTween: Phaser.Tweens.Tween | null; private descriptionScrollTween: Phaser.Tweens.Tween | null;
private moveCursorBlinkTimer: Phaser.Time.TimerEvent | null; private moveCursorBlinkTimer: Phaser.Time.TimerEvent | null;
@ -187,6 +191,27 @@ export default class SummaryUiHandler extends UiHandler {
this.candyCountText.setOrigin(0, 0); this.candyCountText.setOrigin(0, 0);
this.summaryContainer.add(this.candyCountText); this.summaryContainer.add(this.candyCountText);
this.friendshipIcon = this.scene.add.sprite(13, -60, "candy");
this.friendshipIcon.setScale(0.8);
this.summaryContainer.add(this.friendshipIcon);
this.friendshipOverlay = this.scene.add.sprite(13, -60, "candy_overlay");
this.friendshipOverlay.setScale(0.8);
this.summaryContainer.add(this.friendshipOverlay);
this.friendshipShadow = this.scene.add.sprite(13, -60, "candy");
this.friendshipShadow.setTint(0x000000);
this.friendshipShadow.setAlpha(0.50);
this.friendshipShadow.setScale(0.8);
this.friendshipShadow.setInteractive(new Phaser.Geom.Rectangle(0, 0, 16, 16), Phaser.Geom.Rectangle.Contains);
this.summaryContainer.add(this.friendshipShadow);
this.friendshipText = addTextObject(this.scene, 20, -66, "x0", TextStyle.WINDOW_ALT, { fontSize: "76px" });
this.friendshipText.setOrigin(0, 0);
this.summaryContainer.add(this.friendshipText);
this.championRibbon = this.scene.add.image(88, -146, "champion_ribbon"); this.championRibbon = this.scene.add.image(88, -146, "champion_ribbon");
this.championRibbon.setOrigin(0, 0); this.championRibbon.setOrigin(0, 0);
//this.championRibbon.setScale(0.8); //this.championRibbon.setScale(0.8);
@ -292,6 +317,9 @@ export default class SummaryUiHandler extends UiHandler {
this.candyIcon.setTint(argbFromRgba(Utils.rgbHexToRgba(colorScheme[0]))); this.candyIcon.setTint(argbFromRgba(Utils.rgbHexToRgba(colorScheme[0])));
this.candyOverlay.setTint(argbFromRgba(Utils.rgbHexToRgba(colorScheme[1]))); this.candyOverlay.setTint(argbFromRgba(Utils.rgbHexToRgba(colorScheme[1])));
this.friendshipIcon.setTint(argbFromRgba(Utils.rgbHexToRgba(colorScheme[0])));
this.friendshipOverlay.setTint(argbFromRgba(Utils.rgbHexToRgba(colorScheme[1])));
this.numberText.setText(Utils.padInt(this.pokemon.species.speciesId, 4)); this.numberText.setText(Utils.padInt(this.pokemon.species.speciesId, 4));
this.numberText.setColor(this.getTextColor(!this.pokemon.isShiny() ? TextStyle.SUMMARY : TextStyle.SUMMARY_GOLD)); this.numberText.setColor(this.getTextColor(!this.pokemon.isShiny() ? TextStyle.SUMMARY : TextStyle.SUMMARY_GOLD));
this.numberText.setShadowColor(this.getTextColor(!this.pokemon.isShiny() ? TextStyle.SUMMARY : TextStyle.SUMMARY_GOLD, true)); this.numberText.setShadowColor(this.getTextColor(!this.pokemon.isShiny() ? TextStyle.SUMMARY : TextStyle.SUMMARY_GOLD, true));
@ -345,6 +373,15 @@ export default class SummaryUiHandler extends UiHandler {
this.candyShadow.setCrop(0, 0, 16, candyCropY); this.candyShadow.setCrop(0, 0, 16, candyCropY);
if (this.friendshipShadow.visible) {
this.friendshipShadow.on("pointerover", () => (this.scene as BattleScene).ui.showTooltip("", `${i18next.t("pokemonSummary:friendship")}`, true));
this.friendshipShadow.on("pointerout", () => (this.scene as BattleScene).ui.hideTooltip());
}
this.friendshipText.setText(` ${this.pokemon?.friendship||"0"}/255`);
this.friendshipShadow.setCrop(0, 0, 16, 16 * (this.pokemon?.friendship||0) / 255);
const doubleShiny = isFusion && this.pokemon.shiny && this.pokemon.fusionShiny; const doubleShiny = isFusion && this.pokemon.shiny && this.pokemon.fusionShiny;
const baseVariant = !doubleShiny ? this.pokemon.getVariant() : this.pokemon.variant; const baseVariant = !doubleShiny ? this.pokemon.getVariant() : this.pokemon.variant;