Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Kill a monster based on its classId
- kill: function (classId) {
- if (Config.AttackSkill[1] < 0) {
- return false;
- }
- var i, dodgeList, target,
- attackCount = 0;
- for (i = 0; i < 3; i += 1) {
- target = getUnit(1, classId);
- if (target) {
- break;
- }
- delay(50);
- }
- if (!target) {
- throw new Error("Attack.kill: Target not found");
- }
- if (Config.MFLeader) {
- Pather.makePortal();
- say("kill " + classId);
- }
- while (attackCount < 300 && this.checkMonster(target) && this.skipCheck(target)) {
- if (Config.Dodge) {
- dodgeList = this.buildDodgeList();
- if (dodgeList.length) {
- dodgeList.sort(Sort.units);
- if (getDistance(me, dodgeList[0]) < 13) {
- this.dodge(target, 20, dodgeList);
- }
- dodgeList.sort(Sort.units);
- if (getDistance(me, dodgeList[0]) < 13) {
- continue;
- }
- }
- }
- Misc.townCheck(true);
- if (ClassAttack.doAttack(target, attackCount % 15 === 0) < 2) {
- break;
- }
- if (!copyUnit(target).x) { // Check if unit got invalidated, happens if necro raises a skeleton from the boss's corpse.
- return true;
- }
- attackCount += 1;
- }
- return (target.mode === 0 || target.mode === 12);
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement