I have to build the Fallout special system

This is the character sheet of the special system that I have made for my final CS230 project

import random  
from BagOfDice import DiceBag  
  
# Lists of strings containing the names of each SPECIAL, skill, and attribute  
specials_list = ["strength", "perception", "endurance", "charisma", "intelligence", "agility", "luck"]  
skills_list = ["barter", "energyweapons", "explosives", "guns", "lockpick", "medicine", "meleeweapons", "repair", "science", "sneak", "speech", "survival", "unarmed"]  
attributes_list = ["hitpoints", "actionpoints", "skillpoints", "carryweight", "damagethreshold", "radiationresistance", "movespeed", "compassrange", "criticalchance"]  
  
# Dictionary that contains each skill as keys and the SPECIAL that determines their initial value  
skill_special_relationship = {  
   "barter": "charisma",  
   "energyweapons": "perception",  
   "explosives": "endurance",  
   "guns": "agility",  
   "lockpick": "perception",  
   "medicine": "intelligence",  
   "meleeweapons": "strength",  
   "repair": "intelligence",  
   "science": "intelligence",  
   "sneak": "agility",  
   "speech": "charisma",  
   "survival": "endurance",  
   "unarmed": "strength"  
}  
  
class CharacterSheet:  
   def __init__(self, dice):  
      self.dice = dice  
      self.name = "Jean Doe"  
      self.specials = {}  
      self.skills = {}  
      self.attributes = {}  
      self.setSpecials()  
  
   def setSpecials(self):  
      for special in specials_list:  
        self.specials[special] = 0  
      remaining_points = 40  
      for special in self.specials:  
        roll = random.randint(1, 10)  
        if remaining_points - roll >= 0:  
           self.specials[special] = roll  
           remaining_points -= roll  
        else:  
           self.specials[special] = remaining_points  
           remaining_points = 0  
      self.setSkills()  
      self.setAttributes()  
  
   def setSkills(self):  
      for skill in skills_list:  
        self.skills[skill] = 0  
      for skill, special in skill_special_relationship.items():  
        self.skills[skill] = 5 + (self.specials[special] * 2) + (self.specials["luck"] // 2)  
  
   def setAttributes(self):  
      for attribute in attributes_list:  
        self.attributes[attribute] = 0  
      self.attributes["hitpoints"] = 50  
      for _ in range(self.specials["endurance"]):  
        self.attributes["hitpoints"] += self.dice.roll(1, 50)  
      for _ in range(self.specials["luck"]):  
        self.attributes["hitpoints"] += self.dice.roll(1, 10)  
      self.attributes["actionpoints"] = 35  
      for _ in range(self.specials["agility"]):  
        self.attributes["actionpoints"] += self.dice.roll(1, 10)  
      self.attributes["skillpoints"] = 10 + self.specials["intelligence"]  
      self.attributes["carryweight"] = 150  
      for _ in range(self.specials["strength"]):  
        self.attributes["carryweight"] += self.dice.roll(1, 20)  
      self.attributes["damagethreshold"] = self.specials["endurance"] // 2  
      self.attributes["radiationresistance"] = 0  
      for _ in range(self.specials["endurance"]):  
        self.attributes["radiationresistance"] += self.dice.roll(1, 4)  
      self.attributes["movespeed"] = 75 + (self.specials["agility"] * 5)  
      self.attributes["compassrange"] = 50 + (self.specials["perception"] * 10)  
      self.attributes["criticalchance"] = self.specials["luck"]  
  
   def setName(self, newName):  
      self.name = newName  
  
   def setAV(self, key, value):  
      if key in self.specials:  
        self.specials[key] = value  
        self.setSkills()  
        self.setAttributes()  
      elif key in self.skills:  
        self.skills[key] = value  
      elif key in self.attributes:  
        self.attributes[key] = value  
  
   def forceAV(self, key, value):  
      if key in self.specials:  
        self.specials[key] = value  
      elif key in self.skills:  
        self.skills[key] = value  
      elif key in self.attributes:  
        self.attributes[key] = value  
  
   def modAV(self, key, value):  
      if key in self.specials:  
        self.specials[key] += value  
        self.setSkills()  
        self.setAttributes()  
      elif key in self.skills:  
        self.skills[key] += value  
      elif key in self.attributes:  
        self.attributes[key] += value  
  
   def getAV(self, key):  
      if key in self.specials:  
        return self.specials[key]  
      elif key in self.skills:  
        return self.skills[key]  
      elif key in self.attributes:  
        return self.attributes[key]  
      else:  
        return None  
  
   def __str__(self):  
      output = f"Name: {self.name}nn"  
      output += "SPECIALs:n"  
      for special, value in self.specials.items():  
        output += f"{special.capitalize()}: {value}n"  
      output += "nSkills:n"  
      for skill, value in self.skills.items():  
        output += f"{skill.capitalize()}: {value}n"  
      output += "nAttributes:n"  
      for attribute, value in self.attributes.items():  
        output += f"{attribute.capitalize()}: {value}n"  
      return output

This is the dice bag it using

import random

class Die:
    def __init__(self, sides):
        self.sides = sides
        self.value = 1
    def roll(self):
        self.value = random.randrange(1,self.sides+1)
        return self.value
    
class DiceBag:
    def __init__(self, dice):
        self.dice = dice
    def singleRoll(self, selectedDie):
        for die in self.dice:
            if die.sides == selectedDie:
                return die.roll()
        return -1
    def multiRoll(self, selectedDie, numberOfRolls):
        for die in self.dice:
            if die.sides == selectedDie:
                total = 0
                for i in range(0,numberOfRolls):
                    total += die.roll()
                return total
        return -1

This is the main file that will print the results

from BagOfDice import Die, DiceBag  
from CharacterSheetEditor import CharacterSheet  


dice_bag = DiceBag()  
dice_bag.add_die(Die(4))  
dice_bag.add_die(Die(6))  
dice_bag.add_die(Die(10))  
dice_bag.add_die(Die(20))  
dice_bag.add_die(Die(50))  


character_sheet = CharacterSheet(dice_bag)  

#Call setName, setAV, forceAV, modAV, and getAV to show that they work
character_sheet.setName("John Doe")  
character_sheet.setAV("strength", 8)  
character_sheet.forceAV("barter", 50)  
character_sheet.modAV("intelligence", 2)  

#  Get and print attribute values
print(character_sheet.getAV("strength"))  # Expected: 8
print(character_sheet.getAV("barter"))    # Expected: 50
print(character_sheet.getAV("intelligence"))  # Expected: (Original value + 2)

# Print the character sheet
print(character_sheet)

I keep getting a trace back error. What is going wrong with it?

I’ve tried to get the outputs to come where it shows up like you’ve made a character and what they are good at in each stat but it just comes back with a trace back error.

Traceback (most recent call last):
  File "c:Users****DownloadsCharacterSheetEditormain.py", line 21, in <module>
    dice_bag = DiceBag()
               ^^^^^^^^^
TypeError: DiceBag.__init__() missing 1 required positional argument: 'dice'

New contributor

Skinwalker05711 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật