我的第一个自动答题器工作正常,但是当我尝试复制该公式进行魔法恢复时,我启动游戏后我的魔法恢复就开始消失了。仅在您花费了一点技能来提高魔法水平时,法力恢复才会开始。
我尝试复制autoclicker setinterval内容,但法力回复不同。我不知道如何正确格式化它。
这是我的JavaScript:
for
页面底部附近是自动点击器设置
string lineRead = "apple mango orange grape";
var values = lineRead.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < values.Length; i++)
{
CLASS[0,i] = values[i];
}
这是我的manaregen升级的html代码按钮:
var rebirths = 0;
function buyRebirth() {
var rebirthCost = Math.floor(10 * Math.pow(1.1, rebirths));
if (cookies >= rebirthCost)
if (rebirths < 1){
cookies = cookies - rebirthCost
HitPoints = HitPoints + 10;
MaxHitpoints = MaxHitpoints + 10;
ManaPoints = ManaPoints + 10;
MaxManapoints = MaxManapoints + 10;
SkillPoints = SkillPoints + 1;
rebirths = rebirths + 1;
document.getElementById("rebirths").innerHTML = rebirths;
document.getElementById('cookies').innerHTML = cookies;
document.getElementById("HitPoints").innerHTML = HitPoints;
document.getElementById("MaxHitpoints").innerHTML = MaxHitpoints;
document.getElementById("ManaPoints").innerHTML = ManaPoints;
document.getElementById("MaxManapoints").innerHTML = MaxManapoints;
document.getElementById("rebirthCost").innerHTML = rebirthCost;
document.getElementById("SkillPoints").innerHTML = SkillPoints;
}
if (cookies >= rebirthCost)
if(rebirths >= 1){
cookies = cookies - rebirthCost
rebirths = rebirths + 1;
SkillPoints = SkillPoints +1;
document.getElementById('cookies').innerHTML = cookies;
document.getElementById("rebirthCost").innerHTML = rebirthCost;
document.getElementById("rebirths").innerHTML = rebirths;
document.getElementById("SkillPoints").innerHTML = SkillPoints;
var ManaPoints = 0;
var SkillPoints = 0;
function ManaPointsregen(){
if (SkillPoints>0 && rebirths >=1)
SkillPoints = SkillPoints - 1;
ManaPoints = ManaPoints + 1;
document.getElementById('SkillPoints').innerHTML = SkillPoints;
document.getElementById("ManaPoints").innerHTML = ManaPoints;
http://prntscr.com/ns5h8j这就是我,只需打开它即可。它会在开始时上升。
我希望只有在mp regen http://prntscr.com/ns5hj5上使用技能点后,魔法恢复才会开始生效。但是实际的输出魔力恢复从一开始就消失了。我还希望有一种方法可以像在创建MaxManapoints变量并将其停在<= MaxManapoints一样,停止在mabyy中的增长。
答案 0 :(得分:0)
如果我是正确的话,如果 SkillPoints 和 rebirths 的值至少为 1 <,则希望执行这两个语句/ p>
SkillPoints = SkillPoints - 1;
ManaPoints = ManaPoints + 1;
这可以通过将要执行的代码包装在大括号{}中来完成。
目前还没有,以防万一,这种情况评估为真:
if (SkillPoints>0 && rebirths >=1)
JavaScript只会在if-condition之后执行下一行:
SkillPoints = SkillPoints - 1;
这意味着此后的每条语句都将执行,而与if-condition无关:
ManaPoints = ManaPoints + 1;
尝试一下:
if (SkillPoints>0 && rebirths >=1)
{
SkillPoints = SkillPoints - 1;
ManaPoints = ManaPoints + 1;
}