-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbasic_warrior.9.js
145 lines (125 loc) · 3.51 KB
/
basic_warrior.9.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
// Load basic functions from other code snippet
load_code(7);
load_code(8);
// Kiting
var rangeRate = 1.2;
const loopInterval = ((1 / character.frequency) * 1000) / 6;
async function fight(target) {
if (character.mp > G.skills["charge"].mp && !is_on_cooldown("charge"))
use_skill("charge");
if (can_attack(target)) {
set_message("Attacking");
await currentStrategy(target);
attack(target);
if (character.mp > G.skills["warcry"].mp && !is_on_cooldown("warcry"))
use_skill("warcry");
if (
target.target === character.name &&
character.mp > G.skills["hardshell"].mp &&
!is_on_cooldown("hardshell") &&
avgDmgTaken(character) > 500 &&
character.hp < 0.5 * character.max_hp
)
use_skill("hardshell");
if (
character.mp > G.skills["stomp"].mp &&
!is_on_cooldown("stomp") &&
locate_item("basher") !== -1 &&
character.hp < character.max_hp * 0.7
) {
await equipBatch({ mainhand: "basher", offhand: undefined });
await use_skill("stomp");
}
if (character.mp > G.skills["taunt"].mp && !is_on_cooldown("taunt")) {
const mobsTargetingAlly = Object.keys(parent.entities).find((id) =>
partyMems
.filter((char) => char !== character.name)
.includes(parent.entities[id]?.target)
);
if (
mobsTargetingAlly &&
parent.entities[mobsTargetingAlly]?.attack > 120 &&
parent.entities[mobsTargetingAlly]?.attack < 1500 &&
!parent.entities[mobsTargetingAlly]?.cooperative
)
use_skill("taunt", parent.entities[mobsTargetingAlly]);
if (
!target.target ||
(target.target !== character.name &&
target.attack < 1500 &&
!target.cooperative)
) {
use_skill("taunt", target);
}
}
if (
(!get_entity(HEALER) ||
get_entity(HEALER).rip ||
character.hp < 0.3 * character.max_hp) &&
Object.keys(parent.entities).filter(
(id) => parent.entities[id].target === character.name
).length > 2 &&
!is_on_cooldown("scare") &&
character.mp > 100
) {
await equipBatch({
orb: "jacko",
});
await use_skill("scare");
}
// if (
// character.mp > G.skills["cleave"].mp &&
// !is_on_cooldown("cleave") &&
// Object.keys(parent.entities).filter((id) =>
// is_in_range(parent.entities[id], "cleave")
// ).length > 4
// )
// use_skill("cleave");
//if (character.mp > G.skills['stomp'].mp && !is_on_cooldown("stomp"))
// use_skill('stomp')
}
if (!smartmoveDebug) {
hitAndRun(target, rangeRate);
angle =
angle +
flipRotation *
Math.asin(
(character.speed * loopInterval) /
1000 /
2 /
(character.range * rangeRate)
) *
2;
} else {
angle = undefined;
}
if (
target &&
target.range <= character.range &&
target.speed > character.speed
) {
rangeRate = target.speed / character.speed;
} else rangeRate = 1;
}
setInterval(function () {
loot();
buff();
if (character.rip) {
respawn();
return;
}
if (smart.moving && !smartmoveDebug) return;
let target = getTarget();
//// BOSSES
if (goToBoss()) return;
//// EVENTS
target = changeToDailyEventTargets();
//// Logic to targets and farm places
if (!smart.moving && !target)
smart_move({
map,
x: mapX,
y: mapY,
}).catch((e) => use_skill("use_town"));
fight(target);
}, loopInterval);