mateo updated
unknown
plain_text
8 months ago
3.6 kB
3
Indexable
import random class Character: def __init__(self, name, hp, attack_power, attack_names, attack_multipliers): self.name = name self.hp = hp self.attack_power = attack_power self.attack_names = attack_names self.attack_multipliers = attack_multipliers def attack(self, other, attack_name): multiplier = self.attack_multipliers[self.attack_names.index(attack_name)] damage = random.randint(1, self.attack_power) * multiplier other.hp -= damage return damage, attack_name def game(): player = Character( name="drake", hp=100, attack_power=20, attack_names=["eat", "text lixys"], attack_multipliers=[1, 1.5] # Corrected argument name to match the Character class ) enemy = Character( name="Kendrick", hp=100, attack_power=20, attack_names=["ovho", "prolly a minorrrrrr"], attack_multipliers=[1, 2] # Corrected argument name to match the Character class ) print("Hey, welcome to the diddy community!") print(f"You are the world-renowned popstar {player.name} with {player.hp} HP, and you have a dark secret.") print(f"Uh oh, your rival, {enemy.name}, exposes you for being a freak and having a secret family! He has {enemy.hp} HP. Good luck defeating him as he drops tons of diss tracks on you!") while player.hp > 0 and enemy.hp > 0: action = input("Uh oh! Kdot dropped another diss track. Do you want to [m]olest and rap or [c]ry and run? ").strip().lower() if action == 'm': print(f"Okay, now what do you want to do? [1] {player.attack_names[0]} or you can also call Millie Bobby Brown and [2] {player.attack_names[1]}") attack_choice = input("Enter 1 or 2: ").strip() if attack_choice == '1': attack_name = player.attack_names[0] elif attack_choice == '2': attack_name = player.attack_names[1] else: print("Invalid choice. The media is flaming you now.") continue damage, attack_name = player.attack(enemy, attack_name) print(f"You used {attack_name} and touched {enemy.name}'s toes, causing {damage} damage.") if enemy.hp > 0: print(f"He's not a sharter; it didn't affect him enough, and now he still has {enemy.hp} HP left.") else: print(f"{enemy.name} couldn't take your diddy drake energy. He has to go to therapy now.") break attack_name = random.choice(enemy.attack_names) damage, attack_name = enemy.attack(player, attack_name) print(f"{enemy.name} used {attack_name} and the media destroys {damage}% of your legacy.") if player.hp > 0: print(f"You still have {player.hp}% of your legacy left.") else: print("The police raided your home. You have been exposed for a secret child. The Instagram leak, you possibly killed someone, and the whole media is siding with your rival, Kendrick. Your career is over.") break elif action == 'c': print("You started crying like a little freak.") break else: print("There are two options. Are you dumb? This is why Kendrick's coming after you. Please choose 'm' to eat or 'c' to cry and run.") print("Your career is gone, bro. Great job, Drake.") print("Game over.") if __name__ == "__main__": game()
Editor is loading...
Leave a Comment