Core/Game: fix all warnings related to converting doubles and floats.
--HG-- branch : trunk
This commit is contained in:
@@ -159,7 +159,7 @@ m_formation(NULL)
|
||||
DisableReputationGain = false;
|
||||
//m_unit_movement_flags = MONSTER_MOVE_WALK;
|
||||
|
||||
m_SightDistance = sWorld.getConfig(CONFIG_SIGHT_MONSTER);
|
||||
m_SightDistance = (float)sWorld.getConfig(CONFIG_SIGHT_MONSTER);
|
||||
m_CombatDistance = 0;//MELEE_RANGE;
|
||||
|
||||
ResetLootMode(); // restore default loot mode
|
||||
@@ -383,7 +383,7 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data)
|
||||
|
||||
SetMeleeDamageSchool(SpellSchools(cInfo->dmgschool));
|
||||
CreatureBaseStats const* stats = sObjectMgr.GetCreatureBaseStats(getLevel(), cInfo->unit_class);
|
||||
float armor = stats->GenerateArmor(cInfo); // TODO: Why is this treated as uint32 when it's a float?
|
||||
float armor = (float)stats->GenerateArmor(cInfo); // TODO: Why is this treated as uint32 when it's a float?
|
||||
SetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE, armor);
|
||||
SetModifierValue(UNIT_MOD_RESISTANCE_HOLY, BASE_VALUE, float(cInfo->resistance1));
|
||||
SetModifierValue(UNIT_MOD_RESISTANCE_FIRE, BASE_VALUE, float(cInfo->resistance2));
|
||||
@@ -618,7 +618,7 @@ void Creature::RegenerateMana()
|
||||
AuraEffectList const& ModPowerRegenPCTAuras = GetAuraEffectsByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
|
||||
for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
|
||||
if ((*i)->GetMiscValue() == POWER_MANA)
|
||||
addvalue *= ((*i)->GetAmount() + 100) / 100.0f;
|
||||
addvalue = uint32(addvalue * ((*i)->GetAmount() + 100) / 100.0f);
|
||||
|
||||
addvalue += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, POWER_MANA) * CREATURE_REGEN_INTERVAL / (5 * IN_MILLISECONDS);
|
||||
|
||||
@@ -655,7 +655,7 @@ void Creature::RegenerateHealth()
|
||||
// Apply modifiers (if any).
|
||||
AuraEffectList const& ModPowerRegenPCTAuras = GetAuraEffectsByType(SPELL_AURA_MOD_HEALTH_REGEN_PERCENT);
|
||||
for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
|
||||
addvalue *= ((*i)->GetAmount() + 100) / 100.0f;
|
||||
addvalue = uint32(addvalue * ((*i)->GetAmount() + 100) / 100.0f);
|
||||
|
||||
addvalue += GetTotalAuraModifier(SPELL_AURA_MOD_REGEN) * CREATURE_REGEN_INTERVAL / (5 * IN_MILLISECONDS);
|
||||
|
||||
@@ -670,7 +670,7 @@ void Creature::DoFleeToGetAssistance()
|
||||
if (HasAuraType(SPELL_AURA_PREVENTS_FLEEING))
|
||||
return;
|
||||
|
||||
float radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS);
|
||||
float radius = (float)sWorld.getConfig(CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS);
|
||||
if (radius >0)
|
||||
{
|
||||
Creature* pCreature = NULL;
|
||||
@@ -1112,8 +1112,8 @@ void Creature::SelectLevel(const CreatureInfo *cinfo)
|
||||
|
||||
// TODO: set UNIT_FIELD_POWER*, for some creature class case (energy, etc)
|
||||
|
||||
SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, health);
|
||||
SetModifierValue(UNIT_MOD_MANA, BASE_VALUE, mana);
|
||||
SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, (float)health);
|
||||
SetModifierValue(UNIT_MOD_MANA, BASE_VALUE, (float)mana);
|
||||
|
||||
//damage
|
||||
float damagemod = 1.0f;//_GetDamageMod(rank);
|
||||
@@ -1418,7 +1418,7 @@ bool Creature::canStartAttack(Unit const* who, bool force) const
|
||||
|
||||
if (who->isInCombat())
|
||||
if (Unit *victim = who->getAttackerForHelper())
|
||||
if (IsWithinDistInMap(victim, sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS)))
|
||||
if (IsWithinDistInMap(victim, (float)sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS)))
|
||||
force = true;
|
||||
|
||||
if (!force && (IsNeutralToAll() || !IsWithinDistInMap(who, GetAttackDistance(who) + m_CombatDistance)))
|
||||
@@ -1861,7 +1861,7 @@ void Creature::CallAssistance()
|
||||
{
|
||||
SetNoCallAssistance(true);
|
||||
|
||||
float radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS);
|
||||
float radius = (float)sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS);
|
||||
|
||||
if (radius > 0)
|
||||
{
|
||||
|
||||
@@ -352,7 +352,7 @@ void GameObject::Update(uint32 diff)
|
||||
bool IsBattlegroundTrap = false;
|
||||
//FIXME: this is activation radius (in different casting radius that must be selected from spell data)
|
||||
//TODO: move activated state code (cast itself) to GO_ACTIVATED, in this place only check activating and set state
|
||||
float radius = (goInfo->trap.radius)/2; // TODO rename radius to diameter (goInfo->trap.radius) should be (goInfo->trap.diameter)
|
||||
float radius = (float)(goInfo->trap.radius)/2; // TODO rename radius to diameter (goInfo->trap.radius) should be (goInfo->trap.diameter)
|
||||
if (!radius)
|
||||
{
|
||||
if (goInfo->trap.cooldown != 3) // cast in other case (at some triggering/linked go/etc explicit call)
|
||||
@@ -362,7 +362,7 @@ void GameObject::Update(uint32 diff)
|
||||
if (m_respawnTime > 0)
|
||||
break;
|
||||
|
||||
radius = goInfo->trap.cooldown; // battlegrounds gameobjects has data2 == 0 && data5 == 3
|
||||
radius = (float)goInfo->trap.cooldown; // battlegrounds gameobjects has data2 == 0 && data5 == 3
|
||||
IsBattlegroundTrap = true;
|
||||
|
||||
if (!radius)
|
||||
@@ -899,7 +899,7 @@ void GameObject::TriggeringLinkedGameObject(uint32 trapEntry, Unit* target)
|
||||
else
|
||||
{
|
||||
if (Unit *owner = GetOwner())
|
||||
range = owner->GetSpellMaxRangeForTarget(target, srentry);
|
||||
range = (float)owner->GetSpellMaxRangeForTarget(target, srentry);
|
||||
else
|
||||
//if no owner assume that object is hostile to target
|
||||
range = GetSpellMaxRangeForHostile(srentry);
|
||||
@@ -1230,7 +1230,7 @@ void GameObject::Use(Unit* user)
|
||||
int32 chance;
|
||||
if (skill < zone_skill)
|
||||
{
|
||||
chance = pow((double)skill/zone_skill,2) * 100;
|
||||
chance = int32(pow((double)skill/zone_skill,2) * 100);
|
||||
if (chance < 1)
|
||||
chance = 1;
|
||||
}
|
||||
@@ -1732,8 +1732,8 @@ void GameObject::UpdateRotationFields(float rotation2 /*=0.0f*/, float rotation3
|
||||
|
||||
if (rotation2 == 0.0f && rotation3 == 0.0f)
|
||||
{
|
||||
rotation2 = f_rot1;
|
||||
rotation3 = f_rot2;
|
||||
rotation2 = (float)f_rot1;
|
||||
rotation3 = (float)f_rot2;
|
||||
}
|
||||
|
||||
SetFloatValue(GAMEOBJECT_PARENTROTATION+2, rotation2);
|
||||
|
||||
@@ -1479,7 +1479,7 @@ void Position::GetSinCos(const float x, const float y, float &vsin, float &vcos)
|
||||
|
||||
if (dx < 0.001f && dy < 0.001f)
|
||||
{
|
||||
float angle = rand_norm()*2*M_PI;
|
||||
float angle = (float)rand_norm()*static_cast<float>(2*M_PI);
|
||||
vcos = cos(angle);
|
||||
vsin = sin(angle);
|
||||
}
|
||||
@@ -1547,8 +1547,8 @@ void WorldObject::GetRandomPoint(const Position &pos, float distance, float &ran
|
||||
}
|
||||
|
||||
// angle to face `obj` to `this`
|
||||
float angle = rand_norm()*2*M_PI;
|
||||
float new_dist = rand_norm()*distance;
|
||||
float angle = (float)rand_norm()*static_cast<float>(2*M_PI);
|
||||
float new_dist = (float)rand_norm()*static_cast<float>(distance);
|
||||
|
||||
rand_x = pos.m_positionX + new_dist * cos(angle);
|
||||
rand_y = pos.m_positionY + new_dist * sin(angle);
|
||||
@@ -1575,21 +1575,21 @@ void WorldObject::MonsterSay(const char* text, uint32 language, uint64 TargetGui
|
||||
{
|
||||
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
||||
BuildMonsterChat(&data,CHAT_MSG_MONSTER_SAY,text,language,GetName(),TargetGuid);
|
||||
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY),true);
|
||||
SendMessageToSetInRange(&data,(float)sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY),true);
|
||||
}
|
||||
|
||||
void WorldObject::MonsterYell(const char* text, uint32 language, uint64 TargetGuid)
|
||||
{
|
||||
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
||||
BuildMonsterChat(&data,CHAT_MSG_MONSTER_YELL,text,language,GetName(),TargetGuid);
|
||||
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL),true);
|
||||
SendMessageToSetInRange(&data,(float)sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL),true);
|
||||
}
|
||||
|
||||
void WorldObject::MonsterTextEmote(const char* text, uint64 TargetGuid, bool IsBossEmote)
|
||||
{
|
||||
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
||||
BuildMonsterChat(&data,IsBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE,text,LANG_UNIVERSAL,GetName(),TargetGuid);
|
||||
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE),true);
|
||||
SendMessageToSetInRange(&data,(float)sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE),true);
|
||||
}
|
||||
|
||||
void WorldObject::MonsterWhisper(const char* text, uint64 receiver, bool IsBossWhisper)
|
||||
@@ -1661,9 +1661,9 @@ void WorldObject::MonsterSay(int32 textId, uint32 language, uint64 TargetGuid)
|
||||
|
||||
Trinity::MonsterChatBuilder say_build(*this, CHAT_MSG_MONSTER_SAY, textId,language,TargetGuid);
|
||||
Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> say_do(say_build);
|
||||
Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> > say_worker(this,sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY),say_do);
|
||||
Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> > say_worker(this,(float)sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY),say_do);
|
||||
TypeContainerVisitor<Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> >, WorldTypeMapContainer > message(say_worker);
|
||||
cell.Visit(p, message, *GetMap(), *this, sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY));
|
||||
cell.Visit(p, message, *GetMap(), *this, (float)sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY));
|
||||
}
|
||||
|
||||
void WorldObject::MonsterYell(int32 textId, uint32 language, uint64 TargetGuid)
|
||||
@@ -1676,9 +1676,9 @@ void WorldObject::MonsterYell(int32 textId, uint32 language, uint64 TargetGuid)
|
||||
|
||||
Trinity::MonsterChatBuilder say_build(*this, CHAT_MSG_MONSTER_YELL, textId,language,TargetGuid);
|
||||
Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> say_do(say_build);
|
||||
Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> > say_worker(this,sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL),say_do);
|
||||
Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> > say_worker(this,(float)sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL),say_do);
|
||||
TypeContainerVisitor<Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> >, WorldTypeMapContainer > message(say_worker);
|
||||
cell.Visit(p, message, *GetMap(), *this, sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL));
|
||||
cell.Visit(p, message, *GetMap(), *this, (float)sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL));
|
||||
}
|
||||
|
||||
void WorldObject::MonsterYellToZone(int32 textId, uint32 language, uint64 TargetGuid)
|
||||
@@ -1704,9 +1704,9 @@ void WorldObject::MonsterTextEmote(int32 textId, uint64 TargetGuid, bool IsBossE
|
||||
|
||||
Trinity::MonsterChatBuilder say_build(*this, IsBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE, textId,LANG_UNIVERSAL,TargetGuid);
|
||||
Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> say_do(say_build);
|
||||
Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> > say_worker(this,sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE),say_do);
|
||||
Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> > say_worker(this,(float)sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE),say_do);
|
||||
TypeContainerVisitor<Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> >, WorldTypeMapContainer > message(say_worker);
|
||||
cell.Visit(p, message, *GetMap(), *this, sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE));
|
||||
cell.Visit(p, message, *GetMap(), *this, (float)sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE));
|
||||
}
|
||||
|
||||
void WorldObject::MonsterWhisper(int32 textId, uint64 receiver, bool IsBossWhisper)
|
||||
|
||||
@@ -573,7 +573,7 @@ class WorldObject : public Object, public WorldLocation
|
||||
void GetRandomNearPosition(Position &pos, float radius)
|
||||
{
|
||||
GetPosition(&pos);
|
||||
MovePosition(pos, radius * rand_norm(), rand_norm() * 2 * M_PI);
|
||||
MovePosition(pos, radius * (float)rand_norm(), (float)rand_norm() * static_cast<float>(2 * M_PI));
|
||||
}
|
||||
|
||||
void GetContactPoint(const WorldObject* obj, float &x, float &y, float &z, float distance2d = CONTACT_DISTANCE) const
|
||||
|
||||
@@ -715,7 +715,7 @@ void Pet::GivePetXP(uint32 xp)
|
||||
// Subtract newXP from amount needed for nextlevel
|
||||
newXP -= nextLvlXP;
|
||||
GivePetLevel(level+1);
|
||||
SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, sObjectMgr.GetXPForLevel(level+1)*PET_XP_FACTOR);
|
||||
SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, uint32(sObjectMgr.GetXPForLevel(level+1)*PET_XP_FACTOR));
|
||||
|
||||
// Make sure we're working with the upgraded levels for the pet XP-levels
|
||||
level = getLevel();
|
||||
@@ -801,7 +801,7 @@ bool Pet::CreateBaseAtTamed(CreatureInfo const * cinfo, Map * map, uint32 phaseM
|
||||
setPowerType(POWER_FOCUS);
|
||||
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, 0);
|
||||
SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0);
|
||||
SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, sObjectMgr.GetXPForLevel(getLevel()+1)*PET_XP_FACTOR);
|
||||
SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, uint32(sObjectMgr.GetXPForLevel(getLevel()+1)*PET_XP_FACTOR));
|
||||
SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
|
||||
|
||||
if (cinfo->type == CREATURE_TYPE_BEAST)
|
||||
@@ -927,7 +927,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
|
||||
}
|
||||
case HUNTER_PET:
|
||||
{
|
||||
SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, sObjectMgr.GetXPForLevel(petlevel)*PET_XP_FACTOR);
|
||||
SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, uint32(sObjectMgr.GetXPForLevel(petlevel)*PET_XP_FACTOR));
|
||||
//these formula may not be correct; however, it is designed to be close to what it should be
|
||||
//this makes dps 0.5 of pets level
|
||||
SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4)));
|
||||
@@ -943,7 +943,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
|
||||
case 510: // mage Water Elemental
|
||||
{
|
||||
//40% damage bonus of mage's frost damage
|
||||
float val = m_owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FROST) * 0.4;
|
||||
float val = m_owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FROST) * 0.4f;
|
||||
if (val < 0)
|
||||
val = 0;
|
||||
SetBonusDamage(int32(val));
|
||||
|
||||
@@ -1394,7 +1394,7 @@ void Player::Update(uint32 p_time)
|
||||
int time_inn = time(NULL)-GetTimeInnEnter();
|
||||
if (time_inn >= 10) // freeze update
|
||||
{
|
||||
float bubble = 0.125*sWorld.getRate(RATE_REST_INGAME);
|
||||
float bubble = 0.125f*sWorld.getRate(RATE_REST_INGAME);
|
||||
// speed collect rest bonus (section/in hour)
|
||||
SetRestBonus(GetRestBonus()+ time_inn*((float)GetUInt32Value(PLAYER_NEXT_LEVEL_XP)/72000)*bubble);
|
||||
UpdateInnerTime(time(NULL));
|
||||
@@ -2309,7 +2309,7 @@ void Player::RegenerateHealth()
|
||||
|
||||
// polymorphed case
|
||||
if (IsPolymorphed())
|
||||
addvalue = GetMaxHealth()/3;
|
||||
addvalue = (float)GetMaxHealth()/3;
|
||||
// normal regen case (maybe partly in combat case)
|
||||
else if (!isInCombat() || HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT))
|
||||
{
|
||||
@@ -2625,7 +2625,7 @@ void Player::GiveXP(uint32 xp, Unit *victim, float group_rate)
|
||||
float favored_exp_mult = 0;
|
||||
if ((HasAura(32096) || HasAura(32098)) && (zone == 3483 || zone == 3562 || zone == 3836 || zone == 3713 || zone == 3714))
|
||||
favored_exp_mult = 0.05f; // Thrallmar's Favor and Honor Hold's Favor
|
||||
xp *= (1 + favored_exp_mult);
|
||||
xp = uint32(xp * (1 + favored_exp_mult));
|
||||
// Favored experience increase END
|
||||
|
||||
// XP to money conversion processed in Player::RewardQuest
|
||||
@@ -5044,7 +5044,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
|
||||
uint32 dmultiplier = dcost->multiplier[ItemSubClassToDurabilityMultiplierId(ditemProto->Class,ditemProto->SubClass)];
|
||||
uint32 costs = uint32(LostDurability*dmultiplier*double(dQualitymodEntry->quality_mod));
|
||||
|
||||
costs = uint32(costs * discountMod) * sWorld.getRate(RATE_REPAIRCOST);
|
||||
costs = uint32(costs * discountMod * sWorld.getRate(RATE_REPAIRCOST));
|
||||
|
||||
if (costs == 0) //fix for ITEM_QUALITY_ARTIFACT
|
||||
costs = 1;
|
||||
@@ -6732,7 +6732,7 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, int32 honor, bool pvpt
|
||||
return true;
|
||||
|
||||
// Promote to float for calculations
|
||||
float honor_f = honor;
|
||||
float honor_f = (float)honor;
|
||||
|
||||
if (honor_f <= 0)
|
||||
{
|
||||
@@ -6807,7 +6807,7 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, int32 honor, bool pvpt
|
||||
|
||||
honor_f *= sWorld.getRate(RATE_HONOR);
|
||||
// Back to int now
|
||||
honor = honor_f;
|
||||
honor = int32(honor_f);
|
||||
// honor - for show honor points in log
|
||||
// victim_guid - for show victim name in log
|
||||
// victim_rank [1..4] HK: <dishonored rank>
|
||||
@@ -7845,7 +7845,7 @@ void Player::CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32
|
||||
if (m_extraAttacks && IsSpellHaveEffect(spellInfo, SPELL_EFFECT_ADD_EXTRA_ATTACKS))
|
||||
return;
|
||||
|
||||
float chance = spellInfo->procChance;
|
||||
float chance = (float)spellInfo->procChance;
|
||||
|
||||
if (spellData.SpellPPMRate)
|
||||
{
|
||||
@@ -7915,7 +7915,7 @@ void Player::CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32
|
||||
if (entry->PPMChance)
|
||||
chance = GetPPMProcChance(proto->Delay, entry->PPMChance, spellInfo);
|
||||
else if (entry->customChance)
|
||||
chance = entry->customChance;
|
||||
chance = (float)entry->customChance;
|
||||
}
|
||||
|
||||
// Apply spell mods
|
||||
@@ -13110,27 +13110,27 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool
|
||||
case ITEM_MOD_AGILITY:
|
||||
sLog.outDebug("+ %u AGILITY",enchant_amount);
|
||||
HandleStatModifier(UNIT_MOD_STAT_AGILITY, TOTAL_VALUE, float(enchant_amount), apply);
|
||||
ApplyStatBuffMod(STAT_AGILITY, enchant_amount, apply);
|
||||
ApplyStatBuffMod(STAT_AGILITY, (float)enchant_amount, apply);
|
||||
break;
|
||||
case ITEM_MOD_STRENGTH:
|
||||
sLog.outDebug("+ %u STRENGTH",enchant_amount);
|
||||
HandleStatModifier(UNIT_MOD_STAT_STRENGTH, TOTAL_VALUE, float(enchant_amount), apply);
|
||||
ApplyStatBuffMod(STAT_STRENGTH, enchant_amount, apply);
|
||||
ApplyStatBuffMod(STAT_STRENGTH, (float)enchant_amount, apply);
|
||||
break;
|
||||
case ITEM_MOD_INTELLECT:
|
||||
sLog.outDebug("+ %u INTELLECT",enchant_amount);
|
||||
HandleStatModifier(UNIT_MOD_STAT_INTELLECT, TOTAL_VALUE, float(enchant_amount), apply);
|
||||
ApplyStatBuffMod(STAT_INTELLECT, enchant_amount, apply);
|
||||
ApplyStatBuffMod(STAT_INTELLECT, (float)enchant_amount, apply);
|
||||
break;
|
||||
case ITEM_MOD_SPIRIT:
|
||||
sLog.outDebug("+ %u SPIRIT",enchant_amount);
|
||||
HandleStatModifier(UNIT_MOD_STAT_SPIRIT, TOTAL_VALUE, float(enchant_amount), apply);
|
||||
ApplyStatBuffMod(STAT_SPIRIT, enchant_amount, apply);
|
||||
ApplyStatBuffMod(STAT_SPIRIT, (float)enchant_amount, apply);
|
||||
break;
|
||||
case ITEM_MOD_STAMINA:
|
||||
sLog.outDebug("+ %u STAMINA",enchant_amount);
|
||||
HandleStatModifier(UNIT_MOD_STAT_STAMINA, TOTAL_VALUE, float(enchant_amount), apply);
|
||||
ApplyStatBuffMod(STAT_STAMINA, enchant_amount, apply);
|
||||
ApplyStatBuffMod(STAT_STAMINA, (float)enchant_amount, apply);
|
||||
break;
|
||||
case ITEM_MOD_DEFENSE_SKILL_RATING:
|
||||
ApplyRatingMod(CR_DEFENSE_SKILL, enchant_amount, apply);
|
||||
@@ -15961,7 +15961,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
uint32 transGUID = fields[30].GetUInt32();
|
||||
Relocate(fields[12].GetFloat(),fields[13].GetFloat(),fields[14].GetFloat(),fields[16].GetFloat());
|
||||
uint32 mapId = fields[15].GetUInt32();
|
||||
uint32 instanceId = fields[58].GetFloat();
|
||||
uint32 instanceId = fields[58].GetUInt32();
|
||||
|
||||
uint32 dungeonDiff = fields[38].GetUInt32() & 0x0F;
|
||||
if (dungeonDiff >= MAX_DUNGEON_DIFFICULTY)
|
||||
@@ -18625,7 +18625,7 @@ void Player::Say(const std::string& text, const uint32 language)
|
||||
|
||||
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
||||
BuildPlayerChat(&data, CHAT_MSG_SAY, text, language);
|
||||
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY),true);
|
||||
SendMessageToSetInRange(&data,(float)sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY),true);
|
||||
}
|
||||
|
||||
void Player::Yell(const std::string& text, const uint32 language)
|
||||
@@ -18634,7 +18634,7 @@ void Player::Yell(const std::string& text, const uint32 language)
|
||||
|
||||
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
||||
BuildPlayerChat(&data, CHAT_MSG_YELL, text, language);
|
||||
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL),true);
|
||||
SendMessageToSetInRange(&data,(float)sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL),true);
|
||||
}
|
||||
|
||||
void Player::TextEmote(const std::string& text)
|
||||
@@ -18643,7 +18643,7 @@ void Player::TextEmote(const std::string& text)
|
||||
|
||||
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
||||
BuildPlayerChat(&data, CHAT_MSG_EMOTE, text, LANG_UNIVERSAL);
|
||||
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE),true, !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT));
|
||||
SendMessageToSetInRange(&data,(float)sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE),true, !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT));
|
||||
}
|
||||
|
||||
void Player::Whisper(const std::string& text, uint32 language,uint64 receiver)
|
||||
@@ -19154,7 +19154,7 @@ void Player::SetRestBonus (float rest_bonus_new)
|
||||
if (rest_bonus_new < 0)
|
||||
rest_bonus_new = 0;
|
||||
|
||||
float rest_bonus_max = (float)GetUInt32Value(PLAYER_NEXT_LEVEL_XP)*1.5/2;
|
||||
float rest_bonus_max = (float)GetUInt32Value(PLAYER_NEXT_LEVEL_XP)*1.5f/2;
|
||||
|
||||
if (rest_bonus_new > rest_bonus_max)
|
||||
m_rest_bonus = rest_bonus_max;
|
||||
|
||||
@@ -657,20 +657,20 @@ void Player::UpdateArmorPenetration(int32 amount)
|
||||
|
||||
void Player::UpdateMeleeHitChances()
|
||||
{
|
||||
m_modMeleeHitChance = GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
|
||||
m_modMeleeHitChance+= GetRatingBonusValue(CR_HIT_MELEE);
|
||||
m_modMeleeHitChance = (float)GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
|
||||
m_modMeleeHitChance += GetRatingBonusValue(CR_HIT_MELEE);
|
||||
}
|
||||
|
||||
void Player::UpdateRangedHitChances()
|
||||
{
|
||||
m_modRangedHitChance = GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
|
||||
m_modRangedHitChance+= GetRatingBonusValue(CR_HIT_RANGED);
|
||||
m_modRangedHitChance = (float)GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
|
||||
m_modRangedHitChance += GetRatingBonusValue(CR_HIT_RANGED);
|
||||
}
|
||||
|
||||
void Player::UpdateSpellHitChances()
|
||||
{
|
||||
m_modSpellHitChance = GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
|
||||
m_modSpellHitChance+= GetRatingBonusValue(CR_HIT_SPELL);
|
||||
m_modSpellHitChance = (float)GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
|
||||
m_modSpellHitChance += GetRatingBonusValue(CR_HIT_SPELL);
|
||||
}
|
||||
|
||||
void Player::UpdateAllSpellCritChances()
|
||||
@@ -1249,16 +1249,16 @@ void Guardian::UpdateDamagePhysical(WeaponAttackType attType)
|
||||
{
|
||||
case HAPPY:
|
||||
// 125% of normal damage
|
||||
mindamage = mindamage * 1.25;
|
||||
maxdamage = maxdamage * 1.25;
|
||||
mindamage = mindamage * 1.25f;
|
||||
maxdamage = maxdamage * 1.25f;
|
||||
break;
|
||||
case CONTENT:
|
||||
// 100% of normal damage, nothing to modify
|
||||
break;
|
||||
case UNHAPPY:
|
||||
// 75% of normal damage
|
||||
mindamage = mindamage * 0.75;
|
||||
maxdamage = maxdamage * 0.75;
|
||||
mindamage = mindamage * 0.75f;
|
||||
maxdamage = maxdamage * 0.75f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1976,7 +1976,7 @@ class Unit : public WorldObject
|
||||
|
||||
void RewardRage(uint32 damage, uint32 weaponSpeedHitFactor, bool attacker);
|
||||
|
||||
virtual float GetFollowAngle() const { return M_PI/2; }
|
||||
virtual float GetFollowAngle() const { return static_cast<float>(M_PI/2); }
|
||||
|
||||
void OutDebugInfo() const;
|
||||
virtual bool isBeingLoaded() const { return false;}
|
||||
|
||||
Reference in New Issue
Block a user