Core/Game: fix all warnings related to converting doubles and floats.
--HG-- branch : trunk
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/********************************/
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user