Add secret difficulty for a dragon.

Remove 2x speed mult from hardest skill(s) (causes glitches).
Allow moths to still attack while following the lamp.
(Still do not know what causes moths to print "asin domain error" to terminal).
This commit is contained in:
Mari the Deer 2023-10-16 13:58:36 +02:00
commit f78b747ff7
7 changed files with 71 additions and 31 deletions

View file

@ -3,31 +3,30 @@
// tokens
Class DontDuplicate : Inventory {}
Class DontDuplicate2 : Inventory {}
Class GOTTAGOFAST : Inventory
{
override void DoEffect()
{
Super.DoEffect();
if ( !Owner || (Owner.Health <= 0) ) return;
if ( (Owner.tics > 1) && (Owner.tics > max(1,Owner.CurState.tics/2)) )
Owner.tics = max(1,Owner.CurState.tics/2);
}
}
extend Class SWWMHandler
{
double smult;
int dmult;
private void IWantDieSpawn( WorldEvent e )
{
if ( iwantdie == -1 ) iwantdie = (G_SkillName() == StringTable.Localize("$SWWM_SKLUNATIC"));
if ( iwantdie == -1 )
{
int acsre = G_SkillPropertyInt(SKILLP_ACSReturn);
iwantdie = (acsre >= 5);
smult = 2.-(acsre-5)*.5; // reduced in Kynikoss skill because it'd stack with FastMonsters
dmult = acsre-3;
}
if ( iwantdie <= 0 ) return;
if ( SWWMUtility.ValidProjectile(e.Thing) && !e.Thing.FindInventory("DontDuplicate") && (e.Thing.target && e.Thing.target.bISMONSTER && !e.Thing.target.player) )
{
e.Thing.speed *= 2;
e.Thing.vel *= 2;
e.Thing.speed *= smult;
e.Thing.vel *= smult;
double ang = e.Thing.target.target?e.Thing.AngleTo(e.Thing.target.target):e.Thing.angle;
double pt = e.Thing.target.target?e.Thing.PitchTo(e.Thing.target.target,e.Thing.target.missileheight,e.Thing.target.target.Height/2.):e.Thing.pitch;
let [x, y, z] = SWWMUtility.GetAxes(ang,pt,e.Thing.roll);
int numpt = Random[ExtraMissiles](1,2);
int numpt = Random[ExtraMissiles](1,dmult);
for ( int i=0; i<numpt; i++ )
{
double a = FRandom[ExtraMissiles](0,360);
@ -46,12 +45,11 @@ extend Class SWWMHandler
}
}
if ( !e.Thing.bISMONSTER || (e.Thing is 'PlayerPawn') ) return;
e.Thing.GiveInventory("GOTTAGOFAST",1);
// avoid if it has some sort of special handling
if ( e.Thing.special || e.Thing.tid || e.Thing.bDORMANT ) return;
// random chance to spawn doubles
if ( e.Thing.FindInventory("DontDuplicate") || Random[ExtraMissiles](0,2) ) return;
int numpt = Random[ExtraMissiles](1,2);
int numpt = Random[ExtraMissiles](1,dmult);
for ( int i=0; i<numpt; i++ )
{
// three attempts for each