Exemplo n.º 1
0
        public virtual Punch DoPunch()
        {
            Punch punch;

            if (Punches.Count == 0)
            {
                punch = Punch.Create(PunchType.In);
            }
            else
            {
                var lastPunch = Punches
                                .OrderByDescending(p => p.DateAdded)
                                .Last(p => p.DateAdded.Date == DateTime.Now.Date);

                if (lastPunch.DateAdded.Minute == DateTime.Now.Minute)
                {
                    throw new InvalidOperationException("Cannot punch in the same minute");
                }

                punch = Punch.Create(lastPunch.Type == PunchType.In ? PunchType.Out : PunchType.In);
            }

            Punches.Add(punch);
            return(punch);
        }
Exemplo n.º 2
0
 public int CombatCheck(Punches userPunches, Punches comPunches)
 {
     if (userPunches == Punches.Jab && comPunches == Punches.Hook)
     {
         return(1);
     }
     else if (userPunches == Punches.Hook && comPunches == Punches.Uppercut)
     {
         return(1);
     }
     else if (userPunches == Punches.Uppercut && comPunches == Punches.Jab)
     {
         return(1);
     }
     else if (userPunches == Punches.Hook && comPunches == Punches.Jab)
     {
         return(2);
     }
     else if (userPunches == Punches.Jab && comPunches == Punches.Uppercut)
     {
         return(2);
     }
     else if (userPunches == Punches.Uppercut && comPunches == Punches.Hook)
     {
         return(2);
     }
     else
     {
         return(0);
     }
 }
Exemplo n.º 3
0
    IEnumerator DoFarAttack()
    {
        HitType = Punches.FarAttack;
        attackHitBox.SetActive(true);
        yield return(new WaitForSeconds(3f));

        attackHitBox.SetActive(false);

        isAttacking = false;
    }
Exemplo n.º 4
0
    IEnumerator DoHeavyPunch()
    {
        HitType = Punches.Heavy;
        attackHitBox.SetActive(true);
        yield return(new WaitForSeconds(1f));

        attackHitBox.SetActive(false);

        isAttacking = false;
    }
Exemplo n.º 5
0
    IEnumerator DoWeakPunch()
    {
        HitType = Punches.Weak;
        attackHitBox.SetActive(true);
        yield return(new WaitForSeconds(0.7f));

        attackHitBox.SetActive(false);

        isAttacking = false;
    }
Exemplo n.º 6
0
        protected override void Unfold()
        {
            Height *= 2;

            var lastRow          = Height - 1;
            var reflectedPunches = new List <Coordinate>();

            foreach (var punch in Punches)
            {
                var reflectedPunch = new Coordinate(punch.X, lastRow - punch.Y);
                reflectedPunches.Add(reflectedPunch);
            }

            Punches.AddRange(reflectedPunches);
        }
Exemplo n.º 7
0
        protected override void Unfold()
        {
            Width *= 2;

            var lastColumn       = Width - 1;
            var reflectedPunches = new List <Coordinate>();

            foreach (var punch in Punches)
            {
                var reflectedPunch = new Coordinate(lastColumn - punch.X, punch.Y);
                reflectedPunches.Add(reflectedPunch);
            }

            Punches.AddRange(reflectedPunches);
        }
Exemplo n.º 8
0
        protected override void Unfold()
        {
            var newHeight        = Height * 2;
            var newLastRow       = newHeight - 1;
            var reflectedPunches = new List <Coordinate>();

            foreach (var punch in Punches)
            {
                punch.Y += Height;
                var reflectedPunch = new Coordinate(punch.X, newLastRow - punch.Y);
                reflectedPunches.Add(reflectedPunch);
            }

            Height = newHeight;

            Punches.AddRange(reflectedPunches);
        }
Exemplo n.º 9
0
        protected override void Unfold()
        {
            var newWidth         = Width * 2;
            var newLastColumn    = newWidth - 1;
            var reflectedPunches = new List <Coordinate>();

            foreach (var punch in Punches)
            {
                punch.X += Width;
                var reflectedPunch = new Coordinate(newLastColumn - punch.X, punch.Y);
                reflectedPunches.Add(reflectedPunch);
            }

            Width = newWidth;

            Punches.AddRange(reflectedPunches);
        }
Exemplo n.º 10
0
        public string WhoWon(Punches player, Punches comp, string enemy, int victor)
        {
            string winner;

            switch (victor)
            {
            case 0:
                winner = "No one";
                break;

            case 1:
                winner = "You";
                break;

            case 2:
                winner = enemy;
                break;

            default:
                winner = "everyone";
                break;
            }
            return($"You threw a {player}, {enemy} threw a {comp}, {winner} wins this round");
        }
Exemplo n.º 11
0
        public override void AI()
        {
            projectile.netUpdate = true;

            if (projectile.timeLeft % 4 == 0)
            {
                projectile.GetGlobal().HitRoadRollerInLifeTime = false;
            }

            if (projectile.timeLeft > 10)
            {
                LastPosition = Parent.Center;
                Main.player[projectile.owner].heldProj = projectile.whoAmI;

                if (Punches.Count < 10 && TexturePath != null)
                {
                    Punches.Add(new FakePunchData(TexturePath, AltTexturePath));
                }
            }
            else
            {
                projectile.damage = 0;
            }

            projectile.Center = LastPosition + projectile.velocity;

            for (int i = Punches.Count - 1; i >= 0; i--)
            {
                Punches[i].Update();

                if (!Punches[i].Active)
                {
                    Punches.RemoveAt(i);
                }
            }
        }
Exemplo n.º 12
0
 public void InitNextRound()
 {
     FightStats.Add(new FightStats()); //Add new stat page for the round
     Punches.Add(new List <Block.PunchResult>());
 }
Exemplo n.º 13
0
        public void Fight()
        {
            while (firstOpponent.OppHealth > 0 && currentPlayer.MyHealth > 0)
            {
                Punches userPunch = _combatAI.UserPunch();
                Punches compPunch = _combatAI.ComputerPunch();
                int     victor    = _combatAI.CombatCheck(userPunch, compPunch);
                Console.Clear();
                Console.WriteLine(_combatAI.WhoWon(userPunch, compPunch, firstOpponent.OppName, victor));

                if (victor == 1)
                {
                    Console.WriteLine();
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine($"{currentPlayer.MyName} landed a hit on {firstOpponent.OppName}");
                    Console.ResetColor();
                    Console.WriteLine();
                    Console.WriteLine($"{firstOpponent.OppName}'s Health Remaining {firstOpponent.OppHealth -= 1}");
                    Console.WriteLine();
                    Console.WriteLine($"{currentPlayer.MyName}'s Health Remaining {currentPlayer.MyHealth}");
                    Console.WriteLine();
                }

                else if (victor == 2)
                {
                    Console.WriteLine();
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine($"{firstOpponent.OppName} landed a hit on {currentPlayer.MyName}");
                    Console.ResetColor();
                    Console.WriteLine();
                    Console.WriteLine($"{firstOpponent.OppName}'s Health Remaining {firstOpponent.OppHealth}");
                    Console.WriteLine();
                    Console.WriteLine($"{currentPlayer.MyName}'s Health Remaining {currentPlayer.MyHealth -= 1}");
                    Console.WriteLine();
                }

                else
                {
                    Console.WriteLine();
                    Console.ForegroundColor = ConsoleColor.Blue;
                    Console.WriteLine("Lots of moving air");
                    Console.ResetColor();
                    Console.WriteLine();
                    Console.WriteLine($"{firstOpponent.OppName}'s Health Remaining {firstOpponent.OppHealth}");
                    Console.WriteLine();
                    Console.WriteLine($"{currentPlayer.MyName}'s Health Remaining {currentPlayer.MyHealth}");
                    Console.WriteLine();
                }

                if (firstOpponent.OppHealth <= 0)
                {
                    Console.WriteLine();
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine($"You knocked {firstOpponent.OppName} clean out!!!");
                    Console.ResetColor();
                    Console.WriteLine();
                    Console.ReadLine();

                    if (firstOpponent.OppName == "Nick")
                    {
                        Console.WriteLine();
                        Console.WriteLine("'You can LOOK, but you can't TOUCH MY BEARD... GRAWL!'");
                        firstOpponent = new Opponent("Adam", 1, 3);
                        Console.Clear();
                        Console.WriteLine("Announcer - 'Touch gloves and let's get it on'");
                        Console.WriteLine();
                        Console.WriteLine($"You touched gloves with {firstOpponent.OppName}, now throw a punch");
                        Console.WriteLine();
                        Console.WriteLine("(J)ab , (H)ook , or (U)ppercut");
                        Console.WriteLine();
                    }
                    else if (firstOpponent.OppName == "Adam")
                    {
                        Console.WriteLine();
                        Console.WriteLine("'The fencers cut my INTERNET WIRE... AHHHH!'");
                        firstOpponent = new Opponent("Michael", 1, 4);
                        Console.Clear();
                        Console.WriteLine("Announcer - 'Touch gloves and let's get it on'");
                        Console.WriteLine();
                        Console.WriteLine($"You touched gloves with {firstOpponent.OppName}, now throw a punch");
                        Console.WriteLine();
                        Console.WriteLine("(J)ab , (H)ook , or (U)ppercut");
                        Console.WriteLine();
                    }
                    else if (firstOpponent.OppName == "Michael")
                    {
                        Console.WriteLine();
                        Console.WriteLine("'You could also do it.... THIS WAY!! ...just a suggestion.'");
                        firstOpponent = new Opponent("Jacob", 1, 5);
                        Console.Clear();
                        Console.WriteLine("Announcer - 'Touch gloves and let's get it on'");
                        Console.WriteLine();
                        Console.WriteLine($"You touched gloves with {firstOpponent.OppName}, now throw a punch");
                        Console.WriteLine();
                        Console.WriteLine("(J)ab , (H)ook , or (U)ppercut");
                        Console.WriteLine();
                    }
                    else if (firstOpponent.OppName == "Jacob")
                    {
                        Console.WriteLine();
                        Console.WriteLine("'Nanu nanu weakling, I'm a STAR TREK FAN not a STAR WARS FAN...! '");
                        firstOpponent = new Opponent("Andrew", 1, 6);
                        Console.Clear();
                        Console.WriteLine("Announcer - 'Touch gloves and let's get it on'");
                        Console.WriteLine();
                        Console.WriteLine($"You touched gloves with {firstOpponent.OppName}, now throw a punch");
                        Console.WriteLine();
                        Console.WriteLine("(J)ab , (H)ook , or (U)ppercut");
                        Console.WriteLine();
                    }
                    else if (firstOpponent.OppName == "Andrew")
                    {
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine($"Wow {currentPlayer.MyName}, you should consider yourself lucky to have gotten here! You've taken down EFA's toughest instructors! Congratulations on your victory! Go play the lottery or something because seriously, your luck is insane!");
                        Console.ResetColor();
                        Console.WriteLine();
                        Console.WriteLine("If you want to prove yourself again, reset in the main menu and fight again starting with Nick.");
                    }
                    else
                    {
                    }
                }

                else if (currentPlayer.MyHealth <= 0)
                {
                    Console.Clear();
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine($"{firstOpponent.OppName} gave you a run for your money! That was some nap you took {currentPlayer.MyName}. Better LUCK next time.");
                    Console.ResetColor();
                    Console.WriteLine();
                    Console.WriteLine($"Stand up {currentPlayer.MyName}! He knocked you down but you're still in this fight!!");
                    Console.WriteLine();
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine("'Choose Start Fight To Continue'");
                    Console.ResetColor();
                    Console.ReadLine();
                }

                else
                {
                }
            }

            currentPlayer = new Player("", 1, 10);
        }