Merge pull request #365 from KayenEQ/Development

Calc focus effects from worn slots, for an additive foci bonus [NOT LIVE LIKE]
This commit is contained in:
KayenEQ 2015-02-05 06:24:43 -05:00
commit b169544711
6 changed files with 22 additions and 9 deletions

View File

@ -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, 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_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, 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_END()
RULE_CATEGORY( Combat ) RULE_CATEGORY( Combat )

View File

@ -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.');

View File

@ -411,11 +411,11 @@ void Client::AddItemBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAu
newbon->DSMitigation += item->DSMitigation; newbon->DSMitigation += item->DSMitigation;
} }
if (item->Worn.Effect>0 && (item->Worn.Type == ET_WornEffect)) { // latent effects 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 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) switch(item->BardType)
@ -639,7 +639,7 @@ void Client::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon)
uint8 focus = IsFocusEffect(0, 0, true,effect); uint8 focus = IsFocusEffect(0, 0, true,effect);
if (focus) if (focus)
{ {
newbon->FocusEffects[focus] = effect; newbon->FocusEffects[focus] = static_cast<uint8>(effect);
continue; continue;
} }
@ -1393,7 +1393,7 @@ void Mob::CalcSpellBonuses(StatBonuses* newbon)
int buff_count = GetMaxTotalSlots(); int buff_count = GetMaxTotalSlots();
for(i = 0; i < buff_count; i++) { for(i = 0; i < buff_count; i++) {
if(buffs[i].spellid != SPELL_UNKNOWN){ 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) if (buffs[i].numhits > 0)
Numhits(true); 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. 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) bool IsAISpellEffect, uint16 effect_id, int32 se_base, int32 se_limit, int32 se_max)
{ {
int i, effect_value, base2, max, effectid; 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); uint8 focus = IsFocusEffect(spell_id, i);
if (focus) if (focus)
{ {
new_bonus->FocusEffects[focus] = spells[spell_id].effectid[i]; if (!IsWornEffect)
new_bonus->FocusEffects[focus] = static_cast<uint8>(spells[spell_id].effectid[i]);
else if (RuleB(Spells, UseAdditiveFocusFromWornSlot))
new_bonus->FocusEffectsWorn[focus] += spells[spell_id].base[i];
continue; continue;
} }

View File

@ -350,7 +350,8 @@ struct StatBonuses {
int32 CharmBreakChance; // chance to break charm int32 CharmBreakChance; // chance to break charm
int32 SongRange; // increases range of beneficial bard songs int32 SongRange; // increases range of beneficial bard songs
uint32 HPToManaConvert; // Uses HP to cast spells at specific conversion 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) bool NegateEffects; // Check if you contain a buff with negate effect. (only spellbonuses)
int32 SkillDamageAmount2[HIGHEST_SKILL+2]; // Adds skill specific damage int32 SkillDamageAmount2[HIGHEST_SKILL+2]; // Adds skill specific damage
uint32 NegateAttacks[3]; // 0 = bool HasEffect 1 = Buff Slot 2 = Max damage absorbed per hit uint32 NegateAttacks[3]; // 0 = bool HasEffect 1 = Buff Slot 2 = Max damage absorbed per hit

View File

@ -194,7 +194,7 @@ public:
bool IsBeneficialAllowed(Mob *target); bool IsBeneficialAllowed(Mob *target);
virtual int GetCasterLevel(uint16 spell_id); virtual int GetCasterLevel(uint16 spell_id);
void ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* newbon, uint16 casterID = 0, 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); bool IsAISpellEffect = false, uint16 effect_id = 0, int32 se_base = 0, int32 se_limit = 0, int32 se_max = 0);
void NegateSpellsBonuses(uint16 spell_id); void NegateSpellsBonuses(uint16 spell_id);
virtual float GetActSpellRange(uint16 spell_id, float range, bool IsBard = false); virtual float GetActSpellRange(uint16 spell_id, float range, bool IsBard = false);

View File

@ -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 //Summon Spells that require reagents are typically imbue type spells, enchant metal, sacrifice and shouldn't be affected
//by reagent conservation for obvious reasons. //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) { int16 NPC::GetFocusEffect(focusType type, uint16 spell_id) {