public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList <ActuatorItemData> matchedSequence)
        {
            IConstrain constrain  = null;
            Tile       targetTile = null;
            Texture2D  decoration = null;

            context.PrepareActuatorData(matchedSequence[0], out targetTile, out constrain, out decoration, putOnWall: false);

            if (matchedSequence[0].Data == 0)
            {
                constrain = new PartyConstrain();
            }
            else
            {
                constrain = new PartDirectionConstrain((MapDirection)(matchedSequence[0].Data - 1));
            }

            var res = new FloorActuator(context.GetFloorPosition(matchedSequence[0].TilePosition, currentTile), currentTile, constrain, targetTile.ToEnumerable(),
                                        matchedSequence[0].GetActionStateX().ToEnumerable());

            res.Graphics = new CubeGraphic
            {
                Position  = res.Position,
                DrawFaces = CubeFaces.All,
                Outter    = true,
                Scale     = new Vector3(0.2f),
                Texture   = decoration
            };
            return(res);
        }
Ejemplo n.º 2
0
 public LegacyTileCreator(LegacyMapBuilder builder, ISidesCreator sidesCreator, ILogicActuatorCreator logicActuatorCreator, ICreatureCreator creatureCreator)
 {
     this.builder              = builder;
     this.sidesCreator         = sidesCreator;
     this.logicActuatorCreator = logicActuatorCreator;
     this.creatureCreator      = creatureCreator;
 }
Ejemplo n.º 3
0
        public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList<ActuatorItemData> matchedSequence)
        {



            IConstrain constrain = null;
            Tile targetTile = null;
            Texture2D decoration = null;
            context.PrepareActuatorData(matchedSequence[0], out targetTile, out constrain, out decoration, putOnWall: false);

            var res = new FloorActuator(context.GetFloorPosition(matchedSequence[0].TilePosition, currentTile), currentTile,
                new OrConstrain(new IConstrain[] { new PartyConstrain(), new TypeConstrain(typeof(Creature)), new TypeConstrain(typeof(GrabableItem)) }),
                targetTile.ToEnumerable(), matchedSequence[0].GetActionStateX().ToEnumerable());

            //TODO 14 28 actuator sends Clear message to pit(which open the pit => should be close) 
            res.Graphics = new CubeGraphic
            {
                Position = res.Position,
                DrawFaces = CubeFaces.All,
                Outter = true,
                Scale = new Vector3(0.2f),
                Texture = decoration
            };
            return res;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            ResourceProvider.Instance.Initialize(GraphicsDevice, Content);

            var dungeonParser = new DungeonParser();

            dungeonParser.Parse();

            var renderers = new DefaulRenderers(Content, GraphicsDevice);
            var factoreis = new LegacyFactories(dungeonParser.Data, renderers);
            var theron    = new LegacyLeader(factoreis);

            var initializer = new LegacyMapBuilderInitializer();
            var builder     = new LegacyMapBuilder(initializer);

            initializer.Data        = dungeonParser.Data;
            initializer.ItemCreator = new LegacyItemCreator(builder);

            var wallActuatorCreator  = new WallActuatorCreator(builder);
            var floorActuatorCreator = new FloorActuatorCreator(builder);
            var sidesCreator         = new SidesCreator(builder, wallActuatorCreator, floorActuatorCreator);
            var logicActuatorCreator = new LogicActuatorCreator(builder);
            var creatureCreator      = new CreatureCreator(builder);

            initializer.TileCreator = new LegacyTileCreator(builder, sidesCreator, logicActuatorCreator, creatureCreator);
            initializer.Initialize();

            dungeon = new Dungeon(builder, factoreis, theron, GraphicsDevice);

            GameConsole.InitializeConsole(this, dungeon);
            GameConsole.Instance.DrawOrder = 1;
        }
        public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList <ActuatorItemData> matchedSequence)
        {
            IConstrain constrain = null;

            if (matchedSequence[0].Data == 0)
            {
                constrain = new PartyConstrain();
            }
            else
            {
                constrain = new PartDirectionConstrain((MapDirection)(matchedSequence[0].Data - 1));
            }

            var res = new FloorActuator(context.GetFloorPosition(matchedSequence[0].TilePosition, currentTile), currentTile, constrain,
                                        matchedSequence.Select(context.GetTargetTile), matchedSequence.Select(x => x.GetActionStateX()));

            res.Graphics = new CubeGraphic
            {
                Position  = res.Position,
                DrawFaces = CubeFaces.All,
                Outter    = true,
                Scale     = new Vector3(0.2f),
                Texture   = context.GetTexture(matchedSequence.First(), putOnWall: false)
            };
            return(res);
        }
Ejemplo n.º 6
0
 public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList<ActuatorItemData> matchedSequence)
 {
     var items = context.WallActuatorCreator.CurrentGrabableItems.Select(x => context.ItemCreator.CreateItem(x, currentTile));
     return new AlcoveActuator(context.GetWallPosition(matchedSequence[0].TilePosition, context.WallActuatorCreator.CurrentTile), items)
     {
         AlcoveTexture = context.WallTextures[matchedSequence[0].Decoration - 1]
     };
 }
Ejemplo n.º 7
0
 public ChampionCreator(LegacyMapBuilder builder)
 {
     this.builder = builder;
     if (builder != null)
     {
         BonesFactory = (ChampionBonesFactory)builder.GetItemFactory(198);// 198 is identifier of bones => http://dmweb.free.fr/?q=node/886
     }
 }
Ejemplo n.º 8
0
        public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList <ActuatorItemData> matchedSequence)
        {
            var items = context.WallActuatorCreator.CurrentGrabableItems.Select(x => context.ItemCreator.CreateItem(x, currentTile));

            return(new AlcoveActuator(context.GetWallPosition(matchedSequence[0].TilePosition, context.WallActuatorCreator.CurrentTile), items)
            {
                AlcoveTexture = context.WallTextures[matchedSequence[0].Decoration - 1]
            });
        }
Ejemplo n.º 9
0
 public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList <ActuatorItemData> matchedSequence)
 {
     return(new Button(
                context.GetWallPosition(matchedSequence[0].TilePosition, currentTile),
                context.GetTargetTile(matchedSequence[0]),
                matchedSequence[0].GetActionStateX())
     {
         Texture = context.WallTextures[matchedSequence[0].Decoration - 1],
     });
 }
Ejemplo n.º 10
0
 public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList<ActuatorItemData> matchedSequence)
 {
     return new Button(
         context.GetWallPosition(matchedSequence[0].TilePosition, currentTile),
         context.GetTargetTile(matchedSequence[0]),
         matchedSequence[0].GetActionStateX())
     {
         Texture = context.WallTextures[matchedSequence[0].Decoration - 1],
     };
 }
Ejemplo n.º 11
0
 public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList<ActuatorItemData> matchedSequence)
 {
     return new SwitchSequenceActuator(
         context.GetWallPosition(matchedSequence[0].TilePosition, context.WallActuatorCreator.CurrentTile),
         matchedSequence.Take(matchedSequence.Count - 1).Select(context.GetTargetTile),
         matchedSequence.Take(matchedSequence.Count - 1).Select(x => x.GetActionStateX()))
     {
         UpTexture = context.WallTextures[matchedSequence[0].Decoration - 1],
         DownTexture = context.WallTextures[matchedSequence[1].Decoration - 1]
     };
 }
Ejemplo n.º 12
0
        public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList<ActuatorItemData> matchedSequence)
        {
            IConstrain constrain = null;
            Tile targetTile = null;
            Texture2D decoration = null;
            context.PrepareActuatorData(matchedSequence[0], out targetTile, out constrain, out decoration, putOnWall: false);

            return new PartyPossesionActuator(context.GetFloorPosition(matchedSequence[0].TilePosition, currentTile), currentTile,
                constrain, targetTile.ToEnumerable(), matchedSequence[0].GetActionStateX().ToEnumerable());

        }
 public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList <ActuatorItemData> matchedSequence)
 {
     return(new SwitchSequenceActuator(
                context.GetWallPosition(matchedSequence[0].TilePosition, context.WallActuatorCreator.CurrentTile),
                matchedSequence.Take(matchedSequence.Count - 1).Select(context.GetTargetTile),
                matchedSequence.Take(matchedSequence.Count - 1).Select(x => x.GetActionStateX()))
     {
         UpTexture = context.WallTextures[matchedSequence[0].Decoration - 1],
         DownTexture = context.WallTextures[matchedSequence[1].Decoration - 1]
     });
 }
        public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList <ActuatorItemData> matchedSequence)
        {
            IConstrain constrain  = null;
            Tile       targetTile = null;
            Texture2D  decoration = null;

            context.PrepareActuatorData(matchedSequence[0], out targetTile, out constrain, out decoration, putOnWall: false);

            return(new PartyPossesionActuator(context.GetFloorPosition(matchedSequence[0].TilePosition, currentTile), currentTile,
                                              constrain, targetTile.ToEnumerable(), matchedSequence[0].GetActionStateX().ToEnumerable()));
        }
Ejemplo n.º 15
0
 public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList<ActuatorItemData> matchedSequence)
 {
     var data = matchedSequence[0];
     var constrain = new GrabableItemConstrain(context.GetItemFactory(data.Data), invertConstraion: false);
     var item = context.WallActuatorCreator.CurrentGrabableItems.Select(k => new LegacyItemCreator(context).CreateItem(k, currentTile)).SingleOrDefault();
     return new ExchangerActuator(context.GetWallPosition(data.TilePosition, context.WallActuatorCreator.CurrentTile), item, constrain, data.IsOnceOnly)
     {
         DecorationActivated = context.WallTextures[data.Decoration - 1],
         DecorationDeactived = context.WallTextures[matchedSequence[1].Decoration - 1]
     };
 }
 public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList<ActuatorItemData> matchedSequence)
 {
     Texture2D decoration;
     IConstrain constrain;
     Tile targetTile;
     context.PrepareActuatorData(matchedSequence[0], out targetTile, out constrain, out decoration, putOnWall: true);
     return new KeyHoleActuator(context.GetWallPosition(matchedSequence[0].TilePosition, context.WallActuatorCreator.CurrentTile),
         Enumerable.Repeat(targetTile,1), Enumerable.Repeat(matchedSequence[0].GetActionStateX(),1), constrain, destroyItem: true)
     {
         DecorationTexture = decoration
     };
 }
Ejemplo n.º 17
0
        public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList <ActuatorItemData> matchedSequence)
        {
            var data      = matchedSequence[0];
            var constrain = new GrabableItemConstrain(context.GetItemFactory(data.Data), invertConstraion: false);
            var item      = context.WallActuatorCreator.CurrentGrabableItems.Select(k => new LegacyItemCreator(context).CreateItem(k, currentTile)).SingleOrDefault();

            return(new ExchangerActuator(context.GetWallPosition(data.TilePosition, context.WallActuatorCreator.CurrentTile), item, constrain, onceOnly: true)
            {
                DecorationActivated = context.WallTextures[data.Decoration - 1],
                DecorationDeactived = context.WallTextures[data.Decoration - 1],
            });
        }
Ejemplo n.º 18
0
 private string FindChampionDescriptor(LegacyMapBuilder context)
 {
     try
     {
         var descriptor = context.CurrentMap.GetTileData(context.WallActuatorCreator.CurrentTile.GridPosition).TextTags.Single(x => !x.Processed);
         descriptor.Processed = true;
         return(descriptor.Text);
     }
     catch (Exception e)
     {
         throw new InvalidOperationException("Unambigious champoin text descriptor", e);
     }
 }
        public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList <ActuatorItemData> matchedSequence)
        {
            Texture2D  decoration;
            IConstrain constrain;
            Tile       targetTile;

            context.PrepareActuatorData(matchedSequence[0], out targetTile, out constrain, out decoration, putOnWall: true);
            return(new KeyHoleActuator(context.GetWallPosition(matchedSequence[0].TilePosition, context.WallActuatorCreator.CurrentTile),
                                       Enumerable.Repeat(targetTile, 1), Enumerable.Repeat(matchedSequence[0].GetActionStateX(), 1), constrain, destroyItem: true)
            {
                DecorationTexture = decoration
            });
        }
Ejemplo n.º 20
0
 private string FindChampionDescriptor(LegacyMapBuilder context)
 {
     try
     {
         var descriptor = context.CurrentMap.GetTileData(context.WallActuatorCreator.CurrentTile.GridPosition).TextTags.Single(x => !x.Processed);
         descriptor.Processed = true;
         return descriptor.Text;
     }
     catch (Exception e)
     {
         throw new InvalidOperationException("Unambigious champoin text descriptor", e);
     }
 }
Ejemplo n.º 21
0
 public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList<ActuatorItemData> matchedSequence)
 {
     var leverDown = matchedSequence[1];
     return new LeverActuator(
         context.GetWallPosition(matchedSequence[0].TilePosition, context.WallActuatorCreator.CurrentTile),
         context.GetTargetTile(matchedSequence[0]),
         false,//TODO onceOnlyy flag ???
         matchedSequence[0].GetActionStateX())
     {
         UpTexture = context.WallTextures[matchedSequence[0].Decoration - 1],
         DownTexture = context.WallTextures[leverDown.Decoration - 1]
     };
 }
Ejemplo n.º 22
0
 private string FindChampionDescriptor(LegacyMapBuilder context, Point pos)
 {
     try
     {
         var descriptor = context.CurrentMap.GetTileData(pos).TextTags.Single(x => !x.Processed);
         descriptor.Processed = true;
         return(descriptor.Text);
     }
     catch (Exception e)
     {
         throw new InvalidOperationException("Unambiguous champion text descriptor.", e);
     }
 }
Ejemplo n.º 23
0
        public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList <ActuatorItemData> matchedSequence)
        {
            var leverDown = matchedSequence[1];

            return(new LeverActuator(
                       context.GetWallPosition(matchedSequence[0].TilePosition, context.WallActuatorCreator.CurrentTile),
                       context.GetTargetTile(matchedSequence[0]),
                       false,//TODO onceOnlyy flag ???
                       matchedSequence[0].GetActionStateX())
            {
                UpTexture = context.WallTextures[matchedSequence[0].Decoration - 1],
                DownTexture = context.WallTextures[leverDown.Decoration - 1]
            });
        }
Ejemplo n.º 24
0
        public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList<ActuatorItemData> matchedSequence)
        {
            descriptor = FindChampionDescriptor(context).Split('|');

            var champion = new Champion(context.ChampionToken, context.CreatureToken.ToEnumerable(), this)
            {
                Name = descriptor[0],
                Title = descriptor[1] + descriptor[2],
                IsMale = descriptor[3] == "M",
            };

            var items = context.WallActuatorCreator.CurrentGrabableItems.Select(k => context.ItemCreator.CreateItem(k, currentTile));

            var res = new ChampoinActuator(context.GetWallPosition(matchedSequence[0].TilePosition, context.WallActuatorCreator.CurrentTile), champion);
            ((CubeGraphic)res.Graphics).Texture = context.WallTextures[matchedSequence[0].Decoration - 1];

            return res;
        }
Ejemplo n.º 25
0
        public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList <ActuatorItemData> matchedSequence)
        {
            descriptor = FindChampionDescriptor(context).Split('|');

            var champion = new Champion(context.ChampionToken, context.CreatureToken.ToEnumerable(), this)
            {
                Name   = descriptor[0],
                Title  = descriptor[1] + descriptor[2],
                IsMale = descriptor[3] == "M",
            };

            var items = context.WallActuatorCreator.CurrentGrabableItems.Select(k => context.ItemCreator.CreateItem(k, currentTile));

            var res = new ChampoinActuator(context.GetWallPosition(matchedSequence[0].TilePosition, context.WallActuatorCreator.CurrentTile), champion);

            ((CubeGraphic)res.Graphics).Texture = context.WallTextures[matchedSequence[0].Decoration - 1];

            return(res);
        }
        public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList<ActuatorItemData> matchedSequence)
        {

            IConstrain constrain = null;
            if (matchedSequence[0].Data == 0)
                constrain = new PartyConstrain();
            else
                constrain = new PartDirectionConstrain((MapDirection)(matchedSequence[0].Data - 1));

            var res = new FloorActuator(context.GetFloorPosition(matchedSequence[0].TilePosition, currentTile), currentTile, constrain,
                matchedSequence.Select(context.GetTargetTile), matchedSequence.Select(x => x.GetActionStateX()));

            res.Graphics = new CubeGraphic
            {
                Position = res.Position,
                DrawFaces = CubeFaces.All,
                Outter = true,
                Scale = new Vector3(0.2f),
                Texture = context.GetTexture(matchedSequence.First(), putOnWall:false) 
            };
            return res;
        }
Ejemplo n.º 27
0
        public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList <ActuatorItemData> matchedSequence)
        {
            IConstrain constrain  = null;
            Tile       targetTile = null;
            Texture2D  decoration = null;

            context.PrepareActuatorData(matchedSequence[0], out targetTile, out constrain, out decoration, putOnWall: false);

            var res = new FloorActuator(context.GetFloorPosition(matchedSequence[0].TilePosition, currentTile), currentTile,
                                        new OrConstrain(new IConstrain[] { new PartyConstrain(), new TypeConstrain(typeof(Creature)), new TypeConstrain(typeof(GrabableItem)) }),
                                        targetTile.ToEnumerable(), matchedSequence[0].GetActionStateX().ToEnumerable());

            //TODO 14 28 actuator sends Clear message to pit(which open the pit => should be close)
            res.Graphics = new CubeGraphic
            {
                Position  = res.Position,
                DrawFaces = CubeFaces.All,
                Outter    = true,
                Scale     = new Vector3(0.2f),
                Texture   = decoration
            };
            return(res);
        }
Ejemplo n.º 28
0
 public WallActuatorCreator(LegacyMapBuilder builder) : base(builder)
 {
 }
Ejemplo n.º 29
0
 public ActuatorCreatorBase(LegacyMapBuilder builder)
 {
     this.builder = builder;
 }
Ejemplo n.º 30
0
 public FloorActuatorCreator(LegacyMapBuilder builder) : base(builder)
 {
 }
Ejemplo n.º 31
0
 public LogicActuatorCreator(LegacyMapBuilder builder) : base(builder)
 {
 }
 public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList <ActuatorItemData> matchedSequence)
 {
     return(new DecorationItem(context.GetWallPosition(matchedSequence[0].TilePosition, context.WallActuatorCreator.CurrentTile), context.WallTextures[matchedSequence[0].Decoration - 1]));
 }
Ejemplo n.º 33
0
 public CreatureCreator(LegacyMapBuilder builder)
 {
     this.builder = builder;
 }
Ejemplo n.º 34
0
 public override Actuator CreateItem(LegacyMapBuilder context, Tile currentTile, IReadOnlyList<ActuatorItemData> matchedSequence)
 {
     return new DecorationItem(context.GetFloorPosition(matchedSequence[0].TilePosition, currentTile), context.FloorTextures[matchedSequence[0].Decoration - 1]);
 }
Ejemplo n.º 35
0
 public SidesCreator(LegacyMapBuilder builder, IWallActuatorCreator wallCreator, IFloorActuatorCreator floorCreator)
 {
     this.builder      = builder;
     this.wallCreator  = wallCreator;
     this.floorCreator = floorCreator;
 }
Ejemplo n.º 36
0
 public LegacyItemCreator(LegacyMapBuilder builder)
 {
     this.builder = builder;
 }