示例#1
0
文件: utils.py 项目: yankyn/dom_api
def cards(request, dominion_fix):
    '''
    A fixture for creating example cards.
    '''
    if not Card.objects(name=COPPER): #@UndefinedVariable
        create_card(name=COPPER, cost=0, type=TREASURE, money=1)
    if not Card.objects(name=ESTATE): #@UndefinedVariable
        create_card(name=ESTATE, cost=2, type=VICTORY, victory=1)
示例#2
0
def cards(request, dominion_fix):
    '''
    A fixture for creating example cards.
    '''
    if not Card.objects(name=COPPER):  #@UndefinedVariable
        create_card(name=COPPER, cost=0, type=TREASURE, money=1)
    if not Card.objects(name=ESTATE):  #@UndefinedVariable
        create_card(name=ESTATE, cost=2, type=VICTORY, victory=1)
示例#3
0
文件: utils.py 项目: yankyn/dom_api
def full_ruleset(request, cards, ruleset):
    '''
    A Fixture for creating rule_sets with content.
    '''
    ruleset.starting_deck = [Card.objects(name=COPPER)[0]] * 7 #@UndefinedVariable
    ruleset.starting_deck += [Card.objects(name=ESTATE)[0]] * 3 #@UndefinedVariable
    for value in request.param:
        srs = create_specific_rule_set(parent=ruleset, player_number=value)
    return ruleset
示例#4
0
def full_ruleset(request, cards, ruleset):
    '''
    A Fixture for creating rule_sets with content.
    '''
    ruleset.starting_deck = [Card.objects(name=COPPER)[0]
                             ] * 7  #@UndefinedVariable
    ruleset.starting_deck += [Card.objects(name=ESTATE)[0]
                              ] * 3  #@UndefinedVariable
    for value in request.param:
        srs = create_specific_rule_set(parent=ruleset, player_number=value)
    return ruleset
示例#5
0
文件: utils.py 项目: yankyn/dom_api
def turn_card_dict_to_list(dictionary):
    '''
    Turns a dictionary of cards to numbers to a list of cards where each card's 
    number of instances is equal to its mapped value in the dictionary.
    '''
    cardlist = []
    for cardname in dictionary:
        card = Card.objects(name=cardname)[0] #@UndefinedVariable
        cardlist.extend([card] * dictionary[cardname])
    return cardlist
示例#6
0
def turn_card_dict_to_list(dictionary):
    '''
    Turns a dictionary of cards to numbers to a list of cards where each card's 
    number of instances is equal to its mapped value in the dictionary.
    '''
    cardlist = []
    for cardname in dictionary:
        card = Card.objects(name=cardname)[0]  #@UndefinedVariable
        cardlist.extend([card] * dictionary[cardname])
    return cardlist