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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
|
// TMW2 Script
// Author:
// Jesusalva
// Mapflags (FIXME: Disable splash... Or weapons and magic in general)
006-8 mapflag zone MMO No Revive
006-8 mapflag battleground
006-8,44,68,0 script #OutOf0068 NPC_HIDDEN,0,0,{
end;
OnTouch:
if (!$@CAPTURE_FLAG)
warp "006-6", 47, 34;
end;
}
006-8,38,58,0 script #Abort0068A NPC_HIDDEN,0,1,{
end;
OnTouch:
if (!$@CAPTURE_FLAG) {
slide 40, 64;
bg_leave();
}
end;
}
006-8,51,58,0 script #Abort0068B NPC_HIDDEN,0,1,{
end;
OnTouch:
if (!$@CAPTURE_FLAG) {
slide 49, 64;
bg_leave();
}
end;
}
006-8,40,62,0 script #Signin0068A NPC_HIDDEN,1,0,{
end;
OnTouch:
if ($@CAPTURE_INSC && CAPTURE_FLAG >= 0)
bgjoin($@CAPTURE_T1, "006-8", 37, 58);
end;
}
006-8,48,62,0 script #Signin0068B NPC_HIDDEN,1,0,{
end;
OnTouch:
if ($@CAPTURE_INSC && CAPTURE_FLAG >= 0)
bgjoin($@CAPTURE_T2, "006-8", 52, 58);
end;
}
006-8,45,65,0 script Kage NPC_CRUSADER,{
function getmobid;
if ($@CAPTURE_FLAG) {
npctalk l("A game is currently going on, please wait for it to finish.");
end;
}
mesn;
mesq l("This a simple game; Choose one of the shrines - west or east. The one at west is %s, the one at east is %s.", b(l("Magenta")), b(l("Yellow")));
next;
mesn;
mesq l("You can enter when clock ticks :15, and the game begin when the clock ticks :25 if anyone is around. This is to match with Call of Dusty event.");
next;
mesn;
mesq l("Once it begins (you can fight against an AI), kill the most of enemy sparks you can, while preventing your own sparks of being killed. Wins whoever has more sparks after %s minutes.", l(b("five")));
next;
mesn;
mesq l("Keep in mind this is a PvP area - So try to avoid being butchered, because revival spells are disabled here! Hahaha!");
next;
mesn;
mesq l("Oh, and if I perchance catch you using %s or %s... You'll be banned from my game, understood?", b(l("splash weapons")), b(l("splash magic")));
mesc l("-- In such event, Candor Underground B4F will be permanently unreachable for this char."), 1;
close;
OnForfeit1:
.@s=true;
OnForfeit2:
bg_leave();
mapannounce "006-8", sprintf("%s (%s side) is down!", strcharinfo(0), (.@s ? b("Magenta") : b("Yellow"))), 0;
end;
OnSpark1:
.sp1 += 1; end;
OnSpark2:
.sp2 += 1; end;
end;
OnSkip:
end;
OnFinish:
if (getcharid(4) == .win) {
Zeny+=670;
Mobpt+=500;
dispbottom l("You earned %s Monster Points for winning.", fnum(500));
CAPTURE_FLAG += 1;
switch (CAPTURE_FLAG % 11) {
case 1: getitem MercBoxA, 1;
case 2: getitem any(Aquada, Piberries, Cheese, Bread), 1;
case 3: getitem any(Coffee, ChamomileTea, MysteriousBottle), 1;
case 4: getitem any(Aquada, Piberries, Cheese, Bread), 1;
case 5: getitem any(ReturnPotion, TreasureMap), 1;
case 6: getitem any(Aquada, Piberries, Cheese, Bread), 1;
case 7: getitem any(SmokeGrenade, DodgePotion), 1;
case 8: getitem any(Aquada, Piberries, Cheese, Bread), 1;
case 9: getitem any(ScrollSCave, InsuranceContract, Insurance), 1;
case 10: getitem any(Aquada, Piberries, Cheese, Bread), 1;
default: getitem any(IcedBottle, PurificationPotion, ScrollSMaggot), 1;
}
}
bg_leave();
warp "006-8", 44, 66;
end;
OnInit:
.distance=4;
.sp1 = 0; // Sparks killed by Team 1
.sp2 = 0; // Sparks killed by Team 2
.win = -2; // Last match winner
$@CAPTURE_FLAG = false;
$@CAPTURE_INSC = false;
$@CAPTURE_T1 = bgnew("006-8", 34, 28, "Kage::OnForfeit1", "Kage::OnForfeit1");
$@CAPTURE_T2 = bgnew("006-8", 55, 28, "Kage::OnForfeit2", "Kage::OnForfeit2");
end;
function getmobid {
.@lv = getarg(0);
if (.@lv <= 5)
return HouseMaggot;
else if (.@lv <= 11)
return AngryScorpion;
else if (.@lv <= 15)
return CaveMaggot;
else if (.@lv <= 20)
return AngryBat;
else if (.@lv <= 26)
return Bandit;
else if (.@lv <= 30)
return Bluepar;
else if (.@lv <= 35)
return RobinBandit;
else if (.@lv <= 40)
return Snake;
else if (.@lv <= 46)
return Wolvern;
else if (.@lv <= 52)
return HoodedNinja;
else if (.@lv <= 60)
return FrostiaGuard;
else if (.@lv <= 65)
return Scar;
else if (.@lv <= 75)
return Forain;
else if (.@lv <= 80)
return Terranite;
else if (.@lv <= 85)
return GoboBear;
else if (.@lv <= 90)
return TerraniteProtector;
else if (.@lv <= 100)
return Reaper;
else if (.@lv <= 107)
return Snail;
else if (.@lv <= 115)
return Mandragora;
else if (.@lv <= 120)
return PinkieMaximus;
else if (.@lv <= 125)
return Junglefowl;
else if (.@lv <= 130)
return Tengu;
else if (.@lv <= 135)
return SuperiorShroom;
else if (.@lv <= 140)
return Nutcracker;
else if (.@lv <= 150)
return Golem;
else if (.@lv <= 160)
return EarthElement;
else if (.@lv <= 175)
return EpiphanyWisp;
// If all else fails, pick the strongest aggro mob
return EpiphanyWisp;
}
OnMinute15:
$@CAPTURE_INSC = true;
mapannounce "006-8", "Kage : Inscriptions are open! The event will begin in ##B10 minutes!##b", 0;
end;
OnMinute24:
mapannounce "006-8", "Kage : Inscriptions are about to close! The event will begin in ##B1 minute!##b", 0;
end;
OnMinute25:
$@CAPTURE_INSC = false;
$@CAPTURE_FLAG = true;
/* Prepare the teams */
setbgteam $@CAPTURE_T1, 1;
setbgteam $@CAPTURE_T2, 2;
/* Validate difficulty */
.@t1p = bg_get_data($@CAPTURE_T1, 0);
.@t2p = bg_get_data($@CAPTURE_T2, 0);
.@t1lv = 0; .@t2lv = 0;
/* Optional Reinforcements when unbalanced */
freeloop(true);
.@c=getunits(BL_PC, .@pcs, MAX_CYCLE_PC, "006-8", 30, 20, 60, 60);
for (.@i = 0; .@i < .@c; .@i++) {
.@id = .@pcs[.@i];
.@n$ = strcharinfo(0, "", .@id);
.@bg = getcharid(4, .@n$);
if (.@bg < 1) { consolewarn("Invalid bg for %s (%d): %d",.@m$, .@id, .@bg); continue; } // TODO: Get rid of them
if (.@bg == $@CAPTURE_T1)
.@t1lv += readparam(BaseLevel, .@id);
else if (.@bg == $@CAPTURE_T2)
.@t2lv += readparam(BaseLevel, .@id);
else
consolebug("BG %d is not valid (%d, %d)", .@bg, $@CAPTURE_T1, $@CAPTURE_T2);
}
// Calc. averages
if (.@t1p)
.@t1a = .@t1lv / .@t1p;
if (.@t2p)
.@t2a = .@t2lv / .@t2p;
/* Spawn guards as needed... */
// Normalize player count
while (.@t1p < .@t2p) {
.@t1p += 1;
bg_monster($@CAPTURE_T1, "006-8", 32, rand2(24, 32), "Magenta Ally", getmobid(.@t1a), "Kage::OnSkip");
}
while (.@t2p < .@t1p) {
.@t2p += 1;
bg_monster($@CAPTURE_T2, "006-8", 53, rand2(24, 32), "Yellow Ally", getmobid(.@t2a), "Kage::OnSkip");
}
// Apply a buff on the teams, based on level difference
.@c=getunits(BL_PC, .@pcs, MAX_CYCLE_PC, "006-8", 30, 20, 60, 60);
.@t1b = .@t2a - .@t1a; // Team 1 Boost
.@t2b = .@t1a - .@t2a; // Team 2 Boost
for (.@i = 0; .@i < .@c; .@i++) {
.@id = .@pcs[.@i];
.@n$ = strcharinfo(0, "", .@id);
.@bg = getcharid(4, .@n$);
if (.@bg == $@CAPTURE_T1 && .@t1b > 0) {
sc_start SC_INCMHP, 300000, .@t1b * 1000, 10000, SCFLAG_NOAVOID, .@id;
sc_start SC_INCATKRATE, 300000, .@t1b, 10000, SCFLAG_NOAVOID, .@id;
sc_start SC_INCHITRATE, 300000, .@t1b, 10000, SCFLAG_NOAVOID, .@id;
sc_start SC_INCFLEERATE, 300000, .@t1b, 10000, SCFLAG_NOAVOID, .@id;
} else if (.@bg == $@CAPTURE_T2 && .@t2b > 0) {
sc_start SC_INCMHP, 300000, .@t2b * 1000, 10000, SCFLAG_NOAVOID, .@id;
sc_start SC_INCATKRATE, 300000, .@t2b, 10000, SCFLAG_NOAVOID, .@id;
sc_start SC_INCHITRATE, 300000, .@t2b, 10000, SCFLAG_NOAVOID, .@id;
sc_start SC_INCFLEERATE, 300000, .@t2b, 10000, SCFLAG_NOAVOID, .@id;
}
}
freeloop(false);
// FALLTHROUGH
OnMinute26:
OnMinute27:
OnMinute28:
OnMinute29:
/* New wave of sparks */
.@am = 7 + getmapusers("006-8");
freeloop(true);
for (.@i=0; .@i < .@am; .@i++) {
bg_monster($@CAPTURE_T1, "006-8", rand2(31, 44), rand2(21, 35), "Magenta Spark", MagentaSpark, "Kage::OnSpark1");
bg_monster($@CAPTURE_T2, "006-8", rand2(45, 58), rand2(21, 35), "Yellow Spark", YellowSpark, "Kage::OnSpark2");
}
freeloop(false);
end;
OnMinute30:
/* Finish the duel! */
killmonsterall("006-8");
if (.sp2 > .sp1) {
// More spark 2 killed than spark 1
mapannounce "006-8", "Kage : ##BMagenta Team##b is the victor!", 0;
.win = $@CAPTURE_T1;
} else if (.sp1 > .sp2) {
mapannounce "006-8", "Kage : ##BYellow Team##b is the victor!", 0;
.win = $@CAPTURE_T2;
} else {
mapannounce "006-8", "Kage : ##BDraw##b! No one has won!", 0;
.win = -2;
}
// Assign rewards
maptimer("006-8", 10, "Kage::OnFinish");
/* Cleanup */
$@CAPTURE_FLAG = false;
.sp1 = 0;
.sp2 = 0;
end;
}
|