Example #1
0
        public static void ComputerSequence2(int id, Move computerMove)
        {
            Battle  player      = Battle.FindPlayer();
            Battle  computer    = Battle.FindComputer();
            Mon     playerMon   = Mon.Find(player.GetMon_Id());
            Mon     computerMon = Mon.Find(computer.GetMon_Id());
            Move    playerMove  = Move.Find(id);
            Message newMessage  = new Message(computerMove.GetDescription());

            newMessage.Save();
            double otherHP      = (double)player.GetHitpoints() - (double)Battle.Damage(computerMove, computer, computerMon, playerMon);
            int    roundOtherHP = (int)otherHP;

            if (roundOtherHP > 0)
            {
                player.SetNewHP(roundOtherHP);
            }
            else
            {
                player.SetNewHP(0);
            }
        }
Example #2
0
 public static void ComputerChoice(int MonId)
 {
     if (MonId == 1)
     {
         Mon    mon2     = Mon.Find(2);
         Battle computer = mon2.GetAllTrueStats();
         computer.Save();
         computer.SetComputerMon();
         computer.SetActiveMon();
     }
     else if (MonId == 2)
     {
         Mon    mon3     = Mon.Find(3);
         Battle computer = mon3.GetAllTrueStats();
         computer.Save();
         computer.SetComputerMon();
         computer.SetActiveMon();
     }
     else if (MonId == 3)
     {
         Mon    mon1     = Mon.Find(1);
         Battle computer = mon1.GetAllTrueStats();
         computer.Save();
         computer.SetComputerMon();
         computer.SetActiveMon();
     }
     else if (MonId > 3)
     {
         List <Mon> allMons   = Mon.GetAllMons();
         Random     rand      = new Random();
         Mon        chosenMon = Mon.Find(rand.Next(allMons.Count));
         Console.WriteLine(chosenMon.GetMonName());
         Battle computer = chosenMon.GetAllTrueStats();
         computer.Save();
         computer.SetComputerMon();
         computer.SetActiveMon();
     }
 }
Example #3
0
        public static void Sequence(int id)
        {
            Battle      player        = Battle.FindPlayer();
            Battle      computer      = Battle.FindComputer();
            Mon         playerMon     = Mon.Find(player.GetMon_Id());
            Mon         computerMon   = Mon.Find(computer.GetMon_Id());
            Move        playerMove    = Move.Find(id);
            List <Move> computerMoves = Mon.Find(computer.GetMon_Id()).GetMoves();
            Random      move          = new Random();
            Move        computerMove  = computerMoves[move.Next(computerMoves.Count)];

            //Speed Check
            int tie = 0;

            if (computer.GetSpeed() == player.GetSpeed())
            {
                Random speedTie = new Random();
                tie = speedTie.Next(1, 3);
            }
            if (player.GetSpeed() > computer.GetSpeed() || tie == 1)
            {
                double newHP   = (double)computer.GetHitpoints() - (double)Battle.BaseDamage(player.GetBattleId(), playerMove) * (double)MonType.TypeMultiplier(computerMon, playerMove) * (double)MonType.STABMultiplier(playerMon, playerMove) * (double)playerMove.AccuracyMultiplier() * (double)Battle.CritMultiplier();
                int    roundHP = (int)newHP;
                if (roundHP > 0)
                {
                    computer.SetNewHP(roundHP);
                    double otherHP      = (double)player.GetHitpoints() - (double)Battle.BaseDamage(player.GetBattleId(), computerMove) * (double)MonType.TypeMultiplier(playerMon, computerMove) * (double)MonType.STABMultiplier(computerMon, computerMove) * (double)computerMove.AccuracyMultiplier() * (double)Battle.CritMultiplier();
                    int    roundOtherHP = (int)otherHP;

                    if (roundOtherHP > 0)
                    {
                        player.SetNewHP(roundOtherHP);
                    }
                    else
                    {
                        player.SetNewHP(0);
                    }
                }
                else
                {
                    computer.SetNewHP(0);
                }
            }
            else if (player.GetSpeed() < computer.GetSpeed() || tie == 2)
            {
                double otherHP      = (double)player.GetHitpoints() - (double)Battle.BaseDamage(computer.GetBattleId(), computerMove) * (double)MonType.TypeMultiplier(playerMon, computerMove) * (double)MonType.STABMultiplier(playerMon, playerMove) * (double)playerMove.AccuracyMultiplier() * (double)Battle.CritMultiplier();
                int    roundOtherHP = (int)otherHP;

                if (roundOtherHP > 0)
                {
                    player.SetNewHP(roundOtherHP);
                    double newHP   = (double)computer.GetHitpoints() - (double)Battle.BaseDamage(player.GetBattleId(), playerMove) * (double)MonType.TypeMultiplier(computerMon, playerMove) * (double)MonType.STABMultiplier(computerMon, computerMove) * (double)computerMove.AccuracyMultiplier();
                    int    roundHP = (int)newHP;
                    if (roundHP > 0)
                    {
                        computer.SetNewHP(roundHP);
                    }
                    else
                    {
                        computer.SetNewHP(0);
                    }
                }
                else
                {
                    player.SetNewHP(0);
                }
            }
        }