diff --git a/zone/groups.cpp b/zone/groups.cpp index b9eda9836..e80650f08 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -1082,7 +1082,7 @@ void Client::LeaveGroup() { isgrouped = false; } -void Group::HealGroup(uint32 heal_amt, Mob* caster, int32 range) +void Group::HealGroup(uint32 heal_amt, Mob* caster, float range) { if (!caster) return; @@ -1120,7 +1120,7 @@ void Group::HealGroup(uint32 heal_amt, Mob* caster, int32 range) } -void Group::BalanceHP(int32 penalty, int32 range, Mob* caster, int32 limit) +void Group::BalanceHP(int32 penalty, float range, Mob* caster, int32 limit) { if (!caster) return; @@ -1170,7 +1170,7 @@ void Group::BalanceHP(int32 penalty, int32 range, Mob* caster, int32 limit) } } -void Group::BalanceMana(int32 penalty, int32 range, Mob* caster, int32 limit) +void Group::BalanceMana(int32 penalty, float range, Mob* caster, int32 limit) { if (!caster) return; diff --git a/zone/groups.h b/zone/groups.h index 250b86946..951d8881a 100644 --- a/zone/groups.h +++ b/zone/groups.h @@ -86,9 +86,9 @@ public: uint16 GetAvgLevel(); bool LearnMembers(); void VerifyGroup(); - void BalanceHP(int32 penalty, int32 range = 0, Mob* caster = nullptr, int32 limit = 0); - void BalanceMana(int32 penalty, int32 range = 0, Mob* caster = nullptr, int32 limit = 0); - void HealGroup(uint32 heal_amt, Mob* caster, int32 range = 0); + void BalanceHP(int32 penalty, float range = 0, Mob* caster = nullptr, int32 limit = 0); + void BalanceMana(int32 penalty, float range = 0, Mob* caster = nullptr, int32 limit = 0); + void HealGroup(uint32 heal_amt, Mob* caster, float range = 0); inline void SetGroupAAs(GroupLeadershipAA_Struct *From) { memcpy(&LeaderAbilities, From, sizeof(GroupLeadershipAA_Struct)); } inline void GetGroupAAs(GroupLeadershipAA_Struct *Into) { memcpy(Into, &LeaderAbilities, sizeof(GroupLeadershipAA_Struct)); } void UpdateGroupAAs(); diff --git a/zone/mob.h b/zone/mob.h index 352a610eb..dc43f8349 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -1054,7 +1054,7 @@ protected: Timer ranged_timer; float attack_speed; //% increase/decrease in attack speed (not haste) int8 attack_delay; //delay between attacks in 10ths of seconds - float slow_mitigation; // Allows for a slow mitigation (100 = 100%, 50% = 50%) + int16 slow_mitigation; // Allows for a slow mitigation (100 = 100%, 50% = 50%) Timer tic_timer; Timer mana_timer; diff --git a/zone/raids.cpp b/zone/raids.cpp index 699bc6b1d..d377d4174 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -511,7 +511,7 @@ uint32 Raid::GetTotalRaidDamage(Mob* other) return total; } -void Raid::HealGroup(uint32 heal_amt, Mob* caster, uint32 gid, int32 range) +void Raid::HealGroup(uint32 heal_amt, Mob* caster, uint32 gid, float range) { if (!caster) return; @@ -554,7 +554,7 @@ void Raid::HealGroup(uint32 heal_amt, Mob* caster, uint32 gid, int32 range) } -void Raid::BalanceHP(int32 penalty, uint32 gid, int32 range, Mob* caster, int32 limit) +void Raid::BalanceHP(int32 penalty, uint32 gid, float range, Mob* caster, int32 limit) { if (!caster) return; @@ -610,7 +610,7 @@ void Raid::BalanceHP(int32 penalty, uint32 gid, int32 range, Mob* caster, int32 } } -void Raid::BalanceMana(int32 penalty, uint32 gid, int32 range, Mob* caster, int32 limit) +void Raid::BalanceMana(int32 penalty, uint32 gid, float range, Mob* caster, int32 limit) { if (!caster) return; diff --git a/zone/raids.h b/zone/raids.h index eb963ad32..7c3561cd2 100644 --- a/zone/raids.h +++ b/zone/raids.h @@ -157,9 +157,9 @@ public: void CastGroupSpell(Mob* caster,uint16 spellid, uint32 gid); void SplitExp(uint32 exp, Mob* other); uint32 GetTotalRaidDamage(Mob* other); - void BalanceHP(int32 penalty, uint32 gid, int32 range = 0, Mob* caster = nullptr, int32 limit = 0); - void BalanceMana(int32 penalty, uint32 gid, int32 range = 0, Mob* caster = nullptr, int32 limit = 0); - void HealGroup(uint32 heal_amt, Mob* caster, uint32 gid, int32 range = 0); + void BalanceHP(int32 penalty, uint32 gid, float range = 0, Mob* caster = nullptr, int32 limit = 0); + void BalanceMana(int32 penalty, uint32 gid, float range = 0, Mob* caster = nullptr, int32 limit = 0); + void HealGroup(uint32 heal_amt, Mob* caster, uint32 gid, float range = 0); void SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinum, Client *splitter = nullptr); void GroupBardPulse(Mob* caster, uint16 spellid, uint32 gid); diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 41e8f1e50..05bda2a82 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -336,7 +336,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) int i; bool inuse = false; - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for(i = 0; i < buff_count; i++) { if(buffs[i].spellid == spell_id && i != buffslot) { Message(0, "You must wait before you can be affected by this spell again."); @@ -428,10 +428,10 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) float x, y, z, heading; const char *target_zone; - x = spell.base[1]; - y = spell.base[0]; - z = spell.base[2]; - heading = spell.base[3]; + x = static_cast(spell.base[1]); + y = static_cast(spell.base[0]); + z = static_cast(spell.base[2]); + heading = static_cast(spell.base[3]); if(!strcmp(spell.teleport_zone, "same")) { @@ -500,10 +500,10 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) float x, y, z, heading; const char *target_zone; - x = spell.base[1]; - y = spell.base[0]; - z = spell.base[2]; - heading = spell.base[3]; + x = static_cast(spell.base[1]); + y = static_cast(spell.base[0]); + z = static_cast(spell.base[2]); + heading = static_cast(spell.base[3]); if(!strcmp(spell.teleport_zone, "same")) { @@ -801,7 +801,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (!bBreak) { - int resistMod = partial + (GetCHA()/25); + int resistMod = static_cast(partial) + (GetCHA()/25); resistMod = resistMod > 100 ? 100 : resistMod; buffs[buffslot].ticsremaining = resistMod * buffs[buffslot].ticsremaining / 100; } @@ -877,7 +877,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if(IsClient()) { AI_Start(); - animation = GetRunspeed() * 21; //set our animation to match our speed about + animation = static_cast(GetRunspeed() * 21.0f); //set our animation to match our speed about } CalculateNewFearpoint(); @@ -911,7 +911,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) action->source = caster ? caster->GetID() : GetID(); action->level = 65; action->instrument_mod = 10; - action->sequence = (GetHeading() * 12345 / 2); + action->sequence = static_cast((GetHeading() * 12345 / 2)); action->type = 231; action->spell = spell_id; action->buff_unknown = 4; @@ -960,7 +960,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) action->source = caster ? caster->GetID() : GetID(); action->level = 65; action->instrument_mod = 10; - action->sequence = (GetHeading() * 12345 / 2); + action->sequence = static_cast((GetHeading() * 12345 / 2)); action->type = 231; action->spell = spell_id; action->buff_unknown = 4; @@ -996,7 +996,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) action->source = caster ? caster->GetID() : GetID(); action->level = 65; action->instrument_mod = 10; - action->sequence = (GetHeading() * 12345 / 2); + action->sequence = static_cast((GetHeading() * 12345 / 2)); action->type = 231; action->spell = spell_id; action->buff_unknown = 4; @@ -1050,7 +1050,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) break; } - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for(int slot = 0; slot < buff_count; slot++) { if( buffs[slot].spellid != SPELL_UNKNOWN && spells[buffs[slot].spellid].dispel_flag == 0 && @@ -1075,7 +1075,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) break; } - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for(int slot = 0; slot < buff_count; slot++) { if (buffs[slot].spellid != SPELL_UNKNOWN && IsDetrimentalSpell(buffs[slot].spellid) && @@ -1100,7 +1100,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) break; } - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for(int slot = 0; slot < buff_count; slot++) { if (buffs[slot].spellid != SPELL_UNKNOWN && IsBeneficialSpell(buffs[slot].spellid) && @@ -1118,7 +1118,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) case SE_Purify: { //Attempt to remove all Deterimental buffs. - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for(int slot = 0; slot < buff_count; slot++) { if (buffs[slot].spellid != SPELL_UNKNOWN && IsDetrimentalSpell(buffs[slot].spellid)) @@ -1460,7 +1460,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) caster->GetTarget()->GetGender(), caster->GetTarget()->GetTexture() ); - caster->SendAppearancePacket(AT_Size, caster->GetTarget()->GetSize()); + caster->SendAppearancePacket(AT_Size, static_cast(caster->GetTarget()->GetSize())); for(int x = EmuConstants::MATERIAL_BEGIN; x <= EmuConstants::MATERIAL_TINT_END; x++) caster->SendWearChange(x); @@ -1662,7 +1662,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) #ifdef SPELL_EFFECT_SPAM snprintf(effect_desc, _EDLEN, "Model Size: %d%%", effect_value); #endif - ChangeSize(GetSize() * (effect_value / 100.0)); + ChangeSize(GetSize() * (static_cast(effect_value) / 100.0f)); break; } @@ -1881,13 +1881,13 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (effect_value < 0) { effect_value = 0 - effect_value; - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for (int j=0; j < buff_count; j++) { - if (buffs[j].spellid >= (uint16)SPDAT_RECORDS) + if (!IsValidSpell(buffs[j].spellid)) continue; if (CalculatePoisonCounters(buffs[j].spellid) == 0) continue; - if (effect_value >= buffs[j].counters) { + if (effect_value >= static_cast(buffs[j].counters)) { if (caster) caster->Message(MT_Spells,"You have cured your target of %s!",spells[buffs[j].spellid].name); caster->CastOnCurer(buffs[j].spellid); @@ -1913,13 +1913,13 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (effect_value < 0) { effect_value = 0 - effect_value; - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for (int j=0; j < buff_count; j++) { - if (buffs[j].spellid >= (uint16)SPDAT_RECORDS) + if (!IsValidSpell(buffs[j].spellid)) continue; if (CalculateDiseaseCounters(buffs[j].spellid) == 0) continue; - if (effect_value >= buffs[j].counters) + if (effect_value >= static_cast(buffs[j].counters)) { if (caster) caster->Message(MT_Spells,"You have cured your target of %s!",spells[buffs[j].spellid].name); @@ -1948,13 +1948,13 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (effect_value < 0) { effect_value = 0 - effect_value; - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for (int j=0; j < buff_count; j++) { - if (buffs[j].spellid >= (uint16)SPDAT_RECORDS) + if (!IsValidSpell(buffs[j].spellid)) continue; if (CalculateCurseCounters(buffs[j].spellid) == 0) continue; - if (effect_value >= buffs[j].counters) + if (effect_value >= static_cast(buffs[j].counters)) { if (caster) caster->Message(MT_Spells,"You have cured your target of %s!",spells[buffs[j].spellid].name); @@ -1983,13 +1983,13 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (effect_value < 0) { effect_value = -effect_value; - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for (int j=0; j < buff_count; j++) { - if (buffs[j].spellid >= (uint16)SPDAT_RECORDS) + if (!IsValidSpell(buffs[j].spellid)) continue; if (CalculateCorruptionCounters(buffs[j].spellid) == 0) continue; - if (effect_value >= buffs[j].counters) { + if (effect_value >= static_cast(buffs[j].counters)) { if (caster) caster->Message(MT_Spells,"You have cured your target of %s!",spells[buffs[j].spellid].name); caster->CastOnCurer(buffs[j].spellid); @@ -2032,7 +2032,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if(IsNPC()) { - Stun(toss_amt); + Stun(static_cast(toss_amt)); } toss_amt = sqrt(toss_amt)-2.0; @@ -2261,15 +2261,15 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) switch(spells[spell_id].skill) { case SkillThrowing: - caster->DoThrowingAttackDmg(this, nullptr, nullptr, spells[spell_id].base[i],spells[spell_id].base2[i], focus, ReuseTime); + caster->DoThrowingAttackDmg(this, nullptr, nullptr, spells[spell_id].base[i],spells[spell_id].base2[i], focus, ReuseTime); break; case SkillArchery: - caster->DoArcheryAttackDmg(this, nullptr, nullptr, spells[spell_id].base[i],spells[spell_id].base2[i],focus,ReuseTime); + caster->DoArcheryAttackDmg(this, nullptr, nullptr, spells[spell_id].base[i],spells[spell_id].base2[i],focus, ReuseTime); break; default: - caster->DoMeleeSkillAttackDmg(this, spells[spell_id].base[i], spells[spell_id].skill, spells[spell_id].base2[i], focus, ReuseTime); + caster->DoMeleeSkillAttackDmg(this, spells[spell_id].base[i], spells[spell_id].skill, spells[spell_id].base2[i], focus, false, ReuseTime); break; } break; @@ -2485,7 +2485,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if(!caster->IsClient()) break; - uint32 max_mana = spell.base[i]; + int32 max_mana = spell.base[i]; int ratio = spell.base2[i]; uint32 heal_amt = 0; @@ -2617,7 +2617,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) case SE_ManaBurn: { - uint32 max_mana = spell.base[i]; + int32 max_mana = spell.base[i]; int ratio = spell.base2[i]; int32 dmg = 0; @@ -3257,7 +3257,7 @@ snare has both of them negative, yet their range should work the same: break; case 137: // used in berserker AA desperation - result = ubase - (ubase * (GetHPRatio() / 100.0f)); + result = ubase - static_cast((ubase * (GetHPRatio() / 100.0f))); break; case 138: { // unused on live? @@ -3347,7 +3347,7 @@ snare has both of them negative, yet their range should work the same: void Mob::BuffProcess() { - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for (int buffs_i = 0; buffs_i < buff_count; ++buffs_i) { @@ -4343,12 +4343,12 @@ int16 Client::CalcAAFocus(focusType type, uint32 aa_ID, uint16 spell_id) break; case SE_LimitCastTimeMin: - if (spell.cast_time < base1) + if (static_cast(spell.cast_time) < base1) LimitFailure = true; break; case SE_LimitCastTimeMax: - if (spell.cast_time > base1) + if (static_cast(spell.cast_time) > base1) LimitFailure = true; break; @@ -4447,24 +4447,24 @@ int16 Client::CalcAAFocus(focusType type, uint32 aa_ID, uint16 spell_id) case SE_LimitSpellClass: if(base1 < 0) { //Exclude - if (CheckSpellCategory(spell_id, base1, SE_LimitSpellClass)); + if (CheckSpellCategory(spell_id, base1, SE_LimitSpellClass)) return(0); } else { LimitInclude[12] = true; - if (CheckSpellCategory(spell_id, base1, SE_LimitSpellClass)); //Include + if (CheckSpellCategory(spell_id, base1, SE_LimitSpellClass)) //Include LimitInclude[13] = true; } break; case SE_LimitSpellSubclass: if(base1 < 0) { //Exclude - if (CheckSpellCategory(spell_id, base1, SE_LimitSpellSubclass)); + if (CheckSpellCategory(spell_id, base1, SE_LimitSpellSubclass)) return(0); } else { LimitInclude[14] = true; - if (CheckSpellCategory(spell_id, base1, SE_LimitSpellSubclass)); //Include + if (CheckSpellCategory(spell_id, base1, SE_LimitSpellSubclass)) //Include LimitInclude[15] = true; } break; @@ -5248,7 +5248,7 @@ int16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) { if (spellbonuses.FocusEffects[type]){ int buff_slot = 0; uint16 focusspellid = 0; - uint32 buff_max = GetMaxTotalSlots(); + int buff_max = GetMaxTotalSlots(); for (buff_slot = 0; buff_slot < buff_max; buff_slot++) { if (SympatheticProcList.size() > MAX_SYMPATHETIC) @@ -5466,7 +5466,7 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id) { int buff_slot = 0; uint16 focusspellid = 0; uint16 focusspell_tracker = 0; - uint32 buff_max = GetMaxTotalSlots(); + int buff_max = GetMaxTotalSlots(); for (buff_slot = 0; buff_slot < buff_max; buff_slot++) { focusspellid = buffs[buff_slot].spellid; if (focusspellid == 0 || focusspellid >= SPDAT_RECORDS) @@ -5565,11 +5565,11 @@ void Mob::CheckNumHitsRemaining(uint8 type, uint32 buff_slot, uint16 spell_id) return; bool bDepleted = false; - uint32 buff_max = GetMaxTotalSlots(); + int buff_max = GetMaxTotalSlots(); //Spell specific procs [Type 7,10,11] if (IsValidSpell(spell_id)) { - for (uint32 d = 0; d < buff_max; d++) { + for (int d = 0; d < buff_max; d++) { if (buffs[d].spellid == spell_id && buffs[d].numhits > 0 && spells[buffs[d].spellid].numhitstype == type) { if (--buffs[d].numhits == 0) { @@ -5608,7 +5608,7 @@ void Mob::CheckNumHitsRemaining(uint8 type, uint32 buff_slot, uint16 spell_id) } } } else { - for (uint32 d = 0; d < buff_max; d++) { + for (int d = 0; d < buff_max; d++) { if (IsValidSpell(buffs[d].spellid) && buffs[d].numhits > 0 && spells[buffs[d].spellid].numhitstype == type) { if (--buffs[d].numhits == 0) { @@ -5708,7 +5708,7 @@ bool Mob::TryDeathSave() { int SuccessChance = 0; int buffSlot = spellbonuses.DeathSave[1]; int16 UD_HealMod = 0; - uint32 HealAmt = 300; //Death Pact max Heal + int HealAmt = 300; //Death Pact max Heal if(buffSlot >= 0){ @@ -5813,7 +5813,7 @@ float Mob::GetSympatheticProcChances(uint16 spell_id, int16 ProcRateMod, int32 I if (total_cast_time > 0 && total_cast_time <= 2500) cast_time_mod = 0.25f; else if (total_cast_time > 2500 && total_cast_time < 7000) - cast_time_mod = 0.167*((static_cast(total_cast_time) - 1000.0f)/1000.0f); + cast_time_mod = 0.167f*((static_cast(total_cast_time) - 1000.0f)/1000.0f); else cast_time_mod = static_cast(total_cast_time) / 7000.0f; @@ -5848,7 +5848,7 @@ int32 Mob::GetFcDamageAmtIncoming(Mob *caster, uint32 spell_id, bool use_skill, return 0; if (spellbonuses.FocusEffects[focusFcDamageAmtIncoming]){ - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for(int i = 0; i < buff_count; i++){ if( (IsValidSpell(buffs[i].spellid) && (IsEffectInSpell(buffs[i].spellid, SE_FcDamageAmtIncoming))) ){