bash从一个案例 /w另一个情况下加起来
我如何将诸如ATK,DEF等统计数据添加
。 echo“您的char统计数据是($ class($ atk) +($ warweps($ atk)”
#!/data/data/com.termux/files/usr/bin/zsh
echo "Welcome to Wurtex world. Select your starting class:
1 - Warrior
2 - Wizard
3 - Ranger"
read class
case $class in
1)
type="Warrior"
hp=150
atk=30
;;
2)
type="Wizard"
hp=80
atk=70
;;
3)
type="Ranger"
hp=90
atk=60
;;
esac
echo "You chosen the $type class. Your starting HP and ATK is ($hp , $atk)"
sleep 2
if [[ $type == "Warrior" ]]; then
echo "Select your starting weapon:
1 - Frulx Longsword
2 - Ushtar Sword & Circle Shield"
read warWeps
fi
if [[ $type == "Wizard" ]]; then
echo "Select your starting weapon:
1 - YuuRStaff
2 - Olyen Wand & Circle Shield"
read wizWeps
fi
if [[ $type == "Ranger" ]]; then
echo "Select your starting weapon:
1 - Jenzy Bow
2 - Ehtar Crossbow & Basic Defender"
read rangWeps
fi
case $warWeps in
1)
type="Longsword"
name="Frulx Longsword"
atk=20
;;
2)
type="Sword"
name="Ushtar Sword & Circle Shield"
atk=10
def=10
;;
esac
if [[ $type == "Longsword" ]]; then
echo "Your STATS: $atk"
fi
if [[ $type == "Sword" ]]; then
echo "Your STATS: $atk, $def"
fi
case $wizWeps in
1)
type="Staff"
name="YuuRStaff"
atk=15
;;
2)
type="Wand"
name="Olyen Wand & Circle Shield"
atk=12
def=10
;;
esac
if [[ $type == "Staff" ]]; then
echo "Your STATS: $atk"
fi
if [[ $type == "Wand" ]]; then
echo "Your STATS: $atk , $def"
fi
case $rangWeps in
1)
type="Bow"
name="Jenzy Bow"
atk=18
stm=30
;;
2)
type="Crossbow"
name="Ehtar Crossbow & Basic Defender"
atk=16
stm=15
def=7
;;
esac
if [[ $type == "Bow" ]]; then
echo "Your STATS: $atk , $stm"
fi
if [[ $type == "Crossbow" ]]; then
echo "Your STATS: $atk, $stm , $def"
fi
How I can add up stats like atk, def... From class case /w warWeps case, wizWeps case and rangWeps...
ex. echo "Your char stats is ($class($atk) + ($warWeps($atk)"
#!/data/data/com.termux/files/usr/bin/zsh
echo "Welcome to Wurtex world. Select your starting class:
1 - Warrior
2 - Wizard
3 - Ranger"
read class
case $class in
1)
type="Warrior"
hp=150
atk=30
;;
2)
type="Wizard"
hp=80
atk=70
;;
3)
type="Ranger"
hp=90
atk=60
;;
esac
echo "You chosen the $type class. Your starting HP and ATK is ($hp , $atk)"
sleep 2
if [[ $type == "Warrior" ]]; then
echo "Select your starting weapon:
1 - Frulx Longsword
2 - Ushtar Sword & Circle Shield"
read warWeps
fi
if [[ $type == "Wizard" ]]; then
echo "Select your starting weapon:
1 - YuuRStaff
2 - Olyen Wand & Circle Shield"
read wizWeps
fi
if [[ $type == "Ranger" ]]; then
echo "Select your starting weapon:
1 - Jenzy Bow
2 - Ehtar Crossbow & Basic Defender"
read rangWeps
fi
case $warWeps in
1)
type="Longsword"
name="Frulx Longsword"
atk=20
;;
2)
type="Sword"
name="Ushtar Sword & Circle Shield"
atk=10
def=10
;;
esac
if [[ $type == "Longsword" ]]; then
echo "Your STATS: $atk"
fi
if [[ $type == "Sword" ]]; then
echo "Your STATS: $atk, $def"
fi
case $wizWeps in
1)
type="Staff"
name="YuuRStaff"
atk=15
;;
2)
type="Wand"
name="Olyen Wand & Circle Shield"
atk=12
def=10
;;
esac
if [[ $type == "Staff" ]]; then
echo "Your STATS: $atk"
fi
if [[ $type == "Wand" ]]; then
echo "Your STATS: $atk , $def"
fi
case $rangWeps in
1)
type="Bow"
name="Jenzy Bow"
atk=18
stm=30
;;
2)
type="Crossbow"
name="Ehtar Crossbow & Basic Defender"
atk=16
stm=15
def=7
;;
esac
if [[ $type == "Bow" ]]; then
echo "Your STATS: $atk , $stm"
fi
if [[ $type == "Crossbow" ]]; then
echo "Your STATS: $atk, $stm , $def"
fi
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)