当前位置: 首页>>代码示例>>Python>>正文


Python Card.color方法代码示例

本文整理汇总了Python中card.Card.color方法的典型用法代码示例。如果您正苦于以下问题:Python Card.color方法的具体用法?Python Card.color怎么用?Python Card.color使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在card.Card的用法示例。


在下文中一共展示了Card.color方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: read_hole_cards_line

# 需要导入模块: from card import Card [as 别名]
# 或者: from card.Card import color [as 别名]
    def read_hole_cards_line(self, hole_cards_line, active_player):
        """Read the two hole cards given to the active player in the hole card line. Analyses a single line (string).

        Args:
            hole_cards_line (str) : The hole card line, containing the name of the active player.
            active_player (Player) : The name of the active player.

         Returns:
            (list): A list of two Card, containing the two hole cards read.
        """

        # TODO: Does not read the 1st hand of a file

        if not active_player.name in hole_cards_line:
            raise Exception("The active player hole cards are missing.")

        in_cards = False
        card1 = Card(0, "")
        card2 = Card(0, "")

        for i in range(len(hole_cards_line)):
            if in_cards == True:
                card1.set_value(hole_cards_line[i])
                card1.color = hole_cards_line[i + 1]
                card2.set_value(hole_cards_line[i + 3])
                card2.color = hole_cards_line[i + 4]
                break

            if hole_cards_line[i] == "[":
                in_cards = True

        return [card1, card2]
开发者ID:Bobsleigh,项目名称:FirePoker,代码行数:34,代码来源:pokertextfile.py

示例2:

# 需要导入模块: from card import Card [as 别名]
# 或者: from card.Card import color [as 别名]
		temp_card.power = card.find('power').text or "Default"
		temp_card.toughness = card.find('toughness').text or "Default"
		temp_card.loyalty = card.find('loyalty').text or "Default"
		temp_card.ability = card.find('ability').text or "Default"
		#temp_card.flavor = card.find('flavor').text or "Default"
		if temp_card.id == 74256:
			temp_card.flavor = "Default"
		else:
			temp_card.flavor = card.find('flavor').text or "Default"

		temp_card.variation = card.find('variation').text or "Default"
		temp_card.artist = card.find('artist').text or "Default"
		temp_card.number = card.find('number').text or "Default"
		temp_card.rating = card.find('rating').text or "Default"
		temp_card.ruling = card.find('ruling').text or "Default"
		temp_card.color = card.find('color').text or "Default"
		temp_card.generated_mana = card.find('generated_mana').text or "Default"
		temp_card.pricing_low = card.find('pricing_low').text or "Default"
		temp_card.pricing_mid = card.find('pricing_mid').text or "Default"
		temp_card.pricing_high = card.find('pricing_high').text or "Default"
		temp_card.back_id = card.find('back_id').text or "Default"
		temp_card.watermark = card.find('watermark').text or "Default"

		temp_card.name_CN = card.find('name_CN').text or "Default"
		temp_card.name_TW = card.find('name_TW').text or "Default"
		temp_card.name_FR = card.find('name_FR').text or "Default"
		temp_card.name_DE = card.find('name_DE').text or "Default"
		temp_card.name_IT = card.find('name_IT').text or "Default"
		temp_card.name_JP = card.find('name_JP').text or "Default"
		temp_card.name_PT = card.find('name_PT').text or "Default"
		temp_card.name_RU = card.find('name_RU').text or "Default"
开发者ID:LeShadow,项目名称:MTGProject,代码行数:33,代码来源:magic.py


注:本文中的card.Card.color方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。