def getForbiddenItemsFromList(self, itemList):
     self.log.debug('getForbiddenItemsFromList: ' + str(itemList))
     remove = []
     n = randGaussBounds(len(itemList))
     for i in range(n):
         idx = random.randint(0, len(itemList) - 1)
         item = itemList.pop(idx)
         if item is not None:
             remove.append(item)
     return remove
Beispiel #2
0
    def addEnergy(self):
        total = 18
        energyQty = self.qty['energy']
        if energyQty == 'sparse':
            # 4-6
            if random.random() < 0.5:
                self.itemManager.addItem('Reserve')
            else:
                self.itemManager.addItem('ETank')
            # 3 in the pool (1 E, 1 R + the previous one)
            alreadyInPool = 3
            rest = 1 + randGaussBounds(2, 5)
            for i in range(rest):
                self.itemManager.addItem('ETank')
            # complete up to 18 energies with nothing item
            for i in range(total - alreadyInPool - rest):
                self.itemManager.addItem('NoEnergy')

        elif energyQty == 'medium':
            # 8-12
            # add up to 3 Reserves or ETanks (cannot add more than 3 reserves)
            for i in range(3):
                if random.random() < 0.5:
                    self.itemManager.addItem('Reserve')
                else:
                    self.itemManager.addItem('ETank')
            # 5 already in the pool (1 E, 1 R, + the previous 3)
            alreadyInPool = 5
            rest = 3 + randGaussBounds(4, 3.7)
            for i in range(rest):
                self.itemManager.addItem('ETank')
            # fill the rest with NoEnergy
            for i in range(total - alreadyInPool - rest):
                self.itemManager.addItem('NoEnergy')
        else:
            # add the vanilla 3 reserves and 13 Etanks
            for i in range(3):
                self.itemManager.addItem('Reserve')
            for i in range(13):
                self.itemManager.addItem('ETank')
Beispiel #3
0
def addEnergy(qty, itemPool):
    energyQty = qty['energy']
    if energyQty == 'sparse':
        # 4-6
        if random.random() < 0.5:
            addItem('Reserve', itemPool)
        else:
            addItem('ETank', itemPool)
        # 3 in the pool (1 E, 1 R + the previous one)
        rest = 1 + randGaussBounds(2, 5)
        for i in range(rest):
            addItem('ETank', itemPool)
        # complete up to 18 energies with nothing item
        for i in range(18 - 3 - rest):
            itemPool.append(NoEnergy)
    elif qty['energy'] == 'medium':
        # 8-12
        # add up to 3 Reserves or ETanks (cannot add more than 3 reserves)
        for i in range(3):
            if random.random() < 0.5:
                addItem('Reserve', itemPool)
            else:
                addItem('ETank', itemPool)
        # 5 already in the pool (1 E, 1 R, + the previous 3)
        rest = 3 + randGaussBounds(4, 3.7)
        for i in range(rest):
            addItem('ETank', itemPool)
        # fill the rest with NoEnergy
        for i in range(18 - 6 - rest):
            itemPool.append(NoEnergy)
    else:
        # add the vanilla 3 reserves and 13 Etanks
        for i in range(3):
            addItem('Reserve', itemPool)
        for i in range(13):
            addItem('ETank', itemPool)
 def __init__(self, itemManager, qty, sm):
     super(ItemPoolGeneratorMajors, self).__init__(itemManager, qty, sm)
     self.sparseRest = 1 + randGaussBounds(2, 5)
     self.mediumRest = 3 + randGaussBounds(4, 3.7)
     self.ultraSparseNoTanks = random.random() < 0.5
    def addEnergy(self):
        total = 18
        energyQty = self.qty['energy']
        if energyQty == 'ultra sparse':
            # 0-1, remove reserve tank and two etanks, check if it also remove the last etank
            self.itemManager.removeItem('Reserve')
            self.itemManager.addItem('NoEnergy', 'Chozo')
            self.itemManager.removeItem('ETank')
            self.itemManager.addItem('NoEnergy', 'Chozo')
            self.itemManager.removeItem('ETank')
            self.itemManager.addItem('NoEnergy', 'Chozo')
            if random.random() < 0.5:
                # no etank nor reserve
                self.itemManager.removeItem('ETank')
                self.itemManager.addItem('NoEnergy', 'Chozo')
            elif random.random() < 0.5:
                # replace only etank with reserve
                self.itemManager.removeItem('ETank')
                self.itemManager.addItem('Reserve', 'Chozo')

            # complete up to 18 energies with nothing item
            alreadyInPool = 4
            for i in range(total - alreadyInPool):
                self.itemManager.addItem('Nothing', 'Minor')
        elif energyQty == 'sparse':
            # 4-6
            # already 3E and 1R
            alreadyInPool = 4
            rest = randGaussBounds(2, 5)
            if rest >= 1:
                if random.random() < 0.5:
                    self.itemManager.addItem('Reserve', 'Minor')
                else:
                    self.itemManager.addItem('ETank', 'Minor')
            for i in range(rest - 1):
                self.itemManager.addItem('ETank', 'Minor')
            # complete up to 18 energies with nothing item
            for i in range(total - alreadyInPool - rest):
                self.itemManager.addItem('Nothing', 'Minor')
        elif energyQty == 'medium':
            # 8-12
            # add up to 3 Reserves or ETanks (cannot add more than 3 reserves)
            for i in range(3):
                if random.random() < 0.5:
                    self.itemManager.addItem('Reserve', 'Minor')
                else:
                    self.itemManager.addItem('ETank', 'Minor')
            # 7 already in the pool (3 E, 1 R, + the previous 3)
            alreadyInPool = 7
            rest = 1 + randGaussBounds(4, 3.7)
            for i in range(rest):
                self.itemManager.addItem('ETank', 'Minor')
            # fill the rest with NoEnergy
            for i in range(total - alreadyInPool - rest):
                self.itemManager.addItem('Nothing', 'Minor')
        else:
            # add the vanilla 3 reserves and 13 Etanks
            for i in range(3):
                self.itemManager.addItem('Reserve', 'Minor')
            for i in range(11):
                self.itemManager.addItem('ETank', 'Minor')
Beispiel #6
0
 for i in range(10000):
     if (i + 1) % 100 == 0:
         print(i + 1)
     isVanilla = random.random() < 0.5
     strictMinors = bool(random.getrandbits(1))
     minQty = 100
     energyQty = 'vanilla'
     forbidden = []
     if not isVanilla:
         minQty = random.randint(1, 99)
         if random.random() < 0.5:
             energyQty = 'medium'
         else:
             energyQty = 'sparse'
         funPick = fun[:]
         for i in range(randGaussBounds(len(fun))):
             item = funPick[random.randint(0, len(funPick) - 1)]
             forbidden.append(item)
             funPick.remove(item)
     missProb = random.randint(1, 9)
     superProb = random.randint(1, 9)
     pbProb = random.randint(1, 9)
     qty = {
         'minors': minQty,
         'energy': energyQty,
         'ammo': {
             'Missile': missProb,
             'Super': superProb,
             'PowerBomb': pbProb
         },
         'strictMinors': strictMinors