From af4c19d951734e88655672823674eb95ee36ef2e Mon Sep 17 00:00:00 2001 From: "Hello=)" Date: Tue, 6 Aug 2024 08:12:24 +0300 Subject: 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 --- world/map/npc/magic/level2-rain.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'world/map/npc/magic/level2-rain.txt') 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: -- cgit v1.2.3-70-g09d2