diff --git a/src/namedef.h b/src/namedef.h index 13e9096bc..5aa7e82db 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -197,6 +197,8 @@ xx(PowerWeaponLevel2) xx(PowerFlight) xx(PowerSpeed) xx(PowerTorch) +xx(PowerReflection) +xx(Reflection) xx(CustomInventory) xx(Inventory) xx(CallTryPickup) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index e940c259f..2e2dd5682 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -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 diff --git a/wadsrc/static/zscript/inventory/powerups.txt b/wadsrc/static/zscript/inventory/powerups.txt index 346f3d1a7..897fe80e3 100644 --- a/wadsrc/static/zscript/inventory/powerups.txt +++ b/wadsrc/static/zscript/inventory/powerups.txt @@ -1939,6 +1939,21 @@ class PowerInfiniteAmmo : Powerup } } + +//=========================================================================== +// +// InfiniteAmmo +// +//=========================================================================== + +class PowerReflection : Powerup +{ + Default + { + Powerup.Duration -30; + } +} + //=========================================================================== // // PowerMorph