本文整理匯總了Python中the_tale.game.balance.power.Power.deserialize方法的典型用法代碼示例。如果您正苦於以下問題:Python Power.deserialize方法的具體用法?Python Power.deserialize怎麽用?Python Power.deserialize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類the_tale.game.balance.power.Power
的用法示例。
在下文中一共展示了Power.deserialize方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: deserialize
# 需要導入模塊: from the_tale.game.balance.power import Power [as 別名]
# 或者: from the_tale.game.balance.power.Power import deserialize [as 別名]
def deserialize(cls, data):
# if artifact record is desabled or deleted, get another random record
from the_tale.game.artifacts.storage import artifacts_storage
record = artifacts_storage.get_by_uuid(data['id'])
if record is None or record.state.is_DISABLED:
record = random.choice(artifacts_storage.artifacts)
integrity = data.get('integrity', [c.ARTIFACT_MAX_INTEGRITY, c.ARTIFACT_MAX_INTEGRITY])
return cls(record_id=record.id,
power=Power.deserialize(data['power']),
bag_uuid=data['bag_uuid'],
integrity=integrity[0],
max_integrity=integrity[1],
rarity=relations.RARITY.index_value[data.get('rarity', relations.RARITY.NORMAL.value)],
level=data.get('level', 1))