From f035566d7d3ef9166d588f826e47f6d9fcf6fe68 Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Mon, 16 Nov 2020 13:53:21 +0100 Subject: [PATCH] Weight gold shell drop chance based on monster count. Gold shells don't spawn sparks unless they're visible. --- language.version | 2 +- zscript/swwm_ammo.zsc | 1 + zscript/swwm_handler.zsc | 8 +++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/language.version b/language.version index ef370b65e..eaec6a746 100644 --- a/language.version +++ b/language.version @@ -1,2 +1,2 @@ [default] -SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.11b-pre r619 \cu(Sun 15 Nov 19:05:23 CET 2020)"; +SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.11b-pre r620 \cu(Mon 16 Nov 13:53:21 CET 2020)"; diff --git a/zscript/swwm_ammo.zsc b/zscript/swwm_ammo.zsc index 8949f67ff..1040174d6 100644 --- a/zscript/swwm_ammo.zsc +++ b/zscript/swwm_ammo.zsc @@ -720,6 +720,7 @@ Class GoldShell : Ammo action void A_GoldShellTrail() { if ( Random[Goldy](0,2) ) return; + if ( !players[consoleplayer].Camera.CheckSight(self,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) return; Spawn("GoldShellSparkle",Vec3Offset(FRandom[Goldy](-2,2),FRandom[Goldy](-2,2),FRandom[Goldy](10,18))); } diff --git a/zscript/swwm_handler.zsc b/zscript/swwm_handler.zsc index 8d720a072..6c890409d 100644 --- a/zscript/swwm_handler.zsc +++ b/zscript/swwm_handler.zsc @@ -1133,7 +1133,13 @@ Class SWWMHandler : EventHandler // (or cause some things to spam-spawn gold shells) // (*cough* Touhou Doom *cough*) alreadygold.Push(e.Thing); - if ( !Random[GoldDrop](0,2) ) + // weight drop chance based on total count of this monster type + // guarantees that maps that get a bit slaughtery won't become easy farms for drops + int dropweight = 0; + let ti = ThinkerIterator.Create(e.Thing.GetClass()); + while ( ti.Next() ) dropweight++; + dropweight = max(2,dropweight/4); + if ( !Random[GoldDrop](0,dropweight) ) { let g = Actor.Spawn("GoldShell",e.Thing.Vec3Offset(0,0,e.Thing.Height/2)); double ang = FRandom[SpareShells](0,360);