コード例 #1
0
 def __init__(self, bolt, creator, destination):
     angle_ = 135 + angle(get_cell(creator), destination)
     super().__init__(bolt,
                      get_cell(creator),
                      destination,
                      angle=angle_,
                      **ArrowPhysics.parameters)
コード例 #2
0
def create_healing_aura(actor, _object):
    if not isinstance(_object, Unit)\
            or actor.activity.actions == 0\
            or cab_distance(get_cell(actor), get_cell(_object)) > actor.stats.vision:
        return Dummy()
    else:
        actor.activity.make_action(1)
        return action_manager.create_heal_action("healing aura", _object)
コード例 #3
0
def create_attack(actor, cell):
    # impossible to attack further than one's vision allows
    if cab_distance(get_cell(actor), cell) > actor.stats.vision\
            or actor.activity.actions == 0\
            or get_cell(actor) == cell:
        return Dummy()  # described in tech_bits.py
    else:
        actor.activity.make_action(1)  # for now the cost of every attack is 1
        return actor.attack(cell)
コード例 #4
0
 def _cell_highlight(self):
     if self.inspected_cell is not None:
         current = game_manager.current_turn()
         if 1 < mapping.cab_distance(mapping.get_cell(current), self.inspected_cell)\
                 <= current.stats.vision:
             mapping.highlight(self.inspected_cell, _color=arcade.color.RED)
         else:
             mapping.highlight(self.inspected_cell)
コード例 #5
0
 def attack(self, cell):
     if cab_distance(get_cell(self), cell) > 1:
         return create_attack_action("handaxe",
                                     self,
                                     cell,
                                     damage=self.stats.damage,
                                     damage_factor=1)
     else:
         return Dummy()
コード例 #6
0
def move(obj, direction):
    if isinstance(
            obj, Unit
    ):  # checker which might be useful in the future if NPCs are implemented
        cell = get_cell(obj)
        x, y = cell_to_grid(cell)
        new_cell = grid_to_cell(x + direction[0], y + direction[1])

        if new_cell is None or new_cell.is_occupied():
            pass
        elif not is_water(new_cell) and new_cell.height <= obj.activity.steps:
            obj.activity.make_step(
                new_cell.height)  # attached in def create_unit()
            cell.reset()
            new_cell.state = obj
            set_cell(obj, new_cell)
コード例 #7
0
 def __init__(self, bolt, creator, destination):
     super().__init__(bolt, get_cell(creator), destination,
                      **FireballPhysics.parameters)