From 80af8d18caeae5f4d8323ff61c15201497cfecd8 Mon Sep 17 00:00:00 2001
From: Jesusaves <cpntb1@ymail.com>
Date: Tue, 5 Jun 2018 19:48:09 -0300
Subject: Make Crazyfefe's Cave infinite. Cheat with dead body results in BAN.

---
 npc/006-1/crazyfefe.txt | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

(limited to 'npc')

diff --git a/npc/006-1/crazyfefe.txt b/npc/006-1/crazyfefe.txt
index 2bace4757..dd43bc155 100644
--- a/npc/006-1/crazyfefe.txt
+++ b/npc/006-1/crazyfefe.txt
@@ -132,11 +132,11 @@ L_CaveLogic:
     if (mobcount("006-1", "Crazyfefe::OnPetDeath") <= 0)
         goto L_NextRound;
 
-    // Victory conditions: Either you've reached a maximum level (1800) or too few players alive.
-    // Number of alive players is randomly proccessed, so the round may end anytime.
-    // IIRC, dead players still in cave are still counted. TODO, this is a bad place to handle this.
+    // Victory conditions: Too few players are alive.
+    // WARNING, of dead players still in cave are counted, we might never finish the fight.
+    // And a GM might be called to ban everyone inside.
     // To enable debug, comment last part of victory condition.
-    if ($@FIGHT_CAVE_LEVEL >= 1800 || $@FIGHT_CAVE_PLAYER_COUNT <= rand(1,2))
+    if ($@FIGHT_CAVE_PLAYER_COUNT <= rand(1,2))
         goto L_CleanUp;
 
     // reset timer
@@ -144,15 +144,16 @@ L_CaveLogic:
     end;
 
 L_NextRound:
-    // Prepare next round
+    // Prepare next round, and reward survivors
     $@FIGHT_CAVE_LEVEL = $@FIGHT_CAVE_LEVEL + $@FIGHT_CAVE_PLAYER_COUNT + rand(1,3);
+    areatimer 0, "006-1", 20, 20, 70, 60, 10, "Crazyfefe::OnReward";
 
     mapannounce "006-1", "The next round is starting with " + $@FIGHT_CAVE_PLAYER_COUNT + " player(s) left alive." , 0;
     goto L_Summon;
 
 // TODO
 L_Summon:
-    .@amount=($@FIGHT_CAVE_LEVEL/rand(4,6)); // 300~450 mobs on last round >.< Uh oh, this is hard indeed! xD
+    .@amount=($@FIGHT_CAVE_LEVEL/rand(4,6));
 	for (.@i = 0; .@i < .@amount; ++.@i) {
         .@mid=rand(1,15);
         .@monsterId=Piou;
@@ -213,14 +214,14 @@ L_CleanUp:
 
 
 
-// Rewards surviving players, according to performance
+// Rewards surviving players between rounds, according to performance
 OnReward:
     if (ispcdead())
         end;
-    // TODO: Find a good reward according to level
-    Zeny=Zeny+($@FIGHT_CAVE_LEVEL);
-    getexp $@FIGHT_CAVE_LEVEL, 0;
-    dispbottom l("You've gained @@ GP and EXP", ($@FIGHT_CAVE_LEVEL));
+    // Player reward is a random number from 1~3 + lvl/50 (1 point ~= 12~8 mobs)
+    .@prize=rand(1,3) + ($@FIGHT_CAVE_LEVEL/50);
+    Zeny=Zeny+.@prize;
+    getexp .@prize, rand(1,3);
     end;
 
 // Every 5 seconds, handle cave, if fighting. Does nothing when waiting.
-- 
cgit v1.2.3-70-g09d2