Newer
Older
Ruby / ge-mu2.rb
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-


buki= []
kougekirixyoku=[]

buki << "金の剣"
buki << "金の鉾"
buki << "金の斧"

kougekirixyoku << "10"
kougekirixyoku << "20"
kougekirixyoku << "4"

printf("%sの攻撃力は%dです。\n", buki[0],kougekirixyoku[3])
printf("%sの攻撃力は%dです。\n", buki[1],kougekirixyoku[4])
printf("%sの攻撃力は%dです。\n", buki[2],kougekirixyoku[5])

bougu=[]
bougixyorixyoku=[]

bougu << "金の鎧"
bougu << "銀の鎧"
bougu << "銅の鎧"

bougixyorixyoku << "15"
bougixyorixyoku << "10"
bougixyorixyoku << "5"

printf("%sの防御力は%dです。\n", bougu[0],bougixyorixyoku[4]
printf("%sの防御力は%dです。\n", bougu[1],bougixyorixyoku[5]
printf("%sの防御力は%dです。\n", bougu[2],bougixyorixyoku[6]
              

puts "旅の始まり"
puts "1,武器を選べ"
puts "1:金の剣"
puts "2:金の鉾"
puts "3:金の斧"
puts "2,防具を選べ"
puts "1:金の鎧"
puts "2:銀の鎧"
puts "3:銅の鎧"


while true
  print "答えを入力 :"
  kotae = gets.chomp.to_i
  if kotae == 1
    puts "攻撃力10"
    break
  elsif kotae == 2
    puts "攻撃力20"
    break
  elsif kotae == 3
    puts "攻撃力4"
    break
  else
    puts "その選択肢はないよ!"
    redo
  end
end


while true
  print "答えを入力 :"
  kotae = gets.chomp.to_i
  if kotae == 1
    puts "