示例#1
0
 public static bool AdditionalResourcesNeeded(this Batallion batallion)
 {
     if (batallion.AdditionalNeededResources == 0)
     {
         return(true);
     }
     return(false);
 }
示例#2
0
        public void Attack(MonsterEnemy monstergroup, Batallion battle)
        {
            monstergroup.monster = new string[] { "oni", "cursed ninja", "blade panda", "trickster" };
            Console.WriteLine("Which weapon do you have? A Bow or Sword?");
            battle.Weapon = Console.ReadLine();
            if (battle.Weapon == "Sword")
            {
                Console.WriteLine("You rush up to one range of your enemy");
            }
            else if (battle.Weapon == "Bow")
            {
                Console.WriteLine("You move in to five range of your enemy");
            }
            else
            {
                Console.WriteLine("You have nowhere to move");
            }

            for (int i = 0; i < battle.GroupNumber; i++)
            {
                Console.WriteLine("You gained one man");
                battle.Damage += 5;
            }
            switch (monstergroup.Name)
            {
            case "oni":
                battle.Health -= 5;
                Console.WriteLine("The oni lowers your health by 5");
                break;

            case "cursed ninja":
                battle.Luck -= 5;
                Console.WriteLine("The cursed ninja lowers your luck");
                break;

            case "blade panda":
                battle.Damage -= 5;
                Console.WriteLine("The blade panda lowers your damage");
                break;

            case "trickster":
                battle.Speed -= 5;
                Console.WriteLine("The trickster lowers your speed");
                break;

            default:
                battle.Health -= 10;
                Console.WriteLine("What just happened?");
                break;
            }
        }
示例#3
0
文件: Battle.cs 项目: Nikita-bm/War
        private void AttackBatallion(Batallion enemyBatallion, Batallion myBatallion)
        {
            int extraUnits = enemyBatallion.Units - (myBatallion.Units * _army.ArmyPower);

            if (extraUnits < 0)
            {
                myBatallion.RemainingUnits = (-(extraUnits).RoundNumbertotheRight()) / 2;
            }
            else
            {
                myBatallion.AdditionalNeededResources = (extraUnits.RoundNumbertotheRight()) / 2;
            }

            myBatallion.UsedUnits = myBatallion.Units - myBatallion.RemainingUnits;
        }
示例#4
0
文件: Battle.cs 项目: Nikita-bm/War
        private void ResolveAdditionalResourcesNeeded(Batallion myBatallion, Army myArmy)
        {
            if (myBatallion.AdditionalNeededResources == 0)
            {
                return;
            }

            ResolveAdditionalResourcesWithWithAjacentBatallions(myArmy, myBatallion, myBatallion.Rank - 1);

            if (myBatallion.AdditionalNeededResources == 0)
            {
                return;
            }

            ResolveAdditionalResourcesWithWithAjacentBatallions(myArmy, myBatallion, myBatallion.Rank + 1);

            myBatallion.UsedUnits = myBatallion.Units - myBatallion.RemainingUnits;
        }
示例#5
0
文件: Battle.cs 项目: Nikita-bm/War
        private void ResolveAdditionalResourcesWithWithAjacentBatallions(Army myArmy, Batallion myBatallion, int adjacentBatallionRank)
        {
            var adjacentRankedBatallion = myArmy.GetBatallionByRank(adjacentBatallionRank);

            if (adjacentRankedBatallion != null && adjacentRankedBatallion.RemainingUnits > 0)
            {
                int availableWeightedUnitsFromAdjacentBatallion = adjacentRankedBatallion.ReturnWeightage(myBatallion.Rank, adjacentRankedBatallion.RemainingUnits);
                int neededEquivalentUnits = availableWeightedUnitsFromAdjacentBatallion - myBatallion.AdditionalNeededResources;

                if (neededEquivalentUnits > 0)
                {
                    adjacentRankedBatallion.RemainingUnits -= myBatallion.ReturnWeightage(adjacentBatallionRank, myBatallion.AdditionalNeededResources);
                    myBatallion.AdditionalNeededResources   = 0;
                }
                else
                {
                    myBatallion.AdditionalNeededResources -= availableWeightedUnitsFromAdjacentBatallion;
                    adjacentRankedBatallion.RemainingUnits = 0;
                }
                adjacentRankedBatallion.UsedUnits += (adjacentRankedBatallion.Units - (adjacentRankedBatallion.UsedUnits + adjacentRankedBatallion.RemainingUnits));
            }
        }
示例#6
0
 public int GroupByFive(Batallion battle)
 {
     return(battle.GroupNumber * 5);
 }
示例#7
0
 public int LuckByTen(Batallion battle)
 {
     return(battle.Luck * 10);
 }
示例#8
0
 public int HealthByTen(Batallion battle)
 {
     return(battle.Health * 10);
 }