summaryrefslogtreecommitdiff
path: root/resources/js
diff options
context:
space:
mode:
Diffstat (limited to 'resources/js')
-rw-r--r--resources/js/game.js15
-rw-r--r--resources/js/ui.js35
2 files changed, 30 insertions, 20 deletions
diff --git a/resources/js/game.js b/resources/js/game.js
index 1fdde7d..3ce2aed 100644
--- a/resources/js/game.js
+++ b/resources/js/game.js
@@ -923,6 +923,7 @@ const Game = {
const activeBall = Game.getItemFromInventory(Memory.state.player.inventory, Memory.state.activeBall);
// remove ball
+ Game.log(translate('game:catch:ball:throw', true).replace('{ball}', activeBall.name));
activeBall.quantity--;
if (activeBall.quantity === 0) {
Game.removeItemFromInventory(Memory.state.player.inventory, Memory.state.activeBall);
@@ -931,7 +932,7 @@ const Game = {
}
// attempt capture
- Game.log('Attempting capture!');
+ Game.log(translate('game:catch:attempt', true), 1);
let success = true;
let attempts = 1;
const maxAttempts = 4;
@@ -939,8 +940,8 @@ const Game = {
success = checkCapture(playerMonster, opposingMonster, activeBall);
if (!success) {
- Game.log(`Escape attempt ${attempts}: succeeded!`);
- Game.log(`${opposingMonster.name} broke free!`);
+ Game.log(translate('game:catch:attempt:nr:success', true).replace('{nr}', attempts), 2);
+ Game.log(translate('game:catch:broke_free', true).replace('{monster}', opposingMonster.name), 1);
Memory.state.Game.isInBattle = true;
UI.drawStatus();
@@ -949,7 +950,7 @@ const Game = {
return; // can't catch
}
- Game.log(`Escape attempt ${attempts}: failed!`);
+ Game.log(translate('game:catch:attempt:nr:fail', true).replace('{nr}', attempts), 2);
attempts++;
}
@@ -961,16 +962,16 @@ const Game = {
caughtMonster.level = Memory.state.opponent.activeMonster.level;
caughtMonster.hp = Memory.state.opponent.activeMonster.hp;
- Game.log(`Caught ${caughtMonster.name}!`);
+ Game.log(translate('game:catch:caught', true).replace('{monster}', caughtMonster.name), 1);
if (Memory.state.player.monsters.length < 6) {
Memory.state.player.monsters.push(caughtMonster);
- Game.log(`Added ${caughtMonster.name} to Party!`);
+ Game.log(translate('game:catch:to_party', true).replace('{monster}', caughtMonster.name), 2);
} else {
Memory.state.monsters.push(caughtMonster);
- Game.log(`Transfered ${caughtMonster.name} to Box!`, 1);
+ Game.log(translate('game:catch:to_box', true).replace('{monster}', caughtMonster.name), 2);
}
await Game.encounterWildMonster();
diff --git a/resources/js/ui.js b/resources/js/ui.js
index 3275835..ee33a64 100644
--- a/resources/js/ui.js
+++ b/resources/js/ui.js
@@ -532,17 +532,12 @@ const UI = {
drawArea () {
if (Game.isTown(Memory.state.currentArea)) {
UI.drawTown();
-
UI.closeLog();
-
- UI.elements.sceneBattle.classList.add('hidden');
- UI.elements.sceneTown.classList.remove('hidden');
+ UI.showMap();
} else {
UI.elements.battle.style.backgroundImage = `url(/modules/tuxemon/mods/tuxemon/gfx/ui/combat/${Memory.state.currentArea.environment.battle_graphics.background})`;
- UI.elements.sceneTown.classList.add('hidden');
- UI.elements.sceneBattle.classList.remove('hidden');
-
+ UI.showBattle();
UI.drawOpponentMonster();
UI.drawActiveMonster();
UI.drawActiveTechniques();
@@ -690,7 +685,7 @@ const UI = {
/* Town */
drawTown () {
- UI.elements.sceneTown.querySelector('[data-template-slot="map"]').replaceChildren(UI.createMap());
+ UI.elements.sceneTown.querySelector('[data-template-slot="map"]').replaceChildren(UI.createMap());
},
@@ -736,6 +731,7 @@ const UI = {
Game.encounterMonster(monster);
Memory.state.Game.isInBattle = true;
+ UI.showBattle();
UI.closeAllPopups();
}
})));
@@ -790,11 +786,11 @@ const UI = {
template.querySelector('[data-template-slot="box.withdraw"]').addEventListener('click', UI.wrapCallback(() => {
if (Memory.state.monsters.length === 0) {
- alert('No Tuxemon to withdraw in Box!');
+ alert(translate('ui:healing_center:box:withdraw:no_tuxemon_in_box', true));
return;
}
if (Memory.state.player.monsters.length === 6) {
- alert('Not enough space in party!');
+ alert(translate('ui:healing_center:box:withdraw:no_space_in_party', true));
return;
}
@@ -816,7 +812,7 @@ const UI = {
template.querySelector('[data-template-slot="box.deposit"]').addEventListener('click', UI.wrapCallback(() => {
if (Memory.state.player.monsters.length === 1) {
- alert('Can\'t deposit last Tuxemon!');
+ alert(translate('ui:healing_center:box:deposit:last_tuxemon', true));
return;
}
@@ -1100,16 +1096,29 @@ const UI = {
return template;
},
- openMap () {
+ showMap () {
+ UI.elements.sceneBattle.classList.add('hidden');
+ UI.elements.sceneTown.classList.remove('hidden');
+ },
+
+ toggleMap () {
if (Memory.state.Game.isInBattle || Game.isTown(Memory.state.currentArea)) {
return;
}
+ UI.drawOpponentMonster();
+ UI.drawActiveMonster();
+ UI.drawActiveTechniques();
UI.drawTown();
UI.elements.sceneBattle.classList.toggle('hidden');
UI.elements.sceneTown.classList.toggle('hidden');
},
+ showBattle () {
+ UI.elements.sceneBattle.classList.remove('hidden');
+ UI.elements.sceneTown.classList.add('hidden');
+ },
+
openAreaSelection () {
const popup = UI.createPopup();
const template = UI.createTemplate(Template.areaSelection);
@@ -1849,7 +1858,7 @@ const UI = {
};
// UI element click bindings
-UI.elements.showMap.addEventListener('click', UI.wrapCallback(UI.openMap));
+UI.elements.showMap.addEventListener('click', UI.wrapCallback(UI.toggleMap));
UI.elements.changeArea.addEventListener('click', UI.wrapCallback(UI.openAreaSelection));
UI.elements.menuParty.addEventListener('click', UI.wrapCallback(UI.openPartyMenu));
UI.elements.menuInventory.addEventListener('click', UI.wrapCallback(UI.openInventoryMenu));