private static ObjectsPattern[] GetPatterns(IImagesStorage storage)
        {
            var patternsList = new List <ObjectsPattern>
            {
                // Table with 2 chairs
                CreateTableWithChairs(),
                // Single Shelf
                CreateShelfDown(),
                CreateShelfUp(),
                CreateShelfLeft(),
                CreateShelfRight(),
                // Crate
                CreateCrate(),
                // Chest
                CreateChest(),
                CreateGoldenChest(),
                // Water
                CreateWaterPool(),
                // Spiked Floor
                CreateSpikedFloor(),
                // Stone
                CreateStone()
            };

            return(patternsList.ToArray());
        }
Example #2
0
        public SymbolsImage GetWorldImage(IImagesStorage storage)
        {
            var templateImage = storage.GetImage("ItemsOnGround_Potion");
            var palette       = GetPotionPalette();

            return(SymbolsImage.Recolor(templateImage, palette));
        }
Example #3
0
        public override SymbolsImage GetEffectImage(int width, int height, IImagesStorage imagesStorage)
        {
            var color      = TextHelper.GetElementColor(element);
            var damageText = value.ToString();

            var xShift = (int)Math.Floor((width - damageText.Length) / 2d);

            if (damageText.Length > width)
            {
                damageText = "XXX";
            }

            var yShift          = (int)Math.Floor(height / 2d);
            var damageTextImage = new SymbolsImage(width, height);

            for (int shift = 0; shift < damageText.Length; shift++)
            {
                var x = xShift + shift;
                if (x >= damageTextImage.Width)
                {
                    break;
                }

                damageTextImage.SetPixel(x, yShift, damageText[shift], color);
            }

            return(damageTextImage);
        }
Example #4
0
        public ItemsGenerator(IItemGeneratorConfiguration configuration, IImagesStorage imagesStorage, IAncientSpellsProvider spellsProvider)
        {
            var bonusesGenerator = new BonusesGenerator(configuration.BonusesConfiguration);

            weaponGenerators = new Dictionary <WeaponType, IWeaponGenerator>
            {
                {
                    WeaponType.Sword,
                    new WeaponGenerator("Sword",
                                        WorldImageNameSword,
                                        configuration.WeaponsConfiguration.SwordsConfiguration,
                                        configuration.WeaponsConfiguration,
                                        bonusesGenerator,
                                        imagesStorage)
                },
                {
                    WeaponType.Dagger,
                    new WeaponGenerator("Dagger",
                                        WorldImageNameDagger,
                                        configuration.WeaponsConfiguration.DaggersConfiguration,
                                        configuration.WeaponsConfiguration,
                                        bonusesGenerator,
                                        imagesStorage)
                },
                {
                    WeaponType.Mace,
                    new WeaponGenerator("Mace",
                                        WorldImageNameMace,
                                        configuration.WeaponsConfiguration.MacesConfiguration,
                                        configuration.WeaponsConfiguration,
                                        bonusesGenerator,
                                        imagesStorage)
                },
                {
                    WeaponType.Axe,
                    new WeaponGenerator("Axe",
                                        WorldImageNameAxe,
                                        configuration.WeaponsConfiguration.AxesConfiguration,
                                        configuration.WeaponsConfiguration,
                                        bonusesGenerator,
                                        imagesStorage)
                },
                {
                    WeaponType.Staff,
                    new WeaponGenerator("Staff",
                                        WorldImageNameStaff,
                                        configuration.WeaponsConfiguration.StaffsConfiguration,
                                        configuration.WeaponsConfiguration,
                                        bonusesGenerator,
                                        imagesStorage)
                }
            };
            armorGenerator         = new ArmorGenerator(configuration.ArmorConfiguration, bonusesGenerator, imagesStorage);
            shieldGenerator        = new ShieldGenerator(configuration.ShieldsConfiguration, bonusesGenerator, imagesStorage);
            spellBookGenerator     = new SpellBookGenerator(configuration.SpellBooksConfiguration, bonusesGenerator, imagesStorage);
            usableItemsGenerator   = new UsableItemsGenerator(imagesStorage, spellsProvider);
            resourceItemsGenerator = new ResourceItemsGenerator();
            foodItemsGenerator     = new FoodItemsGenerator(imagesStorage);
        }
Example #5
0
 public UsableItemsGenerator(IImagesStorage imagesStorage, IAncientSpellsProvider spellsProvider)
 {
     generators = new Dictionary <UsableItemType, IUsableItemTypeGenerator>
     {
         { UsableItemType.Potion, new PotionsGenerator() },
         { UsableItemType.Scroll, new ScrollsGenerator(spellsProvider) }
     };
 }
Example #6
0
        public SymbolsImage GetWorldImage(IImagesStorage storage)
        {
            var body = storage.GetImage(configuration.Image);
            var directionImageName = GetWorldImageName();
            var directionImage     = storage.GetImage(directionImageName);

            return(SymbolsImage.Combine(body, directionImage));
        }
Example #7
0
        public SymbolsImage GetInventoryImage(IImagesStorage storage)
        {
            var imageTemplateName = GetInventoryImageTemplateName();
            var templateImage     = storage.GetImage(imageTemplateName);
            var palette           = GetPotionPalette();

            return(SymbolsImage.Recolor(templateImage, palette));
        }
Example #8
0
        public SymbolsImage GetImage(IImagesStorage storage, string animationName)
        {
            if (!managers.ContainsKey(animationName))
            {
                managers.Add(animationName,
                             new AnimationManager(storage.GetAnimation(animationName), changeInterval, frameStrategy));
            }

            return(managers[animationName].GetCurrentFrame());
        }
Example #9
0
 public SymbolsImage GetWorldImage(IImagesStorage storage)
 {
     if (energyLeft >= HighEnergy)
     {
         return(storage.GetImage(ImageHighEnergy));
     }
     if (energyLeft >= MediumEnergy)
     {
         return(storage.GetImage(ImageMediumEnergy));
     }
     return(storage.GetImage(ImageLowEnergy));
 }
Example #10
0
 public SymbolsImage GetWorldImage(IImagesStorage storage)
 {
     if (Mana >= HighManaLevel)
     {
         return(animations.GetImage(storage, ImageHighMana));
     }
     if (Mana >= MediumManaLevel)
     {
         return(animations.GetImage(storage, ImageMediumMana));
     }
     return(animations.GetImage(storage, ImageLowMana));
 }
Example #11
0
        private DungeonMapGenerator(IImagesStorage imagesStorage, bool writeMapFile = false)
        {
            this.writeMapFile = writeMapFile;

            generators = new Dictionary <MapType, IMapAreaGenerator>
            {
                { MapType.Dungeon, new DungeonRoomsMapGenerator(
                      new DungeonMapObjectsFactory(),
                      new ObjectsGenerators.DungeonObjectsGenerator(imagesStorage),
                      new DungeonMonstersGenerator()) },
                { MapType.Labyrinth, new LabyrinthMapGenerator(new DungeonMapObjectsFactory()) },
                { MapType.Cave, new CaveDungeonMapGenerator(new CaveMapObjectsFactory()) }
            };
        }
Example #12
0
 public WeaponGenerator(
     string baseName,
     string worldImageName,
     IWeaponConfiguration configuration,
     IWeaponsConfiguration configurations,
     BonusesGenerator bonusesGenerator,
     IImagesStorage imagesStorage)
 {
     this.configurations   = configurations;
     this.imagesStorage    = imagesStorage;
     this.bonusesGenerator = bonusesGenerator;
     this.baseName         = baseName;
     this.worldImageName   = worldImageName;
     this.configuration    = configuration;
 }
Example #13
0
        public SymbolsImage GetWorldImage(IImagesStorage storage)
        {
            if (Volume >= Configuration.MaxVolumeBeforeSpread)
            {
                return(storage.GetImage(ImageBig));
            }

            var halfSpread = Configuration.MaxVolumeBeforeSpread / 2;

            if (Volume >= halfSpread)
            {
                return(storage.GetImage(ImageMedium));
            }

            return(storage.GetImage(ImageSmall));
        }
Example #14
0
 private static IItem CreateMeat(IImagesStorage storage)
 {
     return(new FoodItem(new FoodItemConfiguration
     {
         Key = "food_meat",
         Name = "Meat",
         HungerDecrease = 7,
         Rareness = ItemRareness.Common,
         Weight = 500,
         InventoryImage = storage.GetImage("Food_Meat"),
         WorldImage = storage.GetImage("ItemsOnGround_Food_Meat"),
         Description = new[]
         {
             "A big piece of meat. It smells good."
         }
     }));
 }
Example #15
0
 private static IItem CreateApple(IImagesStorage storage)
 {
     return(new FoodItem(new FoodItemConfiguration
     {
         Key = "food_apple",
         Name = "Apple",
         HungerDecrease = 3,
         Rareness = ItemRareness.Common,
         Weight = 200,
         InventoryImage = storage.GetImage("Food_Apple"),
         WorldImage = storage.GetImage("ItemsOnGround_Food_Apple"),
         Description = new []
         {
             "A sweet red apple. Juicy and tasty."
         }
     }));
 }
Example #16
0
        public SymbolsImage GetEquippedImage(Player player, IImagesStorage imagesStorage)
        {
            if (Equals(player.Equipment.RightHandItem))
            {
                return(GetRightEquippedImage(imagesStorage));
            }
            if (Equals(player.Equipment.LeftHandItem))
            {
                return(GetLeftEquippedImage(imagesStorage));
            }

            Log.Warning($"Trying to render item \"{Name}\" that not equipped on both left and right hand.");
#if DEBUG
            throw new ApplicationException($"Trying to render item \"{Name}\" that not equipped on both left and right hand.");
#else
            return(null);
#endif
        }
Example #17
0
        public SymbolsImage GetWorldImage(IImagesStorage storage)
        {
            if (Closed)
            {
                if (HasConnectedTile(0, -1) && HasConnectedTile(0, 1))
                {
                    return(storage.GetImage(ImageClosedVertical));
                }

                return(storage.GetImage(ImageClosedHorizontal));
            }

            if (HasConnectedTile(0, -1) && HasConnectedTile(0, 1))
            {
                return(storage.GetImage(ImageOpenedVertical));
            }

            return(storage.GetImage(ImageOpenedHorizontal));
        }
Example #18
0
        public SymbolsImage GetWorldImage(IImagesStorage storage)
        {
            if (!HasConnectedTile(0, 1) && !HasConnectedTile(1, 0))
            {
                return(animationsManager.GetImage(storage, ImageBottomRight));
            }

            if (!HasConnectedTile(0, 1))
            {
                return(animationsManager.GetImage(storage, ImageBottom));
            }

            if (!HasConnectedTile(1, 0))
            {
                return(animationsManager.GetImage(storage, ImageRight));
            }

            if (!HasConnectedTile(1, 1))
            {
                return(storage.GetImage(ImageCorner));
            }

            return(storage.GetImage(ImageNormal));
        }
Example #19
0
 public virtual SymbolsImage GetWorldImage(IImagesStorage storage)
 {
     return(worldImage);
 }
Example #20
0
 public SymbolsImage GetWorldImage(IImagesStorage storage)
 {
     return(storage.GetImage(ImageName));
 }
Example #21
0
 public InventoryImagesFactory(IImagesStorage imagesStorage)
 {
     this.imagesStorage = imagesStorage;
 }
Example #22
0
 public SymbolsImage GetWorldImage(IImagesStorage storage)
 {
     return animationsManager.GetImage(storage, AnimationName);
 }
Example #23
0
 protected virtual SymbolsImage GetLeftEquippedImage(IImagesStorage storage)
 {
     return(equippedImageLeft);
 }
Example #24
0
 protected virtual SymbolsImage GetRightEquippedImage(IImagesStorage storage)
 {
     return(equippedImageRight);
 }
Example #25
0
 public virtual SymbolsImage GetInventoryImage(IImagesStorage storage)
 {
     return(inventoryImage);
 }
Example #26
0
 public SymbolsImage GetInventoryImage(IImagesStorage storage)
 {
     return(storage.GetImage(InventoryImageName));
 }
Example #27
0
        public SymbolsImage GetWorldImage(IImagesStorage storage)
        {
            var imageName = GetWorldImageName();

            return(storage.GetImage(imageName));
        }
Example #28
0
 public SymbolsImage GetWorldImage(IImagesStorage storage)
 {
     return(storage.GetImage("Decoratives_Stones_Small"));
 }
Example #29
0
 public SymbolsImage GetInventoryImage(IImagesStorage storage)
 {
     return(storage.GetImage("Item_Resource_Stone"));
 }
Example #30
0
 public static void Initialize(IImagesStorage imagesStorage, bool writeMapFile)
 {
     Current = new DungeonMapGenerator(imagesStorage, writeMapFile);
 }