One Piece Expansive RPG Shell Script Part 1 East Blue Pirate

#1
On your terminal have linux based system installed
Run this by first vi into a shell script and name it onepiece.sh
paste and then use chmod a+x so you may execute the script


#!/bin/bash

# Initial Character Points (CP) and Bounty
CP=100
bounty=0
is_pirate=0
start_location=""

# Options and Costs
declare -A haki_options=( ["None"]=0 ["Observation"]=20 ["Armament"]=20 ["Conqueror"]=40 )
declare -A devil_fruits=( ["None"]=0 ["Paramecia (Standard)"]=20 ["Zoan"]=30 ["Logia"]=50 )
declare -A races=( ["Human"]=0 ["Fishman"]=15 ["Mink"]=15 ["Giant"]=30 ["Cyborg"]=25 )
declare -A blues=( ["East Blue"]=0 ["West Blue"]=0 ["North Blue"]=0 ["South Blue"]=0 )
declare -A occupations=( ["Pirate"]=10 ["Marine"]=10 ["Revolutionary"]=15 ["Bounty Hunter"]=5 ["Merchant"]=5 )

# Marine roster with different strengths and bounty increases
declare -A marines=(
["Captain Morgan"]="strength:30 bounty_increase:1000000"
["Lieutenant Fullbody"]="strength:20 bounty_increase:7000000"
["Commodore Smoker"]="strength:50 bounty_increase:20000000"
["Vice Admiral Momonga"]="strength:45 bounty_increase:100000000"
["Admiral Kizaru"]="strength:60 bounty_increase:1000000000"
)

# Function to display choices and deduct points
choose_option() {
local category="$1"
local options="$2[@]" # Access passed array as a parameter
local options_array=("${!options}") # Expand array

echo "Choose your $category:"
select choice in "${options_array[@]}"; do
local cost="${options_array["$choice"]}"
if [ "$CP" -ge "$cost" ]; then
echo "You chose $choice ($cost CP)"
CP=$((CP - cost))
echo "Remaining CP: $CP"
case $category in
"Occupation")
if [ "$choice" == "Pirate" ]; then
is_pirate=1
fi
;;
"Starting Blue")
start_location="$choice"
;;
esac
break
else
echo "Not enough CP for $choice. You have $CP remaining."
fi
done
}

# Introduction
echo "Welcome to the One Piece Character Creation!"
echo "You have $CP Character Points to customize your character."
echo

# Step 1: Select Haki
choose_option "Haki" haki_options

# Step 2: Select Devil Fruit
choose_option "Devil Fruit" devil_fruits

# Step 3: Select Race
choose_option "Race" races

# Step 4: Select Starting Blue
choose_option "Starting Blue" blues

# Step 5: Select Occupation
choose_option "Occupation" occupations

# Final Summary
echo
echo "Character Creation Complete!"
echo "Remaining CP: $CP"
echo "Summary:"
echo "Haki: ${haki_options[choice]}"
echo "Devil Fruit: ${devil_fruits[choice]}"
echo "Race: ${races[choice]}"
echo "Starting Blue: $start_location"
echo "Occupation: ${occupations[choice]}"
echo

# Pirate-specific actions
if [ "$is_pirate" -eq 1 ] && [ "$start_location" == "East Blue" ]; then
echo "As a Pirate starting in East Blue, your journey is about to get dangerous!"
echo "Marine patrols are out there, and each encounter can increase your bounty."

# Loop for encounters with Marines
for encounter in {1..5}; do
echo "Encounter #$encounter with Marines!"

# Choose a random Marine from the list
marine_names=("${!marines[@]}")
selected_marine=${marine_names[$(( RANDOM % ${#marine_names[@]} ))]}
marine_stats=${marines[$selected_marine]}

# Extract Marine's strength and bounty increase
strength=$(echo "$marine_stats" | awk -F " " '{print $1}' | cut -d':' -f2)
bounty_increase=$(echo "$marine_stats" | awk -F " " '{print $2}' | cut -d':' -f2)

echo "You encountered $selected_marine! Strength: $strength"

# Determine the outcome of the encounter
if [ "$strength" -le 35 ]; then
bounty=$((bounty + bounty_increase))
echo "You defeated $selected_marine! Bounty increased by $bounty_increase Berries."
else
echo "$selected_marine was too strong, but you managed to escape!"
fi

echo "Current Bounty: $bounty Berries"
sleep 1
done
fi

echo
echo "Final Bounty: $bounty Berries"
echo "Good luck on your journey, Pirate of the East Blue!"
 
Top