Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Practice using modulo to loop over an array
- // Choisis la combinaison et l'ordre des unités idéale
- var summonTypes = ["archer"];
- function summonTroops() {
- // Use % to wrap around the summonTypes array based on hero.built.length
- var type = summonTypes[0];
- hero.summon(type);
- }
- while(true) {
- var item = hero.findNearestItem();
- hero.move(item.pos);
- while(hero.gold>hero.costOf(summonTypes[0])) {
- summonTroops();
- }
- var friends = hero.findFriends();
- for(var i = 0;i<friends.length;i++){
- var enemy = friends[i].findNearestEnemy();
- if(enemy ){
- hero.command(friends[i], "attack", enemy);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement