Advertisement
Slowhand-VI

TUT: blackjack_h.fos

Jan 19th, 2016
274
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**<
  2.  *  Blackjack - Card game for FOnline.
  3.  *  What would be the most reasonable way that gambling skill would affect the course of the game?
  4.  *  (It shall be true to gambling in rl, shall be fun, and shall not be exploitable or afk farmed easily (or at all?).)
  5.  *
  6.  *  Specification:
  7.  *      1. Dialogue based with possibility to attach a new GUI for it.
  8.  *      2. The pile of cards shall be pre-generated at each shuffle and not randomized at each draw.
  9.  *      3. Gambling skill difference between host and player is checked, against a  roll, as usual.
  10.  *          3.1 The advantage of higher gambling skill:
  11.  *              3.1.1 Info over the the number of card packs used (which would be random 4 - 8 after each session).
  12.  *              3.1.2 Frequency of shuffling would be lower with better gambling + speech skill checks.
  13.  *              3.1.3 Card counting: available as long as gambling skill is higher than of host and the intellect of player is above X,
  14.  *                      as this is the easiest ways to get advantage over host.
  15.  *              3.1.4 Shuffle tracks: Occasionally on a critical or very hard roll on gambling + perception shuffling check,
  16.  *                      the player will be notified if there are way more high or low cards in the next X cards, if that is the case.
  17.  *          3.2 Disadvantage of lower gambling skill:
  18.  *              3.2.1 Basically missing out on the benefits, like: the character does not pay attention when the shuffling of cards happens,
  19.  *                      since he doesn't know that is important, so you miss that info.
  20.  *          3.3 Other possibilities:
  21.  *              3.3.1 Cheating 1: where the odds of high (7,8,9) or low cards (2,3,4) is reduced/raised, maybe the later could be added
  22.  *                      to some mini/repeatable quest or the host could be sweet talked /payed into changing the packs or whatever..
  23.  *                      (would only create the possibility for it, but not the quest itself) In this case the host would give a hint for the player,
  24.  *                      until the cards are replaced.
  25.  *              3.3.2 Cheating 2: where the player will be notified if the hole card is an Ace or 10.
  26.  *              3.3.3 Cheating 3: Casino could cheat as well, cutting down some cards for player session, this should be able to be find out
  27.  *                      via mini quest/tip drunk gambler/speech etc. or simply by gambling check rolls.
  28.  *          3.4. Different casinos could have different rules and special offers to promote themselves:
  29.  *              3.4.1 Rule changes:
  30.  *                  3.4.1.1 "Hit soft 17" - dealer has to draw a card if on soft 17.
  31.  *                  3.4.1.2 "Dealer wins ties" - dealer will win ties.
  32.  *                  3.4.1.3 "No Hole card" - dealer does not consult hole card until player finished his turns. (can't cheat to find out dealer's hole card)
  33.  *                  3.4.1.4 "No Black Jack after splitting Aces" - no bonus on Black Jack after splitting Aces.
  34.  *              3.4.2 Side bets:
  35.  *                  3.4.2.1 "Royal Match" - Pays for suit matches.
  36.  *                  3.4.2.2 "Perfect Pair" - is an extra bet option before drawing cards, the player can bet if he gets pairs (Perfect, Colored, Mixed, No pairs)
  37.  *                  3.4.2.3 "Lucky Ladies" - pays for initial cards value of 20. (Pair of Queen of Hearts, Suit Pair, etc)
  38.  *              3.4.3 Promotions:
  39.  *                  3.4.3.1 "Real" Black Jack pays higher than regular Black Jack. (11 to 2 instead of 3 to 2). (Real mean Ace of spades with a black Jack card.)
  40.  *
  41.  *  What to keep in sight:
  42.  *      1. It shall be configurable, so that mini quests or altering affects can differ from player to player and from session to session.
  43.  *      2. Shall be expandable later on to a graphical design.
  44.  *      3. Casino rules could be configurable, so that each session (or say,week) could be different, (or per player different odds) so that it can be tied to side quests to gather that info. (e.g.: Tip some wasted beggar or gambler to know the current situation / Or just the need to read the rules from dialogue so that botting is made harder.)
  45.  *
  46.  *  Author:     Slowhand
  47.  *  Reviewer:   N/A
  48.  *  Tester:     N/A
  49.  */
  50.  
  51. #ifndef __BLACKJACK_H__
  52. #define __BLACKJACK_H__
  53.  
  54. #define BLACKJACK_MIN_DECKS_IN_SHOE             (2)         //  Should not be lower than 2, since some side bets require at least 2 decks.
  55. #define BLACKJACK_MAX_DECKS_IN_SHOE             (8)
  56. #define BLACKJACK_DEFAULT_DECKS_IN_SHOE         (6)
  57.  
  58. #define BLACKJACK_SIDE_NONE                     (0)
  59. #define BLACKJACK_SIDE_LUCKY_LADIES             (1)
  60. #define BLACKJACK_SIDE_PERFECT_PAIR             (2)
  61. #define BLAKCJACK_SIDE_ROYAL_MATCH              (3)
  62.  
  63. #define BLACKJACK_SHUFFLE_THRESHOLD_MIN         (10)        //  Percentage
  64. #define BLACKJACK_SHUFFLE_THRESHOLD_MAX         (50)        //  Percentage
  65. #define BLACKJACK_SHUFFLE_SKILL_THRESHOLD       (50)        //  To get maximum effect from gambling, the player shall have more skill than the dealer by this amount.
  66.  
  67. #define BLACKJACK_SKILL_TO_SEE_SHOE_SIZE        (40)        //  This is checked to see, if player can detect the size of the shoe used.
  68. #define BLACKJACK_SKILL_TO_SEE_SHUFFLING        (60)        //  This is checked to see, if the player get's a report about reshuffling of the shoe.
  69. #define BLACKJACK_SKILL_DIFF_TO_SEE_HOLE_CARD   (10)        //  Difficulty factor to see the hole card of the host. (used in a random)
  70.  
  71. //  Lucky Ladies side bet multiplication factors
  72. //  http://www.blackjack.com.au/side-bets/lucky-ladies/
  73. #define BLACKJACK_SIDE_FACTOR_LL_QOHP_BJ        (1000)  //  Player start hand is a Queen of hearts pair and dealer has Blackjack.
  74. #define BLACKJACK_SIDE_FACTOR_LL_QOHP           (125)   //  Player start hand is a Queen of hearts pair and dealer does not have Blackjack.
  75. #define BLACKJACK_SIDE_FACTOR_LL_MATCHED        (19)    //  Player start hand is a pair matching in suit and face and having total value of 20
  76. #define BLACKJACK_SIDE_FACTOR_LL_SUITED         (9)     //  Player start hand is two cards with same suit and having total value of 20.
  77. #define BLACKJACK_SIDE_FACTOR_LL_UNSUITED       (4)     //  Player start hand is two cards with total value of 20.
  78.  
  79. //  Perfect Pair side bet multiplication factors
  80. //  http://www.blackjack.com.au/side-bets/perfect-pairs/
  81. #define BLACKJACK_SIDE_FACTOR_PP_PERFECTPAIR    (25)    //  Player start hand is a pair that matches in suit and face.
  82. #define BLACKJACK_SIDE_FACTOR_PP_COLOREDPAIR    (12)    //  Player start hand is a pair with the same color, but not same suit.
  83. #define BLACKJACK_SIDE_FACTOR_PP_MIXEDPAIR      (6)     //  Player start hand is a pair with different color.
  84.  
  85. //  Royal Match side bet multiplication factors
  86. //  http://www.blackjack.com.au/side-bets/
  87. #define BALCKJACK_SIDE_FACTOR_RM_ROYAL_MATCH    (25)    //  Player starting hand is a Queen and a King of the same suit.
  88. #define BLACKJACK_SIDE_FACTOR_RM_SUITED         (2.5)   //  Player starting hand is two cards with the same suit.
  89.  
  90.  
  91. //  To keep track of game progress bc of rules.
  92. enum BlackjackProgress
  93. {
  94.     Init = 0,               //  Blackjack session is initialized, cue is generated and shuffled.
  95.     Bet = 1,                //  Player can bet or side bet at this point. Once he bet, he cannot side bet.
  96.     SidebetDone = 2,        //  Player had bet on a side bet, other side bets are disabled for this round.
  97.     First = 3,              //  At first 2 cards, more options are available at this point.
  98.     Rest = 4,               //  More than 2 cards, some options are not available from this point
  99.     SplitOneFirst = 5,
  100.     SplitOneRest = 6,
  101.     SplitTwoFirst = 7,
  102.     SplitTwoRest = 8,
  103.     PlayerBust = 9,         //  Players card value exceeds 21, which is a default loss.
  104.     PlayerBlackjack = 10,   //  Player can have Blackjack only from the first 2 cards.
  105.     DealersTurn = 11,       //  Player finished his moves, now it's the dealers turn.
  106.     Result = 12
  107. };
  108.  
  109. #endif // __BLACKJACK_H__
Advertisement
RAW Paste Data Copied
Advertisement