예제 #1
0
        public Attack EnemyTransformation()
        {
            Random transformGen = new Random();
            int    transformInt = transformGen.Next(100);

            if (transformInt < 10)
            {
                //Slumpar bara om den har möjlighet att göra någon transformation
                if (opponentChar.Specials > 0 && opponentCanDoBehavior == true)
                {
                    transformInt = transformGen.Next(0, 3);
                }
                else if (opponentChar.Specials == 0)
                {
                    transformInt = 0;
                }
                else if (opponentCanDoBehavior == false)
                {
                    transformInt = transformGen.Next(1, 3);
                }

                //Instansierar attackens transformationer
                opponentAttack.Transform();


                if (transformInt == 0)
                {
                    Console.WriteLine("Your enemy chose to transform their " + opponentAttack.name + " into a " + opponentChar.behaviorAttack.name);
                    opponentAttack = opponentChar.behaviorAttack;
                }
                else if (transformInt == 1)
                {
                    Console.WriteLine("Your opponent chose to transform their " + opponentAttack.name + " into a " + opponentAttack.firstTransform.name);
                    opponentAttack = opponentAttack.firstTransform;
                }
                else
                {
                    Console.WriteLine("Your opponent chose to transform their " + opponentAttack.name + " into a " + opponentAttack.secondTransform.name);
                    opponentAttack = opponentAttack.secondTransform;
                }
            }
            else
            {
                Console.WriteLine("Your opponent chose not to transform!");
            }

            return(opponentAttack);
        }
예제 #2
0
        //Gränsnitt och metodik över ifall spelaren ska transformera sin attack
        public Attack YourTransformation()
        {
            Console.WriteLine("");
            Console.WriteLine("Do you wanna transform your attack?");

            //Skriver ut specialattacken eller att man inte kan använda den
            yourChar.BehaviorSpecial(canDoBehavior);

            //instansierar den valda attackens vanliga transformationer
            yourAttack.Transform();

            //Skriver ut transformationerna eller att man inte kan använda de
            yourAttack.Transformations(yourChar.specials);



            //Choose transformation

            string transform = Console.ReadLine();
            int    transformIndex;
            bool   transformSuccess = int.TryParse(transform, out transformIndex);

            if (transformSuccess == false || transformIndex > 3 || transformIndex < 1)
            {
                Console.WriteLine("You chose not to transform!");
            }
            //ifall man valde att använda sin behaviorAttack
            else if (transformIndex == 1)
            {
                if (canDoBehavior == true)
                {
                    Console.WriteLine("You chose to transform your " + yourAttack.name + " into a " + yourChar.behaviorAttack.name);
                    yourAttack = yourChar.behaviorAttack;

                    //Kan bara köras en gång per match
                    canDoBehavior = false;
                }
                else
                {
                    Console.WriteLine("You have already used your Behavior transformation for this game!");
                }
            }
            //om man valde någon av sina vanliga transformations
            else if (yourChar.specials > 0)
            {
                if (transformIndex == 2)
                {
                    Console.WriteLine("You chose to transform your " + yourAttack.name + " into a " + yourAttack.firstTransform.name);
                    yourAttack = yourAttack.firstTransform;

                    //En get-set som subtraherar 1 till en int, om den når 0 kan man inte använda den igen.
                    yourChar.Specials = 1;
                }
                else if (transformIndex == 3)
                {
                    Console.WriteLine("You chose to transform your " + yourAttack.name + " into a " + yourAttack.secondTransform.name);
                    yourAttack        = yourAttack.secondTransform;
                    yourChar.Specials = 1;
                }
            }
            else if (yourChar.specials == 0 && (transformIndex == 2 || transformIndex == 3))
            {
                Console.WriteLine("You have already used this fighter's 2 transformations!");
            }


            return(yourAttack);
        }