示例#1
0
 private static void MovingHandler(ICharacters character)
 {
     OnBuildingActions.InDoors(character);
     CityMap.ShowWSAD();
     CityMap.Move(OnInputWork.MovingOnMapHandler(), out MoveX, out MoveY);
     CityMap.ShowMap(character);
 }
示例#2
0
        public static void IfActionPossible(ICharacters characters, int whatAction, out int ifPossible)
        {
            DateTime dateNow = DateTime.Now;

            if (characters.TimeForActions[0 + whatAction] == dateNow.Minute)
            {
                if (characters.TimeForActions[1 + whatAction] < dateNow.Second)
                {
                    ifPossible = 1;
                }
                else
                {
                    ifPossible = 0;
                }
            }
            else
            {
                if (characters.TimeForActions[0 + whatAction] < 60)
                {
                    ifPossible = 1;
                }
                else if (characters.TimeForActions[0 + whatAction] % 60 < dateNow.Second % 60)
                {
                    ifPossible = 1;
                }
                else
                {
                    ifPossible = 0;
                }
            }
        }
        public static void FightOptionsHandler(int choice, ref ICharacters opponent, ref ICharacters character, out int ifPossible)
        {
            switch (choice)
            {
            case 1:
            {
                TimerOpponent.IfActionPossible(opponent, 0, out ifPossible);
                if (ifPossible == 1)
                {
                    ifPossible = 1;
                    FightOptionAttackOpponent.AttackMechanics(ref opponent, ref character, ifPossible);
                }
                else
                {
                    ifPossible = 0;
                    ChoicesOnFightOpponent.FightChoices(ref opponent, ref character, ifPossible);
                }
                break;
            }

            case 2:
            {
                TimerOpponent.IfActionPossible(opponent, 2, out ifPossible);
                if (ifPossible == 1)
                {
                    ifPossible = 1;
                    FightOptionAttackOpponent.SpellMechanics(ref opponent, ref character, ifPossible);
                }
                else
                {
                    ifPossible = 0;
                    ChoicesOnFightOpponent.FightChoices(ref opponent, ref character, ifPossible);
                }
                break;
            }

            case 3:
            {
                TimerOpponent.IfActionPossible(opponent, 4, out ifPossible);
                if (ifPossible == 1)
                {
                    ifPossible = 1;
                    FightOptionItemOpponent.ItemMechanics(ref opponent, ref character, ifPossible);
                }
                else
                {
                    ifPossible = 0;
                    ChoicesOnFightOpponent.FightChoices(ref opponent, ref character, ifPossible);
                }
                break;
            }

            default:
            {
                ifPossible = 1;
                ChoicesOnFightOpponent.FightChoices(ref opponent, ref character, ifPossible);
                break;
            }
            }
        }
示例#4
0
 public static void CharacterStatsAfterFight(ref ICharacters character, ref ICharacters opponent)
 {
     opponent.HitPoints   = 0;
     character.HitPoints  = 0;
     character.HitPoints += 100;
     opponent.HitPoints  += 100;
 }
示例#5
0
 public static void InDoors(ICharacters character)
 {
     if (CityMap.PositionX == 20 && CityMap.PositionY == 19)
     {
         BuildingMessages.BuldingMessage("Arena");
         Arena.FightInArena(character, OnInputWork.ChoiceHandler());
     }
     else if (CityMap.PositionX == 26 && CityMap.PositionY == 11)
     {
         BuildingMessages.BuldingMessage("WeaponSmith");
         Console.WriteLine("You have: " + character.Money + " money, " + character.Strength + " Strength!");
         List <CreatingItems> buildingitems = new List <CreatingItems>();
         buildingitems = ProductsInBuldings.GetWeaponsAvailable(character);
         Console.WriteLine(ProductsInBuldings.ShowProductsAvailable(buildingitems, "Strength"));
         WeaponShop.Weapon(character, buildingitems, OnInputWork.ChoiceHandler());
     }
     else if (CityMap.PositionX == 30 && CityMap.PositionY == 7)
     {
         BuildingMessages.BuldingMessage("ArmorSmith");
         Console.WriteLine("You have: " + character.Money + " money, " + character.Durability + " Durability!");
         List <CreatingItems> buildingitems = new List <CreatingItems>();
         buildingitems = ProductsInBuldings.GetArmorAvailable(character);
         Console.WriteLine(ProductsInBuldings.ShowProductsAvailable(buildingitems, "Durability"));
         ArmorSmith.Armor(character, buildingitems, OnInputWork.ChoiceHandler());
     }
     else if (CityMap.PositionX == 16 && CityMap.PositionY == 4)
     {
         BuildingMessages.BuldingMessage("Shop");
         Console.WriteLine("You have: " + character.Money + " money, " + character.Alchemics + " Alchemics!");
         List <CreatingItems> buildingitems = new List <CreatingItems>();
         buildingitems = ProductsInBuldings.GetShopAvailable(character);
         Console.WriteLine(ProductsInBuldings.ShowProductsAvailable(buildingitems, "Alchemics"));
         ItemShop.Item(character, buildingitems, OnInputWork.ChoiceHandler());
     }
 }
示例#6
0
        public static void SetTime(ICharacters character, string choice)
        {
            choice = choice.ToUpper();
            DateTime date = DateTime.Now;

            switch (choice)
            {
            case "ATTACK":
            {
                character.TimeForActions[0] = date.Minute;
                character.TimeForActions[1] = date.Second + 2;
                break;
            }

            case "SPELL":
            {
                character.TimeForActions[2] = date.Minute;
                character.TimeForActions[3] = date.Second + 4;
                break;
            }

            case "ITEMS":
            {
                character.TimeForActions[4] = date.Minute;
                character.TimeForActions[5] = date.Second + 10;
                break;
            }
            }
        }
示例#7
0
 private static ICharacters Item(ref ICharacters character)
 {
     if (character.ListOfItems.Count != 0)
     {
         int i = 1;
         Console.WriteLine("Choose one of items below:");
         foreach (int item in character.ListOfItems)
         {
             Console.WriteLine(i + ": " + item + " HP");
             i++;
         }
         Console.WriteLine("");
         int Choice = OnInputWork.ChoiceHandler();
         if (Choice <= character.ListOfItems.Count)
         {
             character.HitPoints += character.ListOfItems[Choice - 1];
             character.ListOfItems.RemoveAt(Choice - 1);
         }
         else
         {
             Console.WriteLine("Wrong number! Try again");
         }
     }
     else
     {
         Console.WriteLine("You don't have any items!");
         Thread.Sleep(500);
         Console.Clear();
     }
     return(character);
 }
示例#8
0
 public static void Buying(string choice, ICharacters character)
 {
     choice = choice.ToUpper();
     if (choice == "D")
     {
         CityMap.ShowMap(choice, character);
     }
 }
示例#9
0
        private static void Item(ref ICharacters opponent, ref ICharacters character)
        {
            Random rand          = new Random();
            int    requiredLevel = character.Level;
            int    choice        = rand.Next(10, 30);
            int    Min           = requiredLevel * choice;

            opponent.HitPoints += Min;
        }
示例#10
0
        public static void FightChoices(ref ICharacters character, ref ICharacters opponent, int ifPossible)
        {
            Console.Clear();
            character.Picture();
            Console.WriteLine("Character Hitpoints: " + character.HitPoints);
            opponent.Picture();
            Console.WriteLine("Opponent Hitpoints: " + opponent.HitPoints);
            var options = new Dictionary <string, Int32>
            {
                ["Attack"]           = 1,
                ["Item"]             = 3,
                ["Spells"]           = 2,
                ["Tactical retreat"] = 4
            };

            for (int i = 0; i < (27 * 2 + 2); i++)
            {
                Console.Write("=");
            }
            Console.Write("\n");
            for (int i = 0; i < options.Count; i += 2)
            {
                var items = options.Skip(i).Take(2);
                Console.Write("|");
                foreach (var item in items)
                {
                    Console.Write($"|{item.Value,3}||{item.Key,-20}|");
                }
                Console.Write("|\n");
            }
            for (int i = 0; i < (27 * 2 + 2); i++)
            {
                Console.Write("=");
            }
            Console.WriteLine("\n");

            if (character.HitPoints <= 0 || opponent.HitPoints <= 0)
            {
                Arena.AfterFight(ref character, ref opponent);
            }
            Console.WriteLine();
            if (ifPossible == 0)
            {
                Console.WriteLine("Fast to do, to fight must rest!");
            }
            //if (character.HitPoints <= 0 || opponent.HitPoints <= 0)
            //{?????????????????????????????

            //    Arena.FightLayout(character,opponent,false);

            //}
            int Choice;

            int.TryParse(Console.ReadLine(), out Choice);
            ChoicesOnFight.FightOptionsHandler(Choice, ref character, ref opponent, out ifPossible);
        }
示例#11
0
 private void OnSelectPrev()
 {
     characterSetsIdx--;
     if (characterSetsIdx < 0)
     {
         characterSetsIdx = characterSets.Length - 1;
     }
     Characters = characterSets [characterSetsIdx].Characters;
     shiftSet   = false;
 }
示例#12
0
        public Armor(ICharacters character, Random rand) : base(character, rand)
        {
            int requiredLevel = character.Level;

            this.Required      = requiredLevel * rand.Next(1, 4);
            this.RequiredLevel = requiredLevel;
            this.Price         = this.Required * 100 * rand.Next(80, 101) / 100;//Przykładowo randomowo to przecena
            this.Min           = this.Required * rand.Next(1, 5);
            this.Max           = this.Min;
        }
示例#13
0
 private void OnSelectNext()
 {
     characterSetsIdx++;
     if (characterSetsIdx >= characterSets.Length)
     {
         characterSetsIdx = 0;
     }
     Characters = characterSets [characterSetsIdx].Characters;
     shiftSet   = false;
 }
示例#14
0
        public Shop(ICharacters character, Random rand) : base(character, rand)
        {
            int requiredLevel = character.Level;

            this.Required      = requiredLevel * rand.Next(1, 4);
            this.RequiredLevel = requiredLevel;
            this.Price         = this.Required * 10 * rand.Next(80, 101) / 100;
            this.Min           = this.Required * rand.Next(10, 30);
            this.Max           = this.Min;
        }
示例#15
0
        public CreatingItems(ICharacters character, Random rand)
        {
            int requiredLevel = character.Level;

            this.Required      = requiredLevel * rand.Next(1, 4);
            this.RequiredLevel = requiredLevel;
            this.Price         = this.Required * 100 * rand.Next(80, 101) / 100;
            this.Min           = this.Required * rand.Next(1, 4);
            this.Max           = this.Required * rand.Next(4, 6);
        }
        public static void Durability(ICharacters character)
        {
            string wynik = "";

            for (int i = 0; character.Durability > i; i++)
            {
                wynik += '+';
            }
            wynik.Replace(Environment.NewLine, String.Empty);
            Console.WriteLine("1.Durability" + "(" + character.Durability + ")" + wynik);
        }
        public static void Intelligence(ICharacters character)
        {
            string wynik = "";

            for (int i = 0; character.Intelligence > i; i++)
            {
                wynik += '+';
            }
            wynik.Replace(Environment.NewLine, String.Empty);
            Console.WriteLine("2.Inteligence" + "(" + character.Intelligence + ")" + wynik);
        }
        public static void Skill(ICharacters character)
        {
            string wynik = "";

            for (int i = 0; character.Alchemics > i; i++)
            {
                wynik += '+';
            }
            wynik.Replace(Environment.NewLine, String.Empty);
            Console.WriteLine("3.Skill" + "(" + character.Alchemics + ")" + wynik);
        }
        public static void Strength(ICharacters character)
        {
            string wynik = "";

            for (int i = 0; character.Strength > i; i++)
            {
                wynik += '+';
            }
            wynik.Replace(Environment.NewLine, String.Empty);
            Console.WriteLine("4.Strength" + "(" + character.Strength + ")" + wynik);
        }
示例#20
0
        public static void FightInArena(ICharacters myHero, int choice)
        {
            switch (choice)
            {
            case 1:
            {
                ICharacters opponent;
                int         enemy = Arena.TypeOfEnemy(3);
                if (enemy == 1)
                {
                    opponent = new OpponentDracula(myHero.Level);
                }
                else if (enemy == 2)
                {
                    opponent = new OpponentDragon(myHero.Level);
                }
                else if (enemy == 3)
                {
                    opponent = new OpponentRay(myHero.Level);
                }
                else
                {
                    opponent = new OpponentDracula(myHero.Level);
                }
                Arena.FightLayout(myHero, opponent, true);
                break;
            }

            case 2:
            {
                ICharacters opponent;
                opponent = new ThreeHeadedDragon(16);
                if (myHero.Level >= opponent.Level && myHero.Money >= opponent.RequiredMoney)
                {
                    Arena.FightLayout(myHero, opponent, true);
                }
                else
                {
                    Console.WriteLine("You are not allowed to enter there. You have to have the " + opponent.Level + " and " + opponent.RequiredMoney + " money");
                    Thread.Sleep(2000);
                    CityMap.ShowMap(myHero);
                }
                break;
            }

            default:
            {
                Console.WriteLine();
                Console.WriteLine("You chose life!");
                Console.WriteLine();
                break;
            }
            }
        }
        public static void FightChoices(ref ICharacters opponent, ref ICharacters character, int ifPossible)
        {
            if (character.HitPoints <= 0 || opponent.HitPoints <= 0)
            {
                Arena.FightLayout(character, opponent, false);
            }
            Random Rand0  = new Random();
            int    choice = Rand0.Next(1, 4);

            ChoicesOnFightOpponent.FightOptionsHandler(choice, ref opponent, ref character, out ifPossible);
        }
        public static int LuckAction(ICharacters character)
        {
            Random rand = new Random();

            if (rand.Next(0, (int)Math.Pow(10, 9)) > ((100 - character.Luck) * (int)Math.Pow(10, 7)))
            {
                return(0);
            }
            else
            {
                return(1);
            }
        }
示例#23
0
 private void OnShift()
 {
     if (shiftSet)
     {
         Characters = characterSets [characterSetsIdx].Characters;
         shiftSet   = false;
     }
     else if (characterSets [characterSetsIdx].ShiftCharacters != null)
     {
         Characters = characterSets [characterSetsIdx].ShiftCharacters;
         shiftSet   = true;
     }
 }
示例#24
0
        public static ICharacters Spell(ref ICharacters character, ref ICharacters opponent)
        {
            int    AttackDealt;
            int    HitPointsDefender;
            Random rand = new Random();

            AttackDealt       = OffensiveActions.IntelligenceAction(character);
            HitPointsDefender = opponent.HitPoints;
            int damage = AttackDealt * DefenseActions.LuckAction(opponent);

            opponent.HitPoints = HitPointsDefender - damage;
            Console.WriteLine("You take him:" + damage);
            return(opponent);
        }
示例#25
0
        public static void Choice(ICharacters character)
        {
            Console.Clear();
            int origWidth = 110;

            origWidth = Console.WindowWidth;
            string k = "At the start of the game you have: " + character.AmountOfAtributes + " atributes to alocate.";
            string g = "                         You will get atributes also when you will win fight with opponent.";

            Console.WriteLine("\n\n\n\n\n\n\n\n\n\n\n\n\n");
            Console.SetCursorPosition((origWidth - k.Length) / 2, Console.CursorTop);
            Console.WriteLine(k + "\n" + g);
            Console.ReadKey();
            Increase.Add(character);
        }
示例#26
0
 public static void ShowMap(string choice, ICharacters character)
 {
     Console.Clear();
     string[,] GameMap = new string[width, height];
     GameMap           = CityMap.GenerateMap(out width, out height, out PositionX, out PositionY);
     for (int i = 0; i < height; i++)
     {
         for (int j = 0; j < width; j++)
         {
             Console.Write(GameMap[j, i]);
         }
         Console.WriteLine();
     }
     CityMap.MovingHandler(choice, character);
 }
        public static ICharacters Spell(ref ICharacters character, ref ICharacters opponent)
        {
            int    AttackDealt;
            int    HitPointsDefender;
            Random rand = new Random();

            AttackDealt       = OffensiveActionsOpponent.IntelligenceAction(opponent);
            HitPointsDefender = character.HitPoints;
            if (DefenseActionsOpponent.ArmorAction(character) > AttackDealt)
            {
                character.HitPoints = HitPointsDefender - 10;
            }
            else
            {
                character.HitPoints = HitPointsDefender - ((AttackDealt) * DefenseActionsOpponent.LuckAction(character));
            }
            return(character);
        }
示例#28
0
        public static List <CreatingItems> GetShopAvailable(ICharacters character)
        {
            Random rand = new Random();
            List <CreatingItems> items = new List <CreatingItems>();
            Shop FirstItem             = new Shop(character, rand);

            items.Add(FirstItem);
            Shop SecondItem = new Shop(character, rand);

            items.Add(SecondItem);
            Shop ThirdItem = new Shop(character, rand);

            items.Add(ThirdItem);
            Shop FourhtItem = new Shop(character, rand);

            items.Add(FourhtItem);
            return(items);
        }
示例#29
0
        public static List <CreatingItems> GetArmorAvailable(ICharacters character)
        {
            Random rand = new Random();
            List <CreatingItems> items = new List <CreatingItems>();
            Armor FirstItem            = new Armor(character, rand);

            items.Add(FirstItem);
            Armor SecondItem = new Armor(character, rand);

            items.Add(SecondItem);
            Armor ThirdItem = new Armor(character, rand);

            items.Add(ThirdItem);
            Armor FourhtItem = new Armor(character, rand);

            items.Add(FourhtItem);
            return(items);
        }
示例#30
0
        public static List <CreatingItems> GetWeaponsAvailable(ICharacters character)
        {
            Random rand = new Random();
            List <CreatingItems> items = new List <CreatingItems>();
            Weapon FirstItem           = new Weapon(character, rand);

            items.Add(FirstItem);
            Weapon SecondItem = new Weapon(character, rand);

            items.Add(SecondItem);
            Weapon ThirdItem = new Weapon(character, rand);

            items.Add(ThirdItem);
            Weapon FourhtItem = new Weapon(character, rand);

            items.Add(FourhtItem);
            return(items);
        }
示例#31
0
		private void OnSelectNext()
		{
			characterSetsIdx++;
			if (characterSetsIdx >= characterSets.Length) {
				characterSetsIdx = 0;	
			}
			Characters = characterSets [characterSetsIdx].Characters;
			shiftSet = false;
		}
示例#32
0
		private void OnShift()
		{
			if (shiftSet)
			{
				Characters = characterSets [characterSetsIdx].Characters;
				shiftSet = false;
			} 
			else if(characterSets [characterSetsIdx].ShiftCharacters != null)
			{
				Characters = characterSets [characterSetsIdx].ShiftCharacters;
				shiftSet = true;
			}
		}
示例#33
0
		private void OnSelectPrev()
		{
			characterSetsIdx--;
			if (characterSetsIdx < 0) {
				characterSetsIdx = characterSets.Length - 1;	
			}
			Characters = characterSets [characterSetsIdx].Characters;
			shiftSet = false;
		}