Skip to content

Commit

Permalink
Warrior: Implement missing and move existing to spell scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Jan 13, 2024
1 parent 4cca15b commit f4a0722
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 15 deletions.
8 changes: 8 additions & 0 deletions sql/base/dbc/cmangos_fixes/Spell.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3519,6 +3519,14 @@ UPDATE spell_template SET EffectSpellClassMask1_1=8388608 WHERE Id IN(57870);
UPDATE spell_template SET EffectSpellClassMask1_2=0x01000000 WHERE Id IN(56364);
-- Glyph of Shadow - condition done with code instead - faulty mask
UPDATE spell_template SET EffectSpellClassMask1_2=0 WHERE Id IN(55689);
-- Glyph of Victory Rush - wrong mask
UPDATE spell_template SET EffectSpellClassMask1_2=0x00000100 WHERE Id IN(58382);
-- Glyph of Revenge - wrong mask
UPDATE spell_template SET EffectSpellClassMask1_1=1024 WHERE Id IN(58364);
-- Glyph of Overpower - wrong mask
UPDATE spell_template SET EffectSpellClassMask1_1=0 WHERE Id IN(58386);
-- Glyph of Hamstring - missing mask
UPDATE spell_template SET EffectSpellClassMask1_1=2 WHERE Id IN(58372);

-- fully custom, modelled after 65220 - glyph of snake trap avoidance
INSERT INTO spell_template(Id, Category, Dispel, Mechanic, Attributes, AttributesEx, AttributesEx2, AttributesEx3, AttributesEx4, AttributesEx5, AttributesEx6, AttributesEx7, Stances, Stances2, StancesNot, StancesNot2, Targets, TargetCreatureType, RequiresSpellFocus, FacingCasterFlags, CasterAuraState, TargetAuraState, CasterAuraStateNot, TargetAuraStateNot, CasterAuraSpell, TargetAuraSpell, ExcludeCasterAuraSpell, ExcludeTargetAuraSpell, CastingTimeIndex, RecoveryTime, CategoryRecoveryTime, InterruptFlags, AuraInterruptFlags, ChannelInterruptFlags, ProcFlags, ProcChance, ProcCharges, MaxLevel, BaseLevel, SpellLevel, DurationIndex, PowerType, ManaCost, ManaCostPerlevel, ManaPerSecond, ManaPerSecondPerLevel, RangeIndex, Speed, ModalNextSpell, StackAmount, Totem1, Totem2, Reagent1, Reagent2, Reagent3, Reagent4, Reagent5, Reagent6, Reagent7, Reagent8, ReagentCount1, ReagentCount2, ReagentCount3, ReagentCount4, ReagentCount5, ReagentCount6, ReagentCount7, ReagentCount8, EquippedItemClass, EquippedItemSubClassMask, EquippedItemInventoryTypeMask, Effect1, Effect2, Effect3, EffectDieSides1, EffectDieSides2, EffectDieSides3, EffectRealPointsPerLevel1, EffectRealPointsPerLevel2, EffectRealPointsPerLevel3, EffectBasePoints1, EffectBasePoints2, EffectBasePoints3, EffectMechanic1, EffectMechanic2, EffectMechanic3, EffectImplicitTargetA1, EffectImplicitTargetA2, EffectImplicitTargetA3, EffectImplicitTargetB1, EffectImplicitTargetB2, EffectImplicitTargetB3, EffectRadiusIndex1, EffectRadiusIndex2, EffectRadiusIndex3, EffectApplyAuraName1, EffectApplyAuraName2, EffectApplyAuraName3, EffectAmplitude1, EffectAmplitude2, EffectAmplitude3, EffectMultipleValue1, EffectMultipleValue2, EffectMultipleValue3, EffectChainTarget1, EffectChainTarget2, EffectChainTarget3, EffectItemType1, EffectItemType2, EffectItemType3, EffectMiscValue1, EffectMiscValue2, EffectMiscValue3, EffectMiscValueB1, EffectMiscValueB2, EffectMiscValueB3, EffectTriggerSpell1, EffectTriggerSpell2, EffectTriggerSpell3, EffectPointsPerComboPoint1, EffectPointsPerComboPoint2, EffectPointsPerComboPoint3, EffectSpellClassMask1_1, EffectSpellClassMask1_2, EffectSpellClassMask1_3, EffectSpellClassMask2_1, EffectSpellClassMask2_2, EffectSpellClassMask2_3, EffectSpellClassMask3_1, EffectSpellClassMask3_2, EffectSpellClassMask3_3, SpellVisual, SpellVisual2, SpellIconID, ActiveIconID, SpellPriority, SpellName, SpellName2, SpellName3, SpellName4, SpellName5, SpellName6, SpellName7, SpellName8, SpellName9, SpellName10, SpellName11, SpellName12, SpellName13, SpellName14, SpellName15, SpellName16, Rank1, Rank2, Rank3, Rank4, Rank5, Rank6, Rank7, Rank8, Rank9, Rank10, Rank11, Rank12, Rank13, Rank14, Rank15, Rank16, ManaCostPercentage, StartRecoveryCategory, StartRecoveryTime, MaxTargetLevel, SpellFamilyName, SpellFamilyFlags, SpellFamilyFlags2, MaxAffectedTargets, DmgClass, PreventionType, StanceBarOrder, DmgMultiplier1, DmgMultiplier2, DmgMultiplier3, MinFactionId, MinReputation, RequiredAuraVision, TotemCategory1, TotemCategory2, AreaId, SchoolMask, RuneCostID, SpellMissileID, PowerDisplayId, EffectBonusCoefficient1, EffectBonusCoefficient2, EffectBonusCoefficient3, SpellDescriptionVariableID, SpellDifficultyId, IsServerSide, AttributesServerside) VALUES
Expand Down
4 changes: 3 additions & 1 deletion sql/scriptdev2/spell.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1478,7 +1478,9 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(59725,'spell_spell_reflection_raid'),
(50720,'spell_vigilance'),
(50725,'spell_vigilance_trigger'),
(58567,'spell_sunder_armor');
(59665,'spell_vigilance_redirect'),
(58567,'spell_sunder_armor'),
(56369,'spell_glyph_of_victory_rush');

-- Mage
INSERT INTO spell_scripts(Id, ScriptName) VALUES
Expand Down
44 changes: 43 additions & 1 deletion src/game/Spells/Scripts/Scripting/ClassScripts/Warrior.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ struct WarriorExecute : public SpellScript
{
void OnCast(Spell* spell) const override // confirmed main spell can not hit and child still hits
{
uint32 currentRage = spell->GetCaster()->GetPower(POWER_RAGE);
if (Aura* glyph = spell->GetCaster()->GetAura(58367, EFFECT_INDEX_0)) // Glyph of Execution
currentRage += glyph->GetAmount(); // simulates having more rage
int32 basePoints0 = spell->GetCaster()->CalculateSpellEffectValue(spell->m_targets.getUnitTarget(), spell->m_spellInfo, SpellEffectIndex(0))
+ int32((spell->GetCaster()->GetPower(POWER_RAGE)) * spell->m_spellInfo->DmgMultiplier[0]);
+ int32((currentRage) * spell->m_spellInfo->DmgMultiplier[0]);
SpellCastResult result = spell->GetCaster()->CastCustomSpell(spell->m_targets.getUnitTarget(), 20647, &basePoints0, nullptr, nullptr, TRIGGERED_IGNORE_CURRENT_CASTED_SPELL);
}
};
Expand Down Expand Up @@ -250,6 +253,17 @@ struct SpellReflectionRaid : public SpellScript, public AuraScript
// 50720 - Vigilance
struct Vigilance : public AuraScript
{
void OnApply(Aura* aura, bool apply) const override
{
if (apply)
{
if (Unit* caster = aura->GetCaster())
aura->GetTarget()->CastSpell(caster, 59665, TRIGGERED_OLD_TRIGGERED);
}
else
aura->GetTarget()->getHostileRefManager().ResetThreatRedirection(59665);
}

SpellAuraProcResult OnProc(Aura* aura, ProcExecutionData& procData) const override
{
procData.triggeredSpellId = aura->GetSpellProto()->EffectTriggerSpell[aura->GetEffIndex()];
Expand All @@ -271,6 +285,18 @@ struct VigilanceTrigger : public SpellScript
}
};

// 59665 - Vigilance
struct VigilanceRedirect : public SpellScript
{
void OnEffectExecute(Spell* spell, SpellEffectIndex effIdx) const override
{
int32 damage = spell->GetDamage();
if (Aura* glyph = spell->GetUnitTarget()->GetDummyAura(63326)) // Glyph of Vigilance
damage += glyph->GetModifier()->m_amount;
spell->SetDamage(damage);
}
};

// 3411 - Intervene
struct Intervene : public SpellScript
{
Expand All @@ -288,6 +314,20 @@ struct Intervene : public SpellScript
}
};

// 58382 - Glyph of Victory Rush
struct GlyphOfVictoryRush : public AuraScript
{
void OnApply(Aura* aura, bool apply) const override
{
aura->GetTarget()->RegisterScriptedLocationAura(aura, SCRIPT_LOCATION_CRIT_CHANCE, apply);
}

void OnCritChanceCalculate(Aura* aura, Unit const* target, float& chance, SpellEntry const* spellInfo) const override
{
chance += aura->GetModifier()->m_amount;
}
};

void LoadWarriorScripts()
{
RegisterSpellScript<WarriorExecute>("spell_warrior_execute");
Expand All @@ -302,5 +342,7 @@ void LoadWarriorScripts()
RegisterSpellScript<SpellReflectionRaid>("spell_spell_reflection_raid");
RegisterSpellScript<Vigilance>("spell_vigilance");
RegisterSpellScript<VigilanceTrigger>("spell_vigilance_trigger");
RegisterSpellScript<VigilanceRedirect>("spell_vigilance_redirect");
RegisterSpellScript<Intervene>("spell_intervene");
RegisterSpellScript<GlyphOfVictoryRush>("spell_glyph_of_victory_rush");
}
9 changes: 0 additions & 9 deletions src/game/Spells/SpellAuras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5760,15 +5760,6 @@ void Aura::HandleAuraProcTriggerSpell(bool apply, bool Real)
if (!apply)
GetTarget()->RemoveAurasDueToSpell(40601);
break;
case 50720: // Vigilance (threat transfering)
if (apply)
{
if (Unit* caster = GetCaster())
target->CastSpell(caster, 59665, TRIGGERED_OLD_TRIGGERED);
}
else
target->getHostileRefManager().ResetThreatRedirection(59665);
break;
default:
break;
}
Expand Down
4 changes: 0 additions & 4 deletions src/game/Spells/SpellEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12614,10 +12614,6 @@ void Spell::EffectRedirectThreat(SpellEffectIndex /*eff_idx*/)
if (!unitTarget)
return;

if (m_spellInfo->Id == 59665) // Vigilance
if (Aura* glyph = unitTarget->GetDummyAura(63326)) // Glyph of Vigilance
damage += glyph->GetModifier()->m_amount;

m_caster->getHostileRefManager().SetThreatRedirection(unitTarget->GetObjectGuid(), uint32(damage), m_spellInfo->Id);
}

Expand Down

0 comments on commit f4a0722

Please sign in to comment.