Okay, here is a concept for a simple, turn-by-turn One Piece game focused on combat, easy enough to describe and play out mentally or on paper.
Simple Straw Hat Scuffle!
Goal: Defeat the enemy pirate/Marine before your crew is knocked out!
Setup:
- Your Crew: You control a small team of Straw Hats. Let's start with the classic trio:
- Monkey D. Luffy
- Roronoa Zoro
- Vinsmoke Sanji
- Enemy: A single, tougher opponent (e.g., a generic "Enemy Captain," a low-level Vice Admiral, or a strong pirate subordinate).
- Stats: Each character (yours and the enemy) has:
- HP (Hit Points): How much damage they can take.
- ATK (Attack): How much damage they deal with basic attacks.
- DEF (Defense): How much damage they resist.
- Game State:
- Track the HP of each character.
- Track cooldowns for special abilities.
- Determine which of your characters is currently "Active".
Example Stats (Keep it simple):
- Luffy: HP: 150, ATK: 25, DEF: 10
- Zoro: HP: 140, ATK: 30, DEF: 10
- Sanji: HP: 130, ATK: 28, DEF: 12
- Enemy Captain: HP: 200, ATK: 35, DEF: 15
Gameplay (Turn Order):
The game alternates between the Player's Turn and the Enemy's Turn.
-
Player's Turn:
- Choose one of your active characters to perform an action. (Start with Luffy active).
- Choose one action for the active character:
- Basic Attack: Deal damage equal to your character's ATK minus the enemy's DEF (minimum 1 damage). No cooldown.
- Use Special Ability: Use one of the character's unique moves (see list below). Requires the ability to not be on cooldown. After using, the ability goes on cooldown for a set number of turns.
- Switch Character: Swap your currently active character for another character in your crew who is not knocked out. This action ends the current character's turn without attacking. The new character becomes active for the next Player Turn.
- Defend: Your character focuses on defense this turn, reducing incoming damage by a small amount (e.g., -5 ATK) until their next turn. This action ends the turn.
- Apply the effects of the chosen action.
- End the Player's Turn.
-
Enemy's Turn:
- The enemy performs an action. For simplicity, a basic enemy might just always use their Basic Attack on your active character. A slightly smarter enemy might use a special ability occasionally or target the character with the lowest HP.
- Apply the effects of the enemy action.
- End the Enemy's Turn.
-
Repeat turns until a win or loss condition is met.
Win Condition:
- Reduce the enemy's HP to 0.
Loss Condition:
- All of your crew members (Luffy, Zoro, Sanji) have their HP reduced to 0.
Special Abilities (Examples):
Each character has a couple of signature moves. They have stronger effects than a basic attack but need time to recover (cooldown).
- Luffy:
- Gum-Gum Pistol: Deals moderate damage. Cooldown: 2 turns. (Damage: 1.5 x ATK)
- Gum-Gum Gatling: Deals multiple smaller hits of damage. Cooldown: 3 turns. (Damage: 3 hits of 0.7 x ATK each)
- Zoro:
- Onigiri: Deals high damage. Cooldown: 3 turns. (Damage: 2 x ATK)
- Santoryu Ougi: Sanzen Sekai: Deals very high damage. Cooldown: 4 turns. (Damage: 2.5 x ATK)
- Sanji:
- Diable Jambe: Buffs Sanji's ATK for the next 2 turns. Cooldown: 3 turns. (+10 ATK for 2 turns)
- Concasser: Deals moderate damage and ignores some of the enemy's DEF. Cooldown: 3 turns. (Damage: 1.2 x ATK, Enemy DEF is halved for this attack)
How to Play (Text/Paper):
Keep track of HP and cooldowns. When it's your turn, announce your active character and the action they are taking. When it's the enemy's turn, roll a simple die or follow a basic pattern to decide their move and announce it. Calculate damage and update HP.
Example Turn (Simplified):
- Start: Luffy Active, HP: Luffy 150, Zoro 140, Sanji 130, Enemy 200. No cooldowns.
- Player Turn 1 (Luffy Active):
- Player chooses "Gum-Gum Pistol" for Luffy.
- Calculate Damage: (Luffy's ATK * 1.5) - Enemy DEF = (25 * 1.5) - 15 = 37.5 - 15 = 22.5. Round down to 22 damage.
- Enemy HP becomes 200 - 22 = 178.
- Gum-Gum Pistol goes on Cooldown (2 turns remaining).
- Enemy Turn 1:
- Enemy chooses "Basic Attack" on the active character (Luffy).
- Calculate Damage: Enemy ATK - Luffy DEF = 35 - 10 = 25 damage.
- Luffy HP becomes 150 - 25 = 125.
- Player Turn 2 (Luffy Active, Gum-Gum Pistol CD: 1):
- Player chooses "Switch Character" to Zoro.
- Luffy's turn ends. Zoro is now Active.
- Enemy Turn 2:
- Enemy chooses "Basic Attack" on the active character (Zoro).
- Calculate Damage: Enemy ATK - Zoro DEF = 35 - 10 = 25 damage.
- Zoro HP becomes 140 - 25 = 115.
- Player Turn 3 (Zoro Active, Gum-Gum Pistol CD: 0):
- Player chooses "Onigiri" for Zoro.
- Calculate Damage: (Zoro's ATK * 2) - Enemy DEF = (30 * 2) - 15 = 60 - 15 = 45 damage.
- Enemy HP becomes 178 - 45 = 133.
- Onigiri goes on Cooldown (3 turns remaining).
...and so on, until one side is defeated!
Possible Expansions for More Complexity:
- More characters (Nami, Usopp, Chopper, Robin, Franky, Brook, Jinbe).
- More complex enemies with unique abilities.
- Status effects (Poison, Burn, Stun, Bleed).
- Items (healing potions, temporary buffs).
- Environmental effects.
This simple structure provides the core turn-based combat feel while incorporating iconic One Piece characters and abilities.
import time # Optional: for dramatic pauses
# --- Constants and Data ---
# Base Stats
BASE_STATS = {
"Luffy": {"hp": 150, "atk": 25, "def": 10},
"Zoro": {"hp": 140, "atk": 30, "def": 10},
"Sanji": {"hp": 130, "atk": 28, "def": 12},
"Enemy Captain": {"hp": 200, "atk": 35, "def": 15}
}
# Special Ability Data: {Name: {damage_mult: X, effect: None/str, cooldown: Y}}
# damage_mult: Multiplier for base attack damage.
# effect: String indicating special effect (e.g., "defense_pierce", "attack_buff").
# cooldown: How many turns until it's ready again after use.
SPECIAL_ABILITIES_DATA = {
"Luffy": {
"Gum-Gum Pistol": {"damage_mult": 1.5, "effect": None, "cooldown": 2},
"Gum-Gum Gatling": {"damage_mult": 0.7, "hits": 3, "effect": None, "cooldown": 3}, # Added hits for Gatling
},
"Zoro": {
"Onigiri": {"damage_mult": 2.0, "effect": None, "cooldown": 3},
"Sanzen Sekai": {"damage_mult": 2.5, "effect": None, "cooldown": 4},
},
"Sanji": {
"Diable Jambe": {"damage_mult": 0, "effect": "self_attack_buff", "buff_amount": 10, "buff_duration": 2, "cooldown": 3}, # Buff duration in turns
"Concasser": {"damage_mult": 1.2, "effect": "defense_pierce", "pierce_percent": 0.5, "cooldown": 3}, # Pierce %
}
}
# --- Character Class ---
class Character:
def __init__(self, name, is_player=True):
stats = BASE_STATS.get(name)
if not stats:
raise ValueError(f"Stats not defined for character: {name}")
self.name = name
self.max_hp = stats["hp"]
self.current_hp = self.max_hp
self.base_atk = stats["atk"] # Store base for buffs
self.current_atk = stats["atk"]
self.base_defense = stats["def"] # Store base for buffs/debuffs
self.current_defense = stats["def"]
self.is_player = is_player
# Special Abilities state: {Ability Name: {"cooldown": current, "base_cooldown": base}}
self.special_abilities = {}
if is_player: # Only player characters have defined specials initially
ability_data = SPECIAL_ABILITIES_DATA.get(name, {})
for ab_name, data in ability_data.items():
self.special_abilities[ab_name] = {"cooldown": 0, "base_cooldown": data["cooldown"]}
# Buff/Debuff tracking
self.buffs = {"attack": 0, "defense": 0} # {type: duration}
self.temp_defense = 0 # Used specifically for the 'Defend' action
def is_knocked_out(self):
return self.current_hp <= 0
def take_damage(self, damage):
actual_defense = self.current_defense + self.temp_defense # Account for defend action buff
damage_taken = max(1, damage - actual_defense) # Damage calculation
self.current_hp -= damage_taken
self.current_hp = max(0, self.current_hp) # HP can't go below 0
# print(f"{self.name} took {damage_taken} damage!")
return damage_taken
def deal_basic_attack(self, target):
if self.is_knocked_out():
print(f"{self.name} is knocked out and cannot attack.")
return
damage = self.current_atk
print(f"{self.name} performs a Basic Attack on {target.name}!")
damage_taken = target.take_damage(damage)
print(f"{target.name} took {damage_taken} damage. ({target.current_hp}/{target.max_hp} HP remaining)")
def use_special_ability(self, ability_name, target):
if self.is_knocked_out():
print(f"{self.name} is knocked out and cannot act.")
return False
ability_state = self.special_abilities.get(ability_name)
if not ability_state:
print(f"{self.name} does not have the ability: {ability_name}")
return False
if ability_state["cooldown"] > 0:
print(f"{ability_name} is on cooldown! ({ability_state['cooldown']} turns remaining)")
return False
# Find the ability data from the main data structure
ability_details = None
for char_abilities in SPECIAL_ABILITIES_DATA.values():
if ability_name in char_abilities:
ability_details = char_abilities[ability_name]
break
if not ability_details:
print(f"Error: Details for ability '{ability_name}' not found.") # Should not happen if character has the ability state
return False
print(f"{self.name} uses {ability_name} on {target.name}!")
# --- Apply Ability Effect ---
success = False
if ability_details.get("effect") == "self_attack_buff":
self.current_atk += ability_details["buff_amount"]
self.buffs["attack"] = ability_details["buff_duration"] # Set duration
print(f"{self.name}'s attack increased by {ability_details['buff_amount']} for {self.buffs['attack']} turns!")
success = True # Buff abilities are successful if cast
else: # Damage-dealing abilities
base_damage = self.current_atk * ability_details["damage_mult"]
damage_dealt = base_damage # Start with base
if ability_details.get("effect") == "defense_pierce":
pierce_percent = ability_details.get("pierce_percent", 0)
target_effective_defense = target.current_defense + target.temp_defense # Account for Defend action
pierced_defense = target_effective_defense * pierce_percent
remaining_defense = max(0, target_effective_defense - pierced_defense)
# Damage calculation with partial defense ignore
damage_dealt = max(1, base_damage - remaining_defense)
print(f"({ability_name} pierces {pierce_percent*100:.0f}% of {target.name}'s defense!)")
# Add other effects here if needed...
# Handle multi-hit abilities like Gatling
total_damage_taken = 0
num_hits = ability_details.get("hits", 1)
hit_damage = damage_dealt / num_hits # Divide total calculated damage among hits
for i in range(num_hits):
damage_taken = target.take_damage(hit_damage) # Apply hit damage (rounding happens in take_damage)
total_damage_taken += damage_taken
if target.is_knocked_out():
# If target is defeated mid-gatling, stop hitting
print(f"...Hit {i+1}/{num_hits}...")
break
# Optional: print hit-by-hit for multi-hit
# print(f"...Hit {i+1}/{num_hits}: {target.name} took {damage_taken} damage...")
if num_hits > 1 and not target.is_knocked_out():
# Print total only if not defeated mid-hits
print(f"{target.name} took a total of {total_damage_taken} damage from {ability_name}. ({target.current_hp}/{target.max_hp} HP remaining)")
elif target.is_knocked_out():
# If defeated, the take_damage print already happened, maybe add a summary?
print(f"{target.name} was defeated by {ability_name}!")
success = True # Damage abilities are successful if cast and off cooldown
if success:
# Put the ability on cooldown if it was successfully used (buff or damage)
ability_state["cooldown"] = ability_state["base_cooldown"]
return success # Return if the action was successful
def reduce_cooldowns(self):
# Reduce special ability cooldowns
for ability_name, state in self.special_abilities.items():
if state["cooldown"] > 0:
state["cooldown"] -= 1
# print(f"DEBUG: {self.name}'s {ability_name} cooldown is now {state['cooldown']}") # Optional debug
# Reduce buff durations and reset stats if duration ends
if self.buffs["attack"] > 0:
self.buffs["attack"] -= 1
if self.buffs["attack"] == 0:
self.current_atk = self.base_atk # Reset attack
print(f"{self.name}'s attack buff ended.")
# Defense buff from 'Defend' action is temporary, handled in main loop reset
# No persistent defense buffs in this simple version beyond 'Defend'
def reset_temp_defense(self):
self.temp_defense = 0 # Reset defense bonus from 'Defend' action
def display_status(self):
status_color = "\033[92m" if self.current_hp > self.max_hp / 2 else ("\033[93m" if self.current_hp > 0 else "\033[91m") # Green, Yellow, Red
reset_color = "\033[0m"
print(f"{self.name}: {status_color}{self.current_hp}/{self.max_hp} HP{reset_color}", end="")
if self.is_player:
cooldown_info = []
for ab_name, state in self.special_abilities.items():
if state["cooldown"] > 0:
cooldown_info.append(f"{ab_name} CD:{state['cooldown']}")
if cooldown_info:
print(f" ({', '.join(cooldown_info)})", end="")
if self.buffs["attack"] > 0:
print(f" (ATK Up: {self.buffs['attack']} turns)", end="")
print() # Newline at the end
# --- Game Functions ---
def create_crew():
crew = [
Character("Luffy", is_player=True),
Character("Zoro", is_player=True),
Character("Sanji", is_player=True)
]
return crew
def create_enemy():
enemy = Character("Enemy Captain", is_player=False)
# Simple enemy doesn't need special abilities defined initially in this version,
# but the class structure supports adding them later.
return enemy
def display_game_state(crew, enemy):
print("\n--- Game State ---")
print("Your Crew:")
living_crew = [c for c in crew if not c.is_knocked_out()]
if not living_crew:
print(" All crew members are knocked out!")
else:
for char in living_crew:
char.display_status()
print("\nEnemy:")
enemy.display_status()
print("------------------")
def player_turn(crew, enemy, active_character_index):
print("\n--- Player Turn ---")
# Reset temp defense from previous 'Defend' action for *all* crew members
for char in crew:
char.reset_temp_defense()
active_character = crew[active_character_index]
print(f"Active character: {active_character.name}")
action_chosen = False
while not action_chosen:
print("\nChoose an action:")
print(" [A] Attack (Basic)")
# List available special abilities
available_specials = [(name, state) for name, state in active_character.special_abilities.items() if state["cooldown"] == 0]
if available_specials:
print(" [S] Special Ability")
for name, state in active_character.special_abilities.items():
status = f"CD: {state['cooldown']}" if state['cooldown'] > 0 else "Ready"
print(f" - {name} ({status})")
living_other_crew = [c for c in crew if not c.is_knocked_out() and c != active_character]
if living_other_crew:
print(" [W] Switch Character")
print(" [D] Defend (Gain temporary defense)")
choice = input("Enter action [A/S/W/D]: ").lower()
if choice == 'a':
active_character.deal_basic_attack(enemy)
action_chosen = True
elif choice == 's':
if not available_specials:
print("No special abilities are ready or available for this character.")
continue
print("Choose a special ability:")
special_choices = {str(i+1): ab[0] for i, ab in enumerate(active_specials)}
active_specials = [(name, state) for name, state in active_character.special_abilities.items()] # Need full list to display numbers
for i, (name, state) in enumerate(active_specials):
status = f"CD: {state['cooldown']}" if state['cooldown'] > 0 else "Ready"
print(f" [{i+1}] {name} ({status})")
special_choice_input = input(f"Enter number [1-{len(active_specials)}]: ")
try:
special_index = int(special_choice_input) - 1
if 0 <= special_index < len(active_specials):
chosen_ability_name = list(active_character.special_abilities.keys())[special_index] # Get name by index
# Now check if it's actually usable (off cooldown)
if active_character.special_abilities[chosen_ability_name]["cooldown"] == 0:
action_chosen = active_character.use_special_ability(chosen_ability_name, enemy)
else:
print("That ability is on cooldown.") # Re-prompt
else:
print("Invalid special ability number.") # Re-prompt
except ValueError:
print("Invalid input. Please enter a number.") # Re-prompt
elif choice == 'w':
if not living_other_crew:
print("No other crew members available to switch to.")
continue
print("Switch to which character?")
switch_choices = {str(i+1): c for i, c in enumerate(living_other_crew)}
for i, char in enumerate(living_other_crew):
print(f" [{i+1}] {char.name}")
switch_choice_input = input(f"Enter number [1-{len(living_other_crew)}]: ")
try:
switch_index = int(switch_choice_input) - 1
if 0 <= switch_index < len(living_other_crew):
new_active_character = living_other_crew[switch_index]
new_active_index = crew.index(new_active_character) # Find the index in the main crew list
print(f"{active_character.name} switches out. {new_active_character.name} steps forward!")
return new_active_index, True # Return new index and True indicating action taken
else:
print("Invalid character number.") # Re-prompt
except ValueError:
print("Invalid input. Please enter a number.") # Re-prompt
elif choice == 'd':
DEFENSE_BONUS = 10 # How much defense Defend adds for the enemy turn
active_character.temp_defense = DEFENSE_BONUS
print(f"{active_character.name} is defending, gaining +{DEFENSE_BONUS} Defense for the enemy's next attack!")
action_chosen = True
else:
print("Invalid action. Please choose A, S, W, or D.")
# If we reached here, a non-switch action was taken successfully
return active_character_index, action_chosen
def enemy_turn(enemy, crew, active_character_index):
print("\n--- Enemy Turn ---")
if enemy.is_knocked_out():
print("The enemy is knocked out!")
return
active_character = crew[active_character_index]
# Simple Enemy AI: Always attack the active player character
print(f"{enemy.name} attacks {active_character.name}!")
enemy.deal_basic_attack(active_character) # The take_damage method within deals with temp_defense
# --- Main Game Loop ---
def play_game():
print("Welcome to Simple Straw Hat Scuffle!")
crew = create_crew()
enemy = create_enemy()
active_character_index = 0 # Start with Luffy (index 0)
turn = 1
while True:
print(f"\n===== Turn {turn} =====")
display_game_state(crew, enemy)
# Check win/loss condition before turn actions
living_crew = [c for c in crew if not c.is_knocked_out()]
if not living_crew:
print("\nYour crew has been defeated! Game Over!")
break
if enemy.is_knocked_out():
print(f"\nYou defeated the {enemy.name}! You Win!")
break
# Player's Turn
# Ensure active character is still alive, if not, switch automatically
if crew[active_character_index].is_knocked_out():
print(f"{crew[active_character_index].name} was knocked out! Switching character...")
living_crew = [c for c in crew if not c.is_knocked_out()]
if not living_crew: # Should have been caught by the initial check, but good safety
print("\nYour crew has been defeated! Game Over!")
break
# Find the index of the first living character
active_character_index = crew.index(living_crew[0])
print(f"New active character is {crew[active_character_index].name}.")
# Execute Player Turn - Handles action selection and returns new active index if switched
# Loop until a valid action (attack, special, defend, or successful switch) is chosen
player_action_taken = False
while not player_action_taken:
new_active_index, player_action_taken = player_turn(crew, enemy, active_character_index)
if player_action_taken:
active_character_index = new_active_index # Update index if switch happened
else:
print("Action failed or invalid input. Try again.")
time.sleep(1) # Pause
# Check Win Condition after player action
if enemy.is_knocked_out():
display_game_state(crew, enemy) # Show final state
print(f"\nYou defeated the {enemy.name}! You Win!")
break
# Enemy's Turn
enemy_turn(enemy, crew, active_character_index)
time.sleep(1) # Pause
# Check Loss Condition after enemy action
living_crew_after_enemy = [c for c in crew if not c.is_knocked_out()]
if not living_crew_after_enemy:
display_game_state(crew, enemy) # Show final state
print("\nYour crew has been defeated! Game Over!")
break
# End of Round: Reduce cooldowns for everyone
for char in crew:
char.reduce_cooldowns()
enemy.reduce_cooldowns() # Even simple enemies might have cooldowns later
turn += 1
print("\n--- Game Ended ---")
# --- Start the Game ---
if __name__ == "__main__":
play_game()