Core/Spells: Fixed multiple druid's spells

Port From (https://github.com/TrinityCore/TrinityCore/commit/cf3ea2082578077cfec589c2a5fab12ab91c1777)
This commit is contained in:
hondacrx
2021-04-12 14:54:05 -04:00
parent b974c7f3a7
commit 96dbbb2b36
2 changed files with 65 additions and 12 deletions
+54 -8
View File
@@ -52,6 +52,7 @@ namespace Scripts.Spells.Druid
public const uint Exhilarate = 28742; public const uint Exhilarate = 28742;
public const uint FeralChargeBear = 16979; public const uint FeralChargeBear = 16979;
public const uint FeralChargeCat = 49376; public const uint FeralChargeCat = 49376;
public const uint FormAquaticPassive = 276012;
public const uint FormAquatic = 1066; public const uint FormAquatic = 1066;
public const uint FormFlight = 33943; public const uint FormFlight = 33943;
public const uint FormStag = 165961; public const uint FormStag = 165961;
@@ -74,6 +75,7 @@ namespace Scripts.Spells.Druid
public const uint LivingSeedProc = 48504; public const uint LivingSeedProc = 48504;
public const uint Mangle = 33917; public const uint Mangle = 33917;
public const uint MoonfireDamage = 164812; public const uint MoonfireDamage = 164812;
public const uint Prowl = 5215;
public const uint RejuvenationT10Proc = 70691; public const uint RejuvenationT10Proc = 70691;
public const uint RestorationT102PBonus = 70658; public const uint RestorationT102PBonus = 70658;
public const uint SavageRoar = 62071; public const uint SavageRoar = 62071;
@@ -177,7 +179,7 @@ namespace Scripts.Spells.Druid
if (damageInfo != null) if (damageInfo != null)
{ {
Unit target = GetTarget(); Unit target = GetTarget();
uint rage = (uint)(100.0f * (float)damageInfo.GetDamage() / (float)target.GetMaxHealth()); uint rage = (uint)(target.GetMaxPower(PowerType.Rage) * (float)damageInfo.GetDamage() / (float)target.GetMaxHealth());
if (rage > 0) if (rage > 0)
target.CastCustomSpell(SpellIds.BristlingFurGainRage, SpellValueMod.BasePoint0, (int)rage, target, TriggerCastFlags.FullMask); target.CastCustomSpell(SpellIds.BristlingFurGainRage, SpellValueMod.BasePoint0, (int)rage, target, TriggerCastFlags.FullMask);
} }
@@ -189,6 +191,25 @@ namespace Scripts.Spells.Druid
} }
} }
[Script] // 768 - CatForm - SPELL_DRUID_CAT_FORM
class spell_dru_cat_form : AuraScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.Prowl);
}
void HandleAfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
{
GetTarget().RemoveOwnedAura(SpellIds.Prowl);
}
public override void Register()
{
AfterEffectRemove.Add(new EffectApplyHandler(HandleAfterRemove, 0, AuraType.ModShapeshift, AuraEffectHandleModes.Real));
}
}
[Script] // 1850 - Dash [Script] // 1850 - Dash
public class spell_dru_dash : AuraScript public class spell_dru_dash : AuraScript
{ {
@@ -1375,7 +1396,7 @@ namespace Scripts.Spells.Druid
public override bool Validate(SpellInfo spellInfo) public override bool Validate(SpellInfo spellInfo)
{ {
return ValidateSpellInfo(SpellIds.FormStag, SpellIds.FormAquatic, SpellIds.FormFlight, SpellIds.FormSwiftFlight); return ValidateSpellInfo(SpellIds.FormStag, SpellIds.FormAquaticPassive, SpellIds.FormAquatic, SpellIds.FormFlight, SpellIds.FormSwiftFlight);
} }
public override bool Load() public override bool Load()
@@ -1422,13 +1443,13 @@ namespace Scripts.Spells.Druid
public static uint GetFormSpellId(Player player, Difficulty difficulty, bool requiresOutdoor) public static uint GetFormSpellId(Player player, Difficulty difficulty, bool requiresOutdoor)
{ {
// Check what form is appropriate // Check what form is appropriate
if (player.IsInWater()) // Aquatic form if (player.HasSpell(SpellIds.FormAquaticPassive) && player.IsInWater()) // Aquatic form
return SpellIds.FormAquatic; return SpellIds.FormAquatic;
if (!player.IsInCombat() && player.GetSkillValue(SkillType.Riding) >= 225 && CheckLocationForForm(player, difficulty, requiresOutdoor, SpellIds.FormFlight) == SpellCastResult.SpellCastOk) // Flight form if (!player.IsInCombat() && player.GetSkillValue(SkillType.Riding) >= 225 && CheckLocationForForm(player, difficulty, requiresOutdoor, SpellIds.FormFlight) == SpellCastResult.SpellCastOk) // Flight form
return player.GetSkillValue(SkillType.Riding) >= 300 ? SpellIds.FormSwiftFlight : SpellIds.FormFlight; return player.GetSkillValue(SkillType.Riding) >= 300 ? SpellIds.FormSwiftFlight : SpellIds.FormFlight;
if (CheckLocationForForm(player, difficulty, requiresOutdoor, SpellIds.FormStag) == SpellCastResult.SpellCastOk) // Stag form if (!player.IsInWater() && CheckLocationForForm(player, difficulty, requiresOutdoor, SpellIds.FormStag) == SpellCastResult.SpellCastOk) // Stag form
return SpellIds.FormStag; return SpellIds.FormStag;
return 0; return 0;
@@ -1448,16 +1469,20 @@ namespace Scripts.Spells.Druid
[Script] // 783 - Travel Form (dummy) [Script] // 783 - Travel Form (dummy)
class spell_dru_travel_form_dummy : SpellScript class spell_dru_travel_form_dummy : SpellScript
{ {
public override bool Validate(SpellInfo spellEntry)
{
return ValidateSpellInfo(SpellIds.FormAquaticPassive, SpellIds.FormAquatic, SpellIds.FormStag);
}
SpellCastResult CheckCast() SpellCastResult CheckCast()
{ {
Player player = GetCaster().ToPlayer(); Player player = GetCaster().ToPlayer();
if (!player) if (!player)
return SpellCastResult.CustomError; return SpellCastResult.CustomError;
if (player.GetSkillValue(SkillType.Riding) < 75) uint spellId = (player.HasSpell(SpellIds.FormAquaticPassive) && player.IsInWater()) ? SpellIds.FormAquatic : SpellIds.FormStag;
return SpellCastResult.ApprenticeRidingRequirement;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(player.IsInWater() ? SpellIds.FormAquatic : SpellIds.FormStag, GetCastDifficulty()); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, GetCastDifficulty());
return spellInfo.CheckLocation(player.GetMapId(), player.GetZoneId(), player.GetAreaId(), player); return spellInfo.CheckLocation(player.GetMapId(), player.GetZoneId(), player.GetAreaId(), player);
} }
@@ -1507,7 +1532,28 @@ namespace Scripts.Spells.Druid
} }
[Script] // 252216 - Tiger Dash [Script] // 252216 - Tiger Dash
class spell_dru_tiger_dash : AuraScript class spell_dru_tiger_dash : SpellScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.CatForm);
}
void HandleOnCast()
{
// Change into cat form
if (GetCaster().GetShapeshiftForm() != ShapeShiftForm.CatForm)
GetCaster().CastSpell(GetCaster(), SpellIds.CatForm, true);
}
public override void Register()
{
BeforeCast.Add(new CastHandler(HandleOnCast));
}
}
[Script] // 252216 - Tiger Dash (Aura)
class spell_dru_tiger_dash_AuraScript : AuraScript
{ {
void HandlePeriodic(AuraEffect aurEff) void HandlePeriodic(AuraEffect aurEff)
{ {
@@ -0,0 +1,7 @@
-- Spell Proc
DELETE FROM `spell_proc` WHERE `SpellId` IN (135286);
INSERT INTO `spell_proc` (`SpellId`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`SpellFamilyMask3`,`ProcFlags`,`SpellTypeMask`,`SpellPhaseMask`,`HitMask`,`AttributesMask`,`DisableEffectsMask`,`ProcsPerMinute`,`Chance`,`Cooldown`,`Charges`) VALUES
(135286, 0, 7, 0x800, 0x0, 0x0, 0x0, 0x10, 1, 2, 0x403, 0x10, 0, 0, 0, 0, 0);
DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_dru_cat_form');
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES (768, 'spell_dru_cat_form');