Implemented new focus and limits

SE_Fc_Amplify_Mod 507  @Fc, On Caster, damage-heal-dot mod pct, base: pct

SE_Fc_Amplify_Amt 508
@Fc, On Caster, damage-heal-dot mod flat amt, base: amt

SE_Fc_ResistIncoming 510 implemented, @Fc, On Target, resist modifier, base: amt

SE_Fc_CastTimeMod2 500
@Fc, On Caster, cast time mod pct, base: pct

SE_Fc_CastTimeAmt  501
@Fc, On Caster, cast time mod flat amt, base: milliseconds

SE_Ff_DurationMax	 495
@Ff, Max duration of spell that can be focused, base: tics

SE_Ff_ReuseTimeMin  490
@Ff, Minimum recast time of a spell that can be focused, base: recast time

SE_Ff_ReuseTimeMax  491
 @Ff, Max recast time of a spell that can be focused, base: recast time

SE_Ff_Endurance_Min 492
@Ff, Minimum endurance cost of a spell that can be focused, base: endurance cost

SE_Ff_Endurance_Max 	493
 @Ff, Max endurance cost of a spell that can be focused, base: endurance cost

SE_Ff_Value_Min 479
@Ff, Minimum base value of a spell that can be focused, base: spells to be focused base1 value

 SE_Ff_Value_Max 	480
@Ff, Max base value of a spell that can be focused, base: spells to be focused base1 value

SE_Ff_Override_NotFocusable		460 @Fc, Allow spell to be focused event if flagged with 'not_focusable' in spell table, base: 1

Added basic focus and limit descriptions to source.
This commit is contained in:
KayenEQ
2021-07-20 10:47:49 -04:00
parent cf25f5f1e2
commit 2d5383da70
8 changed files with 347 additions and 121 deletions
+10
View File
@@ -3726,6 +3726,12 @@ uint8 Mob::IsFocusEffect(uint16 spell_id,int effect_index, bool AA,uint32 aa_eff
return focusPetPower;
case SE_SpellResistReduction:
return focusResistRate;
case SE_Fc_ResistIncoming:
focusFcResistIncoming;
case SE_Fc_Amplify_Mod:
focusFcResistIncoming;
case SE_Fc_Amplify_Amt:
focusFcResistIncoming;
case SE_SpellHateMod:
return focusSpellHateMod;
case SE_ReduceReuseTimer:
@@ -3774,6 +3780,10 @@ uint8 Mob::IsFocusEffect(uint16 spell_id,int effect_index, bool AA,uint32 aa_eff
return focusFcCastSpellOnLand;
case SE_FcStunTimeMod:
return focusFcStunTimeMod;
case SE_Fc_CastTimeMod2:
return focusFcCastTimeMod2;
case SE_Fc_CastTimeAmt:
return focusFcCastTimeAmt;
case SE_FcHealPctCritIncoming:
return focusFcHealPctCritIncoming;
case SE_FcHealAmt:
+43 -40
View File
@@ -108,46 +108,49 @@
#define AURA_HARDCAP 2
typedef enum { //focus types
focusSpellHaste = 1,
focusSpellDuration,
focusRange,
focusReagentCost,
focusManaCost,
focusImprovedHeal,
focusImprovedDamage,
focusImprovedDamage2,
focusImprovedDOT, //i dont know about this...
focusFcDamagePctCrit,
focusImprovedUndeadDamage,
focusPetPower,
focusResistRate,
focusSpellHateMod,
focusTriggerOnCast,
focusSpellVulnerability,
focusFcSpellDamagePctIncomingPC,
focusTwincast,
focusSympatheticProc,
focusFcDamageAmt,
focusFcDamageAmt2,
focusFcDamageAmtCrit,
focusSpellDurByTic,
focusSwarmPetDuration,
focusReduceRecastTime,
focusBlockNextSpell,
focusFcHealPctIncoming,
focusFcDamageAmtIncoming,
focusFcSpellDamageAmtIncomingPC,
focusFcCastSpellOnLand,
focusFcHealAmtIncoming,
focusFcBaseEffects,
focusIncreaseNumHits,
focusFcLimitUse,
focusFcMute,
focusFcTimerRefresh,
focusFcStunTimeMod,
focusFcHealPctCritIncoming,
focusFcHealAmt,
focusFcHealAmtCrit,
focusSpellHaste = 1, //@Fc, SPA: 127, SE_IncreaseSpellHaste, On Caster, cast time mod pct, base: pct
focusSpellDuration, //@Fc, SPA: 128, SE_IncreaseSpellDuration, On Caster, spell duration mod pct, base: pct
focusRange, //@Fc, SPA: 129, SE_IncreaseRange, On Caster, spell range mod pct, base: pct
focusReagentCost, //@Fc, SPA: 131, SE_ReduceReagentCost, On Caster, do not consume reagent pct chance, base: min pct, limit: max pct
focusManaCost, //@Fc, SPA: 132, SE_ReduceManaCost, On Caster, reduce mana cost by pct, base: min pct, limt: max pct
focusImprovedHeal, //@Fc, SPA: 125, SE_ImprovedHeal, On Caster, spell healing mod pct, base: min pct, limit: max pct
focusImprovedDamage, //@Fc, SPA: 124, SE_ImprovedDamage, On Caster, spell damage mod pct, base: min pct, limit: max pct
focusImprovedDamage2, //@Fc, SPA: 461, SE_ImprovedDamage2, On Caster, spell damage mod pct, base: min pct, limit: max pct
focusFcDamagePctCrit, //@Fc, SPA: 302, SE_FcDamagePctCrit, On Caster, spell damage mod pct, base: min pct, limit: max pct
focusPetPower, //@Fc, SPA: 167, SE_PetPowerIncrease, On Caster, pet power mod, base: value
focusResistRate, //@Fc, SPA: 126, SE_SpellResistReduction, On Caster, casted spell resist mod pct, base: min pct, limit: max pct
focusSpellHateMod, //@Fc, SPA: 130, SE_SpellHateMod, On Caster, spell hate mod pct, base: min pct, limit: max pct
focusTriggerOnCast, //@Fc, SPA: 339, SE_TriggerOnCast, On Caster, cast on spell use, base: chance pct limit: spellid
focusSpellVulnerability, //@Fc, SPA: 296, SE_FcSpellVulnerability, On Target, spell damage taken mod pct, base: min pct, limit: max pct
focusFcSpellDamagePctIncomingPC, //@Fc, SPA: 483, SE_Fc_Spell_Damage_Pct_IncomingPC, On Target, spell damage taken mod pct, base: min pct, limit: max pct
focusTwincast, //@Fc, SPA: 399, SE_FcTwincast, On Caster, chance cast spell twice, base: chance pct
focusSympatheticProc, //@Fc, SPA: 383, SE_SympatheticProc, On Caster, cast on spell use, base: variable proc chance on cast time, limit: spellid
focusFcDamageAmt, //@Fc, SPA: 286, SE_FcDamageAmt, On Caster, spell damage mod flat amt, base: amt
focusFcDamageAmt2, //@Fc, SPA: 462, SE_FcDamageAmt2, On Caster, spell damage mod flat amt, base: amt
focusFcDamageAmtCrit, //@Fc, SPA: 303, SE_FFcDamageAmtCrit, On Caster, spell damage mod flat amt, base: amt
focusSpellDurByTic, //@Fc, SPA: 287, SE_SpellDurationIncByTic, On Caster, spell buff duration mod, base: tics
focusSwarmPetDuration, //@Fc, SPA: 398, SE_SwarmPetDuration, On Caster, swarm pet duration mod, base: milliseconds
focusReduceRecastTime, //@Fc, SPA: 310, SE_ReduceReuseTimer, On Caster, disc reuse time mod, base: milliseconds
focusBlockNextSpell, //@Fc, SPA: 335, SE_BlockNextSpellFocus, On Caster, chance to block next spell, base: chance
focusFcHealPctIncoming, //@Fc, SPA: 395, SE_FcHealPctCritIncoming, On Target, heal received mod pct, base: pct
focusFcDamageAmtIncoming, //@Fc, SPA: 297, SE_FcDamageAmtIncoming, On Target, damage taken flat amt, base: amt
focusFcSpellDamageAmtIncomingPC, //@Fc, SPA: 484, SE_Fc_Spell_Damage_Amt_IncomingPC, On Target, damage taken flat amt, base: amt
focusFcCastSpellOnLand, //@Fc, SPA: 481, SE_Fc_Cast_Spell_On_Land, On Target, cast spell if hit by spell, base: chance pct, limit: spellid
focusFcHealAmtIncoming, //@Fc, SPA: 394, SE_FcHealAmtIncoming, On Target, heal received mod flat amt, base: amt
focusFcBaseEffects, //@Fc, SPA: 413, SE_FcBaseEffects, On Caster, base spell effectiveness mod pct, base: pct
focusIncreaseNumHits, //@Fc, SPA: 421, SE_FcIncreaseNumHits, On Caster, numhits mod flat amt, base: amt
focusFcLimitUse, //@Fc, SPA: 420, SE_FcLimitUse, On Caster, numhits mod pct, base: pct
focusFcMute, //@Fc, SPA: 357, SE_FcMute, On Caster, prevents spell casting, base: chance pct
focusFcTimerRefresh, //@Fc, SPA: 389, SE_FcTimerRefresh, On Caster, reset all recast timers, base: 1
focusFcStunTimeMod, //@Fc, SPA: 133, SE_FcStunTimeMod, On Caster, stun time mod pct, base: chance pct
focusFcResistIncoming, //@Fc, SPA: 510, SE_Fc_Resist_Incoming, On Target, resist modifier, base: amt
focusFcAmplifyMod, //@Fc, SPA: 507, SE_Fc_Amplify_Mod, On Caster, damage-heal-dot mod pct, base: pct
focusFcAmplifyAmt, //@Fc, SPA: 508, SE_Fc_Amplify_Amt, On Caster, damage-heal-dot mod flat amt, base: amt
focusFcCastTimeMod2, //@Fc, SPA: 500, SE_Fc_CastTimeMod2, On Caster, cast time mod pct, base: pct
focusFcCastTimeAmt, //@Fc, SPA: 501, SE_Fc_CastTimeAmt, On Caster, cast time mod flat amt, base: milliseconds
focusFcHealPctCritIncoming, //@Fc, SPA: 393, SE_FcHealPctCritIncoming, On Target, heal received critical chance mod, base: chance pct
focusFcHealAmt, //@Fc, SPA: 392, SE_FcHealAmt, On Caster, spell healing mod flat amt, base: amt
focusFcHealAmtCrit, //@Fc, SPA: 396, SE_FcHealAmtCrit, On Caster, spell healing mod flat amt, base: amt
} focusType; //Any new FocusType needs to be added to the Mob::IsFocus function
#define HIGHEST_FOCUS focusFcHealAmtCrit //Should always be last focusType in enum
+12 -2
View File
@@ -103,6 +103,7 @@ int32 Mob::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) {
value += value_BaseEffect*GetFocusEffect(focusImprovedDamage2, spell_id)/100;
value += int(value_BaseEffect*GetFocusEffect(focusFcDamagePctCrit, spell_id)/100)*ratio/100;
value += int(value_BaseEffect*GetFocusEffect(focusFcAmplifyMod, spell_id) / 100)*ratio / 100;
if (target) {
value += int(value_BaseEffect*target->GetVulnerability(this, spell_id, 0)/100)*ratio/100;
@@ -113,6 +114,7 @@ int32 Mob::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) {
value -= GetFocusEffect(focusFcDamageAmt, spell_id);
value -= GetFocusEffect(focusFcDamageAmt2, spell_id);
value -= GetFocusEffect(focusFcAmplifyAmt, spell_id);
if (RuleB(Spells, IgnoreSpellDmgLvlRestriction) && !spells[spell_id].no_heal_damage_item_mod && itembonuses.SpellDmg)
value -= GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, value)*ratio / 100;
@@ -140,6 +142,7 @@ int32 Mob::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) {
value += value_BaseEffect*GetFocusEffect(focusImprovedDamage2, spell_id)/100;
value += value_BaseEffect*GetFocusEffect(focusFcDamagePctCrit, spell_id)/100;
value += value_BaseEffect*GetFocusEffect(focusFcAmplifyMod, spell_id)/100;
if (target) {
value += value_BaseEffect*target->GetVulnerability(this, spell_id, 0)/100;
@@ -150,6 +153,7 @@ int32 Mob::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) {
value -= GetFocusEffect(focusFcDamageAmt, spell_id);
value -= GetFocusEffect(focusFcDamageAmt2, spell_id);
value -= GetFocusEffect(focusFcAmplifyAmt, spell_id);
if (RuleB(Spells, IgnoreSpellDmgLvlRestriction) && !spells[spell_id].no_heal_damage_item_mod && itembonuses.SpellDmg)
value -= GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, value);
@@ -191,11 +195,13 @@ int32 Mob::GetActDoTDamage(uint16 spell_id, int32 value, Mob* target) {
value += int(value_BaseEffect*GetFocusEffect(focusImprovedDamage, spell_id)/100)*ratio/100;
value += int(value_BaseEffect*GetFocusEffect(focusImprovedDamage2, spell_id)/100)*ratio/100;
value += int(value_BaseEffect*GetFocusEffect(focusFcDamagePctCrit, spell_id)/100)*ratio/100;
value += int(value_BaseEffect*GetFocusEffect(focusFcAmplifyMod, spell_id) / 100)*ratio/100;
value += int(value_BaseEffect*target->GetVulnerability(this, spell_id, 0)/100)*ratio/100;
extra_dmg = target->GetFcDamageAmtIncoming(this, spell_id) +
int(GetFocusEffect(focusFcDamageAmtCrit, spell_id)*ratio/100) +
GetFocusEffect(focusFcDamageAmt, spell_id) +
GetFocusEffect(focusFcDamageAmt2, spell_id);
GetFocusEffect(focusFcDamageAmt2, spell_id) +
GetFocusEffect(focusFcAmplifyAmt, spell_id);
if (extra_dmg) {
int duration = CalcBuffDuration(this, this, spell_id);
@@ -211,11 +217,13 @@ int32 Mob::GetActDoTDamage(uint16 spell_id, int32 value, Mob* target) {
value += value_BaseEffect*GetFocusEffect(focusImprovedDamage, spell_id)/100;
value += value_BaseEffect*GetFocusEffect(focusImprovedDamage2, spell_id)/100;
value += value_BaseEffect*GetFocusEffect(focusFcDamagePctCrit, spell_id)/100;
value += value_BaseEffect*GetFocusEffect(focusFcAmplifyMod, spell_id)/100;
value += value_BaseEffect*target->GetVulnerability(this, spell_id, 0)/100;
extra_dmg = target->GetFcDamageAmtIncoming(this, spell_id) +
GetFocusEffect(focusFcDamageAmtCrit, spell_id) +
GetFocusEffect(focusFcDamageAmt, spell_id) +
GetFocusEffect(focusFcDamageAmt2, spell_id);
GetFocusEffect(focusFcDamageAmt2, spell_id) +
GetFocusEffect(focusFcAmplifyAmt, spell_id);
if (extra_dmg) {
int duration = CalcBuffDuration(this, this, spell_id);
@@ -275,6 +283,7 @@ int32 Mob::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) {
value = value_BaseEffect;
value += int(value_BaseEffect*GetFocusEffect(focusImprovedHeal, spell_id)/100);
value += int(value_BaseEffect*GetFocusEffect(focusFcAmplifyMod, spell_id) / 100);
// Instant Heals
if(spells[spell_id].buffduration < 1) {
@@ -297,6 +306,7 @@ int32 Mob::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) {
value *= modifier;
value += GetFocusEffect(focusFcHealAmtCrit, spell_id) * modifier;
value += GetFocusEffect(focusFcHealAmt, spell_id);
value += GetFocusEffect(focusFcAmplifyAmt, 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()%17) - 1] >= GetLevel() - 5)
+7 -1
View File
@@ -3120,6 +3120,7 @@ uint32 Mob::GetLevelHP(uint8 tlevel)
int32 Mob::GetActSpellCasttime(uint16 spell_id, int32 casttime)
{
int32 cast_reducer = GetFocusEffect(focusSpellHaste, spell_id);
cast_reducer += GetFocusEffect(focusFcCastTimeMod2, spell_id);
auto min_cap = casttime / 2;
if (level > 50 && casttime >= 3000 && !spells[spell_id].goodEffect &&
@@ -3129,7 +3130,12 @@ int32 Mob::GetActSpellCasttime(uint16 spell_id, int32 casttime)
}
casttime = casttime * (100 - cast_reducer) / 100;
return std::max(casttime, min_cap);
int32 cast_reducer_amt = GetFocusEffect(focusFcCastTimeAmt, spell_id);
casttime = std::max(casttime, min_cap) - cast_reducer_amt;
return std::max(casttime, 0);
}
void Mob::ExecWeaponProc(const EQ::ItemInstance *inst, uint16 spell_id, Mob *on, int level_override) {
+144 -6
View File
@@ -3214,6 +3214,18 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
case SE_Fc_Cast_Spell_On_Land:
case SE_Ff_CasterClass:
case SE_Ff_Same_Caster:
case SE_Fc_ResistIncoming:
case SE_Fc_Amplify_Amt:
case SE_Fc_Amplify_Mod:
case SE_Fc_CastTimeAmt:
case SE_Fc_CastTimeMod2:
case SE_Ff_DurationMax:
case SE_Ff_Endurance_Max:
case SE_Ff_Endurance_Min:
case SE_Ff_ReuseTimeMin:
case SE_Ff_ReuseTimeMax:
case SE_Ff_Value_Min:
case SE_Ff_Value_Max:
{
break;
}
@@ -4431,6 +4443,8 @@ int16 Client::CalcAAFocus(focusType type, const AA::Rank &rank, uint16 spell_id)
int32 base2 = 0;
uint32 slot = 0;
int index_id = -1;
bool LimitFailure = false;
bool LimitInclude[MaxLimitInclude] = {false};
/* Certain limits require only one of several Include conditions to be true. Ie. Add damage to fire OR ice
@@ -4650,7 +4664,7 @@ int16 Client::CalcAAFocus(focusType type, const AA::Rank &rank, uint16 spell_id)
case SE_LimitSpellClass:
if (base1 < 0) { // Exclude
if (CheckSpellCategory(spell_id, base1, SE_LimitSpellClass))
return (0);
LimitFailure = true;
}
else {
LimitInclude[12] = true;
@@ -4662,7 +4676,7 @@ int16 Client::CalcAAFocus(focusType type, const AA::Rank &rank, uint16 spell_id)
case SE_LimitSpellSubclass:
if (base1 < 0) { // Exclude
if (CheckSpellCategory(spell_id, base1, SE_LimitSpellSubclass))
return (0);
LimitFailure = true;
}
else {
LimitInclude[14] = true;
@@ -4693,6 +4707,43 @@ int16 Client::CalcAAFocus(focusType type, const AA::Rank &rank, uint16 spell_id)
LimitFailure = true;
break;
case SE_Ff_DurationMax:
if (base1 > spell.buffduration)
LimitFailure = true;
break;
case SE_Ff_Endurance_Min:
if (spell.EndurCost < base1)
LimitFailure = true;
break;
case SE_Ff_Endurance_Max:
if (spell.EndurCost > base1)
LimitFailure = true;
break;
case SE_Ff_ReuseTimeMin:
if (spell.recast_time < base1)
LimitFailure = true;
break;
case SE_Ff_ReuseTimeMax:
if (spell.recast_time > base1)
LimitFailure = true;
break;
case SE_Ff_Value_Min:
index_id = GetSpellEffectIndex(spell_id, base2);
if (index_id >= 0 && spell.base[index_id] < base1)
LimitFailure = true;
break;
case SE_Ff_Value_Max:
index_id = GetSpellEffectIndex(spell_id, base2);
if (index_id >= 0 && spell.base[index_id] > base1)
LimitFailure = true;
break;
/* These are not applicable to AA's because there is never a 'caster' of the 'buff' with the focus effect.
case SE_Ff_Same_Caster:
case SE_Ff_CasterClass:
@@ -4709,6 +4760,11 @@ int16 Client::CalcAAFocus(focusType type, const AA::Rank &rank, uint16 spell_id)
value = base1;
break;
case SE_Fc_Amplify_Mod:
if (type == focusFcAmplifyMod && base1 > value)
value = base1;
break;
case SE_ImprovedHeal:
if (type == focusImprovedHeal && base1 > value)
value = base1;
@@ -4724,6 +4780,16 @@ int16 Client::CalcAAFocus(focusType type, const AA::Rank &rank, uint16 spell_id)
value = base1;
break;
case SE_Fc_CastTimeMod2:
if (type == focusFcCastTimeMod2 && base1 > value)
value = base1;
break;
case SE_Fc_CastTimeAmt:
if (type == focusFcCastTimeAmt && base1 > value)
value = base1;
break;
case SE_IncreaseSpellDuration:
if (type == focusSpellDuration && base1 > value)
value = base1;
@@ -4759,6 +4825,11 @@ int16 Client::CalcAAFocus(focusType type, const AA::Rank &rank, uint16 spell_id)
value = base1;
break;
case SE_Fc_ResistIncoming:
if (type == focusFcResistIncoming && base1 > value)
value = base1;
break;
case SE_SpellHateMod:
if (type == focusSpellHateMod) {
if (value != 0) {
@@ -4831,6 +4902,11 @@ int16 Client::CalcAAFocus(focusType type, const AA::Rank &rank, uint16 spell_id)
value = base1;
break;
case focusFcAmplifyAmt:
if (type == focusFcAmplifyAmt)
value = base1;
break;
case SE_FcDamageAmtCrit:
if (type == focusFcDamageAmtCrit)
value = base1;
@@ -4934,6 +5010,10 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo
if (!IsValidSpell(focus_id) || !IsValidSpell(spell_id))
return 0;
//Check this here also, some focus effects call this directly, bypassing GetFocusEffect function.
if (spells[spell_id].not_focusable && !IsEffectInSpell(spell_id, SE_Ff_Override_NotFocusable))
return 0;
const SPDat_Spell_Struct &focus_spell = spells[focus_id];
const SPDat_Spell_Struct &spell = spells[spell_id];
@@ -4942,10 +5022,12 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo
int spell_level = 0;
int lvldiff = 0;
uint32 Caston_spell_id = 0;
int index_id = -1;
bool LimitInclude[MaxLimitInclude] = {false};
/* Certain limits require only one of several Include conditions to be true. Ie. Add damage to fire OR ice
spells.
/* Certain limits require only one of several Include conditions to be true. Determined by limits being negative or positive
Ie. Add damage to fire OR ice spells. If positive we 'Include', by checking each limit of same type to look for match until found. Opposed to
just 'Excluding', where if set to negative, if we find that match then focus fails, ie Add damage to all spells BUT Fire.
0/1 SE_LimitResist
2/3 SE_LimitSpell
4/5 SE_LimitEffect
@@ -5181,6 +5263,37 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo
return 0;
break;
case SE_Ff_DurationMax:
if (focus_spell.base[i] > spell.buffduration)
return 0;
break;
case SE_Ff_Endurance_Min:
if (spell.EndurCost < focus_spell.base[i])
return 0;
case SE_Ff_Endurance_Max:
if (spell.EndurCost > focus_spell.base[i])
return 0;
case SE_Ff_ReuseTimeMin:
if (spell.recast_time < focus_spell.base[i])
return 0;
case SE_Ff_ReuseTimeMax:
if (spell.recast_time > focus_spell.base[i])
return 0;
case SE_Ff_Value_Min:
index_id = GetSpellEffectIndex(spell_id, focus_spell.base2[i]);
if (index_id >= 0 && spell.base[index_id] < focus_spell.base[i])
return 0;
case SE_Ff_Value_Max:
index_id = GetSpellEffectIndex(spell_id, focus_spell.base2[i]);
if (index_id >= 0 && spell.base[index_id] > focus_spell.base[i])
return 0;
// handle effects
case SE_ImprovedDamage:
if (type == focusImprovedDamage) {
@@ -5223,6 +5336,11 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo
}
break;
case SE_Fc_Amplify_Mod:
if (type == focusFcAmplifyMod && focus_spell.base[i] > value)
value = focus_spell.base[i];
break;
case SE_ImprovedHeal:
if (type == focusImprovedHeal) {
if (best_focus) {
@@ -5260,6 +5378,16 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo
value = focus_spell.base[i];
break;
case SE_Fc_CastTimeMod2:
if (type == focusFcCastTimeMod2 && focus_spell.base[i] > value)
value = focus_spell.base[i];
break;
case SE_Fc_CastTimeAmt:
if (type == focusFcCastTimeAmt && focus_spell.base[i] > value)
value = focus_spell.base[i];
break;
case SE_IncreaseSpellDuration:
if (type == focusSpellDuration && focus_spell.base[i] > value)
value = focus_spell.base[i];
@@ -5306,6 +5434,11 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo
}
break;
case SE_Fc_ResistIncoming:
if (type == focusFcResistIncoming && focus_spell.base[i] > value)
value = focus_spell.base[i];
break;
case SE_SpellHateMod:
if (type == focusSpellHateMod) {
if (value != 0) {
@@ -5395,6 +5528,11 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo
value = focus_spell.base[i];
break;
case focusFcAmplifyAmt:
if (type == focusFcAmplifyAmt)
value = focus_spell.base[i];
break;
case SE_FcDamageAmtCrit:
if (type == focusFcDamageAmtCrit)
value = focus_spell.base[i];
@@ -5627,7 +5765,7 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id)
if (IsBardSong(spell_id) && type != focusFcBaseEffects && type != focusSpellDuration)
return 0;
if (spells[spell_id].not_focusable)
if (spells[spell_id].not_focusable && !IsEffectInSpell(spell_id, SE_Ff_Override_NotFocusable))
return 0;
int16 realTotal = 0;
@@ -5901,7 +6039,7 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id)
int16 NPC::GetFocusEffect(focusType type, uint16 spell_id) {
if (spells[spell_id].not_focusable)
if (spells[spell_id].not_focusable && !IsEffectInSpell(spell_id, SE_Ff_Override_NotFocusable))
return 0;
int16 realTotal = 0;
+12 -3
View File
@@ -406,8 +406,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot,
spell.targettype == ST_Self ||
spell.targettype == ST_AECaster ||
spell.targettype == ST_Ring ||
spell.targettype == ST_Beam ||
spell.targettype == ST_TargetOptional) && target_id == 0)
spell.targettype == ST_Beam) && target_id == 0)
{
LogSpells("Spell [{}] auto-targeted the caster. Group? [{}], target type [{}]", spell_id, IsGroupSpell(spell_id), spell.targettype);
target_id = GetID();
@@ -1578,7 +1577,12 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce
// single target spells
case ST_Self:
{
spell_target = this;
if (!spell_target)
{
LogSpells("Spell [{}] canceled: invalid target (normal)", spell_id);
MessageString(Chat::Red, SPELL_NEED_TAR);
return false; // can't cast these unless we have a target
}
CastAction = SingleTarget;
break;
}
@@ -4528,8 +4532,13 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use
resist_modifier += caster->GetSpecialAbilityParam(CASTING_RESIST_DIFF, 0);
int focus_resist = caster->GetFocusEffect(focusResistRate, spell_id);
resist_modifier -= 2 * focus_resist;
int focus_incoming_resist = GetFocusEffect(focusFcResistIncoming, spell_id);
resist_modifier -= focus_incoming_resist;
//Check for fear resist
bool IsFear = false;
if(IsFearSpell(spell_id))