def attack(self, other): if self.n_specials > 0: self.n_specials -= 1 self.special_attack(other) else: if d(20) + self.offence > d(20) + other.defense: other.health -= self.damage()
def special_attack(self, other): """ Strategic Supremacy - grants advantage to the attacker and imposes disadvantage on the defender """ advantage = max(d(20), d(20)) + self.offence disadvantage = min(d(20), d(20)) + other.defense if advantage > disadvantage: other.health -= self.damage()
def __init__(self): self.name = "NPC" self.profession = random_profession() self.race = random_race() self.appearance = random_appearance() self.mannerism = random_mannerism() self.background = random_background() self.health = 9 + plus_or_minus_gauss(3) self.ac = 9 + plus_or_minus_gauss(3) self.damage = d(4)
def special_attack(self, other): """ Ambush - grants a bonus attack to the attacker, first attack has advantage, second attack has disadvantage """ first_attack = max(d(20), d(20)) + self.offence if first_attack > d(20) + other.defense: other.health -= self.damage() second_attack = min(d(20), d(20)) + self.offence if second_attack > d(20) + other.defense: other.health -= self.damage()
def special_attack(self, other): """ Tactical Advantage - grants advantage to the attacker """ advantage = max(d(20), d(20)) + self.offence if advantage > d(20) + other.defense: other.health -= self.damage()
def special_attack(self, other): """ Rampage - imposes disadvantage on the defender """ disadvantage = min(d(20), d(20)) + other.defense if d(20) + self.offence > disadvantage: other.health -= self.damage()
def special_attack(self, other): if d(20) + self.offence > d(20) + other.defense: other.health -= self.damage()
def special_attack(self, other): """ Siphon Soul - heal for the amount of damage dealt """ damage = self.damage() if d(20) + self.offence > d(20) + other.defense: other.health -= damage self.health += damage
def special_attack(self, other): """ Demonic Empowerment - deals double damage """ double_damage = self.damage() + self.damage() if d(20) + self.offence > d(20) + other.defense: other.health -= double_damage
'w': lambda x: x.w_to, } user_input = input("\nWhere would you like to go next?") if not user_input: continue else: user_input = user_input[0].lower() if user_input == 'q': exit() if user_input in direction_dispatch.keys(): target = direction_dispatch[user_input](player.location) if target: player.location = target if target.name != "Dragon's Liar": print(f'{player.name} enters the {player.location.name}') print(f'{player.location.description}') else: if d(20) > 15: print(f'{player.name} enters the {player.location.name}') print(f'{player.location.description}') print('You have been incinerated!') else: print("You attempt to gain entry to the Dragon's Lair,\n" "but fall to your death crossing the chasm.") exit() else: print("You cannot go that way!") else: print(f"You cannot go that way, '{user_input}' is not a valid " f"direction.\nTry one of these: (n,s,e,w)")