示例#1
0
 def armor_bonus(self):
     armor_bonus = self.trait.defense_bonus
     if self.armor is not None:
         armor_bonus += self.armor.min_lvl
     if ActiveEffect.find_by_target_and_special(self, Item.Items.POTION_OF_DEFENSE, self.connection):
         armor_bonus += 4
     if ActiveEffect.find_by_target_and_special(self, Item.Items.STONE_ELIXIR, self.connection):
         armor_bonus += 2
     return armor_bonus
示例#2
0
 def attack_bonus(self):
     attack_bonus = self.trait.attack_bonus
     if self.weapon is not None:
         attack_bonus += self.weapon.min_lvl
     if ActiveEffect.find_by_target_and_special(self, Special.Specials.EMPOWER, self.connection):
         attack_bonus += 4
     if ActiveEffect.find_by_target_and_special(self, Item.Items.POTION_OF_STRENGTH, self.connection):
         attack_bonus += 4
     if ActiveEffect.find_by_target_and_special(self, Item.Items.BULL_ELIXIR, self.connection):
         attack_bonus += 2
     return attack_bonus
示例#3
0
 def check_survival(self):
     rand = random.random() * 100
     terrain_factor = 1.5
     if self.position.location.difficulty * 2 < self.lvl:
         terrain_factor = 0.5
     death_chance = 100 * (max(2.5 + terrain_factor * (self.position.location.difficulty * 2 - self.lvl), 1)) / (
             100 + self.armor_bonus * 20)
     if ActiveEffect.find_by_target_and_special(self, Special.Specials.CURSE, self.connection):
         death_chance += 5
     if ActiveEffect.find_by_target_and_special(self, Special.Specials.GUARDIAN, self.connection):
         death_chance -= 10
     if self.lvl <= 4:
         death_chance -= 5 - self.lvl
     return rand > (self.trait.death_chance_factor * death_chance)
示例#4
0
 def attack_bonus(self):
     attack_bonus = self.trait.attack_bonus
     if self.weapon is not None:
         attack_bonus += self.weapon.min_lvl
     if ActiveEffect.find_by_target_and_special(self,
                                                Special.Specials.EMPOWER,
                                                self.connection):
         attack_bonus += 4
     return attack_bonus
示例#5
0
 def attack(self, defender, sneak, defense_bonus=False, attack_bonus=False):
     roll = random.randint(1, 40)
     weapon_bonus = self.attack_bonus + sneak * 2 * defender.trait.sneak_penalty_factor
     armor_bonus = defender.armor_bonus
     if ActiveEffect.find_by_target_and_special(self, Special.Specials.BLIND, self.connection) is not None:
         if random.random > 0.6:
             return False
     return roll + self.lvl * 2 + weapon_bonus + (attack_bonus * 2) > \
            defender.lvl * 2 + armor_bonus + 18 + (defense_bonus * 2)
示例#6
0
 def check_survival(self):
     rand = random.random() * 100
     armor_bonus = 0
     if self.armor is not None:
         armor_bonus = self.armor.min_lvl * 20
     terrain_factor = 1.5
     if self.position.location.difficulty * 2 < self.lvl:
         terrain_factor = 0.5
     death_chance = 100 * self.trait.death_chance_factor * (
         3 + terrain_factor *
         (self.position.location.difficulty * 2 - self.lvl)) / (100 +
                                                                armor_bonus)
     if ActiveEffect.find_by_target_and_special(self,
                                                Special.Specials.CURSE,
                                                self.connection):
         death_chance += 5
     if ActiveEffect.find_by_target_and_special(self,
                                                Special.Specials.GUARDIAN,
                                                self.connection):
         death_chance -= 10
     return rand > death_chance
示例#7
0
 def attack_boss(self, boss):
     roll = random.randint(1, 40)
     weapon_bonus = self.attack_bonus
     if ActiveEffect.find_by_target_and_special(
             self, Special.Specials.BLIND, self.connection) is not None:
         if random.random > 0.6:
             return False
     if roll + self.lvl * 2 + weapon_bonus > \
             boss.lvl * 2 + boss.defense_bonus + 20:
         success = boss.damage(1)
         boss.save()
         self.Parent.SendStreamMessage(
             self.format_message(
                 "{0} managed to hit the {1}, {2}/{3} HP remaining",
                 self.name, boss.name, boss.hp, boss.max_hp))
         return success
     self.Parent.SendStreamMessage(
         self.format_message("{0} failed to hit boss {1}.", self.name,
                             boss.name))
     return False
示例#8
0
 def is_stunned(self):
     return ActiveEffect.find_by_target_and_special(
         self, Special.Specials.STUN, self.connection) is not None
示例#9
0
 def remove_invisibility(self):
     invisibility = ActiveEffect.find_by_target_and_special(self, Special.Specials.INVIS, self.connection)
     if invisibility is not None:
         invisibility.delete()
示例#10
0
 def is_invisible(self):
     return ActiveEffect.find_by_target_and_special(self, Special.Specials.INVIS, self.connection) is not None