Summits gate Javascript


#21
// Fight your way into the Inner Sanctum of the ogre chieftain, and defeat her.
function disassembleCatapults(){
    var catapults = hero.findByType("catapult");
    var friends = hero.findFriends();
    for(var i = 0; i < catapults.length; i += 1){
        var catapult = catapults[i];
         if (catapult) {
                hero.moveXY(catapult.pos.x, catapult.pos.y);
        }else{
            break;
        }
    }
}
function healHero(){
    var paladins = hero.findByType("paladin");
    for(var i = 0; i < paladins.length; i += 1){
        var paladin = paladins[i];
    if (hero.health < 2500 && paladin.canCast("heal", hero)) {
                    hero.command(paladin, "cast", "heal", hero);
        }
    }
}
function command(){
    var friends = hero.findFriends();
    var paladin = hero.findNearest("paladin");
    for(var i = 0; i < friends.length; i += 1){
        var friend = friends[i];
        var catapult = hero.findByType("catapult");
        var enemy = friend.findNearestEnemy();
        if (friend && enemy) {
                hero.command(friend, "attack", enemy);
        }
    }
}
function summon(){
    if (hero.gold > hero.costOf("soldier")) {
        hero.summon("soldier");
    }
}

function fight(){
    var enemies = hero.findEnemies();
    for(var i = 0; i < enemies.length; i += 1){
        var enemy = enemies[i];
if (enemy) {
        if (hero.canCast ("chain-lightning", enemy)) {
            hero.cast("chain-lightning", enemy);
        }else if(hero.isReady("bash")){
        hero.bash(enemy);
        }else{
            hero.attack(enemy);
            }
        }
    }
}
    
while(true) {
    summon();
    fight();
    command();
    healHero();
    disassembleCatapults();
}

#22

You strategy seems too complicated for me. All you need is to attack the catapults and for me is easier to fight them and not to wait them to self-destroy. ( I think this is the idea of @SuperSmacker . I tried this and it’s slower) . Don’t involve your warriors into the fight, hide them out of reach of catapults until you destroy them. I reached the door even without the paladins healing and all my minions with no harm at all.


#23

Wow impressive. For me the catapults always take out some of my troops before I destroy them


#24

so make troops hide got it.


#25

If you make all the troops go in a corner, then once the catapults fire the second shot, they’re all gonna get decimated.

Also, even if they run from the catapults, the fangriders and the other ogres will still hit and damage them, which would kill a few if not many


#26

No, you’re wrong


All enemies are chasing the hero, the fireballs decimate the ogres and the poor fang rider aiming your troops is the first victim of friendly fire.


#27

Well, interesting. 20