diff --git a/d2bs/kolbot/libs/common/Attack.js b/d2bs/kolbot/libs/common/Attack.js index c4138b8e6..b3fdc02cb 100644 --- a/d2bs/kolbot/libs/common/Attack.js +++ b/d2bs/kolbot/libs/common/Attack.js @@ -458,6 +458,9 @@ var Attack = { } } while (target.getNext()); } + + //possible to move sort here so we sort once? + monsterList.sort(sortfunc); while (start && monsterList.length > 0 && attackCount < 300) { if (boss) { @@ -469,11 +472,8 @@ var Attack = { return false; } - //monsterList.sort(Sort.units); - monsterList.sort(sortfunc); - target = copyUnit(monsterList[0]); - + if (target.x !== undefined && (getDistance(target, orgx, orgy) <= range || (this.getScarinessLevel(target) > 7 && getDistance(me, target) <= range)) && this.checkMonster(target)) { if (Config.Dodge && me.hp * 100 / me.hpmax <= Config.DodgeHP) { this.deploy(target, Config.DodgeRange, 5, 9); @@ -483,8 +483,13 @@ var Attack = { //me.overhead("attacking " + target.name + " spectype " + target.spectype + " id " + target.classid); result = ClassAttack.doAttack(target, attackCount % 15 === 0); - - if (result) { + + if (result == -1) { + //if we reached here, it means there was a mob around the telestomp target + monsterList.shift(); + //shift and reappend the target at end, telestomp after we have killed other monsters in list + monsterList.push(target); + } else if (result) { retry = 0; if (result === 2) { diff --git a/d2bs/kolbot/libs/common/Attacks/Sorceress.js b/d2bs/kolbot/libs/common/Attacks/Sorceress.js index 58245bd18..f13010065 100644 --- a/d2bs/kolbot/libs/common/Attacks/Sorceress.js +++ b/d2bs/kolbot/libs/common/Attacks/Sorceress.js @@ -111,7 +111,19 @@ var ClassAttack = { } result = this.doCast(unit, timedSkill, untimedSkill); - + + //build the list and count the monsters + var monList = Attack.buildMonsterList(); + //is sorting strictly required? + var sortfunc = Attack.sortMonsters; + monList.sort(sortfunc); + var monCount = Attack.getMonsterCount(me.x, me.y, 15, monList); + //if there are 3 or more monsters in the area around me, I won't telestomp + if(monCount > 2 && Config.TeleStomp) { + return -1; + } + + //now thare are only 2 monsters, we think it's safe to telestomp if (result === 2 && Config.TeleStomp && Attack.checkResist(unit, "physical") && !!me.getMerc() && Attack.validSpot(unit.x, unit.y)) { while (Attack.checkMonster(unit)) { if (Town.needMerc()) {