示例#1
0
 public override bool Equals(System.Object otherMon)
 {
     if (!(otherMon is Mon))
     {
         return(false);
     }
     else
     {
         Mon  newMon            = (Mon)otherMon;
         bool idEquality        = this.GetMonId().Equals(newMon.GetMonId());
         bool nameEquality      = this.GetMonName().Equals(newMon.GetMonName());
         bool hitpointsEquality = this.GetHitpoints().Equals(newMon.GetHitpoints());
         bool attackEquality    = this.GetAttack().Equals(newMon.GetAttack());
         bool defenseEquality   = this.GetDefense().Equals(newMon.GetMonName());
         bool spattackEquality  = this.GetSpecialattack().Equals(newMon.GetSpecialattack());
         bool spdefenseEquality = this.GetSpecialdefense().Equals(newMon.GetSpecialdefense());
         bool speedEquality     = this.GetSpeed().Equals(newMon.GetSpeed());
         return(idEquality && nameEquality && hitpointsEquality && attackEquality && defenseEquality && spattackEquality && spdefenseEquality && speedEquality);
     }
 }
示例#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();
     }
 }