def __init__(self, name, item_manager=None, speed=None, hp=None, defense=None, atk=None):
        self.NAME = name
        self.item_manager = item_manager if item_manager is not None else ItemManager()
        self._SPEED = int(speed) if speed is not None else generate_attribute(self._AVERAGE_SPEED, self._SPEED_SPREAD)
        self.HP = int(hp) if hp is not None else generate_attribute(self._AVERAGE_HP, self._HP_SPREAD)
        self._DEF = int(defense) if defense is not None else generate_attribute(self._AVERAGE_DEF, self._DEF_SPREAD)
        self._ATK = int(atk) if atk is not None else generate_attribute(self._AVERAGE_ATK, self._ATK_SPREAD)
        self._LOG_ATTRIBUTES = [self.get_formatted_name, self.get_formatted_attack, self.get_formatted_defense,
                                self.get_formatted_hp, self.get_formatted_items]

        self._SPOOK_ROUNDS_AHEAD = 0
        self._SPOOK_PENALTY = 0
Ejemplo n.º 2
0
    def __init__(self, attack=None, defense=None, speed=None, spook_rate=None, spook_power=None):
        if spook_power is not None and spook_power < 0:
            raise ValueError("spook_power must be greater than zero. Specified value was " + spook_power)
        self.ATTACK_BOOST = attack if attack is not None else generate_attribute(self._AVERAGE_ATK_BOOST,
                                                                                 self._ATK_SPREAD)
        self.DEFENSE_BOOST = defense if defense is not None else generate_attribute(self._AVERAGE_DEF_BOOST,
                                                                                    self._DEF_SPREAD)
        self.SPEED_BOOST = speed if speed is not None else generate_attribute(self._AVERAGE_SPEED_BOOST,
                                                                              self._SPEED_SPREAD)
        self.SPOOK_RATE = spook_rate if spook_rate is not None else generate_attribute(self._AVERAGE_SPOOK_RATE,
                                                                                       self._SPOOK_RATE_SPREAD)
        self.SPOOK_POWER = spook_power if spook_power is not None else generate_attribute(self._AVERAGE_SPOOK_POWER,
                                                                                          self._SPOOK_POWER_SPREAD)

        # Primary value is used by implementations of base item to indicate to item manager how the items are to
        # be prioritized. For example, a sword's primary value is attack and a shield's primary value is defense.
        # Swords will be ranked by their attack points and shields will be ranked by their defiense points.
        self.PRIMARY_VALUE = lambda: raise_(NotImplementedError("PRIMARY_VALUE is not implemented."))