summaryrefslogtreecommitdiff
path: root/npc/034-3/gemini.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/034-3/gemini.txt')
-rw-r--r--npc/034-3/gemini.txt126
1 files changed, 124 insertions, 2 deletions
diff --git a/npc/034-3/gemini.txt b/npc/034-3/gemini.txt
index ffbc19205..f9e88fa10 100644
--- a/npc/034-3/gemini.txt
+++ b/npc/034-3/gemini.txt
@@ -71,14 +71,128 @@ OnChannel:
.@magic_power_loss = 53 - ((readparam2(bInt)+1)*2)/10;
dispbottom l("Ok, let's stay focused now!");
+ areamonster "052-1", 27, 20, 77, 47, strmobinfo(1, Forain), Forain, 1;
// TODO: Loop
+ debugmes "NPC: %s / %s (%d)", .name$, .extname$, instance_id();
+ .aid=getcharid(3);
+ .mp$=getmap();
+ .power=.@magic_power;
+ .state=0;
+ .maxpw=.@magic_power_required;
+ .mloss=.@magic_power_loss;
+ initnpctimer;
+ end;
+
+OnTimer13000:
+ initnpctimer; // Reset timer
+ // Time to spawn monsters
+ .@pc = getmapusers(.mp$);
+ areamonster "052-1", 56, 30, 60, 31, "Guardian", Scar, 1+.@pc;
+ areamonster "052-1", 27, 20, 77, 47, strmobinfo(1, Forain), Forain, 2;
+ // Terranites only show up when doing multiplayer, based on number of players
+ if (.@pc >= 2)
+ areamonster "052-1", 56, 30, 60, 31, "Guardian", Terranite, (.@pc/2);
+OnTimer10000:
+OnTimer8000:
+OnTimer6000:
+OnTimer4000:
+OnTimer2000:
+ if (instance_id() < 0) end;
+
+ if (!attachrid(.aid)) {
+ npctalk "The caster ceased to exist!";
+ end;
+ }
+
+ getmapxy(.@m$, .@x, .@y, 0, .aid);
+ if (.@m$ != .@mp$) {
+ npctalk "The caster is gone!";
+ end;
+ }
+ if (.@x < 52 ||
+ .@x > 54 ||
+ .@y < 37 ||
+ .@y > 38) {
+ npctalk "The caster left the power circle!";
+ dispbottom l("The magic accumulated backfires at you!");
+ heal -(.power), -(.power/2);
+ end;
+ }
+
+ // Harm you
+ //misceffect FX_CHANNELLING_RAISE;
+ percentheal -4, -1;
+
+ if (ispcdead()) {
+ npctalk "The caster is dead!";
+ end;
+ }
+ if (Sp <= 0) {
+ npctalk "The caster ran out of mana!";
+ end;
+ }
+
+ // Deplete power over time
+ // But only if not doing solo
+ if (getmapusers(.mp$) > 1)
+ .power -= .mloss;
+
+ // Remove stones inside the circle
+ .@cat=getareadropitem(.mp$, 52, 37, 54, 39, LazuriteShard, true) * 12;
+ .@cbt=getareadropitem(.mp$, 52, 37, 54, 39, LazuriteCrystal, true) * 32;
+ .@cct=getareadropitem(.mp$, 52, 37, 54, 39, LazuriteHeart, true) * 65;
+
+ // Grant them POWER
+ .power+=.@cat+.@cbt+.@cct;
+ .@cur = 4 * .power / .maxpw; // Goes from 0 to 4
+
+ // Check status and update
+ if (.@cur < .status)
+ npctalk "NOTICING a sudden power loss!";
+ else if (.@cur > .status)
+ npctalk "NOTICING an increase of power!";
+ .status=.@cur;
+
+ // Are we done?
+ if (.power >= .maxpw) {
+ npctalk "*the gate spell has been redefined*";
+ if (getcharid(1) > 0) {
+ $@VALIA_STATUS[getcharid(1)]=9;
+ stopnpctimer;
+ .power=0;
+ .mloss=0;
+ .maxpw=0;
+ .state=0;
+ .mp$="";
+ .aid=0;
+ }
+ end;
+ }
+ detachrid();
+ // Should we spawn items?
+ .@t = (getnpctimer(0)+500) / 1000;
+ // Item time!
+ if (.@t == 6 ||
+ .@t == 10) {
+ .@i = 0;
+ // More Shards than Crystals and Hearts
+ freeloop(true);
+ while (.@i < ((5-getmapusers(.mp$)) * 2 + 5)) {
+ .@it=any(LazuriteShard, LazuriteShard, LazuriteShard,
+ LazuriteCrystal, LazuriteCrystal,
+ LazuriteHeart);
+ makeitem(.@it, 1, .mp$, rand2(27, 77), rand2(20, 47));
+ .@i += 1;
+ }
+ freeloop(false);
+ }
end;
OnTalkNearby:
// not very obvious stuff by gumi
.@no_nick$ = strip(substr($@p0$, getstrlen(strcharinfo(PC_NAME)) + 3, getstrlen($@p0$) - 1));
.@message$ = strtoupper(.@no_nick$);
- if (.@message$ == "catalazuli") {
+ if (.@message$ == "CATALAZULI") {
goto OnChannel;
}
end;
@@ -86,7 +200,15 @@ OnTalkNearby:
OnInit:
.distance=3;
.pid=getnpcid();
- debugmes "Pattern %d", .pid;
+ // For players
+ .aid=0;
+ .mp$="";
+ .power=0;
+ .state=0;
+ .maxpw=0;
+ .mloss=0;
+
+ debugmes "Gemini Pattern %d", .pid;
//defpattern(.pid, "^([Kk][Aa][Tt][Aa][Zz][Uu][Ll][Ii])$", "OnTalkNearby");
defpattern(.pid, "^(.*)$", "OnTalkNearby");
activatepset(.pid);