/*
Function: get_applyTotal()
This function adds up the total modifiers for the location type
on an object. You put in like APPLY_HITROLL and it will add up
and return the total +'s to hitroll an object can give.
Might require a little modification because of the affected2
field is not stock rom. I use it to cap on how
powerful something can be enchanted by a spell.
Feel free to use it how ever you want.
Just give me some leave this header so I can have some kind of
credit.
- Amras(hexdev@genesismuds.com)
- hexahedron.genesismuds.com port 1414
*/
int get_applyTotal(OBJ_DATA * obj, int app_type)
{
int to_return = 0;
AFFECT_DATA * paf;
if(!obj->enchanted)
{
if(obj->pIndexData->affected != NULL)
{
for (paf = obj->pIndexData->affected; paf != NULL; paf = paf->next)
{
if(paf->location != app_type)
continue;
to_return += paf->modifier;
}
}
}
if(obj->affected != NULL)
{
for (paf = obj->affected; paf != NULL; paf = paf->next)
{
if(paf->location != app_type)
continue;
to_return += paf->modifier;
}
}
if(obj->affected2 != NULL)
{
for (paf = obj->affected2; paf != NULL; paf = paf->next)
{
if(paf->location != app_type)
continue;
to_return += paf->modifier;
}
}
return to_return;
}