From 24e68146d18660ca906c59fe3661abb6ff226fec Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Thu, 14 Jan 2021 17:23:17 -0300 Subject: Fortress Town Siege - Initial version --- npc/025-1/ctrl.c | 95 +++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 83 insertions(+), 12 deletions(-) (limited to 'npc/025-1') diff --git a/npc/025-1/ctrl.c b/npc/025-1/ctrl.c index 9e0ad0a2b..d11eb798e 100644 --- a/npc/025-1/ctrl.c +++ b/npc/025-1/ctrl.c @@ -14,6 +14,7 @@ // 1,2,4,8,16 - broken statues // 1024 - Fortress Gate // 2048 - Siege started +// 4096 - Governor was spawned // $@FORT_BLACKLIST = int array // Char ID which already raided this week // TODO: Spawn the monster general for each statue. Count their deaths. @@ -143,6 +144,16 @@ function script FTStatue { spawnCore(true); spawnCore(false); + // Front Gate Guardians (Lv 70~80) + getmapxy(.@m$, .@x, .@y, 0); + .@x1=.@x-5; + .@x2=.@x+5; + .@y1=.@y-5; + .@y2=.@y+5; + for (.@i = 0; .@i < 4; ++.@i) { + spawnMob(any(AzulSkullSlime, YellowSkullSlime, Forain, GreenDragon, Michel, EliteDuck, Troll, Moonshroom, Terranite), .@x1, .@y1, .@x2, .@y2); + } + // Player blacklist (unable to use 025-2 warp) maptimer2("025-1", 10, "Gate#F::OnMPBlacklist"); kamibroadcast($MOST_HEROIC$+"'s team has begun a siege on Fortress Town. Will they prevail?"); @@ -158,12 +169,18 @@ OnSesame: // Heartbeat (B1) OnTimer15000: + if ($FORTRESS_STATE) + end; .@breach=($@FORTRESS_STATUE & 1024); spawnCore(.@breach); end; // Heartbeat (B2) OnTimer30000: + if ($FORTRESS_STATE) + end; + + // Initial variables .@breach=($@FORTRESS_STATUE & 1024); .@ppl=getmapusers("025-1"); @@ -180,16 +197,6 @@ OnTimer30000: // Summon reinforcements maptimer2("025-1", 10, "Gate#F::OnMPReinforce"); - // Front Gate Guardians (Lv 70~80) - getmapxy(.@m$, .@x, .@y, 0); - .@x1=.@x-5; - .@x2=.@x+5; - .@y1=.@y-5; - .@y2=.@y+5; - for (.@i = 0; .@i < 4; ++.@i) { - spawnMob(any(AzulSkullSlime, YellowSkullSlime, Forain, GreenDragon, Michel, EliteDuck, Troll, Moonshroom, Terranite), .@x1, .@y1, .@x2, .@y2); - } - // Restart timer initnpctimer; end; @@ -200,7 +207,7 @@ OnMPBlacklist: OnMPReinforce: // Dispose dead bodies - if (ispcdead()) { + if (ispcdead() || getmap() != "025-1") { warp "025-2", 96, 25; end; } @@ -209,8 +216,8 @@ OnMPReinforce: summon("Allied Guard", any(FallenGuard1, FallenGuard2, FallenGuard3)); end; +///////////////////////////////////////////////////////// OnStatueBreach: - debugmes "STATUE BROKEN"; spawnCore(true); getmapxy(.@m$, .@x, .@y, 0); .@x1=.@x-5; @@ -223,6 +230,67 @@ OnStatueBreach: } debugmes "STATUE FINISHED"; //TODO: Maybe spawn monster governor + if ( + ($@FORTRESS_STATUE & 1) && + ($@FORTRESS_STATUE & 2) && + ($@FORTRESS_STATUE & 4) && + ($@FORTRESS_STATUE & 8) && + ($@FORTRESS_STATUE & 16)) { + // The monster Governor shall now make their appearance! + spawnCore(true); + .@x1=97; + .@y1=21; + .@x2=102; + .@y2=25; + // Governor's Personal Bodyguard (Lv 90~110) + for (.@i = 0; .@i < 4; ++.@i) { + spawnMob(any(TerraniteProtector, LavaSkullSlime, VanityPixie, HolyPixie, ShadowPixie, NulityPixie, BlackSkullSlime, Reaper, NightmareDragon, WhirlyBird, PinkieSuseran), .@x1, .@y1, .@x2, .@y2); + } + .@mob=monster("025-1", any(99, 100), any(22, 23, 24), "Monster Governor", MonsterGeneral, 1, "Gate#F::OnConquest"); + // Stat and Strengthen the governor + // Set governor metadata + setunitdata(.@mob, UDT_LEVEL, 100+$MK_TEMPVAR); + // Update monster modes + .@opt=getunitdata(.@mob, UDT_MODE); + .@opt=.@opt|MD_AGGRESSIVE; + .@opt=.@opt|MD_BOSS; + .@opt=.@opt|MD_NOKNOCKBACK; + setunitdata(.@mob, UDT_MODE, .@opt); + // Increase health in 2% per siege + .@bhp=75000; + .@bhp=.@bhp*(50+$MK_TEMPVAR)/50; + setunitdata(.@mob, UDT_MAXHP, .@bhp); + setunitdata(.@mob, UDT_HP, .@bhp); + // Accuracy is very very high, immune to crits, always crit + setunitdata(.@mob, UDT_HIT, 9999); + setunitdata(.@mob, UDT_LUK, 65535); + // Increase damage in 1% per siege (remember crit) + .@atk=320; + .@atk=.@atk*(100+$MK_TEMPVAR)/100; + setunitdata(.@mob, UDT_ATKMIN, .@atk); + setunitdata(.@mob, UDT_ATKMAX, .@atk); + // Ranged monster + setunitdata(.@mob, UDT_ATKRANGE, 8); + // Increase defenses in 0.5% per siege + .@def=getunitdata(.@mob, UDT_DEF); + .@def=.@def*(200+$MK_TEMPVAR)/200; + setunitdata(.@mob, UDT_DEF, .@def); + .@def=getunitdata(.@mob, UDT_MDEF); + .@def=.@def*(200+$MK_TEMPVAR)/200; + setunitdata(.@mob, UDT_MDEF, .@def); + .@def=getunitdata(.@mob, UDT_FLEE); + .@def=.@def*(200+$MK_TEMPVAR)/200; + setunitdata(.@mob, UDT_FLEE, .@def); + .@def=getunitdata(.@mob, UDT_PDODGE); + .@def=.@def*(200+$MK_TEMPVAR)/200; + setunitdata(.@mob, UDT_PDODGE, .@def); + // "Normalize" criticals + setunitdata(.@mob, UDT_CRIT, rand2(900, 2700)); + + // Announce that the Fortress Town can now be conquered + kamibroadcast("##1"+"Aegis Scutum has been nullified, the Monster Governor has appeared at Fortress Town!"); + mapannounce "025-1", "Defeat the Monster Governor to capture the fortress town.", bc_map; + } end; ///////////////////////////////////////////////////////// @@ -317,6 +385,9 @@ OnConquest: $MK_TEMPVAR+=1; FTCleanup(true); kamibroadcast("Fortress Town has been captured by the Allied Forces!"); + // Experience injection to the brave (500k EXP, 100k JEXP) + if (playerattached()) + getexp 500000, 100000; end; } -- cgit v1.2.3-60-g2f50