Hey guys,
Please help me with the code it think it something regarding modulus
this.summonTroops = function() {
var type = summonTypes[this.built.length % summonTypes.length];
if(this.gold >= this.costOf(type)) {
this.summon(type);
}
};
this.commandTroops = function() {
var friends = this.findFriends();
for(var friendIndex=0; friendIndex < friends.length; friendIndex++) {
var friend = friends[friendIndex];
// Use % to wrap around defendPoints based on friendIndex
defendPoints = defendPoints[ friendIndex % defendPoints.length ];
// Command your minion to defend the defendPoint
this.command(friend, "defend", defendPoints);
}
};
loop {
this.summonTroops();
this.commandTroops();
}
Thanks in advance