Merge branch 'pretty_boxes' into 'master'

Pretty boxes

Closes #44 et #28

See merge request ynerant/squirrel-battle!48
This commit is contained in:
ynerant 2020-12-12 17:42:38 +01:00
commit 5eefe1937a
9 changed files with 205 additions and 117 deletions

View File

@ -222,6 +222,10 @@ class HorizontalSplit(Display):
class Box(Display):
title: str = ""
def update_title(self, title: str) -> None:
self.title = title
def __init__(self, *args, fg_border_color: Optional[int] = None, **kwargs):
super().__init__(*args, **kwargs)
@ -236,5 +240,11 @@ class Box(Display):
self.addstr(self.pad, i, self.width - 1, "", self.fg_border_color)
self.addstr(self.pad, self.height - 1, 0,
"" + "" * (self.width - 2) + "", self.fg_border_color)
if self.title:
self.addstr(self.pad, 0, (self.width - len(self.title) - 8) // 2,
f" == {self.title} == ", curses.COLOR_GREEN,
italic=True, bold=True)
self.refresh_pad(self.pad, 0, 0, self.y, self.x,
self.y + self.height - 1, self.x + self.width - 1)

View File

@ -6,7 +6,7 @@ from random import randint
from typing import List
from squirrelbattle.menus import Menu, MainMenu
from .display import Display, Box
from .display import Box, Display
from ..enums import KeyValues
from ..game import Game
from ..resources import ResourceManager
@ -135,15 +135,12 @@ class MainMenuDisplay(Display):
class PlayerInventoryDisplay(MenuDisplay):
message = _("== INVENTORY ==")
def update_pad(self) -> None:
self.addstr(self.pad, 0, (self.width - len(self.message)) // 2,
self.message, bold=True, italic=True)
self.menubox.update_title(_("INVENTORY"))
for i, item in enumerate(self.menu.values):
rep = self.pack[item.name.upper()]
selection = f"[{rep}]" if i == self.menu.position else f" {rep} "
self.addstr(self.pad, 2 + i, 0, selection
self.addstr(self.pad, i + 1, 0, selection
+ " " + item.translated_name.capitalize())
@property
@ -158,20 +155,17 @@ class PlayerInventoryDisplay(MenuDisplay):
"""
We can select a menu item with the mouse.
"""
self.menu.position = max(0, min(len(self.menu.values) - 1, y - 3))
self.menu.position = max(0, min(len(self.menu.values) - 1, y - 2))
game.handle_key_pressed(KeyValues.ENTER)
class StoreInventoryDisplay(MenuDisplay):
message = _("== STALL ==")
def update_pad(self) -> None:
self.addstr(self.pad, 0, (self.width - len(self.message)) // 2,
self.message, bold=True, italic=True)
self.menubox.update_title(_("STALL"))
for i, item in enumerate(self.menu.values):
rep = self.pack[item.name.upper()]
selection = f"[{rep}]" if i == self.menu.position else f" {rep} "
self.addstr(self.pad, 2 + i, 0, selection
self.addstr(self.pad, i + 1, 0, selection
+ " " + item.translated_name.capitalize()
+ ": " + str(item.price) + " Hazels")
@ -187,5 +181,5 @@ class StoreInventoryDisplay(MenuDisplay):
"""
We can select a menu item with the mouse.
"""
self.menu.position = max(0, min(len(self.menu.values) - 1, y - 3))
self.menu.position = max(0, min(len(self.menu.values) - 1, y - 2))
game.handle_key_pressed(KeyValues.ENTER)

View File

@ -43,8 +43,10 @@ class Sunflower(FriendlyEntity):
"""
A friendly sunflower
"""
dialogue_option = [_("Flower power!!"), _("The sun is warm today")]
def __init__(self, maxhealth: int = 15,
*args, **kwargs) -> None:
super().__init__(name="sunflower", maxhealth=maxhealth, *args, **kwargs)
@property
def dialogue_option(self):
return [_("Flower power!!"), _("The sun is warm today")]

View File

@ -474,9 +474,9 @@ class FriendlyEntity(FightingEntity):
dialogue_option: list
def talk_to(self, player: Any) -> str:
a = randint(0, len(self.dialogue_option) - 1)
return "The " + self.translated_name \
+ " said : " + self.dialogue_option[a]
return _("{entity} said: {message}").format(
entity=self.translated_name.capitalize(),
message=choice(self.dialogue_option))
def keys(self) -> list:
"""

View File

@ -1,12 +1,14 @@
# German translation of Squirrel Battle
# Copyright (C) YEAR ÿnérant, eichhornchen, nicomarg, charlse
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ÿnérant, eichhornchen, nicomarg, charlse, ifugao
# This file is distributed under the same license as the squirrelbattle package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: squirrelbattle 3.14.1\n"
"Report-Msgid-Bugs-To: squirrel-battle@crans.org\n"
"POT-Creation-Date: 2020-12-11 18:06+0100\n"
"POT-Creation-Date: 2020-12-12 17:24+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -15,19 +17,19 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: squirrelbattle/display/menudisplay.py:113
msgid "== INVENTORY =="
msgstr "== BESTAND =="
#: squirrelbattle/display/menudisplay.py:139
msgid "INVENTORY"
msgstr "BESTAND"
#: squirrelbattle/display/menudisplay.py:134
msgid "== STALL =="
msgstr "== STAND =="
#: squirrelbattle/display/menudisplay.py:164
msgid "STALL"
msgstr "STAND"
#: squirrelbattle/display/statsdisplay.py:34
#: squirrelbattle/display/statsdisplay.py:33
msgid "Inventory:"
msgstr "Bestand:"
#: squirrelbattle/display/statsdisplay.py:53
#: squirrelbattle/display/statsdisplay.py:52
msgid "YOU ARE DEAD"
msgstr "SIE WURDEN GESTORBEN"
@ -36,11 +38,11 @@ msgstr "SIE WURDEN GESTORBEN"
msgid "I don't sell any squirrel"
msgstr "Ich verkaufe keinen Eichhörnchen."
#: squirrelbattle/entities/friendly.py:46
#: squirrelbattle/entities/friendly.py:52
msgid "Flower power!!"
msgstr "Blumenmacht!!"
#: squirrelbattle/entities/friendly.py:46
#: squirrelbattle/entities/friendly.py:52
msgid "The sun is warm today"
msgstr "Die Sonne ist warm heute"
@ -51,16 +53,16 @@ msgstr "Die Sonne ist warm heute"
msgid "Bomb is exploding."
msgstr "Die Bombe explodiert."
#: squirrelbattle/entities/items.py:224
#: squirrelbattle/entities/items.py:248
#, python-brace-format
msgid "{player} exchanged its body with {entity}."
msgstr "{player} täuscht seinem Körper mit {entity} aus."
#: squirrelbattle/game.py:199 squirrelbattle/tests/game_test.py:537
#: squirrelbattle/game.py:203 squirrelbattle/tests/game_test.py:573
msgid "You do not have enough money"
msgstr ""
msgstr "Sie haben nicht genug Geld"
#: squirrelbattle/game.py:243
#: squirrelbattle/game.py:247
msgid ""
"Some keys are missing in your save file.\n"
"Your save seems to be corrupt. It got deleted."
@ -68,7 +70,7 @@ msgstr ""
"In Ihrer Speicherdatei fehlen einige Schlüssel.\n"
"Ihre Speicherung scheint korrupt zu sein. Es wird gelöscht."
#: squirrelbattle/game.py:251
#: squirrelbattle/game.py:255
msgid ""
"No player was found on this map!\n"
"Maybe you died?"
@ -76,7 +78,7 @@ msgstr ""
"Auf dieser Karte wurde kein Spieler gefunden!\n"
"Vielleicht sind Sie gestorben?"
#: squirrelbattle/game.py:271
#: squirrelbattle/game.py:275
msgid ""
"The JSON file is not correct.\n"
"Your save seems corrupted. It got deleted."
@ -99,12 +101,17 @@ msgstr "{name} nimmt {amount} Schadenspunkte."
msgid "{name} dies."
msgstr "{name} stirbt."
#: squirrelbattle/interfaces.py:477
#, python-brace-format
msgid "{entity} said: {message}"
msgstr "{entity} hat gesagt: {message}"
#: squirrelbattle/menus.py:73
msgid "Back"
msgstr "Zurück"
#: squirrelbattle/tests/game_test.py:314 squirrelbattle/tests/game_test.py:317
#: squirrelbattle/tests/game_test.py:320
#: squirrelbattle/tests/game_test.py:344 squirrelbattle/tests/game_test.py:347
#: squirrelbattle/tests/game_test.py:350 squirrelbattle/tests/game_test.py:353
#: squirrelbattle/tests/translations_test.py:16
msgid "New game"
msgstr "Neu Spiel"
@ -198,33 +205,45 @@ msgid "player"
msgstr "Spieler"
#: squirrelbattle/tests/translations_test.py:61
msgid "tiger"
msgstr "Tiger"
#: squirrelbattle/tests/translations_test.py:62
msgid "hedgehog"
msgstr "Igel"
#: squirrelbattle/tests/translations_test.py:62
msgid "merchant"
msgstr "Kaufmann"
#: squirrelbattle/tests/translations_test.py:63
msgid "rabbit"
msgstr "Kanninchen"
#: squirrelbattle/tests/translations_test.py:64
msgid "sunflower"
msgstr "Sonnenblume"
#: squirrelbattle/tests/translations_test.py:65
msgid "teddy bear"
msgstr "Teddybär"
#: squirrelbattle/tests/translations_test.py:66
msgid "tiger"
msgstr "Tiger"
#: squirrelbattle/tests/translations_test.py:68
msgid "body snatch potion"
msgstr "Leichenfleddererzaubertrank"
#: squirrelbattle/tests/translations_test.py:67
#: squirrelbattle/tests/translations_test.py:69
msgid "bomb"
msgstr "Bombe"
#: squirrelbattle/tests/translations_test.py:68
#: squirrelbattle/tests/translations_test.py:70
msgid "explosion"
msgstr "Explosion"
#: squirrelbattle/tests/translations_test.py:71
msgid "heart"
msgstr "Herz"
#: squirrelbattle/tests/translations_test.py:69
#: squirrelbattle/tests/translations_test.py:72
msgid "sword"
msgstr "schwert"

View File

@ -1,49 +1,67 @@
# Spanish translation of Squirrel Battle
# Copyright (C) YEAR ÿnérant, eichhornchen, nicomarg, charlse
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ÿnérant, eichhornchen, nicomarg, charlse, ifugao
# This file is distributed under the same license as the squirrelbattle package.
# Translation by ifugaao
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: squirrelbattle 3.14.1\n"
"Report-Msgid-Bugs-To: squirrel-battle@crans.org\n"
"POT-Creation-Date: 2020-12-05 14:46+0100\n"
"POT-Creation-Date: 2020-12-12 17:24+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: ifugao\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
# Suggested in Weblate: == INVENTORIO ==
#: squirrelbattle/display/menudisplay.py:105
msgid "== INVENTORY =="
msgstr "== INVENTORIO =="
#: squirrelbattle/display/menudisplay.py:139
msgid "INVENTORY"
msgstr "INVENTORIO"
# Suggested in Weblate: Inventorio :
#: squirrelbattle/display/statsdisplay.py:34
#: squirrelbattle/display/menudisplay.py:164
msgid "STALL"
msgstr "PUESTO"
#: squirrelbattle/display/statsdisplay.py:33
msgid "Inventory:"
msgstr "Inventorio :"
# Suggested in Weblate: ERES MUERTO
#: squirrelbattle/display/statsdisplay.py:50
#: squirrelbattle/display/statsdisplay.py:52
msgid "YOU ARE DEAD"
msgstr "ERES MUERTO"
#: squirrelbattle/entities/friendly.py:33
msgid "I don't sell any squirrel"
msgstr "No vendo ninguna ardilla"
#: squirrelbattle/entities/friendly.py:52
msgid "Flower power!!"
msgstr "Poder de las flores!!"
#: squirrelbattle/entities/friendly.py:52
msgid "The sun is warm today"
msgstr "El sol está caliente hoy"
#. The bomb is exploding.
#. Each entity that is close to the bomb takes damages.
#. The player earn XP if the entity was killed.
#: squirrelbattle/entities/items.py:128
#: squirrelbattle/entities/items.py:151
msgid "Bomb is exploding."
msgstr "La bomba está explotando."
#: squirrelbattle/entities/items.py:172
#: squirrelbattle/entities/items.py:248
#, python-brace-format
msgid "{player} exchanged its body with {entity}."
msgstr "{player} intercambió su cuerpo con {entity}."
#: squirrelbattle/game.py:177
#: squirrelbattle/game.py:203 squirrelbattle/tests/game_test.py:573
msgid "You do not have enough money"
msgstr "No tienes suficiente dinero"
#: squirrelbattle/game.py:247
msgid ""
"Some keys are missing in your save file.\n"
"Your save seems to be corrupt. It got deleted."
@ -51,7 +69,7 @@ msgstr ""
"Algunas claves faltan en su archivo de guarda.\n"
"Su guarda parece a ser corruptido. Fue eliminado."
#: squirrelbattle/game.py:185
#: squirrelbattle/game.py:255
msgid ""
"No player was found on this map!\n"
"Maybe you died?"
@ -59,7 +77,7 @@ msgstr ""
"No jugador encontrado sobre la carta !\n"
"¿ Quizas murió ?"
#: squirrelbattle/game.py:205
#: squirrelbattle/game.py:275
msgid ""
"The JSON file is not correct.\n"
"Your save seems corrupted. It got deleted."
@ -67,28 +85,32 @@ msgstr ""
"El JSON archivo no es correcto.\n"
"Su guarda parece corrupta. Fue eliminada."
#: squirrelbattle/interfaces.py:400
#: squirrelbattle/interfaces.py:429
#, python-brace-format
msgid "{name} hits {opponent}."
msgstr "{name} golpea a {opponent}."
#: squirrelbattle/interfaces.py:412
#: squirrelbattle/interfaces.py:441
#, python-brace-format
msgid "{name} takes {amount} damage."
msgstr "{name} recibe {amount} daño."
#: squirrelbattle/interfaces.py:414
#: squirrelbattle/interfaces.py:443
#, python-brace-format
msgid "{name} dies."
msgstr "{name} se muere."
#: squirrelbattle/menus.py:72
#: squirrelbattle/interfaces.py:477
#, python-brace-format
msgid "{entity} said: {message}"
msgstr "{entity} dijo : {message}"
#: squirrelbattle/menus.py:73
msgid "Back"
msgstr "Volver"
#: squirrelbattle/tests/game_test.py:300,
#: squirrelbattle/tests/game_test.py:303,
#: squirrelbattle/tests/game_test.py:306,
#: squirrelbattle/tests/game_test.py:344 squirrelbattle/tests/game_test.py:347
#: squirrelbattle/tests/game_test.py:350 squirrelbattle/tests/game_test.py:353
#: squirrelbattle/tests/translations_test.py:16
msgid "New game"
msgstr "Nuevo partido"
@ -166,41 +188,61 @@ msgid "Key used to drop an item in the inventory"
msgstr "Tecla para dejar un objeto del inventorio"
#: squirrelbattle/tests/translations_test.py:53
msgid "Key used to talk to a friendly entity"
msgstr "Tecla para hablar con una entidad amiga"
#: squirrelbattle/tests/translations_test.py:55
msgid "Texture pack"
msgstr "Paquete de texturas"
#: squirrelbattle/tests/translations_test.py:54
#: squirrelbattle/tests/translations_test.py:56
msgid "Language"
msgstr "Languaje"
#: squirrelbattle/tests/translations_test.py:57
#: squirrelbattle/tests/translations_test.py:59
msgid "player"
msgstr "jugador"
#: squirrelbattle/tests/translations_test.py:59
msgid "tiger"
msgstr "tigre"
#: squirrelbattle/tests/translations_test.py:60
#: squirrelbattle/tests/translations_test.py:61
msgid "hedgehog"
msgstr "erizo"
#: squirrelbattle/tests/translations_test.py:61
#: squirrelbattle/tests/translations_test.py:62
msgid "merchant"
msgstr "comerciante"
#: squirrelbattle/tests/translations_test.py:63
msgid "rabbit"
msgstr "conejo"
#: squirrelbattle/tests/translations_test.py:62
#: squirrelbattle/tests/translations_test.py:64
msgid "sunflower"
msgstr "girasol"
#: squirrelbattle/tests/translations_test.py:65
msgid "teddy bear"
msgstr "osito de peluche"
#: squirrelbattle/tests/translations_test.py:64
#: squirrelbattle/tests/translations_test.py:66
msgid "tiger"
msgstr "tigre"
#: squirrelbattle/tests/translations_test.py:68
msgid "body snatch potion"
msgstr "poción de intercambio"
#: squirrelbattle/tests/translations_test.py:65
#: squirrelbattle/tests/translations_test.py:69
msgid "bomb"
msgstr "bomba"
#: squirrelbattle/tests/translations_test.py:66
#: squirrelbattle/tests/translations_test.py:70
msgid "explosion"
msgstr "explosión"
#: squirrelbattle/tests/translations_test.py:71
msgid "heart"
msgstr "corazón"
#: squirrelbattle/tests/translations_test.py:72
msgid "sword"
msgstr "espada"

View File

@ -1,34 +1,35 @@
# French translation of Squirrel Battle
# Copyright (C) YEAR ÿnérant, eichhornchen, nicomarg, charlse
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ÿnérant, eichhornchen, nicomarg, charlse, ifugao
# This file is distributed under the same license as the squirrelbattle package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: squirrelbattle 3.14.1\n"
"Report-Msgid-Bugs-To: squirrel-battle@crans.org\n"
"POT-Creation-Date: 2020-12-11 18:06+0100\n"
"POT-Creation-Date: 2020-12-12 17:24+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: fr\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: squirrelbattle/display/menudisplay.py:113
msgid "== INVENTORY =="
msgstr "== INVENTAIRE =="
#: squirrelbattle/display/menudisplay.py:139
msgid "INVENTORY"
msgstr "INVENTAIRE"
#: squirrelbattle/display/menudisplay.py:134
msgid "== STALL =="
msgstr "== STAND =="
#: squirrelbattle/display/menudisplay.py:164
msgid "STALL"
msgstr "STAND"
#: squirrelbattle/display/statsdisplay.py:34
#: squirrelbattle/display/statsdisplay.py:33
msgid "Inventory:"
msgstr "Inventaire :"
#: squirrelbattle/display/statsdisplay.py:53
#: squirrelbattle/display/statsdisplay.py:52
msgid "YOU ARE DEAD"
msgstr "VOUS ÊTES MORT"
@ -37,11 +38,11 @@ msgstr "VOUS ÊTES MORT"
msgid "I don't sell any squirrel"
msgstr "Je ne vends pas d'écureuil"
#: squirrelbattle/entities/friendly.py:46
#: squirrelbattle/entities/friendly.py:52
msgid "Flower power!!"
msgstr "Pouvoir des fleurs !"
msgstr "Pouvoir des fleurs !!"
#: squirrelbattle/entities/friendly.py:46
#: squirrelbattle/entities/friendly.py:52
msgid "The sun is warm today"
msgstr "Le soleil est chaud aujourd'hui"
@ -52,16 +53,16 @@ msgstr "Le soleil est chaud aujourd'hui"
msgid "Bomb is exploding."
msgstr "La bombe explose."
#: squirrelbattle/entities/items.py:224
#: squirrelbattle/entities/items.py:248
#, python-brace-format
msgid "{player} exchanged its body with {entity}."
msgstr "{player} a échangé son corps avec {entity}."
#: squirrelbattle/game.py:199 squirrelbattle/tests/game_test.py:537
#: squirrelbattle/game.py:203 squirrelbattle/tests/game_test.py:573
msgid "You do not have enough money"
msgstr ""
msgstr "Vous n'avez pas assez d'argent"
#: squirrelbattle/game.py:243
#: squirrelbattle/game.py:247
msgid ""
"Some keys are missing in your save file.\n"
"Your save seems to be corrupt. It got deleted."
@ -69,7 +70,7 @@ msgstr ""
"Certaines clés de votre ficher de sauvegarde sont manquantes.\n"
"Votre sauvegarde semble corrompue. Elle a été supprimée."
#: squirrelbattle/game.py:251
#: squirrelbattle/game.py:255
msgid ""
"No player was found on this map!\n"
"Maybe you died?"
@ -77,7 +78,7 @@ msgstr ""
"Aucun joueur n'a été trouvé sur la carte !\n"
"Peut-être êtes-vous mort ?"
#: squirrelbattle/game.py:271
#: squirrelbattle/game.py:275
msgid ""
"The JSON file is not correct.\n"
"Your save seems corrupted. It got deleted."
@ -100,12 +101,17 @@ msgstr "{name} prend {amount} points de dégât."
msgid "{name} dies."
msgstr "{name} meurt."
#: squirrelbattle/interfaces.py:477
#, python-brace-format
msgid "{entity} said: {message}"
msgstr "{entity} a dit : {message}"
#: squirrelbattle/menus.py:73
msgid "Back"
msgstr "Retour"
#: squirrelbattle/tests/game_test.py:314 squirrelbattle/tests/game_test.py:317
#: squirrelbattle/tests/game_test.py:320
#: squirrelbattle/tests/game_test.py:344 squirrelbattle/tests/game_test.py:347
#: squirrelbattle/tests/game_test.py:350 squirrelbattle/tests/game_test.py:353
#: squirrelbattle/tests/translations_test.py:16
msgid "New game"
msgstr "Nouvelle partie"
@ -199,33 +205,45 @@ msgid "player"
msgstr "joueur"
#: squirrelbattle/tests/translations_test.py:61
msgid "tiger"
msgstr "tigre"
#: squirrelbattle/tests/translations_test.py:62
msgid "hedgehog"
msgstr "hérisson"
#: squirrelbattle/tests/translations_test.py:62
msgid "merchant"
msgstr "marchand"
#: squirrelbattle/tests/translations_test.py:63
msgid "rabbit"
msgstr "lapin"
#: squirrelbattle/tests/translations_test.py:64
msgid "sunflower"
msgstr "tournesol"
#: squirrelbattle/tests/translations_test.py:65
msgid "teddy bear"
msgstr "nounours"
#: squirrelbattle/tests/translations_test.py:66
msgid "tiger"
msgstr "tigre"
#: squirrelbattle/tests/translations_test.py:68
msgid "body snatch potion"
msgstr "potion d'arrachage de corps"
#: squirrelbattle/tests/translations_test.py:67
#: squirrelbattle/tests/translations_test.py:69
msgid "bomb"
msgstr "bombe"
#: squirrelbattle/tests/translations_test.py:68
#: squirrelbattle/tests/translations_test.py:70
msgid "explosion"
msgstr ""
#: squirrelbattle/tests/translations_test.py:71
msgid "heart"
msgstr "cœur"
#: squirrelbattle/tests/translations_test.py:69
#: squirrelbattle/tests/translations_test.py:72
msgid "sword"
msgstr "épée"

View File

@ -496,8 +496,8 @@ class TestGame(unittest.TestCase):
self.assertEqual(self.game.state, GameMode.PLAY)
self.assertTrue(self.game.logs.messages)
# Ensure that the message is a good message
self.assertIn(self.game.logs.messages[1][21:],
Sunflower.dialogue_option)
self.assertIn(self.game.logs.messages[1][16:],
Sunflower().dialogue_option)
# Test all directions to detect the friendly entity
self.game.player.move(3, 6)
@ -547,7 +547,7 @@ class TestGame(unittest.TestCase):
# Buy the second item by clicking on it
item = self.game.store_menu.validate()
self.assertIn(item, merchant.inventory)
self.game.display_actions(DisplayActions.MOUSE, 8, 25)
self.game.display_actions(DisplayActions.MOUSE, 7, 25)
self.game.handle_key_pressed(KeyValues.ENTER)
self.assertIn(item, self.game.player.inventory)
self.assertNotIn(item, merchant.inventory)

View File

@ -58,12 +58,15 @@ class TestTranslations(unittest.TestCase):
def test_entities_translation(self) -> None:
self.assertEqual(_("player"), "joueur")
self.assertEqual(_("tiger"), "tigre")
self.assertEqual(_("hedgehog"), "hérisson")
self.assertEqual(_("merchant"), "marchand")
self.assertEqual(_("rabbit"), "lapin")
self.assertEqual(_("sunflower"), "tournesol")
self.assertEqual(_("teddy bear"), "nounours")
self.assertEqual(_("tiger"), "tigre")
self.assertEqual(_("body snatch potion"), "potion d'arrachage de corps")
self.assertEqual(_("bomb"), "bombe")
self.assertEqual(_("explosion"), "explosion")
self.assertEqual(_("heart"), "cœur")
self.assertEqual(_("sword"), "épée")