有时它返回所有主题的概率并且一切都很好,但有时它只返回几个主题的概率并且它们加起来不等于一个,这似乎取决于文档。一般来说,当它返回的主题很少时,概率加起来或多或少是 80%,那么它是否只返回最相关的主题?有没有办法强制它返回所有概率?
也许我遗漏了一些东西,但我找不到该方法参数的任何文档。
所以我正在做一些关于制作一个小游戏原型的课程.我有这些简单的类(以及其他一些不相关的类):
abstract class Weapon {
int damage;
int cost;
}
abstract class RangedWeapon extends Weapon {
int range;
int rounds;
}
class ExtraRounds extends Item{
int cost = 20;
int uses = 1;
void use(GameState state){
if (state.currentCharacter.weapon instanceof RangedWeapon){
state.currentCharacter.weapon.rounds += 10;
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是在尝试编译时,我得到了
Implementations.java:56: error: cannot find symbol
state.currentCharacter.weapon.rounds += 10;
^
symbol: variable rounds
location: variable weapon of type Weapon
Run Code Online (Sandbox Code Playgroud)
我想要的只是班级ExtraRounds来检查是否weapon是班级RangedWeapon并采取相应的行动,但我不知道哪里出了问题.任何帮助表示赞赏