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
+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;