summaryrefslogtreecommitdiff
path: root/npc/031-3_Cave/cindyCave.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/031-3_Cave/cindyCave.txt')
-rw-r--r--npc/031-3_Cave/cindyCave.txt95
1 files changed, 92 insertions, 3 deletions
diff --git a/npc/031-3_Cave/cindyCave.txt b/npc/031-3_Cave/cindyCave.txt
index 738868d6..77046422 100644
--- a/npc/031-3_Cave/cindyCave.txt
+++ b/npc/031-3_Cave/cindyCave.txt
@@ -7,6 +7,8 @@
//TODO: picture
031-3.gat,122,51,0 script Cindy 114, {
+ if ($@FIGHT_YETI_STATUS != 0) goto L_Yeti;
+
set @KEYS_AMOUNT, 10;
set @Q_Nivalis_state_MASK, NIBBLE_5_MASK;
@@ -52,12 +54,33 @@ L_Try_Cage:
mes "You get an uncomfortable feeling and Cindy starts to shiver.";
next;
mes "\"Oh no, the Yetis...\"";
+ if ($@FIGHT_YETI_STATUS != 0) goto L_Yeti;
+
+ // initialize fight
+ set $@FIGHT_YETI_STATUS, 1;
+ set $@FIGHT_YETI_WAVE, 1;
+ set $@FIGHT_YETI_PLAYER_COUNT, getareausers("031-3.gat", 80, 20, 160, 90);
+
+ startnpctimer;
+ goto L_Exit;
+
+//TODO: remove
//TODO: start the battle and set state2 in case of success
mes "DEBUG: ADD YETIFIGHT HERE, QUEST VARIABLE INCREASED";
set @rescue_Cindy, 2;
callsub S_Update_Mask;
close;
-
+
+//TODO: why close and end?
+L_Exit:
+ close;
+ end;
+
+L_Yeti:
+ mes "[Cindy]";
+ mes "\"Watch out, the Yetis!\"";
+ close;
+
L_Reward:
mes "[Cindy]";
mes "\"You are a hero! All this strong monsters!\"";
@@ -70,8 +93,8 @@ L_Reward:
set @reward, rand(1);
if (@reward == 1) goto L_Wizard_Hat;
//TODO: set right, when quarterstaff is in item_db
- //getitem "QuarterStaff", 1;
- mes "DEBUG: GET ACORN INSTEAD OF QUARTERSTAFF";
+ //getitem "WoodenStaff", 1;
+ mes "DEBUG: GET ACORN INSTEAD OF WOODENSTAFF";
getitem "acorn", 1;
goto L_Visit;
@@ -102,6 +125,72 @@ L_Full_Inv:
mes "\"Oh, it seems you carry so much stuff - I will keep it for you until you can take it.\"";
close;
+// Fight logic
+OnTimer5000:
+ setnpctimer 0;
+ if ($@FIGHT_YETI_STATUS != 0) goto L_CaveLogic;
+L_Return_1:
+ set $@FIGHT_YETI_PLAYER_COUNT, 0;
+ areatimer "031-3.gat", 80, 20, 160, 90, 10, "Cindy::onTick";
+ end;
+
+L_CaveLogic:
+ set $@FIGHT_YETI_ROUND_PEN, $@FIGHT_YETI_PLAYER_COUNT;
+ if ($@FIGHT_YETI_ROUND_PEN > 60) set $@FIGHT_YETI_ROUND_PEN, 60;
+ if ($@FIGHT_YETI_PLAYER_COUNT <= 0) goto L_CleanUp;
+ set $@FIGHT_YETI_ROUND_TIMER, $@FIGHT_YETI_ROUND_TIMER + 5; // Advance 5 seconds
+ if (mobcount("031-3.gat", "Cindy::onPetDeath") <= 0) goto L_NextWave;
+ if ($@FIGHT_YETI_ROUND_TIMER + $@FIGHT_YETI_ROUND_PEN >= 120) goto L_NextWave;
+ goto L_Return_1;
+
+L_NextWave:
+ set $@FIGHT_YETI_ROUND_TIMER, 0;
+
+ set $@FIGHT_YETI_WAVE, $@FIGHT_YETI_WAVE + 1;
+ if ($@FIGHT_YETI_WAVE >= 10) goto L_CleanUp;
+//TODO: adjust number of yetis spawned
+ set $@FIGHT_YETI_NUMBER, $@FIGHT_YETI_WAVE + $@FIGHT_YETI_WAVE * $@FIGHT_YETI_PLAYER_COUNT/30;
+
+ set $@YETI_SUMMON, 0;
+
+ areamonster "031-3.gat", 80, 20, 160, 90, "", 1072, $@FIGHT_YETI_NUMBER, "Cindy::onPetDeath";
+ goto L_Return_1;
+
+// Called on each player once every 5 seconds
+onTick:
+ if (isdead(0)) end;
+ set $@FIGHT_YETI_PLAYER_COUNT, $@FIGHT_YETI_PLAYER_COUNT + 1;
+ end;
+
+onPetDeath:
+ end;
+
+onInit:
+ initnpctimer;
+ stopnpctimer;
+L_CleanUp:
+ areatimer "031-3.gat", 80, 20, 160, 90, 10, "Cindy::onReward";
+ set $@FIGHT_YETI_STATUS, 0;
+ set $@FIGHT_YETI_PLAYER_COUNT, 0;
+ set $@FIGHT_YETI_WAVE, 1;
+ set $@FIGHT_YETI_ROUND_TIMER, 0;
+ killmonster "031-3.gat", "Cindy::onPetDeath";
+ stopnpctimer;
+ setnpctimer 0;
+ end;
+
+onReward:
+ if (isdead(0)) end;
+//TODO: determine, if and how many boss points should be added
+ set BOSS_POINTS, BOSS_POINTS + 100;
+//TODO: check, if two messages for the player works
+ message strcharinfo(0), "You gain 100 Boss Points giving you a total of " + BOSS_POINTS;
+ set @rescue_Cindy, 2;
+ callsub S_Update_Mask;
+ message strcharinfo(0), "Cindy looks relieved and as if she wants to talk with you.";
+ end;
+
+/////////
S_Update_Mask:
set QUEST_Nivalis_state,
(QUEST_Nivalis_state & ~(@Q_Nivalis_state_MASK))