Beispiel #1
0
        public void ProcessResults()
        {
            Target.DrainHealth(AppliedDamage);
            Caster.DrainHealth(ReflectedDamage);

            HPLeech = UsedAbility.CalculateHealthLeech(AppliedDamage, Caster);
            MPLeech = UsedAbility.CalculateManaLeech(AppliedDamage, Caster);

            outputCombatLogInfo();
        }
        public int CheckCost(UsedAbility ability)
        {
            switch (ability)
            {
            case UsedAbility.Magic:
                return(15);

            case UsedAbility.PoisonHit:
                return(25);

            default: return(0);    //bör ej tillkomma
            }
        }
        public void Ability(Enemy enemy, Object.Player player, UsedAbility ability)
        {
            #region Hit
            if (ability == UsedAbility.Hit)
            {
                if (usedBy == UsedBy.player)
                {
                    if (CheckIfHit(player.stats.CheckStat(Stat.accuracy),
                                   player.stats.CheckStat(Stat.luck),
                                   player.stats.CheckStat(Stat.speed),
                                   enemy.stats.CheckStat(Stat.luck),
                                   enemy.stats.CheckStat(Stat.speed)))
                    {
                        usedAbility = UsedAbility.Hit;
                        if (CheckIfCritical(player.stats.CheckStat(Stat.luck),
                                            player.stats.CheckStat(Stat.strength),
                                            enemy.stats.CheckStat(Stat.luck),
                                            enemy.stats.CheckStat(Stat.strength)))
                        {
                            power  = player.stats.CheckStat(Stat.strength);
                            effect = Effects.bleed;
                        }
                        else
                        {
                            power  = player.stats.CheckStat(Stat.strength);
                            effect = Effects.none;
                        }
                    }
                    else
                    {
                        usedAbility = UsedAbility.Miss; power = 0; effect = Effects.none;
                    }
                }
                else
                {
                    if (CheckIfHit(enemy.stats.CheckStat(Stat.accuracy),
                                   enemy.stats.CheckStat(Stat.luck),
                                   enemy.stats.CheckStat(Stat.speed),
                                   player.stats.CheckStat(Stat.luck),
                                   player.stats.CheckStat(Stat.speed)))
                    {
                        usedAbility = UsedAbility.Hit;
                        if (CheckIfCritical(player.stats.CheckStat(Stat.luck),
                                            player.stats.CheckStat(Stat.strength),
                                            enemy.stats.CheckStat(Stat.luck),
                                            enemy.stats.CheckStat(Stat.strength)))
                        {
                            power  = enemy.stats.CheckStat(Stat.strength) * 2;
                            effect = Effects.bleed;
                        }
                        else
                        {
                            power  = enemy.stats.CheckStat(Stat.strength);
                            effect = Effects.none;
                        }
                    }
                    else
                    {
                        usedAbility = UsedAbility.Miss; power = 0; effect = Effects.none;
                    }
                }
            }
            #endregion

            #region Defence

            if (ability == UsedAbility.Defence)
            {
                effect = Effects.none;
                if (usedBy == UsedBy.player)
                {
                    usedAbility = UsedAbility.Defence;
                    power       = (player.stats.CheckStat(Stat.strength) / 2) + (player.stats.CheckStat(Stat.accuracy) / 2);
                }
                else
                {
                    usedAbility = UsedAbility.Defence;
                    power       = (enemy.stats.CheckStat(Stat.strength) / 2) + (enemy.stats.CheckStat(Stat.accuracy) / 2);
                }
            }
            #endregion

            #region Magic
            if (ability == UsedAbility.Magic)
            {
                if (usedBy == UsedBy.player)
                {
                    if (CheckIfHit(player.stats.CheckStat(Stat.accuracy),
                                   player.stats.CheckStat(Stat.luck),
                                   player.stats.CheckStat(Stat.speed),
                                   enemy.stats.CheckStat(Stat.luck),
                                   enemy.stats.CheckStat(Stat.speed)))
                    {
                        usedAbility = UsedAbility.Magic;
                        if (CheckIfCritical(player.stats.CheckStat(Stat.luck),
                                            player.stats.CheckStat(Stat.intelligence),
                                            enemy.stats.CheckStat(Stat.luck),
                                            enemy.stats.CheckStat(Stat.intelligence)))
                        {
                            power  = player.stats.CheckStat(Stat.intelligence) + rand.Next(0, player.stats.CheckStat(Stat.luck));
                            effect = Effects.confusion;
                        }
                        else
                        {
                            power  = player.stats.CheckStat(Stat.intelligence) + rand.Next(0, player.stats.CheckStat(Stat.luck));
                            effect = Effects.none;
                        }
                    }
                    else
                    {
                        usedAbility = UsedAbility.Miss; power = 0; effect = Effects.none;
                    }
                }
                else
                {
                    if (CheckIfHit(enemy.stats.CheckStat(Stat.accuracy),
                                   enemy.stats.CheckStat(Stat.luck),
                                   enemy.stats.CheckStat(Stat.speed),
                                   player.stats.CheckStat(Stat.luck),
                                   player.stats.CheckStat(Stat.speed)))
                    {
                        this.usedAbility = UsedAbility.Magic;
                        if (CheckIfCritical(player.stats.CheckStat(Stat.luck),
                                            player.stats.CheckStat(Stat.intelligence),
                                            enemy.stats.CheckStat(Stat.luck),
                                            enemy.stats.CheckStat(Stat.intelligence)))
                        {
                            power  = enemy.stats.CheckStat(Stat.intelligence) + +rand.Next(0, enemy.stats.CheckStat(Stat.luck));
                            effect = Effects.confusion;
                        }
                        else
                        {
                            power  = enemy.stats.CheckStat(Stat.intelligence) + +rand.Next(0, enemy.stats.CheckStat(Stat.luck));
                            effect = Effects.none;
                        }
                    }
                    else
                    {
                        this.usedAbility = UsedAbility.Miss; power = 0; effect = Effects.none;
                    }
                }
            }
            #endregion

            #region Dodge
            if (ability == UsedAbility.Dodge)
            {
                effect = Effects.none;
                if (usedBy == UsedBy.player)
                {
                    int accuracy = player.stats.CheckStat(Stat.accuracy) +
                                   (player.stats.CheckStat(Stat.luck)) + rand.Next(0, 80);
                    if (accuracy >= 50)
                    {
                        usedAbility = UsedAbility.Dodge;
                    }
                    else
                    {
                        usedAbility = UsedAbility.Miss;
                    }
                }
                else
                {
                    int accuracy = enemy.stats.CheckStat(Stat.accuracy) +
                                   (enemy.stats.CheckStat(Stat.luck)) + rand.Next(0, 80);
                    if (accuracy >= 50)
                    {
                        usedAbility = UsedAbility.Dodge;
                    }
                    else
                    {
                        usedAbility = UsedAbility.Miss;
                    }
                }
            }
            #endregion

            #region Poison Hit
            if (ability == UsedAbility.PoisonHit)
            {
                if (usedBy == UsedBy.player)
                {
                    if (CheckIfHit(player.stats.CheckStat(Stat.accuracy),
                                   player.stats.CheckStat(Stat.luck),
                                   player.stats.CheckStat(Stat.speed),
                                   enemy.stats.CheckStat(Stat.luck),
                                   enemy.stats.CheckStat(Stat.speed)))
                    {
                        usedAbility = UsedAbility.PoisonHit;
                        if (CheckIfCritical(player.stats.CheckStat(Stat.luck),
                                            player.stats.CheckStat(Stat.intelligence),
                                            enemy.stats.CheckStat(Stat.luck),
                                            enemy.stats.CheckStat(Stat.intelligence)))
                        {
                            power  = player.stats.CheckStat(Stat.intelligence);
                            effect = Effects.poison;
                        }
                        else
                        {
                            power  = player.stats.CheckStat(Stat.intelligence) / 2;
                            effect = Effects.poison;
                        }
                    }
                    else
                    {
                        usedAbility = UsedAbility.Miss; power = 0; effect = Effects.none;
                    }
                }
                else
                {
                    if (CheckIfHit(enemy.stats.CheckStat(Stat.accuracy),
                                   enemy.stats.CheckStat(Stat.luck),
                                   enemy.stats.CheckStat(Stat.speed),
                                   player.stats.CheckStat(Stat.luck),
                                   player.stats.CheckStat(Stat.speed)))
                    {
                        usedAbility = UsedAbility.PoisonHit;
                        if (CheckIfCritical(enemy.stats.CheckStat(Stat.luck),
                                            enemy.stats.CheckStat(Stat.intelligence),
                                            player.stats.CheckStat(Stat.luck),
                                            player.stats.CheckStat(Stat.intelligence)))
                        {
                            power  = enemy.stats.CheckStat(Stat.intelligence);
                            effect = Effects.poison;
                        }
                        else
                        {
                            power  = enemy.stats.CheckStat(Stat.intelligence) / 2;
                            effect = Effects.poison;
                        }
                    }
                    else
                    {
                        usedAbility = UsedAbility.Miss; power = 0; effect = Effects.none;
                    }
                }
            }
            #endregion

            #region Auto-Miss

            if (ability == UsedAbility.Miss)
            {
                usedAbility = UsedAbility.Miss;
                power       = 0;
                effect      = Effects.none;
            }

            #endregion
        }