summaryrefslogtreecommitdiff
path: root/npc/026-4
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2023-10-08 12:57:44 -0300
committerJesusaves <cpntb1@ymail.com>2023-10-08 12:57:44 -0300
commit74eb2260127dc01d86d5f02bf872fb84b9ca9f3e (patch)
tree47248d18e89e94d285c5388ae21e2f34d7666b7a /npc/026-4
parentc104b26dc5196f2848af31008f5cba581cf58959 (diff)
downloadserverdata-74eb2260127dc01d86d5f02bf872fb84b9ca9f3e.tar.gz
serverdata-74eb2260127dc01d86d5f02bf872fb84b9ca9f3e.tar.bz2
serverdata-74eb2260127dc01d86d5f02bf872fb84b9ca9f3e.tar.xz
serverdata-74eb2260127dc01d86d5f02bf872fb84b9ca9f3e.zip
Add the Bloody Switches (main controller/exit still missing)
Diffstat (limited to 'npc/026-4')
-rw-r--r--npc/026-4/ctrl.c103
1 files changed, 95 insertions, 8 deletions
diff --git a/npc/026-4/ctrl.c b/npc/026-4/ctrl.c
index bd93eecbf..c22ee7fc2 100644
--- a/npc/026-4/ctrl.c
+++ b/npc/026-4/ctrl.c
@@ -8,26 +8,113 @@
// This script must set 026-4 up on init, and refresh it when needed
- script Impregnable#B4F NPC_HIDDEN,{
- end;
-
-// On Tuesday, the map changes
-//OnTue0000:
-OnMon2359:
- // Reload .InstId
- killmonsterall("026-4");
- MazeMobs(145, false, 8, "026-4"); // Initiate Lv 145 mobs
+ function _moveNpc;
end;
// Initialize the dungeon
OnInit:
+ .InstId = false;
+ .npc_x = 0;
+ .npc_y = 0;
+ // The 19 mobs which compose the Bloody List
+ setarray $@MKB4F_MOBS, NightmareDragon, Snail, WhirlyBird, PinkieSuseran, Jhon, Mandragora, PinkieMaximus, Junglefowl, Tengu, Moubi, SuperiorShroom, Nutcracker, Golem, GreenhornAbomination, ShadowTortuga, FireElement, WaterElement, EarthElement, WindElement;
sleep(6000); // Delay 6s before initialization
.InstId = CreateMaze(IOT_NONE, MAZE_SIZE_X, "026-4");
instance_set_timeout(0, 0, .InstId);
instance_init(.InstId);
debugmes "Impregnable Fortress B4F (%d): Init OK", .InstId;
+ setmapflag("026-4", mf_zone, "SuperMMO");
+ goto OnMon2359;
+
+OnMon2359:
+ if (!.InstId) end;
+ // Reload .InstId (weekly takeover)
+ killmonsterall("026-4");
MazeMobs(145, false, 8, "026-4"); // Initiate Lv 145 mobs
+ MazeMobs(115, false, 21, "026-4"); // Initiate Lv 115 mobs
// TODO: Add the utilities: Switches (and move them every day?) and mobpt logic
// And the actual portal (NPC?)
+ goto OnClock1843;
+
+OnClock1843:
+ if (!.InstId) end;
+ // Movement will need to happen here (daily modifications)
+ // We need however to validate the coordinates they're jumping to...
+ _moveNpc("026-4");
+ unitwarp(getnpcid("#026-4Switch_1"), "026-4", .npc_x, .npc_y);
+ _moveNpc("026-4");
+ unitwarp(getnpcid("#026-4Switch_2"), "026-4", .npc_x, .npc_y);
+ _moveNpc("026-4");
+ unitwarp(getnpcid("#026-4Switch_3"), "026-4", .npc_x, .npc_y);
+ _moveNpc("026-4");
+ unitwarp(getnpcid("#026-4Switch_4"), "026-4", .npc_x, .npc_y);
+ _moveNpc("026-4");
+ unitwarp(getnpcid("#026-4Switch_5"), "026-4", .npc_x, .npc_y);
+ end;
+
+function _moveNpc {
+ // Try to warp randomly, up to 30 attempts
+ .@e=0;
+ .@mx=getmapinfo(MAPINFO_SIZE_X, getarg(0))-20;
+ .@my=getmapinfo(MAPINFO_SIZE_Y, getarg(0))-20;
+ do {
+ if (.@e >= 30)
+ break;
+ .npc_x = rand2(20, .@mx);
+ .npc_y = rand2(20, .@my);
+ .@e+=1;
+ } while (!checknpccell(getarg(0), .npc_x, .npc_y, cell_chkpass));
+ return;
+} // _moveNpc
+
+}
+
+// The switches main code
+000-0,0,0,0, script #026-4Switch_1 NPC_SWITCH_OFFLINE,{
+ // Retrieve my own metadata
+ .@n$=strnpcinfo(0, "_0");
+ explode(.@ni$, .@n$, "_");
+ .@id=atoi(.@ni$[1]);
+ .@bit = (2 ** (.@id - 1));
+ // Do not react if already done
+ if (getq(General_Fortress) != 5)
+ end;
+ // If already flipped, then don't do pointless things
+ if (getq2(General_Fortress) & .@bit) {
+ dispbottom l("I already flipped this switch, no point flipping it again.");
+ end;
+ }
+ // After used by someone, can't be used by others for ~30 seconds
+ if (getnpcclass() == NPC_SWITCH_ONLINE)
+ end;
+ // The Bloody Switch: Assign random monster (Miller + char ID + Switch ID)
+ // Maze mobs should count (and qualify for mob points)
+ // All target mobs should be Lv 100+
+ .@minKills = 10;
+ .@mobId = $@MKB4F_MOBS[miller_rand(.@id, getcharid(0), 18)];
+ mesn l("The Bloody Switch");
+ mes l("Our master respects %s, so those whom wish to meet him, the following shall they prove:", b(l("strength")));
+ mesc l("Kill %d/%d %s in this session.", @bloodykill[.@mobId], .@minKills, getmonsterlink(.@mobId)), 1;
+ if (@bloodykill[.@mobId] < .@minKills)
+ close;
+ next;
+ // Mark this switch as done
+ setq2 General_Fortress, getq2(General_Fortress) | .@bit;
+ dispbottom l("You hear a *clank*, it must have worked.");
+ closeclientdialog;
+ setnpcdisplay .name$, NPC_SWITCH_ONLINE;
+ sleep(30000); // Detach the player (instead of sleep2)
+ setnpcdisplay .name$, NPC_SWITCH_OFFLINE;
+ end;
+OnInit:
+ .distance=3;
end;
}
+000-0,0,0,0 duplicate(#026-4Switch_1) #026-4Switch_2 NPC_SWITCH_OFFLINE
+000-0,0,0,0 duplicate(#026-4Switch_1) #026-4Switch_3 NPC_SWITCH_OFFLINE
+000-0,0,0,0 duplicate(#026-4Switch_1) #026-4Switch_4 NPC_SWITCH_OFFLINE
+000-0,0,0,0 duplicate(#026-4Switch_1) #026-4Switch_5 NPC_SWITCH_OFFLINE
+
+// TODO: The main NPC which lets you out of here
+