oldschool-toontown/toontown/minigame/PairingGameGlobals.py

40 lines
1,003 B
Python
Raw Normal View History

2019-11-02 17:27:54 -05:00
import PlayingCardDeck
EasiestGameDuration = 120
HardestGameDuration = 90
EndlessGame = config.GetBool('endless-pairing-game', 0)
MaxRankIndexUsed = [7,
7,
7,
8,
9]
def createDeck(deckSeed, numPlayers):
deck = PlayingCardDeck.PlayingCardDeck()
deck.shuffleWithSeed(deckSeed)
deck.removeRanksAbove(MaxRankIndexUsed[numPlayers])
return deck
def calcGameDuration(difficulty):
difference = EasiestGameDuration - HardestGameDuration
adjust = difference * difficulty
retval = EasiestGameDuration - adjust
return retval
def calcLowFlipModifier(matches, flips):
idealFlips = round(matches * 2 * 1.6)
if idealFlips < 2:
idealFlips = 2
maxFlipsForBonus = idealFlips * 2
retval = 0
if flips < idealFlips:
retval = 1
elif maxFlipsForBonus < flips:
retval = 0
else:
divisor = maxFlipsForBonus - idealFlips
difference = maxFlipsForBonus - flips
retval = float(difference) / divisor
return retval