summaryrefslogtreecommitdiff
path: root/resources/js/ui.js
diff options
context:
space:
mode:
Diffstat (limited to 'resources/js/ui.js')
-rw-r--r--resources/js/ui.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/resources/js/ui.js b/resources/js/ui.js
index 820a49c..06e55ed 100644
--- a/resources/js/ui.js
+++ b/resources/js/ui.js
@@ -37,7 +37,6 @@ const UI = {
battle: document.querySelector('#battle'),
battleOpponent: document.querySelector('#battle__opponent'),
battleOpponentSprite: null,
- battleOpponentTrainerSprite: document.querySelector('.battle__opponent__trainer-sprite'),
battleOpponentAnimation: document.querySelector('.battle__technique-animation'),
battlePlayer: document.querySelector('#battle__player'),
@@ -298,6 +297,15 @@ const UI = {
battleMonsterNode.classList.add('battle__monster--opponent');
+ if (Game.isBattleType('trainer')) {
+ battleMonsterNode.classList.add('battle__monster--is-trainer');
+
+ if (Memory.state.opponent.sprite) {
+ battleMonsterNode.classList.add('battle__monster--has-trainer-sprite');
+ battleMonsterNode.querySelector('[data-template-slot="trainerSprite"]').src = `/modules/tuxemon/mods/tuxemon/gfx/sprites/player/${Memory.state.opponent.sprite}`;
+ }
+ }
+
return battleMonsterNode;
},
@@ -372,12 +380,6 @@ const UI = {
UI.elements.battleOpponentSprite = battleMonsterNode.querySelector('[data-template-slot="sprite"]');
UI.elements.battleOpponentSprite.style.transitionDuration = `${UI.damageHighlightClickDuration}s`;
- if (Game.isBattleType('trainer') && Memory.state.opponent.sprite) {
- UI.elements.battleOpponentTrainerSprite.src = `/modules/tuxemon/mods/tuxemon/gfx/sprites/player/${Memory.state.opponent.sprite}`;
- } else {
- UI.elements.battleOpponentTrainerSprite.src = '';
- }
-
// en/disable catch
UI.drawActiveBall();