3.5. textgame.movable¶
This module is for everything that sits around in rooms.
-
class
textgame.movable.
Item
(description, name, ID='', takable=True, value=0, key=None, initlocation='')[source]¶ Bases:
object
everything that is somewhat movable like treasures, weapons, tools, monsters
- Parameters
description – string describing the thing
name – short name for the thing
ID – unique string by which the item can be taken by the player (eg. ‘coins’ for ‘a sack of coins’)
takable (bool) – is the player able to add this to his/her inventory?
value (int or float) – how valuable the item is
key – if an item has a key, it can be used to open/close doors that are locked with the same key
initlocation (string) – room ID of the room this thing should be placed in at the beginning of the game
-
class
textgame.movable.
Monster
(description, name, ID='', takable=False, deaddescript='', initlocation='', strength=0, spawns_in=None, spawns_at='always', spawn_prob=0, ignoretext='', status=None)[source]¶ Bases:
textgame.movable.Item
monsters or people, can fight, get spawned or always be at one place, get killed
- Parameters
deaddescript – string describing the thing when it’s dead
strength – float between 0 and 1
spawns_in – list of strings with room IDs (or even only part of room IDs) that specify in which rooms the monster should spawn
spawns_at – define the daytime at which the monster should spawn (always/night/day)
spawn_prob – probability to spawn (float between 0 and 1)
ignoretext – this gets returned by
textgame.player.Player.attack()
if the monster’s history is -1. This only happens if the monster has an initlocationstatus – dict that can (but doesn’t need to) contain the following key-value pairs (values must be bool): ‘alive’, ‘active’, ‘fighting’, ‘trap’, ‘singleencounter’, ‘harmless’
-
class
textgame.movable.
Weapon
(*args, **kwargs)[source]¶ Bases:
textgame.movable.Item