Jump to content

[11365][patch] implement SPELL_ATTR_EX3_CANT_MISS


darkstalker

Recommended Posts

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

Implements spell attribute Ex3 0x00040000 (now named SPELL_ATTR_EX3_CANT_MISS) that seems to mark negative spells that must not miss, like paladin judgement and other "strikes" triggered effects, some quest kill credit spells (like 14792 that started this research), Self buffs with target enemy (savage roar, slice & dice), and other stuff.

* For which repository revision was the patch created?

11297

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

none afaik

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

darkstalker

diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h
index 75d23b4..691265d 100644
--- a/src/game/SharedDefines.h
+++ b/src/game/SharedDefines.h
@@ -348,7 +348,7 @@ const uint32 ItemQualityColors[MAX_ITEM_QUALITY] = {
#define SPELL_ATTR_EX3_UNK15                      0x00008000            // 15 Auto Shoot, Shoot, Throw,  - this is autoshot flag
#define SPELL_ATTR_EX3_UNK16                      0x00010000            // 16 no triggers effects that trigger on casting a spell??
#define SPELL_ATTR_EX3_NO_INITIAL_AGGRO           0x00020000            // 17 Causes no aggro if not missed
-#define SPELL_ATTR_EX3_UNK18                      0x00040000            // 18
+#define SPELL_ATTR_EX3_CANT_MISS                  0x00040000            // 18
#define SPELL_ATTR_EX3_UNK19                      0x00080000            // 19
#define SPELL_ATTR_EX3_DEATH_PERSISTENT           0x00100000            // 20 Death persistent spells
#define SPELL_ATTR_EX3_UNK21                      0x00200000            // 21
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index b6957d0..2e0265e 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -2961,7 +2961,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell)

    uint32 missChance = uint32(MeleeSpellMissChance(pVictim, attType, fullSkillDiff, spell)*100.0f);
    // Roll miss
-    uint32 tmp = missChance;
+    uint32 tmp = spell->AttributesEx3 & SPELL_ATTR_EX3_CANT_MISS ? 0 : missChance;
    if (roll < tmp)
        return SPELL_MISS_MISS;

@@ -3138,7 +3138,7 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell)
    if (HitChance <  100) HitChance =  100;
    if (HitChance > 10000) HitChance = 10000;

-    int32 tmp = 10000 - HitChance;
+    int32 tmp = spell->AttributesEx3 & SPELL_ATTR_EX3_CANT_MISS ? 0 : 10000 - HitChance;

    int32 rand = irand(0,10000);

Link to comment
Share on other sites

  • 3 weeks later...

A small comment about this. Maybe can optimize the code putting a big if (!(spell->AttributesEx3 & SPELL_ATTR_EX3_CANT_MISS)) { ... } enclosing all the code above, but didn't cause don't really understand how this piece of code works in detail, seem to be some accumulative value..

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