Example #1
0
        public void GiocatoriCasuali()
        {
            RandomFiller.RandomFiller rndfl = new RandomFiller.RandomFiller();
            Player uno = new Player(rndfl.getName(),rndfl.getSurname(),rndfl.getAge(),rndfl.getAvgSkill(),rndfl.getRole());
            Console.WriteLine(uno.ToString());

        }
Example #2
0
 public void TestValoreGiocatoriReali()
 {
     Player giocatore = new Player("Paul", "Pogba", 21, 79, "CC", "Francese");
     Console.WriteLine(giocatore.ToString());
     giocatore = new Player("Arturo", "Vidal", 28, 85, "CC", "Cileno");
     Console.WriteLine(giocatore.ToString());
     giocatore = new Player("Lionel", "Messi", 27, 95, "AS", "Argentino");
     Console.WriteLine(giocatore.ToString());
     giocatore = new Player("Robin", "VanPersie", 31, 89, "AC", "Olandese");
     Console.WriteLine(giocatore.ToString());
     giocatore = new Player("Alvaro", "Morata", 22, 76, "AC", "Spagnolo");
     Console.WriteLine(giocatore.ToString());
 }
Example #3
0
 public void TestCTORPlayerConNazionalitaDiverse()
 {
     RandomFiller.RandomFiller rnd = new RandomFiller.RandomFiller();
     Player pl = new Player(rnd.getName("Spain"), rnd.getSurname("Spain"),rnd.getAge(),rnd.getAvgSkill(),"Spain");
     Console.WriteLine(pl.ToString());
 }
 private void trytobuy(Player cpl, Team cteam)
 {
     Console.Clear();
     Console.WriteLine("Trying to buy "+cpl.ToString()+" from "+ cteam.TeamName);
     double req = Math.Round((cpl.Val + (GameUtils.getWage(0, 5))), 2);
     Console.WriteLine("\t they asked: "+req+" M Euro\n your offer [money owned: "+money+" M euro] > ");
     double off = MyConsole.AskForDouble(money);
     if (off <= money && off>0)
     {
         Console.WriteLine(off+"M euro ...offert sent..");
         GameUtils.wait(1000);
         Console.WriteLine("Offert received...");
         Console.Write("...We are thinking about it...");
         GameUtils.wait(1000);
         Random rnd = new Random();
         if (off - req > 10)
         {
             Console.WriteLine("we accept your generous offer...");
             Player tmp = cteam.popPlayer(cpl);
             plt.addPlayer(tmp);
             Console.WriteLine("\t you hired " + tmp.ToString() + " ");
             report("+ " + cpl.ToStringShort() + " - val: " + cpl.Val + " - off: " + off + " M euro, from "+cteam.TeamName,bought);
             checkrecordbought(cpl.ToStringShort() + " - val: " + cpl.Val + " - off: " + off + " M euro, from " + cteam.TeamName, off);
             money -= off;
         }
         else if (off >= req)
         {
             if (rnd.Next(100) > 20)
             {
                 Console.WriteLine("we accept your offer...");
                 Player tmp = cteam.popPlayer(cpl);
                 plt.addPlayer(tmp);
                 Console.WriteLine("\t you hired "+tmp.ToString()+" ");
                 report("+ " + cpl.ToStringShort() + " - val: " + cpl.Val + " - off: " + off + " M euro, from " + cteam.TeamName,bought);
                 checkrecordbought(cpl.ToStringShort() + " - val: " + cpl.Val + " - off: " + off + " M euro, from " + cteam.TeamName, off);
                 money -= off;
             }
             else
             {
                 Console.WriteLine("We refuse your offer...");
             }
         }
         else
         {
             if (rnd.Next(100) > 50)
             {
                 Console.WriteLine("we accept your offer...");
                 Player tmp = cteam.popPlayer(cpl);
                 plt.addPlayer(tmp);
                 Console.WriteLine("\t you hired " + tmp.ToString() + " ");
                 report("+ " + cpl.ToStringShort() + " - val: " + cpl.Val + " - off: " + off + " M euro, from " + cteam.TeamName,bought);
                 checkrecordbought(cpl.ToStringShort() + " - val: " + cpl.Val + " - off: " + off + " M euro, from " + cteam.TeamName, off);
                 money -= off;
             }
             else
             {
                 Console.WriteLine("We refuse your offer...");
             }
         }
     }else if(off<=0){
         Console.WriteLine("We kindly refuse your shitty offer");
     }
     else
     {
         Console.WriteLine("You dont have enough money...");
     }
     EnterToContinue();
 }
        private void trytobuy(Player cpl,bool fromyouth = false)
        {
            Console.Clear();
            Console.WriteLine("Trying to buy " + cpl.ToString() + " from  FreePlayers List");
            double req = Math.Round((cpl.Val * 0.3 + (GameUtils.getWage(0, 5))), 2);
            Console.WriteLine("\t He asked: " + req + " M Euro\n your offer [money owned: " + money + " M euro] ");
            double off = MyConsole.AskForDouble(money);
            if (off <= money)
            {
                Console.WriteLine(off + "M euro ...offert sent..");
                GameUtils.wait(1000);
                Console.WriteLine("Offert received...");
                Console.Write("...I am thinking about it...");
                GameUtils.wait(1000);
                Random rnd = new Random();
                if (off >= req)
                {
                    if (rnd.Next(100) > 5)
                    {
                        Console.WriteLine("I accept your offer...");
                        //Player tmp = cteam.popPlayer(cpl);
                        plt.addPlayer(cpl);
                        Console.WriteLine("\t you hired " + cpl.ToString() + " ");
                        if (!fromyouth)
                        {
                            
                            report("+ " + cpl.ToStringShort() + " - val: " + cpl.Val + " - off: " + off + " M euro, Parametro 0", bought);
                            checkrecordbought(cpl.ToStringShort() + " - val: " + cpl.Val + " - off: " + off + " M euro, Parametro 0", off);
                        }
                        else
                        {
                            report("+ " + cpl.ToStringShort() + " - val: " + cpl.Val + " - off: " + off + " M euro, from YouthClub", bought);
                            checkrecordbought(cpl.ToStringShort() + " - val: " + cpl.Val + " - off: " + off + " M euro, from YouthClub", off);
                        }

                        money -= off;
                    }
                    else
                    {
                        Console.WriteLine("I refuse your offer...");
                    }
                }
                else
                {
                    if (rnd.Next(100) > 50)
                    {
                        Console.WriteLine("I accept your offer...");
                       // Player tmp = cteam.popPlayer(cpl);
                        plt.addPlayer(cpl);
                        Console.WriteLine("\t you hired " + cpl.ToString() + " ");
                        if (!fromyouth)
                        {
                            checkrecordbought(cpl.ToStringShort() + " - val: " + cpl.Val + " - off: " + off + " M euro, Parametro 0", off);
                            report("+ " + cpl.ToStringShort() + " - val: " + cpl.Val + " - off: " + off + " M euro, Parametro 0", bought);
                        }
                        else
                        {
                            report("+ " + cpl.ToStringShort() + " - val: " + cpl.Val + " - off: " + off + " M euro, from YouthClub", bought);
                            checkrecordbought(cpl.ToStringShort() + " - val: " + cpl.Val + " - off: " + off + " M euro, from YouthClub", off);
                        }
                        money -= off;
                    }
                    else
                    {
                        Console.WriteLine("I refuse your offer...");
                    }
                }
            }
            else if (off <= 0)
            {
                Console.WriteLine("I kindly refuse your shitty offer");
            }
            else
            {
                Console.WriteLine("You dont have enough money...");
            }

            EnterToContinue();
        }