예제 #1
0
        public void SetTerrain()
        {
            var terrainNames = Assembly.GetExecutingAssembly().DefinedTypes
                               .Where(typeInfo => typeInfo.ImplementedInterfaces.Contains(typeof(ITerrain)) && typeInfo.IsAbstract == false)
                               .Select(terrainType => terrainType.Name.ToLower())
                               .ToList();

            int t = RandomProvider.Generate(0, terrainNames.Count - 1);

            this.Terrain = this.context.ResolveNamed <ITerrain>(terrainNames[t]);
        }
예제 #2
0
        public void SetActiveHero()
        {
            var res = RandomProvider.Generate(1, 2);

            if (res == 1)
            {
                this.ActiveHero = this.firstHero;
            }
            else
            {
                this.ActiveHero = this.secondHero;
            }
        }
예제 #3
0
 public override void Apply()
 {
     if (Caster.Opponent.HasRessistance)
     {
         this.damageDealt = 0;
     }
     else
     {
         var heroDmg = RandomProvider.Generate(this.Caster.DmgStartOfRange, base.Caster.DmgEndOfRange); // calculate hero dmg
         this.damageDealt = heroDmg + base.AbilityPower;                                                // adds ability power
     }
     base.Caster.Opponent.HealthPoints -= damageDealt;                                                  //deals dmg to hp
     base.Apply();                                                                                      //cd applied
 }
예제 #4
0
        public string ApplyContinuousEffect(IHero active)
        {
            int x = RandomProvider.Generate(1, 3);

            if (x == 1)
            {
                return(this.Terrain.ContinuousEffect(active));
            }
            else if (x == 2)
            {
                return(this.Terrain.ContinuousEffect(active.Opponent));
            }
            else
            {
                return("Terrain was merciful today");
            }
        }
예제 #5
0
        public void CreateSpellBook(IHero hero)
        {
            var spellPool   = PopulateSpellPool().Where(x => x.HeroClass == hero.HeroClass);
            var basicAttack = new DamagingAbility("Basic Attack", 0, hero.HeroClass, EffectType.Damage, 0);

            hero.Abilities.Add(basicAttack); //add basic attack

            var dmgAbilities = spellPool.Where(x => x.Type == EffectType.Damage).ToList();

            hero.Abilities.Add(dmgAbilities[RandomProvider.Generate(0, dmgAbilities.Count - 1)]);  //add 2nd spell                                                                                                      //?

            var effectAbilitues = spellPool.Where(x => x.Type != EffectType.Damage).ToList();

            hero.Abilities.Add(effectAbilitues[RandomProvider.Generate(0, effectAbilitues.Count - 1)]);   //add 3rd spell

            foreach (var ability in hero.Abilities)
            {
                ability.Caster = hero;
            }
        }