Pelf

Pelf guardian of ancient kings

Apr 28th, 2012
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 7.62 KB | None | 0 0
  1. diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
  2. index 13f5503..939b099 100644
  3. --- a/src/server/game/Entities/Unit/Unit.cpp
  4. +++ b/src/server/game/Entities/Unit/Unit.cpp
  5. @@ -6620,6 +6620,81 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
  6.          }
  7.          case SPELLFAMILY_PALADIN:
  8.          {
  9. +           // Ancient Crusader (player)
  10. +           if (dummySpell->Id == 86701)
  11. +           {
  12. +               if (GetTypeId() != TYPEID_PLAYER)
  13. +                   return false;
  14. +
  15. +               //if caster has no guardian of ancient kings aura then remove dummy aura
  16. +               if (!HasAura(86698))
  17. +               {
  18. +                   RemoveAurasDueToSpell(86701);
  19. +                   return false;
  20. +               }
  21. +
  22. +               CastSpell(this, 86700, true);
  23. +               return true;
  24. +           }
  25. +           // Ancient Crusader (guardian)
  26. +           if (dummySpell->Id == 86703)
  27. +           {
  28. +               if (!GetOwner() || GetOwner()->GetTypeId() != TYPEID_PLAYER)
  29. +                   return false;
  30. +
  31. +               GetOwner()->CastSpell(this, 86700, true);
  32. +                  
  33. +               return true;
  34. +           }
  35. +           // Ancient Healer
  36. +           if (dummySpell->Id == 86674)
  37. +           {
  38. +               if (GetTypeId() != TYPEID_PLAYER)
  39. +                   return false;
  40. +
  41. +               //if caster has no guardian of ancient kings aura then remove dummy aura
  42. +               if (!HasAura(86669))
  43. +               {
  44. +                   RemoveAurasDueToSpell(86674);
  45. +                   return false;
  46. +               }
  47. +
  48. +              
  49. +               // check for single target spell (TARGET_SINGLE_FRIEND, NO_TARGET)
  50. +               if (!(procSpell->EffectImplicitTargetA[triggeredByAura->GetEffIndex()] == 21 &&
  51. +                   procSpell->EffectImplicitTargetB[triggeredByAura->GetEffIndex()] == 0))
  52. +                   return false;
  53. +
  54. +               // Need to get guardian but that's NOT WORK!!!
  55. +               //if (Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, GetPetGUID()))
  56. +              
  57. +               std::list<Creature*> petlist;
  58. +               GetCreatureListWithEntryInGrid(petlist, 46499, 100.0f);
  59. +               if (!petlist.empty())
  60. +                   for (std::list<Creature*>::const_iterator itr = petlist.begin(); itr != petlist.end(); ++itr)
  61. +                   {
  62. +                       Unit* pet = (*itr);
  63. +                       if (pet->GetOwnerGUID() == GetGUID())
  64. +                       {
  65. +                           //need to save num of heals up to 5
  66. +                           //I've done it with AI, maybe there's better way
  67. +                           uint32 heals = pet->GetAI()->GetData(1001);
  68. +                           int32 bp0 = damage;
  69. +                           int32 bp1 = damage / 10;
  70. +                           pet->CastCustomSpell(pVictim, 86678, &bp0, &bp1, NULL, true);
  71. +                           if (heals > 3)
  72. +                           {
  73. +                               //Dismiss guardian and remove auras
  74. +                               pet->ToCreature()->ForcedDespawn();
  75. +                               RemoveAurasDueToSpell(86669);
  76. +                               RemoveAurasDueToSpell(86674);
  77. +                           }
  78. +                           else
  79. +                               pet->GetAI()->SetData(1001, heals + 1);
  80. +                       }
  81. +                   }
  82. +               return true;
  83. +           }
  84.              // Seal of Righteousness - melee proc dummy (addition ${$MWS*(0.022*$AP+0.044*$SPH)} damage)
  85.              if (dummySpell->SpellFamilyFlags[0]&0x8000000)
  86.              {
  87. diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
  88. index 8929f75..bc524a5 100644
  89. --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
  90. +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
  91. @@ -6663,11 +6663,26 @@ void AuraEffect::HandleAuraDummy(AuraApplication const *aurApp, uint8 mode, bool
  92.              break;
  93.          }
  94.          case SPELLFAMILY_PALADIN:
  95. -           // Holy shield
  96.             switch(GetId())
  97.             {
  98. -           case 20925:
  99. -                               //HandleShieldBlockValue(aurApp, mode, apply);
  100. +               //Guardian of Ancient Kings (retribution)
  101. +           case 86698:
  102. +               if (!apply)
  103. +               {
  104. +                   if (caster->HasAura(86700))
  105. +                   {
  106. +                       caster->CastSpell(caster, 86704, true);
  107. +                       caster->RemoveAurasDueToSpell(86700);
  108. +                       caster->RemoveAurasDueToSpell(86701);
  109. +                   }
  110. +               }
  111. +               break;
  112. +               //Guardian of Ancient Kings (holy)
  113. +           case 86669:
  114. +               if (!apply)
  115. +               {
  116. +                   caster->RemoveAurasDueToSpell(86674);
  117. +               }
  118.                 break;
  119.             }
  120.              break;
  121. diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
  122. index 0110f15..434ac7b 100644
  123. --- a/src/server/game/Spells/SpellEffects.cpp
  124. +++ b/src/server/game/Spells/SpellEffects.cpp
  125. @@ -340,6 +340,22 @@ void Spell::EffectEnvirinmentalDMG(SpellEffIndex effIndex)
  126.  
  127.  void Spell::EffectSchoolDMG(SpellEffIndex /*effIndex*/)
  128.  {
  129. +   // Ancient Fury
  130. +   if (m_spellInfo->Id == 86704)
  131. +   {
  132. +       if (m_caster->GetTypeId() == TYPEID_PLAYER)
  133. +       {
  134. +           if (Aura* aura = m_caster->GetAura(86700))
  135. +           {
  136. +               uint8 stacks = aura->GetStackAmount();
  137. +               uint32 count = 0;
  138. +               for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
  139. +                   ++count;
  140. +               damage = (damage + damage * stacks) / count;
  141. +           }
  142. +       }
  143. +   }
  144. +   m_damage += damage;
  145.  }
  146.  
  147.  void Spell::SpellDamageSchoolDmg(SpellEffIndex effIndex)
  148. @@ -1752,6 +1768,30 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
  149.  
  150.              switch (m_spellInfo->Id)
  151.              {
  152. +               case 86150: // Guardian of ancient kings
  153. +               {
  154. +                   if (m_caster->GetTypeId() == TYPEID_PLAYER)
  155. +                   {
  156. +                       //Holy, check holy shock spell
  157. +                       if (m_caster->HasSpell(20473))
  158. +                       {
  159. +                           m_caster->CastSpell(m_caster, 86669, true);
  160. +                           m_caster->CastSpell(m_caster, 86674, true);
  161. +                       }
  162. +                       //Protection, check avenger's shield
  163. +                       else if (m_caster->HasSpell(31935))
  164. +                       {
  165. +                           m_caster->CastSpell(m_caster, 86659, true);
  166. +                       }
  167. +                       //Retribution, check templar's verdict
  168. +                       else if (m_caster->HasSpell(85256))
  169. +                       {
  170. +                           m_caster->CastSpell(m_caster, 86698, true);
  171. +                           m_caster->CastSpell(m_caster, 86701, true);
  172. +                       }
  173. +                   }
  174. +                   break;
  175. +               }
  176.                  case 19740: // Blessing of Might
  177.                  {
  178.                      if (m_caster->GetTypeId() == TYPEID_PLAYER)
  179. diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
  180. index 10757d6..b3591fc 100644
  181. --- a/src/server/scripts/World/npcs_special.cpp
  182. +++ b/src/server/scripts/World/npcs_special.cpp
  183. @@ -3043,6 +3043,73 @@ public:
  184.      };
  185.  };
  186.  
  187. +class npc_guardian_of_ancient_kings : public CreatureScript
  188. +{
  189. +public:
  190. +    npc_guardian_of_ancient_kings() : CreatureScript("npc_guardian_of_ancient_kings") { }
  191. +
  192. +   CreatureAI *GetAI(Creature *creature) const
  193. +    {
  194. +        return new npc_guardian_of_ancient_kingsAI(creature);
  195. +    }
  196. +
  197. +    struct npc_guardian_of_ancient_kingsAI : public ScriptedAI
  198. +    {
  199. +        npc_guardian_of_ancient_kingsAI(Creature *c) : ScriptedAI(c)
  200. +       {
  201. +           uiHeals = 0;
  202. +       }
  203. +
  204. +       uint32 uiHeals;
  205. +
  206. +        void Reset()
  207. +        {
  208. +           me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
  209. +           me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
  210. +           if (me->GetEntry() == 46506)
  211. +               me->SetReactState(REACT_AGGRESSIVE);
  212. +           else
  213. +               me->SetReactState(REACT_PASSIVE);
  214. +
  215. +           if (me->GetEntry() == 46490)
  216. +           {
  217. +               if (me->GetOwner())
  218. +                   DoCast(me->GetOwner(), 86657);
  219. +           }
  220. +           else if (me->GetEntry() == 46506)
  221. +           {
  222. +               if (me->GetOwner())
  223. +                   DoCast(me, 86703, true);
  224. +           }
  225. +        }
  226. +
  227. +       void SetData(uint32 type, uint32 data)
  228. +       {
  229. +           if (type == 1001)
  230. +               uiHeals = data;
  231. +       }
  232. +
  233. +       uint32 GetData(uint32 type)
  234. +       {
  235. +           if (type == 1001)
  236. +               return uiHeals;
  237. +
  238. +           return 0;
  239. +       }
  240. +
  241. +        void UpdateAI(const uint32 diff)
  242. +        {
  243. +            if (!UpdateVictim())
  244. +                return;
  245. +
  246. +           if (me->HasUnitState(UNIT_STAT_CASTING))
  247. +               return;
  248. +
  249. +           DoMeleeAttackIfReady();
  250. +        }
  251. +    };
  252. +};
  253. +
  254.  void AddSC_npcs_special()
  255.  {
  256.      new npc_air_force_bots;
  257. @@ -3077,5 +3144,6 @@ void AddSC_npcs_special()
  258.      new npc_flame_orb;
  259.      new npc_power_word_barrier;
  260.     new npc_bloodworm();
  261. +   new npc_guardian_of_ancient_kings();
  262.  }
Advertisement
Add Comment
Please, Sign In to add comment