Ejemplo n.º 1
0
        private IAbilitiesController ConfigureAbilityController(
            Transform placeForUi,
            IAbilityActivator abilityActivator, ProfilePlayer profilePlayer)
        {
            var abilityItemsConfigCollection
                = ContentDataSourceLoader.LoadAbilityItemConfigs(new ResourcePath
            {
                PathResource = "DataSource/Ability/AbilityItemConfigDataSource"
            });
            var abilityRepository
                = new AbilityRepository(abilityItemsConfigCollection);
            var abilityCollectionViewPath
                = new ResourcePath {
                PathResource = $"Prefabs/{nameof(AbilityCollectionView)}"
                };
            var abilityCollectionView
                = ResourceLoader.LoadAndInstantiateObject <AbilityCollectionView>(abilityCollectionViewPath, placeForUi,
                                                                                  false);

            AddGameObjects(abilityCollectionView.gameObject);

            var abilitiesController = new AbilitiesController(abilityRepository, profilePlayer.InventoryModel,
                                                              abilityCollectionView, abilityActivator);

            AddController(abilitiesController);

            return(abilitiesController);
        }
Ejemplo n.º 2
0
 public UnitManager(WorldModel worldModel, CommandProcessor commandProcessor, IFactory <UnitData, AllianceType, UnitModel> unitFactory, AbilityRepository abilityRepository)
 {
     _worldModel        = worldModel;
     _unitFactory       = unitFactory;
     _abilityRepository = abilityRepository;
     _commandProcessor  = commandProcessor;
 }
Ejemplo n.º 3
0
 public Ability(string name) {
     _name = name;
     _repo = new Repository.AbilityRepository();
     _cost = _repo.GetCostByAbilityName(Name);
     _level = _repo.FindRarityByName(Name);
     _school = _repo.FindSchoolByName(Name);
     _type = _repo.FindTypeByName(Name);
     _effect = _repo.FindEffectByName(Name);
 }
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()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            GameModel = new GameModel(Content, _graphics, _spriteBatch);

            var testTexture = Content.Load <Texture2D>("Enemy");

            _units = new List <Unit>();

            var ar = new AbilityRepository();

            ar.Load();

            var ur = new UnitRepository();

            ur.Load(ar);

            var sr = new SquadRepository();

            sr.Load();

            var startPositions = new List <Point>()
            {
                new Point(1, 2),
                new Point(4, 2),
                new Point(0, 5),
                new Point(2, 3),
                new Point(3, 1),
            };

            var squad = sr.Squads.First();

            foreach (var unitId in squad.UnitIds)
            {
                var index = Random.Next(0, startPositions.Count);

                var startPoint = startPositions[index];
                startPositions.RemoveAt(index);

                var unitModel = ur.GetById(unitId);

                _units.Add(new Unit(testTexture)
                {
                    TilePosition = Map.PointToVector2(startPoint.X, startPoint.Y),
                    UnitModel    = unitModel,
                    Layer        = 0.6f,
                });
            }

            //_state = new BattleState(GameModel, _units);
            _state = new HomeState(GameModel);
            _state.LoadContent();
        }
 public AbilityMakerAbility(UnitModel unit, AbilityData data, WorldModel world, TickService tickservice,
                            CommandProcessor command, UnitRegistry unitRegistry, AbilityRepository abilityRepository)
 {
     _unit              = unit;
     _world             = world;
     _command           = command;
     _data              = new BuffAbilityParams(data);
     _tickService       = tickservice;
     _unitRegistry      = unitRegistry;
     _abilityRepository = abilityRepository;
 }
Ejemplo n.º 6
0
        public void AbilityRepositoryTest()
        {
            // Arrange
            var ability = new Ability(1);

            ability.AbilityName = "Strength";
            ability.Description = "How Strong You Are";
            // Act
            var ablRepository = new AbilityRepository();
            var abl           = ablRepository.Retrieve(1);

            // Assert
            Assert.AreEqual(ability.AbilityName, abl.AbilityName);
            Assert.AreEqual(ability.Description, abl.Description);
        }
        public CommanderAbility2(UnitModel unit, AbilityData data, WorldModel world, TickService tickservice, CommandProcessor command,
                                 IFactory <IBuff, BuffData, BuffTargetCommand> buffFactory, AbilityRepository abilityRepository,

                                 IFactory <StatChangeData, HPChangeCommand> HPChangeFactory)
        {
            _unit              = unit;
            _world             = world;
            _command           = command;
            _data              = new BuffAbilityParams(data);
            _tickService       = tickservice;
            _buffFactory       = buffFactory;
            _HPChangeFactory   = HPChangeFactory;
            _abilityRepository = abilityRepository;

            _castTime     = data.castTime;
            _cooldownTime = data.cooldownTime;
        }
Ejemplo n.º 8
0
        private IAbilitiesController ConfigureAbilityController(Transform placeForUi, IAbilityActivator abilityActivator, IReadOnlyList <IItem> items)
        {
            var abilityItemsConfigCollection = ContentDataSourceLoader.LoadAbilityItemConfigs(new ResourcePath {
                PathResource = "DataSource/Abilities/AbilityItemConfigDataSource"
            });
            var abilityRepository         = new AbilityRepository(abilityItemsConfigCollection);
            var abilityCollectionViewPath = new ResourcePath {
                PathResource = $"Prefabs/{nameof(AbilityCollectionView)}"
            };
            var abilityCollectionView = ResourceLoader.LoadAndInstantiateObject <AbilityCollectionView>(abilityCollectionViewPath, placeForUi, false);

            AddGameObjects(abilityCollectionView.gameObject);

            // загрузить в модель экипированные предметы можно любым способом
            var inventoryModel = new InventoryModel();

            inventoryModel.EquipItems(items);

            var abilitiesController = new AbilitiesController(abilityRepository, inventoryModel, abilityCollectionView, abilityActivator);

            AddController(abilitiesController);

            return(abilitiesController);
        }
Ejemplo n.º 9
0
        private BaseController ConfigureAbilityController(Transform placeForUi, IAbilityActivator abilityActivator)
        {
            var abilityItemsConfigCollection
                = ContentDataSourceLoader.LoadAbilityItemConfigs(new ResourcePath {
                PathResource = "DataSource/Ability/AbilityItemConfigDataSource"
            });

            var abilityRepository
                = new AbilityRepository(abilityItemsConfigCollection);

            var abilityCollectionViewPath
                = new ResourcePath {
                PathResource = $"Prefabs/{nameof(AbilityCollectionView)}"
                };
            var abilityCollectionView =
                ResourceLoader.LoadAndInstantiateObject <AbilityCollectionView>(abilityCollectionViewPath, placeForUi, false);

            AddGameObjects(abilityCollectionView.gameObject);

            var abilityItemsRepository
                = new ItemsRepository(abilityItemsConfigCollection.Select(value => value.ItemConfig).ToList());

            var inventoryModel = new InventoryModel();

            foreach (var item in abilityItemsRepository.Collection.Values)
            {
                inventoryModel.EquipItem(item);
            }

            var abilitiesController = new AbilitiesController(abilityRepository, inventoryModel, abilityCollectionView,
                                                              abilityActivator);

            AddController(abilitiesController);

            return(abilitiesController);
        }
Ejemplo n.º 10
0
 public FeatController(AbilityRepository repo)
 {
     Repo = repo;
 }
Ejemplo n.º 11
0
        private ILootTable GenerateLootTable()
        {
            var potionItemTemplate = ItemTemplateRepository.Retrieve(ItemTemplateLookups.MinorHealthPotion);
            var potionItem         = new DefaultItem
            {
                ItemTemplate  = potionItemTemplate,
                Modifications = new IModification[0],
                Variables     = new DefaultItemVariables()
            };

            var cleaveAbility   = AbilityRepository.Retrieve(AbilityLookups.Cleave);
            var cleaveLootEntry = new CustomLootTableEntry {
                Ability = cleaveAbility
            };

            cleaveLootEntry.Variables.DropRate(0.02f);

            var attackAbility   = AbilityRepository.Retrieve(AbilityLookups.Attack);
            var attackLootEntry = new CustomLootTableEntry {
                Ability = attackAbility
            };

            attackLootEntry.Variables.DropRate(0.04f);

            var healAbility   = AbilityRepository.Retrieve(AbilityLookups.Heal);
            var healLootEntry = new CustomLootTableEntry {
                Ability = healAbility
            };

            healLootEntry.Variables.DropRate(0.02f);

            var fireboltSpell     = SpellRepository.Retrieve(SpellLookups.Firebolt);
            var fireboltLootEntry = new CustomLootTableEntry {
                Spell = fireboltSpell
            };

            fireboltLootEntry.Variables.DropRate(0.03f);

            var regenSpell     = SpellRepository.Retrieve(SpellLookups.Firebolt);
            var regenLootEntry = new CustomLootTableEntry {
                Spell = regenSpell
            };

            regenLootEntry.Variables.DropRate(0.03f);

            var lootEntries = new List <ILootTableEntry>
            {
                potionItem.GenerateCustomLootTableEntry(0.10f),
                cleaveLootEntry,
                attackLootEntry,
                healLootEntry,
                fireboltLootEntry,
                regenLootEntry
            };

            var allCardEffects = CardEffectsRepository.FindAll(new GetAllQuery <CardEffects>());

            foreach (var cardEffect in allCardEffects)
            {
                var lootEntry = new CustomLootTableEntry {
                    CardEffects = cardEffect
                };
                lootEntry.Variables.DropRate(0.05f);
                lootEntries.Add(lootEntry);
            }

            return(new DefaultLootTable
            {
                AvailableLoot = lootEntries,
                Randomizer = Randomizer,
            });
        }
Ejemplo n.º 12
0
 public CharFeatsController(AbilityRepository repo)
 {
     Repo = repo;
 }
Ejemplo n.º 13
0
 public AbilitySeeder(AppHarborDB db)
 {
     _db = db;
     _abilityRepository = new AbilityRepository(db);
 }
Ejemplo n.º 14
0
 public CombatSkillRepository()
 {
     abilityRepository = new AbilityRepository();
 }
Ejemplo n.º 15
0
        private void PopulateToolsetViewModel()
        {
            ClearViewModelPopulation();

            using (GameModuleRepository repo = new GameModuleRepository())
            {
                ViewModel.ActiveModule = repo.GetModule();
            }

            using (ContentPackageResourceRepository repo = new ContentPackageResourceRepository())
            {
                ViewModel.TilesetSpriteSheetsList = repo.GetAllUIObjects(ContentPackageResourceTypeEnum.Tileset, false);
            }

            using (ItemRepository repo = new ItemRepository())
            {
                ViewModel.ItemList = repo.GetAllUIObjects();
            }

            using (ScriptRepository repo = new ScriptRepository())
            {
                ViewModel.ScriptList = repo.GetAllUIObjects();
            }

            using (GenderRepository repo = new GenderRepository())
            {
                ViewModel.GenderList = repo.GetAllUIObjects();
            }

            using (ConversationRepository repo = new ConversationRepository())
            {
                ViewModel.ConversationList = repo.GetAllUIObjects();
            }

            using (RaceRepository repo = new RaceRepository())
            {
                ViewModel.RaceList = repo.GetAllUIObjects();
            }

            using (FactionRepository repo = new FactionRepository())
            {
                ViewModel.FactionList = repo.GetAllUIObjects();
            }

            using (TilesetRepository repo = new TilesetRepository())
            {
                ViewModel.TilesetList = repo.GetAllUIObjects();
            }

            using (AbilityRepository repo = new AbilityRepository())
            {
                ViewModel.AbilityList = repo.GetAll();
            }

            using (SkillRepository repo = new SkillRepository())
            {
                ViewModel.SkillList = repo.GetAll();
            }

            using (LevelRequirementRepository repo = new LevelRequirementRepository())
            {
                ViewModel.LevelRequirementList = repo.GetAll();
            }
        }
Ejemplo n.º 16
0
 public AbilityController(AbilityRepository ap)
 {
     abilityRepository = ap;
 }