Fix the math so berserkers aren't left out in spell related checks.

This commit is contained in:
Natedog2012 2016-02-11 13:07:42 -08:00
parent a14b3117e9
commit 31b6346f03
6 changed files with 20 additions and 20 deletions

View File

@ -5463,7 +5463,7 @@ int32 Bot::CalcBotAAFocus(BotfocusType type, uint32 aa_ID, uint32 points, uint16
LimitFound = true; LimitFound = true;
break; break;
case SE_LimitMaxLevel: case SE_LimitMaxLevel:
spell_level = spell.classes[(GetClass() % 16) - 1]; spell_level = spell.classes[(GetClass() % 17) - 1];
lvldiff = spell_level - base1; lvldiff = spell_level - base1;
//every level over cap reduces the effect by base2 percent unless from a clicky when ItemCastsUseFocus is true //every level over cap reduces the effect by base2 percent unless from a clicky when ItemCastsUseFocus is true
if(lvldiff > 0 && (spell_level <= RuleI(Character, MaxLevel) || RuleB(Character, ItemCastsUseFocus) == false)) { if(lvldiff > 0 && (spell_level <= RuleI(Character, MaxLevel) || RuleB(Character, ItemCastsUseFocus) == false)) {
@ -5477,7 +5477,7 @@ int32 Bot::CalcBotAAFocus(BotfocusType type, uint32 aa_ID, uint32 points, uint16
} }
break; break;
case SE_LimitMinLevel: case SE_LimitMinLevel:
if((spell.classes[(GetClass() % 16) - 1]) < base1) if((spell.classes[(GetClass() % 17) - 1]) < base1)
LimitFound = true; LimitFound = true;
break; break;
case SE_LimitCastTimeMin: case SE_LimitCastTimeMin:
@ -5915,7 +5915,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel
case SE_LimitMaxLevel:{ case SE_LimitMaxLevel:{
if (IsNPC()) if (IsNPC())
break; break;
spell_level = spell.classes[(GetClass() % 16) - 1]; spell_level = spell.classes[(GetClass() % 17) - 1];
lvldiff = (spell_level - focus_spell.base[i]); lvldiff = (spell_level - focus_spell.base[i]);
if(lvldiff > 0 && (spell_level <= RuleI(Character, MaxLevel) || RuleB(Character, ItemCastsUseFocus) == false)) { if(lvldiff > 0 && (spell_level <= RuleI(Character, MaxLevel) || RuleB(Character, ItemCastsUseFocus) == false)) {
if(focus_spell.base2[i] > 0) { if(focus_spell.base2[i] > 0) {
@ -5931,7 +5931,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel
case SE_LimitMinLevel: case SE_LimitMinLevel:
if (IsNPC()) if (IsNPC())
break; break;
if (spell.classes[(GetClass() % 16) - 1] < focus_spell.base[i]) if (spell.classes[(GetClass() % 17) - 1] < focus_spell.base[i])
return 0; return 0;
break; break;
@ -7083,7 +7083,7 @@ int32 Bot::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) {
value -= GetBotFocusEffect(BotfocusFcDamageAmt, spell_id); value -= GetBotFocusEffect(BotfocusFcDamageAmt, spell_id);
if(itembonuses.SpellDmg && spells[spell_id].classes[(GetClass() % 16) - 1] >= GetLevel() - 5) if(itembonuses.SpellDmg && spells[spell_id].classes[(GetClass() % 17) - 1] >= GetLevel() - 5)
value += (GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, value) * ratio / 100); value += (GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, value) * ratio / 100);
entity_list.MessageClose(this, false, 100, MT_SpellCrits, "%s delivers a critical blast! (%d)", GetName(), -value); entity_list.MessageClose(this, false, 100, MT_SpellCrits, "%s delivers a critical blast! (%d)", GetName(), -value);
@ -7102,7 +7102,7 @@ int32 Bot::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) {
value -= GetBotFocusEffect(BotfocusFcDamageAmtCrit, spell_id); value -= GetBotFocusEffect(BotfocusFcDamageAmtCrit, spell_id);
value -= GetBotFocusEffect(BotfocusFcDamageAmt, spell_id); value -= GetBotFocusEffect(BotfocusFcDamageAmt, spell_id);
if(itembonuses.SpellDmg && spells[spell_id].classes[(GetClass() % 16) - 1] >= GetLevel() - 5) if(itembonuses.SpellDmg && spells[spell_id].classes[(GetClass() % 17) - 1] >= GetLevel() - 5)
value += GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, value); value += GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, value);
return value; return value;
@ -7135,7 +7135,7 @@ int32 Bot::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) {
value += GetBotFocusEffect(BotfocusFcHealAmt, spell_id); value += GetBotFocusEffect(BotfocusFcHealAmt, spell_id);
value += target->GetFocusIncoming(focusFcHealAmtIncoming, SE_FcHealAmtIncoming, this, spell_id); value += target->GetFocusIncoming(focusFcHealAmtIncoming, SE_FcHealAmtIncoming, this, spell_id);
if(itembonuses.HealAmt && spells[spell_id].classes[(GetClass() % 16) - 1] >= GetLevel() - 5) if(itembonuses.HealAmt && spells[spell_id].classes[(GetClass() % 17) - 1] >= GetLevel() - 5)
value += (GetExtraSpellAmt(spell_id, itembonuses.HealAmt, value) * modifier); value += (GetExtraSpellAmt(spell_id, itembonuses.HealAmt, value) * modifier);
value += (value * target->GetHealRate(spell_id, this) / 100); value += (value * target->GetHealRate(spell_id, this) / 100);
@ -7239,7 +7239,7 @@ int32 Bot::GetActSpellCasttime(uint16 spell_id, int32 casttime) {
} }
int32 Bot::GetActSpellCost(uint16 spell_id, int32 cost) { int32 Bot::GetActSpellCost(uint16 spell_id, int32 cost) {
if(this->itembonuses.Clairvoyance && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5) { if(this->itembonuses.Clairvoyance && spells[spell_id].classes[(GetClass()%17) - 1] >= GetLevel() - 5) {
int32 mana_back = (this->itembonuses.Clairvoyance * zone->random.Int(1, 100) / 100); int32 mana_back = (this->itembonuses.Clairvoyance * zone->random.Int(1, 100) / 100);
if(mana_back > cost) if(mana_back > cost)
mana_back = cost; mana_back = cost;

View File

@ -112,7 +112,7 @@ int32 Mob::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) {
value -= GetFocusEffect(focusFcDamageAmt, spell_id); value -= GetFocusEffect(focusFcDamageAmt, spell_id);
value -= GetFocusEffect(focusFcDamageAmt2, spell_id); value -= GetFocusEffect(focusFcDamageAmt2, spell_id);
if(!spells[spell_id].no_heal_damage_item_mod && itembonuses.SpellDmg && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5) if(!spells[spell_id].no_heal_damage_item_mod && itembonuses.SpellDmg && spells[spell_id].classes[(GetClass()%17) - 1] >= GetLevel() - 5)
value -= GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, value)*ratio/100; value -= GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, value)*ratio/100;
else if (IsNPC() && CastToNPC()->GetSpellScale()) else if (IsNPC() && CastToNPC()->GetSpellScale())
@ -145,7 +145,7 @@ int32 Mob::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) {
value -= GetFocusEffect(focusFcDamageAmt, spell_id); value -= GetFocusEffect(focusFcDamageAmt, spell_id);
value -= GetFocusEffect(focusFcDamageAmt2, spell_id); value -= GetFocusEffect(focusFcDamageAmt2, spell_id);
if(!spells[spell_id].no_heal_damage_item_mod && itembonuses.SpellDmg && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5) if(!spells[spell_id].no_heal_damage_item_mod && itembonuses.SpellDmg && spells[spell_id].classes[(GetClass()%17) - 1] >= GetLevel() - 5)
value -= GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, value); value -= GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, value);
if (IsNPC() && CastToNPC()->GetSpellScale()) if (IsNPC() && CastToNPC()->GetSpellScale())
@ -290,7 +290,7 @@ int32 Mob::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) {
value += GetFocusEffect(focusFcHealAmt, spell_id); value += GetFocusEffect(focusFcHealAmt, spell_id);
value += target->GetFocusIncoming(focusFcHealAmtIncoming, SE_FcHealAmtIncoming, this, spell_id); value += target->GetFocusIncoming(focusFcHealAmtIncoming, SE_FcHealAmtIncoming, this, spell_id);
if(!spells[spell_id].no_heal_damage_item_mod && itembonuses.HealAmt && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5) if(!spells[spell_id].no_heal_damage_item_mod && itembonuses.HealAmt && spells[spell_id].classes[(GetClass()%17) - 1] >= GetLevel() - 5)
value += GetExtraSpellAmt(spell_id, itembonuses.HealAmt, value) * modifier; value += GetExtraSpellAmt(spell_id, itembonuses.HealAmt, value) * modifier;
value += value*target->GetHealRate(spell_id, this)/100; value += value*target->GetHealRate(spell_id, this)/100;
@ -339,7 +339,7 @@ int32 Client::GetActSpellCost(uint16 spell_id, int32 cost)
cost *= 2; cost *= 2;
// Formula = Unknown exact, based off a random percent chance up to mana cost(after focuses) of the cast spell // Formula = Unknown exact, based off a random percent chance up to mana cost(after focuses) of the cast spell
if(itembonuses.Clairvoyance && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5) if(itembonuses.Clairvoyance && spells[spell_id].classes[(GetClass()%17) - 1] >= GetLevel() - 5)
{ {
int16 mana_back = itembonuses.Clairvoyance * zone->random.Int(1, 100) / 100; int16 mana_back = itembonuses.Clairvoyance * zone->random.Int(1, 100) / 100;
// Doesnt generate mana, so best case is a free spell // Doesnt generate mana, so best case is a free spell

View File

@ -2678,7 +2678,7 @@ int16 Merc::GetFocusEffect(focusType type, uint16 spell_id) {
int32 Merc::GetActSpellCost(uint16 spell_id, int32 cost) int32 Merc::GetActSpellCost(uint16 spell_id, int32 cost)
{ {
// Formula = Unknown exact, based off a random percent chance up to mana cost(after focuses) of the cast spell // Formula = Unknown exact, based off a random percent chance up to mana cost(after focuses) of the cast spell
if(this->itembonuses.Clairvoyance && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5) if(this->itembonuses.Clairvoyance && spells[spell_id].classes[(GetClass()%17) - 1] >= GetLevel() - 5)
{ {
int16 mana_back = this->itembonuses.Clairvoyance * zone->random.Int(1, 100) / 100; int16 mana_back = this->itembonuses.Clairvoyance * zone->random.Int(1, 100) / 100;
// Doesnt generate mana, so best case is a free spell // Doesnt generate mana, so best case is a free spell

View File

@ -5117,7 +5117,7 @@ int8 Mob::GetDecayEffectValue(uint16 spell_id, uint16 spelleffect) {
if (!IsValidSpell(spell_id)) if (!IsValidSpell(spell_id))
return false; return false;
int spell_level = spells[spell_id].classes[(GetClass()%16) - 1]; int spell_level = spells[spell_id].classes[(GetClass()%17) - 1];
int effect_value = 0; int effect_value = 0;
int lvlModifier = 100; int lvlModifier = 100;

View File

@ -1082,11 +1082,11 @@ int32 Client::GenericFocus(uint16 spell_id, uint16 modspellid)
switch( spells[modspellid].effectid[i] ) switch( spells[modspellid].effectid[i] )
{ {
case SE_LimitMaxLevel: case SE_LimitMaxLevel:
if (spell.classes[(GetClass()%16) - 1] > modspell.base[i]) if (spell.classes[(GetClass()%17) - 1] > modspell.base[i])
return 100; return 100;
break; break;
case SE_LimitMinLevel: case SE_LimitMinLevel:
if (spell.classes[(GetClass()%16) - 1] < modspell.base[i]) if (spell.classes[(GetClass()%17) - 1] < modspell.base[i])
return 100; return 100;
break; break;
case SE_IncreaseRange: case SE_IncreaseRange:

View File

@ -4227,7 +4227,7 @@ int16 Client::CalcAAFocus(focusType type, const AA::Rank &rank, uint16 spell_id)
break; break;
case SE_LimitMaxLevel: case SE_LimitMaxLevel:
spell_level = spell.classes[(GetClass() % 16) - 1]; spell_level = spell.classes[(GetClass() % 17) - 1];
lvldiff = spell_level - base1; lvldiff = spell_level - base1;
// every level over cap reduces the effect by base2 percent unless from a clicky when // every level over cap reduces the effect by base2 percent unless from a clicky when
// ItemCastsUseFocus is true // ItemCastsUseFocus is true
@ -4243,7 +4243,7 @@ int16 Client::CalcAAFocus(focusType type, const AA::Rank &rank, uint16 spell_id)
break; break;
case SE_LimitMinLevel: case SE_LimitMinLevel:
if ((spell.classes[(GetClass() % 16) - 1]) < base1) if ((spell.classes[(GetClass() % 17) - 1]) < base1)
LimitFailure = true; LimitFailure = true;
break; break;
@ -4661,7 +4661,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo
case SE_LimitMaxLevel: case SE_LimitMaxLevel:
if (IsNPC()) if (IsNPC())
break; break;
spell_level = spell.classes[(GetClass() % 16) - 1]; spell_level = spell.classes[(GetClass() % 17) - 1];
lvldiff = spell_level - focus_spell.base[i]; lvldiff = spell_level - focus_spell.base[i];
// every level over cap reduces the effect by focus_spell.base2[i] percent unless from a clicky // every level over cap reduces the effect by focus_spell.base2[i] percent unless from a clicky
// when ItemCastsUseFocus is true // when ItemCastsUseFocus is true
@ -4679,7 +4679,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo
case SE_LimitMinLevel: case SE_LimitMinLevel:
if (IsNPC()) if (IsNPC())
break; break;
if (spell.classes[(GetClass() % 16) - 1] < focus_spell.base[i]) if (spell.classes[(GetClass() % 17) - 1] < focus_spell.base[i])
return (0); return (0);
break; break;