fei
June 27, 2015, 2:18pm
1
loop {
var farthest = null;
var maxDistance = 0;
var enemyIndex = 0;
var enemies = this.findEnemies();
// 查看全部敌人,找出最远的那个。
while (enemyIndex < enemies.length) {
var target = enemies[enemyIndex];
enemyIndex += 1;
// 是不是有敌人比我们能看到的最远的敌人还要远?
var distance = this.distanceTo(target);
if (distance > maxDistance) {
maxDistance = distance;
farthest = target;
}
}
if (farthest) {
// 干掉最远的敌人!
// 如果敌人血量大于0就保持攻击。
if(this.health>0){
if (this.isReady("cleave")) {
this.cleave(farthest);
this.bash(farthest);
}
else {
this.attack(farthest);
this.bash(farthest);
}
}
}
}
trotod
June 27, 2015, 4:06pm
2
这是 Mad Maxer,对吗?
我想一个问题就是在 bash
敌人的时候。
如果你想用 bash
,你先要检查可不可以用 bash
:
if (this.isReady('bash')) {
this.bash(farthest)
}
另一个问题是在攻击敌人。你真在查看自己的血量。你因该查看敌人的血量。因为每个 loop
最远的敌人会变,所以你也因该用一个 while
loop 攻击敌人,这样可以打死最远的敌人,再找别的敌人。
我不知道你为什么要用 this.cleave
,因为 Mad Maxer 不应该让你用 Long Sword 。
(Also my Chinese isn’t that great, so maybe your English might be better than my Chinese:)
Your hero needs to check if he/she can bash before bashing an enemy
Your hero should check if the farthest enemy’s health is greater than 0, not the hero’s health
Your hero should also use a while
loop to attack the farthest enemy, so your hero’s target does not change
Not sure why you are cleaving when the Long Sword is not allowed in Mad Maxer
1 Like
fei
June 28, 2015, 3:15pm
3
Thank you for you help;
although that my hero was also die too early.
was the blood of my hero too less to pass this game
Mybe the knives of my hero was too lower;
trotod
June 28, 2015, 4:30pm
4
You should already have over 600 health (“blood”).
If you can, try buying the Kithsteel Blade (Kithsteel的剑). (1600 )
If you can’t, as long as you understand the concept taught in Mad Maxer, you could skip to Clash of Clones (克隆冲突) or Crag Tag (峭壁标签) .
1 Like