summaryrefslogtreecommitdiff
path: root/resources/js/game.js
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2023-09-01 00:07:35 +0200
committerDaniel Weipert <code@drogueronin.de>2023-09-01 00:07:35 +0200
commit94cf76f8968cf81a06d70fe329b5edf4ec07f94f (patch)
tree3441162085e32ed3abbc73b17bd10edb94432ada /resources/js/game.js
parentc657c77d0cf49afba627b93848e1915e2ce7d3ff (diff)
battle translations
Diffstat (limited to 'resources/js/game.js')
-rw-r--r--resources/js/game.js68
1 files changed, 53 insertions, 15 deletions
diff --git a/resources/js/game.js b/resources/js/game.js
index 2c6ecc0..5abc42f 100644
--- a/resources/js/game.js
+++ b/resources/js/game.js
@@ -98,7 +98,7 @@ const Game = {
const money = calculateAwardedMoney(Memory.state.opponent.activeMonster);
Memory.state.money += money;
Game.addPhaseEvent('postTurn', () => {
- Game.log(`Got ${money} money!`);
+ Game.log(translate('game:battle:money:get', true).replace('{amount}', money));
});
// exp
@@ -171,8 +171,12 @@ const Game = {
Memory.state.money -= totalHealingCenterPrice;
Game.addPhaseEvent('postTurnEnd', () => {
- Game.log(`Whited out!`);
- Game.log(`Payed ${formatPrice(totalHealingCenterPrice)} for full recovery at ${Memory.state.currentArea.name}!`);
+ Game.log(translate('game:battle:defeat', true));
+ Game.log(
+ translate('game:battle:defeat:recovery_price', true)
+ .replace('{amount}', formatPrice(totalHealingCenterPrice))
+ .replace('{name}', Memory.state.currentArea.name)
+ );
});
Memory.saveToLocalStorage();
@@ -246,7 +250,11 @@ const Game = {
});
};
- log(`${user.name} attempts to use ${technique.name}!`);
+ log(
+ translate('game:battle:technique:attempt', true)
+ .replace('{monster.name}', user.name)
+ .replace('{technique.name}', technique.name)
+ );
// recharge
if (technique.isRecharging()) {
@@ -256,7 +264,7 @@ const Game = {
UI.drawActionFeedback(feedbackNode);
}
- log('But has to recharge!', 1);
+ log(translate('game:battle:technique:attempt:fail:recharge', true), 1);
canUse = false;
}
@@ -268,7 +276,7 @@ const Game = {
UI.drawActionFeedback(feedbackNode);
}
- log('But is nodding off!', 1);
+ log(translate('game:battle:technique:attempt:fail:noddingoff', true), 1);
canUse = false;
}
@@ -282,7 +290,7 @@ const Game = {
technique.use();
Game.doBattleAnimation && UI.drawDamageMiss(UI.createDamageMiss());
- log('But missed!', 1);
+ log(translate('game:battle:technique:attempt:fail:miss', true), 1);
return;
}
@@ -300,7 +308,11 @@ const Game = {
technique.use();
Game.addBattlePhaseEvent('action', user, () => {
- Game.log(`${user.name} is using ${technique.name}!`);
+ Game.log(
+ translate('game:battle:technique:use', true)
+ .replace('{monster.name}', user.name)
+ .replace('{technique.name}', technique.name)
+ );
});
for (const techniqueEffectCode of technique.effects) {
@@ -323,7 +335,12 @@ const Game = {
UI.drawTechniqueAnimation(technique);
}
- Game.log(`Deals ${damage} to ${target.name}!`, 1);
+ Game.log(
+ translate('game:battle:technique:use:damage', true)
+ .replace('{amount}', damage)
+ .replace('{name}', target.name),
+ 1
+ );
});
}
@@ -349,7 +366,11 @@ const Game = {
const heal = (user.level + 7) * technique.healingPower;
recipient.hp += heal;
- Game.log(`Heals ${heal}!`, 1);
+ Game.log(
+ translate('game:battle:technique:use:healing', true)
+ .replace('{amount}', heal),
+ 1
+ );
});
}
}
@@ -384,7 +405,12 @@ const Game = {
recipient.statusEffect = statusEffect;
- Game.log(`${techniqueEffect.recipients.map((recipient) => recipient.name).join(', ')} ${techniqueEffect.recipients.length > 1 ? 'are' : 'is'} now ${statusEffect.name}!`, 1);
+ Game.log(
+ translate('game:battle:technique:use:status', true)
+ .replace('{monster.name}', recipient.name)
+ .replace('{status_effect.name}', translate(`status_${statusEffect.slug}`, true)),
+ 1
+ );
}
}
});
@@ -408,7 +434,11 @@ const Game = {
// if still 0 turns left after remove action
if (monster.statusEffect.turnsLeft === 0) {
- Game.log(`${monster.name} is not ${monster.statusEffect.name} anymore!`);
+ Game.log(
+ translate('game:battle:status_effect:removed', true)
+ .replace('{monster.name}', monster.name)
+ .replace('{status_effect.name}', translate(`status_${monster.statusEffect.slug}`, true))
+ );
monster.statusEffect = null;
} else {
@@ -420,7 +450,11 @@ const Game = {
}
const logStatusIs = () => {
- Game.log(`${monster.name} is ${monster.statusEffect.name}!`);
+ Game.log(
+ translate('game:battle:status_effect:is', true)
+ .replace('{monster.name}', monster.name)
+ .replace('{status_effect.name}', translate(`status_${monster.statusEffect.slug}`, true))
+ );
}
// poison / burn
@@ -567,6 +601,7 @@ const Game = {
let speedDifference = Memory.state.opponent.activeMonster.stats.speed - Memory.state.player.activeMonster.stats.speed;
if (speedDifference > 0) speedDifference = speedDifference / 2;
else if (speedDifference < 0 && speedDifference > -100) speedDifference = speedDifference * 2;
+
let levelDifference = Memory.state.opponent.activeMonster.level - Memory.state.player.activeMonster.level;
if (levelDifference >= 5) levelDifference = levelDifference * 2;
else if (levelDifference < 0 && levelDifference > -10) levelDifference = 0;
@@ -848,19 +883,22 @@ const Game = {
if (itemEffect.type === 'heal') {
monster.hp += itemEffect.amount;
+
useLowersQuantity = true;
UI.drawActiveMonster();
}
- if (itemEffect.type === 'revive') {
+ else if (itemEffect.type === 'revive') {
monster.hp = itemEffect.amount;
monster.statusEffect = null;
+
useLowersQuantity = true;
UI.drawActiveMonster();
}
else if (itemEffect.type === 'capture') {
Memory.state.activeBall = item.slug;
+
UI.drawActiveBall();
}
@@ -869,9 +907,9 @@ const Game = {
if (evolution) {
await fetchMonster(evolution.monster_slug);
monster.evolve(evolution);
- UI.drawActiveMonster();
useLowersQuantity = true;
+ UI.drawActiveMonster();
}
}
}