出于某种原因,我无法弄清楚如何编译它。在此行中找不到 setValue 函数:'skill.get("Level").setValue(newLevel);'
import java.util.HashMap;
public class Stat extends GameObject
{
int value;
public Stat()
{
name = "Accuracy";
value = 1;
}
public int getValue()
{
return value;
}
public void setValue(int newValue)
{
value = newValue;
}
}
import java.util.HashMap;
public class Skill extends Stat
{
protected HashMap<String, GameObject> skill;
public Skill()
{
name = "swords";
description = "Learn how to master the art of swordmanship";
skill.put("Level",new Stat("Level",1));
skill.get("Level").setValue(newLevel);
}
}