Updated all spell scripts.

This commit is contained in:
hondacrx
2023-10-07 14:04:50 -04:00
parent ccb5341c21
commit fa10b981bd
18 changed files with 9427 additions and 5645 deletions
+320 -235
View File
@@ -1,4 +1,4 @@
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
using Framework.Constants;
@@ -9,18 +9,24 @@ using Game.Scripting;
using Game.Spells;
using System;
using System.Collections.Generic;
using System.Linq;
using static Global;
namespace Scripts.Spells.Rogue
{
public struct SpellIds
struct SpellIds
{
public const uint AdrenalineRush = 13750;
public const uint BetweenTheEyes = 199804;
public const uint BlackjackTalent = 379005;
public const uint Blackjack = 394119;
public const uint BladeFlurry = 13877;
public const uint BladeFlurryExtraAttack = 22482;
public const uint Broadside = 193356;
public const uint BuriedTreasure = 199600;
public const uint CheatDeathDummy = 31231;
public const uint CheatedDeath = 45181;
public const uint CheatingDeath = 45182;
public const uint DeathFromAbove = 152150;
public const uint GrandMelee = 193358;
public const uint GrapplingHook = 195457;
@@ -34,6 +40,8 @@ namespace Scripts.Spells.Rogue
public const uint MainGauche = 86392;
public const uint PremeditationPassive = 343160;
public const uint PremeditationAura = 343173;
public const uint PreyOnTheWeakTalent = 131511;
public const uint PreyOnTheWeak = 255909;
public const uint RuthlessPrecision = 193357;
public const uint Sanctuary = 98877;
public const uint SkullAndCrossbones = 199603;
@@ -53,16 +61,27 @@ namespace Scripts.Spells.Rogue
public const uint TricksOfTheTrade = 57934;
public const uint TricksOfTheTradeProc = 59628;
public const uint HonorAmongThievesEnergize = 51699;
public const uint T52pSetBonus = 37169;
public const uint T52PSetBonus = 37169;
public const uint VenomousWounds = 79134;
}
struct Misc
{
public static int? GetFinishingMoveCPCost(Spell spell)
{
if (spell == null)
return null;
return spell.GetPowerTypeCostAmount(PowerType.ComboPoints);
}
}
[Script] // 53 - Backstab
class spell_rog_backstab : SpellScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellEffect(spellInfo.Id, 3);
return ValidateSpellEffect((spellInfo.Id, 3));
}
void HandleHitDamage(uint effIndex)
@@ -74,21 +93,46 @@ namespace Scripts.Spells.Rogue
Unit caster = GetCaster();
if (hitUnit.IsInBack(caster))
{
float currDamage = (float)GetHitDamage();
float newDamage = MathFunctions.AddPct(ref currDamage, (float)GetEffectInfo(3).CalcValue(caster));
float currDamage = (float)(GetHitDamage());
float newDamage = MathFunctions.AddPct(ref currDamage, (float)(GetEffectInfo(3).CalcValue(caster)));
SetHitDamage((int)newDamage);
}
}
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(HandleHitDamage, 1, SpellEffectName.SchoolDamage));
OnEffectHitTarget.Add(new(HandleHitDamage, 1, SpellEffectName.SchoolDamage));
}
}
// 379005 - Blackjack
[Script] // Called by Sap - 6770 and Blind - 2094
class spell_rog_blackjack : AuraScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.BlackjackTalent, SpellIds.Blackjack);
}
void EffectRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
{
Unit caster = GetCaster();
if (caster != null)
if (caster.HasAura(SpellIds.BlackjackTalent))
caster.CastSpell(GetTarget(), SpellIds.Blackjack, true);
}
public override void Register()
{
AfterEffectRemove.Add(new(EffectRemove, 0, AuraType.Any, AuraEffectHandleModes.Real));
}
}
[Script] // 13877, 33735, (check 51211, 65956) - Blade Flurry
class spell_rog_blade_flurry_AuraScript : AuraScript
class spell_rog_blade_flurry : AuraScript
{
Unit _procTarget;
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.BladeFlurryExtraAttack);
@@ -115,19 +159,52 @@ namespace Scripts.Spells.Rogue
public override void Register()
{
DoCheckProc.Add(new CheckProcHandler(CheckProc));
DoCheckProc.Add(new(CheckProc));
if (m_scriptSpellId == SpellIds.BladeFlurry)
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.ModPowerRegenPercent));
OnEffectProc.Add(new(HandleProc, 0, AuraType.ModPowerRegenPercent));
else
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.ModMeleeHaste));
OnEffectProc.Add(new(HandleProc, 0, AuraType.ModMeleeHaste));
}
}
[Script] // 31230 - Cheat Death
class spell_rog_cheat_death : AuraScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.CheatDeathDummy, SpellIds.CheatedDeath, SpellIds.CheatingDeath)
&& ValidateSpellEffect((spellInfo.Id, 1));
}
Unit _procTarget = null;
void HandleAbsorb(AuraEffect aurEff, DamageInfo dmgInfo, ref uint absorbAmount)
{
Unit target = GetTarget();
if (target.HasAura(SpellIds.CheatedDeath))
{
absorbAmount = 0;
return;
}
PreventDefaultAction();
target.CastSpell(target, SpellIds.CheatDeathDummy, TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError);
target.CastSpell(target, SpellIds.CheatedDeath, TriggerCastFlags.DontReportCastError);
target.CastSpell(target, SpellIds.CheatingDeath, TriggerCastFlags.DontReportCastError);
target.SetHealth(target.CountPctFromMaxHealth(GetEffectInfo(1).CalcValue(target)));
}
public override void Register()
{
OnEffectAbsorb.Add(new(HandleAbsorb, 0));
}
}
[Script] // 2818 - Deadly Poison
class spell_rog_deadly_poison_SpellScript : SpellScript
class spell_rog_deadly_poison : SpellScript
{
byte _stackAmount;
public override bool Load()
{
// at this point CastItem must already be initialized
@@ -143,7 +220,7 @@ namespace Scripts.Spells.Rogue
if (target != null)
{
// Deadly Poison
AuraEffect aurEff = target.GetAuraEffect(AuraType.PeriodicDummy, SpellFamilyNames.Rogue, new FlagArray128(0x10000, 0x80000, 0), GetCaster().GetGUID());
AuraEffect aurEff = target.GetAuraEffect(AuraType.PeriodicDamage, SpellFamilyNames.Rogue, new FlagArray128(0x10000, 0x80000, 0), GetCaster().GetGUID());
if (aurEff != null)
_stackAmount = aurEff.GetBase().GetStackAmount();
}
@@ -155,11 +232,13 @@ namespace Scripts.Spells.Rogue
return;
Player player = GetCaster().ToPlayer();
Unit target = GetHitUnit();
if (target != null)
{
Item item = player.GetItemByPos(InventorySlots.Bag0, EquipmentSlot.MainHand);
if (item == GetCastItem())
item = player.GetItemByPos(InventorySlots.Bag0, EquipmentSlot.OffHand);
@@ -167,9 +246,9 @@ namespace Scripts.Spells.Rogue
return;
// item combat enchantments
for (byte slot = 0; slot < (int)EnchantmentSlot.Max; ++slot)
for (EnchantmentSlot slot = 0; slot < EnchantmentSlot.Max; ++slot)
{
var enchant = CliDB.SpellItemEnchantmentStorage.LookupByKey(item.GetEnchantmentId((EnchantmentSlot)slot));
SpellItemEnchantmentRecord enchant = CliDB.SpellItemEnchantmentStorage.LookupByKey(item.GetEnchantmentId(slot));
if (enchant == null)
continue;
@@ -178,10 +257,10 @@ namespace Scripts.Spells.Rogue
if (enchant.Effect[s] != ItemEnchantmentType.CombatSpell)
continue;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(enchant.EffectArg[s], Difficulty.None);
SpellInfo spellInfo = SpellMgr.GetSpellInfo(enchant.EffectArg[s], Difficulty.None);
if (spellInfo == null)
{
Log.outError(LogFilter.Spells, $"Player::CastItemCombatSpell Enchant {enchant.Id}, player (Name: {player.GetName()}, {player.GetGUID()}) cast unknown spell {enchant.EffectArg[s]}");
Log.outError(LogFilter.Spells, $"Player.CastItemCombatSpell Enchant {enchant.Id}, player (Name: {player.GetName()}, {player.GetGUID().ToString()})cast unknown spell {enchant.EffectArg[s]}");
continue;
}
@@ -204,63 +283,47 @@ namespace Scripts.Spells.Rogue
public override void Register()
{
BeforeHit.Add(new BeforeHitHandler(HandleBeforeHit));
AfterHit.Add(new HitHandler(HandleAfterHit));
BeforeHit.Add(new(HandleBeforeHit));
AfterHit.Add(new(HandleAfterHit));
}
byte _stackAmount = 0;
}
[Script] // 32645 - Envenom
class spell_rog_envenom : SpellScript
{
void CalculateDamage(uint effIndex)
void CalculateDamage(Unit victim, ref int damage, ref int flatMod, ref float pctMod)
{
int damagePerCombo = GetHitDamage();
AuraEffect t5 = GetCaster().GetAuraEffect(SpellIds.T52pSetBonus, 0);
pctMod *= GetSpell().GetPowerTypeCostAmount(PowerType.ComboPoints).GetValueOrDefault(0);
AuraEffect t5 = GetCaster().GetAuraEffect(SpellIds.T52PSetBonus, 0);
if (t5 != null)
damagePerCombo += t5.GetAmount();
int finalDamage = damagePerCombo;
var costs = GetSpell().GetPowerCost();
var c = costs.Find(cost => cost.Power == PowerType.ComboPoints);
if (c != null)
finalDamage *= c.Amount;
SetHitDamage(finalDamage);
flatMod += t5.GetAmount();
}
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(CalculateDamage, 0, SpellEffectName.SchoolDamage));
CalcDamage.Add(new(CalculateDamage));
}
}
[Script] // 196819 - Eviscerate
class spell_rog_eviscerate : SpellScript
{
void CalculateDamage(uint effIndex)
void CalculateDamage(Unit victim, ref int damage, ref int flatMod, ref float pctMod)
{
int damagePerCombo = GetHitDamage();
AuraEffect t5 = GetCaster().GetAuraEffect(SpellIds.T52pSetBonus, 0);
pctMod *= GetSpell().GetPowerTypeCostAmount(PowerType.ComboPoints).GetValueOrDefault(0);
AuraEffect t5 = GetCaster().GetAuraEffect(SpellIds.T52PSetBonus, 0);
if (t5 != null)
damagePerCombo += t5.GetAmount();
int finalDamage = damagePerCombo;
var costs = GetSpell().GetPowerCost();
var c = costs.Find(cost => cost.Power == PowerType.ComboPoints);
if (c != null)
finalDamage *= c.Amount;
SetHitDamage(finalDamage);
flatMod += t5.GetAmount();
}
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(CalculateDamage, 0, SpellEffectName.SchoolDamage));
CalcDamage.Add(new(CalculateDamage));
}
}
[Script] // 193358 - Grand Melee
class spell_rog_grand_melee : AuraScript
{
@@ -272,7 +335,7 @@ namespace Scripts.Spells.Rogue
bool HandleCheckProc(ProcEventInfo eventInfo)
{
Spell procSpell = eventInfo.GetProcSpell();
return procSpell && procSpell.HasPowerTypeCost(PowerType.ComboPoints);
return procSpell != null && procSpell.HasPowerTypeCost(PowerType.ComboPoints);
}
void HandleProc(AuraEffect aurEff, ProcEventInfo procInfo)
@@ -297,13 +360,13 @@ namespace Scripts.Spells.Rogue
public override void Register()
{
DoCheckProc.Add(new CheckProcHandler(HandleCheckProc));
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
DoCheckProc.Add(new(HandleCheckProc));
OnEffectProc.Add(new(HandleProc, 0, AuraType.Dummy));
}
}
// 198031 - Honor Among Thieves
[Script] /// 7.1.5
[Script] // 7.1.5
class spell_rog_honor_among_thieves : AuraScript
{
public override bool Validate(SpellInfo spellInfo)
@@ -316,17 +379,70 @@ namespace Scripts.Spells.Rogue
PreventDefaultAction();
Unit target = GetTarget();
target.CastSpell(target, SpellIds.HonorAmongThievesEnergize, new CastSpellExtraArgs(aurEff));
target.CastSpell(target, SpellIds.HonorAmongThievesEnergize, aurEff);
}
public override void Register()
{
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
OnEffectProc.Add(new(HandleProc, 0, AuraType.Dummy));
}
}
[Script] // 51690 - Killing Spree
class spell_rog_killing_spree_SpellScript : SpellScript
class spell_rog_killing_spree_AuraScript : AuraScript
{
List<ObjectGuid> _targets = new();
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.KillingSpreeTeleport,
SpellIds.KillingSpreeWeaponDmg,
SpellIds.KillingSpreeDmgBuff
);
}
void HandleApply(AuraEffect aurEff, AuraEffectHandleModes mode)
{
GetTarget().CastSpell(GetTarget(), SpellIds.KillingSpreeDmgBuff, true);
}
void HandleEffectPeriodic(AuraEffect aurEff)
{
while (!_targets.Empty())
{
ObjectGuid guid = _targets.SelectRandom();
Unit target = ObjAccessor.GetUnit(GetTarget(), guid);
if (target != null)
{
GetTarget().CastSpell(target, SpellIds.KillingSpreeTeleport, true);
GetTarget().CastSpell(target, SpellIds.KillingSpreeWeaponDmg, true);
break;
}
else
_targets.Remove(guid);
}
}
void HandleRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
{
GetTarget().RemoveAurasDueToSpell(SpellIds.KillingSpreeDmgBuff);
}
public override void Register()
{
AfterEffectApply.Add(new(HandleApply, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.Real));
OnEffectPeriodic.Add(new(HandleEffectPeriodic, 0, AuraType.PeriodicDummy));
AfterEffectRemove.Add(new(HandleRemove, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.Real));
}
public void AddTarget(Unit target)
{
_targets.Add(target.GetGUID());
}
}
[Script]
class spell_rog_killing_spree : SpellScript
{
void FilterTargets(List<WorldObject> targets)
{
@@ -347,58 +463,22 @@ namespace Scripts.Spells.Rogue
public override void Register()
{
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 1, Targets.UnitDestAreaEnemy));
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 1, SpellEffectName.Dummy));
OnObjectAreaTargetSelect.Add(new(FilterTargets, 1, Targets.UnitDestAreaEnemy));
OnEffectHitTarget.Add(new(HandleDummy, 1, SpellEffectName.Dummy));
}
}
[Script]
class spell_rog_killing_spree_AuraScript : AuraScript
[Script] // 385627 - Kingsbane
class spell_rog_kingsbane : AuraScript
{
List<ObjectGuid> _targets = new();
public override bool Validate(SpellInfo spellInfo)
bool CheckProc(AuraEffect aurEff, ProcEventInfo procInfo)
{
return ValidateSpellInfo(SpellIds.KillingSpreeTeleport, SpellIds.KillingSpreeWeaponDmg, SpellIds.KillingSpreeDmgBuff);
}
void HandleApply(AuraEffect aurEff, AuraEffectHandleModes mode)
{
GetTarget().CastSpell(GetTarget(), SpellIds.KillingSpreeDmgBuff, true);
}
void HandleEffectPeriodic(AuraEffect aurEff)
{
while (!_targets.Empty())
{
ObjectGuid guid = _targets.SelectRandom();
Unit target = Global.ObjAccessor.GetUnit(GetTarget(), guid);
if (target != null)
{
GetTarget().CastSpell(target, SpellIds.KillingSpreeTeleport, true);
GetTarget().CastSpell(target, SpellIds.KillingSpreeWeaponDmg, true);
break;
}
else
_targets.Remove(guid);
}
}
void HandleRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
{
GetTarget().RemoveAurasDueToSpell(SpellIds.KillingSpreeDmgBuff);
return procInfo.GetActionTarget().HasAura(GetId(), GetCasterGUID());
}
public override void Register()
{
AfterEffectApply.Add(new EffectApplyHandler(HandleApply, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.Real));
OnEffectPeriodic.Add(new EffectPeriodicHandler(HandleEffectPeriodic, 0, AuraType.PeriodicDummy));
AfterEffectRemove.Add(new EffectApplyHandler(HandleRemove, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.Real));
}
public void AddTarget(Unit target)
{
_targets.Add(target.GetGUID());
DoCheckEffectProc.Add(new(CheckProc, 4, AuraType.ProcTriggerSpell));
}
}
@@ -412,20 +492,20 @@ namespace Scripts.Spells.Rogue
bool HandleCheckProc(ProcEventInfo eventInfo)
{
return eventInfo.GetDamageInfo() != null && eventInfo.GetDamageInfo().GetVictim() != null;
return eventInfo.GetDamageInfo()?.GetVictim();
}
void HandleProc(AuraEffect aurEff, ProcEventInfo procInfo)
{
Unit target = GetTarget();
if (target != null)
target.CastSpell(procInfo.GetDamageInfo().GetVictim(), SpellIds.MainGauche, new CastSpellExtraArgs(aurEff));
target.CastSpell(procInfo.GetDamageInfo().GetVictim(), SpellIds.MainGauche, aurEff);
}
public override void Register()
{
DoCheckProc.Add(new CheckProcHandler(HandleCheckProc));
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
DoCheckProc.Add(new(HandleCheckProc));
OnEffectProc.Add(new(HandleProc, 0, AuraType.Dummy));
}
}
@@ -442,14 +522,37 @@ namespace Scripts.Spells.Rogue
public override void Register()
{
OnCheckCast.Add(new CheckCastHandler(CheckCast));
OnCheckCast.Add(new(CheckCast));
}
}
// 131511 - Prey on the Weak
[Script] // Called by Cheap Shot - 1833 and Kidney Shot - 408
class spell_rog_prey_on_the_weak : AuraScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.PreyOnTheWeakTalent, SpellIds.PreyOnTheWeak);
}
void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode)
{
Unit caster = GetCaster();
if (caster != null)
if (caster.HasAura(SpellIds.PreyOnTheWeakTalent))
caster.CastSpell(GetTarget(), SpellIds.PreyOnTheWeak, true);
}
public override void Register()
{
AfterEffectApply.Add(new(OnApply, 0, AuraType.ModStun, AuraEffectHandleModes.Real));
}
}
[Script] // 79096 - Restless Blades
class spell_rog_restless_blades : AuraScript
{
static uint[] Spells = { SpellIds.AdrenalineRush, SpellIds.BetweenTheEyes, SpellIds.Sprint, SpellIds.GrapplingHook, SpellIds.Vanish, SpellIds.KillingSpree, SpellIds.MarkedForDeath, SpellIds.DeathFromAbove };
uint[] Spells = { SpellIds.AdrenalineRush, SpellIds.BetweenTheEyes, SpellIds.Sprint, SpellIds.GrapplingHook, SpellIds.Vanish, SpellIds.KillingSpree, SpellIds.MarkedForDeath, SpellIds.DeathFromAbove };
public override bool Validate(SpellInfo spellInfo)
{
@@ -458,10 +561,10 @@ namespace Scripts.Spells.Rogue
void HandleProc(AuraEffect aurEff, ProcEventInfo procInfo)
{
int? spentCP = procInfo.GetProcSpell()?.GetPowerTypeCostAmount(PowerType.ComboPoints);
var spentCP = Misc.GetFinishingMoveCPCost(procInfo.GetProcSpell());
if (spentCP.HasValue)
{
int cdExtra = (int)-((float)(aurEff.GetAmount() * spentCP.Value) * 0.1f);
int cdExtra = -(int)((float)(aurEff.GetAmount() * spentCP.Value) * 0.1f);
SpellHistory history = GetTarget().GetSpellHistory();
foreach (uint spellId in Spells)
@@ -471,14 +574,14 @@ namespace Scripts.Spells.Rogue
public override void Register()
{
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
OnEffectProc.Add(new(HandleProc, 0, AuraType.Dummy));
}
}
[Script] // 315508 - Roll the Bones
class spell_rog_roll_the_bones : SpellScript
{
static uint[] Spells = { SpellIds.SkullAndCrossbones, SpellIds.GrandMelee, SpellIds.RuthlessPrecision, SpellIds.TrueBearing, SpellIds.BuriedTreasure, SpellIds.Broadside };
uint[] Spells = { SpellIds.SkullAndCrossbones, SpellIds.GrandMelee, SpellIds.RuthlessPrecision, SpellIds.TrueBearing, SpellIds.BuriedTreasure, SpellIds.Broadside };
public override bool Validate(SpellInfo spellInfo)
{
@@ -498,7 +601,8 @@ namespace Scripts.Spells.Rogue
}
}
var possibleBuffs = Spells.Shuffle().ToArray();
List<uint> possibleBuffs = new(Spells);
possibleBuffs.Shuffle();
// https://www.icy-veins.com/wow/outlaw-rogue-pve-dps-rotation-cooldowns-abilities
// 1 Roll the Bones buff : 100.0 % chance;
@@ -522,43 +626,18 @@ namespace Scripts.Spells.Rogue
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.ApplyAura));
OnEffectHitTarget.Add(new(HandleDummy, 0, SpellEffectName.ApplyAura));
}
}
[Script] // 1943 - Rupture
class spell_rog_rupture_AuraScript : AuraScript
class spell_rog_rupture : AuraScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.VenomousWounds);
}
void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
{
Unit caster = GetCaster();
if (caster != null)
{
canBeRecalculated = false;
float[] attackpowerPerCombo =
{
0.0f,
0.015f, // 1 point: ${($m1 + $b1*1 + 0.015 * $AP) * 4} damage over 8 secs
0.024f, // 2 points: ${($m1 + $b1*2 + 0.024 * $AP) * 5} damage over 10 secs
0.03f, // 3 points: ${($m1 + $b1*3 + 0.03 * $AP) * 6} damage over 12 secs
0.03428571f, // 4 points: ${($m1 + $b1*4 + 0.03428571 * $AP) * 7} damage over 14 secs
0.0375f // 5 points: ${($m1 + $b1*5 + 0.0375 * $AP) * 8} damage over 16 secs
};
int cp = caster.GetPower(PowerType.ComboPoints);
if (cp > 5)
cp = 5;
amount += (int)(caster.GetTotalAttackPowerValue(WeaponAttackType.BaseAttack) * attackpowerPerCombo[cp]);
}
}
void OnEffectRemoved(AuraEffect aurEff, AuraEffectHandleModes mode)
{
if (GetTargetApplication().GetRemoveMode() != AuraRemoveMode.Death)
@@ -566,7 +645,7 @@ namespace Scripts.Spells.Rogue
Aura aura = GetAura();
Unit caster = aura.GetCaster();
if (!caster)
if (caster == null)
return;
Aura auraVenomousWounds = caster.GetAura(SpellIds.VenomousWounds);
@@ -574,19 +653,18 @@ namespace Scripts.Spells.Rogue
return;
// Venomous Wounds: if unit dies while being affected by rupture, regain energy based on remaining duration
SpellPowerCost cost = GetSpellInfo().CalcPowerCost(PowerType.Energy, false, caster, GetSpellInfo().GetSchoolMask(), null);
var cost = GetSpellInfo().CalcPowerCost(PowerType.Energy, false, caster, GetSpellInfo().GetSchoolMask(), null);
if (cost == null)
return;
float pct = (float)aura.GetDuration() / (float)aura.GetMaxDuration();
int extraAmount = (int)((float)cost.Amount * pct);
float pct = (float)(aura.GetDuration()) / (float)(aura.GetMaxDuration());
int extraAmount = (int)((float)(cost.Amount) * pct);
caster.ModifyPower(PowerType.Energy, extraAmount);
}
public override void Register()
{
DoEffectCalcAmount.Add(new EffectCalcAmountHandler(CalculateAmount, 0, AuraType.PeriodicDummy));
OnEffectRemove.Add(new EffectApplyHandler(OnEffectRemoved, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.Real));
OnEffectRemove.Add(new(OnEffectRemoved, 0, AuraType.PeriodicDamage, AuraEffectHandleModes.Real));
}
}
@@ -597,30 +675,32 @@ namespace Scripts.Spells.Rogue
{
Unit target = GetTarget();
int? cost = procInfo.GetProcSpell()?.GetPowerTypeCostAmount(PowerType.ComboPoints);
var cost = Misc.GetFinishingMoveCPCost(procInfo.GetProcSpell());
if (cost.HasValue)
if (RandomHelper.randChance(aurEff.GetSpellEffectInfo().PointsPerResource * (cost.Value)))
if (RandomHelper.randChance(aurEff.GetSpellEffectInfo().PointsPerResource * cost.Value))
target.ModifyPower(PowerType.ComboPoints, 1);
}
public override void Register()
{
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy));
OnEffectProc.Add(new(HandleProc, 0, AuraType.Dummy));
}
}
[Script] // 185438 - Shadowstrike
class spell_rog_shadowstrike : SpellScript
{
bool _hasPremeditationAura;
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.PremeditationAura, SpellIds.SliceAndDice, SpellIds.PremeditationPassive)
&& ValidateSpellEffect(SpellIds.PremeditationPassive, 0);
&& ValidateSpellEffect((SpellIds.PremeditationPassive, 0));
}
SpellCastResult HandleCheckCast()
{
// Because the premeditation aura is removed when we're out of stealth,
// Because the premeditation aura is Removed when we're out of stealth,
// when we reach HandleEnergize the aura won't be there, even if it was when player launched the spell
_hasPremeditationAura = GetCaster().HasAura(SpellIds.PremeditationAura);
return SpellCastResult.Success;
@@ -643,7 +723,7 @@ namespace Scripts.Spells.Rogue
}
// Grant 10 seconds of slice and dice
int duration = Global.SpellMgr.GetSpellInfo(SpellIds.PremeditationPassive, Difficulty.None).GetEffect(0).CalcValue(GetCaster());
int duration = SpellMgr.GetSpellInfo(SpellIds.PremeditationPassive, Difficulty.None).GetEffect(0).CalcValue(GetCaster());
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
args.AddSpellMod(SpellValueMod.Duration, duration * Time.InMilliseconds);
@@ -653,11 +733,9 @@ namespace Scripts.Spells.Rogue
public override void Register()
{
OnCheckCast.Add(new CheckCastHandler(HandleCheckCast));
OnEffectHitTarget.Add(new EffectHandler(HandleEnergize, 1, SpellEffectName.Energize));
OnCheckCast.Add(new(HandleCheckCast));
OnEffectHitTarget.Add(new(HandleEnergize, 1, SpellEffectName.Energize));
}
bool _hasPremeditationAura = false;
}
[Script] // 193315 - Sinister Strike
@@ -665,28 +743,28 @@ namespace Scripts.Spells.Rogue
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.T52pSetBonus);
return ValidateSpellInfo(SpellIds.T52PSetBonus);
}
void HandleDummy(uint effIndex)
{
int damagePerCombo = GetHitDamage();
AuraEffect t5 = GetCaster().GetAuraEffect(SpellIds.T52pSetBonus, 0);
AuraEffect t5 = GetCaster().GetAuraEffect(SpellIds.T52PSetBonus, 0);
if (t5 != null)
damagePerCombo += t5.GetAmount();
int finalDamage = damagePerCombo;
var costs = GetSpell().GetPowerCost();
var c = costs.Find(cost => cost.Power == PowerType.ComboPoints);
if (c != null)
finalDamage *= c.Amount;
List<SpellPowerCost> cost = GetSpell().GetPowerCost();
var c = cost.Find(cost => cost.Power == PowerType.ComboPoints);
if (c != null)
finalDamage *= c.Amount;
SetHitDamage(finalDamage);
}
SetHitDamage(finalDamage);
}
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 2, SpellEffectName.Dummy));
OnEffectHitTarget.Add(new(HandleDummy, 2, SpellEffectName.Dummy));
}
}
@@ -695,58 +773,65 @@ namespace Scripts.Spells.Rogue
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.MasterOfSubtletyPassive, SpellIds.MasterOfSubtletyDamagePercent, SpellIds.Sanctuary, SpellIds.ShadowFocus, SpellIds.ShadowFocusEffect, SpellIds.StealthStealthAura, SpellIds.StealthShapeshiftAura);
}
return ValidateSpellInfo(SpellIds.MasterOfSubtletyPassive,
SpellIds.MasterOfSubtletyDamagePercent,
SpellIds.Sanctuary,
SpellIds.ShadowFocus,
SpellIds.ShadowFocusEffect,
SpellIds.StealthStealthAura,
SpellIds.StealthShapeshiftAura
);
}
void HandleEffectApply(AuraEffect aurEff, AuraEffectHandleModes mode)
void HandleEffectApply(AuraEffect aurEff, AuraEffectHandleModes mode)
{
Unit target = GetTarget();
// Master of Subtlety
if (target.HasAura(SpellIds.MasterOfSubtletyPassive))
target.CastSpell(target, SpellIds.MasterOfSubtletyDamagePercent, TriggerCastFlags.FullMask);
// Shadow Focus
if (target.HasAura(SpellIds.ShadowFocus))
target.CastSpell(target, SpellIds.ShadowFocusEffect, TriggerCastFlags.FullMask);
// Premeditation
if (target.HasAura(SpellIds.PremeditationPassive))
target.CastSpell(target, SpellIds.PremeditationAura, true);
target.CastSpell(target, SpellIds.Sanctuary, TriggerCastFlags.FullMask);
target.CastSpell(target, SpellIds.StealthStealthAura, TriggerCastFlags.FullMask);
target.CastSpell(target, SpellIds.StealthShapeshiftAura, TriggerCastFlags.FullMask);
}
void HandleEffectRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
{
Unit target = GetTarget();
// Master of Subtlety
AuraEffect masterOfSubtletyPassive = GetTarget().GetAuraEffect(SpellIds.MasterOfSubtletyPassive, 0);
if (masterOfSubtletyPassive != null)
{
Unit target = GetTarget();
// Master of Subtlety
if (target.HasAura(SpellIds.MasterOfSubtletyPassive))
target.CastSpell(target, SpellIds.MasterOfSubtletyDamagePercent, new CastSpellExtraArgs(TriggerCastFlags.FullMask));
// Shadow Focus
if (target.HasAura(SpellIds.ShadowFocus))
target.CastSpell(target, SpellIds.ShadowFocusEffect, new CastSpellExtraArgs(TriggerCastFlags.FullMask));
// Premeditation
if (target.HasAura(SpellIds.PremeditationPassive))
target.CastSpell(target, SpellIds.PremeditationAura, true);
target.CastSpell(target, SpellIds.Sanctuary, new CastSpellExtraArgs(TriggerCastFlags.FullMask));
target.CastSpell(target, SpellIds.StealthStealthAura, new CastSpellExtraArgs(TriggerCastFlags.FullMask));
target.CastSpell(target, SpellIds.StealthShapeshiftAura, new CastSpellExtraArgs(TriggerCastFlags.FullMask));
}
void HandleEffectRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
{
Unit target = GetTarget();
// Master of Subtlety
AuraEffect masterOfSubtletyPassive = GetTarget().GetAuraEffect(SpellIds.MasterOfSubtletyPassive, 0);
if (masterOfSubtletyPassive != null)
Aura masterOfSubtletyAura = GetTarget().GetAura(SpellIds.MasterOfSubtletyDamagePercent);
if (masterOfSubtletyAura != null)
{
Aura masterOfSubtletyAura = GetTarget().GetAura(SpellIds.MasterOfSubtletyDamagePercent);
if (masterOfSubtletyAura != null)
{
masterOfSubtletyAura.SetMaxDuration(masterOfSubtletyPassive.GetAmount());
masterOfSubtletyAura.RefreshDuration();
}
masterOfSubtletyAura.SetMaxDuration(masterOfSubtletyPassive.GetAmount());
masterOfSubtletyAura.RefreshDuration();
}
// Premeditation
target.RemoveAura(SpellIds.PremeditationAura);
target.RemoveAurasDueToSpell(SpellIds.ShadowFocusEffect);
target.RemoveAurasDueToSpell(SpellIds.StealthStealthAura);
target.RemoveAurasDueToSpell(SpellIds.StealthShapeshiftAura);
}
// Premeditation
target.RemoveAura(SpellIds.PremeditationAura);
target.RemoveAurasDueToSpell(SpellIds.ShadowFocusEffect);
target.RemoveAurasDueToSpell(SpellIds.StealthStealthAura);
target.RemoveAurasDueToSpell(SpellIds.StealthShapeshiftAura);
}
public override void Register()
{
AfterEffectApply.Add(new EffectApplyHandler(HandleEffectApply, 0, AuraType.Dummy, AuraEffectHandleModes.Real));
AfterEffectRemove.Add(new EffectApplyHandler(HandleEffectRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real));
AfterEffectApply.Add(new(HandleEffectApply, 0, AuraType.Dummy, AuraEffectHandleModes.Real));
AfterEffectRemove.Add(new(HandleEffectRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real));
}
}
@@ -766,13 +851,15 @@ namespace Scripts.Spells.Rogue
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(HandleEffectHitTarget, 0, SpellEffectName.ApplyAura));
OnEffectHitTarget.Add(new(HandleEffectHitTarget, 0, SpellEffectName.ApplyAura));
}
}
[Script] // 57934 - Tricks of the Trade
class spell_rog_tricks_of_the_trade_aura : AuraScript
class spell_rog_tricks_of_the_trade_AuraScript : AuraScript
{
ObjectGuid _redirectTarget;
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.TricksOfTheTradeProc);
@@ -789,19 +876,17 @@ namespace Scripts.Spells.Rogue
PreventDefaultAction();
Unit rogue = GetTarget();
if (Global.ObjAccessor.GetUnit(rogue, _redirectTarget))
rogue.CastSpell(rogue, SpellIds.TricksOfTheTradeProc, new CastSpellExtraArgs(aurEff));
if (ObjAccessor.GetUnit(rogue, _redirectTarget) != null)
rogue.CastSpell(rogue, SpellIds.TricksOfTheTradeProc, aurEff);
Remove(AuraRemoveMode.Default);
}
public override void Register()
{
AfterEffectRemove.Add(new EffectApplyHandler(OnRemove, 1, AuraType.Dummy, AuraEffectHandleModes.Real));
OnEffectProc.Add(new EffectProcHandler(HandleProc, 1, AuraType.Dummy));
AfterEffectRemove.Add(new(OnRemove, 1, AuraType.Dummy, AuraEffectHandleModes.Real));
OnEffectProc.Add(new(HandleProc, 1, AuraType.Dummy));
}
ObjectGuid _redirectTarget;
public void SetRedirectTarget(ObjectGuid guid) { _redirectTarget = guid; }
}
@@ -813,11 +898,11 @@ namespace Scripts.Spells.Rogue
Aura aura = GetHitAura();
if (aura != null)
{
spell_rog_tricks_of_the_trade_aura script = aura.GetScript<spell_rog_tricks_of_the_trade_aura>();
var script = aura.GetScript<spell_rog_tricks_of_the_trade_AuraScript>();
if (script != null)
{
Unit explTarget = GetExplTargetUnit();
if (explTarget != null)
if (explTarget)
script.SetRedirectTarget(explTarget.GetGUID());
else
script.SetRedirectTarget(ObjectGuid.Empty);
@@ -827,7 +912,7 @@ namespace Scripts.Spells.Rogue
public override void Register()
{
AfterHit.Add(new HitHandler(DoAfterHit));
AfterHit.Add(new(DoAfterHit));
}
}
@@ -841,7 +926,7 @@ namespace Scripts.Spells.Rogue
public override void Register()
{
AfterEffectRemove.Add(new EffectApplyHandler(HandleRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real));
AfterEffectRemove.Add(new(HandleRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real));
}
}
@@ -850,12 +935,12 @@ namespace Scripts.Spells.Rogue
{
bool CheckForStun(AuraEffect aurEff, ProcEventInfo eventInfo)
{
return eventInfo.GetProcSpell() && eventInfo.GetProcSpell().GetSpellInfo().HasAura(AuraType.ModStun);
return eventInfo.GetProcSpell() != null && eventInfo.GetProcSpell().GetSpellInfo().HasAura(AuraType.ModStun);
}
public override void Register()
{
DoCheckEffectProc.Add(new CheckEffectProcHandler(CheckForStun, 0, AuraType.ProcTriggerSpell));
DoCheckEffectProc.Add(new(CheckForStun, 0, AuraType.ProcTriggerSpell));
}
}
@@ -872,7 +957,7 @@ namespace Scripts.Spells.Rogue
Unit target = GetTarget();
if (!target.HasAuraType(AuraType.ModStun))
{
target.CastSpell(target, SpellIds.TurnTheTablesBuff, new CastSpellExtraArgs(aurEff));
target.CastSpell(target, SpellIds.TurnTheTablesBuff, aurEff);
PreventDefaultAction();
Remove();
}
@@ -880,11 +965,11 @@ namespace Scripts.Spells.Rogue
public override void Register()
{
OnEffectPeriodic.Add(new EffectPeriodicHandler(CheckForStun, 0, AuraType.PeriodicDummy));
OnEffectPeriodic.Add(new(CheckForStun, 0, AuraType.PeriodicDummy));
}
}
[Script] // 1856 - Vanish - SPELL_ROGUE_VANISH
[Script] // 1856 - Vanish - SpellIds.Vanish
class spell_rog_vanish : SpellScript
{
public override bool Validate(SpellInfo spellInfo)
@@ -905,18 +990,18 @@ namespace Scripts.Spells.Rogue
if (target.HasAura(SpellIds.VanishAura))
return;
target.CastSpell(target, SpellIds.VanishAura, new CastSpellExtraArgs(TriggerCastFlags.FullMask));
target.CastSpell(target, SpellIds.StealthShapeshiftAura, new CastSpellExtraArgs(TriggerCastFlags.FullMask));
target.CastSpell(target, SpellIds.VanishAura, TriggerCastFlags.FullMask);
target.CastSpell(target, SpellIds.StealthShapeshiftAura, TriggerCastFlags.FullMask);
}
public override void Register()
{
OnEffectLaunchTarget.Add(new EffectHandler(OnLaunchTarget, 1, SpellEffectName.TriggerSpell));
OnEffectLaunchTarget.Add(new(OnLaunchTarget, 1, SpellEffectName.TriggerSpell));
}
}
[Script] // 11327 - Vanish
class spell_rog_vanish_aura : AuraScript
class spell_rog_vanish_AuraScript : AuraScript
{
public override bool Validate(SpellInfo spellInfo)
{
@@ -925,16 +1010,16 @@ namespace Scripts.Spells.Rogue
void HandleEffectRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
{
GetTarget().CastSpell(GetTarget(), SpellIds.Stealth, new CastSpellExtraArgs(TriggerCastFlags.FullMask));
GetTarget().CastSpell(GetTarget(), SpellIds.Stealth, TriggerCastFlags.FullMask);
}
public override void Register()
{
AfterEffectRemove.Add(new EffectApplyHandler(HandleEffectRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real));
AfterEffectRemove.Add(new(HandleEffectRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real));
}
}
[Script] // 79134 - Venomous Wounds - SPELL_ROGUE_VENOMOUS_WOUNDS
[Script] // 79134 - Venomous Wounds - SpellIds.VenomousWounds
class spell_rog_venomous_wounds : AuraScript
{
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
@@ -945,7 +1030,7 @@ namespace Scripts.Spells.Rogue
public override void Register()
{
OnEffectProc.Add(new EffectProcHandler(HandleProc, 1, AuraType.Dummy));
OnEffectProc.Add(new(HandleProc, 1, AuraType.Dummy));
}
}
}
}