private static bool IsTrapDetectedBy(CLRScriptBase s, ALFA.Shared.ActiveTrap trap, uint detector)
{
if (trap.Detected)
{
return false;
}
if(!IsInArea(s, trap, detector))
{
return false;
}
if (s.GetDetectMode(detector) == FALSE)
{
s.DelayCommand(6.0f, delegate { DetectHeartBeat(s, trap, detector); });
return false;
}
if (trap.DetectDC > 20 &&
s.GetLevelByClass(CLASS_TYPE_ROGUE, detector) == FALSE &&
s.GetHasSpellEffect(SPELL_FIND_TRAPS, detector) == FALSE)
{
s.DelayCommand(6.0f, delegate { DetectHeartBeat(s, trap, detector); });
return false;
}
int searchBonus = s.GetSkillRank(SKILL_SEARCH, detector, FALSE);
int roll = s.d20(1);
int finalDice = roll + searchBonus;
if (trap.DetectDC <= finalDice)
{
return true;
}
s.DelayCommand(6.0f, delegate { DetectHeartBeat(s, trap, detector); });
return false;
}