Turn 4 TurnsteemCreated with Sketch.

in #fortnitelast year

import random
import time

class Player:
def init(self, name, max_health, attack_damage):
self.name = name
self.max_health = max_health
self.attack_damage = attack_damage
self.current_health = max_health

def take_damage(self, damage):
    self.current_health = max(0, self.current_health - damage)

def is_alive(self):
    return self.current_health > 0

class HealerPlayer(Player):
def init(self, name, max_health, attack_damage, chug_splash_cannon):
super().init(name, max_health, attack_damage)
self.chug_splash_cannon = chug_splash_cannon

def buff_teammate(self, teammate, buff_amount=None):
    buff_amount = buff_amount or random.randint(5, 15)
    teammate.attack_damage += buff_amount
    print(f"{self.name} buffs {teammate.name}, increasing their attack damage by {buff_amount}.")

def heal_teammate(self, teammate):
    healing_amount = self.chug_splash_cannon.heal(self)
    teammate.current_health = min(teammate.max_health, teammate.current_health + healing_amount)
    print(f"{self.name} uses Chug Splash Cannon to heal {teammate.name} for {healing_amount} health.")

class ChugSplashCannon:
def init(self, healing_amount):
self.healing_amount = healing_amount

def heal(self, player):
    healing_amount = random.randint(20, 30)
    player.current_health = min(player.max_health, player.current_health + healing_amount)
    return healing_amount

class Boss(Player):
def init(self, name, max_health, attack_damage):
super().init(name, max_health, attack_damage)

def player_turn(player, teammates, boss):
print(f"\nIt's {player.name}'s turn. Choose an action:")
print("1. Attack Boss\n2. Buff Teammate\n3. Heal Teammate\n4. Defend")

choice = input("Enter your choice (1-4): ")

if choice == '1':
    damage = random.randint(10, 25) + player.attack_damage
    boss.take_damage(damage)
    print(f"{player.name} attacks {boss.name} and deals {damage} damage.")
elif choice == '2':
    teammate = random.choice(teammates)
    player.buff_teammate(teammate)
elif choice == '3':
    teammate = random.choice(teammates)
    player.heal_teammate(teammate)
elif choice == '4':
    print(f"{player.name} chooses to defend and takes reduced damage this turn.")

def simulate_boss_fight(players, boss):
turn_counter = 1
kill_counter = 0

while boss.is_alive() and any(player.is_alive() for player in players):
    print(f"\nTurn {turn_counter}")

    for player in players:
        if player.is_alive():
            player_turn(player, [p for p in players if p != player], boss)

    if boss.is_alive():
        for player in players:
            if player.is_alive():
                damage = random.randint(15, 30) + boss.attack_damage
                player.take_damage(damage)
                print(f"{boss.name} attacks {player.name} and deals {damage} damage.")

    turn_counter += 1
    time.sleep(1)  # Simulating turns with a pause

if not boss.is_alive():
    kill_counter += 1
    print(f"\n{boss.name} has been defeated!")

return kill_counter

def boss_simulation_loop(num_simulations):
total_kills = 0

for _ in range(num_simulations):
    healer_cannon = ChugSplashCannon(30)
    healer = HealerPlayer("Healer", 100, 10, healer_cannon)
    player2 = Player("Player2", 100, 15)
    player3 = Player("Player3", 100, 18)
    player4 = Player("Player4", 100, 14)
    boss = Boss("Evil Boss", 200, 20)

    total_kills += simulate_boss_fight([healer, player2, player3, player4], boss)

print(f"\nBoss simulation completed.\nTotal kills: {total_kills}")

if name == "main":
num_simulations = 5 # You can adjust the number of simulations
boss_simulation_loop(num_simulations)

Screenshot_20231210-131956.png

Sort:  
Loading...