Weight gold shell drop chance based on monster count.

Gold shells don't spawn sparks unless they're visible.
This commit is contained in:
Mari the Deer 2020-11-16 13:53:21 +01:00
commit f035566d7d
3 changed files with 9 additions and 2 deletions

View file

@ -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)));
}

View file

@ -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);