From ea672272f57cbd29b516ef41a6d7084bc888ccec Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 5 Dec 2020 14:20:58 +0100 Subject: [PATCH 1/6] Add body snatch potion --- squirrelbattle/display/menudisplay.py | 2 +- squirrelbattle/display/texturepack.py | 2 ++ squirrelbattle/entities/items.py | 28 ++++++++++++++++++- squirrelbattle/game.py | 2 +- squirrelbattle/interfaces.py | 10 ++++--- .../locale/de/LC_MESSAGES/squirrelbattle.po | 18 +++++++----- .../locale/fr/LC_MESSAGES/squirrelbattle.po | 18 +++++++----- squirrelbattle/tests/translations_test.py | 1 + 8 files changed, 60 insertions(+), 21 deletions(-) diff --git a/squirrelbattle/display/menudisplay.py b/squirrelbattle/display/menudisplay.py index 285b6db..d040d81 100644 --- a/squirrelbattle/display/menudisplay.py +++ b/squirrelbattle/display/menudisplay.py @@ -109,7 +109,7 @@ class InventoryDisplay(MenuDisplay): 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 - + " " + _(item.name).capitalize()) + + " " + item.translated_name.capitalize()) @property def truewidth(self) -> int: diff --git a/squirrelbattle/display/texturepack.py b/squirrelbattle/display/texturepack.py index dfee866..7fc4a9a 100644 --- a/squirrelbattle/display/texturepack.py +++ b/squirrelbattle/display/texturepack.py @@ -56,6 +56,7 @@ TexturePack.ASCII_PACK = TexturePack( RABBIT='Y', TIGER='n', TEDDY_BEAR='8', + BODY_SNATCH_POTION='S', ) TexturePack.SQUIRREL_PACK = TexturePack( @@ -75,4 +76,5 @@ TexturePack.SQUIRREL_PACK = TexturePack( RABBIT='🐇', TIGER='🐅', TEDDY_BEAR='🧸', + BODY_SNATCH_POTION='🔀', ) diff --git a/squirrelbattle/entities/items.py b/squirrelbattle/entities/items.py index 4800a58..8953b39 100644 --- a/squirrelbattle/entities/items.py +++ b/squirrelbattle/entities/items.py @@ -1,7 +1,7 @@ # Copyright (C) 2020 by ÿnérant, eichhornchen, nicomarg, charlse # SPDX-License-Identifier: GPL-3.0-or-later -from random import randint +from random import choice, randint from typing import Optional from .player import Player @@ -143,3 +143,29 @@ class Bomb(Item): d["exploding"] = self.exploding d["damage"] = self.damage return d + + +class BodySnatchPotion(Item): + """ + The body-snatch potion allows to exchange all characteristics with a random + other entity. + """ + + def __init__(self, *args, **kwargs): + super().__init__(name="body_snatch_potion", *args, **kwargs) + + def use(self) -> None: + """ + Find a valid random entity, then exchange characteristics. + """ + valid_entities = self.held_by.map.find_entities(FightingEntity) + valid_entities.remove(self.held_by) + entity = choice(valid_entities) + entity_state = entity.save_state() + player_state = self.held_by.save_state() + self.held_by.__dict__.update(entity_state) + entity.__dict__.update(player_state) + self.held_by.map.currenty, self.held_by.map.currentx = self.held_by.y,\ + self.held_by.x + + self.held_by.inventory.remove(self) diff --git a/squirrelbattle/game.py b/squirrelbattle/game.py index b9439b5..6d9e9e7 100644 --- a/squirrelbattle/game.py +++ b/squirrelbattle/game.py @@ -48,7 +48,7 @@ class Game: Create a new game on the screen. """ # TODO generate a new map procedurally - self.map = Map.load(ResourceManager.get_asset_path("example_map_2.txt")) + self.map = Map.load(ResourceManager.get_asset_path("example_map.txt")) self.map.logs = self.logs self.logs.clear() self.player = Player() diff --git a/squirrelbattle/interfaces.py b/squirrelbattle/interfaces.py index 90e5d69..3567ea0 100644 --- a/squirrelbattle/interfaces.py +++ b/squirrelbattle/interfaces.py @@ -324,10 +324,11 @@ class Entity: """ Returns all entities subclasses """ - from squirrelbattle.entities.items import Heart, Bomb + from squirrelbattle.entities.items import BodySnatchPotion, Bomb, Heart from squirrelbattle.entities.monsters import Tiger, Hedgehog, \ Rabbit, TeddyBear - return [Tiger, Bomb, Heart, Hedgehog, Rabbit, TeddyBear] + return [BodySnatchPotion, Bomb, Heart, Hedgehog, + Rabbit, TeddyBear, Tiger] @staticmethod def get_all_entity_classes_in_a_dict() -> dict: @@ -337,11 +338,12 @@ class Entity: from squirrelbattle.entities.player import Player from squirrelbattle.entities.monsters import Tiger, Hedgehog, Rabbit, \ TeddyBear - from squirrelbattle.entities.items import Bomb, Heart + from squirrelbattle.entities.items import BodySnatchPotion, Bomb, Heart return { "Tiger": Tiger, "Bomb": Bomb, "Heart": Heart, + "BodySnatchPotion": BodySnatchPotion, "Hedgehog": Hedgehog, "Rabbit": Rabbit, "TeddyBear": TeddyBear, @@ -423,7 +425,7 @@ class FightingEntity(Entity): """ Returns a fighting entities specific attributes """ - return ["maxhealth", "health", "level", "strength", + return ["name", "maxhealth", "health", "level", "strength", "intelligence", "charisma", "dexterity", "constitution"] def save_state(self) -> dict: diff --git a/squirrelbattle/locale/de/LC_MESSAGES/squirrelbattle.po b/squirrelbattle/locale/de/LC_MESSAGES/squirrelbattle.po index 0d20e90..505d2d8 100644 --- a/squirrelbattle/locale/de/LC_MESSAGES/squirrelbattle.po +++ b/squirrelbattle/locale/de/LC_MESSAGES/squirrelbattle.po @@ -8,7 +8,7 @@ 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 13:11+0100\n" +"POT-Creation-Date: 2020-12-05 14:13+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -25,14 +25,14 @@ msgstr "== BESTAND ==" msgid "Inventory:" msgstr "Bestand:" -#: squirrelbattle/display/statsdisplay.py:39 +#: squirrelbattle/display/statsdisplay.py:50 msgid "YOU ARE DEAD" msgstr "SIE WURDEN GESTORBEN" #. 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:129 +#: squirrelbattle/entities/items.py:128 msgid "Bomb is exploding." msgstr "" @@ -60,17 +60,17 @@ msgstr "" "Die JSON-Datei ist nicht korrekt.\n" "Ihre Speicherung scheint korrumpiert. Sie wurde gelöscht." -#: squirrelbattle/interfaces.py:398 +#: squirrelbattle/interfaces.py:400 #, python-brace-format msgid "{name} hits {opponent}." msgstr "{name} schlägt {opponent}." -#: squirrelbattle/interfaces.py:410 +#: squirrelbattle/interfaces.py:412 #, python-brace-format msgid "{name} takes {amount} damage." msgstr "{name} nimmt {amount} Schadenspunkte." -#: squirrelbattle/interfaces.py:412 +#: squirrelbattle/interfaces.py:414 #, python-brace-format msgid "{name} dies." msgstr "{name} stirbt." @@ -186,9 +186,13 @@ msgid "teddy bear" msgstr "Teddybär" #: squirrelbattle/tests/translations_test.py:64 +msgid "body snatch potion" +msgstr "Leichenfleddererzaubertrank" + +#: squirrelbattle/tests/translations_test.py:65 msgid "bomb" msgstr "Bombe" -#: squirrelbattle/tests/translations_test.py:65 +#: squirrelbattle/tests/translations_test.py:66 msgid "heart" msgstr "Herz" diff --git a/squirrelbattle/locale/fr/LC_MESSAGES/squirrelbattle.po b/squirrelbattle/locale/fr/LC_MESSAGES/squirrelbattle.po index 33ab440..1c17ccf 100644 --- a/squirrelbattle/locale/fr/LC_MESSAGES/squirrelbattle.po +++ b/squirrelbattle/locale/fr/LC_MESSAGES/squirrelbattle.po @@ -8,7 +8,7 @@ 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 13:11+0100\n" +"POT-Creation-Date: 2020-12-05 14:13+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -25,14 +25,14 @@ msgstr "== INVENTAIRE ==" msgid "Inventory:" msgstr "Inventaire :" -#: squirrelbattle/display/statsdisplay.py:39 +#: squirrelbattle/display/statsdisplay.py:50 msgid "YOU ARE DEAD" msgstr "VOUS ÊTES MORT" #. 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:129 +#: squirrelbattle/entities/items.py:128 msgid "Bomb is exploding." msgstr "La bombe explose." @@ -60,17 +60,17 @@ msgstr "" "Le fichier JSON de sauvegarde est incorrect.\n" "Votre sauvegarde semble corrompue. Elle a été supprimée." -#: squirrelbattle/interfaces.py:398 +#: squirrelbattle/interfaces.py:400 #, python-brace-format msgid "{name} hits {opponent}." msgstr "{name} frappe {opponent}." -#: squirrelbattle/interfaces.py:410 +#: squirrelbattle/interfaces.py:412 #, python-brace-format msgid "{name} takes {amount} damage." msgstr "{name} prend {amount} points de dégât." -#: squirrelbattle/interfaces.py:412 +#: squirrelbattle/interfaces.py:414 #, python-brace-format msgid "{name} dies." msgstr "{name} meurt." @@ -186,9 +186,13 @@ msgid "teddy bear" msgstr "nounours" #: squirrelbattle/tests/translations_test.py:64 +msgid "body snatch potion" +msgstr "potion d'arrachage de corps" + +#: squirrelbattle/tests/translations_test.py:65 msgid "bomb" msgstr "bombe" -#: squirrelbattle/tests/translations_test.py:65 +#: squirrelbattle/tests/translations_test.py:66 msgid "heart" msgstr "cœur" diff --git a/squirrelbattle/tests/translations_test.py b/squirrelbattle/tests/translations_test.py index ef7369f..0cb39c5 100644 --- a/squirrelbattle/tests/translations_test.py +++ b/squirrelbattle/tests/translations_test.py @@ -61,5 +61,6 @@ class TestTranslations(unittest.TestCase): self.assertEqual(_("rabbit"), "lapin") self.assertEqual(_("teddy bear"), "nounours") + self.assertEqual(_("body snatch potion"), "potion d'arrachage de corps") self.assertEqual(_("bomb"), "bombe") self.assertEqual(_("heart"), "cœur") From f887a1f0aacbf5410073007d79111c92cdd5289e Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 5 Dec 2020 14:25:22 +0100 Subject: [PATCH 2/6] Entity name is a parameter since it can be changed through body snatch potion --- squirrelbattle/entities/items.py | 14 +++++++------- squirrelbattle/entities/monsters.py | 24 ++++++++++++------------ squirrelbattle/entities/player.py | 11 ++++++----- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/squirrelbattle/entities/items.py b/squirrelbattle/entities/items.py index 8953b39..943b0c8 100644 --- a/squirrelbattle/entities/items.py +++ b/squirrelbattle/entities/items.py @@ -67,8 +67,8 @@ class Heart(Item): """ healing: int - def __init__(self, healing: int = 5, *args, **kwargs): - super().__init__(name="heart", *args, **kwargs) + def __init__(self, name: str = "heart", healing: int = 5, *args, **kwargs): + super().__init__(name=name, *args, **kwargs) self.healing = healing def hold(self, player: "Player") -> None: @@ -96,9 +96,9 @@ class Bomb(Item): owner: Optional["Player"] tick: int - def __init__(self, damage: int = 5, exploding: bool = False, - *args, **kwargs): - super().__init__(name="bomb", *args, **kwargs) + def __init__(self, name: str = "bomb", damage: int = 5, + exploding: bool = False, *args, **kwargs): + super().__init__(name=name, *args, **kwargs) self.damage = damage self.exploding = exploding self.tick = 4 @@ -151,8 +151,8 @@ class BodySnatchPotion(Item): other entity. """ - def __init__(self, *args, **kwargs): - super().__init__(name="body_snatch_potion", *args, **kwargs) + def __init__(self, name: str = "body_snatch_potion", *args, **kwargs): + super().__init__(name=name, *args, **kwargs) def use(self) -> None: """ diff --git a/squirrelbattle/entities/monsters.py b/squirrelbattle/entities/monsters.py index 9c151ad..feff81a 100644 --- a/squirrelbattle/entities/monsters.py +++ b/squirrelbattle/entities/monsters.py @@ -63,9 +63,9 @@ class Tiger(Monster): """ A tiger monster """ - def __init__(self, strength: int = 2, maxhealth: int = 20, - *args, **kwargs) -> None: - super().__init__(name="tiger", strength=strength, + def __init__(self, name: str = "tiger", strength: int = 2, + maxhealth: int = 20, *args, **kwargs) -> None: + super().__init__(name=name, strength=strength, maxhealth=maxhealth, *args, **kwargs) @@ -73,9 +73,9 @@ class Hedgehog(Monster): """ A really mean hedgehog monster """ - def __init__(self, strength: int = 3, maxhealth: int = 10, - *args, **kwargs) -> None: - super().__init__(name="hedgehog", strength=strength, + def __init__(self, name: str = "hedgehog", strength: int = 3, + maxhealth: int = 10, *args, **kwargs) -> None: + super().__init__(name=name, strength=strength, maxhealth=maxhealth, *args, **kwargs) @@ -83,9 +83,9 @@ class Rabbit(Monster): """ A rabbit monster """ - def __init__(self, strength: int = 1, maxhealth: int = 15, - *args, **kwargs) -> None: - super().__init__(name="rabbit", strength=strength, + def __init__(self, name: str = "rabbit", strength: int = 1, + maxhealth: int = 15, *args, **kwargs) -> None: + super().__init__(name=name, strength=strength, maxhealth=maxhealth, *args, **kwargs) @@ -93,7 +93,7 @@ class TeddyBear(Monster): """ A cute teddybear monster """ - def __init__(self, strength: int = 0, maxhealth: int = 50, - *args, **kwargs) -> None: - super().__init__(name="teddy_bear", strength=strength, + def __init__(self, name: str = "teddy_bear", strength: int = 0, + maxhealth: int = 50, *args, **kwargs) -> None: + super().__init__(name=name, strength=strength, maxhealth=maxhealth, *args, **kwargs) diff --git a/squirrelbattle/entities/player.py b/squirrelbattle/entities/player.py index e452c8d..02a6d8c 100644 --- a/squirrelbattle/entities/player.py +++ b/squirrelbattle/entities/player.py @@ -16,11 +16,12 @@ class Player(FightingEntity): inventory: list paths: Dict[Tuple[int, int], Tuple[int, int]] - def __init__(self, maxhealth: int = 20, strength: int = 5, - intelligence: int = 1, charisma: int = 1, dexterity: int = 1, - constitution: int = 1, level: int = 1, current_xp: int = 0, - max_xp: int = 10, *args, **kwargs) -> None: - super().__init__(name="player", maxhealth=maxhealth, strength=strength, + def __init__(self, name: str = "player", maxhealth: int = 20, + strength: int = 5, intelligence: int = 1, charisma: int = 1, + dexterity: int = 1, constitution: int = 1, level: int = 1, + current_xp: int = 0, max_xp: int = 10, *args, **kwargs) \ + -> None: + super().__init__(name=name, maxhealth=maxhealth, strength=strength, intelligence=intelligence, charisma=charisma, dexterity=dexterity, constitution=constitution, level=level, *args, **kwargs) From c38f8cdc53d663003d171a40100e1b8cc39d7638 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 5 Dec 2020 14:35:59 +0100 Subject: [PATCH 3/6] Save the inventory of the player when saving the game, fixes #33 --- squirrelbattle/entities/player.py | 11 +++++++++-- squirrelbattle/tests/game_test.py | 6 ++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/squirrelbattle/entities/player.py b/squirrelbattle/entities/player.py index 02a6d8c..3f1d941 100644 --- a/squirrelbattle/entities/player.py +++ b/squirrelbattle/entities/player.py @@ -19,7 +19,8 @@ class Player(FightingEntity): def __init__(self, name: str = "player", maxhealth: int = 20, strength: int = 5, intelligence: int = 1, charisma: int = 1, dexterity: int = 1, constitution: int = 1, level: int = 1, - current_xp: int = 0, max_xp: int = 10, *args, **kwargs) \ + current_xp: int = 0, max_xp: int = 10, inventory: list = None, + *args, **kwargs) \ -> None: super().__init__(name=name, maxhealth=maxhealth, strength=strength, intelligence=intelligence, charisma=charisma, @@ -27,7 +28,12 @@ class Player(FightingEntity): level=level, *args, **kwargs) self.current_xp = current_xp self.max_xp = max_xp - self.inventory = list() + self.inventory = inventory if inventory else list() + for i in range(len(self.inventory)): + if isinstance(self.inventory[i], dict): + entity_classes = self.get_all_entity_classes_in_a_dict() + item_class = entity_classes[self.inventory[i]["type"]] + self.inventory[i] = item_class(**self.inventory[i]) self.paths = dict() def move(self, y: int, x: int) -> None: @@ -118,4 +124,5 @@ class Player(FightingEntity): d = super().save_state() d["current_xp"] = self.current_xp d["max_xp"] = self.max_xp + d["inventory"] = [item.save_state() for item in self.inventory] return d diff --git a/squirrelbattle/tests/game_test.py b/squirrelbattle/tests/game_test.py index f0120eb..887835b 100644 --- a/squirrelbattle/tests/game_test.py +++ b/squirrelbattle/tests/game_test.py @@ -32,6 +32,9 @@ class TestGame(unittest.TestCase): """ Save a game and reload it. """ + bomb = Bomb() + self.game.map.add_entity(bomb) + bomb.hold(self.game.player) old_state = self.game.save_state() self.game.handle_key_pressed(KeyValues.DOWN) @@ -45,6 +48,9 @@ class TestGame(unittest.TestCase): new_state = self.game.save_state() self.assertEqual(old_state, new_state) + # Ensure that the bomb is loaded + self.assertTrue(self.game.player.inventory) + # Error on loading save with open(ResourceManager.get_config_path("save.json"), "w") as f: f.write("I am not a JSON file") From f39113fd0bb554797692e1f8c4334c8ad41d5213 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 5 Dec 2020 14:39:33 +0100 Subject: [PATCH 4/6] Test body snatch potion, fixes #34 --- squirrelbattle/tests/entities_test.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/squirrelbattle/tests/entities_test.py b/squirrelbattle/tests/entities_test.py index efd3397..2c72abd 100644 --- a/squirrelbattle/tests/entities_test.py +++ b/squirrelbattle/tests/entities_test.py @@ -3,7 +3,7 @@ import unittest -from squirrelbattle.entities.items import Bomb, Heart, Item +from squirrelbattle.entities.items import BodySnatchPotion, Bomb, Heart, Item from squirrelbattle.entities.monsters import Tiger, Hedgehog, Rabbit, TeddyBear from squirrelbattle.entities.player import Player from squirrelbattle.interfaces import Entity, Map @@ -154,6 +154,24 @@ class TestEntities(unittest.TestCase): heart_state = item.save_state() self.assertEqual(heart_state["healing"], item.healing) + def test_body_snatch_potion(self) -> None: + """ + Test some random stuff with body snatch potions. + """ + item = BodySnatchPotion() + self.map.add_entity(item) + item.hold(self.player) + + tiger = Tiger(y=42, x=42) + self.map.add_entity(tiger) + + # The player becomes a tiger, and the tiger becomes a squirrel + item.use() + self.assertEqual(self.player.name, "tiger") + self.assertEqual(tiger.name, "player") + self.assertEqual(self.player.y, 42) + self.assertEqual(self.player.x, 42) + def test_players(self) -> None: """ Test some random stuff with players. From 7ad2cad77c582952254de2079a7fcb5c7f2a5897 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 5 Dec 2020 14:47:54 +0100 Subject: [PATCH 5/6] Add a message in the logs when a body-snap potion is used --- squirrelbattle/entities/items.py | 5 +++++ .../locale/de/LC_MESSAGES/squirrelbattle.po | 13 +++++++++---- .../locale/fr/LC_MESSAGES/squirrelbattle.po | 11 ++++++++--- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/squirrelbattle/entities/items.py b/squirrelbattle/entities/items.py index 943b0c8..2405a7f 100644 --- a/squirrelbattle/entities/items.py +++ b/squirrelbattle/entities/items.py @@ -168,4 +168,9 @@ class BodySnatchPotion(Item): self.held_by.map.currenty, self.held_by.map.currentx = self.held_by.y,\ self.held_by.x + self.held_by.map.logs.add_message( + _("{player} exchanged its body with {entity}.").format( + player=self.held_by.translated_name.capitalize(), + entity=entity.translated_name)) + self.held_by.inventory.remove(self) diff --git a/squirrelbattle/locale/de/LC_MESSAGES/squirrelbattle.po b/squirrelbattle/locale/de/LC_MESSAGES/squirrelbattle.po index 505d2d8..28307eb 100644 --- a/squirrelbattle/locale/de/LC_MESSAGES/squirrelbattle.po +++ b/squirrelbattle/locale/de/LC_MESSAGES/squirrelbattle.po @@ -8,7 +8,7 @@ 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:13+0100\n" +"POT-Creation-Date: 2020-12-05 14:46+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -34,7 +34,12 @@ msgstr "SIE WURDEN GESTORBEN" #. The player earn XP if the entity was killed. #: squirrelbattle/entities/items.py:128 msgid "Bomb is exploding." -msgstr "" +msgstr "Die Bombe explodiert." + +#: squirrelbattle/entities/items.py:172 +#, python-brace-format +msgid "{player} exchanged its body with {entity}." +msgstr "{player} täuscht seinem Körper mit {entity} aus." #: squirrelbattle/game.py:177 msgid "" @@ -79,8 +84,8 @@ msgstr "{name} stirbt." msgid "Back" msgstr "Zurück" -#: squirrelbattle/tests/game_test.py:294 squirrelbattle/tests/game_test.py:297 -#: squirrelbattle/tests/game_test.py:300 +#: squirrelbattle/tests/game_test.py:300 squirrelbattle/tests/game_test.py:303 +#: squirrelbattle/tests/game_test.py:306 #: squirrelbattle/tests/translations_test.py:16 msgid "New game" msgstr "Neu Spiel" diff --git a/squirrelbattle/locale/fr/LC_MESSAGES/squirrelbattle.po b/squirrelbattle/locale/fr/LC_MESSAGES/squirrelbattle.po index 1c17ccf..652871d 100644 --- a/squirrelbattle/locale/fr/LC_MESSAGES/squirrelbattle.po +++ b/squirrelbattle/locale/fr/LC_MESSAGES/squirrelbattle.po @@ -8,7 +8,7 @@ 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:13+0100\n" +"POT-Creation-Date: 2020-12-05 14:46+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -36,6 +36,11 @@ msgstr "VOUS ÊTES MORT" msgid "Bomb is exploding." msgstr "La bombe explose." +#: squirrelbattle/entities/items.py:172 +#, python-brace-format +msgid "{player} exchanged its body with {entity}." +msgstr "{player} a échangé son corps avec {entity}." + #: squirrelbattle/game.py:177 msgid "" "Some keys are missing in your save file.\n" @@ -79,8 +84,8 @@ msgstr "{name} meurt." msgid "Back" msgstr "Retour" -#: squirrelbattle/tests/game_test.py:294 squirrelbattle/tests/game_test.py:297 -#: squirrelbattle/tests/game_test.py:300 +#: squirrelbattle/tests/game_test.py:300 squirrelbattle/tests/game_test.py:303 +#: squirrelbattle/tests/game_test.py:306 #: squirrelbattle/tests/translations_test.py:16 msgid "New game" msgstr "Nouvelle partie" From f8ca5b2cc5f72e5775a13ceaf7a47508326a503c Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 5 Dec 2020 14:48:43 +0100 Subject: [PATCH 6/6] Recalculate the path finder when the player exchanges its body --- squirrelbattle/entities/items.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/squirrelbattle/entities/items.py b/squirrelbattle/entities/items.py index 2405a7f..e90ec32 100644 --- a/squirrelbattle/entities/items.py +++ b/squirrelbattle/entities/items.py @@ -173,4 +173,6 @@ class BodySnatchPotion(Item): player=self.held_by.translated_name.capitalize(), entity=entity.translated_name)) + self.held_by.recalculate_paths() + self.held_by.inventory.remove(self)