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

--HG--
branch : trunk
This commit is contained in:
silinoron
2010-08-22 12:39:39 -07:00
parent 399e35f8f5
commit 5cbae843d5
39 changed files with 378 additions and 380 deletions
@@ -451,7 +451,7 @@ int32 AuraEffect::CalculateAmount(Unit * caster)
m_canBeRecalculated = false;
if (!m_spellProto->procFlags)
break;
amount = GetBase()->GetUnitOwner()->GetMaxHealth()*0.10f;
amount = int32(GetBase()->GetUnitOwner()->GetMaxHealth()*0.10f);
if (caster)
{
// Glyphs increasing damage cap
@@ -630,7 +630,7 @@ int32 AuraEffect::CalculateAmount(Unit * caster)
{
m_canBeRecalculated = false;
// we're getting total damage on aura apply, change it to be damage per tick
amount = (float)amount / GetTotalTicks();
amount = int32((float)amount / GetTotalTicks());
}
break;
case SPELL_AURA_PERIODIC_ENERGIZE:
@@ -643,7 +643,7 @@ int32 AuraEffect::CalculateAmount(Unit * caster)
}
// Innervate
else if (m_spellProto->Id == 29166)
amount = GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA) * amount / (GetTotalTicks() * 100.0f);
amount = int32(GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA) * amount / (GetTotalTicks() * 100.0f));
// Owlkin Frenzy
else if (m_spellProto->Id == 48391)
amount = GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA) * amount / 100;
@@ -657,7 +657,7 @@ int32 AuraEffect::CalculateAmount(Unit * caster)
if (caster->GetTypeId() == TYPEID_PLAYER)
// Bonus from Glyph of Lightwell
if (AuraEffect* modHealing = caster->GetAuraEffect(55673, 0))
amount *= (100.0f + modHealing->GetAmount()) / 100.0f;
amount = int32(amount * (100.0f + modHealing->GetAmount()) / 100.0f);
}
break;
case SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN:
@@ -711,7 +711,7 @@ int32 AuraEffect::CalculateAmount(Unit * caster)
break;
}
if (level_diff > 0)
amount += multiplier * level_diff;
amount += int32(multiplier * level_diff);
break;
}
case SPELL_AURA_MOD_INCREASE_HEALTH:
@@ -806,7 +806,7 @@ void AuraEffect::CalculatePeriodic(Unit * caster, bool create)
caster->ModSpellCastTime(m_spellProto, m_amplitude);
// and periodic time of auras affected by SPELL_AURA_PERIODIC_HASTE
if (caster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, m_spellProto))
m_amplitude *= caster->GetFloatValue(UNIT_MOD_CAST_SPEED);
m_amplitude = int32(m_amplitude * caster->GetFloatValue(UNIT_MOD_CAST_SPEED));
}
}
@@ -1491,7 +1491,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
if (Player *modOwner = caster->GetSpellModOwner())
modOwner->ApplySpellMod(GetSpellProto()->Id, SPELLMOD_MULTIPLE_VALUE, multiplier);
damage *= multiplier;
damage = int32(damage * multiplier);
caster->DealHeal(target, damage, GetSpellProto());
break;
@@ -1522,20 +1522,20 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
TakenTotalMod *= (Tenacity->GetAmount() + 100.0f) / 100.0f;
// Healing taken percent
float minval = target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
float minval = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
if (minval)
TakenTotalMod *= (100.0f + minval) / 100.0f;
float maxval = target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
float maxval = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
if (maxval)
TakenTotalMod *= (100.0f + maxval) / 100.0f;
// Healing over time taken percent
float minval_hot = target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT);
float minval_hot = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT);
if (minval_hot)
TakenTotalMod *= (100.0f + minval_hot) / 100.0f;
float maxval_hot = target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT);
float maxval_hot = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT);
if (maxval_hot)
TakenTotalMod *= (100.0f + maxval_hot) / 100.0f;
@@ -1549,7 +1549,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
// Wild Growth = amount + (6 - 2*doneTicks) * ticks* amount / 100
if (m_spellProto->SpellFamilyName == SPELLFAMILY_DRUID && m_spellProto->SpellIconID == 2864)
{
damage += float(damage * GetTotalTicks()) * ((6-float(2*(GetTickNumber()-1)))/100);
damage += int32(float(damage * GetTotalTicks()) * ((6-float(2*(GetTickNumber()-1)))/100));
}
damage = caster->SpellHealingBonus(target, GetSpellProto(), damage, DOT, GetBase()->GetStackAmount());
@@ -1680,7 +1680,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
break;
case 32960: // Mark of Kazzak
int32 modifier = (target->GetPower(power) * 0.05f);
int32 modifier = int32(target->GetPower(power) * 0.05f);
target->ModifyPower(power, -modifier);
if (target->GetPower(power) == 0)
@@ -2159,7 +2159,7 @@ void AuraEffect::TriggerSpell(Unit * target, Unit * caster) const
return;
// Frost Blast
case 27808:
caster->CastCustomSpell(29879, SPELLVALUE_BASE_POINT0, (float)target->GetMaxHealth()*0.21f, target, true, NULL, this);
caster->CastCustomSpell(29879, SPELLVALUE_BASE_POINT0, int32((float)target->GetMaxHealth()*0.21f), target, true, NULL, this);
return;
// Detonate Mana
case 27819:
@@ -2363,21 +2363,20 @@ void AuraEffect::TriggerSpell(Unit * target, Unit * caster) const
case 65923:
if (caster->HasAura(66193))
{
if (Unit* permafrostCaster = caster->GetAura(66193)->GetCaster())
if (permafrostCaster->ToCreature())
permafrostCaster->ToCreature()->ForcedDespawn(3000);
caster->CastSpell(caster,66181,false);
if (Unit *permafrostCaster = caster->GetAura(66193)->GetCaster())
if (Creature *permafrostCasterAsCreature = permafrostCaster->ToCreature())
permafrostCasterAsCreature->ForcedDespawn(3000);
caster->CastSpell(caster, 66181, false);
caster->RemoveAllAuras();
if (caster->ToCreature())
caster->ToCreature()->DisappearAndDie();
if (Creature *casterAsCreature = caster->ToCreature())
casterAsCreature->DisappearAndDie();
}
break;
// Mana Tide
case 16191:
{
target->CastCustomSpell(triggerTarget, triggerSpellId, &m_amount, NULL, NULL, true, NULL, this);
return;
}
// Negative Energy Periodic
case 46284:
caster->CastCustomSpell(triggerSpellId, SPELLVALUE_MAX_TARGETS, m_tickNumber / 10 + 1, NULL, true, NULL, this);
@@ -3272,7 +3271,7 @@ void AuraEffect::HandleAuraModScale(AuraApplication const * aurApp, uint8 mode,
Unit * target = aurApp->GetTarget();
target->ApplyPercentModFloatValue(OBJECT_FIELD_SCALE_X,GetAmount(),apply);
target->ApplyPercentModFloatValue(OBJECT_FIELD_SCALE_X,(float)GetAmount(),apply);
}
void AuraEffect::HandleAuraCloneCaster(AuraApplication const * aurApp, uint8 mode, bool apply) const
@@ -3875,7 +3874,7 @@ void AuraEffect::HandleModThreat(AuraApplication const * aurApp, uint8 mode, boo
if (target->GetTypeId() == TYPEID_PLAYER)
for (int8 x=0; x < MAX_SPELL_SCHOOL; x++)
if (GetMiscValue() & int32(1<<x))
ApplyPercentModFloatVar(target->m_threatModifier[x], GetAmount(), apply);
ApplyPercentModFloatVar(target->m_threatModifier[x], (float)GetAmount(), apply);
}
void AuraEffect::HandleAuraModTotalThreat(AuraApplication const * aurApp, uint8 mode, bool apply) const
@@ -3892,7 +3891,7 @@ void AuraEffect::HandleAuraModTotalThreat(AuraApplication const * aurApp, uint8
if (!caster || !caster->isAlive())
return;
target->getHostileRefManager().addTempThreat(GetAmount(), apply);
target->getHostileRefManager().addTempThreat((float)GetAmount(), apply);
}
void AuraEffect::HandleModTaunt(AuraApplication const * aurApp, uint8 mode, bool apply) const
@@ -4449,7 +4448,7 @@ void AuraEffect::HandleAuraModResistanceExclusive(AuraApplication const * aurApp
{
target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_VALUE, float(GetAmount()), apply);
if (target->GetTypeId() == TYPEID_PLAYER)
target->ApplyResistanceBuffModsMod(SpellSchools(x),aurApp->IsPositive(),GetAmount(), apply);
target->ApplyResistanceBuffModsMod(SpellSchools(x),aurApp->IsPositive(),(float)GetAmount(), apply);
}
}
}
@@ -4467,7 +4466,7 @@ void AuraEffect::HandleAuraModResistance(AuraApplication const * aurApp, uint8 m
{
target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), TOTAL_VALUE, float(GetAmount()), apply);
if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->isPet())
target->ApplyResistanceBuffModsMod(SpellSchools(x),GetAmount() > 0,GetAmount(), apply);
target->ApplyResistanceBuffModsMod(SpellSchools(x),GetAmount() > 0,(float)GetAmount(), apply);
}
}
}
@@ -4510,8 +4509,8 @@ void AuraEffect::HandleModResistancePercent(AuraApplication const * aurApp, uint
target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_PCT, float(GetAmount()), apply);
if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->isPet())
{
target->ApplyResistanceBuffModsPercentMod(SpellSchools(i),true,GetAmount(), apply);
target->ApplyResistanceBuffModsPercentMod(SpellSchools(i),false,GetAmount(), apply);
target->ApplyResistanceBuffModsPercentMod(SpellSchools(i),true,(float)GetAmount(), apply);
target->ApplyResistanceBuffModsPercentMod(SpellSchools(i),false,(float)GetAmount(), apply);
}
}
}
@@ -4582,7 +4581,7 @@ void AuraEffect::HandleAuraModStat(AuraApplication const * aurApp, uint8 mode, b
//target->ApplyStatMod(Stats(i), m_amount,apply);
target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(GetAmount()), apply);
if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->isPet())
target->ApplyStatBuffMod(Stats(i),GetAmount(),apply);
target->ApplyStatBuffMod(Stats(i),(float)GetAmount(),apply);
}
}
}
@@ -4708,13 +4707,14 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const * aurApp, uint8
{
target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(GetAmount()), apply);
if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->isPet())
target->ApplyStatPercentBuffMod(Stats(i), GetAmount(), apply);
target->ApplyStatPercentBuffMod(Stats(i), (float)GetAmount(), apply);
}
}
//recalculate current HP/MP after applying aura modifications (only for spells with 0x10 flag)
if ((GetMiscValue() == STAT_STAMINA) && (maxHPValue > 0) && (m_spellProto->Attributes & 0x10))
{
// hmm... why is newHPValue a uint64 here?
// newHP = (curHP / maxHP) * newMaxHP = (newMaxHP * curHP) / maxHP -> which is better because no int -> double -> int conversion is needed
uint64 newHPValue = (target->GetMaxHealth() * curHPValue) / maxHPValue;
target->SetHealth(newHPValue);
@@ -5098,7 +5098,7 @@ void AuraEffect::HandleModCastingSpeed(AuraApplication const * aurApp, uint8 mod
Unit * target = aurApp->GetTarget();
target->ApplyCastTimePercentMod(GetAmount(),apply);
target->ApplyCastTimePercentMod((float)GetAmount(),apply);
}
void AuraEffect::HandleModMeleeRangedSpeedPct(AuraApplication const * aurApp, uint8 mode, bool apply) const
@@ -5108,9 +5108,9 @@ void AuraEffect::HandleModMeleeRangedSpeedPct(AuraApplication const * aurApp, ui
Unit * target = aurApp->GetTarget();
target->ApplyAttackTimePercentMod(BASE_ATTACK,GetAmount(),apply);
target->ApplyAttackTimePercentMod(OFF_ATTACK,GetAmount(),apply);
target->ApplyAttackTimePercentMod(RANGED_ATTACK, GetAmount(), apply);
target->ApplyAttackTimePercentMod(BASE_ATTACK,(float)GetAmount(),apply);
target->ApplyAttackTimePercentMod(OFF_ATTACK,(float)GetAmount(),apply);
target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply);
}
void AuraEffect::HandleModCombatSpeedPct(AuraApplication const * aurApp, uint8 mode, bool apply) const
@@ -5120,10 +5120,10 @@ void AuraEffect::HandleModCombatSpeedPct(AuraApplication const * aurApp, uint8 m
Unit * target = aurApp->GetTarget();
target->ApplyCastTimePercentMod(m_amount,apply);
target->ApplyAttackTimePercentMod(BASE_ATTACK,GetAmount(),apply);
target->ApplyAttackTimePercentMod(OFF_ATTACK,GetAmount(),apply);
target->ApplyAttackTimePercentMod(RANGED_ATTACK, GetAmount(), apply);
target->ApplyCastTimePercentMod(float(m_amount),apply);
target->ApplyAttackTimePercentMod(BASE_ATTACK,float(GetAmount()),apply);
target->ApplyAttackTimePercentMod(OFF_ATTACK,float(GetAmount()),apply);
target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(GetAmount()), apply);
}
void AuraEffect::HandleModAttackSpeed(AuraApplication const * aurApp, uint8 mode, bool apply) const
@@ -5133,7 +5133,7 @@ void AuraEffect::HandleModAttackSpeed(AuraApplication const * aurApp, uint8 mode
Unit * target = aurApp->GetTarget();
target->ApplyAttackTimePercentMod(BASE_ATTACK,GetAmount(),apply);
target->ApplyAttackTimePercentMod(BASE_ATTACK, (float)GetAmount(), apply);
target->UpdateDamagePhysical(BASE_ATTACK);
}
@@ -5144,9 +5144,9 @@ void AuraEffect::HandleHaste(AuraApplication const * aurApp, uint8 mode, bool ap
Unit * target = aurApp->GetTarget();
target->ApplyAttackTimePercentMod(BASE_ATTACK, GetAmount(),apply);
target->ApplyAttackTimePercentMod(OFF_ATTACK, GetAmount(),apply);
target->ApplyAttackTimePercentMod(RANGED_ATTACK,GetAmount(),apply);
target->ApplyAttackTimePercentMod(BASE_ATTACK, (float)GetAmount(), apply);
target->ApplyAttackTimePercentMod(OFF_ATTACK, (float)GetAmount(), apply);
target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply);
}
void AuraEffect::HandleAuraModRangedHaste(AuraApplication const * aurApp, uint8 mode, bool apply) const
@@ -5156,7 +5156,7 @@ void AuraEffect::HandleAuraModRangedHaste(AuraApplication const * aurApp, uint8
Unit * target = aurApp->GetTarget();
target->ApplyAttackTimePercentMod(RANGED_ATTACK, GetAmount(), apply);
target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply);
}
void AuraEffect::HandleRangedAmmoHaste(AuraApplication const * aurApp, uint8 mode, bool apply) const
@@ -5169,7 +5169,7 @@ void AuraEffect::HandleRangedAmmoHaste(AuraApplication const * aurApp, uint8 mod
if (target->GetTypeId() != TYPEID_PLAYER)
return;
target->ApplyAttackTimePercentMod(RANGED_ATTACK, GetAmount(), apply);
target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply);
}
/********************************/
+2 -2
View File
@@ -1226,13 +1226,13 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
// effect on caster
if (AuraEffect const * aurEff = aura->GetEffect(0))
{
float multiplier = aurEff->GetAmount();
float multiplier = (float)aurEff->GetAmount();
if (aurEff->GetId() == 47535)
multiplier -= 0.5f;
else if (aurEff->GetId() == 47537)
multiplier += 0.5f;
int32 basepoints0 = (multiplier * caster->GetMaxPower(POWER_MANA) / 100);
int32 basepoints0 = int32(multiplier * caster->GetMaxPower(POWER_MANA) / 100);
caster->CastCustomSpell(caster, 47755, &basepoints0, NULL, NULL, true);
}
// effect on aura target
+43 -43
View File
@@ -1546,7 +1546,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
// and duration of auras affected by SPELL_AURA_PERIODIC_HASTE
if (m_originalCaster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, aurSpellInfo))
duration *= m_originalCaster->GetFloatValue(UNIT_MOD_CAST_SPEED);
duration = int32(duration * m_originalCaster->GetFloatValue(UNIT_MOD_CAST_SPEED));
if (duration != m_spellAura->GetMaxDuration())
{
@@ -2028,7 +2028,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
{
float min_dis = GetSpellMinRange(m_spellInfo, true);
float max_dis = GetSpellMaxRange(m_spellInfo, true);
float dis = rand_norm() * (max_dis - min_dis) + min_dis;
float dis = (float)rand_norm() * (max_dis - min_dis) + min_dis;
float x, y, z;
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE, dis);
m_targets.setDst(x, y, z, m_caster->GetOrientation());
@@ -2192,21 +2192,21 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
if (dist < objSize)
dist = objSize;
else if (cur == TARGET_DEST_CASTER_RANDOM)
dist = objSize + (dist - objSize) * rand_norm();
dist = objSize + (dist - objSize) * (float)rand_norm();
switch(cur)
{
case TARGET_DEST_CASTER_FRONT_LEFT: angle = -M_PI/4; break;
case TARGET_DEST_CASTER_BACK_LEFT: angle = -3*M_PI/4; break;
case TARGET_DEST_CASTER_BACK_RIGHT: angle = 3*M_PI/4; break;
case TARGET_DEST_CASTER_FRONT_RIGHT:angle = M_PI/4; break;
case TARGET_DEST_CASTER_FRONT_LEFT: angle = static_cast<float>(-M_PI/4); break;
case TARGET_DEST_CASTER_BACK_LEFT: angle = static_cast<float>(-3*M_PI/4); break;
case TARGET_DEST_CASTER_BACK_RIGHT: angle = static_cast<float>(3*M_PI/4); break;
case TARGET_DEST_CASTER_FRONT_RIGHT:angle = static_cast<float>(M_PI/4); break;
case TARGET_MINION:
case TARGET_DEST_CASTER_FRONT_LEAP:
case TARGET_DEST_CASTER_FRONT: angle = 0.0f; break;
case TARGET_DEST_CASTER_BACK: angle = M_PI; break;
case TARGET_DEST_CASTER_RIGHT: angle = M_PI/2; break;
case TARGET_DEST_CASTER_LEFT: angle = -M_PI/2; break;
default: angle = rand_norm()*2*M_PI; break;
case TARGET_DEST_CASTER_FRONT: angle = 0.0f; break;
case TARGET_DEST_CASTER_BACK: angle = static_cast<float>(M_PI); break;
case TARGET_DEST_CASTER_RIGHT: angle = static_cast<float>(M_PI/2); break;
case TARGET_DEST_CASTER_LEFT: angle = static_cast<float>(-M_PI/2); break;
default: angle = (float)rand_norm()*static_cast<float>(2*M_PI); break;
}
Position pos;
@@ -2237,23 +2237,23 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
float angle, dist;
float objSize = target->GetObjectSize();
dist = target->GetSpellRadiusForTarget(target, sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
dist = (float)target->GetSpellRadiusForTarget(target, sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
if (dist < objSize)
dist = objSize;
else if (cur == TARGET_DEST_CASTER_RANDOM)
dist = objSize + (dist - objSize) * rand_norm();
dist = objSize + (dist - objSize) * (float)rand_norm();
switch(cur)
{
case TARGET_DEST_TARGET_FRONT: angle = 0.0f; break;
case TARGET_DEST_TARGET_BACK: angle = M_PI; break;
case TARGET_DEST_TARGET_RIGHT: angle = M_PI/2; break;
case TARGET_DEST_TARGET_LEFT: angle = -M_PI/2; break;
case TARGET_DEST_TARGET_FRONT_LEFT: angle = -M_PI/4; break;
case TARGET_DEST_TARGET_BACK_LEFT: angle = -3*M_PI/4; break;
case TARGET_DEST_TARGET_BACK_RIGHT: angle = 3*M_PI/4; break;
case TARGET_DEST_TARGET_FRONT_RIGHT:angle = M_PI/4; break;
default: angle = rand_norm()*2*M_PI; break;
case TARGET_DEST_TARGET_FRONT: angle = 0.0f; break;
case TARGET_DEST_TARGET_BACK: angle = static_cast<float>(M_PI); break;
case TARGET_DEST_TARGET_RIGHT: angle = static_cast<float>(M_PI/2); break;
case TARGET_DEST_TARGET_LEFT: angle = static_cast<float>(-M_PI/2); break;
case TARGET_DEST_TARGET_FRONT_LEFT: angle = static_cast<float>(-M_PI/4); break;
case TARGET_DEST_TARGET_BACK_LEFT: angle = static_cast<float>(-3*M_PI/4); break;
case TARGET_DEST_TARGET_BACK_RIGHT: angle = static_cast<float>(3*M_PI/4); break;
case TARGET_DEST_TARGET_FRONT_RIGHT:angle = static_cast<float>(M_PI/4); break;
default: angle = (float)rand_norm()*static_cast<float>(2*M_PI); break;
}
Position pos;
@@ -2282,21 +2282,21 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
case TARGET_DEST_TRAJ:
SelectTrajTargets();
return;
case TARGET_DEST_DEST_FRONT: angle = 0.0f; break;
case TARGET_DEST_DEST_BACK: angle = M_PI; break;
case TARGET_DEST_DEST_RIGHT: angle = M_PI/2; break;
case TARGET_DEST_DEST_LEFT: angle = -M_PI/2; break;
case TARGET_DEST_DEST_FRONT_LEFT: angle = -M_PI/4; break;
case TARGET_DEST_DEST_BACK_LEFT: angle = -3*M_PI/4; break;
case TARGET_DEST_DEST_BACK_RIGHT: angle = 3*M_PI/4; break;
case TARGET_DEST_DEST_FRONT_RIGHT:angle = M_PI/4; break;
default: angle = rand_norm()*2*M_PI; break;
case TARGET_DEST_DEST_FRONT: angle = 0.0f; break;
case TARGET_DEST_DEST_BACK: angle = static_cast<float>(M_PI); break;
case TARGET_DEST_DEST_RIGHT: angle = static_cast<float>(M_PI/2); break;
case TARGET_DEST_DEST_LEFT: angle = static_cast<float>(-M_PI/2); break;
case TARGET_DEST_DEST_FRONT_LEFT: angle = static_cast<float>(-M_PI/4); break;
case TARGET_DEST_DEST_BACK_LEFT: angle = static_cast<float>(-3*M_PI/4); break;
case TARGET_DEST_DEST_BACK_RIGHT: angle = static_cast<float>(3*M_PI/4); break;
case TARGET_DEST_DEST_FRONT_RIGHT:angle = static_cast<float>(M_PI/4); break;
default: angle = (float)rand_norm()*static_cast<float>(2*M_PI); break;
}
float dist;
dist = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
if (cur == TARGET_DEST_DEST_RANDOM || cur == TARGET_DEST_DEST_RANDOM_DIR_DIST)
dist *= rand_norm();
dist *= (float)rand_norm();
// must has dst, no need to set flag
Position pos = m_targets.m_dstPos;
@@ -4592,7 +4592,7 @@ void Spell::TakeRunePower()
}
// you can gain some runic power when use runes
float rp = src->runePowerGain;
float rp = (float)src->runePowerGain;
rp *= sWorld.getRate(RATE_POWER_RUNICPOWER_INCOME);
plr->ModifyPower(POWER_RUNIC_POWER, (int32)rp);
}
@@ -4956,7 +4956,7 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_TARGET_AURASTATE;
//Must be behind the target.
if (m_spellInfo->AttributesEx2 == 0x100000 && (m_spellInfo->AttributesEx & 0x200) == 0x200 && target->HasInArc(M_PI, m_caster)
if (m_spellInfo->AttributesEx2 == 0x100000 && (m_spellInfo->AttributesEx & 0x200) == 0x200 && target->HasInArc(static_cast<float>(M_PI), m_caster)
//Exclusion for Pounce: Facing Limitation was removed in 2.0.1, but it still uses the same, old Ex-Flags
&& (!(m_spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && m_spellInfo->SpellFamilyFlags.IsEqual(0x20000,0,0)))
//Mutilate no longer requires you be behind the target as of patch 3.0.3
@@ -4969,7 +4969,7 @@ SpellCastResult Spell::CheckCast(bool strict)
}
//Target must be facing you.
if ((m_spellInfo->Attributes == 0x150010) && !target->HasInArc(M_PI, m_caster))
if ((m_spellInfo->Attributes == 0x150010) && !target->HasInArc(static_cast<float>(M_PI), m_caster))
{
SendInterrupted(2);
return SPELL_FAILED_NOT_INFRONT;
@@ -5190,7 +5190,7 @@ SpellCastResult Spell::CheckCast(bool strict)
{
// spell different for friends and enemies
// hurt version required facing
if (m_targets.getUnitTarget() && !m_caster->IsFriendlyTo(m_targets.getUnitTarget()) && !m_caster->HasInArc(M_PI, m_targets.getUnitTarget()))
if (m_targets.getUnitTarget() && !m_caster->IsFriendlyTo(m_targets.getUnitTarget()) && !m_caster->HasInArc(static_cast<float>(M_PI), m_targets.getUnitTarget()))
return SPELL_FAILED_UNIT_NOT_INFRONT;
}
else if (m_spellInfo->SpellIconID == 33 && m_spellInfo->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_SHAMAN_FIRE_NOVA)
@@ -5932,8 +5932,8 @@ SpellCastResult Spell::CheckRange(bool strict)
SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex);
Unit *target = m_targets.getUnitTarget();
float max_range = m_caster->GetSpellMaxRangeForTarget(target, srange);
float min_range = m_caster->GetSpellMinRangeForTarget(target, srange);
float max_range = (float)m_caster->GetSpellMaxRangeForTarget(target, srange);
float min_range = (float)m_caster->GetSpellMinRangeForTarget(target, srange);
uint32 range_type = GetSpellRangeType(srange);
if (Player* modOwner = m_caster->GetSpellModOwner())
@@ -5959,7 +5959,7 @@ SpellCastResult Spell::CheckRange(bool strict)
return SPELL_FAILED_TOO_CLOSE;
if (m_caster->GetTypeId() == TYPEID_PLAYER &&
(m_spellInfo->FacingCasterFlags & SPELL_FACING_FLAG_INFRONT) && !m_caster->HasInArc(M_PI, target))
(m_spellInfo->FacingCasterFlags & SPELL_FACING_FLAG_INFRONT) && !m_caster->HasInArc(static_cast<float>(M_PI), target))
return SPELL_FAILED_UNIT_NOT_INFRONT;
}
@@ -7030,9 +7030,9 @@ int32 Spell::CalculateDamageDone(Unit *unit, const uint32 effectMask, float *mul
{
if (IsAreaEffectTarget[m_spellInfo->EffectImplicitTargetA[i]] || IsAreaEffectTarget[m_spellInfo->EffectImplicitTargetB[i]])
{
m_damage = float(m_damage) * unit->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, m_spellInfo->SchoolMask);
m_damage = int32(float(m_damage) * unit->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, m_spellInfo->SchoolMask));
if (m_caster->GetTypeId() == TYPEID_UNIT)
m_damage = float(m_damage) * unit->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE, m_spellInfo->SchoolMask);
m_damage = int32(float(m_damage) * unit->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE, m_spellInfo->SchoolMask));
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
@@ -7044,7 +7044,7 @@ int32 Spell::CalculateDamageDone(Unit *unit, const uint32 effectMask, float *mul
}
if (m_applyMultiplierMask & (1 << i))
{
m_damage *= m_damageMultipliers[i];
m_damage = int32(m_damage * m_damageMultipliers[i]);
m_damageMultipliers[i] *= multiplier[i];
}
+2 -2
View File
@@ -784,11 +784,11 @@ namespace Trinity
i_data->push_back(target);
break;
case PUSH_IN_FRONT:
if (i_source->isInFront(target, i_radius, M_PI/2))
if (i_source->isInFront(target, i_radius, static_cast<float>(M_PI/2)))
i_data->push_back(target);
break;
case PUSH_IN_BACK:
if (i_source->isInBack(target, i_radius, M_PI/2))
if (i_source->isInBack(target, i_radius, static_cast<float>(M_PI/2)))
i_data->push_back(target);
break;
case PUSH_IN_LINE:
+20 -20
View File
@@ -712,7 +712,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
damage += int32(dmg_min);
else
damage += irand(int32(dmg_min), int32(dmg_max));
damage += m_caster->ToPlayer()->GetAmmoDPS()*item->GetProto()->Delay*0.001f;
damage += int32(m_caster->ToPlayer()->GetAmmoDPS()*item->GetProto()->Delay*0.001f);
}
}
}
@@ -737,14 +737,14 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
else if (m_spellInfo->Id == 20187)
{
float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
float sp = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo));
float sp = (float)m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo));
damage += int32(0.2f*ap + 0.32f*sp);
}
// Judgement of Wisdom, Light, Justice
else if (m_spellInfo->Id == 54158)
{
float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
float sp = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo));
float sp = (float)m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo));
damage += int32(0.14f*ap + 0.22f*sp);
}
break;
@@ -1281,7 +1281,7 @@ void Spell::EffectDummy(uint32 i)
if (!unitTarget && unitTarget->GetEntry() != 26452 && ((unitTarget->GetHealth() / unitTarget->GetMaxHealth()) * 100.0f) > 95.0f)
return;
m_caster->DealDamage(unitTarget, unitTarget->GetMaxHealth()*0.93f);
m_caster->DealDamage(unitTarget, uint32(unitTarget->GetMaxHealth()*0.93f));
return;
}
case 49357: // Brewfest Mount Transformation
@@ -1556,8 +1556,8 @@ void Spell::EffectDummy(uint32 i)
case 27222:
case 57946: spFactor = 0.5f; break;
}
int32 damage = m_spellInfo->EffectBasePoints[0] + (6.3875 * m_spellInfo->baseLevel);
int32 mana = damage + (m_caster->ToPlayer()->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+SPELL_SCHOOL_SHADOW) * spFactor);
int32 damage = int32(m_spellInfo->EffectBasePoints[0] + (6.3875 * m_spellInfo->baseLevel));
int32 mana = int32(damage + (m_caster->ToPlayer()->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+SPELL_SCHOOL_SHADOW) * spFactor));
if (unitTarget && (int32(unitTarget->GetHealth()) > damage))
{
@@ -1693,10 +1693,10 @@ void Spell::EffectDummy(uint32 i)
if (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_DK_DEATH_STRIKE)
{
uint32 count = unitTarget->GetDiseasesByCaster(m_caster->GetGUID());
int32 bp = count * m_caster->GetMaxHealth() * m_spellInfo->DmgMultiplier[0] / 100;
int32 bp = int32(count * m_caster->GetMaxHealth() * m_spellInfo->DmgMultiplier[0] / 100);
// Improved Death Strike
if (AuraEffect const * aurEff = m_caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, 2751, 0))
bp = bp * (m_caster->CalculateSpellDamage(m_caster, aurEff->GetSpellProto(), 2) + 100.0f) / 100.0f;
bp = int32(bp * (m_caster->CalculateSpellDamage(m_caster, aurEff->GetSpellProto(), 2) + 100.0f) / 100.0f);
m_caster->CastCustomSpell(m_caster, 45470, &bp, NULL, NULL, false);
return;
}
@@ -1705,7 +1705,7 @@ void Spell::EffectDummy(uint32 i)
{
if (m_caster->IsFriendlyTo(unitTarget))
{
int32 bp = damage * 1.5f;
int32 bp = int32(damage * 1.5f);
m_caster->CastCustomSpell(unitTarget, 47633, &bp, NULL, NULL, true);
}
else
@@ -2564,7 +2564,7 @@ void Spell::SpellDamageHeal(uint32 /*i*/)
addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, addhealth, HEAL);
if (AuraEffect * aurEff = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_SHAMAN, 0, 0, 0x10, m_originalCasterGUID))
{
addhealth *= 1.25f;
addhealth = int32(addhealth * 1.25f);
// consume aura
unitTarget->RemoveAura(aurEff->GetBase());
}
@@ -2598,7 +2598,7 @@ void Spell::EffectHealPct(uint32 /*i*/)
if (m_spellInfo->Id == 59754 && unitTarget == m_caster)
return;
uint32 addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, unitTarget->GetMaxHealth() * damage / 100.0f, HEAL);
uint32 addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, uint32(unitTarget->GetMaxHealth() * damage / 100.0f), HEAL);
//if (Player *modOwner = m_caster->GetSpellModOwner())
// modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DAMAGE, addhealth, this);
@@ -3665,7 +3665,7 @@ void Spell::EffectTeleUnitsFaceCaster(uint32 i)
if (unitTarget->isInFlight())
return;
float dis = m_caster->GetSpellRadiusForTarget(unitTarget, sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
float dis = (float)m_caster->GetSpellRadiusForTarget(unitTarget, sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
float fx,fy,fz;
m_caster->GetClosePoint(fx,fy,fz,unitTarget->GetObjectSize(),dis);
@@ -4137,7 +4137,7 @@ void Spell::EffectTaunt(uint32 /*i*/)
if (m_spellInfo->Id == 62124)
{
int32 damageDone = 1 + m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.5f;
int32 damageDone = int32(1 + m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.5f);
m_caster->DealDamage(unitTarget, damageDone, NULL, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_HOLY, m_spellInfo, false);
m_caster->SendSpellNonMeleeDamageLog(unitTarget, m_spellInfo->Id, damageDone, SPELL_SCHOOL_MASK_HOLY, 0, 0, false, false, false);
}
@@ -4776,7 +4776,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
case 54426:
if (unitTarget)
{
int32 damage = (int32)unitTarget->GetHealth() - (int32)unitTarget->GetMaxHealth() * 0.05f;
int32 damage = int32((int32)unitTarget->GetHealth() - (int32)unitTarget->GetMaxHealth() * 0.05f);
if (damage > 0)
m_caster->CastCustomSpell(28375, SPELLVALUE_BASE_POINT0, damage, unitTarget);
}
@@ -6175,7 +6175,7 @@ void Spell::EffectAddExtraAttacks(uint32 /*i*/)
// attack prevented
// fixme, some attacks may not target current victim, this is right now not handled
if (!victim || !unitTarget->IsWithinMeleeRange(victim) || !unitTarget->HasInArc(2*M_PI/3, victim))
if (!victim || !unitTarget->IsWithinMeleeRange(victim) || !unitTarget->HasInArc(static_cast<float>(2*M_PI/3), victim))
return;
// Only for proc/log informations
@@ -6228,7 +6228,7 @@ void Spell::EffectReputation(uint32 i)
if (RepRewardRate const * repData = sObjectMgr.GetRepRewardRate(faction_id))
{
rep_change = (float)rep_change * repData->spell_rate;
rep_change = int32((float)rep_change * repData->spell_rate);
}
_player->GetReputationMgr().ModifyReputation(factionEntry, rep_change);
@@ -6468,8 +6468,8 @@ void Spell::EffectPullTowards(uint32 i)
if (!unitTarget)
return;
float speedZ = m_spellInfo->EffectBasePoints[i]/10;
float speedXY = m_spellInfo->EffectMiscValue[i]/10;
float speedZ = (float)(m_spellInfo->EffectBasePoints[i]/10);
float speedXY = (float)(m_spellInfo->EffectMiscValue[i]/10);
Position pos;
if (m_spellInfo->Effect[i] == SPELL_EFFECT_PULL_TOWARDS_DEST)
{
@@ -6652,7 +6652,7 @@ void Spell::EffectTransmitted(uint32 effIndex)
//GO is always friendly to it's creator, get range for friends
float min_dis = GetSpellMinRangeForFriend(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex));
float max_dis = GetSpellMaxRangeForFriend(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex));
float dis = rand_norm() * (max_dis - min_dis) + min_dis;
float dis = (float)rand_norm() * (max_dis - min_dis) + min_dis;
m_caster->GetClosePoint(fx, fy, fz, DEFAULT_WORLD_OBJECT_SIZE, dis);
}
@@ -7195,7 +7195,7 @@ void Spell::GetSummonPosition(uint32 i, Position &pos, float radius, uint32 coun
{
case TARGET_MINION:
case TARGET_DEST_CASTER_RANDOM:
m_caster->GetNearPosition(pos, radius * rand_norm(), rand_norm()*2*M_PI);
m_caster->GetNearPosition(pos, radius * (float)rand_norm(), (float)rand_norm()*static_cast<float>(2*M_PI));
break;
case TARGET_DEST_DEST_RANDOM:
case TARGET_DEST_TARGET_RANDOM: