Jump to content

[11452][patch] Implement spell 14537 - Six Demon Bag


Guest stfx

Recommended Posts

What bug does the patch fix? What features does the patch add?

Implements dummy effect for spell 14537 used by item 7734

For which repository revision was the patch created?

[11369]

Is there a thread in the bug report section or at lighthouse? If yes, please add a link to the thread.

No.

Who has been writing this patch? Please include either forum user names or email addresses.

me but similar patches already exist in some places

diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 322df49..203ffda 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -887,6 +887,47 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx)
                    }
                    return;
                }
+                case 14537:                                 // Six Demon Bag
+                {
+                    if (!unitTarget)
+                        return;
+
+                    uint32 ClearSpellId[6] =
+                    { 
+                        15662,   // Fireball
+                        11538,   // Frostball
+                        21179,   // Chain Lightning
+                        14621,   // Polymorph
+                        25189,   // Enveloping Winds
+                        14642    // Summon Felhund minion
+                    };
+
+                    Unit* newTarget = unitTarget;
+                    uint32 spell_id = 0;
+                    uint32 roll = urand(0, 99);
+                    if (roll < 25)                      // Fireball (25% chance)
+                        spell_id = ClearSpellId[0];
+                    else if (roll < 50)                 // Frostball (25% chance)
+                        spell_id = ClearSpellId[1];
+                    else if (roll < 70)                 // Chain Lighting (20% chance)
+                        spell_id = ClearSpellId[2];
+                    else if (roll < 80)                 // Polymorph (10% chance)
+                    {
+                        spell_id = ClearSpellId[3];
+                        if (urand(0, 9) < 3)            // 30% chance to self-cast
+                            newTarget = m_caster;
+                    } 
+                    else if (roll < 95)                 // Enveloping Winds (15% chance)
+                        spell_id = ClearSpellId[4];
+                    else                                // Summon Felhund minion (5% chance)
+                    {
+                        spell_id = ClearSpellId[5];
+                        newTarget = m_caster;
+                    }
+
+                    m_caster->CastSpell(newTarget, spell_id, true, NULL);
+                    return;
+                }
                case 15998:                                 // Capture Worg Pup
                case 29435:                                 // Capture Female Kaliri Hatchling
                {

EDIT: Updated based on Schmoozerd's post. Thanks :)

EDIT2: for polymorph self cast you could also use the following to prevent the need to roll again

+                        if (roll < 73)                  // 30% chance to self-cast

Link to comment
Share on other sites

cool, finally!

I have been waiting for this one since ages :)

as this spell is triggered by an item, possible you should forward the item to the next spell

Edit:

Read over this again, this cannot work, as you always cast by m_caster onto m_caster

I suggest to add a new Unit* newTarget = unitTarget;

and to use newTarget = m_caster in case of self-sheep

(actually it must work with using unitTarget, but as this is no local variable, I think this is bad style)

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

I not see reason have array when each case have own if-else code, so i will merge it to code at adding.

I not yet check patch work but expect that also missing spell_bonus data for avoid use by item casts caster spell power bonus.

[added]

in [11452] with added spell_bonus data. Thank you :)

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use