void NegateMagicSpell::LaunchAntiMagicField() { if(!ValidIONum(m_target)) return; for(size_t i = 0; i < MAX_SPELLS; i++) { SpellBase * spell = spells[SpellHandle(i)]; if(!spell) continue; if(this == spell) continue; if(m_level < spell->m_level) continue; Vec3f pos = spell->getPosition(); if(closerThan(pos, entities[m_target]->pos, 600.f)) { if(spell->m_type != SPELL_CREATE_FIELD) { spells.endSpell(spell); } else if(m_target == PlayerEntityHandle && spell->m_caster == PlayerEntityHandle) { spells.endSpell(spell); } } } }
void DouseSpell::Launch() { m_duration = ArxDurationMs(500); Vec3f target; if(m_hand_group != ActionPoint()) { target = m_hand_pos; } else { target = m_caster_pos; target.y -= 50.f; } float fPerimeter = 400.f + m_level * 30.f; CheckForIgnition(Sphere(target, fPerimeter), 0, 1); for(size_t ii = 0; ii < g_staticLightsMax; ii++) { EERIE_LIGHT * light = g_staticLights[ii]; if(!light || !(light->extras & EXTRAS_EXTINGUISHABLE)) { continue; } if(!(light->extras & EXTRAS_SEMIDYNAMIC) && !(light->extras & EXTRAS_SPAWNFIRE) && !(light->extras & EXTRAS_SPAWNSMOKE)) { continue; } if(!light->m_ignitionStatus) { continue; } if(!fartherThan(target, light->pos, fPerimeter)) { m_lights.push_back(ii); } } if(player.torch && closerThan(target, player.pos, fPerimeter)) { ARX_PLAYER_ClickedOnTorch(player.torch); } for(size_t k = 0; k < MAX_SPELLS; k++) { SpellBase * spell = spells[SpellHandle(k)]; if(!spell) { continue; } switch(spell->m_type) { case SPELL_FIREBALL: { Vec3f pos = spell->getPosition(); float radius = std::max(m_level * 2.f, 12.f); if(closerThan(target, pos, fPerimeter + radius)) { spell->m_level -= m_level; if(spell->m_level < 1) { spells.endSpell(spell); } } break; } case SPELL_FIRE_FIELD: { Vec3f pos = spell->getPosition(); if(closerThan(target, pos, fPerimeter + 200)) { spell->m_level -= m_level; if(spell->m_level < 1) { spells.endSpell(spell); } } break; } default: break; } } }