void MassParalyseSpell::Launch() { ARX_SOUND_PlaySFX(SND_SPELL_MASS_PARALYSE); m_duration = (m_launchDuration > -1) ? m_launchDuration : 10000; for(size_t ii = 0; ii < entities.size(); ii++) { const EntityHandle handle = EntityHandle(ii); Entity * tio = entities[handle]; if(handle == m_caster || !tio || !(tio->ioflags & IO_NPC)) { continue; } if(tio->show != SHOW_FLAG_IN_SCENE) { continue; } if(tio->ioflags & IO_FREEZESCRIPT) { continue; } if(fartherThan(tio->pos, entities[m_caster]->pos, 500.f)) { continue; } tio->ioflags |= IO_FREEZESCRIPT; ARX_NPC_Kill_Spell_Launch(tio); m_targets.push_back(tio->index()); } }
void ParalyseSpell::Launch() { ARX_SOUND_PlaySFX(SND_SPELL_PARALYSE, &entities[m_target]->pos); m_duration = (m_launchDuration > -1) ? m_launchDuration : 5000; float resist_magic = 0.f; if(m_target == PlayerEntityHandle && m_level <= player.level) { resist_magic = player.m_misc.resistMagic; } else if(entities[m_target]->ioflags & IO_NPC) { resist_magic = entities[m_target]->_npcdata->resist_magic; } if(Random::getf(0.f, 100.f) < resist_magic) { float mul = std::max(0.5f, 1.f - (resist_magic * 0.005f)); m_duration = long(m_duration * mul); } entities[m_target]->ioflags |= IO_FREEZESCRIPT; m_targets.push_back(m_target); ARX_NPC_Kill_Spell_Launch(entities[m_target]); }