mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-06 13:02:59 +00:00
# This is a combination of 4 commits.
# The first commit's message is: const float to int16 explicit conversion # This is the 2nd commit message: float to int explicit conversion # This is the 3rd commit message: Explicit conversion float to int32 # This is the 4th commit message: double to float explicit conversion float to int explicit conversion float to int explicit conversion
This commit is contained in:
parent
a49ffc47ec
commit
6bb833aae2
@ -562,13 +562,13 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit, ExtraAttac
|
||||
armor = CastToNPC()->GetRawAC();
|
||||
|
||||
if (!IsPet())
|
||||
armor = (armor / RuleR(Combat, NPCACFactor));
|
||||
armor = (int)(armor / RuleR(Combat, NPCACFactor));
|
||||
|
||||
armor += spellbonuses.AC + itembonuses.AC + 1;
|
||||
}
|
||||
|
||||
if (opts) {
|
||||
armor *= (1.0f - opts->armor_pen_percent);
|
||||
armor *= (int)(1.0f - opts->armor_pen_percent);
|
||||
armor -= opts->armor_pen_flat;
|
||||
}
|
||||
|
||||
@ -595,41 +595,41 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit, ExtraAttac
|
||||
int softcap_armor = (int)(armor - softcap);
|
||||
if (RuleB(Combat, OldACSoftcapRules)) {
|
||||
if (GetClass() == WARRIOR)
|
||||
softcap_armor = softcap_armor * RuleR(Combat, WarriorACSoftcapReturn);
|
||||
softcap_armor = (int)(softcap_armor * RuleR(Combat, WarriorACSoftcapReturn));
|
||||
else if (GetClass() == SHADOWKNIGHT || GetClass() == PALADIN ||
|
||||
(GetClass() == MONK && weight <= monkweight))
|
||||
softcap_armor = softcap_armor * RuleR(Combat, KnightACSoftcapReturn);
|
||||
softcap_armor = (int)(softcap_armor * RuleR(Combat, KnightACSoftcapReturn));
|
||||
else if (GetClass() == CLERIC || GetClass() == BARD ||
|
||||
GetClass() == BERSERKER || GetClass() == ROGUE ||
|
||||
GetClass() == SHAMAN || GetClass() == MONK)
|
||||
softcap_armor = softcap_armor * RuleR(Combat, LowPlateChainACSoftcapReturn);
|
||||
softcap_armor = (int)(softcap_armor * RuleR(Combat, LowPlateChainACSoftcapReturn));
|
||||
else if (GetClass() == RANGER || GetClass() == BEASTLORD)
|
||||
softcap_armor = softcap_armor * RuleR(Combat, LowChainLeatherACSoftcapReturn);
|
||||
softcap_armor = (int)(softcap_armor * RuleR(Combat, LowChainLeatherACSoftcapReturn));
|
||||
else if (GetClass() == WIZARD || GetClass() == MAGICIAN ||
|
||||
GetClass() == NECROMANCER || GetClass() == ENCHANTER ||
|
||||
GetClass() == DRUID)
|
||||
softcap_armor = softcap_armor * RuleR(Combat, CasterACSoftcapReturn);
|
||||
softcap_armor = (int)(softcap_armor * RuleR(Combat, CasterACSoftcapReturn));
|
||||
else
|
||||
softcap_armor = softcap_armor * RuleR(Combat, MiscACSoftcapReturn);
|
||||
softcap_armor = (int)(softcap_armor * RuleR(Combat, MiscACSoftcapReturn));
|
||||
} else {
|
||||
if (GetClass() == WARRIOR)
|
||||
softcap_armor *= RuleR(Combat, WarACSoftcapReturn);
|
||||
softcap_armor *= (int)RuleR(Combat, WarACSoftcapReturn);
|
||||
else if (GetClass() == PALADIN || GetClass() == SHADOWKNIGHT)
|
||||
softcap_armor *= RuleR(Combat, PalShdACSoftcapReturn);
|
||||
softcap_armor *= (int)RuleR(Combat, PalShdACSoftcapReturn);
|
||||
else if (GetClass() == CLERIC || GetClass() == RANGER ||
|
||||
GetClass() == MONK || GetClass() == BARD)
|
||||
softcap_armor *= RuleR(Combat, ClrRngMnkBrdACSoftcapReturn);
|
||||
softcap_armor *= (int)RuleR(Combat, ClrRngMnkBrdACSoftcapReturn);
|
||||
else if (GetClass() == DRUID || GetClass() == NECROMANCER ||
|
||||
GetClass() == WIZARD || GetClass() == ENCHANTER ||
|
||||
GetClass() == MAGICIAN)
|
||||
softcap_armor *= RuleR(Combat, DruNecWizEncMagACSoftcapReturn);
|
||||
softcap_armor *= (int)RuleR(Combat, DruNecWizEncMagACSoftcapReturn);
|
||||
else if (GetClass() == ROGUE || GetClass() == SHAMAN ||
|
||||
GetClass() == BEASTLORD || GetClass() == BERSERKER)
|
||||
softcap_armor *= RuleR(Combat, RogShmBstBerACSoftcapReturn);
|
||||
softcap_armor *= (int)RuleR(Combat, RogShmBstBerACSoftcapReturn);
|
||||
else
|
||||
softcap_armor *= RuleR(Combat, MiscACSoftcapReturn);
|
||||
softcap_armor *= (int)RuleR(Combat, MiscACSoftcapReturn);
|
||||
}
|
||||
armor = softcap + softcap_armor;
|
||||
armor = (int)(softcap + softcap_armor);
|
||||
}
|
||||
|
||||
if (GetClass() == WIZARD || GetClass() == MAGICIAN ||
|
||||
@ -655,7 +655,7 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit, ExtraAttac
|
||||
// use serverop variables to set values
|
||||
int myac = GetAC();
|
||||
if(opts) {
|
||||
myac *= (1.0f - opts->armor_pen_percent);
|
||||
myac *= (int)(1.0f - opts->armor_pen_percent);
|
||||
myac -= opts->armor_pen_flat;
|
||||
}
|
||||
|
||||
@ -696,7 +696,7 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit, ExtraAttac
|
||||
}
|
||||
}
|
||||
|
||||
damage -= (aa_mit * damage);
|
||||
damage -= (int32)(aa_mit * damage);
|
||||
|
||||
if(damage != 0 && damage < minhit)
|
||||
damage = minhit;
|
||||
@ -742,7 +742,7 @@ int32 Mob::GetMeleeMitDmg(Mob *attacker, int32 damage, int32 minhit,
|
||||
d = 20.0;
|
||||
|
||||
float interval = (damage - minhit) / 20.0f;
|
||||
damage -= ((int)d * interval);
|
||||
damage -= (int32)(d * interval);
|
||||
|
||||
damage -= (minhit * itembonuses.MeleeMitigation / 100);
|
||||
damage -= (damage * spellbonuses.MeleeMitigation / 100);
|
||||
@ -775,7 +775,7 @@ int32 Client::GetMeleeMitDmg(Mob *attacker, int32 damage, int32 minhit,
|
||||
if (thac0 > thac0cap)
|
||||
thac0 = thac0cap;
|
||||
|
||||
d += 10 * (a_diff / thac0);
|
||||
d += (int)(10 * (a_diff / thac0));
|
||||
} else if (mit_roll > atk_roll) {
|
||||
float m_diff = mit_roll - atk_roll;
|
||||
float thac20 = mit_rating * RuleR(Combat, ACthac20Factor);
|
||||
@ -783,7 +783,7 @@ int32 Client::GetMeleeMitDmg(Mob *attacker, int32 damage, int32 minhit,
|
||||
if (thac20 > thac20cap)
|
||||
thac20 = thac20cap;
|
||||
|
||||
d -= 10 * (m_diff / thac20);
|
||||
d -= (int)(10 * (m_diff / thac20));
|
||||
}
|
||||
|
||||
if (d < 1)
|
||||
@ -1019,7 +1019,7 @@ int Mob::GetWeaponDamage(Mob *against, const ItemInst *weapon_item, uint32 *hate
|
||||
|
||||
if(eledmg)
|
||||
{
|
||||
eledmg = (eledmg * against->ResistSpell(weapon_item->GetItem()->ElemDmgType, 0, this) / 100);
|
||||
eledmg = (int)(eledmg * against->ResistSpell(weapon_item->GetItem()->ElemDmgType, 0, this) / 100);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1027,7 +1027,7 @@ int Mob::GetWeaponDamage(Mob *against, const ItemInst *weapon_item, uint32 *hate
|
||||
for(int x = 0; x < MAX_AUGMENT_SLOTS; x++){
|
||||
if(weapon_item->GetAugment(x) && weapon_item->GetAugment(x)->GetItem()){
|
||||
if(weapon_item->GetAugment(x)->GetItem()->ElemDmgAmt)
|
||||
eledmg += (weapon_item->GetAugment(x)->GetItem()->ElemDmgAmt * against->ResistSpell(weapon_item->GetAugment(x)->GetItem()->ElemDmgType, 0, this) / 100);
|
||||
eledmg += (int)(weapon_item->GetAugment(x)->GetItem()->ElemDmgAmt * against->ResistSpell(weapon_item->GetAugment(x)->GetItem()->ElemDmgType, 0, this) / 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1274,7 +1274,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b
|
||||
damage, min_hit, max_hit, GetSTR(), GetSkill(skillinuse), weapon_damage, mylevel);
|
||||
|
||||
if(opts) {
|
||||
damage *= opts->damage_percent;
|
||||
damage *= (int)opts->damage_percent;
|
||||
damage += opts->damage_flat;
|
||||
hate *= opts->hate_percent;
|
||||
hate += opts->hate_flat;
|
||||
@ -1416,7 +1416,7 @@ void Client::Damage(Mob* other, int32 damage, uint16 spell_id, SkillUseTypes att
|
||||
if(other->IsNPC() && !other->IsPet())
|
||||
{
|
||||
float npcspellscale = other->CastToNPC()->GetSpellScale();
|
||||
damage = ((float)damage * npcspellscale) / (float)100;
|
||||
damage = (int32)((damage * npcspellscale) / 100);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1896,9 +1896,9 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
|
||||
damage += (itembonuses.HeroicSTR / 10) + (damage * other->GetSkillDmgTaken(skillinuse) / 100) + GetSkillDmgAmt(skillinuse);
|
||||
|
||||
if(opts) {
|
||||
damage *= opts->damage_percent;
|
||||
damage *= (int)opts->damage_percent;
|
||||
damage += opts->damage_flat;
|
||||
hate *= opts->hate_percent;
|
||||
hate *= (int32)opts->hate_percent;
|
||||
hate += opts->hate_flat;
|
||||
}
|
||||
|
||||
@ -1908,9 +1908,9 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
|
||||
|
||||
} else {
|
||||
if(opts) {
|
||||
damage *= opts->damage_percent;
|
||||
damage *= (int)opts->damage_percent;
|
||||
damage += opts->damage_flat;
|
||||
hate *= opts->hate_percent;
|
||||
hate *= (int32)opts->hate_percent;
|
||||
hate += opts->hate_flat;
|
||||
}
|
||||
|
||||
@ -2506,9 +2506,9 @@ void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp,
|
||||
if(top && top != other) {
|
||||
if(tv_mod) {
|
||||
float tv = tv_mod / 100.0f;
|
||||
hate *= tv;
|
||||
hate *= (int32)tv;
|
||||
} else {
|
||||
hate *= RuleR(Aggro, TunnelVisionAggroMod);
|
||||
hate *= (int32)RuleR(Aggro, TunnelVisionAggroMod);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4294,7 +4294,7 @@ void Mob::TryCriticalHit(Mob *defender, uint16 skill, int32 &damage, ExtraAttack
|
||||
|
||||
if(MakeRandomFloat(0, 1) < critChance){
|
||||
int16 SlayDmgBonus = aabonuses.SlayUndead[1] + itembonuses.SlayUndead[1] + spellbonuses.SlayUndead[1];
|
||||
damage = (damage*SlayDmgBonus*2.25f)/100;
|
||||
damage = (int32)((damage*SlayDmgBonus*2.25f)/100);
|
||||
entity_list.MessageClose(this, false, 200, MT_CritMelee, "%s cleanses %s target!(%d)", GetCleanName(), this->GetGender() == 0 ? "his" : this->GetGender() == 1 ? "her" : "its", damage);
|
||||
return;
|
||||
}
|
||||
|
||||
18
zone/bot.cpp
18
zone/bot.cpp
@ -1405,17 +1405,17 @@ 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)
|
||||
{
|
||||
new_base_hp = (5 + (40 * hp_factor / 12) + ((GetLevel() - 40) * hp_factor / 6) +
|
||||
new_base_hp = (int)(5 + (40 * hp_factor / 12) + ((GetLevel() - 40) * hp_factor / 6) +
|
||||
((NormalSTA - SoDPost255) * hp_factor / 90) +
|
||||
((NormalSTA - SoDPost255) * (GetLevel() - 40) * hp_factor / 1800));
|
||||
}
|
||||
else
|
||||
{
|
||||
new_base_hp = (5 + (80 * hp_factor / 8) + ((GetLevel() - 80) * hp_factor / 10) +
|
||||
new_base_hp = (int)(5 + (80 * hp_factor / 8) + ((GetLevel() - 80) * hp_factor / 10) +
|
||||
((NormalSTA - SoDPost255) * hp_factor / 90) +
|
||||
((NormalSTA - SoDPost255) * hp_factor / 45));
|
||||
}
|
||||
@ -4735,7 +4735,7 @@ Bot* Bot::LoadBot(uint32 botID, std::string* errorMessage) {
|
||||
else {
|
||||
while(DataRow = mysql_fetch_row(DatasetResult)) {
|
||||
NPCType DefaultNPCTypeStruct = CreateDefaultNPCTypeStructForBot(std::string(DataRow[2]), std::string(DataRow[3]), atoi(DataRow[4]), atoi(DataRow[5]), atoi(DataRow[6]), atoi(DataRow[7]));
|
||||
NPCType TempNPCStruct = FillNPCTypeStruct(atoi(DataRow[1]), std::string(DataRow[2]), std::string(DataRow[3]), atoi(DataRow[4]), atoi(DataRow[5]), atoi(DataRow[6]), atoi(DataRow[7]), atof(DataRow[8]), atoi(DataRow[9]), atoi(DataRow[10]), atoi(DataRow[11]), atoi(DataRow[12]), atoi(DataRow[13]), atoi(DataRow[14]), atoi(DataRow[15]), atoi(DataRow[16]), atoi(DataRow[17]), atoi(DataRow[18]), atoi(DataRow[19]), atoi(DataRow[20]), DefaultNPCTypeStruct.MR, DefaultNPCTypeStruct.CR, DefaultNPCTypeStruct.DR, DefaultNPCTypeStruct.FR, DefaultNPCTypeStruct.PR, DefaultNPCTypeStruct.Corrup, DefaultNPCTypeStruct.AC, DefaultNPCTypeStruct.STR, DefaultNPCTypeStruct.STA, DefaultNPCTypeStruct.DEX, DefaultNPCTypeStruct.AGI, DefaultNPCTypeStruct.INT, DefaultNPCTypeStruct.WIS, DefaultNPCTypeStruct.CHA, DefaultNPCTypeStruct.ATK);
|
||||
NPCType TempNPCStruct = FillNPCTypeStruct(atoi(DataRow[1]), std::string(DataRow[2]), std::string(DataRow[3]), atoi(DataRow[4]), atoi(DataRow[5]), atoi(DataRow[6]), atoi(DataRow[7]), (float)atof(DataRow[8]), atoi(DataRow[9]), atoi(DataRow[10]), atoi(DataRow[11]), atoi(DataRow[12]), atoi(DataRow[13]), atoi(DataRow[14]), atoi(DataRow[15]), atoi(DataRow[16]), atoi(DataRow[17]), atoi(DataRow[18]), atoi(DataRow[19]), atoi(DataRow[20]), DefaultNPCTypeStruct.MR, DefaultNPCTypeStruct.CR, DefaultNPCTypeStruct.DR, DefaultNPCTypeStruct.FR, DefaultNPCTypeStruct.PR, DefaultNPCTypeStruct.Corrup, DefaultNPCTypeStruct.AC, DefaultNPCTypeStruct.STR, DefaultNPCTypeStruct.STA, DefaultNPCTypeStruct.DEX, DefaultNPCTypeStruct.AGI, DefaultNPCTypeStruct.INT, DefaultNPCTypeStruct.WIS, DefaultNPCTypeStruct.CHA, DefaultNPCTypeStruct.ATK);
|
||||
Result = new Bot(botID, atoi(DataRow[0]), atoi(DataRow[1]), atof(DataRow[38]), atoi(DataRow[39]), TempNPCStruct);
|
||||
break;
|
||||
}
|
||||
@ -6550,7 +6550,7 @@ 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)opts->damage_percent;
|
||||
damage += opts->damage_flat;
|
||||
hate *= opts->hate_percent;
|
||||
hate += opts->hate_flat;
|
||||
@ -9421,7 +9421,7 @@ int32 Bot::GetActSpellCost(uint16 spell_id, int32 cost) {
|
||||
PercentManaReduction += (float)MakeRandomFloat(1, (double)focus_redux);
|
||||
}
|
||||
|
||||
cost -= (cost * (PercentManaReduction / 100));
|
||||
cost -= (int32)(cost * (PercentManaReduction / 100));
|
||||
|
||||
// Gift of Mana - reduces spell cost to 1 mana
|
||||
if(focus_redux >= 100) {
|
||||
@ -10578,7 +10578,7 @@ int32 Bot::CalcManaRegen()
|
||||
if(mana_regen_rate < 0.0f)
|
||||
mana_regen_rate = 0.0f;
|
||||
|
||||
regen = regen * mana_regen_rate; // 90% of people wouldnt guess that manaregen would decrease the larger the number they input, this makes more sense
|
||||
regen = (int32)(regen * mana_regen_rate); // 90% of people wouldnt guess that manaregen would decrease the larger the number they input, this makes more sense
|
||||
|
||||
return regen;
|
||||
}
|
||||
@ -10638,12 +10638,12 @@ int32 Bot::CalcMaxHP() {
|
||||
|
||||
nd += aabonuses.MaxHP; //Natural Durability, Physical Enhancement, Planar Durability
|
||||
|
||||
bot_hp = (float)bot_hp * (float)nd / (float)10000; //this is to fix the HP-above-495k issue
|
||||
bot_hp = (int32)(bot_hp * nd / 10000); //this is to fix the HP-above-495k issue
|
||||
bot_hp += spellbonuses.HP + aabonuses.HP;
|
||||
|
||||
bot_hp += GroupLeadershipAAHealthEnhancement();
|
||||
|
||||
bot_hp += bot_hp * ((spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000.0f);
|
||||
bot_hp += (int32)(bot_hp * ((spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000.0f));
|
||||
max_hp = bot_hp;
|
||||
|
||||
if (cur_hp > max_hp)
|
||||
|
||||
@ -2076,7 +2076,7 @@ void Mob::SetAttackTimer() {
|
||||
if(max_quiver > 0)
|
||||
{
|
||||
float quiver_haste = 1 / (1 + max_quiver / 100);
|
||||
speed *= quiver_haste;
|
||||
speed *= (int)quiver_haste;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -599,7 +599,7 @@ public:
|
||||
bool PassCastRestriction(bool UseCastRestriction = true, int16 value = 0, bool IsDamage = true);
|
||||
bool ImprovedTaunt();
|
||||
bool TryRootFadeByDamage(int buffslot, Mob* attacker);
|
||||
int16 GetSlowMitigation() const {return slow_mitigation;}
|
||||
int16 GetSlowMitigation() const {return (int16)slow_mitigation;}
|
||||
|
||||
void ModSkillDmgTaken(SkillUseTypes skill_num, int value);
|
||||
int16 GetModSkillDmgTaken(const SkillUseTypes skill_num);
|
||||
|
||||
@ -243,7 +243,7 @@ public:
|
||||
|
||||
uint32 GetMaxDMG() const {return max_dmg;}
|
||||
uint32 GetMinDMG() const {return min_dmg;}
|
||||
int16 GetSlowMitigation() const {return slow_mitigation;}
|
||||
int16 GetSlowMitigation() const {return (int16)slow_mitigation;}
|
||||
float GetAttackSpeed() const {return attack_speed;}
|
||||
bool IsAnimal() const { return(bodytype == BT_Animal); }
|
||||
uint16 GetPetSpellID() const {return pet_spell_id;}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user