- added an old submission for PowerReflection, although it had to be seriously reworked and improved.

This commit is contained in:
Christoph Oelckers 2017-02-26 15:47:37 +01:00
parent a0b830c198
commit 8b2a5c75a1
3 changed files with 39 additions and 0 deletions

View file

@ -197,6 +197,8 @@ xx(PowerWeaponLevel2)
xx(PowerFlight)
xx(PowerSpeed)
xx(PowerTorch)
xx(PowerReflection)
xx(Reflection)
xx(CustomInventory)
xx(Inventory)
xx(CallTryPickup)

View file

@ -1162,6 +1162,28 @@ static int DamageMobj (AActor *target, AActor *inflictor, AActor *source, int da
// any negative value means that something in the above chain has cancelled out all damage and all damage effects, including pain.
return 0;
}
AInventory *reflect;
//[RC] Backported from the Zandronum source.. Mostly.
if( target->player &&
damage > 0 &&
source &&
(reflect = target->FindInventory(NAME_PowerReflection)) &&
mod != NAME_Reflection)
{
if ( target != source )
{
// use the reflect item's damage factors to get the final value here.
int reflectdamage = reflect->ApplyDamageFactor(mod, damage);
P_DamageMobj(source, nullptr, target, reflectdamage, NAME_Reflection );
// Reset means of death flag.
MeansOfDeath = mod;
}
}
// Push the target unless the source's weapon's kickback is 0.
// (i.e. Gauntlets/Chainsaw)
if (!plrDontThrust && inflictor && inflictor != target // [RH] Not if hurting own self

View file

@ -1939,6 +1939,21 @@ class PowerInfiniteAmmo : Powerup
}
}
//===========================================================================
//
// InfiniteAmmo
//
//===========================================================================
class PowerReflection : Powerup
{
Default
{
Powerup.Duration -30;
}
}
//===========================================================================
//
// PowerMorph