Implement damage accumulator for flak chunks (auto-gibs at specific threshold).

Rebalances to ammo amounts and spawns.
Rebalances to ripper speed and pulsegun beam damage.
More tweaks to UT movement.
This commit is contained in:
Marisa the Magician 2018-09-15 12:46:31 +02:00
commit cdfea51f31
5 changed files with 97 additions and 28 deletions

View file

@ -105,6 +105,53 @@ Class ChunkTrail : Actor
}
}
Class FlakAccumulator : Thinker
{
Actor victim;
int amount;
int cnt;
override void Tick()
{
Super.Tick();
cnt++;
if ( cnt < 5 ) return;
Destroy();
}
static void Accumulate( Actor victim, int amount )
{
let ti = ThinkerIterator.Create("FlakAccumulator",STAT_USER);
FlakAccumulator a, match = null;
while ( a = FlakAccumulator(ti.Next()) )
{
if ( a.victim != victim ) continue;
match = a;
break;
}
if ( !match )
{
match = new("FlakAccumulator");
match.ChangeStatNum(STAT_USER);
match.victim = victim;
}
match.cnt = 0;
match.amount += amount;
}
static int GetAmount( Actor victim )
{
let ti = ThinkerIterator.Create("FlakAccumulator",STAT_USER);
FlakAccumulator a;
while ( a = FlakAccumulator(ti.Next()) )
{
if ( a.victim != victim ) continue;
return a.amount;
}
return 0;
}
}
Class FlakChunk : Actor
{
ChunkTrail trail;
@ -208,6 +255,10 @@ Class FlakChunk : Actor
override int DoSpecialDamage( Actor target, int damage, Name damagetype )
{
if ( vel.length() <= 5.0 ) return 0;
FlakAccumulator.Accumulate(target,damage);
int gibhealth = (target.GibHealth==int.min)?-target.SpawnHealth():target.GibHealth;
int calcdmg = FlakAccumulator.GetAmount(target);
if ( target.Health-calcdmg <= (gibhealth/2) ) bEXTREMEDEATH = true;
if ( !target.bNOBLOOD )
{
target.SpawnBlood(pos,AngleTo(target),damage);