From 2f13fea6839f84af9d83741b68e137feadc0b194 Mon Sep 17 00:00:00 2001 From: MantisLord Date: Sat, 3 Feb 2024 22:54:22 -0500 Subject: [PATCH] Spell/Engineering: Goblin Bomb Dispenser * Use item 10587 "Goblin Bomb Dispenser" - casts spell 23134 "Goblin Bomb" * 10% chance to malfunction with spell 13261 "Malfunction Explosion or 90% chance to proceed with spell 13258 "Summon Goblin Bomb" * Creature 8937 "Pet Bomb" is summoned - level is player's engineering skill divided by 5 * Pet Bomb has aura 13260 "Pet Bomb Passive" on spawn - triggers 13259 "Explosion" on successful melee hit https://github.com/cmangos/issues/issues/637 --- sql/base/dbc/cmangos_fixes/Spell.sql | 4 ++ sql/scriptdev2/spell.sql | 2 + .../scripts/world/item_scripts.cpp | 38 +++++++++++++++++++ src/game/Spells/SpellEffects.cpp | 7 ---- src/game/Spells/SpellMgr.h | 1 + 5 files changed, 45 insertions(+), 7 deletions(-) diff --git a/sql/base/dbc/cmangos_fixes/Spell.sql b/sql/base/dbc/cmangos_fixes/Spell.sql index e8146e484a..d1c86d7d3e 100644 --- a/sql/base/dbc/cmangos_fixes/Spell.sql +++ b/sql/base/dbc/cmangos_fixes/Spell.sql @@ -3172,6 +3172,10 @@ INSERT INTO spell_template(Id, SchoolMask, Category, Dispel, Mechanic, Attribute INSERT INTO spell_template(Id, SchoolMask, Category, Dispel, Mechanic, Attributes, AttributesEx, AttributesEx2, AttributesEx3, AttributesEx4, AttributesEx5, Stances, StancesNot, Targets, TargetCreatureType, RequiresSpellFocus, CasterAuraState, TargetAuraState, CasterAuraStateNot, TargetAuraStateNot, CastingTimeIndex, RecoveryTime, CategoryRecoveryTime, InterruptFlags, AuraInterruptFlags, ChannelInterruptFlags, procFlags, procChance, procCharges, maxLevel, baseLevel, spellLevel, DurationIndex, powerType, manaCost, manaCostPerLevel, manaPerSecond, manaPerSecondPerLevel, rangeIndex, speed, 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, EffectBaseDice1, EffectBaseDice2, EffectBaseDice3, EffectDicePerLevel1, EffectDicePerLevel2, EffectDicePerLevel3, 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, SpellVisual, SpellIconID, activeIconID, spellPriority, SpellName, SpellName2, SpellName3, SpellName4, SpellName5, SpellName6, SpellName7, SpellName8, ManaCostPercentage, StartRecoveryCategory, StartRecoveryTime, MaxTargetLevel, SpellFamilyName, SpellFamilyFlags, MaxAffectedTargets, DmgClass, PreventionType, DmgMultiplier1, DmgMultiplier2, DmgMultiplier3, TotemCategory1, TotemCategory2, AreaId, IsServerSide) VALUES ('44288', '8', '0', '4', '11', '786880', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '20', '20', '0', '0', '70', '70', '21', '0', '0', '0', '0', '0', '2', '30', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '-1', '-1', '0', '6', '0', '0', '1', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '42', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '44289', '0', '0', '0', '0', '0', '0', '163', '0', '0', 'Crippling Poison', '', '', '', '', '', '', '', '0', '0', '0', '0', '8', '0', '0', '1', '0', '1', '1', '1', '0', '0', '0', 2); +-- Pet Bomb Passive used by Pet Bomb (item Goblin Bomb Dispenser) +INSERT INTO spell_template (Id, Category, CastUI, Dispel, Mechanic, Attributes, AttributesEx, AttributesEx2, AttributesEx3, AttributesEx4, Stances, StancesNot, Targets, TargetCreatureType, RequiresSpellFocus, CasterAuraState, TargetAuraState, 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, EffectBaseDice1, EffectBaseDice2, EffectBaseDice3, EffectDicePerLevel1, EffectDicePerLevel2, EffectDicePerLevel3, 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, EffectTriggerSpell1, EffectTriggerSpell2, EffectTriggerSpell3, EffectPointsPerComboPoint1, EffectPointsPerComboPoint2, EffectPointsPerComboPoint3, SpellVisual, SpellIconID, ActiveIconID, SpellPriority, SpellName, SpellName2, SpellName3, SpellName4, SpellName5, SpellName6, SpellName7, SpellName8, Rank1, Rank2, Rank3, Rank4, Rank5, Rank6, Rank7, Rank8, ManaCostPercentage, StartRecoveryCategory, StartRecoveryTime, MaxTargetLevel, SpellFamilyName, SpellFamilyFlags, MaxAffectedTargets, DmgClass, PreventionType, StanceBarOrder, DmgMultiplier1, DmgMultiplier2, DmgMultiplier3, MinFactionId, MinReputation, RequiredAuraVision, SchoolMask, IsServerSide, AttributesServerside) VALUES +('13260', '0', '0', '0', '0', '262608', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '4', '100', '1', '0', '30', '30', '21', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '-1', '-1', '0', '6', '0', '0', '1', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '42', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '13259', '0', '0', '0', '0', '0', '0', '11', '0', '0', 'Pet Bomb Passive', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '0', '-1', '1', '1', '1', '0', '0', '0', '1', '0', '0'); + -- ============================================================ -- WOTLK section -- ============================================================ diff --git a/sql/scriptdev2/spell.sql b/sql/scriptdev2/spell.sql index c3bbc46859..59d4ac0317 100644 --- a/sql/scriptdev2/spell.sql +++ b/sql/scriptdev2/spell.sql @@ -50,6 +50,7 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES (11889,'spell_capture_mountain_giant'), (11610,'spell_gammerita_turtle_camera'), (12479,'spell_hex_of_jammalan'), +(13258,'spell_summon_goblin_bomb'), (16380,'spell_greater_invisibility_mob'), (17016,'spell_placing_beacon_torch'), (17244,'spell_anastari_possess'), @@ -61,6 +62,7 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES (20038,'spell_explosion_razorgore'), (21651,'spell_opening_capping'), (22858,'spell_retaliation_creature'), +(23134,'spell_goblin_bomb'), (23226,'spell_ritual_candle_aura'), (24228,'spell_arlokk_vanish'), (24314,'spell_threatening_gaze'), diff --git a/src/game/AI/ScriptDevAI/scripts/world/item_scripts.cpp b/src/game/AI/ScriptDevAI/scripts/world/item_scripts.cpp index 84c1c2f368..2dc94e7d2d 100644 --- a/src/game/AI/ScriptDevAI/scripts/world/item_scripts.cpp +++ b/src/game/AI/ScriptDevAI/scripts/world/item_scripts.cpp @@ -332,6 +332,42 @@ struct ArgussianCompass : public AuraScript if (max_absorb < currentAbsorb) currentAbsorb = max_absorb; } +}; + +enum +{ + SPELL_MALFUNCTION_EXPLOSION = 13261, + SPELL_SUMMON_GOBLIN_BOMB = 13258, + SPELL_PET_BOMB_PASSIVE = 13260, // triggers 13259 Explosion on successful melee hit +}; + +// 13258 - Summon Goblin Bomb +struct SummonGoblinBomb : public SpellScript +{ + void OnSummon(Spell* spell, Creature* summon) const override + { + if (Player* player = dynamic_cast(spell->GetCaster())) + summon->SelectLevel(uint16(player->GetSkillValue(SKILL_ENGINEERING) / 5)); + summon->AI()->SetReactState(REACT_AGGRESSIVE); + summon->CastSpell(summon, SPELL_PET_BOMB_PASSIVE, TRIGGERED_OLD_TRIGGERED); + } +}; + +// 23134 - Goblin Bomb +struct GoblinBomb : public SpellScript +{ + void OnEffectExecute(Spell* spell, SpellEffectIndex /*effIdx*/) const override + { + Unit* target = spell->GetUnitTarget(); + Unit* caster = spell->GetCaster(); + if (!target || !caster) + return; + uint32 roll = urand(0, 99); + if (roll < 10) + target->CastSpell(caster, SPELL_MALFUNCTION_EXPLOSION, TRIGGERED_OLD_TRIGGERED); + else + caster->CastSpell(caster, SPELL_SUMMON_GOBLIN_BOMB, TRIGGERED_OLD_TRIGGERED); + } }; void AddSC_item_scripts() @@ -367,4 +403,6 @@ void AddSC_item_scripts() RegisterSpellScript("spell_banish_exile"); RegisterSpellScript("spell_orb_of_deception"); RegisterSpellScript("spell_argussian_compass"); + RegisterSpellScript("spell_summon_goblin_bomb"); + RegisterSpellScript("spell_goblin_bomb"); } diff --git a/src/game/Spells/SpellEffects.cpp b/src/game/Spells/SpellEffects.cpp index 6a6512849f..c6061265cd 100644 --- a/src/game/Spells/SpellEffects.cpp +++ b/src/game/Spells/SpellEffects.cpp @@ -1168,13 +1168,6 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) return; } - case 23134: // Goblin Bomb Dispenser - { - if (m_CastItem) - m_caster->CastSpell(m_caster, 13258, TRIGGERED_OLD_TRIGGERED, m_CastItem); - - return; - } case 23138: // Gate of Shazzrah { if (!unitTarget || m_scriptValue > 0) diff --git a/src/game/Spells/SpellMgr.h b/src/game/Spells/SpellMgr.h index b42405871d..b92c9cfddb 100644 --- a/src/game/Spells/SpellMgr.h +++ b/src/game/Spells/SpellMgr.h @@ -614,6 +614,7 @@ inline bool IsSpellRemovedOnEvade(SpellEntry const* spellInfo) case 12627: // Disease Cloud case 12787: // Thrash case 12898: // Smoke Aura Visual + case 13260: // Pet Bomb Passive case 13299: // Poison Proc case 13616: // Wracking Pains Proc case 13767: // Hate to Zero (Hate to Zero)