Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addtelestompfix #1343

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions d2bs/kolbot/libs/common/Attack.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand All @@ -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) {
Expand Down
14 changes: 13 additions & 1 deletion d2bs/kolbot/libs/common/Attacks/Sorceress.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down