From f6fc8fae09d7770d4ad9e6957af0830dfb9ffc49 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Mon, 12 Mar 2018 13:16:59 -0400 Subject: [PATCH] Core/Unit: unambiguosly define PLAYER_FIELD_MOD_DAMAGE_DONE_ fields as signed - They were used both signed and unsignedly --- Source/Game/Entities/Player/Player.cs | 18 +++++++++--------- Source/Game/Entities/TemporarySummon.cs | 10 +++++----- Source/Game/Spells/Auras/AuraEffect.cs | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Source/Game/Entities/Player/Player.cs b/Source/Game/Entities/Player/Player.cs index 1ff30ec32..732d22c66 100644 --- a/Source/Game/Entities/Player/Player.cs +++ b/Source/Game/Entities/Player/Player.cs @@ -5802,16 +5802,16 @@ namespace Game.Entities SetFloatValue(PlayerFields.ModPeriodicHealingDonePercent, 1.0f); for (byte i = 0; i < 7; ++i) { - SetUInt32Value(PlayerFields.ModDamageDoneNeg + i, 0); - SetUInt32Value(PlayerFields.ModDamageDonePos + i, 0); + SetInt32Value(PlayerFields.ModDamageDoneNeg + i, 0); + SetInt32Value(PlayerFields.ModDamageDonePos + i, 0); SetFloatValue(PlayerFields.ModDamageDonePct + i, 1.0f); } + SetFloatValue(PlayerFields.ModSpellPowerPct, 1.0f); //reset attack power, damage and attack speed fields - SetBaseAttackTime(WeaponAttackType.BaseAttack, SharedConst.BaseAttackTime); - SetBaseAttackTime(WeaponAttackType.OffAttack, SharedConst.BaseAttackTime); - SetBaseAttackTime(WeaponAttackType.RangedAttack, SharedConst.BaseAttackTime); + for (byte i = 0; i < (int)WeaponAttackType.Max; ++i) + SetFloatValue(UnitFields.BaseAttackTime + i, SharedConst.BaseAttackTime); SetFloatValue(UnitFields.MinDamage, 0.0f); SetFloatValue(UnitFields.MaxDamage, 0.0f); @@ -5852,11 +5852,11 @@ namespace Game.Entities SetResistanceBuffMods(SpellSchools.Normal, true, 0.0f); SetResistanceBuffMods(SpellSchools.Normal, false, 0.0f); // 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); - SetResistanceBuffMods((SpellSchools)i, true, 0.0f); - SetResistanceBuffMods((SpellSchools)i, false, 0.0f); + SetResistance(spellSchool, 0); + SetResistanceBuffMods(spellSchool, true, 0.0f); + SetResistanceBuffMods(spellSchool, false, 0.0f); } SetUInt32Value(PlayerFields.ModTargetResistance, 0); diff --git a/Source/Game/Entities/TemporarySummon.cs b/Source/Game/Entities/TemporarySummon.cs index 82b14766f..eb2d2edb2 100644 --- a/Source/Game/Entities/TemporarySummon.cs +++ b/Source/Game/Entities/TemporarySummon.cs @@ -871,8 +871,8 @@ namespace Game.Entities //demons benefit from warlocks shadow or fire damage else if (IsPet()) { - int fire = (int)((owner.GetUInt32Value(PlayerFields.ModDamageDonePos + (int)SpellSchools.Fire)) + owner.GetUInt32Value(PlayerFields.ModDamageDoneNeg + (int)SpellSchools.Fire)); - int shadow = (int)((owner.GetUInt32Value(PlayerFields.ModDamageDonePos + (int)SpellSchools.Shadow)) + owner.GetUInt32Value(PlayerFields.ModDamageDoneNeg + (int)SpellSchools.Shadow)); + int fire = owner.GetInt32Value(PlayerFields.ModDamageDonePos + (int)SpellSchools.Fire) - owner.GetInt32Value(PlayerFields.ModDamageDoneNeg + (int)SpellSchools.Fire); + int shadow = owner.GetInt32Value(PlayerFields.ModDamageDonePos + (int)SpellSchools.Shadow) - owner.GetInt32Value(PlayerFields.ModDamageDoneNeg + (int)SpellSchools.Shadow); int maximum = (fire > shadow) ? fire : shadow; if (maximum < 0) maximum = 0; @@ -882,7 +882,7 @@ namespace Game.Entities //water elementals benefit from mage's frost damage 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) frost = 0; SetBonusDamage((int)(frost * 0.4f)); @@ -915,14 +915,14 @@ namespace Game.Entities //force of nature 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) bonusDamage = spellDmg * 0.09f; } //greater 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) bonusDamage = spellDmg * 0.4f; } diff --git a/Source/Game/Spells/Auras/AuraEffect.cs b/Source/Game/Spells/Auras/AuraEffect.cs index 8797008bf..0c69f166e 100644 --- a/Source/Game/Spells/Auras/AuraEffect.cs +++ b/Source/Game/Spells/Auras/AuraEffect.cs @@ -3912,7 +3912,7 @@ namespace Game.Spells for (int i = 0; i < (int)SpellSchools.Max; ++i) { if (Convert.ToBoolean(GetMiscValue() & (1 << i))) - target.ApplyModUInt32Value(baseField + i, GetAmount(), apply); + target.ApplyModInt32Value(baseField + i, GetAmount(), apply); } Guardian pet = target.ToPlayer().GetGuardianPet();