예제 #1
0
 public void GameStart()
 {
     while (jackpot == -1)
     {
         Console.Write("Enter Jackpot: ");
         if (int.TryParse(Console.ReadLine(), out jackpot))
         {
             Console.WriteLine("Jackpot Set To: " + Gambling.FormatMoney(jackpot));
         }
     }
 }
예제 #2
0
    int Generate()
    {
        string result = "[Scratch Card #" + currentID + "] | ";

        currentID++;

        int[] payout = new int[3];

        Random rand = new Random();

        for (int i = 0; i < payout.Length; i++)
        {
            int highest = 0;
            int lowest  = jackpot;
            foreach (KeyValuePair <int, int> prize in possibilities)
            {
                int value  = prize.Key;
                int chance = prize.Value;
                int random = rand.Next(0, chance);

                if (lowest > value)
                {
                    lowest = value;
                }

                if (random == 0 && value > highest)
                {
                    highest = value;
                }
            }

            // If no prize was won, automatically switch to lowest
            if (highest == 0)
            {
                highest = lowest;
            }

            payout[i] = highest;

            result += Gambling.FormatMoney((int)(payout[i] / 1000.0f) * 1000) + " | ";
        }

        Gambling.SetClipboard(result);

        if (payout[0] == payout[1] && payout[1] == payout[2])
        {
            return(payout[0]);
        }
        else
        {
            return(0);
        }
    }
예제 #3
0
    int Generate()
    {
        Random rand   = new Random();
        int    random = rand.Next(1, rarity);

        current++;

        if (random == 1)
        {
            Gambling.SetClipboard("[Mystery Box #" + current + " You won the Jackpot: " + Gambling.FormatMoney(jackpot));
            return(jackpot);
        }
        else
        {
            int value = 0;
            random = rand.Next(1, rarity);

            if (random <= 2)
            {
                value = (int)((double)jackpot * 0.35);
                Gambling.SetClipboard("[Mystery Box #" + current + "] You win: " + Gambling.FormatMoney(value));
                return(value);
            }
            else if (random < (rarity / 75))
            {
                value = (int)((double)jackpot * 0.075);
                Gambling.SetClipboard("[Mystery Box #" + current + "] You win: " + Gambling.FormatMoney(value));
                return(value);
            }
            else if (random < (rarity / 40))
            {
                value = (int)((double)jackpot * 0.05);
                Gambling.SetClipboard("[Mystery Box #" + current + "] You win: " + Gambling.FormatMoney(value));
                return(value);
            }
            else if (random < (rarity / 15))
            {
                value = (int)((double)jackpot * 0.01);
                Gambling.SetClipboard("[Mystery Box #" + current + "] You win: " + Gambling.FormatMoney(value));
                return(value);
            }
            else if (random < (rarity / 10))
            {
                value = (int)((double)jackpot * 0.0075);
                Gambling.SetClipboard("[Mystery Box #" + current + "] You win: " + Gambling.FormatMoney(value));
                return(value);
            }

            value = (int)((float)jackpot * 0.005);
            Gambling.SetClipboard("[Mystery Box #" + current + "] You win: " + Gambling.FormatMoney(value));
            return(value);
        }
    }
예제 #4
0
    int[] chanceForBust = { 15, 25 }; // 15 in 25 chance of going bust

    public void GameStart()
    {
        while (betAmount == -1)
        {
            Console.Write("Enter Bet Amount: ");

            if (int.TryParse(Console.ReadLine(), out betAmount))
            {
                Console.WriteLine("Bet amount set to: " + Gambling.FormatMoney(betAmount));
            }
        }
        Reset();
    }
예제 #5
0
    public void Double()
    {
        if (!isBust)
        {
            Random rand = new Random();

            if (rand.Next(1, chanceForBust[1] + 1) <= chanceForBust[0])
            {
                isBust = true;
                Gambling.SetClipboard("[Double or Nothing] (BUST): " + Gambling.FormatMoney(total) + "!");
            }
            else
            {
                total *= 2;
                Gambling.SetClipboard("[Double or Nothing] (DOUBLE): " + Gambling.FormatMoney(total) + "!");
            }
        }
    }
예제 #6
0
    public void GameStart()
    {
        while (jackpot == -1)
        {
            Console.Write("Enter Jackpot: $");

            if (int.TryParse(Console.ReadLine(), out jackpot))
            {
                Console.WriteLine("Jackpot Set: " + Gambling.FormatMoney(jackpot));
                Console.WriteLine("Cards Should Be Sold For " + Gambling.FormatMoney(jackpot / 100) + " each.");
            }
        }

        int totalPossibilities = 15;

        for (int i = 1; i <= totalPossibilities; i++)
        {
            possibilities[(int)((1.0f / totalPossibilities) * i * jackpot)] = (int)Math.Pow(i, 1.8f);
        }
    }
예제 #7
0
 public void Reset()
 {
     isBust = false;
     total  = betAmount;
     Gambling.SetClipboard("[Double or Nothing] Game Started: " + Gambling.FormatMoney(total));
 }