class Slime
def appear
@hp = 100
print("野生的史莱姆跳出来了")
end
def status
print("史莱姆当前的hp是#{@hp}")
end
def attack
print("史莱姆向你发起了攻击")
end
def damage
@hp -= 5
print("你攻击了史莱姆,造成了5点伤害")
end
end
a = Slime.new
b = Slime.new
a.appear
b.appear
a.attack
b.attack
a.status
b.status
a.damage
a.status
b.status
c = Slime.new
c.appear
c.attack
c.status
class Slime
def appear
@hp = 100
print("野生的史莱姆跳出来了")
end
def status
print("史莱姆当前的hp是#{@hp}")
end
def attack
print("史莱姆向你发起了攻击")
end
def damage
@hp -= 5
print("你攻击了史莱姆,造成了5点伤害")
end
end
a = Slime.new
b = Slime.new
a.appear
b.appear
a.attack
b.attack
a.status
b.status
a.damage
a.status
b.status
c = Slime.new
c.appear
c.attack
c.status