Codecombat China game website:http://www.codecombat.cn/
all code is shared with JavaScript code
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41. Summit ' s Gate
//Need a good operation
//Fight your to the Inner Sanctum of the Ogre Chieftain, and kill her.
this.flags = function () {
var flagg = This.findflag ("green");
var FLAGB = This.findflag ("Black");
if (Flagg) {
This.pickupflag (Flagg);
}
if (FLAGB) {
This.jumpto (flagb.pos);
This.pickupflag (FLAGB);
}
};
this.attacks = function () {
var enemy = This.findnearest (This.findenemies ());
if (Enemy && This.distanceto (enemy) <) {
if (This.isready ("bash")) {
This.bash (enemy);
}
Else if (This.isready ("throw")) {
This.throw (enemy);
}
else {
This.attack (enemy);
}
}
};
this.builds = function () {
if (This.gold > This.costof ("Archer")) {
This.summon ("Archer");
}
};
This.comm = function (friend) {
if (friend) {
var enemy = Friend.findnearestenemy ();
if (Friend.type = = "Paladin" && This.health < This.maxhealth) {
This.command (friend, "cast", "Heal", this);
}
else if (enemy && enemy.type! = "Tower") {
This.command (friend, "attack", enemy);
}
else {
if (Friend.pos.x <) {
This.command (friend, "move", {x:friend.pos.x+1,y:28});
}
}
}
};
this.commandfriends = function () {
//Command your friends.
var friends = This.findfriends ();
For (var i=0; i < friends.length; i++) {
var friend = friends[i];
if (Friend.type = = "Paladin") {
This.comm (friend);
}
else if (Friend.type = = "Archer") {
This.comm (friend);
}
else if (Friend.type = = "Soldier") {
This.comm (friend);
}
}
};
Loop {
this.flags ();
this.builds ();
this.attacks ();
this.commandfriends ();
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Codecombat Resting Cloud Peak 41 off code share