コード例 #1
0
def chanceGraphic():
    global chanceArray, chancePointer
    chanceCard = chanceArray[chancePointer]
    array = [[], [], [], []]
    if chanceCard.fee == True:
        array[0].append(space.menuElement(True, 1, 1, 90, "Pay Charge"))
    else:
        array[0].append(space.menuElement(True, 1, 1, 90, "Collect funds"))
    array[1].append(chanceCard)
    return array
コード例 #2
0
def resetMenu(inJail=False):
    if inJail == False:
        menuArray = [[
            space.menuElement(True, 1, 1, 90, "Manage Properties"),
            space.menuElement(False, 1, 2, 90, "Roll Dice")
        ], [], [], []]
    else:
        menuArray = [[
            space.menuElement(True, 1, 1, 90, "Pay Fine"),
            space.menuElement(False, 1, 2, 90, "Roll Dice")
        ], [], [], []]
    return menuArray
コード例 #3
0
def generatePropertyArray(player, board):
    array = [[], [], [], []]
    array[0].append(space.menuElement(True, 1, 1, 90, "Back"))
    addedSpaces = 0
    for i in board:
        if i.owner == player.ID:
            column = 0
            added = False
            while added == False:
                if len(array[column]) < 9:
                    array[column].append(
                        space.menuElement(False, (column + 1),
                                          (addedSpaces + 2), 90, i.name, i))
                    added = True
                else:
                    column += 1
                    addedSpaces = 0
            addedSpaces += 1
    return array
コード例 #4
0
def generateSpaceMenuArray(propertySpace):
    array = [[], [], [], []]
    array[0].append(space.menuElement(True, 1, 1, 90, "Back"))
    allOwned = True
    for i in boardArray:
        if i.colour == propertySpace.colour and (i.owner != propertySpace.owner
                                                 or i.isMorgaged == True):
            allOwned = False
            break
    if allOwned == True:
        array[0].append(
            space.menuElement(False, 1, 2, 90, "Upgrade", propertySpace))
        array[0].append(
            space.menuElement(False, 1, 3, 90, "Downgrade", propertySpace))
        array[0].append(
            space.menuElement(False, 1, 4, 90, "Morgage", propertySpace))
    else:
        array[0].append(
            space.menuElement(
                False, 1, 2, 90,
                "You need a full, not morgaged set to upgrade them"))
        array[0].append(
            space.menuElement(False, 1, 3, 90, "Morgage", propertySpace))
    return array
コード例 #5
0
def AITurn(surface, colourLookup, player, board):
    if player.inJail == True:
        jailPayment(player)
        array = endCondition(player)
    else:
        array = [[space.menuElement(True, 1, 1, 90, "Roll Dice")]]
        array = menuProcess(surface, colourLookup, array, player, board)
        try:
            for j in array:
                for i in j:
                    print(i)
                    if i.text == "Buy Space":
                        array = [[
                            space.menuElement(True, 1, 1, 90, "Buy Space")
                        ]]
                        array = menuProcess(surface, colourLookup, array,
                                            player, board)
                        raise doubleBreak
                    elif i.text == "Pay Fine":
                        array = [[
                            space.menuElement(True, 1, 1, 90, "Pay Fine")
                        ]]
                        array = menuProcess(surface, colourLookup, array,
                                            player, board)
                        raise doubleBreak
                    elif i.text == "Pay Rent":
                        array = [[
                            space.menuElement(True, 1, 1, 90, "Pay Rent")
                        ]]
                        array = menuProcess(surface, colourLookup, array,
                                            player, board)
                        raise doubleBreak
                    elif i.text == "Pay Tax":
                        array = [[
                            space.menuElement(True, 1, 1, 90, "Pay Tax")
                        ]]
                        array = menuProcess(surface, colourLookup, array,
                                            player, board)
                        raise doubleBreak
                    elif i.text == "Pay Charge":
                        array = [[
                            space.menuElement(True, 1, 1, 90, "Pay Charge")
                        ]]
                        array = menuProcess(surface, colourLookup, array,
                                            player, board)
                        raise doubleBreak
                    elif i.text == "Collect Funds":
                        array = [[
                            space.menuElement(True, 1, 1, 90, "Collect Funds")
                        ]]
                        array = menuProcess(surface, colourLookup, array,
                                            player, board)
                        raise doubleBreak
                    elif i.text == "End Turn":
                        array = [[
                            space.menuElement(True, 1, 1, 90, "End Turn")
                        ]]
                        array = menuProcess(surface, colourLookup, array,
                                            player, board)
                        raise doubleBreak
        except doubleBreak:
            pass
    player.output()
    return array
コード例 #6
0
def menuProcess(surface, colourLookup, array, player, board):
    #print("menuProcess ENTER")
    global currentPlayer
    try:
        for column in array:
            for i in column:
                if i.marked == True:
                    if i.text == "Roll Dice":
                        rollDice(surface, colourLookup, player, array)
                        newSpace = boardArray[player.posIndex]
                        if newSpace.spaceType == "PROPERTY" or newSpace.spaceType == "TRAIN" or newSpace.spaceType == "TRAM" or newSpace.spaceType == "BUS" or newSpace.spaceType == "UTILITY":
                            if newSpace.owner == None:
                                array = [[
                                    space.menuElement(True, 1, 1, 90,
                                                      "Buy Space"),
                                    space.menuElement(False, 1, 2, 90,
                                                      "End Turn")
                                ], [], [], []]
                            elif newSpace.owner == player.ID:
                                array = [[
                                    space.menuElement(True, 1, 1, 90,
                                                      "End Turn")
                                ], [], [], []]
                            elif newSpace.owner != None and newSpace.owner != player.ID:
                                array = [[
                                    space.menuElement(True, 1, 1, 90,
                                                      "Pay Rent")
                                ], [], [], []]
                            array = cardGraphic(newSpace, array)
                        elif newSpace.spaceType == "TAX":
                            array = [[
                                space.menuElement(True, 1, 1, 90, "Pay Tax")
                            ], [], [], []]
                        elif newSpace.spaceType == "GO_TO_JAIL":
                            sendToJail(player)
                            array = endCondition(player)
                            raise doubleBreak
                        elif newSpace.spaceType == "CHANCE":
                            array = chanceGraphic()
                    elif i.text == "Buy Space":
                        buySpace(player)
                        array = endCondition(player)
                        raise doubleBreak
                    elif i.text == "Pay Tax":
                        taxPayment(player)
                        array = endCondition(player)
                        raise doubleBreak
                    elif i.text == "Manage Properties":
                        array = generatePropertyArray(player, board)
                    elif i.text == "Pay Charge" or i.text == "Collect funds":
                        chancePayCollect(player)
                        array = endCondition(player)
                        raise doubleBreak
                    elif i.text == "Pay Fine":
                        jailPayment(player)
                        array = endCondition(player)
                        raise doubleBreak
                    elif i.text == "Back":
                        if player.inJail == True:
                            array = resetMenu(True)
                        else:
                            array = resetMenu()
                    elif i.text == "Upgrade":
                        propertyModify(player, board, "Upgrade", i.space)
                    elif i.text == "Downgrade":
                        propertyModify(player, board, "Downgrade", i.space)
                    elif i.text == "Morgage":
                        propertyModify(player, board, "Morgage", i.space)
                    elif i.text == "End Turn":
                        array = endCondition(player)
                        raise doubleBreak
                    elif i.space != None:
                        array = generateSpaceMenuArray(i.space)
                        array = cardGraphic(i.space, array)
    except doubleBreak:
        pass
    #print("menuProcess ESCAPE")
    return array