summaryrefslogtreecommitdiff
path: root/npc/029-3_Fight_Cave/parua.txt
blob: ef99b3b3307903273f79616ec8023ec2127dbd3a (plain) (blame)
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
// Parua's fight

029-3.gat,50,25,0	script	Parua	183,{
	if ($@FIGHT_CAVE_STATUS != 0) goto L_Enjoy;
	mes "[Parua]";
	mes "\"Hello.\"";
	next;
	mes "[Parua]";
	mes "\"Do you dare challenge the power that sleeps here?\"";
	menu "No, I'll let it sleep.", L_Exit,
	     "Ha! What's the worst it could do?", -;
	mes "[Parua]";
	mes "\"Very well, for a fee of 20,000 GP, I will awaken that power.\"";
	menu "No, what a ripoff!", L_Exit,
	     "Fine, here you go.", -;

	if (zeny < 20000) goto L_NotEnough;
	if ($@FIGHT_CAVE_STATUS != 0) goto L_AlreadyStarted;
	if (getareausers("029-3.gat", 20, 20, 70, 60) < 5) goto L_NotEnoughPlayers;

	set zeny, zeny - 20000;
	npctalk "Let the battle begin!";
	set $@FIGHT_CAVE_STATUS, 1;
	set $@FIGHT_CAVE_LEVEL, 1;
	set $@FIGHT_CAVE_PLAYER_COUNT, getareausers("029-3.gat", 20, 20, 70, 60);

	set $@FIGHT_CAVE_LAST, 0;

	startnpctimer;
	goto L_Exit;

L_Enjoy:
	mes "[Parua]";
	mes "\"Enjoy the fight!\"";
	goto L_Exit;

L_NotEnough:
	mes "[Parua]";
	mes "\"Seems you can't meet my fee.\"";
	goto L_Exit;

L_AlreadyStarted:
	mes "[Parua]";
	mes "\"Seems your friend already paid me.\"";
	goto L_Exit;

L_NotEnoughPlayers:
	mes "[Parua]";
	mes "\"Maybe you should bring some friends with you; this will get messy.\"";
	mes "He takes a moment to calculate. \"You'll probably need at least...five people, including yourself.\"";
	goto L_Exit;

L_Exit:
	close;
	end;

// Fight logic
OnTimer5000:
	setnpctimer 0;
	if ($@FIGHT_CAVE_STATUS != 0) goto L_CaveLogic;
L_Return_1:
	set $@FIGHT_CAVE_PLAYER_COUNT, 0;
	areatimer "029-3.gat", 20, 20, 70, 60, 10, "Parua::onTick";
	end;

L_CaveLogic:
	set $@FIGHT_CAVE_ROUND_PEN, $@FIGHT_CAVE_PLAYER_COUNT;
	if ($@FIGHT_CAVE_ROUND_PEN > 60) set $@FIGHT_CAVE_ROUND_PEN, 60;
	if ($@FIGHT_CAVE_PLAYER_COUNT <= 0) goto L_CleanUp;
	set $@FIGHT_CAVE_ROUND_TIMER, $@FIGHT_CAVE_ROUND_TIMER + 5; // Advance 5 seconds
	if (mobcount("029-3.gat", "Parua::onPetDeath") <= 0) goto L_NextRound;
	if ($@FIGHT_CAVE_ROUND_TIMER + $@FIGHT_CAVE_ROUND_PEN >= 120) goto L_NextRound;
	goto L_Return_1;

L_NextRound:
	set $@FIGHT_CAVE_ROUND_TIMER, 0;

	set $@FIGHT_CAVE_TEMP_UP, ($@FIGHT_CAVE_LEVEL / 10);
	if ($@FIGHT_CAVE_TEMP_UP > 100) set $@FIGHT_CAVE_TEMP_UP, 100;

	set $@FIGHT_CAVE_LEVEL, $@FIGHT_CAVE_LEVEL + $@FIGHT_CAVE_PLAYER_COUNT + $@FIGHT_CAVE_TEMP_UP;
	if ($@FIGHT_CAVE_LEVEL >= 2200) goto L_CleanUp;
	set $@FIGHT_CAVE_POINTS, $@FIGHT_CAVE_LEVEL;

	if ($@FIGHT_CAVE_LAST + 30  < $@FIGHT_CAVE_LEVEL) goto L_Announce;
L_Return_2:
       mapannounce "029-3.gat", "Parua: The next round (level " + $@FIGHT_CAVE_LEVEL + ") is starting with " + $@FIGHT_CAVE_PLAYER_COUNT + " player(s) left alive." , 0;

	set $@MOB_1_SUMMON, 0;
	set $@MOB_2_SUMMON, 0;
	set $@MOB_3_SUMMON, 0;
	set $@MOB_4_SUMMON, 0;
	set $@MOB_5_SUMMON, 0;
	set $@MOB_6_SUMMON, 0;
L_Summon:
	if ($@FIGHT_CAVE_POINTS >= 243 && $@MOB_1_SUMMON < 2) goto L_MOB1;
	if ($@FIGHT_CAVE_POINTS >= 81 && $@MOB_2_SUMMON < 6) goto L_MOB2;
	if ($@FIGHT_CAVE_POINTS >= 27 && $@MOB_3_SUMMON < 5) goto L_MOB3;
	if ($@FIGHT_CAVE_POINTS >= 9 && $@MOB_4_SUMMON < 7) goto L_MOB4;
	if ($@FIGHT_CAVE_POINTS >= 3 && $@MOB_5_SUMMON < 10) goto L_MOB5;
	if ($@FIGHT_CAVE_POINTS >= 1 && $@MOB_6_SUMMON < 12) goto L_MOB6;
	goto L_Return_1;

L_Announce:
	mapannounce "029-1.gat", "Parua: The next round (level " + $@FIGHT_CAVE_LEVEL + ") is starting with " + $@FIGHT_CAVE_PLAYER_COUNT + " player(s) left alive." , 0;
	set $@FIGHT_CAVE_LAST, $@FIGHT_CAVE_LAST + 30;
	goto L_Return_2;

L_MOB1:
	set $@MOB_1_SUMMON, $@MOB_1_SUMMON + 1;
	set $@FIGHT_CAVE_POINTS, $@FIGHT_CAVE_POINTS - 243;
	areamonster "029-3.gat", 20, 20, 70, 60, "", 1022, 1, "Parua::onPetDeath";
	goto L_Summon;

L_MOB2:
	set $@MOB_2_SUMMON, $@MOB_2_SUMMON + 1;
	set $@FIGHT_CAVE_POINTS, $@FIGHT_CAVE_POINTS - 81;
	areamonster "029-3.gat", 20, 20, 70, 60, "", 1045, 1, "Parua::onPetDeath";
	goto L_Summon;

L_MOB3:
	set $@MOB_3_SUMMON, $@MOB_3_SUMMON + 1;
	set $@FIGHT_CAVE_POINTS, $@FIGHT_CAVE_POINTS - 27;
	areamonster "029-3.gat", 20, 20, 70, 60, "", 1024, 1, "Parua::onPetDeath";
	goto L_Summon;

L_MOB4:
	set $@MOB_4_SUMMON, $@MOB_4_SUMMON + 1;
	set $@FIGHT_CAVE_POINTS, $@FIGHT_CAVE_POINTS - 9;
	areamonster "029-3.gat", 20, 20, 70, 60, "", 1043, 1, "Parua::onPetDeath";
	goto L_Summon;

L_MOB5:
	set $@MOB_5_SUMMON, $@MOB_5_SUMMON + 1;
	set $@FIGHT_CAVE_POINTS, $@FIGHT_CAVE_POINTS - 3;
	areamonster "029-3.gat", 20, 20, 70, 60, "", 1010, 1, "Parua::onPetDeath";
	goto L_Summon;

L_MOB6:
	set $@MOB_6_SUMMON, $@MOB_6_SUMMON + 1;
	set $@FIGHT_CAVE_POINTS, $@FIGHT_CAVE_POINTS - 1;
	areamonster "029-3.gat", 20, 20, 70, 60, "", 1008, 1, "Parua::onPetDeath";
	goto L_Summon;

// Called on each player once every 5 seconds
onTick:
	if (isdead(0)) end;
	set $@FIGHT_CAVE_PLAYER_COUNT, $@FIGHT_CAVE_PLAYER_COUNT + 1;
	end;

onPetDeath:
	end;

onInit:
	initnpctimer;
	stopnpctimer;
L_CleanUp:
	npctalk "Game Over";
	mapannounce "029-1.gat", "Parua: The dungeon is now ready for its next victims.", 0;
	areatimer "029-3.gat", 20, 20, 70, 60, 10, "Parua::onReward";
	set $@FIGHT_CAVE_STATUS, 0;
	set $@FIGHT_CAVE_PLAYER_COUNT, 0;
	set $@FIGHT_CAVE_LEVEL, 1;
	set $@FIGHT_CAVE_ROUND_TIMER, 0;
	killmonster "029-3.gat", "Parua::onPetDeath";
	stopnpctimer;
	setnpctimer 0;
	end;

onReward:
	if (isdead(0)) end;
	set BOSS_POINTS, BOSS_POINTS + 100;
	message strcharinfo(0), "You gain 100 Boss Points giving you a total of " + BOSS_POINTS;
	end;

}