コード例 #1
0
 def get_player_party(self, count=3):
     """Return player party."""
     ui = self.ui
     party = []
     for i in range(1, count + 1, 1):
         charName = input(f"Enter player {i} Name:")
         if len(charName) <= 0:
             ui.print_error("You must enter at least 1 character")
         else:
             # Create party member
             mbr = Person({
                 "name": charName,
                 "hp": 500,
                 "mp": 70,
                 "attack": 45,
                 "defense": 40,
                 "spells": self.spellList
             })
             mbr.action = ["Attack", "Magic", "Item"]
             # Fill party mbr's inventory
             for item in self.itemList:
                 mbr.add_item(item, 5)
             # Add party mbr to player party
             self.add_party_member(party, mbr)
     return party
コード例 #2
0
 def get_enemy_party(self, count=3):
     """Return ."""
     party = []
     for i in range(1, count + 1, 1):
         enemy = Person({
             "name": f"S******d {i}",
             "hp": 500,
             "mp": 70,
             "attack": 45,
             "defense": 40,
             "spells": self.spellList
         })
         enemy.action = ["Attack", "Magic", "Item"]
         for item in self.itemList:
             enemy.add_item(item, 5)
         self.add_party_member(party, enemy)
     return party