Core/Refactor: Fix alot of Possible loss of fraction warnings

This commit is contained in:
hondacrx
2018-05-07 17:34:41 -04:00
parent daa425b029
commit b2c1554065
17 changed files with 31 additions and 30 deletions
@@ -225,7 +225,7 @@ namespace Game.Entities
float GetProgress()
{
return GetTimeSinceCreated() < GetTimeToTargetScale() ? GetTimeSinceCreated() / GetTimeToTargetScale() : 1.0f;
return GetTimeSinceCreated() < GetTimeToTargetScale() ? (float)GetTimeSinceCreated() / GetTimeToTargetScale() : 1.0f;
}
void UpdateTargetList()
@@ -655,7 +655,7 @@ namespace Game.Entities
return;
}
float currentTimePercent = _movementTime / GetTimeToTarget();
float currentTimePercent = (float)_movementTime / GetTimeToTarget();
if (currentTimePercent <= 0.0f)
return;
+1 -1
View File
@@ -2318,7 +2318,7 @@ namespace Game.Entities
if (getLevel() < levelForTarget)
return 1.0f;
return GetMaxHealthByLevel(levelForTarget) / GetCreateHealth();
return (float)GetMaxHealthByLevel(levelForTarget) / GetCreateHealth();
}
float GetBaseDamageForLevel(uint level)
@@ -161,8 +161,8 @@ namespace Game.Entities
float xDiff = nextPosition.posX - lastPosition.posX;
float yDiff = nextPosition.posY - lastPosition.posY;
float zDiff = nextPosition.posZ - lastPosition.posZ;
Position interPosition = new Position(lastPosition.posX + (xDiff * (interDiff / timeDiff)), lastPosition.posY +
(yDiff * (interDiff / timeDiff)), lastPosition.posZ + (zDiff * (interDiff / timeDiff)));
Position interPosition = new Position(lastPosition.posX + (xDiff * ((float)interDiff / timeDiff)), lastPosition.posY +
(yDiff * ((float)interDiff / timeDiff)), lastPosition.posZ + (zDiff * ((float)interDiff / timeDiff)));
// Advance (at speed) to this position. The remote sight object is used
// to send update information to player in cinematic
+1 -1
View File
@@ -3772,7 +3772,7 @@ namespace Game.Entities
ulong price = 0;
if (crItem.IsGoldRequired(pProto) && pProto.GetBuyPrice() > 0) //Assume price cannot be negative (do not know why it is int32)
{
float buyPricePerItem = pProto.GetBuyPrice() / pProto.GetBuyCount();
float buyPricePerItem = (float)pProto.GetBuyPrice() / pProto.GetBuyCount();
ulong maxCount = (ulong)(PlayerConst.MaxMoneyAmount / buyPricePerItem);
if (count > maxCount)
{
+1 -1
View File
@@ -1104,7 +1104,7 @@ namespace Game.Entities
var mAPbyArmor = GetAuraEffectsByType(AuraType.ModAttackPowerOfArmor);
foreach (var iter in mAPbyArmor)
// always: ((*i).GetModifier().m_miscvalue == 1 == SPELL_SCHOOL_MASK_NORMAL)
attPowerMod += GetArmor() / iter.GetAmount();
attPowerMod += (int)(GetArmor() / iter.GetAmount());
}
SetUInt32Value(index, (uint)base_attPower); //UNIT_FIELD_(RANGED)_ATTACK_POWER field
+2 -2
View File
@@ -548,8 +548,8 @@ namespace Game.Entities
if (pInfo == null)
SetCreateHealth(30 + 30 * petlevel);
float bonusDmg = GetOwner().SpellBaseDamageBonusDone(SpellSchoolMask.Nature) * 0.15f;
SetBaseWeaponDamage(WeaponAttackType.BaseAttack, WeaponDamageRange.MinDamage, petlevel * 2.5f - (petlevel / 2) + bonusDmg);
SetBaseWeaponDamage(WeaponAttackType.BaseAttack, WeaponDamageRange.MaxDamage, petlevel * 2.5f + (petlevel / 2) + bonusDmg);
SetBaseWeaponDamage(WeaponAttackType.BaseAttack, WeaponDamageRange.MinDamage, petlevel * 2.5f - ((float)petlevel / 2) + bonusDmg);
SetBaseWeaponDamage(WeaponAttackType.BaseAttack, WeaponDamageRange.MaxDamage, petlevel * 2.5f + ((float)petlevel / 2) + bonusDmg);
break;
}
case 15352: //earth elemental 36213
+2 -2
View File
@@ -784,7 +784,7 @@ namespace Game.Entities
uint VictimDefense = victim.GetMaxSkillValueForLevel(this);
uint AttackerMeleeSkill = GetMaxSkillValueForLevel();
Probability *= (float)(AttackerMeleeSkill / VictimDefense * 0.16);
Probability *= (AttackerMeleeSkill / (float)VictimDefense * 0.16f);
if (Probability < 0)
Probability = 0;
@@ -1014,7 +1014,7 @@ namespace Game.Entities
victim.ToCreature().LowerPlayerDamageReq(health < damage ? health : damage);
}
damage /= (uint)victim.GetHealthMultiplierForTarget(this);
damage = (uint)(damage / victim.GetHealthMultiplierForTarget(this));
if (health <= damage)
{