本文整理汇总了Python中card.Card.create方法的典型用法代码示例。如果您正苦于以下问题:Python Card.create方法的具体用法?Python Card.create怎么用?Python Card.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类card.Card
的用法示例。
在下文中一共展示了Card.create方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: from_user
# 需要导入模块: from card import Card [as 别名]
# 或者: from card.Card import create [as 别名]
def from_user(fight, user, team_id):
''' Создание файтера из пользователя.
User user - пользователь.
int team_id - номер команды.
'''
f = Fighter(fight)
f._type = "user"
f.have_deck = True
f.alive = True
f.user_id = user.id
f.team_id = team_id
f.deck = list(chain.from_iterable((Card.create(id) for i in range(count)) for id, count in user["deck"].dict.iteritems()))
f.name = user.name
f.image = user.image
f.level = user["level"]
f.base_stats = {}
for key in ["atk", "def", "matk", "mdef", "hp_max"]:
f.base_stats[key] = f.stats[key] = user[key]
for sk in user['skills'].keys():
key = 'skill_' + sk
f.base_stats[key] = f.stats[key] = user['skills'][sk]
if fight._type == "training":
f.hp = user["hp_max"]
else:
user.update_hp()
f.hp = int(user.hp)
f.effects = []
for eff, limit in user["effects"]:
f.add_effect(effect.get(eff.id, *eff.args), 99, f)
f.stats["max_hand"] = 6
shuffle(f.deck)
f.hand = []
f.draw(5)
f.mana = 0
return f
示例2: get_card
# 需要导入模块: from card import Card [as 别名]
# 或者: from card.Card import create [as 别名]
def get_card(self, sn):
return Card.create(self.query('select * from card where cardid = "%s"' % (sn,)))
示例3: get_card
# 需要导入模块: from card import Card [as 别名]
# 或者: from card.Card import create [as 别名]
def get_card(self, sn):
apb = self.local.option('apb') == '2'
return Card.create(self.query('select * from card where CardID = "%s"' % (sn,)), apb=apb)