From 718ba3edbf8c01b4e8c92034cb1be0a5483af4b0 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Mon, 30 Jun 2014 16:17:55 -0400 Subject: [PATCH] Implemented SE_PetMeleeMitigation - Bonus applied to pet owner. Gives AC to owner's pet. Related AA's to be added in a seperate update. --- changelog.txt | 1 + common/spdat.h | 2 +- zone/attack.cpp | 14 ++++++++++++-- zone/bonuses.cpp | 14 ++++++++++++++ zone/common.h | 1 + 5 files changed, 29 insertions(+), 3 deletions(-) diff --git a/changelog.txt b/changelog.txt index 82dcc497f..0a22ccf8d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -19,6 +19,7 @@ Revised Assassinate mechanic so damage now receives all backstab bonuses, proc c system, or flat chance based on dex (formula updated). Assassinate can now proc from THROW if behind target, various other adjustments. Kayen: Fix to AA Finishing Blow missing aa_effects data, update required SQL. Revised Finishing blow so that damage now receives all melee bonus. Support also for this effect if placed on items or spells. +Kayen: Implemented SE_PetMeleeMitigation - Bonus applied to pet owner. Gives AC to owner's pet. Required SQL: utils/sql/git/required/2014_06_25_AA_Update.sql Optional SQL: utils/sql/git/optiional/2014_06_29_HeadShotRules.sql diff --git a/common/spdat.h b/common/spdat.h index 65bb9f692..23a50fc3f 100644 --- a/common/spdat.h +++ b/common/spdat.h @@ -544,7 +544,7 @@ typedef enum { #define SE_FcHealAmtIncoming 394 // implemented - Adds/Removes amount of healing on target by X value with foucs restrictions. #define SE_FcHealPctCritIncoming 395 // implemented[AA] - Increases chance of having a heal crit when cast on you. [focus limited] #define SE_FcHealAmtCrit 396 // implemented - Adds a direct healing amount to spells -//#define SE_PetMeleeMitigation 397 // *not implemented[AA] - additional mitigation to your pets. +#define SE_PetMeleeMitigation 397 // implemented[AA] - additional mitigation to your pets. Adds AC. #define SE_SwarmPetDuration 398 // implemented - Affects the duration of swarm pets #define SE_FcTwincast 399 // implemented - cast 2 spells for every 1 #define SE_HealGroupFromMana 400 // implemented - Drains mana and heals for each point of mana drained diff --git a/zone/attack.cpp b/zone/attack.cpp index 3346f4aa7..7b641bd96 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -560,11 +560,21 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit, ExtraAttac weight = (CastToClient()->CalcCurrentWeight() / 10.0); } else if (IsNPC()) { armor = CastToNPC()->GetRawAC(); + int PetACBonus = 0; if (!IsPet()) armor = (armor / RuleR(Combat, NPCACFactor)); + else{ + Mob *owner = nullptr; + owner = GetOwner(); + if (owner){ + PetACBonus = owner->aabonuses.PetMeleeMitigation + + owner->itembonuses.PetMeleeMitigation + + owner->spellbonuses.PetMeleeMitigation; + } + } - armor += spellbonuses.AC + itembonuses.AC + 1; + armor += spellbonuses.AC + itembonuses.AC + PetACBonus + 1; } if (opts) { @@ -4447,7 +4457,7 @@ bool Mob::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse) uint32 FB_Dmg = aabonuses.FinishingBlow[1] + spellbonuses.FinishingBlow[1] + itembonuses.FinishingBlow[1]; - uint16 FB_Level = 0; //Get Highest Headshot Level + uint16 FB_Level = 0; FB_Level = aabonuses.FinishingBlowLvl[0]; if (FB_Level < spellbonuses.FinishingBlowLvl[0]) FB_Level = spellbonuses.FinishingBlowLvl[0]; diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index 8b46773fc..5a13f2ccb 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -1311,6 +1311,10 @@ void Client::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon) break; } + case SE_PetMeleeMitigation: + newbon->PetMeleeMitigation += base1; + break; + } } } @@ -2844,6 +2848,10 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne break; } + case SE_PetMeleeMitigation: + newbon->PetMeleeMitigation += effect_value; + break; + //Special custom cases for loading effects on to NPC from 'npc_spels_effects' table if (IsAISpellEffect) { @@ -4075,6 +4083,12 @@ void Mob::NegateSpellsBonuses(uint16 spell_id) itembonuses.GivePetGroupTarget = false; break; + case SE_PetMeleeMitigation: + spellbonuses.PetMeleeMitigation = effect_value; + itembonuses.PetMeleeMitigation = effect_value; + aabonuses.PetMeleeMitigation = effect_value; + break; + case SE_RootBreakChance: spellbonuses.RootBreakChance = effect_value; aabonuses.RootBreakChance = effect_value; diff --git a/zone/common.h b/zone/common.h index 6d6ae581f..d9b0d53d3 100644 --- a/zone/common.h +++ b/zone/common.h @@ -427,6 +427,7 @@ struct StatBonuses { uint8 HSLevel; // Max Level Headshot will be effective at. uint32 Assassinate[2]; // Assassinate AA (Massive dmg vs humaniod w/ assassinate) 0= ? 1= Dmg uint8 AssassinateLevel; // Max Level Assassinate will be effective at. + int32 PetMeleeMitigation; // Add AC to owner's pet. };