def saveCardClass(): print 'start save card class' ids = [1,2,3,4,5,6,7,8,9,10] names = [u'死亡骑士', u'德鲁伊', u'猎人', u'法师', u'圣骑士', u'牧师', u'潜行者', u'萨满祭司', u'术士', u'战士'] enUSS = [u'Death Knight', u'Druid', u'Hunter', u'Mage', u'Paladin', u'Priest', u'Rogue', u'Shaman', u'Warlock', u'Warrior'] zhTWS = [u'死亡騎士', u'德魯伊', u'獵人', u'法師', u'聖騎士', u'牧師', u'盜賊', u'薩滿', u'術士', u'戰士'] for i in range(0,10): cs = CardClass() cs.classId = ids[i] cs.name = names[i] cs.enUS = enUSS[i] cs.zhTW = zhTWS[i] save(cs)
def setup_factory(factory): factory.add_card_class(CardClass("Cooper", Kind.Treasure, 0)) factory.add_card_class(CardClass("Silver", Kind.Treasure, 3)) factory.add_card_class(CardClass("Gold", Kind.Treasure, 6)) factory.add_card_class(CardClass("Estate", Kind.Victory, 2)) factory.add_card_class(CardClass("Duchy", Kind.Victory, 5)) factory.add_card_class(CardClass("Province", Kind.Victory, 8)) factory.add_card_class(CardClass("Curse", Kind.Curse, 0)) card = CardClass("Village", Kind.Action, 3) def action(self): yield Resource(action=2) card.set_action(action) factory.add_card_class(card)
def saveCardClass(): print 'start save card class' ids = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] names = [ u'死亡骑士', u'德鲁伊', u'猎人', u'法师', u'圣骑士', u'牧师', u'潜行者', u'萨满祭司', u'术士', u'战士' ] enUSS = [ u'Death Knight', u'Druid', u'Hunter', u'Mage', u'Paladin', u'Priest', u'Rogue', u'Shaman', u'Warlock', u'Warrior' ] zhTWS = [ u'死亡騎士', u'德魯伊', u'獵人', u'法師', u'聖騎士', u'牧師', u'盜賊', u'薩滿', u'術士', u'戰士' ] for i in range(0, 10): cs = CardClass() cs.classId = ids[i] cs.name = names[i] cs.enUS = enUSS[i] cs.zhTW = zhTWS[i] save(cs)
def to_card_class(cls): cc = CardClass(cls.__name__, cls.kind, cls.cost) if hasattr(cls, "action"): cc.set_action(cls.action) return cc