[int64] Support for HP / Mana / End / Damage / Hate (#2091)

* Initial int64 work

* Hate 64 bit

* Update special_attacks.cpp

* Aggro / Damage / Hate int64

* NPC edit adjustments

* Fix bot compile

* More int64 adjustments

* More int64 references

* npcedit references

* aggrozone

* More int64 changes

* More int64 changes for damage

* Many more damage int64 references

* More spell damage int64 conversions

* HealDamage

* Damage fully working

* Remove debug

* Add migration

* More int64 adjustments

* Much wow, many int64

* More int64

* PR adjustments
This commit is contained in:
Chris Miles
2022-05-07 22:32:02 -05:00
committed by GitHub
parent d9c41526e8
commit f201d4c999
57 changed files with 743 additions and 708 deletions
+27 -27
View File
@@ -40,7 +40,7 @@ float Mob::GetActSpellRange(uint16 spell_id, float range, bool IsBard)
return (range * extrange) / 100;
}
int32 Mob::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) {
int64 Mob::GetActSpellDamage(uint16 spell_id, int64 value, Mob* target) {
if (spells[spell_id].target_type == ST_Self)
return value;
@@ -49,7 +49,7 @@ int32 Mob::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) {
value += value*CastToNPC()->GetSpellFocusDMG()/100;
bool Critical = false;
int32 base_value = value;
int64 base_value = value;
int chance = 0;
// Need to scale HT damage differently after level 40! It no longer scales by the constant value in the spell file. It scales differently, instead of 10 more damage per level, it does 30 more damage per level. So we multiply the level minus 40 times 20 if they are over level 40.
@@ -121,7 +121,7 @@ int32 Mob::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) {
value -= GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, base_value)*ratio/100;
else if (IsNPC() && CastToNPC()->GetSpellScale())
value = int(static_cast<float>(value) * CastToNPC()->GetSpellScale() / 100.0f);
value = int64(static_cast<float>(value) * CastToNPC()->GetSpellScale() / 100.0f);
entity_list.MessageCloseString(
this, true, 100, Chat::SpellCrit,
@@ -160,12 +160,12 @@ int32 Mob::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) {
value -= GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, base_value);
if (IsNPC() && CastToNPC()->GetSpellScale())
value = int(static_cast<float>(value) * CastToNPC()->GetSpellScale() / 100.0f);
value = int64(static_cast<float>(value) * CastToNPC()->GetSpellScale() / 100.0f);
return value;
}
int32 Mob::GetActReflectedSpellDamage(int32 spell_id, int32 value, int effectiveness) {
int64 Mob::GetActReflectedSpellDamage(int32 spell_id, int64 value, int effectiveness) {
/*
Reflected spells use the spells base damage before any modifiers or formulas applied.
That value can then be modifier by the reflect spells 'max' value, defined here as effectiveness
@@ -177,11 +177,11 @@ int32 Mob::GetActReflectedSpellDamage(int32 spell_id, int32 value, int effective
value += value * CastToNPC()->GetSpellFocusDMG() / 100;
if (CastToNPC()->GetSpellScale()) {
value = int(static_cast<float>(value) * CastToNPC()->GetSpellScale() / 100.0f);
value = int64(static_cast<float>(value) * CastToNPC()->GetSpellScale() / 100.0f);
}
}
int32 base_spell_dmg = value;
int64 base_spell_dmg = value;
value = value * effectiveness / 100;
@@ -192,7 +192,7 @@ int32 Mob::GetActReflectedSpellDamage(int32 spell_id, int32 value, int effective
return value;
}
int32 Mob::GetActDoTDamage(uint16 spell_id, int32 value, Mob* target, bool from_buff_tic) {
int64 Mob::GetActDoTDamage(uint16 spell_id, int64 value, Mob* target, bool from_buff_tic) {
if (target == nullptr)
return value;
@@ -201,8 +201,8 @@ int32 Mob::GetActDoTDamage(uint16 spell_id, int32 value, Mob* target, bool from_
value += value * CastToNPC()->GetSpellFocusDMG() / 100;
}
int32 base_value = value;
int32 extra_dmg = 0;
int64 base_value = value;
int64 extra_dmg = 0;
int16 chance = 0;
chance += itembonuses.CriticalDoTChance + spellbonuses.CriticalDoTChance + aabonuses.CriticalDoTChance;
@@ -213,16 +213,16 @@ int32 Mob::GetActDoTDamage(uint16 spell_id, int32 value, Mob* target, bool from_
chance = spells[spell_id].override_crit_chance;
if (!spells[spell_id].good_effect && chance > 0 && (zone->random.Roll(chance))) {
int32 ratio = 200;
int64 ratio = 200;
ratio += itembonuses.DotCritDmgIncrease + spellbonuses.DotCritDmgIncrease + aabonuses.DotCritDmgIncrease;
value = base_value*ratio/100;
value += int(base_value*GetFocusEffect(focusImprovedDamage, spell_id, nullptr, from_buff_tic)/100)*ratio/100;
value += int(base_value*GetFocusEffect(focusImprovedDamage2, spell_id, nullptr, from_buff_tic)/100)*ratio/100;
value += int(base_value*GetFocusEffect(focusFcDamagePctCrit, spell_id, nullptr, from_buff_tic)/100)*ratio/100;
value += int(base_value*GetFocusEffect(focusFcAmplifyMod, spell_id, nullptr, from_buff_tic) / 100)*ratio/100;
value += int(base_value*target->GetVulnerability(this, spell_id, 0, from_buff_tic)/100)*ratio/100;
value += int64(base_value*GetFocusEffect(focusImprovedDamage, spell_id, nullptr, from_buff_tic)/100)*ratio/100;
value += int64(base_value*GetFocusEffect(focusImprovedDamage2, spell_id, nullptr, from_buff_tic)/100)*ratio/100;
value += int64(base_value*GetFocusEffect(focusFcDamagePctCrit, spell_id, nullptr, from_buff_tic)/100)*ratio/100;
value += int64(base_value*GetFocusEffect(focusFcAmplifyMod, spell_id, nullptr, from_buff_tic) / 100)*ratio/100;
value += int64(base_value*target->GetVulnerability(this, spell_id, 0, from_buff_tic)/100)*ratio/100;
extra_dmg = target->GetFcDamageAmtIncoming(this, spell_id, from_buff_tic) +
int(GetFocusEffect(focusFcDamageAmtCrit, spell_id, nullptr, from_buff_tic)*ratio/100) +
int64(GetFocusEffect(focusFcDamageAmtCrit, spell_id, nullptr, from_buff_tic)*ratio/100) +
GetFocusEffect(focusFcDamageAmt, spell_id, nullptr, from_buff_tic) +
GetFocusEffect(focusFcDamageAmt2, spell_id, nullptr, from_buff_tic) +
GetFocusEffect(focusFcAmplifyAmt, spell_id, nullptr, from_buff_tic);
@@ -277,12 +277,12 @@ int32 Mob::GetActDoTDamage(uint16 spell_id, int32 value, Mob* target, bool from_
}
if (IsNPC() && CastToNPC()->GetSpellScale())
value = int(static_cast<float>(value) * CastToNPC()->GetSpellScale() / 100.0f);
value = int64(static_cast<float>(value) * CastToNPC()->GetSpellScale() / 100.0f);
return value;
}
int32 Mob::GetExtraSpellAmt(uint16 spell_id, int32 extra_spell_amt, int32 base_spell_dmg)
int64 Mob::GetExtraSpellAmt(uint16 spell_id, int64 extra_spell_amt, int64 base_spell_dmg)
{
if (RuleB(Spells, FlatItemExtraSpellAmt)) {
if (RuleB(Spells, ItemExtraSpellAmtCalcAsPercent))
@@ -316,14 +316,14 @@ int32 Mob::GetExtraSpellAmt(uint16 spell_id, int32 extra_spell_amt, int32 base_s
return extra_spell_amt;
}
int32 Mob::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target, bool from_buff_tic) {
int64 Mob::GetActSpellHealing(uint16 spell_id, int64 value, Mob* target, bool from_buff_tic) {
if (IsNPC()) {
value += value * CastToNPC()->GetSpellFocusHeal() / 100;
}
int32 base_value = value;
int64 base_value = value;
int16 critical_chance = 0;
int8 critical_modifier = 1;
@@ -354,17 +354,17 @@ int32 Mob::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target, bool fr
}
if (GetClass() == CLERIC) {
value += int(base_value*RuleI(Spells, ClericInnateHealFocus) / 100); //confirmed on live parsing clerics get an innate 5 pct heal focus
value += int64(base_value*RuleI(Spells, ClericInnateHealFocus) / 100); //confirmed on live parsing clerics get an innate 5 pct heal focus
}
value += int(base_value*GetFocusEffect(focusImprovedHeal, spell_id, nullptr, from_buff_tic) / 100);
value += int(base_value*GetFocusEffect(focusFcAmplifyMod, spell_id, nullptr, from_buff_tic) / 100);
value += int64(base_value*GetFocusEffect(focusImprovedHeal, spell_id, nullptr, from_buff_tic) / 100);
value += int64(base_value*GetFocusEffect(focusFcAmplifyMod, spell_id, nullptr, from_buff_tic) / 100);
// Instant Heals
if (spells[spell_id].buff_duration < 1) {
if (target) {
value += int(base_value * target->GetFocusEffect(focusFcHealPctIncoming, spell_id, this)/100); //SPA 393 Add before critical
value += int(base_value * target->GetFocusEffect(focusFcHealPctCritIncoming, spell_id, this)/100); //SPA 395 Add before critical (?)
value += int64(base_value * target->GetFocusEffect(focusFcHealPctIncoming, spell_id, this)/100); //SPA 393 Add before critical
value += int64(base_value * target->GetFocusEffect(focusFcHealPctCritIncoming, spell_id, this)/100); //SPA 395 Add before critical (?)
}
value += GetFocusEffect(focusFcHealAmtCrit, spell_id); //SPA 396 Add before critical
@@ -413,7 +413,7 @@ int32 Mob::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target, bool fr
//Heal over time spells. [Heal Rate and Additional Healing effects do not increase this value]
else {
//Using IgnoreSpellDmgLvlRestriction to also allow healing to scale
int32 extra_heal = 0;
int64 extra_heal = 0;
if (RuleB(Spells, HOTsScaleWithHealAmt)) {
if (RuleB(Spells, IgnoreSpellDmgLvlRestriction) && !spells[spell_id].no_heal_damage_item_mod && itembonuses.HealAmt) {
extra_heal += GetExtraSpellAmt(spell_id, itembonuses.HealAmt, base_value);