Ejemplo n.º 1
0
        public List <string> Fight()
        {
            List <string> fight = new List <string>();

            int  round = 1, golemRound = 4, incrementWounds = 2;
            bool warriorFight = (Character.Protagonist.Specialization == Character.SpecializationType.Warrior);
            bool poisonBlade  = false;

            if (Game.Data.Triggers.Contains("PoisonBlade"))
            {
                poisonBlade = true;
                Game.Option.Trigger("PoisonBlade", remove: true);
            }

            List <Character> FightEnemies = new List <Character>();

            foreach (Character enemy in Enemies)
            {
                FightEnemies.Add(enemy.Clone());
            }

            while (true)
            {
                fight.Add(String.Format("HEAD|Раунд: {0}", round));

                if (!GolemFight && (Character.Protagonist.Specialization == Character.SpecializationType.Thrower) && (round == 1))
                {
                    fight.Add("BOLD|Вы бросаете метательные ножи");

                    FightEnemies[0].Hitpoints -= 3;

                    fight.Add(String.Format("GOOD|{0} ранен метательными ножами и потерял 3 жизни", FightEnemies[0].Name));
                    fight.Add(String.Empty);

                    if (EnemyLostFight(FightEnemies, ref fight))
                    {
                        return(fight);
                    }
                }

                if (!String.IsNullOrEmpty(ReactionRound))
                {
                    string[] wounds = ReactionRound.Split(',');
                    fight.Add(String.Format("BOLD|{0} пытаются нанести вам дополнительный урон", wounds[1].TrimStart()));

                    if (!GoodReaction(ref fight))
                    {
                        int wound = int.Parse(wounds[0]);
                        Character.Protagonist.Hitpoints -= wound;

                        fight.Add(String.Format("BAD|{0} нанесли дополнительный урон: {1}", wounds[1].TrimStart(), wound));

                        if (Character.Protagonist.Hitpoints <= 0)
                        {
                            return(LostFight(fight));
                        }
                    }
                    else
                    {
                        fight.Add(String.Format("BOLD|{0} не преуспели", wounds[1].TrimStart()));
                    }

                    fight.Add(String.Empty);
                }

                foreach (Character enemy in FightEnemies)
                {
                    if (enemy.Hitpoints <= 0)
                    {
                        continue;
                    }

                    fight.Add(String.Format("{0} (жизни: {1})", enemy.Name, enemy.Hitpoints));

                    if (!String.IsNullOrEmpty(ConneryAttacks))
                    {
                        string[] bonus = ConneryAttacks.Split(',');

                        if ((bonus.Length < 2) || (round > int.Parse(bonus[1])))
                        {
                            int conneryAttack = int.Parse(bonus[0]);

                            enemy.Hitpoints -= conneryAttack;

                            fight.Add(String.Format("GOOD|{0} ранен атакой Коннери", enemy.Name, conneryAttack));

                            if (EnemyLostFight(FightEnemies, ref fight, connery: true))
                            {
                                return(fight);
                            }
                        }
                    }

                    int firstHeroRoll   = Game.Dice.Roll();
                    int secondHeroRoll  = Game.Dice.Roll();
                    int heroHitStrength = firstHeroRoll + secondHeroRoll + Character.Protagonist.Strength;

                    fight.Add(String.Format(
                                  "Ваш удар: {0} + {1} + {2} = {3}",
                                  Game.Dice.Symbol(firstHeroRoll), Game.Dice.Symbol(secondHeroRoll),
                                  Character.Protagonist.Strength, heroHitStrength));

                    int firstEnemyRoll   = Game.Dice.Roll();
                    int secondEnemyRoll  = Game.Dice.Roll();
                    int enemyHitStrength = firstEnemyRoll + secondEnemyRoll + enemy.Strength;

                    fight.Add(String.Format(
                                  "Его удар: {0} + {1} + {2} = {3}",
                                  Game.Dice.Symbol(firstEnemyRoll), Game.Dice.Symbol(secondEnemyRoll),
                                  enemy.Strength, enemyHitStrength));

                    bool zombieWound = false;

                    if (ZombieFight && (heroHitStrength > enemyHitStrength))
                    {
                        int dice = Game.Dice.Roll();
                        zombieWound = dice % 2 == 0;
                        fight.Add(String.Format("Бросок на пробитие: {0} - {1}", Game.Dice.Symbol(dice), (zombieWound ? "чёт" : "нечет")));

                        if (warriorFight)
                        {
                            zombieWound = true;
                        }
                    }

                    bool lightningLunge = (warriorFight && (firstHeroRoll == secondHeroRoll) && !Game.Data.Triggers.Contains("EvilEye"));

                    if (ZombieFight && (heroHitStrength > enemyHitStrength) && !zombieWound)
                    {
                        fight.Add("BOLD|Вы не смогли пробить до кости");
                    }

                    else if (GolemFight && (heroHitStrength > enemyHitStrength))
                    {
                        fight.Add("BOLD|Вы отбили все атаки");
                    }

                    else if (warriorFight && (firstHeroRoll == secondHeroRoll) && (firstHeroRoll == 6))
                    {
                        fight.Add("BOLD|Вы сделали 'Крыло ястреба'!");

                        if (enemy.Hitpoints > 6)
                        {
                            enemy.Hitpoints /= 2;
                            fight.Add(String.Format("GOOD|{0} ранен на половину своих жизней", enemy.Name));
                        }
                        else
                        {
                            enemy.Hitpoints = 0;
                            fight.Add(String.Format("GOOD|{0} убит наповал", enemy.Name));

                            if (EnemyLostFight(FightEnemies, ref fight))
                            {
                                return(fight);
                            }
                        }
                    }

                    else if ((heroHitStrength > enemyHitStrength) || lightningLunge)
                    {
                        if (lightningLunge)
                        {
                            fight.Add("BOLD|Вы сделали 'Молниеносный выпад'!");
                        }

                        fight.Add(String.Format("GOOD|{0} ранен", enemy.Name));

                        if (String.IsNullOrEmpty(ReactionHit))
                        {
                            int wound = (AttackWounds > 0 ? AttackWounds : 2);

                            if (poisonBlade)
                            {
                                wound += 2;
                                fight.Add(String.Format("Вы нанесли урон ядом: {0}", wound));
                            }

                            enemy.Hitpoints -= wound;
                        }
                        else
                        {
                            string[] wounds = ReactionHit.Split('-');
                            int      wound  = int.Parse(GoodReaction(ref fight) ? wounds[0] : wounds[1]);

                            enemy.Hitpoints -= wound;

                            fight.Add(String.Format("Вы нанесли урон: {0}", wound));
                        }

                        if (EnemyLostFight(FightEnemies, ref fight))
                        {
                            return(fight);
                        }
                    }
                    else if (heroHitStrength < enemyHitStrength)
                    {
                        fight.Add(String.Format("BAD|{0} ранил вас", enemy.Name));

                        if (!String.IsNullOrEmpty(ReactionWounds))
                        {
                            string[] wounds = ReactionWounds.Split('-');
                            int      wound  = int.Parse(GoodReaction(ref fight) ? wounds[0] : wounds[1]);

                            Character.Protagonist.Hitpoints -= wound;

                            fight.Add(String.Format("{0} нанёс урон: {1}", enemy.Name, wound));
                        }
                        else if (IncrementWounds)
                        {
                            fight.Add(String.Format("{0} нанёс урон: {1}", enemy.Name, incrementWounds));

                            Character.Protagonist.Hitpoints -= incrementWounds;

                            incrementWounds += 1;
                        }
                        else
                        {
                            Character.Protagonist.Hitpoints -= 2;
                        }

                        if (Character.Protagonist.Hitpoints <= 0)
                        {
                            return(LostFight(fight));
                        }
                    }
                    else
                    {
                        fight.Add("BOLD|Ничья в раунде");
                    }

                    if (GolemFight && (golemRound > 0))
                    {
                        golemRound -= 1;
                    }

                    else if (GolemFight)
                    {
                        golemRound = 4;

                        fight.Add("BOLD|Коннери улучил момент для удара");

                        if (!GoodReaction(ref fight))
                        {
                            fight.Add("BAD|Вы не смогли прикрыть Коннери и он ранен");
                            Character.Protagonist.ConneryHitpoints -= 2;

                            if (Character.Protagonist.ConneryHitpoints <= 0)
                            {
                                return(LostFight(fight));
                            }
                        }
                        else
                        {
                            fight.Add(String.Format("GOOD|{0} ранен атакой Коннери", enemy.Name));
                            enemy.Hitpoints -= 1;

                            if (EnemyLostFight(FightEnemies, ref fight, connery: true))
                            {
                                return(fight);
                            }
                        }
                    }

                    if ((OnlyRounds > 0) && (OnlyRounds <= round))
                    {
                        fight.Add("BOLD|Отведённые на бой раунды истекли.");
                        return(fight);
                    }

                    if ((RoundsToWin > 0) && (RoundsToWin <= round))
                    {
                        fight.Add("BAD|Отведённые на победу раунды истекли.");
                        return(LostFight(fight));
                    }

                    fight.Add(String.Empty);
                }

                round += 1;
            }
        }
Ejemplo n.º 2
0
        public List <string> Fight()
        {
            List <string> fight = new List <string>();

            int  round = 1, woundLine = 0, wounded = 0, death = 0, roundsWin = 0, incrementWounds = 2;
            bool warriorFight = (Character.Protagonist.Specialization == Character.SpecializationType.Warrior);

            List <Character> FightEnemies = new List <Character>();

            foreach (Character enemy in Enemies)
            {
                FightEnemies.Add(enemy.Clone());
            }

            while (true)
            {
                fight.Add(String.Format("HEAD|Раунд: {0}", round));

                bool block        = EvenWound || ReactionFight;
                bool reactionFail = false;

                if ((Character.Protagonist.Specialization == Character.SpecializationType.Thrower) && (round == 1) && !block)
                {
                    fight.Add("BOLD|Вы бросаете метательные ножи");

                    int wound = (Game.Data.Triggers.Contains("PoisonedBlade") ? 4 : 3);

                    FightEnemies[0].Hitpoints -= wound;

                    fight.Add(String.Format("GOOD|{0} ранен метательными ножами и потерял {1} жизни", FightEnemies[0].Name, wound));
                    fight.Add(String.Empty);

                    if (EnemyLostFight(FightEnemies, ref fight))
                    {
                        return(fight);
                    }
                }

                foreach (Character enemy in FightEnemies)
                {
                    if ((enemy.Hitpoints <= 0) && !Invincible)
                    {
                        continue;
                    }

                    if (Regeneration && (round % 4 == 0) && (enemy.Hitpoints < Enemies.Where(x => x.Name == enemy.Name).FirstOrDefault().Hitpoints))
                    {
                        enemy.Hitpoints += 1;
                        fight.Add(String.Format("BOLD|{0} восстановил 1 жизнь", enemy.Name));
                    }

                    if (!Invincible)
                    {
                        fight.Add(String.Format("{0} (жизни: {1})", enemy.Name, enemy.Hitpoints));
                    }

                    int firstHeroRoll   = Game.Dice.Roll();
                    int secondHeroRoll  = Game.Dice.Roll();
                    int heroHitStrength = firstHeroRoll + secondHeroRoll + Character.Protagonist.Strength;

                    fight.Add(String.Format(
                                  "Ваш удар: {0} + {1} + {2} = {3}",
                                  Game.Dice.Symbol(firstHeroRoll), Game.Dice.Symbol(secondHeroRoll),
                                  Character.Protagonist.Strength, heroHitStrength));

                    int firstEnemyRoll   = Game.Dice.Roll();
                    int secondEnemyRoll  = Game.Dice.Roll();
                    int enemyHitStrength = firstEnemyRoll + secondEnemyRoll + enemy.Strength;

                    fight.Add(String.Format(
                                  "Его удар: {0} + {1} + {2} = {3}",
                                  Game.Dice.Symbol(firstEnemyRoll), Game.Dice.Symbol(secondEnemyRoll),
                                  enemy.Strength, enemyHitStrength));

                    if (ReactionFight)
                    {
                        reactionFail = !GoodReaction(ref fight, showResult: true);
                    }

                    if (TailAttack && (firstEnemyRoll == secondEnemyRoll))
                    {
                        fight.Add("BAD|Аллигатор ударил хвостом! Вы теряете 5 жизней!");

                        Character.Protagonist.Hitpoints -= 5;
                        TailAttack = false;

                        woundLine = 0;

                        if (Character.Protagonist.Hitpoints <= 0)
                        {
                            return(LostFight(fight));
                        }
                    }
                    else if (warriorFight && (firstHeroRoll == secondHeroRoll) && (firstHeroRoll == 6) && (!ReactionFight || !reactionFail))
                    {
                        fight.Add("BOLD|Вы сделали 'Крыло ястреба'!");

                        enemy.Hitpoints /= 2;
                        woundLine       += 1;

                        fight.Add(String.Format("GOOD|{0} ранен на половину своих жизней", enemy.Name));
                    }
                    else if ((heroHitStrength > enemyHitStrength) && (!ReactionFight || !reactionFail))
                    {
                        int woundLevel = (IsMagicBlade() ? 3 : 2);

                        if (EvenWound)
                        {
                            int woundDice = Game.Dice.Roll();

                            if (woundDice % 2 == 0)
                            {
                                enemy.Hitpoints -= woundLevel;
                                woundLine       += 1;

                                fight.Add(String.Format("Бросок на пробитие: {0} - чётное", Game.Dice.Symbol(woundDice)));
                                fight.Add(String.Format("GOOD|{0} ранен", enemy.Name));
                            }
                            else
                            {
                                fight.Add(String.Format("Бросок на пробитие: {0} - нечётное", Game.Dice.Symbol(woundDice)));
                                fight.Add(String.Format("BAD|Вы не смогли пробить защиту {0}", enemy.Name));
                            }
                        }
                        else
                        {
                            fight.Add(String.Format("GOOD|{0} ранен", enemy.Name));

                            woundLine += 1;
                            roundsWin += 1;

                            if (IsPoisonedBlade())
                            {
                                enemy.Hitpoints -= 5;
                                fight.Add(String.Format("BOLD|Из-за яда, рана отнимает у {0} сразу 5 жизней", enemy.Name));
                            }
                            else
                            {
                                enemy.Hitpoints -= woundLevel;
                            }
                        }

                        if (enemy.Hitpoints <= 0)
                        {
                            death += 1;
                        }

                        if (EnemyLostFight(FightEnemies, ref fight))
                        {
                            return(fight);
                        }
                    }
                    else if ((heroHitStrength < enemyHitStrength) || reactionFail)
                    {
                        fight.Add(String.Format("BAD|{0} ранил вас", enemy.Name));

                        wounded  += 1;
                        woundLine = 0;

                        if (!String.IsNullOrEmpty(ReactionWounds))
                        {
                            string[] wounds = ReactionWounds.Split('-');
                            int      wound  = int.Parse(GoodReaction(ref fight, showResult: true) ? wounds[0] : wounds[1]);

                            Character.Protagonist.Hitpoints -= wound;

                            if (wound > 0)
                            {
                                fight.Add(String.Format("{0} нанёс урон: {1}", enemy.Name, wound));
                            }
                            else
                            {
                                fight.Add(String.Format("GOOD|{0} не нанёс вам урона", enemy.Name));
                            }
                        }
                        else if (IncrementWounds)
                        {
                            fight.Add(String.Format("{0} нанёс урон: {1}", enemy.Name, incrementWounds));

                            Character.Protagonist.Hitpoints -= incrementWounds;

                            incrementWounds *= 2;
                        }
                        else
                        {
                            Character.Protagonist.Hitpoints -= (Wound > 0 ? Wound : 2);
                        }

                        if (Character.Protagonist.Hitpoints <= 0)
                        {
                            return(LostFight(fight));
                        }
                    }
                    else
                    {
                        woundLine = 0;
                        fight.Add("BOLD|Ничья в раунде");
                    }


                    if ((OnlyRounds > 0) && (OnlyRounds <= round))
                    {
                        fight.Add("BOLD|Отведённые на бой раунды истекли.");
                        return(fight);
                    }

                    if ((RoundsToWin > 0) && (RoundsToWin <= round))
                    {
                        fight.Add("BAD|Отведённые на победу раунды истекли.");
                        return(LostFight(fight));
                    }

                    if ((DeathLimit > 0) && (death >= DeathLimit))
                    {
                        fight.Add(String.Empty);
                        fight.Add("BOLD|Вы убили установленное количество противников.");

                        return(fight);
                    }

                    if ((RoundsWinToWin > 0) && (roundsWin >= RoundsWinToWin))
                    {
                        fight.Add(String.Empty);
                        fight.Add("BOLD|Вы нанесли противнику необходимое количество ран :)");

                        return(fight);
                    }

                    if (ThreeWoundLimit && (woundLine > 2))
                    {
                        fight.Add(String.Empty);
                        fight.Add("BOLD|Вы ранили его три раза подряд!");

                        return(fight);
                    }

                    fight.Add(String.Empty);
                }

                round += 1;
            }
        }