diff options
Diffstat (limited to 'npc/081-3/logic.txt')
-rw-r--r-- | npc/081-3/logic.txt | 203 |
1 files changed, 203 insertions, 0 deletions
diff --git a/npc/081-3/logic.txt b/npc/081-3/logic.txt new file mode 100644 index 00000000..d77bd34c --- /dev/null +++ b/npc/081-3/logic.txt @@ -0,0 +1,203 @@ +// TMW Script. +// Author: +// Jesusalva +// Notes: +// Christmas 2021 - Boss Chamber #1 +// FIXME: What if players *fail* this? e.g. die + +081-3,44,36,0 script Pentagram#Xmas21A NPC424,{ + .@id = X21ID(); + if ($@XMAS21_BC1[.@id] == X21BC1_ON) end; + .@n$ = instance_npcname("Pentagram#Xmas21A"); + .@cl = X21BC1_CLEAR(); + + mesn; + mesq l("Should we break the Pentagram?"); + next; + select + l("I'm not ready yet."), + l("Bring it on!"), + rif(.@cl, l("Make it harder!")), + rif(.@cl, l("Make it a nightmare!")), + rif(.@cl, l("Kill me semi-instantly!")); + mes ""; + closeclientdialog; + if (@menu == 1 || 'LOCKD) { + close; + } + + 'LOCKD = true; + 'BC1LV = @menu - 1; + @BC1ME = getcharid(3); + .@mg = monster(getmap(), 44, 36, "Der Schneemann", SnowmanBoss, 1, "Pentagram#Xmas21A::OnFin"); + + // Prepare the difficulty settings + // Each difficulty level doubles the nÂș of players difficulty setting + // Can go up to 12 * 4 = 48, but we use 16 as the theoretical max + .@df = max(1, getmapusers(getmap()) * ('BC1LV * 2)); + .@lv = BaseLevel; + + setunitdata(.@mg, UDT_MAXHP, 5000 + (.@lv * 150) + (1200 * .@df)); + setunitdata(.@mg, UDT_HP, 5000 + (.@lv * 150) + (1200 * .@df)); + + setunitdata(.@mg, UDT_ADELAY, 2200 - max(1200, 75 * .@df)); + setunitdata(.@mg, UDT_ATKRANGE, 3); + + /* + setunitdata(.@mg, UDT_ATKMIN, .@lv*4+.@df*3); + setunitdata(.@mg, UDT_ATKMAX, .@lv*4+.@df*3); + */ + setunitdata(.@mg, UDT_ATKMIN, (.@lv+.@df)*5); + setunitdata(.@mg, UDT_ATKMAX, (.@lv+.@df)*6); + setunitdata(.@mg, UDT_DEF, min(50+.@df, 98)); + setunitdata(.@mg, UDT_MDEF, min(50+.@df, 98)); + setunitdata(.@mg, UDT_HIT, 9999); + + // Destroy the instance only after half hour has passed + instance_set_timeout(1800, 1800); + initnpctimer; + setnpctimer(39000); + disablenpc(.@n$); + $@XMAS21_BC1[.@id] = X21BC1_ON; + .BC1ID = .@mg; + close; + +OnFin: + if (!playerattached()) { + consolemes(CONSOLEMES_ERROR, "Player not attached after Christmas 2021 victory! Script aborted!"); + end; + } + killmonsterall(getmap()); + getexp 10000, 0; + getitem AquaTicket, 1 + 'BC1LV; + maptimer(getmap(), 10, "Pentagram#Xmas21A::OnFlush"); + end; + +// Distribute experience and handle quest progress +OnFlush: + getexp 5000, 0; + if (@BC1ME > 0) { + if (!X21BC1_CLEAR()) { + dispbottom l("Whatever that guardian was, the path is now clear, and the gate, open."); + X21BC1_DOCLEAR(); + } + } + @BC1ME = 0; + .@id = X21ID(); + $@XMAS21_BC1[.@id] = X21BC1_OFF; + getitem AquaTicket, X21_TICKET_SUPPORT + ('BC1LV / 2); + end; + +// Pseudo-Magic +OnTimer40000: + if (getunittype(.BC1ID) < 0) { + stopnpctimer; + end; + } + + .CYCLE += 1; + .@m$=getmapinfo(MAPINFO_NAME); // We could use .map$ too + areamonster(.@m$, 31, 23, 58, 50, "Snowballz", Snowman, 1+getmapusers(.@m$)); + + if (.CYCLE % 2 != 0) { + initnpctimer; + end; + } + + // The boss special skill depends on its health + .@hp = 100 * getunitdata(.BC1ID, UDT_HP) / getunitdata(.BC1ID, UDT_MAXHP); + + // HP > 70%, just some warm-up + if (.@hp > 70) { + unittalk(.BC1ID, "Blizzard!"); + rectharm(.BC1ID, 6, 6, rand2(250), HARM_MAGI, Ele_Neutral, "filter_always", BL_PC); + + // HP < 70%, cripple half the attackers + } else if (.@hp > 40) { + .@sc = any(SC_SILENCE, SC_BLIND); + if (.@sc == SC_SILENCE) + unittalk(.BC1ID, "Silence!"); + else + unittalk(.BC1ID, "Blind!"); + areasc2(.@m$, 44, 36, 14, rand2(15000), BL_PC, .@sc); + rectharm(.BC1ID, 5, 5, rand2(50), HARM_MAGI, Ele_Neutral, "filter_always", BL_PC); + + // HP < 40%, cause great damage + } else if (.@hp > 15) { + unittalk(.BC1ID, "Greater Blizzard!"); + rectharm(.BC1ID, 8, 8, 100+rand2(250), HARM_MAGI, Ele_Neutral, "filter_always", BL_PC); + + // HP < 15%, use more dangerous conditions + } else { + .@sc = any(SC_POISON, SC_CURSE); + if (.@sc == SC_SILENCE) + unittalk(.BC1ID, "Poison!"); + else + unittalk(.BC1ID, "Curse!"); + areasc2(.@m$, 44, 36, 14, rand2(15000), BL_PC, .@sc); + rectharm(.BC1ID, 5, 5, rand2(100), HARM_MAGI, Ele_Neutral, "filter_always", BL_PC); + } + + // Repeat forever + initnpctimer; + end; + +OnClean: + enablenpc(.name$); + killmonsterall(getmapinfo(MAPINFO_NAME)); +OnInit: + .distance=2; + .BC1ID = 0; + .CYCLE = 0; + end; +} + + +081-3,44,22,0 script #0813Nexit NPC_HIDDEN,0,0,{ + end; +OnTouch: + if (!isChristmas21()) end; + if (!X21BC1_CLEAR()) { + dispbottom l("A strong magic barrier prevents me from using this exit."); + end; + } + .@id = X21ID(); + if ($@XMAS21_BC1[.@id] == X21BC1_ON) end; + if ($@XMAS21_BC1[.@id] == X21BC1_OFF) { + mesn l("Northern Lights"); + mes l("Past this gate, beyond the existential frontier, I can see the Northern Lights."); + mes l("Should we walk toward it?"); + next; + select + l("Yes"), + l("Not yet"), + l("[Run away]"); + mes ""; + if (@menu == 1) { + /* We need to determine if instance exists and is needed */ + X21INIT(); + + .@mapn$="0803@"+X21ID2(); + warp .@mapn$, 83, 154; + } + // NOTE: Right now, anyone can do so? + else if (@menu == 3) { + enablenpc(instance_npcname("Pentagram#Xmas21A")); + warp "081-2", 90, 21; + 'LOCKD = false; + } + closeclientdialog; + close; + } + end; +} + +081-3,44,50,0 script #0813Sexit NPC_HIDDEN,0,0,{ + end; +OnTouch: + .@id = X21ID(); + if ($@XMAS21_BC1[.@id] == X21BC1_ON) end; + warp "081-2", 90, 21; + end; +} + |