Ru-MaNGOS

Ru-MaNGOS (http://mangos.ytdb.ru/index.php)
-   Патчи на рассмотрении (http://mangos.ytdb.ru/forumdisplay.php?f=49)
-   -   Fix use item 3434 (http://mangos.ytdb.ru/showthread.php?t=5382)

Den 23.04.2012 19:56

Fix use item 3434
 
Нельзя применить к цели выше 30-го уровня.

Код:

diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index a389f3c..8846f0c 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -4846,6 +4846,14 @@ SpellCastResult Spell::CheckCast(bool strict)
                return SPELL_FAILED_CASTER_AURASTATE;
        }
 
+        // Sleep (item 3434)
+        if (m_spellInfo->Id == 700)
+        {
+            int32 targetLevel = m_targets.getUnitTarget()->getLevel();
+            if (targetLevel > 30)
+                return SPELL_FAILED_FIZZLE;
+        }
+
        // totem immunity for channeled spells(needs to be before spell cast)
        // spell attribs for player channeled spells
        if (m_spellInfo->HasAttribute(SPELL_ATTR_EX_UNK14)


schmoozerd 24.04.2012 00:01

Hi Den *wave

on wowhead it says about this item: "Unreliable on targets above level 30."
http://old.wowhead.com/item=3434#comments

So I would assume it might still work (with a lower chance)

Den 24.04.2012 09:04

Hi schmoozerd.

Not so long ago, did this quest and checked that the purpose above the 30th level doesn't affect.

later still I will check :)

Den 14.05.2012 12:33

Возвращаемся к этому вопросу. Оказывается что, если взять предмет схожий с выше указанным, к примеру http://www.wowhead.com/item=4360 то получается, что на цель 34 уровня предмет не действует вообще. Выходит так, на каждый уровень по 10% снимается шанс, что предмет будет использован.

We come back to this question. It appears that if to take a subject similar with above specified, for example http://www.wowhead.com/item=4360 that turns out that 34 levels the subject doesn't affect the purpose in general. Leaves so, on each level on 10 % the chance acts in film that the subject will be used.

Код:

diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index bfc115d..01098dd 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -4919,6 +4919,31 @@ SpellCastResult Spell::CheckCast(bool strict)
                return SPELL_FAILED_CASTER_AURASTATE;
        }
 
+        // Sleep (item 3434)
+        if (m_spellInfo->Id == 700)
+        {
+            int32 targetLevel = m_targets.getUnitTarget()->GetLevel();
+            float chance = m_spellInfo->procChance;
+
+            switch (targetLevel)
+            {
+                case 31: chance = 90.0f; break;
+                case 32: chance = 80.0f; break;
+                case 33: chance = 70.0f; break;
+                case 34: chance = 60.0f; break;
+                case 35: chance = 50.0f; break;
+                case 36: chance = 40.0f; break;
+                case 37: chance = 30.0f; break;
+                case 38: chance = 20.0f; break;
+                case 39: chance = 10.0f; break;
+            }
+
+            if (!roll_chance_i(chance) || targetLevel >= 40)
+                return SPELL_FAILED_FIZZLE;
+
+            return SPELL_CAST_OK;
+        }
+
        // totem immunity for channeled spells(needs to be before spell cast)
        // spell attribs for player channeled spells
        if (m_spellInfo->HasAttribute(SPELL_ATTR_EX_UNK14)

PS Попробовал перевести переводчиком обратно этот же текст на русский, последнее предложение :laugh1:

partizanes 14.05.2012 12:47

м.б как то так вместо свича(просто идея)

Код:

if(targetLevel> 30)
change = change-((targetLevel- 30)*10)


p.s по идеи можно использовать параметр max вместо 30 из
Код:

Spell Level = 8, base 8, max 30, maxTarget 0
и по второму приведенному примеру
Код:

Spell Level = 0, base 0, max 24, maxTarget 0
для расчёта шанса и сделать общим для всех таких видов спеллов.

что то типа
Код:

if (max>1 && targetLevel> max)
{
change = change-((targetLevel - max)*10))
if(change <0)
return SPELL_FAILED_FIZZLE;
}

единственное что не учел наверно это что шанс то 101 ))

partizanes 15.05.2012 02:34

все что осмыслил ,пересмотрел все спелы с первым if
(думаю что как то так)
в коде есть я думаю ошибки(по синтаксису) ,но тому кому надо поймет суть.

Код:

if (SPELL_AURA_MOD_STUN &&  m_spellInfo->maxlevel > 0 && m_spellInfo->maxlevel < m_targets.getUnitTarget()->GetLevel())
{
 int32 targetLevel = m_targets.getUnitTarget()->GetLevel();
 int32 maxlevel    =  m_spellInfo->maxlevel();

 float change = change-((targetLevel - maxlevel)*10));

  if (chance <= 1)
    return SPELL_FAILED_FIZZLE;       
}


partizanes 18.05.2012 00:46

итоговый рабочий вариант
Код:

case SPELL_AURA_MOD_STUN
Код:

    if (m_spellInfo->maxLevel > 0 && m_spellInfo->maxLevel < m_targets.getUnitTarget()->getLevel())
        {
                int32 targetLevel = m_targets.getUnitTarget()->getLevel();
                int32 maxlevel    =  m_spellInfo->maxLevel;                                       
                float change = m_spellInfo->procChance;

                change -= (targetLevel - maxlevel)*10;
               
                if (change <= 1)
                return SPELL_FAILED_FIZZLE;       
        }

вопрос 1:куда запихнуть?(вопрос2,3)
вопрос 2:что конкретно не срабатывает Эффект ? Урон
вопрос 3 когда проверят до каста ? после каста
вопрос 4: учитывая как я понял что почти везде шанс каста 101% ,возникает вопрос учитывать ли 1% как рандом - тоесть
Код:

//101    - ( 60    -  50  )  * 10  = 1% 
change -= (targetLevel - maxlevel)*10;

if (change <= 1)  ?  if (change <=0)

вопрос5: как вернуть шанс в функцию в которой будет производится вычисления с шансом (если проверка уже после каста)

schmoozerd 18.11.2012 15:25

little bump here

A small note about the 101 chance:
I always thought that 101 chance would mean "hits always"

But it is possible that the 101 chance is an entirely independend chance calculation, and in these cases we just need to use the other values for calculation

Some more notes about targeting:
spell http://www.wowhead.com/spell=4064 has no unit-targeting, but is AoE-Dest-Targeting, so this calculation would not fit into CheckCast.

Also it would be required to ensure that the code is safe (not checked if getUnitTarget returns a valid pointer)


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

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