From f878bf8b8b4f2b76daa7cc9ed7bb4844632ffcc3 Mon Sep 17 00:00:00 2001 From: hero2002 Date: Sat, 15 Jun 2024 15:54:52 +0300 Subject: [PATCH 1/2] Added Bolt Counter --- src/itemFolder/military/boltTower.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/itemFolder/military/boltTower.py b/src/itemFolder/military/boltTower.py index 0d9c74e3..1a657b5a 100644 --- a/src/itemFolder/military/boltTower.py +++ b/src/itemFolder/military/boltTower.py @@ -1,4 +1,5 @@ import src +from src.rooms import Room class BoltTower(src.items.Item): @@ -17,7 +18,7 @@ def __init__(self): super().__init__(display="/\\") self.charges = 7 self.faction = None - + self.pos def apply(self, character): self.showTargetingHud({"character":character}) @@ -49,12 +50,19 @@ def showTargetingHud(self,params): character.timeTaken += 1 def rerender(): - roomRender = self.container.render(advanceAnimations=False) + if isinstance(self.container,Room) : + roomRender = self.container.render(advanceAnimations = False) + else: + roomRender = self.container.render(size=(12,12),coordinateOffset = ((self.getTerrainPosition()[0] + 2)* 15 + 1 ,(self.getTerrainPosition()[1])* 15 + 1)) for line in roomRender: line.append("\n") - return [roomRender,extraText,"\npress wasd to shoot \npress . to wait"] + if self.charges>0: + charges_text = self.charges + else: + charges_text = "no" + return [roomRender,extraText,f"you have {charges_text} shots left","\npress wasd to shoot \npress . to wait"] submenue = src.interaction.OneKeystrokeMenu(rerender()) submenue.rerenderFunction = rerender From 55a5b5f16a3cb06ab68c978a7edb56a37971af80 Mon Sep 17 00:00:00 2001 From: Abdallah Abdalkafi Date: Sat, 15 Jun 2024 16:04:38 +0300 Subject: [PATCH 2/2] Update boltTower.py --- src/itemFolder/military/boltTower.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/itemFolder/military/boltTower.py b/src/itemFolder/military/boltTower.py index 1a657b5a..8e3243c2 100644 --- a/src/itemFolder/military/boltTower.py +++ b/src/itemFolder/military/boltTower.py @@ -18,7 +18,6 @@ def __init__(self): super().__init__(display="/\\") self.charges = 7 self.faction = None - self.pos def apply(self, character): self.showTargetingHud({"character":character})