コード例 #1
0
ファイル: rules_controller.py プロジェクト: yankyn/dom_api
def create_general_rule_set(*args, **kwargs):
    '''
    Initializes a general rule set from the configured constant rules.
    '''
    if not Rules.objects(_is_constant=True): #@UndefinedVariable
        raise DominionException('Default constant rules are not configured!')
    rules = GeneralRuleSet(*args, **kwargs)
    
    copy_fields(rules, Rules.objects(_is_constant=True)[0]) #@UndefinedVariable
    
    return rules
コード例 #2
0
def create_general_rule_set(*args, **kwargs):
    '''
    Initializes a general rule set from the configured constant rules.
    '''
    if not Rules.objects(_is_constant=True):  #@UndefinedVariable
        raise DominionException('Default constant rules are not configured!')
    rules = GeneralRuleSet(*args, **kwargs)

    copy_fields(rules,
                Rules.objects(_is_constant=True)[0])  #@UndefinedVariable

    return rules
コード例 #3
0
def create_constant_rules(phase_order=DEFAULT_PHASE_ORDER,
                          card_types=DEFAULT_CARD_TYPES):
    '''
    Creates a set of constant rules.
    '''
    if Rules.objects(_is_constant=True):  #@UndefinedVariable
        raise DominionException(
            '''Constant rules configuration document already exists
            , please check your actions again''')
    else:
        rules = Rules(phase_order=phase_order,
                      card_types=card_types,
                      _is_constant=True)
    return rules
コード例 #4
0
ファイル: rules_controller.py プロジェクト: yankyn/dom_api
def create_constant_rules(phase_order=DEFAULT_PHASE_ORDER, card_types=DEFAULT_CARD_TYPES):
    '''
    Creates a set of constant rules.
    '''
    if Rules.objects(_is_constant=True): #@UndefinedVariable
            raise DominionException('''Constant rules configuration document already exists
            , please check your actions again''')
    else:
        rules = Rules(phase_order=phase_order, card_types=card_types, _is_constant=True)
    return rules