Esempio n. 1
0
            public void finishpokergame(Mobile from)
            {
                int    i, match1 = 0, match2 = 0, match3 = 0, match4 = 0, match5 = 0, temp = 0;
                bool   isStrt = true, isFlush = false;
                string Temp;

                for (i = 0; i <= 4; i++)
                {
                    m_From.dealercards[i] = m_From.playercards[i];
                }

                for (int j = 4; j >= 0; j--)
                {
                    for (i = 0; i < 4; i++)
                    {
                        if (m_From.CardValue2(m_From.dealercards[i]) >= m_From.CardValue2(m_From.dealercards[i + 1]))
                        {
                            temp = m_From.dealercards[i];
                            m_From.dealercards[i]     = m_From.dealercards[i + 1];
                            m_From.dealercards[i + 1] = temp;
                        }
                    }
                }

                for (i = 4; i > 0; i--)
                {
                    if (m_From.CardValue2(m_From.dealercards[i]) != (m_From.CardValue2(m_From.dealercards[0]) + i))
                    {
                        isStrt          = false;
                        m_From.pokermsg = "Game Over.";
                        m_From.pwin     = 0;
                    }
                }

                if ((m_From.CardValue2(m_From.dealercards[0]) == 2) && (m_From.CardValue2(m_From.dealercards[1]) == 3) && (m_From.CardValue2(m_From.dealercards[2]) == 4) && (m_From.CardValue2(m_From.dealercards[3]) == 5) && (m_From.CardValue2(m_From.dealercards[4]) == 14))
                {
                    isStrt = true;
                }

                if (isStrt)
                {
                    m_From.pokermsg = "Straight.";
                    m_From.pwin     = m_From.playerbet * 4;
                }

                Temp = m_From.CardSuit(m_From.dealercards[0]);
                if (Temp == m_From.CardSuit(m_From.dealercards[1]) && Temp == m_From.CardSuit(m_From.dealercards[2]) && Temp == m_From.CardSuit(m_From.dealercards[3]) && Temp == m_From.CardSuit(m_From.dealercards[4]))
                {
                    isFlush         = true;
                    m_From.pokermsg = "Flush.";
                    m_From.pwin     = m_From.playerbet * 5;
                }

                if (!isStrt && !isFlush)
                {
                    for (i = 0; i <= 4; i++)
                    {
                        temp = m_From.CardValue2(m_From.dealercards[i]);

                        if ((m_From.CardValue2(m_From.dealercards[0]) == temp) && i != 0)
                        {
                            match1++;
                        }
                        if ((m_From.CardValue2(m_From.dealercards[1]) == temp) && i != 1)
                        {
                            match2++;
                        }
                        if ((m_From.CardValue2(m_From.dealercards[2]) == temp) && i != 2)
                        {
                            match3++;
                        }
                        if ((m_From.CardValue2(m_From.dealercards[3]) == temp) && i != 3)
                        {
                            match4++;
                        }
                        if ((m_From.CardValue2(m_From.dealercards[4]) == temp) && i != 4)
                        {
                            match5++;
                        }
                    }

                    if ((match1 == 3) || (match2 == 3) || (match3 == 3) || (match4 == 3) || (match5 == 3))
                    {
                        m_From.pokermsg = "4 of a Kind";
                        m_From.pwin     = m_From.playerbet * 8;
                    }

                    if ((match1 == 2) || (match2 == 2) || (match3 == 2) || (match4 == 2) || (match5 == 2))
                    {
                        m_From.pokermsg = "3 of a Kind";
                        m_From.pwin     = m_From.playerbet * 3;
                    }

                    if ((match1 + match2 + match3 + match4 + match5) == 8)
                    {
                        m_From.pokermsg = "Full House.";
                        m_From.pwin     = m_From.playerbet * 6;
                    }

                    if ((match1 + match2 + match3 + match4 + match5) == 4)
                    {
                        m_From.pokermsg = "Two Pair.";
                        m_From.pwin     = m_From.playerbet * 2;
                    }

                    temp = 0;
                    if ((match1 + match2 + match3 + match4 + match5) == 2)
                    {
                        if (match1 == 1)
                        {
                            temp = m_From.CardValue2(m_From.dealercards[0]);
                        }
                        if (match2 == 1)
                        {
                            temp = m_From.CardValue2(m_From.dealercards[1]);
                        }
                        if (match3 == 1)
                        {
                            temp = m_From.CardValue2(m_From.dealercards[2]);
                        }
                        if (match4 == 1)
                        {
                            temp = m_From.CardValue2(m_From.dealercards[3]);
                        }
                        if (temp >= 10)
                        {
                            m_From.pokermsg = "Pair 10's +";
                            m_From.pwin     = m_From.playerbet;
                        }
                    }
                }                 //end if(isStrt && isFlush)

                if (isFlush && isStrt)
                {
                    if (m_From.dealercards[0] == 10)
                    {
                        m_From.pokermsg = "Royal Straight Flush";
                        m_From.pwin     = m_From.playerbet * 12;
                    }
                    else
                    {
                        m_From.pokermsg = "Straight Flush";
                        m_From.pwin     = m_From.playerbet * 10;
                    }
                }

                if (m_From.pwin > 0)
                {
                    m_From.payplayer(from, m_From.pwin);
                    Effects.PlaySound(from.Location, from.Map, 0x36);
                    m_From.gamestats[4] += 1;
                }
                else if (m_From.pwin == m_From.playerbet)
                {
                    m_From.gamestats[5] += 1;
                }
                else
                {
                    m_From.gamestats[3] += 1;
                }
            }
Esempio n. 2
0
            public void finishgame(Mobile from)
            {
                int i, temp, dealervalue = dealercardvalue(), playervalue = playercardvalue();

                temp = (m_From.playerbet / 2);

                if (m_From.dbj && m_From.pbj)
                {
                    m_From.dwin = temp;
                    m_From.pwin = m_From.playerbet + temp;

                    m_From.payplayer(from, m_From.pwin);
                    m_From.gamestats[2] += 1;
                    m_From.pokermsg      = "We have a push.";
                }
                else if (m_From.dbj)
                {
                    m_From.gamestats[0] += 1;
                    m_From.pokermsg      = "Looks like I won.";
                    m_From.dwin          = m_From.playerbet;
                    m_From.pwin          = 0;
                }
                else if (m_From.pbj)
                {
                    m_From.dwin = 0;
                    m_From.pwin = (m_From.playerbet * 2) + temp;

                    m_From.payplayer(from, m_From.pwin);
                    m_From.gamestats[1] += 1;
                    m_From.pokermsg      = "You won this one.";
                }
                else
                {
                    if (playervalue > 21 || (dealervalue > playervalue && dealervalue <= 21))
                    {                    // dealer won
                        m_From.gamestats[0] += 1;
                        m_From.pokermsg      = "Looks like I won.";
                        m_From.dwin          = m_From.playerbet;
                        m_From.pwin          = 0;
                    }
                    else
                    {
                        if (dealervalue < 17)
                        {
                            for (i = 2; i <= 4; ++i)
                            {
                                if (m_From.dealercards[i] == 0)
                                {
                                    m_From.dealercards[i] = m_From.pickcard(from);
                                    dealervalue           = dealercardvalue();
                                }
                                if (dealervalue >= 17)
                                {
                                    i = 6;
                                }
                            }
                        }

                        if (playervalue > 21 || (dealervalue > playervalue && dealervalue <= 21))
                        {                        // dealer won
                            m_From.gamestats[0] += 1;
                            m_From.pokermsg      = "I won this round.";
                            m_From.dwin          = m_From.playerbet;
                            m_From.pwin          = 0;
                        }
                        else if (dealervalue == playervalue)
                        {                         // tie
                            m_From.dwin = temp;
                            m_From.pwin = m_From.playerbet + temp;

                            m_From.payplayer(from, m_From.pwin);
                            m_From.gamestats[2] += 1;
                            m_From.pokermsg      = "We have a push.";
                        }
                        else
                        {                         // count players card
                            if (playervalue == 21)
                            {                     // player won
                                m_From.dwin = 0;
                                m_From.pwin = (m_From.playerbet * 2);

                                m_From.payplayer(from, m_From.pwin);
                                m_From.gamestats[1] += 1;
                                m_From.pokermsg      = "You have won another round.";
                            }
                            else
                            {                             // player won
                                m_From.dwin = 0;
                                m_From.pwin = (m_From.playerbet * 2);

                                m_From.payplayer(from, m_From.pwin);
                                m_From.gamestats[1] += 1;
                                m_From.pokermsg      = "You won this one.";
                            }
                        }
                    }                     // end of else
                }
                m_From.dbj              = false;
                m_From.pbj              = false;
                m_From.pwin             = (m_From.pwin - m_From.playerbet);
                m_From.dealercardhidden = false;
                m_From.roundend         = true;
                Effects.PlaySound(from.Location, from.Map, 0x36);
                from.SendGump(new BlackjackGump(from, m_From));
            }