Beispiel #1
0
    def randomize_damage_modifiers(self):
        # Generate small random damage modifiers for the mage. These won't make a huge deal for the most part.
        resistances = {}
        for magic_type in MagicTypesEnum.choices():
            resistances[magic_type] = random.randint(0, 4) - 2

        for affinity in self.magical_affinity:
            resistances[affinity] += 2

        self.resistances = resistances
Beispiel #2
0
    def randomize_stats(self, pool=None):
        """
        Pool of stat points to use. If not set will instead generate a random one.
        Initial stats come from on of 4 possible buckets.
        80% of the time you get 20 to 29 points.
        15% of the time you get 30 to 32
        4% of the time you get 33 to 34, and
        1% of the time you get 35 to 38.
        :return:
        """
        if pool is None:
            pool = random.randint(0, 100)
            if 0 <= pool <= 80:
                pool = random.randint(20, 29)
            elif 80 < pool <= 95:
                pool = random.randint(30, 34)
            elif 95 < pool <= 99:
                pool = random.randint(35, 39)
            else:
                pool = random.randint(40, 44)

        self.assign_stats_from_pool(pool)
Beispiel #3
0
    def randomize_affinity(self, rand_count=2):
        """
        Give the mage random affinities. Gives them rand_count total affinities. If they already have some, they
        will get that many less.
        :param rand_count:
        :return:
        """
        magic_types = MagicTypesEnum.choices()
        magical_affinity = []
        for existing_type in self.magical_affinity:
            magic_types.remove(existing_type)
            rand_count -= 1

        for _ in range(rand_count):
            magic_type = magic_types[random.randint(0, len(magic_types) - 1)]
            magical_affinity.append(magic_type)
            magic_types.remove(magic_type)

        self.magical_affinity = magical_affinity