Core/Unit: unambiguosly define PLAYER_FIELD_MOD_DAMAGE_DONE_ fields as signed - They were used both signed and unsignedly

This commit is contained in:
hondacrx
2018-03-12 13:16:59 -04:00
parent ac2224808e
commit f6fc8fae09
3 changed files with 15 additions and 15 deletions
+9 -9
View File
@@ -5802,16 +5802,16 @@ namespace Game.Entities
SetFloatValue(PlayerFields.ModPeriodicHealingDonePercent, 1.0f); SetFloatValue(PlayerFields.ModPeriodicHealingDonePercent, 1.0f);
for (byte i = 0; i < 7; ++i) for (byte i = 0; i < 7; ++i)
{ {
SetUInt32Value(PlayerFields.ModDamageDoneNeg + i, 0); SetInt32Value(PlayerFields.ModDamageDoneNeg + i, 0);
SetUInt32Value(PlayerFields.ModDamageDonePos + i, 0); SetInt32Value(PlayerFields.ModDamageDonePos + i, 0);
SetFloatValue(PlayerFields.ModDamageDonePct + i, 1.0f); SetFloatValue(PlayerFields.ModDamageDonePct + i, 1.0f);
} }
SetFloatValue(PlayerFields.ModSpellPowerPct, 1.0f); SetFloatValue(PlayerFields.ModSpellPowerPct, 1.0f);
//reset attack power, damage and attack speed fields //reset attack power, damage and attack speed fields
SetBaseAttackTime(WeaponAttackType.BaseAttack, SharedConst.BaseAttackTime); for (byte i = 0; i < (int)WeaponAttackType.Max; ++i)
SetBaseAttackTime(WeaponAttackType.OffAttack, SharedConst.BaseAttackTime); SetFloatValue(UnitFields.BaseAttackTime + i, SharedConst.BaseAttackTime);
SetBaseAttackTime(WeaponAttackType.RangedAttack, SharedConst.BaseAttackTime);
SetFloatValue(UnitFields.MinDamage, 0.0f); SetFloatValue(UnitFields.MinDamage, 0.0f);
SetFloatValue(UnitFields.MaxDamage, 0.0f); SetFloatValue(UnitFields.MaxDamage, 0.0f);
@@ -5852,11 +5852,11 @@ namespace Game.Entities
SetResistanceBuffMods(SpellSchools.Normal, true, 0.0f); SetResistanceBuffMods(SpellSchools.Normal, true, 0.0f);
SetResistanceBuffMods(SpellSchools.Normal, false, 0.0f); SetResistanceBuffMods(SpellSchools.Normal, false, 0.0f);
// set other resistance to original value (0) // set other resistance to original value (0)
for (var i = 1; i < (int)SpellSchools.Max; ++i) for (var spellSchool = SpellSchools.Holy; spellSchool < SpellSchools.Max; ++spellSchool)
{ {
SetResistance((SpellSchools)i, 0); SetResistance(spellSchool, 0);
SetResistanceBuffMods((SpellSchools)i, true, 0.0f); SetResistanceBuffMods(spellSchool, true, 0.0f);
SetResistanceBuffMods((SpellSchools)i, false, 0.0f); SetResistanceBuffMods(spellSchool, false, 0.0f);
} }
SetUInt32Value(PlayerFields.ModTargetResistance, 0); SetUInt32Value(PlayerFields.ModTargetResistance, 0);
+5 -5
View File
@@ -871,8 +871,8 @@ namespace Game.Entities
//demons benefit from warlocks shadow or fire damage //demons benefit from warlocks shadow or fire damage
else if (IsPet()) else if (IsPet())
{ {
int fire = (int)((owner.GetUInt32Value(PlayerFields.ModDamageDonePos + (int)SpellSchools.Fire)) + owner.GetUInt32Value(PlayerFields.ModDamageDoneNeg + (int)SpellSchools.Fire)); int fire = owner.GetInt32Value(PlayerFields.ModDamageDonePos + (int)SpellSchools.Fire) - owner.GetInt32Value(PlayerFields.ModDamageDoneNeg + (int)SpellSchools.Fire);
int shadow = (int)((owner.GetUInt32Value(PlayerFields.ModDamageDonePos + (int)SpellSchools.Shadow)) + owner.GetUInt32Value(PlayerFields.ModDamageDoneNeg + (int)SpellSchools.Shadow)); int shadow = owner.GetInt32Value(PlayerFields.ModDamageDonePos + (int)SpellSchools.Shadow) - owner.GetInt32Value(PlayerFields.ModDamageDoneNeg + (int)SpellSchools.Shadow);
int maximum = (fire > shadow) ? fire : shadow; int maximum = (fire > shadow) ? fire : shadow;
if (maximum < 0) if (maximum < 0)
maximum = 0; maximum = 0;
@@ -882,7 +882,7 @@ namespace Game.Entities
//water elementals benefit from mage's frost damage //water elementals benefit from mage's frost damage
else if (GetEntry() == ENTRY_WATER_ELEMENTAL) else if (GetEntry() == ENTRY_WATER_ELEMENTAL)
{ {
int frost = (int)((owner.GetUInt32Value(PlayerFields.ModDamageDonePos + (int)SpellSchools.Frost)) + owner.GetUInt32Value(PlayerFields.ModDamageDoneNeg + (int)SpellSchools.Frost)); int frost = owner.GetInt32Value(PlayerFields.ModDamageDonePos + (int)SpellSchools.Frost) - owner.GetInt32Value(PlayerFields.ModDamageDoneNeg + (int)SpellSchools.Frost);
if (frost < 0) if (frost < 0)
frost = 0; frost = 0;
SetBonusDamage((int)(frost * 0.4f)); SetBonusDamage((int)(frost * 0.4f));
@@ -915,14 +915,14 @@ namespace Game.Entities
//force of nature //force of nature
if (GetEntry() == ENTRY_TREANT) if (GetEntry() == ENTRY_TREANT)
{ {
int spellDmg = (int)((GetOwner().GetUInt32Value(PlayerFields.ModDamageDonePos + (int)SpellSchools.Nature)) + GetOwner().GetUInt32Value(PlayerFields.ModDamageDoneNeg + (int)SpellSchools.Nature)); int spellDmg = GetOwner().GetInt32Value(PlayerFields.ModDamageDonePos + (int)SpellSchools.Nature) - GetOwner().GetInt32Value(PlayerFields.ModDamageDoneNeg + (int)SpellSchools.Nature);
if (spellDmg > 0) if (spellDmg > 0)
bonusDamage = spellDmg * 0.09f; bonusDamage = spellDmg * 0.09f;
} }
//greater fire elemental //greater fire elemental
else if (GetEntry() == ENTRY_FIRE_ELEMENTAL) else if (GetEntry() == ENTRY_FIRE_ELEMENTAL)
{ {
int spellDmg = (int)((GetOwner().GetUInt32Value(PlayerFields.ModDamageDonePos + (int)SpellSchools.Fire)) + GetOwner().GetUInt32Value(PlayerFields.ModDamageDoneNeg + (int)SpellSchools.Fire)); int spellDmg = GetOwner().GetInt32Value(PlayerFields.ModDamageDonePos + (int)SpellSchools.Fire) - GetOwner().GetInt32Value(PlayerFields.ModDamageDoneNeg + (int)SpellSchools.Fire);
if (spellDmg > 0) if (spellDmg > 0)
bonusDamage = spellDmg * 0.4f; bonusDamage = spellDmg * 0.4f;
} }
+1 -1
View File
@@ -3912,7 +3912,7 @@ namespace Game.Spells
for (int i = 0; i < (int)SpellSchools.Max; ++i) for (int i = 0; i < (int)SpellSchools.Max; ++i)
{ {
if (Convert.ToBoolean(GetMiscValue() & (1 << i))) if (Convert.ToBoolean(GetMiscValue() & (1 << i)))
target.ApplyModUInt32Value(baseField + i, GetAmount(), apply); target.ApplyModInt32Value(baseField + i, GetAmount(), apply);
} }
Guardian pet = target.ToPlayer().GetGuardianPet(); Guardian pet = target.ToPlayer().GetGuardianPet();