Exemplo n.º 1
0
    def __init__(self):
        self.HP = random.randint(100, 125)
        self.Attack = random.randint(10, 20)
        self.Kisses = []
        self.Straws = []
        self.Chocolates = []
        self.Nerds = []
        print("Your starting HP is " + str(self.HP))
        print("Your attack is " + str(self.Attack))
        for count in range(10):
            weaponType = random.randint(1, 4)
            if (weaponType == 1):
                newWeapon = HersheysKiss()
                self.Kisses.append(newWeapon)
            elif (weaponType == 2):
                newWeapon = SourStraw()
                self.Straws.append(newWeapon)
            elif (weaponType == 3):
                newWeapon = ChocolateBar()
                self.Chocolates.append(newWeapon)
            elif (weaponType == 4):
                newWeapon = NerdBomb()
                self.Nerds.append(newWeapon)

        print("\nOn Halloween, you picked: \n" + str(len(self.Kisses)) +
              " Hershey's Kisses\n" + " - Attack Modifier: 1\n" +
              " - Each can be used an unlimited amount of times\n" +
              str(len(self.Straws)) + " Sour Straws\n" +
              " - Attack Modifier: 1-1.75 \n" + " - Each can be used twice\n" +
              str(len(self.Chocolates)) + " Chocolate Bars\n" +
              " - Attack Modifier: 2-2.4\n" +
              " - Each can be used four times\n" + str(len(self.Nerds)) +
              " Nerd Bombs\n" + " - Attack modifier: 3.5-5\n" +
              " - Each can be used once\n")
Exemplo n.º 2
0
    def getAttacked(self, monster):
        minAttack = int(monster.getMinAttack())
        maxAttack = int(monster.getMaxAttack())
        attack = random.randint(minAttack, maxAttack)
        if (monster.getName() == "Person"):
            self.HP = self.HP + 1
            weaponType = random.randint(1, 4)
            weaponType = random.randint(1, 4)
            if (weaponType == 1):
                newWeapon = HersheysKiss()
                self.Kisses.append(newWeapon)
            elif (weaponType == 2):
                newWeapon = SourStraw()
                self.Straws.append(newWeapon)
            elif (weaponType == 3):
                newWeapon = ChocolateBar()
                self.Chocolates.append(newWeapon)
            elif (weaponType == 4):
                newWeapon = NerdBomb()
                self.Nerds.append(newWeapon)

            print("A Person in the house helped you! Your HP is now " +
                  str(self.HP))
            print("You have also been given a " + newWeapon.Name)
        else:
            self.HP = self.HP - attack
            print("A " + monster.Name + " attacked you for: " + str(attack))
            print("Your HP is now " + str(self.HP))
Exemplo n.º 3
0
 def setInventory(self):
     self.inventory[0] = HersheyKisses()
     self.inventory[0].setAttackModifier(
         round(self.inventory[0].getAttack() * self.attackLevel, 2))
     for i in range(1, len(self.inventory)):
         temp = [ChocolateBar(), SourStraw(), NerdBomb()]
         self.inventory[i] = temp[randint(0, 2)]
         self.inventory[i].setAttackModifier(
             round(self.inventory[i].getAttack() * self.attackLevel, 2))
Exemplo n.º 4
0
 def pickRandomWeapon(self):
     random = randint(0, 3)
     if random == 0:
         return HersheyKiss()
     elif random == 1:
         return SourStraw()
     elif random == 2:
         return ChocolateBar()
     elif random == 3:
         return NerdBomb()
Exemplo n.º 5
0
 def generateWeapons(self):
     ''' generate a random list of weapons '''
     self.weapons.append(HersheyKiss())
     for i in range(9):
         weaponNum = random.randint(2, 4)
         if (weaponNum == 2):
             self.weapons.append(SourStraw())
         elif (weaponNum == 3):
             self.weapons.append(ChocolateBar())
         elif (weaponNum == 4):
             self.weapons.append(NerdBomb())
Exemplo n.º 6
0
    def attack(self):
        choice = int(
            input(("Choose a weapon: \n" +
                   " 1 = Hershey Kiss: Infinite uses remaining\n" +
                   " 2 = Sour Straw: " + str(len(self.Straws) * 2) +
                   " uses remaining\n" + " 3 = Chocolate Bar: " +
                   str(len(self.Chocolates) * 4) + " uses remaining\n" +
                   " 4 = Nerd Bomb: " + str(len(self.Nerds)) +
                   " uses remaining\n")))

        if (choice == 1):
            damage = 1
        elif (choice == 2):
            weapon = SourStraw()
        elif (choice == 3):
            weapon = ChocolateBar()
        elif (choice == 4):
            weapon = NerdBomb()

        #Trying to figure out why i can't get an int from the weapon class
        uses = weapon.getUses()
        print(uses)
Exemplo n.º 7
0
 def __init__(self):
     super().__init__("Player", 100, 125, 10, 20)
     self.inv = list()
     self.invMax = 10
     self.inv.append(HersheyKiss())
     for i in range(9):
         roll = random.randint(0, 2)
         item = NerdBomb()
         if (roll == 0):
             item = SourStraw()
         elif (roll == 1):
             item = ChocolateBar()
         self.inv.append(item)
Exemplo n.º 8
0
 def __fillInventory(self):
     # clear inventory
     # refill with new weapons
     weapon_types = []
     for x in range(10):
         random = randint(0, 3)
         if random == 0:
             weapon_types.append(HersheyKiss())
         elif random == 1:
             weapon_types.append(SourStraw())
         elif random == 2:
             weapon_types.append(ChocolateBar())
         elif random == 3:
             weapon_types.append(NerdBomb())
     return weapon_types
Exemplo n.º 9
0
    def __init__(self):
        self.__health = randint(100, 125)
        self.__min_attack_val = 10
        self.__max_attack_val = 20
        self.__inventory_size = 10
        __num_kisses = 1
        __num_straws = 0
        __num_bars = 0
        __num_bombs = 0
        self.__inventory = \
            {'Hershey Kiss': {'obj': HersheyKiss(), 'num': __num_kisses},
             'Sour Straw': {'obj': SourStraw(), 'num': __num_straws},
             'Chocolate Bar': {'obj': ChocolateBar(), 'num': __num_bars},
             'Nerd Bomb': {'obj': NerdBomb(), 'num': __num_bombs}}

        self.__fill_inventory()