Arcane Duel: Battle of Spells

Image for Arcane Duel: Battle of Spells

Introducing Arcane Duel: Battle of Spells – A Thrilling Turn-Based Spellcasting Adventure!

Image for Arcane Duel: Battle of Spells
Arcane Duel: Battle of Spells

Unleash your magic, outwit your foe, and become the ultimate spellcaster!

We are excited to announce the launch of our new game, “Arcane Duel: Battle of Spells”!

This turn-based spellcasting game offers players an immersive experience where they can engage in magical battles against cunning enemies.

Whether you’re a seasoned spellcaster or a newcomer to the world of magic, Arcane Duel promises hours of strategic fun and excitement.

Gameplay Overview

In Arcane Duel, players take on the role of a heroic spellcaster facing off against formidable foes.

The game features a variety of spells, each with unique effects, damage values, and mana costs.

Players must carefully choose their spells and manage their mana to outwit their opponents and emerge victorious.

Strategic Spellcasting

The core of Arcane Duel’s gameplay revolves around strategic spellcasting. Players can choose from a selection of spells, including offensive attacks like Fireball and Ice Shard, as well as healing spells to restore health. Each turn, players must decide whether to cast a spell or restore mana, adding an extra layer of strategy to the battles.

Challenging Enemies

The game features a variety of enemies, each with their own spellcasting abilities. Players will need to adapt their strategies to counter different foes and their unique tactics. The enemy AI is designed to provide a challenging experience, ensuring that no two battles are the same.

Visuals and Sound

Arcane Duel boasts vibrant visuals and immersive sound effects that bring the magical battles to life. The spell effects are visually stunning, and the sound design enhances the overall gaming experience, making players feel like true spellcasters.

Conclusion

We invite you to embark on a magical journey in Arcane Duel: Battle of Spells. Test your spellcasting skills, strategize your moves, and become the ultimate spellcaster! Stay tuned for updates and future expansions that will introduce new spells, enemies, and features to enhance your gaming experience. Get ready to unleash your magic and conquer the arcane battlefield!

Code

Python
import random

class Spell:
def init(self, name, damage, mana_cost, description):
self.name = name
self.damage = damage
self.mana_cost = mana_cost
self.description = description
def __str__(self):
    return f"{self.name} (Damage: {self.damage}, Mana: {self.mana_cost}) - {self.description}"
class Character:
def init(self, name, health, mana, spells):
self.name = name
self.max_health = health
self.current_health = health
self.max_mana = mana
self.current_mana = mana
self.spells = spells
def is_alive(self):
    return self.current_health > 0

def take_damage(self, amount):
    self.current_health -= amount
    if self.current_health < 0:
        self.current_health = 0
    print(f"{self.name} takes {amount} damage. Health: {self.current_health}/{self.max_health}")

def restore_mana(self, amount):
    self.current_mana += amount
    if self.current_mana > self.max_mana:
        self.current_mana = self.max_mana
    print(f"{self.name} restores {amount} mana. Mana: {self.current_mana}/{self.max_mana}")

def cast_spell(self, spell, target):
    if self.current_mana >= spell.mana_cost:
        self.current_mana -= spell.mana_cost
        print(f"{self.name} casts {spell.name} on {target.name}!")
        target.take_damage(spell.damage)
        return True
    else:
        print(f"{self.name} doesn't have enough mana to cast {spell.name}!")
        return False

def display_status(self):
    print(f"\n--- {self.name} Status ---")
    print(f"Health: {self.current_health}/{self.max_health}")
    print(f"Mana: {self.current_mana}/{self.max_mana}")
    print("Spells:")
    for i, spell in enumerate(self.spells):
        print(f"  {i+1}. {spell}")
    print("--------------------------")
def game_loop():
# Define Spells
fireball = Spell("Fireball", 25, 10, "A scorching blast of fire.")
ice_shard = Spell("Ice Shard", 15, 5, "A sharp projectile of ice.")
lightning_bolt = Spell("Lightning Bolt", 35, 15, "A powerful jolt of electricity.")
heal = Spell("Heal", -20, 8, "Restores a small amount of health.") # Negative damage for healing
# Define Characters
player_spells = [fireball, ice_shard, heal]
player = Character("Hero", 100, 50, player_spells)

enemy_spells = [fireball, lightning_bolt]
enemy = Character("Goblin Shaman", 80, 40, enemy_spells)

print("Welcome to the Spell Battle!")

while player.is_alive() and enemy.is_alive():
    player.display_status()
    enemy.display_status()

    # Player's Turn
    print("\n--- Player's Turn ---")
    print("Choose an action:")
    print("1. Cast a spell")
    print("2. Do nothing (restore a little mana)")

    choice = input("Enter your choice (1 or 2): ")

    if choice == '1':
        print("Choose a spell to cast:")
        for i, spell in enumerate(player.spells):
            print(f"{i+1}. {spell.name} (Mana: {spell.mana_cost})")

        spell_choice = input("Enter spell number: ")
        try:
            spell_index = int(spell_choice) - 1
            if 0 <= spell_index < len(player.spells):
                chosen_spell = player.spells[spell_index]
                if chosen_spell.damage < 0: # It's a healing spell
                    if player.cast_spell(chosen_spell, player):
                        player.current_health -= chosen_spell.damage # Subtracting negative damage adds health
                        if player.current_health > player.max_health:
                            player.current_health = player.max_health
                        print(f"{player.name} heals for {-chosen_spell.damage} health. Health: {player.current_health}/{player.max_health}")
                else:
                    player.cast_spell(chosen_spell, enemy)
            else:
                print("Invalid spell choice. You lose your turn.")
        except ValueError:
            print("Invalid input. You lose your turn.")
    elif choice == '2':
        player.restore_mana(10)
    else:
        print("Invalid choice. You lose your turn.")

    if not enemy.is_alive():
        break

    # Enemy's Turn
    print("\n--- Enemy's Turn ---")
    if enemy.current_mana < min(s.mana_cost for s in enemy.spells):
        print(f"{enemy.name} doesn't have enough mana for a spell and restores mana.")
        enemy.restore_mana(random.randint(5, 15))
    else:
        # Enemy AI: Choose a random spell it can afford
        affordable_spells = [s for s in enemy.spells if enemy.current_mana >= s.mana_cost]
        if affordable_spells:
            chosen_spell = random.choice(affordable_spells)
            if chosen_spell.damage < 0: # Enemy doesn't heal itself in this simple AI
                print(f"{enemy.name} tries to heal but has no target. Restores mana instead.")
                enemy.restore_mana(random.randint(5, 15))
            else:
                enemy.cast_spell(chosen_spell, player)
        else:
            print(f"{enemy.name} has no affordable spells and restores mana.")
            enemy.restore_mana(random.randint(5, 15))

    if not player.is_alive():
        break

print("\n--- Game Over ---")
if player.is_alive():
    print(f"{player.name} defeated {enemy.name}! You win!")
elif enemy.is_alive():
    print(f"{enemy.name} defeated {player.name}! You lose!")
else:
    print("It's a draw! Both fell in battle.")
if name == "main":
game_loop()