From dd17597c923b48a3a6753d1a51715e5fcd6b53e2 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Thu, 5 Feb 2015 04:27:33 -0500 Subject: [PATCH 1/2] Implemented non-live like feature to allow focus effects to be placed in worn slot to provide an additive focus bonus that stacks with regular focus effects. This is opposed to how regular focus effects work in which the highest value is always taken. Please note, focus calculated from worn slot will only use only the focuses base value (ie ignores all limit checks). Example (Hypothetical). Improved Heal I (10 pct focus) in Helm Worn Slot Improved Heal I (10 pct focus) in Glove Worn Slot Improved Heal V (50 pct focus) in Glove Focus Slot Total Heal Focus would be 50 + 10 + 10 Added optional rule which is OFF by default. UseAdditiveFocusFromWornSlot --- common/ruletypes.h | 1 + zone/bonuses.cpp | 17 +++++++++++------ zone/common.h | 3 ++- zone/mob.h | 2 +- zone/spell_effects.cpp | 7 ++++++- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index 18fb3ba3e..ff88115e2 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -329,6 +329,7 @@ RULE_BOOL ( Spells, Jun182014HundredHandsRevamp, false) // this should be true f RULE_BOOL ( Spells, SwarmPetTargetLock, false) // Use old method of swarm pets target locking till target dies then despawning. RULE_BOOL ( Spells, NPC_UseFocusFromSpells, true) // Allow npcs to use most spell derived focus effects. RULE_BOOL ( Spells, NPC_UseFocusFromItems, false) // Allow npcs to use most item derived focus effects. +RULE_BOOL ( Spells, UseAdditiveFocusFromWornSlot, false) // Allows an additive focus effect to be calculated from worn slot. RULE_CATEGORY_END() RULE_CATEGORY( Combat ) diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index 8cceb5023..4aa13519b 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -411,11 +411,11 @@ void Client::AddItemBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAu newbon->DSMitigation += item->DSMitigation; } if (item->Worn.Effect>0 && (item->Worn.Type == ET_WornEffect)) { // latent effects - ApplySpellsBonuses(item->Worn.Effect, item->Worn.Level, newbon, 0, true); + ApplySpellsBonuses(item->Worn.Effect, item->Worn.Level, newbon, 0, true, true); } if (item->Focus.Effect>0 && (item->Focus.Type == ET_Focus)) { // focus effects - ApplySpellsBonuses(item->Focus.Effect, item->Focus.Level, newbon, 0, true); + ApplySpellsBonuses(item->Focus.Effect, item->Focus.Level, newbon, 0, true, false); } switch(item->BardType) @@ -639,7 +639,7 @@ void Client::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon) uint8 focus = IsFocusEffect(0, 0, true,effect); if (focus) { - newbon->FocusEffects[focus] = effect; + newbon->FocusEffects[focus] = static_cast(effect); continue; } @@ -1393,7 +1393,7 @@ void Mob::CalcSpellBonuses(StatBonuses* newbon) int buff_count = GetMaxTotalSlots(); for(i = 0; i < buff_count; i++) { if(buffs[i].spellid != SPELL_UNKNOWN){ - ApplySpellsBonuses(buffs[i].spellid, buffs[i].casterlevel, newbon, buffs[i].casterid, false, buffs[i].ticsremaining,i); + ApplySpellsBonuses(buffs[i].spellid, buffs[i].casterlevel, newbon, buffs[i].casterid, false, false, buffs[i].ticsremaining,i); if (buffs[i].numhits > 0) Numhits(true); @@ -1416,7 +1416,7 @@ void Mob::CalcSpellBonuses(StatBonuses* newbon) if (GetClass() == BARD) newbon->ManaRegen = 0; // Bards do not get mana regen from spells. } -void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* new_bonus, uint16 casterId, bool item_bonus, uint32 ticsremaining, int buffslot, +void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* new_bonus, uint16 casterId, bool item_bonus, bool IsWornEffect, uint32 ticsremaining, int buffslot, bool IsAISpellEffect, uint16 effect_id, int32 se_base, int32 se_limit, int32 se_max) { int i, effect_value, base2, max, effectid; @@ -1439,7 +1439,12 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne uint8 focus = IsFocusEffect(spell_id, i); if (focus) { - new_bonus->FocusEffects[focus] = spells[spell_id].effectid[i]; + if (!IsWornEffect) + new_bonus->FocusEffects[focus] = static_cast(spells[spell_id].effectid[i]); + + else if (RuleB(Spells, UseAdditiveFocusFromWornSlot)) + new_bonus->FocusEffectsWorn[focus] += spells[spell_id].base[i]; + continue; } diff --git a/zone/common.h b/zone/common.h index 20d19e94d..639eee91e 100644 --- a/zone/common.h +++ b/zone/common.h @@ -350,7 +350,8 @@ struct StatBonuses { int32 CharmBreakChance; // chance to break charm int32 SongRange; // increases range of beneficial bard songs uint32 HPToManaConvert; // Uses HP to cast spells at specific conversion - uint32 FocusEffects[HIGHEST_FOCUS+1]; // Stores the focus effectid for each focustype you have. + uint8 FocusEffects[HIGHEST_FOCUS+1]; // Stores the focus effectid for each focustype you have. + int16 FocusEffectsWorn[HIGHEST_FOCUS+1]; // Optional to allow focus effects to be applied additively from worn slot bool NegateEffects; // Check if you contain a buff with negate effect. (only spellbonuses) int32 SkillDamageAmount2[HIGHEST_SKILL+2]; // Adds skill specific damage uint32 NegateAttacks[3]; // 0 = bool HasEffect 1 = Buff Slot 2 = Max damage absorbed per hit diff --git a/zone/mob.h b/zone/mob.h index 330e8160e..41aa5783b 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -194,7 +194,7 @@ public: bool IsBeneficialAllowed(Mob *target); virtual int GetCasterLevel(uint16 spell_id); void ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* newbon, uint16 casterID = 0, - bool item_bonus = false, uint32 ticsremaining = 0, int buffslot = -1, + bool item_bonus = false, bool IsWornEffect = false, uint32 ticsremaining = 0, int buffslot = -1, bool IsAISpellEffect = false, uint16 effect_id = 0, int32 se_base = 0, int32 se_limit = 0, int32 se_max = 0); void NegateSpellsBonuses(uint16 spell_id); virtual float GetActSpellRange(uint16 spell_id, float range, bool IsBard = false); diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index a6725b296..24eac51ee 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -5527,7 +5527,12 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id) { //Summon Spells that require reagents are typically imbue type spells, enchant metal, sacrifice and shouldn't be affected //by reagent conservation for obvious reasons. - return realTotal + realTotal2 + realTotal3; + //Non-Live like feature to allow for an additive focus bonus to be applied from foci that are placed in worn slot. (No limit checks) + int16 worneffect_bonus = 0; + if (RuleB(Spells, UseAdditiveFocusFromWornSlot)) + worneffect_bonus = itembonuses.FocusEffectsWorn[type]; + + return realTotal + realTotal2 + realTotal3 + worneffect_bonus; } int16 NPC::GetFocusEffect(focusType type, uint16 spell_id) { From 1495eb42a34b402f01e31a97815e2f466ce28c6c Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Thu, 5 Feb 2015 04:27:52 -0500 Subject: [PATCH 2/2] sql --- utils/sql/git/optional/2015_2_5_UseAdditiveFocusFromWornSlot.sql | 1 + 1 file changed, 1 insertion(+) create mode 100644 utils/sql/git/optional/2015_2_5_UseAdditiveFocusFromWornSlot.sql diff --git a/utils/sql/git/optional/2015_2_5_UseAdditiveFocusFromWornSlot.sql b/utils/sql/git/optional/2015_2_5_UseAdditiveFocusFromWornSlot.sql new file mode 100644 index 000000000..905dcc163 --- /dev/null +++ b/utils/sql/git/optional/2015_2_5_UseAdditiveFocusFromWornSlot.sql @@ -0,0 +1 @@ +INSERT INTO `rule_values` (`ruleset_id`, `rule_name`, `rule_value`, `notes`) VALUES (1, 'Spells:UseAdditiveFocusFromWornSlot', 'false', '[Not live like] If a focus effect is placed in a worn slot the base value will calculated as an additive bonus to regular focus effects.');