Summits-gate with out //This line archers do not form a circle


#1

The main my that I don’t understood that with out" //This line "archers do not form a circle

hero.c = function(s, x, y, h, o ) {
if(h===undefined) h = false;
if(o===undefined) o = false;
hero.say(h);//This line
var d=6,e=null;
var defendPos = {x: x, y: y};
var angle = Math.PI * 2;
for(var i=0; i<s.length; i++)
{
if(s[i])
{
defendPos = {x: x, y: y};
angle = Math.PI * 2;
if(s[i].type==“soldier”) {if(o) d=5; else d=7;}
if(s[i].type==“archer”) {if(o) d=7; else d=4;}
if(s[i].type==“paladin”) {if(h&&o) d=4; else{ if(h) d=8; else d=2;}}
angle = angle * i / s.length;
if(h) angle = angle/2-Math.PI/2;
if(h&&o) angle = angle+Math.PI;
defendPos.x += d * Math.cos(angle);
defendPos.y += d * Math.sin(angle);
e=null;
if(hero.findEnemies()) e=s[i].findNearest(hero.findEnemies());

    if(h){
        if(s[i].type=="soldier") { if(e&&s[i].distanceTo(e)<6)
            hero.command(s[i], "attack", e);
                    else hero.command(s[i], "move", defendPos);}
        if(s[i].type=="archer") { if(e&&s[i].distanceTo(e)<13)
            hero.command(s[i], "attack", e);
                    else hero.command(s[i], "move", defendPos);}
        if(s[i].type=="paladin") {    
            if (s[i].canCast("heal",hero)) this.command(s[i], "cast", "heal", hero);
            else {if(s[i].canCast("heal",s[i]))this.command(s[i], "cast", "heal", s[i]);}
        }
    }
    else hero.command(s[i], "move", defendPos);

    }
}

};

hero.c( hero.findByType(“soldier”) , 52, 38, true);
hero.c( hero.findByType(“archer”), 6, 38);
if(hero.now()>4) hero.say(“message”);
if( hero.now()>5.6){
var sa = hero.findByType(“soldier”);
var a1=sa[0];
var a2=sa[1];
sa[0]=null;
sa[1]=null;
hero.command(a1, “move”,{x:88, y:61});
hero.command(a2, “move”,{x:88, y:7});
while( hero.now<6.7)
hero.c(sa , 17, 38);
}

but at all if in line “if( hero.now()>5.6){” not be executed


#2

@Eggzz can you use the code format button to ensure your code is formatted properly and easy to read.