-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgeographer.pl
More file actions
72 lines (68 loc) · 1.88 KB
/
geographer.pl
File metadata and controls
72 lines (68 loc) · 1.88 KB
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
#------------------------------------------------------------
# Geographer plugin - OpenKore Team
#
# Prohibit attacking a geographer:
# + healed by another one
# + situated too close to another one
# Stop attacking monsters under above circumstances
# (prohibit to attack means setting up null damage from kore
# and 1 damage from player (from kore's id))
#------------------------------------------------------------
package geographer;
use strict;
use Globals;
use Log;
use Misc;
use Plugins;
use Utils;
Plugins::register("geographer", "Reaction on two close geographers", \&Unload);
my $hooks = Plugins::addHooks(
["AI_pre",\&positionReact, undef],
["packet/skill_cast", \&healReact, undef],
["packet/skill_used_no_damage", \&healReact, undef]);
sub positionReact {
foreach (@monstersID) {
my $monster = $monsters{$_};
if ($monster->{type} == 1368 && !$monster->{dmgFromPlayer}) {
foreach my $mobCopy (@monstersID) {
my $monsterCopy = $monsters{$mobCopy};
if ($monsterCopy->{type} == 1368) {
if ($monster->{ID} ne $monsterCopy->{ID}) {
if (distance($monster->{pos},$monsterCopy->{pos}) <= 10) {
prohibitAttacking($monster);
prohibitAttacking($monsterCopy);
last;
}
}
}
}
}
}
}
sub healReact {
# After cast, not before
my $monsterS = $monsters{@_[1]->{sourceID}};
my $monsterO = $monsters{@_[1]->{targetID}};
if(!$monsterO
|| @_[1]->{skillID} != 28
|| $monsterO->{type} != 1368) {
return;
}
prohibitAttacking($monsterO);
if ($monsterS->{type} == 1368) {
prohibitAttacking($monsterS);
}
}
sub prohibitAttacking {
undef @_[0]->{dmgFromYou};
undef @_[0]->{missedFromYou};
@_[0]->{dmgFromPlayer}{$char->{ID}} = 1;
if (AI::action eq "attack" && AI::args()->{ID} eq @_[0]->{ID}) {
AI::dequeue;
stopAttack();
}
}
sub Unload {
Plugins::delHooks($hooks);
}
1;