Beispiel #1
0
 def duplicate_member(self, command_line, widget_proxy, live):
     if self.parent.selected and not self.parent.selected.is_player:
         match = self.duplicate_member_re.search(command_line)
         if match:
             copies = int(match.group('copies'))
             old = self.parent.selected
             for _ in range(copies):
                 new = Member.npc(old.base_name, old.stat_block)
                 self.parent.encounter.add_member(new)
             self.parent.show_members()
         else:
             self.show_temp_message(msg='Invalid Args')
Beispiel #2
0
    def test_as_dict_from_dict_same_object(self):
        s = StatBlock({'hit_points': 50, 'dexterity': 14})
        m = Member.npc('base', s)

        d = m.as_dict()
        new = Member.empty()
        new.from_dict(d)

        compare(actual=new.base_name, expected=m.base_name)
        compare(actual=new.name, expected=m.name)
        compare(actual=new.piece_name, expected=m.piece_name)
        compare(actual=new.is_player, expected=m.is_player)
        compare(actual=new.used_slots, expected=m.used_slots)
        compare(actual=new.current_hp, expected=m.current_hp)
        compare(actual=new.hit_points, expected=m.hit_points)
        compare(actual=new.initiative, expected=m.initiative)
        compare(actual=new.is_alive, expected=m.is_alive)
        compare(actual=new.current_turn, expected=m.current_turn)
 def add_to_encounter(self, value):
     encounter = self.parent.encounter
     stat_block = self._load_value(value)
     encounter.add_member(Member.npc(stat_block.name, stat_block))
     self.parent.parentApp.switchFormPrevious()