core.components.monster module

class core.components.monster.Monster[source]

Bases: object

A class for a Tuxemon monster object. This class acts as a skeleton for a Tuxemon, fetching its details from a database.

Param:None

Example:

>>> bulbatux = Monster()
>>> bulbatux.load_from_db("Bulbatux")
>>> pprint.pprint(bulbatux.__dict__)
    {'attack': 10,
     'attack_modifier': [u'1', u'1.1', u'1.2'],
     'body': <core.components.fusion.Body instance at 0x1607638>,
     'defense': u'1,1.1,1.2',
     'defense_modifier': [u'1', u'1.1', u'1.2'],
     'hp': 30,
     'hp_modifier': [u'0.9', u'1', u'1.1'],
     'level': 0,
     'monster_id': 1,
     'moves': [<__main__.Technique instance at 0x160b4d0>],
     'name': u'Bulbatux',
     'special_attack': 9,
     'special_attack_modifier': [u'1', u'1.1', u'1.2'],
     'special_defense': 8,
     'special_defense_modifier': [u'1', u'1.1', u'1.2'],
     'speed': 7,
     'speed_modifier': [u'1', u'1.1', u'1.2'],
     'status': 'Normal',
     'type1': u'grass',
     'type2': u'poison',
     'experience_give_modifier': 3,
     'experience_required_modifier': 55}
apply_status(status)[source]

Apply a status to the monster

Return type:None
give_experience(amount=1)[source]

Gives the Monster a specified amount of experience, and levels up the monster if necessary.

Parameters:amount (Integer) – The amount of experience to add to the monster.
Return type:None
Returns:None

Example:

>>> bulbatux.give_experience(20)
learn(technique)[source]

Adds a technique to this tuxemon’s moveset.

Parameters:technique (core.components.monster.Technique) – The core.components.monster.Technique object for the monster to learn.
Return type:None
Returns:None

Examples:

>>> bulbatux.learn(Technique())
>>> bulbatux.moves[0].use(bulbatux, target=tuxmander)
level_up()[source]

Increases a Monster’s level by one and increases stats accordingly

Return type:None
Returns:None
load_from_db(name)[source]

Loads and sets this monster’s attributes from the monster.db database. The monster is looked up in the database by name.

Parameters:name (String) – The name of the monster to look up in the monster database.
Return type:None
Returns:None

Examples:

>>> bulbatux = Monster()
>>> bulbatux.load_from_db("Bigfin")
load_sprite_from_db()[source]

Looks up the path to the monster’s battle sprites so they can be loaded as pygame surfaces.

Param:None
Return type:None
Returns:None
load_sprites()[source]

Loads the monster’s sprite images as Pygame surfaces.

Return type:Boolean
Returns:True if the sprites are already loaded.

Examples:

>>> bulbatux.load_sprites()
>>> bulbatux.sprites
set_level(level=5)[source]

Sets the Monster’s level to the specified arbitrary level, and modifies experience accordingly.

Parameters:level (Integer) – The level to set the monster to.
Return type:None
Returns:None

Example:

>>> bulbatux.set_level(20)
set_stats()[source]

Sets the monsters initial stats, or imporves stats when called during a level up. If this is being called when the game is creating a monster, it should be looped through. Once for each level of the monster being created.

Return type:None
Returns:None

Example: