Core/Game: fix all warnings related to converting doubles and floats.

--HG--
branch : trunk
This commit is contained in:
silinoron committed 2010-08-22 12:39:39 -07:00
1 parent 399e35f8f5
commit 5cbae843d5
39 files changed
+378 -380

No files matched your search

+77 -77
View File
@@ -508,8 +508,8 @@ void Unit::GetRandomContactPoint(const Unit* obj, float &x, float &y, float &z,
uint32 attacker_number = getAttackers().size();
if (attacker_number > 0)
--attacker_number;
GetNearPoint(obj,x,y,z,obj->GetCombatReach(), distance2dMin+(distance2dMax-distance2dMin)*rand_norm()
, GetAngle(obj) + (attacker_number ? (M_PI/2 - M_PI * rand_norm()) * float(attacker_number) / combat_reach * 0.3 : 0));
GetNearPoint(obj,x,y,z,obj->GetCombatReach(), distance2dMin+(distance2dMax-distance2dMin)*(float)rand_norm()
, GetAngle(obj) + (attacker_number ? (static_cast<float>(M_PI/2) - static_cast<float>(M_PI) * (float)rand_norm()) * float(attacker_number) / combat_reach * 0.3f : 0));
}
void Unit::UpdateInterruptMask()
@@ -590,7 +590,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
continue;
SpellEntry const * spell = (*i)->GetSpellProto();
uint32 share = damage * (float((*i)->GetAmount()) / 100.0f);
uint32 share = uint32(damage * (float((*i)->GetAmount()) / 100.0f));
// TODO: check packets if damage is done by pVictim, or by attacker of pVicitm
DealDamageMods(shareDamageTarget, share, NULL);
DealDamage(shareDamageTarget, share, NULL, NODAMAGE, GetSpellSchoolMask(spell), spell, false);
@@ -771,9 +771,9 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
if (pVictim->GetTypeId() != TYPEID_PLAYER)
{
if (spellProto && IsDamageToThreatSpell(spellProto))
pVictim->AddThreat(this, damage*2, damageSchoolMask, spellProto);
pVictim->AddThreat(this, damage*2.0f, damageSchoolMask, spellProto);
else
pVictim->AddThreat(this, damage, damageSchoolMask, spellProto);
pVictim->AddThreat(this, (float)damage, damageSchoolMask, spellProto);
}
else // victim is a player
{
@@ -1471,7 +1471,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
}
else
{
float percent20 = pVictim->GetAttackTime(BASE_ATTACK) * 0.20;
float percent20 = pVictim->GetAttackTime(BASE_ATTACK) * 0.20f;
float percent60 = 3.0f * percent20;
if (basetime > percent20 && basetime <= percent60)
pVictim->setAttackTimer(BASE_ATTACK, uint32(percent20));
@@ -1589,7 +1589,7 @@ bool Unit::IsDamageReducedByArmor(SpellSchoolMask schoolMask, SpellEntry const *
uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellEntry const *spellInfo, WeaponAttackType /*attackType*/)
{
uint32 newdamage = 0;
float armor = pVictim->GetArmor();
float armor = float(pVictim->GetArmor());
// Ignore enemy armor by SPELL_AURA_MOD_TARGET_RESISTANCE aura
armor += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, SPELL_SCHOOL_MASK_NORMAL);
@@ -1603,14 +1603,14 @@ uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellEnt
{
if ((*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL
&& (*j)->IsAffectedOnSpell(spellInfo))
armor= int32(float(armor) * (float(100-(*j)->GetAmount())/100.0f));
armor = floor(float(armor) * (float(100-(*j)->GetAmount())/100.0f));
}
AuraEffectList const& ResIgnoreAuras = GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST);
for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j)
{
if ((*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
armor= int32(float(armor) * (float(100-(*j)->GetAmount())/100.0f));
armor = floor(float(armor) * (float(100-(*j)->GetAmount())/100.0f));
}
if (GetTypeId() == TYPEID_PLAYER)
@@ -1621,7 +1621,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellEnt
// item neutral spell
if ((*itr)->GetSpellProto()->EquippedItemClass == -1)
{
armor = int32(float(armor) * (float(100-(*itr)->GetAmount())/100.0f));
armor = floor(float(armor) * (float(100-(*itr)->GetAmount())/100.0f));
continue;
}
@@ -1632,7 +1632,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellEnt
if (weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellProto()))
{
armor= int32(float(armor) * (float(100-(*itr)->GetAmount())/100.0f));
armor = floor(float(armor) * (float(100-(*itr)->GetAmount())/100.0f));
break;
}
}
@@ -1644,9 +1644,9 @@ uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellEnt
{
float maxArmorPen=0;
if (getLevel()<60)
maxArmorPen=400+85*pVictim->getLevel();
maxArmorPen=(float)(400+85*pVictim->getLevel());
else
maxArmorPen=400+85*pVictim->getLevel()+4.5*85*(pVictim->getLevel()-59);
maxArmorPen=400+85*pVictim->getLevel()+4.5f*85*(pVictim->getLevel()-59);
// Cap armor penetration to this number
maxArmorPen = std::min(((armor+maxArmorPen)/3),armor);
// Figure out how much armor do we ignore
@@ -1721,7 +1721,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff
discreteResistProbability[2] = 2.5f * averageResist;
}
float r = rand_norm();
float r = (float)rand_norm();
int i = 0;
float probabilitySum = discreteResistProbability[0];
while (r >= probabilitySum && i < 10)
@@ -1921,7 +1921,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff
if (spellProto->SpellIconID == 2135 && pVictim->GetTypeId() == TYPEID_PLAYER)
{
int32 remainingHealth = pVictim->GetHealth() - RemainingDamage;
uint32 allowedHealth = pVictim->GetMaxHealth() * 0.35f;
uint32 allowedHealth = uint32(pVictim->GetMaxHealth() * 0.35f);
// If damage kills us
if (remainingHealth <= 0 && !pVictim->ToPlayer()->HasSpellCooldown(66235))
{
@@ -1936,7 +1936,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff
? 1.0f
: float(defenseSkillValue) / float(reqDefForMaxHeal);
int32 healAmount = pVictim->GetMaxHealth() * (*i)->GetAmount() / 100.0f * pctFromDefense;
int32 healAmount = int32(pVictim->GetMaxHealth() * (*i)->GetAmount() / 100.0f * pctFromDefense);
pVictim->CastCustomSpell(pVictim, 66235, &healAmount, NULL, NULL, true);
pVictim->ToPlayer()->AddSpellCooldown(66235,0,time(NULL) + 120);
}
@@ -1991,7 +1991,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff
uint32 rank = sSpellMgr.GetSpellRank(spellProto->Id);
SpellEntry const * talentProto = sSpellStore.LookupEntry(sSpellMgr.GetSpellWithRank(49189, rank));
int32 minHp = (float)pVictim->GetMaxHealth() * (float)SpellMgr::CalculateSpellEffectAmount(talentProto, 0, (*i)->GetCaster()) / 100.0f;
int32 minHp = int32((float)pVictim->GetMaxHealth() * (float)SpellMgr::CalculateSpellEffectAmount(talentProto, 0, (*i)->GetCaster()) / 100.0f);
// Damage that would take you below [effect0] health or taken while you are at [effect0]
if (remainingHp < minHp)
{
@@ -7321,7 +7321,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
{
if (this->GetDistance(target) < 15.0f)
return false;
float chance = triggerAmount;
float chance = (float)triggerAmount;
if (!roll_chance_f(chance))
return false;
@@ -7335,7 +7335,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
if (procSpell->Id != 2484)
return false;
float chance = triggerAmount;
float chance = (float)triggerAmount;
if (!roll_chance_f(chance))
return false;
@@ -7374,18 +7374,18 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
return false;
// firehit = dummySpell->EffectBasePoints[0] / ((4*19.25) * 1.3);
float fire_onhit = dummySpell->EffectBasePoints[0] / 100.0;
float fire_onhit = dummySpell->EffectBasePoints[0] / 100.0f;
float add_spellpower = SpellBaseDamageBonus(SPELL_SCHOOL_MASK_FIRE)
+ SpellBaseDamageBonusForVictim(SPELL_SCHOOL_MASK_FIRE, pVictim);
float add_spellpower = (float)(SpellBaseDamageBonus(SPELL_SCHOOL_MASK_FIRE)
+ SpellBaseDamageBonusForVictim(SPELL_SCHOOL_MASK_FIRE, pVictim));
// 1.3speed = 5%, 2.6speed = 10%, 4.0 speed = 15%, so, 1.0speed = 3.84%
add_spellpower= add_spellpower / 100.0 * 3.84;
add_spellpower= add_spellpower / 100.0f * 3.84f;
// Enchant on Off-Hand and ready?
if (castItem->GetSlot() == EQUIPMENT_SLOT_OFFHAND && isAttackReady(OFF_ATTACK))
{
float BaseWeaponSpeed = GetAttackTime(OFF_ATTACK)/1000.0;
float BaseWeaponSpeed = GetAttackTime(OFF_ATTACK)/1000.0f;
// Value1: add the tooltip damage by swingspeed + Value2: add spelldmg by swingspeed
basepoints0 = int32((fire_onhit * BaseWeaponSpeed) + (add_spellpower * BaseWeaponSpeed));
@@ -7395,7 +7395,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Enchant on Main-Hand and ready?
else if (castItem->GetSlot() == EQUIPMENT_SLOT_MAINHAND && isAttackReady(BASE_ATTACK))
{
float BaseWeaponSpeed = GetAttackTime(BASE_ATTACK)/1000.0;
float BaseWeaponSpeed = GetAttackTime(BASE_ATTACK)/1000.0f;
// Value1: add the tooltip damage by swingspeed + Value2: add spelldmg by swingspeed
basepoints0 = int32((fire_onhit * BaseWeaponSpeed) + (add_spellpower * BaseWeaponSpeed));
@@ -7413,7 +7413,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
if (dummySpell->SpellIconID == 2287)
{
// Default chance for Healing Wave and Riptide
float chance = triggeredByAura->GetAmount();
float chance = (float)triggeredByAura->GetAmount();
if (procSpell->SpellFamilyFlags[0] & 0x80)
// Lesser Healing Wave - 0.6 of default
@@ -7748,7 +7748,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
else
continue;
basepoints0 = CalculateSpellDamage(this, procSpell,i) * 0.4f;
basepoints0 = int32(CalculateSpellDamage(this, procSpell,i) * 0.4f);
CastCustomSpell(this,triggered_spell_id,&basepoints0,NULL,NULL,true,NULL,triggeredByAura);
}
return true;
@@ -7837,7 +7837,7 @@ bool Unit::HandleObsModEnergyAuraProc(Unit *pVictim, uint32 /*damage*/, AuraEffe
if (dummySpell->SpellFamilyFlags[1] & 0x40000)
{
uint32 maxmana = GetMaxPower(POWER_MANA);
basepoints0 = maxmana* GetAttackTime(RANGED_ATTACK)/1000.0f/100.0f;
basepoints0 = uint32(maxmana* GetAttackTime(RANGED_ATTACK)/1000.0f/100.0f);
target = this;
triggered_spell_id = 34075;
break;
@@ -10408,8 +10408,8 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
continue;
float mod = pVictim->ToPlayer()->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE)*(-8.0f);
if (mod < (*i)->GetAmount())
mod = (*i)->GetAmount();
sumNegativeMod += mod;
mod = (float)(*i)->GetAmount();
sumNegativeMod += int32(mod);
}
break;
// Ebon Plague
@@ -10457,15 +10457,15 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
{
coeff = bonus->dot_damage;
if (bonus->ap_dot_bonus > 0)
DoneTotal += bonus->ap_dot_bonus * stack * ApCoeffMod * GetTotalAttackPowerValue(
(IsRangedWeaponSpell(spellProto) && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK);
DoneTotal += int32(bonus->ap_dot_bonus * stack * ApCoeffMod * GetTotalAttackPowerValue(
(IsRangedWeaponSpell(spellProto) && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK));
}
else
{
coeff = bonus->direct_damage;
if (bonus->ap_bonus > 0)
DoneTotal += bonus->ap_bonus * stack * ApCoeffMod * GetTotalAttackPowerValue(
(IsRangedWeaponSpell(spellProto) && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK);
DoneTotal += int32(bonus->ap_bonus * stack * ApCoeffMod * GetTotalAttackPowerValue(
(IsRangedWeaponSpell(spellProto) && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK));
}
}
// Default calculation
@@ -10529,14 +10529,14 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
float coeff2 = CalculateLevelPenalty(spellProto) * stack;
if (spellProto->SpellFamilyName) //TODO: fix this
TakenTotal+= TakenAdvertisedBenefit * coeff * coeff2;
TakenTotal+= int32(TakenAdvertisedBenefit * coeff * coeff2);
if (Player* modOwner = GetSpellModOwner())
{
coeff *= 100.0f;
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_SPELL_BONUS_DAMAGE, coeff);
coeff /= 100.0f;
}
DoneTotal += DoneAdvertisedBenefit * coeff * coeff2;
DoneTotal += int32(DoneAdvertisedBenefit * coeff * coeff2);
}
// Some spells don't benefit from done mods
@@ -10641,7 +10641,7 @@ bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM
crit_chance = GetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1 + GetFirstSchoolInMask(schoolMask));
else
{
crit_chance = m_baseSpellCritChance;
crit_chance = (float)m_baseSpellCritChance;
crit_chance += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, schoolMask);
}
// taken
@@ -10669,9 +10669,9 @@ bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM
switch((*i)->GetMiscValue())
{
// Shatter
case 911: modChance+= 16.0f;
case 910: modChance+= 17.0f;
case 849: modChance+= 17.0f;
case 911: modChance+= 16;
case 910: modChance+= 17;
case 849: modChance+= 17;
if (!pVictim->HasAuraState(AURA_STATE_FROZEN, spellProto, this))
break;
crit_chance+=modChance;
@@ -10967,15 +10967,15 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
{
coeff = bonus->dot_damage;
if (bonus->ap_dot_bonus > 0)
DoneTotal+=bonus->ap_dot_bonus * stack * GetTotalAttackPowerValue(
(IsRangedWeaponSpell(spellProto) && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK);
DoneTotal += int32(bonus->ap_dot_bonus * stack * GetTotalAttackPowerValue(
(IsRangedWeaponSpell(spellProto) && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK));
}
else
{
coeff = bonus->direct_damage;
if (bonus->ap_bonus > 0)
DoneTotal+=bonus->ap_bonus * stack * GetTotalAttackPowerValue(
(IsRangedWeaponSpell(spellProto) && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK);
DoneTotal += int32(bonus->ap_bonus * stack * GetTotalAttackPowerValue(
(IsRangedWeaponSpell(spellProto) && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK));
}
}
else // scripted bonus
@@ -10984,10 +10984,10 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
if (spellProto->SpellFamilyFlags[2] & 0x80000000 && spellProto->SpellIconID == 329)
{
scripted = true;
int32 apBonus = std::max(GetTotalAttackPowerValue(BASE_ATTACK), GetTotalAttackPowerValue(RANGED_ATTACK));
int32 apBonus = int32(std::max(GetTotalAttackPowerValue(BASE_ATTACK), GetTotalAttackPowerValue(RANGED_ATTACK)));
if (apBonus > DoneAdvertisedBenefit)
{
DoneTotal += apBonus * 0.2f;
DoneTotal += int32(apBonus * 0.2f);
coeff = 0.0f;
}
else
@@ -11060,14 +11060,14 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
}
factorMod *= CalculateLevelPenalty(spellProto)* stack;
TakenTotal += TakenAdvertisedBenefit * coeff * factorMod;
TakenTotal += int32(TakenAdvertisedBenefit * coeff * factorMod);
if (Player* modOwner = GetSpellModOwner())
{
coeff *= 100.0f;
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_SPELL_BONUS_DAMAGE, coeff);
coeff /= 100.0f;
}
DoneTotal += DoneAdvertisedBenefit * coeff * factorMod;
DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod);
}
// use float as more appropriate for negative values and percent applying
@@ -11101,22 +11101,22 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
// Healing taken percent
float minval = pVictim->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
float minval = (float)pVictim->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
if (minval)
TakenTotalMod *= (100.0f + minval) / 100.0f;
float maxval = pVictim->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
float maxval = (float)pVictim->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
if (maxval)
TakenTotalMod *= (100.0f + maxval) / 100.0f;
if (damagetype == DOT)
{
// Healing over time taken percent
float minval_hot = pVictim->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT);
float minval_hot = (float)pVictim->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT);
if (minval_hot)
TakenTotalMod *= (100.0f + minval_hot) / 100.0f;
float maxval_hot = pVictim->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT);
float maxval_hot = (float)pVictim->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT);
if (maxval_hot)
TakenTotalMod *= (100.0f + maxval_hot) / 100.0f;
}
@@ -11513,7 +11513,7 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage, WeaponAttackType att
continue;
float mod = pVictim->ToPlayer()->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE)*(-8.0f);
if (mod < (*i)->GetAmount())
mod = (*i)->GetAmount();
mod = (float)(*i)->GetAmount();
TakenTotalMod *= (mod+100.0f)/100.0f;
}
break;
@@ -11662,7 +11662,7 @@ float Unit::GetPPMProcChance(uint32 WeaponSpeed, float PPM, const SpellEntry * s
if (Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_PROC_PER_MINUTE,PPM);
return uint32((WeaponSpeed * PPM) / 600.0f); // result is chance in percents (probability = Speed_in_sec * (PPM / 60))
return floor((WeaponSpeed * PPM) / 600.0f); // result is chance in percents (probability = Speed_in_sec * (PPM / 60))
}
void Unit::Mount(uint32 mount, uint32 VehicleId)
@@ -12180,7 +12180,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
else // Use not mount (shapeshift for example) auras (should stack)
main_speed_mod = GetTotalAuraModifier(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED) + GetTotalAuraModifier(SPELL_AURA_MOD_INCREASE_VEHICLE_FLIGHT_SPEED);
non_stack_bonus = (100.0 + GetMaxPositiveAuraModifier(SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACK))/100.0f;
non_stack_bonus = (100.0f + GetMaxPositiveAuraModifier(SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACK))/100.0f;
// Update speed for vehicle if available
if (GetTypeId() == TYPEID_PLAYER && GetVehicle())
@@ -12234,7 +12234,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
if (slow)
{
speed *=(100.0f + slow)/100.0f;
if (float minSpeedMod = GetMaxPositiveAuraModifier(SPELL_AURA_MOD_MINIMUM_SPEED))
if (float minSpeedMod = (float)GetMaxPositiveAuraModifier(SPELL_AURA_MOD_MINIMUM_SPEED))
{
float min_speed = minSpeedMod / 100.0f;
if (speed < min_speed)
@@ -12945,30 +12945,30 @@ uint32 Unit::GetSpellMaxRangeForTarget(Unit* target,const SpellRangeEntry * rang
if (!rangeEntry)
return 0;
if (rangeEntry->maxRangeHostile == rangeEntry->maxRangeFriend)
return rangeEntry->maxRangeFriend;
return uint32(rangeEntry->maxRangeFriend);
if (IsHostileTo(target))
return rangeEntry->maxRangeHostile;
return rangeEntry->maxRangeFriend;
return uint32(rangeEntry->maxRangeHostile);
return uint32(rangeEntry->maxRangeFriend);
};
uint32 Unit::GetSpellMinRangeForTarget(Unit* target,const SpellRangeEntry * rangeEntry)
{
if (!rangeEntry)
return 0;
if (rangeEntry->minRangeHostile == rangeEntry->minRangeFriend)
return rangeEntry->minRangeFriend;
return uint32(rangeEntry->minRangeFriend);
if (IsHostileTo(target))
return rangeEntry->minRangeHostile;
return rangeEntry->minRangeFriend;
return uint32(rangeEntry->minRangeHostile);
return uint32(rangeEntry->minRangeFriend);
};
uint32 Unit::GetSpellRadiusForTarget(Unit* target,const SpellRadiusEntry * radiusEntry)
{
if (!radiusEntry)
return 0;
if (radiusEntry->radiusHostile == radiusEntry->radiusFriend)
return radiusEntry->radiusFriend;
return uint32(radiusEntry->radiusFriend);
if (IsHostileTo(target))
return radiusEntry->radiusHostile;
return radiusEntry->radiusFriend;
return uint32(radiusEntry->radiusHostile);
return uint32(radiusEntry->radiusFriend);
};
Unit* Unit::GetUnit(WorldObject& object, uint64 guid)
@@ -14869,9 +14869,9 @@ bool Unit::HandleAuraRaidProcFromChargeWithValue(AuraEffect *triggeredByAura)
{
float radius;
if (spellProto->EffectRadiusIndex[effIdx])
radius = GetSpellRadiusForTarget(triggeredByAura->GetCaster(), sSpellRadiusStore.LookupEntry(spellProto->EffectRadiusIndex[effIdx]));
radius = (float)GetSpellRadiusForTarget(triggeredByAura->GetCaster(), sSpellRadiusStore.LookupEntry(spellProto->EffectRadiusIndex[effIdx]));
else
radius = GetSpellMaxRangeForTarget(triggeredByAura->GetCaster(), sSpellRangeStore.LookupEntry(spellProto->rangeIndex));
radius = (float)GetSpellMaxRangeForTarget(triggeredByAura->GetCaster(), sSpellRangeStore.LookupEntry(spellProto->rangeIndex));
if (Unit * caster = triggeredByAura->GetCaster())
{
@@ -14930,9 +14930,9 @@ bool Unit::HandleAuraRaidProcFromCharge(AuraEffect* triggeredByAura)
{
float radius;
if (spellProto->EffectRadiusIndex[effIdx])
radius = GetSpellRadiusForTarget(triggeredByAura->GetCaster(), sSpellRadiusStore.LookupEntry(spellProto->EffectRadiusIndex[effIdx]));
radius = (float)GetSpellRadiusForTarget(triggeredByAura->GetCaster(), sSpellRadiusStore.LookupEntry(spellProto->EffectRadiusIndex[effIdx]));
else
radius = GetSpellMaxRangeForTarget(triggeredByAura->GetCaster() ,sSpellRangeStore.LookupEntry(spellProto->rangeIndex));
radius = (float)GetSpellMaxRangeForTarget(triggeredByAura->GetCaster() ,sSpellRangeStore.LookupEntry(spellProto->rangeIndex));
if (Unit * caster = triggeredByAura->GetCaster())
{
@@ -15905,9 +15905,9 @@ float Unit::MeleeSpellMissChance(const Unit *pVictim, WeaponAttackType attType,
else
HitChance = 93 - (leveldif - 2) * lchance;*/
if (spellId || attType == RANGED_ATTACK || !haveOffhandWeapon())
HitChance = 95.0f;
HitChance = 95;
else
HitChance = 76.0f;
HitChance = 76;
// Hit chance depends from victim auras
if (attType == RANGED_ATTACK)
@@ -15935,9 +15935,9 @@ float Unit::MeleeSpellMissChance(const Unit *pVictim, WeaponAttackType attType,
//miss_chance -= skillDiff * 0.04f;
int32 diff = -skillDiff;
if (pVictim->GetTypeId() == TYPEID_PLAYER)
miss_chance += diff > 0 ? diff * 0.04 : diff * 0.02;
miss_chance += diff > 0 ? diff * 0.04f : diff * 0.02f;
else
miss_chance += diff > 10 ? 2 + (diff - 10) * 0.4 : diff * 0.1;
miss_chance += diff > 10 ? 2 + (diff - 10) * 0.4f : diff * 0.1f;
// Limit miss chance from 0 to 60%
if (miss_chance < 0.0f)
@@ -16694,7 +16694,7 @@ void Unit::RewardRage(uint32 damage, uint32 weaponSpeedHitFactor, bool attacker)
{
float addRage;
float rageconversion = ((0.0091107836 * getLevel()*getLevel())+3.225598133*getLevel())+4.2652911;
float rageconversion = ((0.0091107836f * getLevel()*getLevel())+3.225598133f*getLevel())+4.2652911f;
// Unknown if correct, but lineary adjust rage conversion above level 70
if (getLevel() > 70)
@@ -16702,18 +16702,18 @@ void Unit::RewardRage(uint32 damage, uint32 weaponSpeedHitFactor, bool attacker)
if (attacker)
{
addRage = ((damage/rageconversion*7.5 + weaponSpeedHitFactor)/2);
addRage = ((damage/rageconversion*7.5f + weaponSpeedHitFactor)/2);
// talent who gave more rage on attack
addRage *= 1.0f + GetTotalAuraModifier(SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT) / 100.0f;
}
else
{
addRage = damage/rageconversion*2.5;
addRage = damage/rageconversion*2.5f;
// Berserker Rage effect
if (HasAura(18499))
addRage *= 2.0;
addRage *= 2.0f;
}
addRage *= sWorld.getRate(RATE_POWER_RAGE_INCOME);