public override bool OnTrap(TrapSprungEvent trap, GameObject triggerer)
    {
        // numP = 210 / (game.party_npc_size() + game.party_pc_size())
        // for obj in game.obj_list_vicinity( triggerer.location, OLC_CRITTERS ):
        // obj.stat_base_set(stat_experience, (obj.stat_level_get(stat_experience) - numP))
        AttachParticles(trap.Type.ParticleSystemId, trap.Object);
        Sound(4021, 1);
        foreach (var dmg in trap.Type.Damage)
        {
            if ((dmg.Type == DamageType.Poison))
            {
                if ((!triggerer.SavingThrow(13, SavingThrowType.Fortitude, D20SavingThrowFlag.POISON, trap.Object)))
                {
                    triggerer.AddCondition("Poisoned", dmg.Dice.Modifier, 0);
                }
            }
            else
            {
                triggerer.Damage(trap.Object, dmg.Type, dmg.Dice);
            }
        }

        DetachScript();
        return(SkipDefault);
    }
    public override bool OnTrap(TrapSprungEvent trap, GameObject triggerer)
    {
        // numP = 210 / (game.party_npc_size() + game.party_pc_size())
        // for obj in game.obj_list_vicinity( triggerer.location, OLC_CRITTERS ):
        // obj.stat_base_set(stat_experience, (obj.stat_level_get(stat_experience) - numP))
        AttachParticles(trap.Type.ParticleSystemId, trap.Object);
        Sound(4029, 1);
        foreach (var obj in ObjList.ListVicinity(triggerer.GetLocation(), ObjectListFilter.OLC_CRITTERS))
        {
            if ((obj.DistanceTo(trap.Object) <= 5))
            {
                if ((obj.HasLineOfSight(trap.Object)))
                {
                    foreach (var dmg in trap.Type.Damage)
                    {
                        if ((dmg.Type == DamageType.Poison))
                        {
                            if ((!obj.SavingThrow(15, SavingThrowType.Fortitude, D20SavingThrowFlag.POISON, trap.Object)))
                            {
                                obj.AddCondition("Poisoned", dmg.Dice.Modifier, 0);
                            }
                        }
                        else
                        {
                            obj.ReflexSaveAndDamage(trap.Object, 15, D20SavingThrowReduction.Half, D20SavingThrowFlag.SPELL_DESCRIPTOR_SONIC, dmg.Dice, dmg.Type, D20AttackPower.NORMAL);
                        }
                    }
                }
            }
        }

        DetachScript();
        return(SkipDefault);
    }
Esempio n. 3
0
    public override bool OnTrap(TrapSprungEvent trap, GameObject triggerer)
    {
        AttachParticles(trap.Type.ParticleSystemId, trap.Object);
        foreach (var obj in ObjList.ListVicinity(triggerer.GetLocation(), ObjectListFilter.OLC_CRITTERS))
        {
            if ((obj.DistanceTo(trap.Object) <= 10))
            {
                if ((obj.HasLineOfSight(trap.Object)))
                {
                    foreach (var dmg in trap.Type.Damage)
                    {
                        if ((dmg.Type == DamageType.Poison))
                        {
                            if ((!obj.SavingThrow(15, SavingThrowType.Fortitude, D20SavingThrowFlag.POISON, trap.Object)))
                            {
                                obj.AddCondition("Poisoned", dmg.Dice.Modifier, 0);
                            }
                        }
                        else if ((obj == triggerer))
                        {
                            obj.Damage(trap.Object, dmg.Type, dmg.Dice);
                        }
                        else
                        {
                            obj.ReflexSaveAndDamage(trap.Object, 15, D20SavingThrowReduction.Half, D20SavingThrowFlag.SPELL_DESCRIPTOR_FORCE, dmg.Dice, dmg.Type, D20AttackPower.NORMAL);
                        }
                    }
                }
            }
        }

        return(SkipDefault);
    }
Esempio n. 4
0
    public override bool OnTrap(TrapSprungEvent trap, GameObject triggerer)
    {
        AttachParticles(trap.Type.ParticleSystemId, trap.Object);
        var result = trap.Attack(triggerer, 8, 20, false);

        if (((result & D20CAF.HIT)) != D20CAF.NONE)
        {
            foreach (var dmg in trap.Type.Damage)
            {
                if ((dmg.Type == DamageType.Poison))
                {
                    if ((!triggerer.SavingThrow(13, SavingThrowType.Fortitude, D20SavingThrowFlag.POISON, trap.Object)))
                    {
                        triggerer.AddCondition("Poisoned", dmg.Dice.Modifier, 0);
                    }
                }
                else
                {
                    var d = dmg.Dice.Copy();

                    if (((result & D20CAF.CRITICAL)) != D20CAF.NONE)
                    {
                        d = d.WithCount(d.Count * 3);
                        d = d.WithModifier(d.Modifier * 3);
                    }

                    triggerer.Damage(trap.Object, dmg.Type, d);
                }
            }
        }

        return(SkipDefault);
    }
Esempio n. 5
0
    public override bool OnTrap(TrapSprungEvent trap, GameObject triggerer)
    {
        AttachParticles(trap.Type.ParticleSystemId, trap.Object);
        var result = trap.Attack(triggerer, 8, 20, false);

        if (((result & D20CAF.HIT)) != D20CAF.NONE)
        {
            if ((!triggerer.SavingThrow(13, SavingThrowType.Fortitude, D20SavingThrowFlag.POISON, trap.Object)))
            {
                triggerer.AddCondition("Poisoned", trap.Type.Damage[0].Dice.Modifier, 0);
            }

            var d = trap.Type.Damage[1].Dice.Copy();

            if (((result & D20CAF.CRITICAL)) != D20CAF.NONE)
            {
                d = d.WithCount(d.Count * 2);
                d = d.WithModifier(d.Modifier * 2);
            }

            triggerer.Damage(trap.Object, trap.Type.Damage[1].Type, d);
        }

        if ((trap.Type.Id == 4))
        {
            foreach (var obj in ObjList.ListVicinity(triggerer.GetLocation(), ObjectListFilter.OLC_CRITTERS))
            {
                if ((obj.DistanceTo(trap.Object) <= 10))
                {
                    if ((obj.HasLineOfSight(trap.Object)))
                    {
                        obj.ReflexSaveAndDamage(trap.Object, 20, D20SavingThrowReduction.Half, D20SavingThrowFlag.SPELL_DESCRIPTOR_ACID, trap.Type.Damage[2].Dice, trap.Type.Damage[2].Type, D20AttackPower.NORMAL);
                    }
                }
            }
        }

        if ((trap.Type.Id == 7))
        {
            foreach (var obj in ObjList.ListVicinity(triggerer.GetLocation(), ObjectListFilter.OLC_CRITTERS))
            {
                if ((obj.DistanceTo(trap.Object) <= 10))
                {
                    if ((obj.HasLineOfSight(trap.Object)))
                    {
                        if ((!obj.SavingThrow(15, SavingThrowType.Fortitude, D20SavingThrowFlag.POISON, trap.Object)))
                        {
                            obj.AddCondition("Poisoned", trap.Type.Damage[2].Dice.Modifier, 0);
                        }
                    }
                }
            }
        }

        return(SkipDefault);
    }
Esempio n. 6
0
    public override bool OnTrap(TrapSprungEvent trap, GameObject triggerer)
    {
        AttachParticles(trap.Type.ParticleSystemId, trap.Object);
        foreach (var dmg in trap.Type.Damage)
        {
            triggerer.Damage(trap.Object, dmg.Type, dmg.Dice);
        }

        return(SkipDefault);
    }
    public override bool OnTrap(TrapSprungEvent trap, GameObject triggerer)
    {
        AttachParticles(trap.Type.ParticleSystemId, trap.Object);
        foreach (var obj in ObjList.ListVicinity(triggerer.GetLocation(), ObjectListFilter.OLC_CRITTERS))
        {
            obj.AddCondition("Poisoned", 5, 0);
        }

        return(SkipDefault);
    }
Esempio n. 8
0
    public override bool OnTrap(TrapSprungEvent trap, GameObject triggerer)
    {
        AttachParticles(trap.Type.ParticleSystemId, trap.Object);
        foreach (var obj in ObjList.ListVicinity(triggerer.GetLocation(), ObjectListFilter.OLC_CRITTERS))
        {
            foreach (var dmg in trap.Type.Damage)
            {
                obj.Damage(trap.Object, dmg.Type, dmg.Dice);
            }
        }

        return(SkipDefault);
    }
Esempio n. 9
0
    public override bool OnTrap(TrapSprungEvent trap, GameObject triggerer)
    {
        // numP = 210 / (game.party_npc_size() + game.party_pc_size())
        // for obj in game.obj_list_vicinity( triggerer.location, OLC_CRITTERS ):
        // obj.stat_base_set(stat_experience, (obj.stat_level_get(stat_experience) - numP))
        if ((triggerer.GetMap() == 5094))
        {
            // monsterA = game.obj_create( 14424, location_from_axis (487L, 505L) )	## test
            // monsterA = game.obj_create( 14600, location_from_axis (487L, 505L) )	## test
            SetGlobalVar(708, 0);
            var monsterA = GameSystems.MapObject.CreateObject(14601, new locXY(487, 505)); // test
            // create_item_in_inventory ( 6072, monsterA )
            Utilities.create_item_in_inventory(4068, monsterA);
            // create_item_in_inventory ( 4004, monsterA )
            monsterA.SetConcealed(true);
            var monsterC = GameSystems.MapObject.CreateObject(14602, new locXY(487, 506));
            Utilities.create_item_in_inventory(4194, monsterC);
            monsterC.SetConcealed(true);
            var monsterD = GameSystems.MapObject.CreateObject(14602, new locXY(487, 504));
            Utilities.create_item_in_inventory(4194, monsterD);
            monsterD.SetConcealed(true);
            var monsterE = GameSystems.MapObject.CreateObject(14602, new locXY(488, 505));
            Utilities.create_item_in_inventory(4194, monsterE);
            monsterE.SetConcealed(true);
            // monsterA = game.obj_create( 14081, location_from_axis (487L, 505L) )	## test
            // monsterA.turn_towards(triggerer)                             ## test
            // monsterA.attack(triggerer)                               ## test
            // monsterA.concealed_set(1)                                ## test
            // monsterB = game.obj_create( 14128, location_from_axis (487L, 499L) )
            // monsterB = game.obj_create( 14425, location_from_axis (487L, 499L) )     ## test
            // monsterB.turn_towards(triggerer)
            // monsterB.attack(triggerer)
            // monsterB.concealed_set(1)
            monsterC = GameSystems.MapObject.CreateObject(14107, new locXY(482, 496));
            monsterC.TurnTowards(triggerer);
            monsterC.Attack(triggerer);
            monsterC.SetConcealed(true);
            monsterD = GameSystems.MapObject.CreateObject(14083, new locXY(478, 501));
            monsterD.TurnTowards(triggerer);
            monsterD.Attack(triggerer);
            monsterD.SetConcealed(true);
            monsterE = GameSystems.MapObject.CreateObject(14107, new locXY(481, 506));
            monsterE.TurnTowards(triggerer);
            monsterE.Attack(triggerer);
            monsterE.SetConcealed(true);
        }

        DetachScript();
        return(SkipDefault);
    }
Esempio n. 10
0
    public override bool OnTrap(TrapSprungEvent trap, GameObject triggerer)
    {
        // numP = 210 / (game.party_npc_size() + game.party_pc_size())
        // for obj in game.obj_list_vicinity( triggerer.location, OLC_CRITTERS ):
        // obj.stat_base_set(stat_experience, (obj.stat_level_get(stat_experience) - numP))
        AttachParticles(trap.Type.ParticleSystemId, trap.Object);
        Sound(4021, 1);
        foreach (var obj in ObjList.ListVicinity(triggerer.GetLocation(), ObjectListFilter.OLC_CRITTERS))
        {
            obj.AddCondition("Poisoned", 5, 0);
        }

        DetachScript();
        return(SkipDefault);
    }
    public override bool OnTrap(TrapSprungEvent trap, GameObject triggerer)
    {
        // numP = 210 / (game.party_npc_size() + game.party_pc_size())
        // for obj in game.obj_list_vicinity( triggerer.location, OLC_CRITTERS ):
        // obj.stat_base_set(stat_experience, (obj.stat_level_get(stat_experience) - numP))
        AttachParticles(trap.Type.ParticleSystemId, trap.Object);
        Sound(4023, 1);
        foreach (var obj in ObjList.ListVicinity(triggerer.GetLocation(), ObjectListFilter.OLC_CRITTERS))
        {
            if ((obj.DistanceTo(trap.Object) <= 10))
            {
                if ((obj.HasLineOfSight(trap.Object)))
                {
                    var result = trap.Attack(triggerer, 15, 20, true);
                    if (((result & D20CAF.HIT)) != D20CAF.NONE)
                    {
                        foreach (var dmg in trap.Type.Damage)
                        {
                            if ((dmg.Type == DamageType.Poison))
                            {
                                if ((!obj.SavingThrow(11, SavingThrowType.Fortitude, D20SavingThrowFlag.POISON, trap.Object)))
                                {
                                    obj.AddCondition("Poisoned", dmg.Dice.Modifier, 0);
                                }
                            }
                            else
                            {
                                var d = dmg.Dice.Copy();
                                if (((result & D20CAF.CRITICAL)) != D20CAF.NONE)
                                {
                                    d = d.WithCount(d.Count * 2);
                                    d = d.WithModifier(d.Modifier * 2);
                                }

                                obj.Damage(trap.Object, dmg.Type, d);
                            }
                        }
                    }
                }
            }
        }

        DetachScript();
        return(SkipDefault);
    }
Esempio n. 12
0
    public override bool OnTrap(TrapSprungEvent trap, GameObject triggerer)
    {
        AttachParticles(trap.Type.ParticleSystemId, trap.Object);
        foreach (var obj in ObjList.ListVicinity(triggerer.GetLocation(), ObjectListFilter.OLC_CRITTERS))
        {
            if ((obj.DistanceTo(trap.Object) <= 10))
            {
                if ((obj.HasLineOfSight(trap.Object)))
                {
                    var result = trap.Attack(triggerer, 15, 20, true);

                    if (((result & D20CAF.HIT)) != D20CAF.NONE)
                    {
                        foreach (var dmg in trap.Type.Damage)
                        {
                            if ((dmg.Type == DamageType.Poison))
                            {
                                if ((!obj.SavingThrow(11, SavingThrowType.Fortitude, D20SavingThrowFlag.POISON, trap.Object)))
                                {
                                    obj.AddCondition("Poisoned", dmg.Dice.Modifier, 0);
                                }
                            }
                            else
                            {
                                var d = dmg.Dice.Copy();

                                if (((result & D20CAF.CRITICAL)) != D20CAF.NONE)
                                {
                                    d = d.WithCount(d.Count * 2);
                                    d = d.WithModifier(d.Modifier * 2);
                                }

                                obj.Damage(trap.Object, dmg.Type, d);
                            }
                        }
                    }
                }
            }
        }

        return(SkipDefault);
    }
Esempio n. 13
0
    public override bool OnTrap(TrapSprungEvent trap, GameObject triggerer)
    {
        AttachParticles(trap.Type.ParticleSystemId, trap.Object);
        foreach (var dmg in trap.Type.Damage)
        {
            if ((dmg.Type == DamageType.Poison))
            {
                if ((!triggerer.SavingThrow(13, SavingThrowType.Fortitude, D20SavingThrowFlag.POISON, trap.Object)))
                {
                    triggerer.AddCondition("Poisoned", dmg.Dice.Modifier, 0);
                }
            }
            else
            {
                triggerer.Damage(trap.Object, dmg.Type, dmg.Dice);
            }
        }

        return(SkipDefault);
    }
Esempio n. 14
0
    public override bool OnTrap(TrapSprungEvent trap, GameObject triggerer)
    {
        // numP = 210 / (game.party_npc_size() + game.party_pc_size())
        // for obj in game.obj_list_vicinity( triggerer.location, OLC_CRITTERS ):
        // obj.stat_base_set(stat_experience, (obj.stat_level_get(stat_experience) - numP))
        AttachParticles(trap.Type.ParticleSystemId, trap.Object);
        Sound(4025, 1);
        var result = trap.Attack(triggerer, 8, 20, false);

        if (((result & D20CAF.HIT)) != D20CAF.NONE)
        {
            foreach (var dmg in trap.Type.Damage)
            {
                Logger.Info("dmg type={0}", dmg.Type);
                if ((dmg.Type == DamageType.Poison))
                {
                    if ((!triggerer.SavingThrow(13, SavingThrowType.Fortitude, D20SavingThrowFlag.POISON, trap.Object)))
                    {
                        triggerer.AddCondition("Poisoned", dmg.Dice.Modifier, 0);
                    }
                }
                else
                {
                    var d = dmg.Dice.Copy();
                    if (((result & D20CAF.CRITICAL)) != D20CAF.NONE)
                    {
                        d = d.WithCount(d.Count * 3);
                        d = d.WithModifier(d.Modifier * 3);
                    }

                    triggerer.Damage(trap.Object, dmg.Type, d);
                }
            }
        }

        DetachScript();
        return(SkipDefault);
    }
Esempio n. 15
0
 public virtual bool OnTrap(TrapSprungEvent evt, GameObject triggerer)
 {
     return(true);
 }
 public static D20CAF Attack(this TrapSprungEvent evt, GameObject target, int attackBonus, int criticalHitRange, bool rangedAttack)
 {
     throw new NotImplementedException();
 }
Esempio n. 17
0
    public override bool OnTrap(TrapSprungEvent trap, GameObject triggerer)
    {
        // print "Trap sprung"
        if ((trap.Type.Id == 16))
        {
            // print "ID 16"
            // numP = 210 / (game.party_npc_size() + game.party_pc_size())
            // for obj in game.obj_list_vicinity( triggerer.location, OLC_CRITTERS ):
            // obj.stat_base_set(stat_experience, (obj.stat_level_get(stat_experience) - numP))
            AttachParticles(trap.Type.ParticleSystemId, trap.Object);
            AttachParticles("sp-Fireball-Hit", trap.Object);
            Sound(4024, 1);
            foreach (var obj in ObjList.ListVicinity(triggerer.GetLocation(), ObjectListFilter.OLC_CRITTERS))
            {
                if ((obj.DistanceTo(trap.Object) <= 20))
                {
                    if ((obj.HasLineOfSight(trap.Object) || !obj.HasLineOfSight(trap.Object)))
                    {
                        foreach (var dmg in trap.Type.Damage)
                        {
                            if ((dmg.Type == DamageType.Poison))
                            {
                                if ((!obj.SavingThrow(21, SavingThrowType.Fortitude, D20SavingThrowFlag.POISON, trap.Object)))
                                {
                                    obj.AddCondition("Poisoned", dmg.Dice.Modifier, 0);
                                }
                            }
                            else
                            {
                                obj.ReflexSaveAndDamage(trap.Object, 21, D20SavingThrowReduction.Half, D20SavingThrowFlag.SPELL_DESCRIPTOR_FIRE, dmg.Dice, dmg.Type, D20AttackPower.NORMAL);
                            }
                        }
                    }
                }
            }
        }

        if ((triggerer.GetMap() == 5067))
        {
            GetGlobalFlag(874);
        }

        if ((trap.Type.Id == 6))
        {
            // print "ID 6"
            // numP = 210 / (game.party_npc_size() + game.party_pc_size())
            // for obj in game.obj_list_vicinity( triggerer.location, OLC_CRITTERS ):
            // obj.stat_base_set(stat_experience, (obj.stat_level_get(stat_experience) - numP))
            AttachParticles(trap.Type.ParticleSystemId, trap.Object);
            Sound(4024, 1);
            foreach (var obj in ObjList.ListVicinity(triggerer.GetLocation(), ObjectListFilter.OLC_CRITTERS))
            {
                if ((obj.DistanceTo(trap.Object) <= 5))
                {
                    if ((obj.HasLineOfSight(trap.Object)))
                    {
                        foreach (var dmg in trap.Type.Damage)
                        {
                            if ((dmg.Type == DamageType.Poison))
                            {
                                if ((!obj.SavingThrow(15, SavingThrowType.Fortitude, D20SavingThrowFlag.POISON, trap.Object)))
                                {
                                    obj.AddCondition("Poisoned", dmg.Dice.Modifier, 0);
                                }
                            }
                            else
                            {
                                obj.ReflexSaveAndDamage(trap.Object, 16, D20SavingThrowReduction.Half, D20SavingThrowFlag.SPELL_DESCRIPTOR_FIRE, dmg.Dice, dmg.Type, D20AttackPower.NORMAL);
                            }
                        }
                    }
                }
            }
        }

        // print "newsid = 0"
        // game.new_sid = 0
        Logger.Info("Trap script ID changed to 0");
        trap.Object.RemoveScript(ObjScriptEvent.Trap); // fixes re-arming when doing disable device
        return(SkipDefault);
    }
    public override bool OnTrap(TrapSprungEvent trap, GameObject triggerer)
    {
        if ((trap.Type.Id == 2))
        {
            // numP = 210 / (game.party_npc_size() + game.party_pc_size())
            // for obj in game.obj_list_vicinity( triggerer.location, OLC_CRITTERS ):
            // obj.stat_base_set(stat_experience, (obj.stat_level_get(stat_experience) - numP))
            AttachParticles(trap.Type.ParticleSystemId, trap.Object);
            Sound(4023, 1);
            var result = trap.Attack(triggerer, 10, 20, false);
            if (((result & D20CAF.HIT)) != D20CAF.NONE)
            {
                if ((!triggerer.SavingThrow(15, SavingThrowType.Fortitude, D20SavingThrowFlag.POISON, trap.Object)))
                {
                    triggerer.AddCondition("Poisoned", trap.Type.Damage[0].Dice.Modifier, 0);
                }

                var d = trap.Type.Damage[1].Dice.Copy();
                if (((result & D20CAF.CRITICAL)) != D20CAF.NONE)
                {
                    d = d.WithCount(d.Count * 2);
                    d = d.WithModifier(d.Modifier * 2);
                }

                triggerer.Damage(trap.Object, trap.Type.Damage[1].Type, d);
            }

            foreach (var obj in ObjList.ListVicinity(triggerer.GetLocation(), ObjectListFilter.OLC_CRITTERS))
            {
                if ((obj.DistanceTo(trap.Object) <= 15))
                {
                    if ((obj.HasLineOfSight(trap.Object)))
                    {
                        if ((!obj.SavingThrow(15, SavingThrowType.Fortitude, D20SavingThrowFlag.POISON, trap.Object)))
                        {
                            obj.AddCondition("Poisoned", trap.Type.Damage[2].Dice.Modifier, 0);
                        }
                    }
                }
            }

            DetachScript();
        }

        if ((trap.Type.Id == 3))
        {
            // numP = 210 / (game.party_npc_size() + game.party_pc_size())
            // for obj in game.obj_list_vicinity( triggerer.location, OLC_CRITTERS ):
            // obj.stat_base_set(stat_experience, (obj.stat_level_get(stat_experience) - numP))
            AttachParticles(trap.Type.ParticleSystemId, trap.Object);
            Sound(4023, 1);
            var result = trap.Attack(triggerer, 8, 20, false);
            if (((result & D20CAF.HIT)) != D20CAF.NONE)
            {
                if ((!triggerer.SavingThrow(13, SavingThrowType.Fortitude, D20SavingThrowFlag.POISON, trap.Object)))
                {
                    triggerer.AddCondition("Poisoned", trap.Type.Damage[0].Dice.Modifier, 0);
                }

                var d = trap.Type.Damage[1].Dice.Copy();
                if (((result & D20CAF.CRITICAL)) != D20CAF.NONE)
                {
                    d = d.WithCount(d.Count * 2);
                    d = d.WithModifier(d.Modifier * 2);
                }

                triggerer.Damage(trap.Object, trap.Type.Damage[1].Type, d);
            }

            DetachScript();
        }

        if ((trap.Type.Id == 4))
        {
            // numP = 210 / (game.party_npc_size() + game.party_pc_size())
            // for obj in game.obj_list_vicinity( triggerer.location, OLC_CRITTERS ):
            // obj.stat_base_set(stat_experience, (obj.stat_level_get(stat_experience) - numP))
            AttachParticles(trap.Type.ParticleSystemId, trap.Object);
            Sound(4023, 1);
            var result = trap.Attack(triggerer, 11, 20, false);
            if (((result & D20CAF.HIT)) != D20CAF.NONE)
            {
                if ((!triggerer.SavingThrow(16, SavingThrowType.Fortitude, D20SavingThrowFlag.POISON, trap.Object)))
                {
                    triggerer.AddCondition("Poisoned", trap.Type.Damage[0].Dice.Modifier, 0);
                }

                var d = trap.Type.Damage[1].Dice.Copy();
                if (((result & D20CAF.CRITICAL)) != D20CAF.NONE)
                {
                    d = d.WithCount(d.Count * 2);
                    d = d.WithModifier(d.Modifier * 2);
                }

                triggerer.Damage(trap.Object, trap.Type.Damage[1].Type, d);
            }

            foreach (var obj in ObjList.ListVicinity(triggerer.GetLocation(), ObjectListFilter.OLC_CRITTERS))
            {
                if ((obj.DistanceTo(trap.Object) <= 15))
                {
                    if ((obj.HasLineOfSight(trap.Object)))
                    {
                        obj.ReflexSaveAndDamage(trap.Object, 20, D20SavingThrowReduction.Half, D20SavingThrowFlag.SPELL_DESCRIPTOR_ACID, trap.Type.Damage[2].Dice, trap.Type.Damage[2].Type, D20AttackPower.NORMAL);
                    }
                }
            }

            DetachScript();
        }

        if ((trap.Type.Id == 7))
        {
            // numP = 210 / (game.party_npc_size() + game.party_pc_size())
            // for obj in game.obj_list_vicinity( triggerer.location, OLC_CRITTERS ):
            // obj.stat_base_set(stat_experience, (obj.stat_level_get(stat_experience) - numP))
            AttachParticles(trap.Type.ParticleSystemId, trap.Object);
            Sound(4023, 1);
            var result = trap.Attack(triggerer, 13, 20, false);
            if (((result & D20CAF.HIT)) != D20CAF.NONE)
            {
                if ((!triggerer.SavingThrow(18, SavingThrowType.Fortitude, D20SavingThrowFlag.POISON, trap.Object)))
                {
                    triggerer.AddCondition("Poisoned", trap.Type.Damage[0].Dice.Modifier, 0);
                }

                var d = trap.Type.Damage[1].Dice.Copy();
                if (((result & D20CAF.CRITICAL)) != D20CAF.NONE)
                {
                    d = d.WithCount(d.Count * 2);
                    d = d.WithModifier(d.Modifier * 2);
                }

                triggerer.Damage(trap.Object, trap.Type.Damage[1].Type, d);
            }

            foreach (var obj in ObjList.ListVicinity(triggerer.GetLocation(), ObjectListFilter.OLC_CRITTERS))
            {
                if ((obj.DistanceTo(trap.Object) <= 10))
                {
                    if ((obj.HasLineOfSight(trap.Object)))
                    {
                        if ((!obj.SavingThrow(18, SavingThrowType.Fortitude, D20SavingThrowFlag.POISON, trap.Object)))
                        {
                            obj.AddCondition("Poisoned", trap.Type.Damage[2].Dice.Modifier, 0);
                        }
                    }
                }
            }

            DetachScript();
        }

        // code to retain TRAP!!!
        if ((trap.Type.Id == 11 && triggerer.GetMap() == 5080))
        {
            // numP = 210 / (game.party_npc_size() + game.party_pc_size())
            // for obj in game.obj_list_vicinity( triggerer.location, OLC_CRITTERS ):
            // obj.stat_base_set(stat_experience, (obj.stat_level_get(stat_experience) - numP))
            LocAndOffsets loct = LocAndOffsets.Zero;
            foreach (var chest in ObjList.ListVicinity(triggerer.GetLocation(), ObjectListFilter.OLC_CONTAINER))
            {
                if ((chest.GetNameId() == 1055 && chest.DistanceTo(trap.Object) <= 5))
                {
                    var loc1 = new locXY(484, 566);
                    var loc2 = new locXY(476, 582);
                    var loc  = chest.GetLocation();
                    loct = trap.Object.GetLocationFull();
                    if ((loc1 >= loc))
                    {
                        chest.Destroy();
                        var item = GameSystems.MapObject.CreateObject(1055, new locXY(484, 566));
                    }

                    if ((loc2 >= loc && loc1 <= loc))
                    {
                        chest.Destroy();
                        var item = GameSystems.MapObject.CreateObject(1055, new locXY(476, 582));
                    }
                }
            }

            if (loct != LocAndOffsets.Zero)
            {
                var npc = GameSystems.MapObject.CreateObject(14605, loct);
                triggerer.BeginDialog(npc, 1000);
            }
        }

        return(SkipDefault);
    }