private static NWEffect GetTrapEffect(CLRScriptBase s, ALFA.Shared.ActiveTrap trap, uint target)
        {
            int damage = 0;

            for (int count = 0; count < trap.DiceNumber; count++)
            {
                damage += s.Random(trap.DiceType) + 1;
            }
            if (trap.SaveDC > -1)
            {
                if (s.ReflexSave(target, trap.SaveDC, SAVING_THROW_TYPE_TRAP, s.GetObjectByTag(trap.Tag, 0)) != TRUE)
                {
                    if (s.GetHasFeat(FEAT_IMPROVED_EVASION, target, TRUE) == TRUE)
                    {
                        damage /= 2;
                    }
                }
                else
                {
                    if (s.GetHasFeat(FEAT_EVASION, target, TRUE) == TRUE)
                    {
                        damage = 0;
                    }
                    else
                    {
                        damage /= 2;
                    }
                }
            }
            else
            {
                int    roll      = new Random().Next(20) + 1;
                int    final     = roll + trap.AttackBonus;
                string hitormiss = " *hit* ";
                if (final < s.GetAC(target, FALSE) && roll != 20)
                {
                    hitormiss = " *miss* ";
                    damage    = 0;
                }
                s.SendMessageToPC(target, "<C=DarkViolet>Trap</C><C=DarkOrange> attacks " + s.GetName(target) + ":" + hitormiss + ": " + roll + " + " + trap.AttackBonus + " = " + final);
            }

            NWEffect eVis = s.EffectVisualEffect(VFX_COM_HIT_DIVINE, FALSE);

            List <int> damageTypes = new List <int>();

            if ((trap.DamageType & DAMAGE_TYPE_ACID) == DAMAGE_TYPE_ACID)
            {
                damageTypes.Add(DAMAGE_TYPE_ACID);
                eVis = s.EffectVisualEffect(VFX_COM_HIT_ACID, FALSE);
            }
            if ((trap.DamageType & DAMAGE_TYPE_BLUDGEONING) == DAMAGE_TYPE_BLUDGEONING)
            {
                damageTypes.Add(DAMAGE_TYPE_BLUDGEONING);
                eVis = s.EffectVisualEffect(VFX_COM_BLOOD_CRT_RED, FALSE);
            }
            if ((trap.DamageType & DAMAGE_TYPE_COLD) == DAMAGE_TYPE_COLD)
            {
                damageTypes.Add(DAMAGE_TYPE_COLD);
                eVis = s.EffectVisualEffect(VFX_COM_HIT_FROST, FALSE);
            }
            if ((trap.DamageType & DAMAGE_TYPE_DIVINE) == DAMAGE_TYPE_DIVINE)
            {
                damageTypes.Add(DAMAGE_TYPE_DIVINE);
                eVis = s.EffectVisualEffect(VFX_COM_HIT_DIVINE, FALSE);
            }
            if ((trap.DamageType & DAMAGE_TYPE_ELECTRICAL) == DAMAGE_TYPE_ELECTRICAL)
            {
                damageTypes.Add(DAMAGE_TYPE_ELECTRICAL);
                eVis = s.EffectVisualEffect(VFX_COM_HIT_ELECTRICAL, FALSE);
            }
            if ((trap.DamageType & DAMAGE_TYPE_FIRE) == DAMAGE_TYPE_FIRE)
            {
                damageTypes.Add(DAMAGE_TYPE_FIRE);
                eVis = s.EffectVisualEffect(VFX_COM_HIT_FIRE, FALSE);
            }
            if ((trap.DamageType & DAMAGE_TYPE_MAGICAL) == DAMAGE_TYPE_MAGICAL)
            {
                damageTypes.Add(DAMAGE_TYPE_MAGICAL);
                eVis = s.EffectVisualEffect(VFX_COM_HIT_DIVINE, FALSE);
            }
            if ((trap.DamageType & DAMAGE_TYPE_NEGATIVE) == DAMAGE_TYPE_NEGATIVE)
            {
                damageTypes.Add(DAMAGE_TYPE_NEGATIVE);
                eVis = s.EffectVisualEffect(VFX_COM_HIT_NEGATIVE, FALSE);
            }
            if ((trap.DamageType & DAMAGE_TYPE_PIERCING) == DAMAGE_TYPE_PIERCING)
            {
                damageTypes.Add(DAMAGE_TYPE_PIERCING);
                eVis = s.EffectVisualEffect(VFX_COM_BLOOD_CRT_RED, FALSE);
            }
            if ((trap.DamageType & DAMAGE_TYPE_POSITIVE) == DAMAGE_TYPE_POSITIVE)
            {
                damageTypes.Add(DAMAGE_TYPE_POSITIVE);
                eVis = s.EffectVisualEffect(VFX_COM_HIT_DIVINE, FALSE);
            }
            if ((trap.DamageType & DAMAGE_TYPE_SLASHING) == DAMAGE_TYPE_SLASHING)
            {
                damageTypes.Add(DAMAGE_TYPE_SLASHING);
                eVis = s.EffectVisualEffect(VFX_COM_BLOOD_CRT_RED, FALSE);
            }
            if ((trap.DamageType & DAMAGE_TYPE_SONIC) == DAMAGE_TYPE_SONIC)
            {
                damageTypes.Add(DAMAGE_TYPE_SONIC);
                eVis = s.EffectVisualEffect(VFX_COM_HIT_SONIC, FALSE);
            }

            if (damage == 0)
            {
                return(eVis);
            }

            NWEffect eDam = eVis;

            damage /= damageTypes.Count;
            if (damage < 1)
            {
                damage = 1;
            }
            foreach (int dmgType in damageTypes)
            {
                eDam = s.EffectLinkEffects(eDam, s.EffectDamage(damage, dmgType, DAMAGE_POWER_NORMAL, FALSE));
            }

            return(eDam);
        }