Skip to content

Commit

Permalink
Warlock: Implement missing glyphs and port some existing ones to spel…
Browse files Browse the repository at this point in the history
…lscripts
  • Loading branch information
killerwife committed Jan 12, 2024
1 parent 082e4b1 commit 4cca15b
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 26 deletions.
5 changes: 4 additions & 1 deletion sql/scriptdev2/spell.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1383,7 +1383,10 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(27217,'spell_drain_soul'),
(47855,'spell_drain_soul'),
(48018,'spell_demonic_circle_summon'),
(48020,'spell_demonic_circle_teleport');
(48020,'spell_demonic_circle_teleport'),
(63320,'spell_glyph_of_life_tap'),
(63310,'spell_glyph_of_shadowflame'),
(6358,'spell_seduction_succubus');

-- Pet Scaling
INSERT INTO spell_scripts(Id, ScriptName) VALUES
Expand Down
36 changes: 35 additions & 1 deletion src/game/Entities/Pet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Pet::Pet(PetType type) :
m_removed(false), m_happinessTimer(7500), m_petType(type), m_duration(0),
m_loading(false),
m_declinedname(nullptr), m_petModeFlags(PET_MODE_DEFAULT), m_originalCharminfo(nullptr), m_inStatsUpdate(false), m_dismissDisabled(false),
m_controllableGuardian(false), m_doNotFollowMounted(false)
m_controllableGuardian(false), m_doNotFollowMounted(false), m_glyphedStat(false)
{
m_name = "Pet";

Expand Down Expand Up @@ -2501,3 +2501,37 @@ std::vector<uint32> Pet::GetCharmSpells() const
}
return spells;
}

void Pet::Heartbeat()
{
Creature::Heartbeat();

switch (GetUInt32Value(UNIT_CREATED_BY_SPELL))
{
case 697: // Voidwalker
{
bool change = m_glyphedStat;
if (Unit* owner = GetOwner())
m_glyphedStat = owner->HasAura(56247); // Glyph of Voidwalker
if (change != m_glyphedStat)
UpdateStats(STAT_STAMINA);
break;
}
case 30146: // Felguard
{
bool change = m_glyphedStat;
if (Unit* owner = GetOwner())
{
if (!owner->HasSpell(30146)) // unlearned felguard
{
Unsummon(PET_SAVE_NOT_IN_SLOT);
return;
}
m_glyphedStat = owner->HasAura(56246); // Glyph of Felguard
}
if (change != m_glyphedStat)
UpdateAttackPowerAndDamage();
break;
}
}
}
3 changes: 3 additions & 0 deletions src/game/Entities/Pet.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ class Pet : public Creature
bool IgnoresOwnersDeath() const;

std::vector<uint32> GetCharmSpells() const;

void Heartbeat() override;
protected:
uint32 m_happinessTimer;
PetType m_petType;
Expand All @@ -318,6 +320,7 @@ class Pet : public Creature
bool m_controllableGuardian;
bool m_doNotFollowMounted;
bool m_saveAutocast;
bool m_glyphedStat;

void SaveToDB(uint32, uint8, uint32) override // overwrite of Creature::SaveToDB - don't must be called
{
Expand Down
7 changes: 6 additions & 1 deletion src/game/Entities/StatSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,8 @@ bool Pet::UpdateStats(Stats stat)

// value = ((base_value * base_pct) + total_value) * total_pct
float value = GetTotalStatValue(stat);
if (GetUInt32Value(UNIT_CREATED_BY_SPELL) == 697 && m_glyphedStat)
value *= 1.2;

float oldValue = GetStat(stat);
SetStat(stat, int32(value));
Expand Down Expand Up @@ -1094,7 +1096,10 @@ void Pet::UpdateAttackPowerAndDamage(bool ranged)
// in BASE_VALUE of UNIT_MOD_ATTACK_POWER for creatures we store data of meleeattackpower field in DB
float base_attPower = GetModifierValue(unitMod, BASE_VALUE) * GetModifierValue(unitMod, BASE_PCT);
float attPowerMod = GetModifierValue(unitMod, TOTAL_VALUE);
float attPowerMultiplier = GetModifierValue(unitMod, TOTAL_PCT) - 1.0f;
float attPowerMultiplier = GetModifierValue(unitMod, TOTAL_PCT);
if (GetUInt32Value(UNIT_CREATED_BY_SPELL) == 30146 && m_glyphedStat)
attPowerMultiplier *= 1.2;
attPowerMultiplier -= 1.0f;

// UNIT_FIELD_(RANGED)_ATTACK_POWER field
SetInt32Value(UNIT_FIELD_ATTACK_POWER, (int32)base_attPower);
Expand Down
50 changes: 48 additions & 2 deletions src/game/Spells/Scripts/Scripting/ClassScripts/Warlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,13 @@ struct EyeOfKilrogg : public SpellScript
{
summon->CastSpell(nullptr, 2585, TRIGGERED_OLD_TRIGGERED);
summon->DisableThreatPropagationToOwner();
if (spell->GetCaster()->GetMapId() == 571) // Northrend - Flight
summon->CastSpell(nullptr, 58083, TRIGGERED_OLD_TRIGGERED);
if (spell->GetCaster()->HasAura(58081)) // Glyph of Kilrogg
{
MapEntry const* mapEntry = spell->GetCaster()->GetMap()->GetEntry();
if (mapEntry->addon < 1 || !mapEntry->IsContinent()) // flyable areas
return;
summon->CastSpell(nullptr, 58083, TRIGGERED_OLD_TRIGGERED); // flight
}
}
};

Expand Down Expand Up @@ -597,6 +602,44 @@ struct DrainSoul : public AuraScript
}
};

// 63320 - Glyph of Life Tap
struct GlyphOfLifeTap : public AuraScript
{
SpellAuraProcResult OnProc(Aura* aura, ProcExecutionData& procData) const override
{
procData.triggeredSpellId = 63321;
return SPELL_AURA_PROC_OK;
}
};

// 63310 - Glyph of Shadowflame
struct GlyphOfShadowflame : public AuraScript
{
SpellAuraProcResult OnProc(Aura* aura, ProcExecutionData& procData) const override
{
procData.triggeredSpellId = 63311;
return SPELL_AURA_PROC_OK;
}
};

// 6358 - Seduction
struct SeductionSuccubus : public AuraScript
{
void OnApply(Aura* aura, bool apply) const override
{
bool hasGlyph = false;
if (Unit* caster = aura->GetCaster())
if (Unit* owner = caster->GetOwner())
if (owner->HasAura(56250)) // Glyph of Succubus
hasGlyph = true;
if (apply && hasGlyph)
{
aura->GetTarget()->RemoveSpellsCausingAura(SPELL_AURA_PERIODIC_DAMAGE);
aura->GetTarget()->RemoveSpellsCausingAura(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
}
}
};

void LoadWarlockScripts()
{
RegisterSpellScript<UnstableAffliction>("spell_unstable_affliction");
Expand All @@ -619,4 +662,7 @@ void LoadWarlockScripts()
RegisterSpellScript<GlyphOfShadowburn>("spell_glyph_of_shadowburn");
RegisterSpellScript<DeathsEmbrace>("spell_deaths_embrace");
RegisterSpellScript<DrainSoul>("spell_drain_soul");
RegisterSpellScript<GlyphOfLifeTap>("spell_glyph_of_life_tap");
RegisterSpellScript<GlyphOfShadowflame>("spell_glyph_of_shadowflame");
RegisterSpellScript<SeductionSuccubus>("spell_seduction_succubus");
}
17 changes: 0 additions & 17 deletions src/game/Spells/SpellAuras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10484,23 +10484,6 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply)
else
return;
}
// Shadowflame (DoT)
else if (m_spellProto->IsFitToFamilyMask(uint64(0x0000000000000000), 0x00000002))
{
// Glyph of Shadowflame
if (!apply)
boostSpells.push_back(63311);
else
{
Unit* caster = GetCaster();
if (caster && caster->HasAura(63310))
boostSpells.push_back(63311);
else
return;
}
}
else
return;
break;
}
case SPELLFAMILY_PRIEST:
Expand Down
3 changes: 3 additions & 0 deletions src/game/Spells/SpellEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6875,6 +6875,9 @@ void Spell::EvaluateResultLists(std::list<std::pair<SpellAuraHolder*, uint32> >&
{
int32 heal_amount = m_spellInfo->CalculateSimpleValue(EFFECT_INDEX_1);
m_caster->CastCustomSpell(nullptr, 19658, &heal_amount, nullptr, nullptr, TRIGGERED_OLD_TRIGGERED);
if (m_caster->HasAura(56249)) // Glyph of Felhunter
if (Unit* owner = m_caster->GetOwner())
owner->CastCustomSpell(nullptr, 19658, &heal_amount, nullptr, nullptr, TRIGGERED_OLD_TRIGGERED);
}
}
// Send fail log to client
Expand Down
4 changes: 0 additions & 4 deletions src/game/Spells/UnitAuraProcHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1403,10 +1403,6 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(ProcExecutionData& data)
basepoints[EFFECT_INDEX_0] = damage;
break;
}
// Glyph of Life Tap
case 63320:
triggered_spell_id = 63321;
break;
// Retaliation
case 65932:
triggered_spell_id = 65934;
Expand Down

0 comments on commit 4cca15b

Please sign in to comment.