critical_striks #1
@@ -1,6 +1,6 @@
|
|||||||
import enum
|
import enum
|
||||||
|
|
||||||
from MechFabrik.bauteile.items import Item, ItemStatus
|
from MechFabrik.bauteile.items import Gyroskope, Item, ItemStatus
|
||||||
|
|
||||||
|
|
||||||
class ZoneNames(enum.Enum):
|
class ZoneNames(enum.Enum):
|
||||||
@@ -144,11 +144,11 @@ class CriticalStrikeEvent:
|
|||||||
self.__dict__['_zone'].state = AreaStatus.DAMAGED
|
self.__dict__['_zone'].state = AreaStatus.DAMAGED
|
||||||
self.__dict__['_area'].state = AreaStatus.DAMAGED
|
self.__dict__['_area'].state = AreaStatus.DAMAGED
|
||||||
item = self.__dict__['_area'].items[self.__dict__['_index']]
|
item = self.__dict__['_area'].items[self.__dict__['_index']]
|
||||||
if item is None:
|
if item is None or item.state == ItemStatus.DESTROYED:
|
||||||
self.__dict__['_item_is_empty'] = True
|
self.__dict__['_item_is_empty'] = True
|
||||||
else:
|
else:
|
||||||
self.__dict__['_item_is_empty'] = False
|
self.__dict__['_item_is_empty'] = False
|
||||||
item.state = ItemStatus.DESTROYED
|
item.process_strike()
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def is_empty(self):
|
def is_empty(self):
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ class Item(object):
|
|||||||
def state(self, new_state: ItemStatus):
|
def state(self, new_state: ItemStatus):
|
||||||
self._state = new_state
|
self._state = new_state
|
||||||
|
|
||||||
|
def process_strike(self):
|
||||||
|
self._state = ItemStatus.DESTROYED
|
||||||
|
|
||||||
|
|
||||||
class BigItem(Item):
|
class BigItem(Item):
|
||||||
|
|
||||||
@@ -52,6 +55,14 @@ class DurableItem(Item):
|
|||||||
super().__init__(item_type)
|
super().__init__(item_type)
|
||||||
self._max_strike = max_strike
|
self._max_strike = max_strike
|
||||||
|
|
||||||
|
@property
|
||||||
|
def max_strike(self):
|
||||||
|
return self._max_strike
|
||||||
|
|
||||||
|
def process_strike(self):
|
||||||
|
self._max_strike -= 1
|
||||||
|
self._state = ItemStatus.DAMAGED if self._max_strike > 0 else ItemStatus.DESTROYED
|
||||||
|
|
||||||
|
|
||||||
class Gyroskope(BigItem, DurableItem):
|
class Gyroskope(BigItem, DurableItem):
|
||||||
def __init__(self, tonnage: float):
|
def __init__(self, tonnage: float):
|
||||||
|
|||||||
Reference in New Issue
Block a user