View Single Post
  #1  
Old 01-18-2011, 03:16 PM
bad_captain
Developer
 
Join Date: Feb 2009
Location: Cincinnati, OH
Posts: 512
Default IsPureNukeSpell issue?

I have been looking into this function while working on bots. Is this intended to allow heal spells through? The current code is below.

Code:
bool IsPureNukeSpell(int16 spell_id)
{
        int i, effect_count = 0;

        if(!IsValidSpell(spell_id))
                return false;

        for(i = 0; i < EFFECT_COUNT; i++)
        {
                if(!IsBlankSpellEffect(spell_id, i))
                        effect_count++;
        }

        return
        (
                effect_count == 1 && IsEffectInSpell(spell_id, SE_CurrentHP) && 
                spells[spell_id].buffduration == 0
        );
}
This will return true for any single effect heal, as it does not check for negative values (damage spells). To do some testing, I have added && IsDamageSpell(spellid) in the return after checking the buffduration, which has a lot of redundant code, but you can't really just do a quick && spells[spell_id].base[0] < 0, since I guess you can't be guaranteed that even though it has only 1 effect, that it is in slot 0. Instead of rewriting what's already there in IsDamageSpell, I would just use it..

Or is this working as intended?

I can use IsDamageSpell in what I'm working on for bots in conjunction with this, or it could be added here, if there isn't a reason for needing heals to be run through this. (This is called from IsPartialCapableSpell)
Reply With Quote