Ru-MaNGOS

Ru-MaNGOS (http://mangos.ytdb.ru/index.php)
-   Принятые патчи (http://mangos.ytdb.ru/forumdisplay.php?f=5)
-   -   Check cast Mend Pet (http://mangos.ytdb.ru/showthread.php?t=5383)

Den 23.04.2012 20:11

Check cast Mend Pet
 
Код:

diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index a389f3c..388b02e 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -4814,6 +4814,20 @@ SpellCastResult Spell::CheckCast(bool strict)
                return SPELL_FAILED_MOVING;
        }
 
+        // Prevent cast Mend Pet on dead pet
+        if (Unit* target = m_targets.getUnitTarget())
+        {
+            if (Pet* pet = target->GetPet())
+            {
+                if (!pet->isAlive())
+                {
+                    // Mend Pet
+                    if (m_spellInfo->IsFitToFamily(SPELLFAMILY_HUNTER, UI64LIT(0x0000000000800000)))
+                        return SPELL_FAILED_TARGETS_DEAD;
+                }
+            }
+        }
+
        if (!m_IsTriggeredSpell && NeedsComboPoints(m_spellInfo) && !m_caster->IsIgnoreUnitState(m_spellInfo, IGNORE_UNIT_TARGET_STATE) &&
            (!m_targets.getUnitTarget() || m_targets.getUnitTarget()->GetObjectGuid() != ((Player*)m_caster)->GetComboTargetGuid()))
            // warrior not have real combo-points at client side but use this way for mark allow Overpower use


rsa 23.04.2012 20:57

эта проверка есть и в чистом мангосе немного ниже, туда просто надо добавить проверку isAlive()
Код:

// check pet presents
        for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
        {
            if(m_spellInfo->EffectImplicitTargetA[j] == TARGET_PET)
            {
                if(!m_caster->GetPet())
                {
                    if(m_triggeredByAuraSpell)              // not report pet not existence for t
                        return SPELL_FAILED_DONT_REPORT;
                    else
                        return SPELL_FAILED_NO_PET;
                }
                break;
            }
        }


schmoozerd 25.04.2012 00:22

I think rsa points to
Код:

diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index a389f3c..f820164 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -4924,13 +4924,16 @@ SpellCastResult Spell::CheckCast(bool strict)
        {
            if(m_spellInfo->EffectImplicitTargetA[j] == TARGET_PET)
            {
-                if(!m_caster->GetPet())
+                Pet* pet = m_caster->GetPet();
+                if(!pet)
                {
                    if(m_triggeredByAuraSpell)              // not report pet not existence for triggered spells
                        return SPELL_FAILED_DONT_REPORT;
                    else
                        return SPELL_FAILED_NO_PET;
                }
+                else if (!pet->isAlive()) // Edit: Actually uses an exception for (at least) 2641
+                    return SPELL_FAILED_TARGETS_DEAD;
                break;
            }
        }

Any further comments?

rsa 25.04.2012 07:01

Код:

      // check pet presents
        for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
        {
            if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_PET)
            {
                Pet *pet = m_caster->GetPet();
                if (!pet || (!pet->isAlive() && !IsSpellAllowDeadTarget(m_spellInfo)))
                {
                    if (m_triggeredByAuraSpell)              // not report pet not existence for triggered spells
                        return SPELL_FAILED_DONT_REPORT;
                    else if (!pet)
                        return SPELL_FAILED_NO_PET;
                    else
                        return SPELL_FAILED_TARGETS_DEAD;
                }
                break;
            }
        }


schmoozerd 25.04.2012 11:57

this will just not work :(

From your code:
Цитата:

inline bool IsSpellAllowDeadTarget(SpellEntry const* spellInfo)
{
return spellInfo ? spellInfo->AttributesEx2 & SPELL_ATTR2_ALLOW_DEAD_TARGET : false;
}

Den 25.04.2012 12:05

It is worth to remember also about talent http://www.wowhead.com/spell=55709 :)

rsa 25.04.2012 12:25

Цитата:

Сообщение от schmoozerd (Сообщение 27071)
this will just not work :(

From your code:

for me work fine. over a year...

Цитата:

Сообщение от Den (Сообщение 27072)
It is worth to remember also about talent http://www.wowhead.com/spell=55709 :)

ID - 55709 Heart of the Phoenix
AttributesEx2: 0x00000001 (SPELL_ATTR2_ALLOW_DEAD_TARGET)

schmoozerd 25.04.2012 12:30

Spell 2641 doesn't have this attribute.

rsa 25.04.2012 12:37

Цитата:

Сообщение от schmoozerd (Сообщение 27074)
Spell 2641 doesn't have this attribute.

currently work of 2641 - partially hack. dead pet must be dismissed by 47531 (absent in DBC) - his must have this attr.
PS may be effect 1 of 2641 also must work on dead pet? ;)

schmoozerd 25.04.2012 12:49

as I said - would not work correctly..

rsa 25.04.2012 13:01

Цитата:

Сообщение от schmoozerd (Сообщение 27076)
as I said - would not work correctly..

not work correctly with badly hacks? yes, i agree.

PS i'm cannot fit code to hacks. if spell absent in DBC, but must work - his require reconstruction, but not hacks like 11970 and some other...

schmoozerd 25.04.2012 13:10

well, i don't know what the missing spell related to 2641 is for.
But it cannot be used to dismiss the pet.
THat is just stupid for two reasons:
1) effect1 has the dismiss pet effect, so it would be redundant
2) the non-existent spell was not used in classic times, and I am farily sure that even in classic times a hunter was able to dismiss a pet...

rsa 25.04.2012 13:35

:) in classic _any_ spell be castable on dead target, if your not remember... not requre special addons like this.
in DBC big bunch of spells, reworked on 2.xx and next time reworked on 3.xx (4.xx, 5.xx).

schmoozerd 26.04.2012 20:49

In some minimal form in [11981].
Thank you :)


Текущее время: 22:56. Часовой пояс GMT +3.

ru-mangos.ru - Русское сообщество MaNGOS