diff options
author | Fedja Beader <fedja@protonmail.ch> | 2024-05-29 02:50:02 +0200 |
---|---|---|
committer | Jesusalva Jesusalva <jesusalva@tmw2.org> | 2024-05-29 20:53:03 +0000 |
commit | c5dfd2aa01f7a714a40aaee4649c199e0f31b315 (patch) | |
tree | 35889199d6da52d168bbc7a72b5e8e30789f2999 | |
parent | 9710a1f188b94347938619df3d2042cb6bfac6de (diff) | |
download | serverdata-c5dfd2aa01f7a714a40aaee4649c199e0f31b315.tar.gz serverdata-c5dfd2aa01f7a714a40aaee4649c199e0f31b315.tar.bz2 serverdata-c5dfd2aa01f7a714a40aaee4649c199e0f31b315.tar.xz serverdata-c5dfd2aa01f7a714a40aaee4649c199e0f31b315.zip |
The coordination required for multi-player raid boss generation and fighting is annoying
-rw-r--r-- | npc/001-13/main.txt | 29 | ||||
-rw-r--r-- | npc/functions/aurora.txt | 9 |
2 files changed, 27 insertions, 11 deletions
diff --git a/npc/001-13/main.txt b/npc/001-13/main.txt index d1557d273..b718d177e 100644 --- a/npc/001-13/main.txt +++ b/npc/001-13/main.txt @@ -4,35 +4,48 @@ // Description: // Controls boss raid showdown (Freeyorp Event System - Boss Raid) +// Variable: +// $FYRAID_OWNER is .@id mapped to players +// FYRAID_LV is the last boss level that you obtained all rewards for. +// $FYRAID_LV[.@id] is your current boss's level. +// Should be >= FYRAID_LV. +// $FYRAID_HP[.@id] tracks leftover HP between fights +// $FYRAID_TIME[.@id] tracks overall per-boss time limit + +// This script is also called at end of boss fight with abort=true. function script FYRaid_Select { .@abort = getarg(0, false); if ($EVENT$ != "Raid") return; sleep2(100); // Anti-flood protection: Hold execution for 100ms mes l("Current Boss: %s", $RAIDING_BOSS$); + .@id = array_find($FYRAID_OWNER, getcharid(3)); if (.@id >= 0) { - // Same level (challenge ongoing) - if ($FYRAID_LV[.@id] == FYRAID_LV) { + .@diff = $FYRAID_LV[.@id] - FYRAID_LV; + // Same or greater level (challenge ongoing) + if (.@diff >= 0) { + .@reward = (2 * FYRAID_LV + .@diff) * (1 + .@diff) / 2; // Was defeated when you weren't loooking (limited precedence) if ($FYRAID_HP[.@id] <= 0) { mesc l("Boss defeated!"), 3; - FYRAID_LV+=1; $FYRAID_HP[.@id]=0; - Mobpt += FYRAID_LV * 10; - getitem EventNaftalin, FYRAID_LV; + // Arithmentic average of + // FYRAID_LV + FYRAID_LV+1 + ... + FYRAID_LV+.@diff + FYRAID_LV += .@diff; + Mobpt += .@reward * 10; + getitem EventNaftalin, .@reward; } // Time is running out else if (gettimetick(2) < $FYRAID_TIME[.@id]) { - mesc l("You found a Level %d %s!", FYRAID_LV, $RAIDING_BOSS$), 2; + mesc l("You found a Level %d %s!", $FYRAID_LV[.@id], $RAIDING_BOSS$), 2; mesc l("Time left: %s", FuzzyTime($FYRAID_TIME[.@id])), 1; } // Time has expired - free for next boss else if (gettimetick(2) > $FYRAID_TIME[.@id]) { mesc l("The boss you discovered has ran away!"); - $FYRAID_LV[.@id] = 0; $FYRAID_HP[.@id] = 0; $FYRAID_TIME[.@id] = 0; - Mobpt += rand2(FYRAID_LV); + Mobpt += rand2(.@reward); } } } diff --git a/npc/functions/aurora.txt b/npc/functions/aurora.txt index fbad772e7..df3e3129e 100644 --- a/npc/functions/aurora.txt +++ b/npc/functions/aurora.txt @@ -448,10 +448,12 @@ function script FYEConf_Raid { return; } + // Boss Raid Appears! (What you killed is meaningless) function script FYE_Raid { .@mob=getarg(0, killedrid); - // Actually - ignore system or auto-generated entities + // Actually - ignore system or auto-generated entities. + // This check also excludes the Raid boss itself. if (.@mob > 1490) return; .@lv=getmonsterinfo(.@mob, MOB_LV); @@ -467,7 +469,8 @@ function script FYE_Raid { // Wait - Maybe you already found a boss? if (.@id >= 0) { - if ($FYRAID_LV[.@id] == FYRAID_LV) + // Noone has fought this boss yet. + if ($FYRAID_HP[.@id] > 0) return; } @@ -481,7 +484,7 @@ function script FYE_Raid { // Assign the boss stats $FYRAID_HP[.@id]=2000+FYRAID_LV*1000+(FYRAID_LV/5*500); // Also declared in 001-13/main.txt - $FYRAID_LV[.@id]=FYRAID_LV; + $FYRAID_LV[.@id]= min($FYRAID_LV + 1, FYRAID_LV); $FYRAID_TIME[.@id]=gettimetick(2)+3600; // One hour // Announce that the boss was found! |