public override void HandleAttack(DesignPatterns___DC_Design.EnumAttacks attack, DesignPatterns___DC_Design.Target targets, DesignPatterns___DC_Design.DungeonCharacter attacker)
        {
            if (attack.Equals(EnumAttacks.HyperBeam))
            {
                int str = (attacker.DCStats.GetStat(StatsType.Strength));
                // calculate raw damage
                // Strength Weight -> Each Str point = .8% - 1.2% damage increase of BaseDamage. FOR EXAMPLE: 100 Raw Str = 180%-220% * BaseDamage, OR 38-42 damage.
                int damage = _random.Next((int)(BaseDamage * StatAlgorithms.GetPercentStrength(str, LowPercent)), (int)(BaseDamage * StatAlgorithms.GetPercentStrength(str, HighPercent)));

                var cmd = new StatAugmentCommand();

                // Apply defense reduction
                int appliedDamage = StatAlgorithms.ApplyDefence(damage, targets.ElementAt(DEFAULT_INDEX));
                cmd.AddEffect(new EffectInformation(StatsType.CurHp, -appliedDamage), targets.ElementAt(DEFAULT_INDEX));

                cmd.AddEffect(StatAlgorithms.ModifyStatBy(StatsType.Agility, attacker, 0.1, 15), attacker);
                cmd.AddEffect(new EffectInformation(StatsType.CurResources, attack.Cost), attacker);

                // reduce target combat effectivness (lower str, agi, def by 15%)
                cmd.AddEffect(StatAlgorithms.ModifyStatBy(StatsType.Strength, targets.ElementAt(DEFAULT_INDEX), -.15, 4), targets.ElementAt(DEFAULT_INDEX));
                cmd.AddEffect(StatAlgorithms.ModifyStatBy(StatsType.Agility, targets.ElementAt(DEFAULT_INDEX), -.15, 4), targets.ElementAt(DEFAULT_INDEX));
                cmd.AddEffect(StatAlgorithms.ModifyStatBy(StatsType.Defense, targets.ElementAt(DEFAULT_INDEX), -.15, 4), targets.ElementAt(DEFAULT_INDEX));

                cmd.RegisterCommand();
            }
            else
            {
                NextLink.HandleAttack(attack, targets, attacker);
            }
        }
        public override void HandleAttack(DesignPatterns___DC_Design.EnumAttacks attack, DesignPatterns___DC_Design.Target targets, DesignPatterns___DC_Design.DungeonCharacter attacker)
        {
            if (attack.Equals(EnumAttacks.DemoralizingShout))
            {
                int str = (attacker.DCStats.GetStat(StatsType.Strength));

                var cmd = new StatAugmentCommand();

                cmd.AddEffect(new EffectInformation(StatsType.CurResources, attack.Cost + (int)(.1275 * attacker.DCStats.GetStat(StatsType.Intelegence))), attacker);

                double reduction = StatAlgorithms.ApplyStrengthToStatReduction(PercentReduction, str);

                foreach (var target in targets)
                {
                    // reduce target combat effectivness (lower str, agi, def by 15% + percent based off str)
                    cmd.AddEffect(StatAlgorithms.ModifyStatBy(StatsType.Strength, target, reduction, 5), target); //targets.ElementAt(DEFAULT_INDEX)
                    cmd.AddEffect(StatAlgorithms.ModifyStatBy(StatsType.Agility, target, reduction, 5), target);
                    cmd.AddEffect(StatAlgorithms.ModifyStatBy(StatsType.Defense, target, reduction, 5), target);
                }

                cmd.RegisterCommand();
            }
            else
            {
                NextLink.HandleAttack(attack, targets, attacker);
            }
        }
        public override void HandleAttack(DesignPatterns___DC_Design.EnumAttacks attack, DesignPatterns___DC_Design.Target targets, DesignPatterns___DC_Design.DungeonCharacter attacker)
        {
            if (attack.Equals(EnumAttacks.IceCone))
            {
                int str = (attacker.DCStats.GetStat(StatsType.Strength));
                var damage = _random.Next((int)(BaseDamage * StatAlgorithms.GetPercentStrength(str, LowPercent)), (int)(BaseDamage * StatAlgorithms.GetPercentStrength(str, HighPercent)));

                var cmd = new StatAugmentCommand();
                foreach (var target in targets)
                {
                    int appliedDamage = StatAlgorithms.ApplyDefence(damage, target);

                    cmd.AddEffect(new EffectInformation(StatsType.CurHp, -appliedDamage), target);

                    cmd.AddEffect(StatAlgorithms.ModifyStatBy(StatsType.Agility, target, -0.8, 4), target);
                    cmd.AddEffect(StatAlgorithms.ModifyStatBy(StatsType.Defense, target, -0.8, 4), target);

                }
                cmd.AddEffect(new EffectInformation(StatsType.CurResources, attack.Cost), attacker);
                cmd.RegisterCommand();
            }
            else
            {
                NextLink.HandleAttack(attack,targets,attacker);
            }
        }
Exemple #4
0
 public void augmentStat(StatAugmentCommand augment)
 {
     if (Validate(augment))
     {
         PublicEnums.StatsType statForAugment = augment.Stat;
         var statValue = _stats[statForAugment];
         augment.ApplyAugment(statValue);
     }
 }
 public void UseItem(GenericItems item, Target targets)
 {
     var cmd = new StatAugmentCommand();
     foreach (var target in targets)
     {
         cmd.AddEffects(item.Properties,target);
     }
     cmd.RegisterCommand();
 }
        public void UseItem(GenericItems item, Target targets)
        {
            var cmd = new StatAugmentCommand();
            var effectsResult = item.Properties.Select(effect => effect.GetInverse()).ToList();

            foreach (var target in targets)
            {
                cmd.AddEffects(effectsResult, target);
            }
            cmd.RegisterCommand();
        }
        public override bool Use()
        {
            StatAugmentCommand cmd = new StatAugmentCommand();

            foreach (EffectInformation ef in this.Properties)
            {
                cmd.AddEffect(ef, Hero.GetInstance());
            }

            cmd.RegisterCommand();

            Player.GetInstance().GetInventory().RemoveItem(this);

            return true;
        }
 public void OfferCommand(StatAugmentCommand cmd)
 {
     foreach (var key in cmd.Effects.Keys)
     {
         foreach (var effect in cmd.Effects[key])
         {
             if (effect.Magnitude != 0)
             {
                 var sacThread = new StatAugmentCommandThread(effect, key);
                 ThreadPool.QueueUserWorkItem(sacThread.ThreadStart);
             }
         }
     }
     //var t = new Thread(new ThreadStart(sacThread.ThreadStart));
     //t.Start();
 }
        public override void HandleAttack(DesignPatterns___DC_Design.EnumAttacks attack, DesignPatterns___DC_Design.Target targets, DesignPatterns___DC_Design.DungeonCharacter attacker)
        {
            if (attack.Equals(EnumAttacks.GreaterHeal))
            {
                int str = (attacker.DCStats.GetStat(StatsType.Strength));
                int heal = _random.Next(BaseHeal * (int)(StatAlgorithms.GetPercentStrength(str, LowPercent)), (int)(BaseHeal * StatAlgorithms.GetPercentStrength(str, HighPercent)));
                StatAugmentCommand cmd = new StatAugmentCommand();

                cmd.AddEffect(new EffectInformation(StatsType.CurHp, heal), targets.ElementAt(DEFAULT_INDEX));

                cmd.AddEffect(StatAlgorithms.ModifyStatBy(StatsType.Agility, targets.ElementAt(DEFAULT_INDEX), .2, 4), attacker);
                cmd.AddEffect(new EffectInformation(StatsType.CurResources, attack.Cost), attacker);
                cmd.RegisterCommand();
            }
            else
            {
                NextLink.HandleAttack(attack, targets, attacker);
            }
        }
        public override void HandleAttack(DesignPatterns___DC_Design.EnumAttacks attack, DesignPatterns___DC_Design.Target targets, DesignPatterns___DC_Design.DungeonCharacter attacker)
        {
            if (attack.Equals(EnumAttacks.LifeTap))
            {
                int manaIncrease = attacker.DCStats.GetStat(StatsType.CurHp);
                int healthSacrifice = -1 * (manaIncrease / 2);
                StatAugmentCommand cmd = new StatAugmentCommand();

                cmd.AddEffect(new EffectInformation(StatsType.CurHp, healthSacrifice), attacker);

                cmd.AddEffect(StatAlgorithms.ModifyStatBy(StatsType.Defense, targets.ElementAt(DEFAULT_INDEX), .9, 6), attacker);
                cmd.AddEffect(new EffectInformation(StatsType.CurResources, manaIncrease), attacker);
                cmd.RegisterCommand();
            }
            else
            {
                NextLink.HandleAttack(attack, targets, attacker);
            }
        }
        public override void HandleAttack(EnumAttacks attack, Target targets, DungeonCharacter attacker)
        {
            if (attack.Equals(EnumAttacks.WeakAttack))
            {
                int str = (attacker.DCStats.GetStat(StatsType.Strength));

                int damage = _random.Next((int)(BaseDamage * StatAlgorithms.GetPercentStrength(str, LowPercent)), (int)(BaseDamage * StatAlgorithms.GetPercentStrength(str, HighPercent)));

                var cmd = new StatAugmentCommand();

                int appliedDamage = StatAlgorithms.ApplyDefence(damage, targets.ElementAt(DEFAULT_INDEX));
                cmd.AddEffect(new EffectInformation(StatsType.CurHp, -appliedDamage), targets.ElementAt(DEFAULT_INDEX));

                cmd.AddEffect(new EffectInformation(StatsType.CurResources, attack.Cost + (int)(.1275 * attacker.DCStats.GetStat(StatsType.Intelegence))), attacker);
                cmd.RegisterCommand();
            }
            else
            {
                NextLink.HandleAttack(attack,targets,attacker);
            }
        }
        public override bool Use()
        {
            try
            {
                Dictionary<EnumGearSlot, Equipable> PlayerEquipedInventory = Player.GetInstance().GetEquipedInventory();
                Equipable currentlyEquipedItem = PlayerEquipedInventory[Slot];
                StatAugmentCommand cmd = new StatAugmentCommand();

                // for each effect on current equiped item, add its inverse effect to cmd
                foreach (EffectInformation effect in currentlyEquipedItem.Properties)
                {
                    cmd.AddEffect(effect.GetInverse(), Hero.GetInstance());
                }

                // apply inverse cmd to character to "unequpid" item.
                cmd.RegisterCommand();

                // remove item from equipped, add to inventory
                PlayerEquipedInventory.Remove(Slot);
                Player.GetInstance().GetInventory().AddItem(currentlyEquipedItem);

                // reset command
                cmd = new StatAugmentCommand();

                //Give the properties of this gear to the hero and register
                cmd.AddEffects(this.Properties, Hero.GetInstance());
                cmd.RegisterCommand();

                // add item to equpied, remove from inventory
                PlayerEquipedInventory.Add(Slot, this);
                //Player.GetInstance().GetInventory().RemoveItem(this);
            }
            catch (Exception e) // <---- WILL CHANGE FROM GENERIC EXCEPTION
            {
                // Write error out to text file for debugging
                return false;
            }

            return true;
        }
        public override void HandleAttack(DesignPatterns___DC_Design.EnumAttacks attack, DesignPatterns___DC_Design.Target targets, DesignPatterns___DC_Design.DungeonCharacter attacker)
        {
            if (attack.Equals(EnumAttacks.LightningBolt))
            {
                int str = (attacker.DCStats.GetStat(StatsType.Strength));

                int damage = _random.Next(BaseDamage, (int)(BaseDamage * StatAlgorithms.GetPercentStrength(str, HighPercent)));
                var cmd = new StatAugmentCommand();

                int appliedDamage = StatAlgorithms.ApplyDefence(damage, targets.ElementAt(DEFAULT_INDEX));

                cmd.AddEffect(new EffectInformation(StatsType.CurHp, -appliedDamage), targets.ElementAt(DEFAULT_INDEX));
                cmd.AddEffect(StatAlgorithms.ModifyStatBy(StatsType.Agility, targets.ElementAt(DEFAULT_INDEX), 1.5, 2), targets.ElementAt(DEFAULT_INDEX));

                cmd.AddEffect(new EffectInformation(StatsType.CurResources, attack.Cost), attacker);
                cmd.RegisterCommand();
            }
            else
            {
                NextLink.HandleAttack(attack, targets, attacker);
            }
        }
Exemple #14
0
 private bool Validate(StatAugmentCommand augment)
 {
     return _stats.ContainsKey(augment.Stat);
 }
        private void CloseBattle()
        {
            StatAugmentCommand cmd = new StatAugmentCommand();
            Hero hero = Hero.GetInstance();

            cmd.AddEffect(new EffectInformation(StatsType.CurResources, hero.DCStats.GetStat(StatsType.MaxResources) - hero.DCStats.GetStat(StatsType.CurResources)), hero);
            cmd.AddEffect(new EffectInformation(StatsType.CurHp, (int)(hero.DCStats.GetStat(StatsType.MaxHp) * .30)), hero); // <----------------------- NEWLY ADDED
            //StatAugmentManager.GetInstance().OfferCommand(cmd);
            cmd.RegisterCommand();

            _barTick.IsEnabled = false;

            this.Close();
        }