explicit conversions of floats

This commit is contained in:
Arthur Dene Ice 2014-05-09 16:15:13 -07:00
parent ddcd496b1d
commit 689897ca39
6 changed files with 14 additions and 14 deletions

View File

@ -1276,7 +1276,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b
if(opts) {
damage *= (int)opts->damage_percent;
damage += opts->damage_flat;
hate *= opts->hate_percent;
hate = (uint32)(hate * opts->hate_percent);
hate += opts->hate_flat;
}
@ -1849,7 +1849,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
}
if(weapon->ElemDmgAmt){
eleBane += (weapon->ElemDmgAmt * other->ResistSpell(weapon->ElemDmgType, 0, this) / 100);
eleBane = (uint16)(eleBane + weapon->ElemDmgAmt * other->ResistSpell(weapon->ElemDmgType, 0, this) / 100);
}
}
@ -3832,7 +3832,7 @@ void Mob::HealDamage(uint32 amount, Mob *caster, uint16 spell_id)
if (caster && amount > 0) {
if (caster->IsNPC() && !caster->IsPet()) {
float npchealscale = caster->CastToNPC()->GetHealScale();
amount = (static_cast<float>(amount) * npchealscale) / 100.0f;
amount = (uint32)(amount * npchealscale) / 100.0f);
}
}

View File

@ -1405,7 +1405,7 @@ int32 Bot::GenerateBaseHitPoints()
if(level < 41)
{
new_base_hp = (5 + (GetLevel() * hp_factor / 12) + ((NormalSTA - SoDPost255) * GetLevel() * hp_factor / 3600));
new_base_hp = (int)(5 + (GetLevel() * hp_factor / 12) + ((NormalSTA - SoDPost255) * GetLevel() * hp_factor / 3600));
}
else if(level < 81)
{
@ -6550,9 +6550,9 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b
damage, min_hit, max_hit, GetSTR(), GetSkill(skillinuse), weapon_damage, GetLevel());
if(opts) {
damage *= opts->damage_percent;
damage = (int)(damage * opts->damage_percent);
damage += opts->damage_flat;
hate *= opts->hate_percent;
hate = (uint32)(hate * opts->hate_percent);
hate += opts->hate_flat;
}

View File

@ -447,7 +447,7 @@ int32 Client::GetActSpellCost(uint16 spell_id, int32 cost)
PercentManaReduction += MakeRandomFloat(1, (double)focus_redux);
}
cost -= (cost * (PercentManaReduction / 100));
cost = (int32)(cost -(cost * (PercentManaReduction / 100)));
// Gift of Mana - reduces spell cost to 1 mana
if(focus_redux >= 100) {

View File

@ -912,7 +912,7 @@ int32 Merc::CalcMaxHP() {
max_hp += GroupLeadershipAAHealthEnhancement();
max_hp += max_hp * ((spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000.0f);
max_hp = (int32)(max_hp + max_hp * ((spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000.0f));
if (cur_hp > max_hp)
cur_hp = max_hp;
@ -2943,7 +2943,7 @@ int32 Merc::GetActSpellCost(uint16 spell_id, int32 cost)
PercentManaReduction += MakeRandomFloat(1, (double)focus_redux);
}
cost -= (cost * (PercentManaReduction / 100));
cost = (int32)(cost - (cost * (PercentManaReduction / 100)));
// Gift of Mana - reduces spell cost to 1 mana
if(focus_redux >= 100) {
@ -4689,7 +4689,7 @@ void Merc::DoClassAttacks(Mob *target) {
}
}
classattack_timer.Start(reuse*HasteModifier/100);
classattack_timer.Start((uint32)(reuse*HasteModifier/1000));
}
bool Merc::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell, ExtraAttackOptions *opts)

View File

@ -271,9 +271,9 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower,
float scale_power = (float)act_power / 100.0f;
if(scale_power > 0)
{
npc_type->max_hp *= (1 + scale_power);
npc_type->max_hp = (int32)(npc_type->max_hp *(1 + scale_power));
npc_type->cur_hp = npc_type->max_hp;
npc_type->AC *= (1 + scale_power);
npc_type->AC = (int16)(npc_type->AC * (1 + scale_power));
npc_type->level += 1 + ((int)act_power / 25); // gains an additional level for every 25 pet power
npc_type->min_dmg = (npc_type->min_dmg * (1 + (scale_power / 2)));
npc_type->max_dmg = (npc_type->max_dmg * (1 + (scale_power / 2)));

View File

@ -917,8 +917,8 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Item
if(dobonus)
{
MaxDmg *= (float)2;
hate *= (float)2;
MaxDmg *= 2;
hate *= 2;
MaxDmg = mod_archery_bonus_damage(MaxDmg, RangeWeapon);
mlog(COMBAT__RANGED, "Ranger. Double damage success roll, doubling damage to %d", MaxDmg);