- added some flexibility to some Skulltag powerups.
- handle these powerups by actual item checks instead of cheat flags. (The same should also be done for the Frightener and Buddha but those are a bit more complex because they are also real cheats.)
This commit is contained in:
parent
c7668952d9
commit
e6b31dde27
7 changed files with 58 additions and 110 deletions
|
|
@ -1164,18 +1164,28 @@ static int DamageMobj (AActor *target, AActor *inflictor, AActor *source, int da
|
|||
}
|
||||
|
||||
|
||||
AInventory *reflect;
|
||||
//[RC] Backported from the Zandronum source.. Mostly.
|
||||
if( target->player &&
|
||||
damage > 0 &&
|
||||
source &&
|
||||
(reflect = target->FindInventory(NAME_PowerReflection)) &&
|
||||
mod != NAME_Reflection)
|
||||
mod != NAME_Reflection &&
|
||||
target != source)
|
||||
|
||||
{
|
||||
if ( target != source )
|
||||
int reflectdamage = 0;
|
||||
for (auto p = target->player->mo->Inventory; p != nullptr; p = p->Inventory)
|
||||
{
|
||||
// This picks the reflection item with the maximum efficiency for the given damage type.
|
||||
if (p->IsKindOf(NAME_PowerReflection))
|
||||
{
|
||||
int mydamage = p->ApplyDamageFactor(mod, damage);
|
||||
if (mydamage > reflectdamage) reflectdamage = mydamage;
|
||||
}
|
||||
}
|
||||
|
||||
if (reflectdamage > 0)
|
||||
{
|
||||
// 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.
|
||||
|
|
@ -1439,13 +1449,24 @@ static int DamageMobj (AActor *target, AActor *inflictor, AActor *source, int da
|
|||
|
||||
// If the damaging player has the power of drain, give the player 50% of the damage
|
||||
// done in health.
|
||||
if ( source && source->player && source->player->cheats & CF_DRAIN && !(target->flags5 & MF5_DONTDRAIN))
|
||||
if ( source && source->player && !(target->flags5 & MF5_DONTDRAIN))
|
||||
{
|
||||
if (!target->player || target->player != source->player)
|
||||
{
|
||||
if ( P_GiveBody( source, damage / 2 ))
|
||||
double draindamage = 0;
|
||||
for (auto p = source->player->mo->Inventory; p != nullptr; p = p->Inventory)
|
||||
{
|
||||
S_Sound( source, CHAN_ITEM, "*drainhealth", 1, ATTN_NORM );
|
||||
// This picks the item with the maximum efficiency.
|
||||
if (p->IsKindOf(NAME_PowerDrain))
|
||||
{
|
||||
double mydamage = p->FloatVar(NAME_Strength);
|
||||
if (mydamage > draindamage) draindamage = mydamage;
|
||||
}
|
||||
}
|
||||
|
||||
if ( P_GiveBody( source, int(draindamage * damage)))
|
||||
{
|
||||
S_Sound(source, CHAN_ITEM, "*drainhealth", 1, ATTN_NORM );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue