summaryrefslogtreecommitdiff
path: root/world/map/npc
diff options
context:
space:
mode:
authorHello=) <hello@themanaworld.org>2024-08-06 08:12:24 +0300
committerHello TMW <hello@themanaworld.org>2024-08-07 19:34:42 +0000
commitaf4c19d951734e88655672823674eb95ee36ef2e (patch)
treefe4e9cc736b5e6337eae0afb258d9badebf5fc54 /world/map/npc
parentedf0110b83c79e82f63add148c94fb330358c89e (diff)
downloadserverdata-af4c19d951734e88655672823674eb95ee36ef2e.tar.gz
serverdata-af4c19d951734e88655672823674eb95ee36ef2e.tar.bz2
serverdata-af4c19d951734e88655672823674eb95ee36ef2e.tar.xz
serverdata-af4c19d951734e88655672823674eb95ee36ef2e.zip
A bit more fun with rain. Idea courtesy of Wellvin.
How this works: * If rain hits EntAbomination -> LogHead spawned. * If rain hits LogHead -> sometimes [Mauve,Alizarin,Gamboge,Cobalt]Plant could be spawned. * If $NO_RAIN_SPAWNS global variable set -> all spawns are completely disabled (this allows to revert to old logic without server restart if abused or bugs pop up) * If map gets too crowded by spawns spell would cease further spawns (limit set around 30, both spawned logheads and herbs count for this purpose) * Tested on my local, and all obvious bugs were hopefully sorted out. Reported-by: Wellvin
Diffstat (limited to 'world/map/npc')
-rw-r--r--world/map/npc/magic/level2-rain.txt11
1 files changed, 10 insertions, 1 deletions
diff --git a/world/map/npc/magic/level2-rain.txt b/world/map/npc/magic/level2-rain.txt
index 6a7f288b..291af009 100644
--- a/world/map/npc/magic/level2-rain.txt
+++ b/world/map/npc/magic/level2-rain.txt
@@ -102,9 +102,18 @@ OnHit:
if(get(Hp, .caster) < 1) destroy; // destroy if caster is missing
if(getmap(.caster) != strnpcinfo(3)) destroy; // destroy if caster left the map
if(target(.caster, @target_id, 16) != 16 && .caster != @target_id) end;
- if((get(BL_TYPE, @target_id) & 1) == 0) end; // either mob or pc
+ if((get(BL_TYPE, @target_id) & 1) == 0) end; // either mob or pc
if(get(ELTTYPE, @target_id) == ELT_FIRE)
injure .caster, @target_id, ((rand((@spellpower/15)+5)+2) * (100 - get(MDEF1, @target_id))) / 100;
+ if ($NO_RAIN_SPAWNS) end; // server-wide killswitch for rain pranks if spawns logic would backfire.
+ if (mobcount(getmap(), "rain::OnRainSpawnDeath") > 30) end; // Abort if too crowded.
+ if(get(Class, @target_id) == EntAbomination) // Rain hit Ent? This scores little perk!
+ monster getmap(), getnpcx(), getnpcy(), "", LogHead, 1+rand(1+(.max/150)), "rain::OnRainSpawnDeath";
+ if((get(Class, @target_id) == LogHead) && (rand(5) == 3)) // Rain hit LogHead? Little perk as well (plants)
+ monster getmap(), getnpcx(), getnpcy(), "", MauvePlant+rand(5), 1, "rain::OnRainSpawnDeath";
+ end;
+
+OnRainSpawnDeath:
end;
OnDestroy: