예제 #1
0
 def activate(self, action):
     self.on_cd()
     if self.unit.dmg_received == 0:
         self.string('fail', format_dict={'actor': self.unit.name})
         self.unit.waste_energy(2)
     elif self.unit.melee_targets:
         target = self.unit.target
         if 'dodge' not in target.action:
             damage = self.unit.dmg_received
             attack_action = standart_actions.Attack(self.unit,
                                                     self.unit.fight,
                                                     stringed=False)
             attack_action.blockable = False
             attack_action.activate(target=target,
                                    waste=self.unit.weapon.energy_cost,
                                    dmg=damage + self.unit.damage)
             self.string('use',
                         format_dict={
                             'actor':
                             self.unit.name,
                             'target':
                             target.name,
                             'damage':
                             attack_action.dmg_done +
                             attack_action.dmg_blocked
                         })
         else:
             self.string('fail', format_dict={'actor': self.unit.name})
             self.unit.waste_energy(2)
     else:
         self.string('special', format_dict={'actor': self.unit.name})
         self.unit.waste_energy(2)
예제 #2
0
 def start_special_action(self, info):
     self.unit.target = self.unit.fight[info[-1]]
     if self.special_available(target=self.unit.target):
         self.unit.fight.edit_queue(standart_actions.SpecialAttack(unit=self.unit, fight=self.unit.fight,
                                                                   info=info, order=self.order, energy_cost=self.special_energy_cost))
     else:
         self.unit.fight.edit_queue(standart_actions.Attack(unit=self.unit, fight=self.unit.fight,
                                                            info=info))
예제 #3
0
 def activate(self, action):
     self.on_cd()
     target = action.target
     attack = standart_actions.Attack(self.unit, self.unit.fight)
     shield = next(armor for armor in self.unit.armor
                   if 'shield' in armor.types)
     attack.activate(target=target, weapon=shield)
     self.unit.waste_energy(shield.energy_cost)
     shield.current_coverage = 100
     statuses.CustomStatus(self.unit, 0, 1, self.stop_shield, args=[shield])
예제 #4
0
 def parry(self, action, option):
     if action.dmg_done == int(option):
         self.string('special_hit_self', format_dict={'actor':self.unit.name, 'target': action.unit.name})
         action.dmg_done = 0
         action.stringed = False
         x = standart_actions.Attack(self.unit, self.unit.fight, order=6)
         x.activate(target=action.unit, waste=1)
     elif action.dmg_done == int(option) - 1:
         action.dmg_done = 0
         action.stringed = False
         self.string('special_miss', format_dict={'actor': self.unit.name, 'target': action.unit.name})
예제 #5
0
 def get_action(self):
     if not self.special_types and len(self.targets()) == 1:
         self.unit.target = self.targets()[0]
         attack = standart_actions.Attack(unit=self.unit, fight=self.unit.fight)
         attack.act()
         return True
     keyboard = keyboards.types.InlineKeyboardMarkup(row_width=2)
     buttons = self.attack_buttons()
     for button in buttons:
         keyboard.add(button)
     self.create_menu(keyboard)
예제 #6
0
파일: weapons.py 프로젝트: egor5q/Veganwars
 def get_action(self):
     if 'options' not in self.types and len(self.targets(
     )) == 1 or 'attack_modifier_random' in self.unit.statuses:
         self.unit.target = self.targets()[0]
         attack = standart_actions.Attack(unit=self.unit,
                                          fight=self.unit.fight)
         attack.act()
         return True
     keyboard = keyboards.types.InlineKeyboardMarkup(row_width=2)
     buttons = self.attack_buttons()
     for button in buttons:
         keyboard.add(button)
     self.create_menu(keyboard)
예제 #7
0
 def activate(self, action):
     self.on_cd()
     target = action.target
     attack = standart_actions.Attack(self.unit,
                                      self.unit.fight,
                                      stringed=False,
                                      armor_string_alt=False)
     dmg_done = attack.activate(target=target)
     if dmg_done > 0 and not any(unit.target == self.unit and 'attack' in unit.action for unit in self.unit.targets()) \
         and self.unit.dmg_received == 0:
         self.string('use',
                     format_dict={
                         'actor': self.unit.name,
                         'target': target.name,
                         'damage': dmg_done
                     })
         target.hp_delta -= 1
     else:
         attack.string(attack.str)
예제 #8
0
    def cleave(self):
        for action in self.unit.fight.action_queue.action_list:
            if action.unit == self.unit and action.name == 'attack':
                self.unit.fight.action_queue.remove(action)
                self.unit.waste_energy(self.unit.weapon.energy_cost)
                targets = [
                    target for target in self.unit.melee_targets
                    if 'dodge' not in target.action
                ]
                if targets:
                    damage = engine.aoe_split(
                        self.unit.weapon.dice_num +
                        1 + self.unit.weapon.damage + self.unit.damage,
                        len(targets))
                    self.string(
                        'use',
                        format_dict={
                            'actor':
                            self.unit.name,
                            'damage':
                            damage,
                            'targets':
                            ', '.join([
                                target.name if isinstance(target.name, str)
                                else target.name.translate('rus')
                                for target in targets
                            ])
                        })

                    for target in targets:
                        attack_action = standart_actions.Attack(
                            self.unit, self.unit.fight, stringed=False)
                        attack_action.activate(target=target,
                                               waste=0,
                                               dmg=damage)
                else:
                    self.string('fail', format_dict={'actor': self.unit.name})
예제 #9
0
 def activate(self, action):
     self.unit.move_forward()
     self.string('use', format_dict={'actor': self.unit.name})
     attack = standart_actions.Attack(self.unit, self.unit.fight)
     attack.activate(target=action.target)
예제 #10
0
 def activate(self, action):
     self.unit.rooted.remove('fast-attack')
     attack = standart_actions.Attack(self.unit, self.unit.fight)
     attack.activate(target=action.target,
                     waste=self.energy_cost + self.unit.weapon.energy_cost)