Skip to content

Commit

Permalink
deleted fields erased
Browse files Browse the repository at this point in the history
  • Loading branch information
erfanfi79 committed Feb 3, 2020
1 parent 28980cf commit adfa9ea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 27 deletions.
24 changes: 3 additions & 21 deletions model.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ def __init__(self, player_id, king):
self.range_upgraded_unit = None # unit that last turn the player upgraded range of it
self.damage_upgraded_unit = None # unit that last turn the player upgraded damage of it

# deleted fields
self.spells = []
self.upgrade_tokens = 0

def is_alive(self):
return self.king.is_alive

Expand All @@ -64,9 +60,8 @@ def __str__(self):


class Unit:
def __init__(self, unit_id, base_unit, cell, path, hp, is_hasted, is_clone, damage_level,
range_level, was_damage_upgraded, was_range_upgraded, range, attack, active_poisons,
was_played_this_turn, target, target_cell):
def __init__(self, unit_id, base_unit, cell, path, hp, is_hasted, damage_level,
range_level, range, attack, target, target_cell):
self.unit_id = unit_id
self.base_unit = base_unit
self.cell = cell
Expand All @@ -83,16 +78,7 @@ def __init__(self, unit_id, base_unit, cell, path, hp, is_hasted, is_clone, dama
self.is_duplicate = False
self.is_hasted = is_hasted
self.affected_spells = []

# deleted fields
self.hp = hp
self.is_clone = is_clone

self.was_damage_upgraded = was_damage_upgraded
self.was_range_upgraded = was_range_upgraded

self.active_poisons = active_poisons
self.was_played_this_turn = was_played_this_turn


class SpellTarget(Enum):
Expand Down Expand Up @@ -131,17 +117,13 @@ def get_value(string):


class Spell:
def __init__(self, type, type_id, duration, priority, range, power, target):
def __init__(self, type, type_id, duration, priority, target):
self.type = SpellType.get_value(type)
self.type_id = type_id
self.duration = duration
self.priority = priority
self.target = SpellTarget.get_value(target)

# deleted fields
self.range = range
self.power = power

def is_unit_spell(self):
return self.type == SpellType.TELE

Expand Down
6 changes: 0 additions & 6 deletions world.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ def _spells_init(self, msg):
type_id=spell["typeId"],
duration=spell["duration"],
priority=spell["priority"],
range=spell["range"],
power=spell["power"],
target=spell["target"])
for spell in msg]

Expand Down Expand Up @@ -170,16 +168,12 @@ def _handle_turn_units(self, msg, is_dead_unit=False):
hp=unit_msg["hp"],
damage_level=unit_msg["damageLevel"],
range_level=unit_msg["rangeLevel"],
was_damage_upgraded=unit_msg["wasDamageUpgraded"],
was_range_upgraded=unit_msg["wasRangeUpgraded"],
is_hasted=unit_msg["isHasted"],
is_clone=unit_msg["isDuplicate"],
# is_clone=unit_msg.keys().isdisjoint("isClone") and unit_msg["isClone"],
# active_poisons=unit_msg["activePoisons"],
# active_poisons=unit_msg.keys().isdisjoint("activePoisons") and unit_msg["activePoisons"],
range=unit_msg["range"],
attack=unit_msg["attack"],
was_played_this_turn=unit_msg["wasPlayedThisTurn"],
target=unit_msg["target"],
target_cell=tc)
if not is_dead_unit:
Expand Down

0 comments on commit adfa9ea

Please sign in to comment.