示例#1
0
        public virtual void MobPress(Mob mob)
        {
            int cell = mob.pos;

            if (pit[cell] && !mob.Flying)
            {
                Chasm.MobFall(mob);
                return;
            }

            bool trap = true;

            switch (map[cell])
            {
            case Terrain.TOXIC_TRAP:
                ToxicTrap.Trigger(cell, mob);
                break;

            case Terrain.FIRE_TRAP:
                FireTrap.Trigger(cell, mob);
                break;

            case Terrain.PARALYTIC_TRAP:
                ParalyticTrap.Trigger(cell, mob);
                break;

            case Terrain.POISON_TRAP:
                PoisonTrap.Trigger(cell, mob);
                break;

            case Terrain.ALARM_TRAP:
                AlarmTrap.Trigger(cell, mob);
                break;

            case Terrain.LIGHTNING_TRAP:
                LightningTrap.Trigger(cell, mob);
                break;

            case Terrain.GRIPPING_TRAP:
                GrippingTrap.Trigger(cell, mob);
                break;

            case Terrain.SUMMONING_TRAP:
                SummoningTrap.Trigger(cell, mob);
                break;

            case Terrain.DOOR:
                Door.Enter(cell);

                goto default;

            default:
                trap = false;
                break;
            }

            if (trap)
            {
                if (Dungeon.Visible[cell])
                {
                    Sample.Instance.Play(Assets.SND_TRAP);
                }

                Set(cell, Terrain.INACTIVE_TRAP);
                GameScene.UpdateMap(cell);
            }

            var plant = plants[cell];

            if (plant != null)
            {
                plant.Activate(mob);
            }
        }
示例#2
0
        public virtual void Press(int cell, actors.Character ch)
        {
            if (pit[cell] && ch == Dungeon.Hero)
            {
                Chasm.HeroFall(cell);
                return;
            }

            var trap = false;

            switch (map[cell])
            {
            case Terrain.SECRET_TOXIC_TRAP:
                GLog.Information(TXT_HIDDEN_PLATE_CLICKS);
                goto case Terrain.TOXIC_TRAP;

            case Terrain.TOXIC_TRAP:
                trap = true;
                ToxicTrap.Trigger(cell, ch);
                break;

            case Terrain.SECRET_FIRE_TRAP:
                GLog.Information(TXT_HIDDEN_PLATE_CLICKS);
                goto case Terrain.FIRE_TRAP;

            case Terrain.FIRE_TRAP:
                trap = true;
                FireTrap.Trigger(cell, ch);
                break;

            case Terrain.SECRET_PARALYTIC_TRAP:
                GLog.Information(TXT_HIDDEN_PLATE_CLICKS);
                goto case Terrain.PARALYTIC_TRAP;

            case Terrain.PARALYTIC_TRAP:
                trap = true;
                ParalyticTrap.Trigger(cell, ch);
                break;

            case Terrain.SECRET_POISON_TRAP:
                GLog.Information(TXT_HIDDEN_PLATE_CLICKS);
                goto case Terrain.POISON_TRAP;

            case Terrain.POISON_TRAP:
                trap = true;
                PoisonTrap.Trigger(cell, ch);
                break;

            case Terrain.SECRET_ALARM_TRAP:
                GLog.Information(TXT_HIDDEN_PLATE_CLICKS);
                goto case Terrain.ALARM_TRAP;

            case Terrain.ALARM_TRAP:
                trap = true;
                AlarmTrap.Trigger(cell, ch);
                break;

            case Terrain.SECRET_LIGHTNING_TRAP:
                GLog.Information(TXT_HIDDEN_PLATE_CLICKS);
                goto case Terrain.LIGHTNING_TRAP;

            case Terrain.LIGHTNING_TRAP:
                trap = true;
                LightningTrap.Trigger(cell, ch);
                break;

            case Terrain.SECRET_GRIPPING_TRAP:
                GLog.Information(TXT_HIDDEN_PLATE_CLICKS);
                goto case Terrain.GRIPPING_TRAP;

            case Terrain.GRIPPING_TRAP:
                trap = true;
                GrippingTrap.Trigger(cell, ch);
                break;

            case Terrain.SECRET_SUMMONING_TRAP:
                GLog.Information(TXT_HIDDEN_PLATE_CLICKS);
                goto case Terrain.SUMMONING_TRAP;

            case Terrain.SUMMONING_TRAP:
                trap = true;
                SummoningTrap.Trigger(cell, ch);
                break;

            case Terrain.HIGH_GRASS:
                HighGrass.Trample(this, cell, ch);
                break;

            case Terrain.WELL:
                WellWater.AffectCell(cell);
                break;

            case Terrain.ALCHEMY:
                if (ch == null)
                {
                    Alchemy.Transmute(cell);
                }
                break;

            case Terrain.DOOR:
                Door.Enter(cell);
                break;
            }

            if (trap)
            {
                Sample.Instance.Play(Assets.SND_TRAP);

                if (ch == Dungeon.Hero)
                {
                    Dungeon.Hero.Interrupt();
                }

                Set(cell, Terrain.INACTIVE_TRAP);
                GameScene.UpdateMap(cell);
            }

            var plant = plants[cell];

            if (plant != null)
            {
                plant.Activate(ch);
            }
        }