Add strictness options for untouchable bonus handling.

Fix order of operations making first untouchable kill not have a bonus.
This commit is contained in:
Mari the Deer 2020-11-29 21:25:40 +01:00
commit 5ea5cb35fc
9 changed files with 45 additions and 7 deletions

View file

@ -1410,15 +1410,18 @@ Class SWWMHandler : EventHandler
scr.xcnt = ++ofs;
}
}
spreecount[pnum]++;
if ( s && (spreecount[pnum] > s.skill) && !tookdamage[pnum] )
s.skill = spreecount[pnum];
if ( !tookdamage[pnum] )
{
int spreebonus = 10*spreecount[pnum];
int spreebonus = 10*(spreecount[pnum]);
// taper off after 10x (some people go really far with these, holy fuck)
if ( spreecount[pnum] > 10 ) spreebonus = int(spreebonus*((spreecount[pnum]/10.)**.25));
score += 100+spreebonus;
if ( (spreecount[pnum] > 0) && scr )
{
scr.xscore[ofs] = spreecount[pnum]+1;
scr.xscore[ofs] = spreecount[pnum];
scr.xtcolor[ofs] = Font.CR_FIRE;
scr.xstr[ofs] = StringTable.Localize("$SWWM_SPREEKILL");
scr.xcnt = ++ofs;
@ -1444,9 +1447,6 @@ Class SWWMHandler : EventHandler
Console.Printf(StringTable.Localize("$SWWM_LASTMONSTER"),src.player.GetUserName(),1000);
SWWMScoreObj.Spawn(1000,src.Vec3Offset(0,0,src.Height/2));
}
spreecount[pnum]++;
if ( s && (spreecount[pnum] > s.skill) && !tookdamage[pnum] )
s.skill = spreecount[pnum];
}
override void WorldThingDamaged( WorldEvent e )

View file

@ -170,6 +170,11 @@ Class SWWMArmor : Armor abstract
if ( amount <= saved ) saved = amount;
newdamage -= saved;
if ( healed > 0 ) Owner.GiveBody(healed);
if ( (swwm_strictuntouchable == 1) && (saved > 0) && Owner.player )
{
let hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
if ( hnd ) hnd.tookdamage[Owner.PlayerNumber()] = true;
}
amount -= saved;
damage = newdamage;
bool shouldautouse = false;
@ -364,6 +369,11 @@ Class SWWMHealth : Inventory abstract
return;
else if ( bBIGPOWERUP && (Owner.Health-damage > 0) )
return;
if ( (swwm_strictuntouchable == 1) && Owner.player )
{
let hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
if ( hnd ) hnd.tookdamage[Owner.PlayerNumber()] = true;
}
if ( ((Owner.player == players[consoleplayer]) || bBigPowerup) ) Owner.A_StartSound(UseSound,CHAN_ITEMEXTRA);
int tgive = 0;
bool acc = CVar.GetCVar('swwm_accdamage',players[consoleplayer]).GetBool();

View file

@ -990,6 +990,11 @@ Class Demolitionist : PlayerPawn
}
override int DamageMobj( Actor inflictor, Actor source, int damage, Name mod, int flags, double angle )
{
if ( (swwm_strictuntouchable >= 2) && (damage > 0) && player )
{
let hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
if ( hnd ) hnd.tookdamage[PlayerNumber()] = true;
}
// no damage whatsoever
if ( scriptedinvul )
return 0;

View file

@ -82,7 +82,7 @@ Class GrilledCheeseSandwich : Inventory
return; // this damage type is ignored by the player, so it does not affect us
if ( damageType == 'EndLevel' )
return; // don't trigger on endlevel damage
if ( damageType == 'Telefrag' )
if ( (damageType == 'Telefrag') && source )
{
// prevent overlap with voodoo doll
if ( source.player == Owner.player )
@ -91,6 +91,11 @@ Class GrilledCheeseSandwich : Inventory
}
if ( (Owner.Health-damage <= 0) && (Amount > 0) )
{
if ( (swwm_strictuntouchable == 1) && Owner.player )
{
let hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
if ( hnd ) hnd.tookdamage[Owner.PlayerNumber()] = true;
}
if ( damageType == 'InstantDeath' )
SafeTeleport(); // get out of pits
newdamage = 0;