

Code: Select all
public bool isCreatureImmuneToEffect(Creature crt, Effect ef)
{
//see if their level is greater than the effect works on level
if (crt.cr_level > ef.worksOnLevelOrLowerOnCreatureOrPc)
{
return true;
}
//go through each trait to see if have trait with immune effect
foreach (EffectTagForDropDownList efTag in crt.immuneToEffectTagList)
{
if (efTag.tag == ef.tag)
{
return true;
}
}
//go through each effect to see if it is a remove effect type
foreach (Effect pcEf in crt.cr_effectsList)
{
if (pcEf.removeEffectTagList.Count > 0)
{
foreach (EffectTagForDropDownList efTag in pcEf.removeEffectTagList)
{
if (efTag.tag.Equals(ef.tag))
{
return true;
}
}
}
}
return false;
}