[11998] Implement fail chance for spell 54732

Ths to stfx for porting

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
boxa 2011-08-29 15:38:39 +04:00 committed by Schmoozerd
parent 007420b615
commit f13213018c
2 changed files with 20 additions and 19 deletions

View file

@ -8563,34 +8563,35 @@ void Spell::EffectSummonObject(SpellEffectIndex eff_idx)
void Spell::EffectResurrect(SpellEffectIndex /*eff_idx*/) void Spell::EffectResurrect(SpellEffectIndex /*eff_idx*/)
{ {
if(!unitTarget) if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
if(unitTarget->GetTypeId() != TYPEID_PLAYER)
return; return;
if(unitTarget->isAlive()) if (unitTarget->isAlive() || !unitTarget->IsInWorld())
return;
if(!unitTarget->IsInWorld())
return; return;
switch (m_spellInfo->Id) switch (m_spellInfo->Id)
{ {
// Defibrillate (Goblin Jumper Cables) have 33% chance on success case 8342: // Defibrillate (Goblin Jumper Cables) has 33% chance on success
case 8342: case 22999: // Defibrillate (Goblin Jumper Cables XL) has 50% chance on success
if (roll_chance_i(67)) case 54732: // Defibrillate (Gnomish Army Knife) has 67% chance on success
{ {
m_caster->CastSpell(m_caster, 8338, true, m_CastItem); uint32 failChance = 0;
uint32 failSpellId = 0;
switch (m_spellInfo->Id)
{
case 8342: failChance=67; failSpellId = 8338; break;
case 22999: failChance=50; failSpellId = 23055; break;
case 54732: failChance=33; failSpellId = 0; break;
}
if (roll_chance_i(failChance))
{
if (failSpellId)
m_caster->CastSpell(m_caster, failSpellId, true, m_CastItem);
return; return;
} }
break; break;
// Defibrillate (Goblin Jumper Cables XL) have 50% chance on success
case 22999:
if (roll_chance_i(50))
{
m_caster->CastSpell(m_caster, 23055, true, m_CastItem);
return;
} }
break;
default: default:
break; break;
} }

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "11997" #define REVISION_NR "11998"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__