diff options
-rw-r--r-- | npc/042-10/ctrl.txt | 187 |
1 files changed, 151 insertions, 36 deletions
diff --git a/npc/042-10/ctrl.txt b/npc/042-10/ctrl.txt index 509f547f5..a2a4b27d7 100644 --- a/npc/042-10/ctrl.txt +++ b/npc/042-10/ctrl.txt @@ -83,13 +83,111 @@ L_NoAccessBlock: //////////////////////////////////////////////////////////////////// // TODO: Catazuli spots // TODO: Spawn monsters +// KatazuliInfo( ) +function script KatazuliInfo { + mes ".:: Magical Seal ::."; + mes ""; + mes l("The Magical Seal which protects the final room is too strong."); + mes l("However, by casting %s here, we'll be able to weaken the seal!", b("katazuli")); + next; + mes l("To cast, one must sit on the circle and say the chant on general chat."); + mes l("The chant must be exact, without any prefix or suffix."); + next; + mes l("While breaking the seal, monsters will spawn. They may drop %s.", getitemlink(DarkPetal)); + mes l("Drop these near the circle to make the breaking faster."); + next; + mes l("Multiple players may conduct Katazuli at once. If you move or stand, the spell may be aborted."); + mes l("Remember: Taking damage will make you stand!"); + next; + mes l("After casting %s, you must wait %d seconds before casting it again.", b("katazuli"), b("60")); + mes l("However, as long as you remain seated and immobile, the spell will slowly destroy the seal."); + next; + mesc l("Caution"), 1; + mes l("The seals slowly grow stronger as time passes!"); + mes l("Once broken, they'll lose the link to the magical seal."); + mes l("Even if they recover their strength, because the connection was severed, the barrier will not power up again."); + return; +} + +// KatazuliCore( Begin, ID ) +function script KatazuliCore { + // Basic checks + // Not sitting - Do nothing and cancel + if (!issit()) + end; + + // Not sitting on the circle - Again, do nothing + getmapxy(.@m$, .@x, .@y, 0); + if (.@x != .x || .@y != .y) + end; + + // Initialize local variables + .@start=getarg(0); + .@id=getarg(1); + + // User cooldown + if (.@start && @katazuli >= gettimetick(2)) + end; + if (!.@start && @katazuli <= gettimetick(2)) + end; + + // All checks passed: KATAZULI + specialeffect FX_MGSHIELD, AREA, getcharid(3); // Temporary FX + + // Consume Dark Petals nearby + .@cat=getareadropitem(getmap(), .x-3, .y-3, .x+3, .y+3, DarkPetal, true); + + // Your own power boost + .@cat+=1; + + // Power the circle + .@power=getd("$@GTEMP_"+.@id+"_"+.@m$)+.@cat; + setd("$@GTEMP_"+.@id+"_"+.@m$, .@power); + + // Inform new status + if (.@power < 5 && .@start) + unittalk(getcharid(3), "This circle is nearly at full power! We need to shut down it!", true); + else if (.@power < 100) + unittalk(getcharid(3), "There is still too much power! Please drop "+getitemlink(DarkPetal)+" nearby!", true); + else if (.@power < 200) + unittalk(getcharid(3), "At this rate, we will do it! Keep going! Please drop "+getitemlink(DarkPetal)+" nearby!", true); + else if (.@power < 300) + unittalk(getcharid(3), "Guys I'm close to shut it down! Please drop "+getitemlink(DarkPetal)+" nearby!", true); + + // Debug Information + if (is_staff() && $@GM_OVERRIDE) + dispbottom l("[DEBUG] Current Power: %d", .@power); + + // TODO: Circle was shut down + if (.@power >= 300) { + // TODO + end; + } + + // TODO: Spawn monsters, drop Dark Petal + // Set cooldown on start + if (.@start) { + dispbottom l("Please wait 60 seconds to cast again."); + @katazuli=gettimetick(2)+60; + } + return; +} + + +//////////////////////// +// The first Katazuli 042-10,128,85,0 script #Katazuli01 NPC_SUMMONING_CIRC,0,0,{ - dispbottom l("This is probably related to the magical seals."); - end; + mes "Read tutorial?"; + select l("No"), l("Yes"); + if (@menu == 2) + KatazuliInfo(); + dispbottom l("This is probably related to the magic barrier."); + close; OnInit: - .distance=2; + .kataId=8; + .distance=3; .pid=getnpcid(); debugmes "Pattern %d", .pid; //defpattern(.pid, "^([Kk][Aa][Tt][Aa][Zz][Uu][Ll][Ii])$", "OnTalkNearby"); @@ -108,36 +206,44 @@ OnTalkNearby: // It is with us! if (.@message$ == "KATAZULI") { - // Not sitting - Do nothing - if (!issit()) - end; - // Not sitting on the circle - Again, do nothing - getmapxy(.@m$, .@x, .@y, 0); - if (.@x != .x || .@y != .y) - end; - // User cooldown - if (@katazuli > gettimetick(2)) - end; - - // All checks passed: KATAZULI - specialeffect FX_MGSHIELD, AREA, getcharid(3); // Temporary FX - - // Consume Dark Petals nearby - .@cat=getareadropitem(getmap(), .x-3, .y-3, .x+3, .y+3, DarkPetal, true); - - // TODO: Power Variable - dispbottom l("Katazuli! %d", .@cat); - + KatazuliCore(true, .kataId); + addtimer 6000, instance_npcname(.name$)+"::OnKatazuli"; } end; + +OnKatazuli: + KatazuliCore(false, .kataId); + addtimer 6000, instance_npcname(.name$)+"::OnKatazuli"; + end; + +OnInstanceInit: + initnpctimer; + end; + +// Every minute, recover some energy +OnTimer60000: + .@id=.kataId; + .@m$=instance_mapname("042-10"); + .@power=min(0, getd("$@GTEMP_"+.@id+"_"+.@m$)-rand2(5)); + setd("$@GTEMP_"+.@id+"_"+.@m$, .@power); + initnpctimer; + end; } + +//////////////////////// +// The second Katazuli 042-10,32,108,0 script #Katazuli02 NPC_SUMMONING_CIRC,0,0,{ - dispbottom l("This is probably related to the magical seals."); - end; + mes "Read tutorial?"; + select l("No"), l("Yes"); + if (@menu == 2) + KatazuliInfo(); + dispbottom l("This is probably related to the magic barrier."); + close; OnInit: - .distance=2; + .kataId=16; + .distance=3; .pid=getnpcid(); debugmes "Pattern %d", .pid; //defpattern(.pid, "^([Kk][Aa][Tt][Aa][Zz][Uu][Ll][Ii])$", "OnTalkNearby"); @@ -156,18 +262,27 @@ OnTalkNearby: // It is with us! if (.@message$ == "KATAZULI") { - // Not sitting - Do nothing - if (!issit()) - end; - // Not sitting on the circle - Again, do nothing - getmapxy(.@m$, .@x, .@y, 0); - if (.@x != .x || .@y != .y) - end; + KatazuliCore(true, .kataId); + addtimer 6000, instance_npcname(.name$)+"::OnKatazuli"; + } + end; - // All checks passed: KATAZULI - specialeffect FX_MGSHIELD, AREA, getcharid(3); // Temporary FX +OnKatazuli: + KatazuliCore(false, .kataId); + addtimer 6000, instance_npcname(.name$)+"::OnKatazuli"; + end; - } +OnInstanceInit: + initnpctimer; + end; + +// Every minute, recover some energy +OnTimer60000: + .@id=.kataId; + .@m$=instance_mapname("042-10"); + .@power=min(0, getd("$@GTEMP_"+.@id+"_"+.@m$)-rand2(5)); + setd("$@GTEMP_"+.@id+"_"+.@m$, .@power); + initnpctimer; end; } |