| # combatant string:
|
| # name:group:str:int:wis:dex:con:cha:lvl:hp:ap:skill:wpn_dice(1,2)
|
|
|
| # Fred:a:10:10:10:10:10:10:1:6:1:1:1
|
| # George:b:10:10:10:10:10:10:1:6:1:1:1
|
|
|
| # usage:
|
| # ./combat_rolls.py Fred:a:10:10:10:10:10:10:1:6:1:1:1 George:b:10:10:10:10:10:10:1:6:1:1:1 Samantha:b:10:10:10:10:10:10:1:6:1:1:1
|
| # a:
|
| # - Fred b
|
| # b:
|
| # - George a
|
| # - Samantha a
|
|
|
|
|
| import sys
|
|
|
| class Combatant():
|
| DATA = ['name', 'group', 'str', 'int', 'wis', 'dex', 'con', 'cha', 'lvl', 'hp', 'ap', 'skill', 'wpn_dice' ]
|
| def __init__(self,data):
|
| stuff = data.split(':')
|
| for index, value in enumerate(self.DATA):
|
| setattr(self, value, stuff[index])
|
|
|
|
|
| def get_other_side(groups, peep):
|
| sides = list(groups.keys())
|
| sides.remove(peep.group)
|
| return sides[0]
|
|
|
|
|
| peeps = []
|
| groups = {}
|
| for c in sys.argv[1:]:
|
| peep = Combatant(c)
|
| if peep.group not in groups.keys():
|
| groups[peep.group] = []
|
| groups[peep.group].append(peep)
|
|
|
|
|
| for group, peeps in groups.items():
|
| print("{}: ".format(group))
|
| for p in peeps:
|