Exemplo n.º 1
0
 def attack(self):
     defense_roll = nodes.dice(game.state.home_node.processor + game.player.defense)
     attack_roll = nodes.dice(self.power)
     if attack_roll > defense_roll:
         damage = attack_roll - defense_roll + 1
         terminal.add_line("<MAGENTA>COMBAT:<LIGHTGREY> %s attacks you for <LIGHTRED>%i<LIGHTGREY> damage!" % (self.name, damage))
         game.player.lose_hp(damage, self.name)
     else:
         terminal.add_line("<MAGENTA>COMBAT:<LIGHTGREY> %s misses you!" % (self.name))
Exemplo n.º 2
0
    def defend(self,counter=False):
        attack_roll = nodes.dice(game.state.home_node.processor + game.player.attack)
        defense_roll = nodes.dice(self.power)
        if counter:
            counter = 'counter'
        else:
            counter = ''

        if attack_roll > defense_roll:
            damage = attack_roll - defense_roll + 1
            terminal.add_line("<MAGENTA>COMBAT:<LIGHTGREY> you %sattack %s for <LIGHTRED>%i<LIGHTGREY> damage!" % (counter, self.name, damage))
            self.hp -= damage
            if self.hp <= 0:
                self.defeated()
        else:
            terminal.add_line("<MAGENTA>COMBAT:<LIGHTGREY> you %sattack %s, but miss!" % (counter, self.name))