mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 15:02:39 +00:00
Merge pull request #900 from Blue-Shadow/armorfactor_fix
- fixed buggy ArmorFactor behavior when set to a value other than 1.0
This commit is contained in:
commit
3c0ff178fd
1 changed files with 11 additions and 26 deletions
|
@ -132,19 +132,6 @@ class BasicArmor : Armor
|
||||||
// You shouldn't be picking up BasicArmor anyway.
|
// You shouldn't be picking up BasicArmor anyway.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!item.bIgnoreSkill)
|
|
||||||
{
|
|
||||||
if (item is "BasicArmorBonus")
|
|
||||||
{
|
|
||||||
let armor = BasicArmorBonus(item);
|
|
||||||
armor.SaveAmount = int(armor.SaveAmount * G_SkillPropertyFloat(SKILLP_ArmorFactor));
|
|
||||||
}
|
|
||||||
else if (item is "BasicArmorPickup")
|
|
||||||
{
|
|
||||||
let armor = BasicArmorPickup(item);
|
|
||||||
armor.SaveAmount = int(armor.SaveAmount * G_SkillPropertyFloat(SKILLP_ArmorFactor));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,12 +250,6 @@ class BasicArmorBonus : Armor
|
||||||
override Inventory CreateCopy (Actor other)
|
override Inventory CreateCopy (Actor other)
|
||||||
{
|
{
|
||||||
let copy = BasicArmorBonus(Super.CreateCopy (other));
|
let copy = BasicArmorBonus(Super.CreateCopy (other));
|
||||||
|
|
||||||
if (!bIgnoreSkill)
|
|
||||||
{
|
|
||||||
SaveAmount = int(SaveAmount * G_SkillPropertyFloat(SKILLP_ArmorFactor));
|
|
||||||
}
|
|
||||||
|
|
||||||
copy.SavePercent = SavePercent;
|
copy.SavePercent = SavePercent;
|
||||||
copy.SaveAmount = SaveAmount;
|
copy.SaveAmount = SaveAmount;
|
||||||
copy.MaxSaveAmount = MaxSaveAmount;
|
copy.MaxSaveAmount = MaxSaveAmount;
|
||||||
|
@ -309,7 +290,7 @@ class BasicArmorBonus : Armor
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int saveAmount = min(SaveAmount, MaxSaveAmount);
|
int saveAmount = min(GetSaveAmount(), MaxSaveAmount);
|
||||||
|
|
||||||
if (saveAmount <= 0)
|
if (saveAmount <= 0)
|
||||||
{ // If it can't give you anything, it's as good as used.
|
{ // If it can't give you anything, it's as good as used.
|
||||||
|
@ -344,6 +325,11 @@ class BasicArmorBonus : Armor
|
||||||
{
|
{
|
||||||
SaveAmount *= amount;
|
SaveAmount *= amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GetSaveAmount ()
|
||||||
|
{
|
||||||
|
return !bIgnoreSkill ? int(SaveAmount * G_SkillPropertyFloat(SKILLP_ArmorFactor)) : SaveAmount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
@ -383,12 +369,6 @@ class BasicArmorPickup : Armor
|
||||||
override Inventory CreateCopy (Actor other)
|
override Inventory CreateCopy (Actor other)
|
||||||
{
|
{
|
||||||
let copy = BasicArmorPickup(Super.CreateCopy (other));
|
let copy = BasicArmorPickup(Super.CreateCopy (other));
|
||||||
|
|
||||||
if (!bIgnoreSkill)
|
|
||||||
{
|
|
||||||
SaveAmount = int(SaveAmount * G_SkillPropertyFloat(SKILLP_ArmorFactor));
|
|
||||||
}
|
|
||||||
|
|
||||||
copy.SavePercent = SavePercent;
|
copy.SavePercent = SavePercent;
|
||||||
copy.SaveAmount = SaveAmount;
|
copy.SaveAmount = SaveAmount;
|
||||||
copy.MaxAbsorb = MaxAbsorb;
|
copy.MaxAbsorb = MaxAbsorb;
|
||||||
|
@ -410,6 +390,7 @@ class BasicArmorPickup : Armor
|
||||||
|
|
||||||
override bool Use (bool pickup)
|
override bool Use (bool pickup)
|
||||||
{
|
{
|
||||||
|
int SaveAmount = GetSaveAmount();
|
||||||
let armor = BasicArmor(Owner.FindInventory("BasicArmor"));
|
let armor = BasicArmor(Owner.FindInventory("BasicArmor"));
|
||||||
|
|
||||||
// This should really never happen but let's be prepared for a broken inventory.
|
// This should really never happen but let's be prepared for a broken inventory.
|
||||||
|
@ -450,6 +431,10 @@ class BasicArmorPickup : Armor
|
||||||
SaveAmount *= amount;
|
SaveAmount *= amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GetSaveAmount ()
|
||||||
|
{
|
||||||
|
return !bIgnoreSkill ? int(SaveAmount * G_SkillPropertyFloat(SKILLP_ArmorFactor)) : SaveAmount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
Loading…
Reference in a new issue