Skip to content

Commit

Permalink
Fixed "slot damage vs bosses" (#164) [M]
Browse files Browse the repository at this point in the history
- "slot damage vs bosses" doesn't applied to weapon if it hasn't any
custom attributes.
  • Loading branch information
M60TM authored Jan 28, 2024
1 parent b5c3c4b commit cf268c9
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions addons/sourcemod/scripting/freak_fortress_2/weapons.sp
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ stock void Weapons_OnHitBossPre(int attacker, int victim, float &damage, int wea
#if defined __tf_custom_attributes_included
if(TCALoaded && weapon != -1 && HasEntProp(weapon, Prop_Send, "m_AttributeList"))
{
char buffer[36];
KeyValues kv = TF2CustAttr_GetAttributeKeyValues(weapon);
if(kv)
{
Expand Down Expand Up @@ -507,7 +508,6 @@ stock void Weapons_OnHitBossPre(int attacker, int victim, float &damage, int wea
if(value != 1.0)
Client(victim).RageDebuff *= value;

char buffer[36];
if(damagecustom != TF_CUSTOM_BURNING && damagecustom != TF_CUSTOM_BURNING_FLARE && damagecustom != TF_CUSTOM_BURNING_ARROW)
{
kv.GetString("mod attribute hit stale", buffer, sizeof(buffer));
Expand All @@ -528,25 +528,6 @@ stock void Weapons_OnHitBossPre(int attacker, int victim, float &damage, int wea
}
}

if(GetEntityClassname(weapon, buffer, sizeof(buffer)))
{
int slot = TF2_GetClassnameSlot(buffer);
if(slot >= TFWeaponSlot_Primary && slot <= TFWeaponSlot_Melee)
{
int entity, i;
while(TF2_GetItem(attacker, entity, i))
{
if(entity == weapon)
continue;

static const char AttribName[][] = { "primary damage vs bosses", "secondary damage vs bosses", "melee damage vs bosses" };
value = TF2CustAttr_GetFloat(entity, AttribName[slot], 1.0);
if(value != 1.0)
damage *= value;
}
}
}

if(TF2_IsPlayerInCondition(attacker, TFCond_BlastJumping))
{
value = kv.GetFloat("mid-air damage vs bosses", 1.0);
Expand Down Expand Up @@ -580,6 +561,25 @@ stock void Weapons_OnHitBossPre(int attacker, int victim, float &damage, int wea
}

delete kv;

if(GetEntityClassname(weapon, buffer, sizeof(buffer)))
{
int slot = TF2_GetClassnameSlot(buffer);
if(slot >= TFWeaponSlot_Primary && slot <= TFWeaponSlot_Melee)
{
int entity, i;
while(TF2_GetItem(attacker, entity, i))
{
if(entity == weapon)
continue;

static const char AttribName[][] = { "primary damage vs bosses", "secondary damage vs bosses", "melee damage vs bosses" };
float value = TF2CustAttr_GetFloat(entity, AttribName[slot], 1.0);
if(value != 1.0)
damage *= value;
}
}
}
}
#endif
}
Expand Down

0 comments on commit cf268c9

Please sign in to comment.