예제 #1
0
SpellItem* SpellShell::FindSpell(int spell_id, int caster_id, int target_id)
{
  bool target = true;
  const Spell* spell = m_spells->spell(spell_id);
  if (spell)
    target = (spell->targetType() != 6);

  for(QValueList<SpellItem*>::Iterator it = m_spellList.begin();
      it != m_spellList.end(); it++) {
    SpellItem *i = *it;
    //loop to trap a spell being added that is already cast on self.
    if ((i->spellId() == spell_id) && (i->casterId() == i->targetId()))
      if (caster_id == target_id)
	return i;
	
    if ((i->spellId() == spell_id) && (i->targetId() == target_id)) 
    {
      if ( (target) && (target_id) ) 
      {
	if (i->targetId() == target_id)
	  return i;
      }
      else return i;
    }
  }
  return NULL;
}
예제 #2
0
SpellItem* SpellShell::FindSpell(int spell_id, int caster_id, int target_id)
{
   for(QValueList<SpellItem*>::Iterator it = m_spellList.begin();
         it != m_spellList.end(); it++) {
      SpellItem *i = *it;
      if ((i->spellId() == spell_id) && (i->casterId() == caster_id)) {
         struct spellInfoStruct *info;
         info = spell_info(spell_id);
         if ( (info->target) && (target_id) ) {
            if (i->targetId() == target_id)
               return i;
         } else return i;
      }
   }
   return NULL;
}