为什么'受伤'值有所不同?
public int Health = 500;
public int Injured;
public int AtkDamage()
{
Random AtkRnd = new Random();
return Injured = AtkRnd.Next(0, 100);
}
public int RemainHP()
{
return Health -= Injured;
}
为什么在" retushp"中"受伤"与" atkdamage"中的"受伤"不同,他们在同一阶级中。
在RemainHP
中删除=
。现在相当于
Health = Health - Injured;
return Health;
你想要
return Health - Injured