def __init__(self, json_in): self.data = json.loads(json_in) self.sid = ship.myid ship.myid += 1 self.name = self.data["name"] self.desc = self.data["desc"] self.dice = [] for d in self.data["dice"]: self.dice.append(die(d)) self.actions = [] for a in self.data["actions"]: self.actions.append(action(a))
{"attack_dice":1,"civilian_dice":1,}, {"frigate":1}, ], "limit":{ "phase":1, "turn":2, }, "scope":[ "any", ], "result":[ {"attack":1,"shield":1,}, {"attack":6}, ], } dsample_one = die(json.dumps(dsample1)) dsample_two = die(json.dumps(dsample2)) asample_one = action(json.dumps(asample)) ssample = { "name":"frigate", "desc":"A basic attack frigate.", "dice":[ dsample_one.json(), dsample_two.json(), ], "actions":[ asample_one.json(), ] }
"turn": 2, }, "scope": [ "any", ], "result": [ { "attack": 1, "shield": 1, }, { "attack": 6 }, ], } dsample_one = die(json.dumps(dsample1)) dsample_two = die(json.dumps(dsample2)) asample_one = action(json.dumps(asample)) ssample = { "name": "frigate", "desc": "A basic attack frigate.", "dice": [ dsample_one.json(), dsample_two.json(), ], "actions": [ asample_one.json(), ] }