scripts.engine.internal package¶
Submodules¶
scripts.engine.internal.action module¶
-
class
Action
[source]¶ Bases:
abc.ABC
Action taken during the game. A container for Effects.
-
effects
: List[scripts.engine.core.effect.Effect]¶
-
shape
: ShapeType¶
-
-
class
Affliction
(origin: int, affected_entity: int, duration: int)[source]¶ Bases:
scripts.engine.internal.action.Action
A subclass of Affliction represents an affliction (a semi-permanent modifier) and holds all the data that is not dependent on the individual instances - stuff like applicable targets etc.
An instance of Affliction represents an individual application of that affliction, and holds only the data that is tied to the individual use - stuff like the user and target.
-
__init__
(origin: int, affected_entity: int, duration: int)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
apply
() → Iterator[Tuple[EntityID, List[Effect]]][source]¶ Apply the affliction to the affected entity. An iterator over pairs of (affected entity, [effects]). Use affected entity position. Applies to each entity only once.
-
category
: AfflictionCategoryType¶
-
triggers
: List[ReactionTriggerType]¶
-
-
class
Behaviour
(attached_entity: int)[source]¶ Bases:
abc.ABC
Base class for AI behaviours. Not really an Action, as such, more of a super class that determines when npcs will use Actions.
-
class
DelayedSkill
(attached_entity: int)[source]¶ Bases:
scripts.engine.internal.action.Behaviour
After duration ends trigger skill centred on self.
-
class
Projectile
(attached_entity: int)[source]¶ Bases:
scripts.engine.internal.action.Behaviour
Move in direction, up to max_range (in tiles). Speed is time spent per tile moved.
-
class
Skill
(user: int, target_tile: scripts.engine.world_objects.tile.Tile, direction: DirectionType)[source]¶ Bases:
scripts.engine.internal.action.Action
A subclass of Skill represents a skill and holds all the data that is not dependent on the individual cast - stuff like shape, base accuracy, etc.
An instance of Skill represents an individual use of that skill, and additionally holds only the data that is tied to the individual use - stuff like the user and target.
-
__init__
(user: int, target_tile: scripts.engine.world_objects.tile.Tile, direction: DirectionType)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
apply
() → Iterator[Tuple[EntityID, List[Effect]]][source]¶ An iterator over pairs of (affected entity, [effects]). Uses target tile. Can apply to an entity multiple times.
-
blessings
: List[SkillModifier]¶
-
delayed_skill_data
: Optional[DelayedSkillData]¶
-
projectile_data
: Optional[ProjectileData]¶
-
resource_type
: ResourceType¶
-
target_directions
: List[DirectionType]¶
-
targeting_method
: TargetingMethodType¶
-
-
class
SkillModifier
(owner)[source]¶ Bases:
abc.ABC
The base class for blessings. Blessings modify skills through the effects applied.
-
apply
(effects: List[scripts.engine.core.effect.Effect], owner, target)[source]¶ This is the core function of the blessing. It takes the effect stack and modifies it with the blessing.
-
property
involved_effects
¶ Get the set of effects involved in the blessing.
-
roll_level
()[source]¶ Runs the level selection algorithm and updates attributes with the applied level.
-
-
register_action
(cls: Type[Union[Action, Behaviour, SkillModifier]])[source]¶ Initialises the class properties set by external data, if appropriate, and adds to the action registry for use by the engine.
scripts.engine.internal.constant module¶
-
class
AfflictionCategory
[source]¶ Bases:
types.SimpleNamespace
Boon or Bane
-
BANE
= 'boon'¶
-
BOON
= 'bane'¶
-
-
class
DamageType
[source]¶ Bases:
types.SimpleNamespace
Damage types
-
ASTRAL
= 'astral'¶
-
BURN
= 'burn'¶
-
CHEMICAL
= 'chemical'¶
-
COLD
= 'cold'¶
-
MUNDANE
= 'mundane'¶
-
-
class
Direction
[source]¶ Bases:
types.SimpleNamespace
Holds a tuple as (x, y) for the relative direction.
-
CENTRE
= (0, 0)¶
-
DOWN
= (0, 1)¶
-
DOWN_LEFT
= (-1, 1)¶
-
DOWN_RIGHT
= (1, 1)¶
-
LEFT
= (-1, 0)¶
-
RIGHT
= (1, 0)¶
-
UP
= (0, -1)¶
-
UP_LEFT
= (-1, -1)¶
-
UP_RIGHT
= (1, -1)¶
-
-
class
EffectType
[source]¶ Bases:
types.SimpleNamespace
Types of effects
-
AFFECT_COOLDOWN
= 'affect_cooldown'¶
-
AFFECT_STAT
= 'affect_stat'¶
-
ALTER_TERRAIN
= 'alter_terrain'¶
-
APPLY_AFFLICTION
= 'apply_affliction'¶
-
DAMAGE
= 'damage'¶
-
MOVE
= 'move'¶
-
-
class
EventType
(value)[source]¶ Bases:
enum.IntEnum
The types of possible customer pygame events.
-
GAME
= 2¶
-
INPUT
= 1¶
-
INTERACTION
= 3¶
-
-
class
GameEventType
(value)[source]¶ Bases:
enum.IntEnum
Custom pygame event names triggered by the game
-
END_ROUND
= 10¶
-
END_TURN
= 8¶
-
EXIT_GAME
= 4¶
-
EXIT_MENU
= 1¶
-
LOAD_GAME
= 3¶
-
MESSAGE
= 11¶
-
NEW_GAME
= 2¶
-
NEW_ROUND
= 9¶
-
NEW_TURN
= 7¶
-
START_GAME
= 6¶
-
WIN_CONDITION_MET
= 5¶
-
-
class
GameState
(value)[source]¶ Bases:
enum.IntEnum
States the game can be in.
-
DEVELOPER
= 6¶
-
EXITING
= 5¶
-
GAME_MAP
= 2¶
-
LOADING
= 1¶
-
MENU
= 7¶
-
PLAYER_DEAD
= 3¶
-
TARGETING
= 4¶
-
-
class
Height
[source]¶ Bases:
types.SimpleNamespace
How tall an entity is.
-
DIMINUTIVE
= 2¶
-
LOFTY
= 4¶
-
MAX
= 5¶
-
MIDDLING
= 3¶
-
MIN
= 1¶
-
-
class
HitType
[source]¶ Bases:
types.SimpleNamespace
The value of each hit type. The value is the starting amount.
-
CRIT
= 'crit'¶
-
GRAZE
= 'graze'¶
-
HIT
= 'hit'¶
-
-
class
InputEventType
(value)[source]¶ Bases:
enum.IntEnum
Custom pygame event names triggered by input. These need to be interpreted into intents.
-
SKILL_BAR_CLICK
= 32776¶
-
TILE_CLICK
= 32775¶
-
-
class
InputIntent
[source]¶ Bases:
types.SimpleNamespace
Values of the conversion from input to intent. Strings.
-
ACTOR_INFO_TOGGLE
= 'actor_info_toggle'¶
-
BURST_PROFILE
= 'burst_profile'¶
-
CANCEL
= 'cancel'¶
-
CENTRE
= 'centre'¶
-
CONFIRM
= 'confirm'¶
-
DEBUG_TOGGLE
= 'debug_toggle'¶
-
DEV_TOGGLE
= 'dev_toggle'¶
-
DOWN
= 'down'¶
-
DOWN_LEFT
= 'down_left'¶
-
DOWN_RIGHT
= 'down_right'¶
-
DUNGEON_DEV_VIEW
= 'dungeon_dev_toggle'¶
-
EXIT
= 'exit'¶
-
LEFT
= 'left'¶
-
LEFT_CLICKED
= 'left_clicked'¶
-
REFRESH_DATA
= 'refresh_data'¶
-
RIGHT
= 'right'¶
-
SKILL0
= 'skill0'¶
-
SKILL1
= 'skill1'¶
-
SKILL2
= 'skill2'¶
-
SKILL3
= 'skill3'¶
-
SKILL4
= 'skill4'¶
-
SKILL5
= 'skill5'¶
-
TEST
= 'test'¶
-
TOGGLE_UI
= 'toggle_ui'¶
-
UP
= 'up'¶
-
UP_LEFT
= 'up_left'¶
-
UP_RIGHT
= 'up_right'¶
-
-
class
InteractionEventType
(value)[source]¶ Bases:
enum.IntEnum
Custom pygame events to trigger interactions. Think of these as categories for Reaction Triggers.
-
AFFECT_COOLDOWN
= 4¶
-
AFFECT_STAT
= 3¶
-
AFFLICTION
= 5¶
-
ALTER_TERRAIN
= 6¶
-
DAMAGE
= 2¶
-
MOVE
= 1¶
-
-
class
PrimaryStat
[source]¶ Bases:
types.SimpleNamespace
Primary stats. Values are strings.
-
BUSTLE
= 'bustle'¶
-
CLOUT
= 'clout'¶
-
EXACTITUDE
= 'exactitude'¶
-
SKULLDUGGERY
= 'skullduggery'¶
-
VIGOUR
= 'vigour'¶
-
-
class
ProjectileExpiry
[source]¶ Bases:
types.SimpleNamespace
What happens when the skill reaches the range limit
-
ACTIVATE
= 'activate'¶
-
FIZZLE
= 'fizzle'¶
-
-
class
ProjectileSpeed
[source]¶ Bases:
types.SimpleNamespace
The speed at which a projectile travels; how much time to move a tile. N.B. does not use base move_cost
-
AVERAGE
= 5¶
-
FAST
= 2¶
-
INSTANT
= 0¶
-
SLOW
= 10¶
-
-
class
ReactionTrigger
[source]¶ Bases:
types.SimpleNamespace
Type of trigger for the affliction
-
AFFLICTED
= 'afflicted'¶
-
CAUSED_AFFECT_COOLDOWN
= 'caused_affect_cooldown'¶
-
CAUSED_AFFECT_STAT
= 'caused_affect_stat'¶
-
CAUSED_AFFLICTION
= 'caused_affliction'¶
-
COLLISION
= 'collision'¶
-
COOLDOWN_AFFECTED
= 'cooldown_affected'¶
-
DEAL_DAMAGE
= 'deal_damage'¶
-
DIE
= 'die'¶
-
KILL
= 'kill'¶
-
MOVE
= 'move'¶
-
MOVED
= 'moved'¶
-
PROXIMITY
= 'proximity'¶
-
STAT_AFFECTED
= 'stat_affected'¶
-
TAKE_DAMAGE
= 'take_damage'¶
-
-
class
RenderLayer
(value)[source]¶ Bases:
enum.IntEnum
The possible render layers. Lower number is further down the stack.
-
ACTOR
= 40¶
-
BOTTOM
= 10¶
-
TERRAIN
= 30¶
-
TILE
= 20¶
-
UI_BASE
= 50¶
-
UI_WINDOW
= 60¶
-
-
class
Resource
[source]¶ Bases:
types.SimpleNamespace
Resources that can be used. Must map to secondary stats.
-
HEALTH
= 'health'¶
-
STAMINA
= 'stamina'¶
-
-
class
SecondaryStat
[source]¶ Bases:
types.SimpleNamespace
Secondary stats
-
ACCURACY
= 'accuracy'¶
-
MAX_HEALTH
= 'max_health'¶
-
MAX_STAMINA
= 'max_stamina'¶
-
RESIST_ASTRAL
= 'resist_astral'¶
-
RESIST_BURN
= 'resist_burn'¶
-
RESIST_CHEMICAL
= 'resist_chemical'¶
-
RESIST_COLD
= 'resist_cold'¶
-
RESIST_MUNDANE
= 'resist_mundane'¶
-
RUSH
= 'rush'¶
-
-
class
Shape
[source]¶ Bases:
types.SimpleNamespace
When to trigger the afflictions
-
CIRCLE
= 'circle'¶
-
CONE
= 'cone'¶
-
CROSS
= 'cross'¶
-
SQUARE
= 'square'¶
-
TARGET
= 'target'¶
-
-
class
SpriteCategory
[source]¶ Bases:
types.SimpleNamespace
-
ATTACK
= 'attack'¶
-
DEAD
= 'dead'¶
-
HIT
= 'hit'¶
-
ICON
= 'icon'¶
-
IDLE
= 'idle'¶
-
MOVE
= 'move'¶
-
-
class
TargetingMethod
[source]¶ Bases:
types.SimpleNamespace
Specify the way in which as skill is targeted
-
AUTO
= 'auto'¶
-
DIRECTION
= 'direction'¶
-
TILE
= 'tile'¶
-
-
class
TerrainCollision
[source]¶ Bases:
types.SimpleNamespace
What to do when a skill hits terrain
-
ACTIVATE
= 'activate'¶
-
FIZZLE
= 'fizzle'¶
-
REFLECT
= 'reflect'¶
-
-
class
TileCategory
[source]¶ Bases:
types.SimpleNamespace
The type of tile to be placed. Used in Dungen only.
-
ACTOR
= 'actor'¶
-
DEBUG
= 'debug'¶
-
FLOOR
= 'floor'¶
-
PLAYER
= 'player'¶
-
WALL
= 'wall'¶
-
-
class
TileTag
[source]¶ Bases:
types.SimpleNamespace
Tags identifying a situation on a Tile.
-
ACTOR
= 'actor'¶
-
ANY
= 'any'¶
-
BLOCKED_MOVEMENT
= 'blocked_movement'¶
-
IS_VISIBLE
= 'is_visible'¶
-
NO_BLOCKING_TILE
= 'no_blocking_tile'¶
-
NO_ENTITY
= 'no_entity'¶
-
OPEN_SPACE
= 'open_space'¶
-
OTHER_ENTITY
= 'other_entity'¶
-
SELF
= 'self'¶
-
-
class
TraitGroup
[source]¶ Bases:
types.SimpleNamespace
The types of player traits
-
HOMELAND
= 'homeland'¶
-
NPC
= 'npc'¶
-
PEOPLE
= 'people'¶
-
SAVVY
= 'savvy'¶
-
-
class
TravelMethod
[source]¶ Bases:
types.SimpleNamespace
How the skill travels
-
ARC
= 'arc'¶
-
STANDARD
= 'standard'¶
-
-
class
UIElement
(value)[source]¶ Bases:
enum.IntEnum
The different, single instance UI elements
-
ACTOR_INFO
= 2¶
-
BLESSING_MENU
= 3¶
-
CHARACTER_SELECTOR
= 9¶
-
DUNGEN_VIEWER
= 7¶
-
ENTITY_QUEUE
= 5¶
-
MESSAGE_LOG
= 1¶
-
SKILL_BAR
= 4¶
-
TILE_INFO
= 6¶
-
TITLE_SCREEN
= 8¶
-
scripts.engine.internal.data module¶
-
class
Store
[source]¶ Bases:
object
Hold the current state info required by the engine. Must be serialised. Should only be accessed via getters and setters, not directly.
scripts.engine.internal.debug module¶
-
disable_profiling
(dump_data: bool = False)[source]¶ Turn off current profiling. Dump data to file if required.
-
enable_profiling
(duration: int = 999)[source]¶ Enable profiling. Create profiler if one doesnt exist
-
performance_test
(method_descs: List[str], old_methods: List[Tuple[Union[str, Callable], str]], new_methods: List[Tuple[Union[str, Callable], str]], num_runs: int = 1000, repeats: int = 3) → str[source]¶ - Run performance testing on a collection of methods/functions. Returns a formatted string detailing performance of
old, new and % change between them.
method_descs are used as descriptions only. old_methods/new_methods expects a list of tuples that are (method_to_test, setup). Setup can be an empty string but is usually an import. Index in each list much match, i.e. method_name[0] is the alias of the methods in old_methods[0] and new_methods[0].
Outputs as “Access Trait: 0.00123 -> 0.00036(71.00033%)”.
example usage: method_descs = [“Set Var”, “Access Skill”] old_methods = [(“x = 1”, “”),(“library.get_skill_data(‘lunge’)”, “”)] new_methods = [(“x = ‘one’”, “”), (“library2.SKILLS.get(‘lunge’)”, “from scripts.engine import library2”)] print( performance_test(method_descs, old_methods, new_methods) )
scripts.engine.internal.definition module¶
-
class
ActorData
(key: str = 'none', possible_names: List[str] = <factory>, description: str = 'none', position_offsets: List[Tuple[int, int]] = <factory>, trait_names: List[str] = <factory>, behaviour_name: str = 'none', height: HeightType = 1)[source]¶ Bases:
object
Data class for an actor. Also used to hold and map data from json.
-
__init__
(key: str = 'none', possible_names: List[str] = <factory>, description: str = 'none', position_offsets: List[Tuple[int, int]] = <factory>, trait_names: List[str] = <factory>, behaviour_name: str = 'none', height: HeightType = 1) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
height
: HeightType = 1¶
-
-
class
AffectCooldownEffectData
(effect_type: EffectTypeType = 'affect_cooldown', success_effects: List[Effect] = <factory>, failure_effects: List[Effect] = <factory>, skill_name: str = '', affect_amount: int = 0)[source]¶ Bases:
scripts.engine.internal.definition.EffectData
The data for a apply affliction effect. Also used to hold and map data from json.
-
__init__
(effect_type: EffectTypeType = 'affect_cooldown', success_effects: List[Effect] = <factory>, failure_effects: List[Effect] = <factory>, skill_name: str = '', affect_amount: int = 0) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
effect_type
: EffectTypeType = 'affect_cooldown'¶
-
-
class
AffectStatEffectData
(effect_type: EffectTypeType = 'affect_stat', success_effects: List[Effect] = <factory>, failure_effects: List[Effect] = <factory>, cause_name: str = '', stat_to_target: PrimaryStatType = 'exactitude', affect_amount: int = 0)[source]¶ Bases:
scripts.engine.internal.definition.EffectData
The data for an affect stat effect. Also used to hold and map data from json.
-
__init__
(effect_type: EffectTypeType = 'affect_stat', success_effects: List[Effect] = <factory>, failure_effects: List[Effect] = <factory>, cause_name: str = '', stat_to_target: PrimaryStatType = 'exactitude', affect_amount: int = 0) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
effect_type
: EffectTypeType = 'affect_stat'¶
-
stat_to_target
: PrimaryStatType = 'exactitude'¶
-
-
class
AfflictionData
(name: str = 'none', description: str = 'none', icon_path: str = 'none', category: AfflictionCategoryType = 'boon', identity_tags: List[EffectTypeType] = <factory>, triggers: List[ReactionTriggerType] = <factory>)[source]¶ Bases:
object
Data class for an Affliction
-
__init__
(name: str = 'none', description: str = 'none', icon_path: str = 'none', category: AfflictionCategoryType = 'boon', identity_tags: List[EffectTypeType] = <factory>, triggers: List[ReactionTriggerType] = <factory>) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
category
: AfflictionCategoryType = 'boon'¶
-
triggers
: List[ReactionTriggerType]¶
-
-
class
AlterTerrainEffectData
(effect_type: EffectTypeType = 'alter_terrain', success_effects: List[Effect] = <factory>, failure_effects: List[Effect] = <factory>, terrain_name: str = '', affect_amount: int = 0)[source]¶ Bases:
scripts.engine.internal.definition.EffectData
The data for an alter terrain effect. Also used to hold and map data from json.
-
__init__
(effect_type: EffectTypeType = 'alter_terrain', success_effects: List[Effect] = <factory>, failure_effects: List[Effect] = <factory>, terrain_name: str = '', affect_amount: int = 0) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
effect_type
: EffectTypeType = 'alter_terrain'¶
-
-
class
ApplyAfflictionEffectData
(effect_type: EffectTypeType = 'apply_affliction', success_effects: List[Effect] = <factory>, failure_effects: List[Effect] = <factory>, affliction_name: str = '', duration: int = 0)[source]¶ Bases:
scripts.engine.internal.definition.EffectData
The data for a apply affliction effect. Also used to hold and map data from json.
-
__init__
(effect_type: EffectTypeType = 'apply_affliction', success_effects: List[Effect] = <factory>, failure_effects: List[Effect] = <factory>, affliction_name: str = '', duration: int = 0) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
effect_type
: EffectTypeType = 'apply_affliction'¶
-
-
class
BaseValueData
(accuracy: int = 0, damage: int = 0, bustle: int = 0, clout: int = 0, exactitude: int = 0, skullduggery: int = 0, vigour: int = 0, max_health: int = 0, max_stamina: int = 0, resist_astral: int = 0, resist_burn: int = 0, resist_chemical: int = 0, resist_cold: int = 0, resist_mundane: int = 0, rush: int = 0)[source]¶ Bases:
object
-
__init__
(accuracy: int = 0, damage: int = 0, bustle: int = 0, clout: int = 0, exactitude: int = 0, skullduggery: int = 0, vigour: int = 0, max_health: int = 0, max_stamina: int = 0, resist_astral: int = 0, resist_burn: int = 0, resist_chemical: int = 0, resist_cold: int = 0, resist_mundane: int = 0, rush: int = 0) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
DamageEffectData
(effect_type: EffectTypeType = 'damage', success_effects: List[Effect] = <factory>, failure_effects: List[Effect] = <factory>, stat_to_target: PrimaryStatType = 'exactitude', accuracy: int = 0, potency: float = 1.0, damage: int = 0, damage_type: DamageTypeType = 'mundane', mod_stat: PrimaryStatType = 'exactitude', mod_amount: float = 0.0)[source]¶ Bases:
scripts.engine.internal.definition.EffectData
The data for a damage effect. Also used to hold and map data from json.
-
__init__
(effect_type: EffectTypeType = 'damage', success_effects: List[Effect] = <factory>, failure_effects: List[Effect] = <factory>, stat_to_target: PrimaryStatType = 'exactitude', accuracy: int = 0, potency: float = 1.0, damage: int = 0, damage_type: DamageTypeType = 'mundane', mod_stat: PrimaryStatType = 'exactitude', mod_amount: float = 0.0) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
damage_type
: DamageTypeType = 'mundane'¶
-
effect_type
: EffectTypeType = 'damage'¶
-
mod_stat
: PrimaryStatType = 'exactitude'¶
-
stat_to_target
: PrimaryStatType = 'exactitude'¶
-
-
class
DefaultValueData
(move_cost: int = 0, time_per_round: int = 0, reduced_effectiveness_multi_tile_modifier: float = 0.0)[source]¶ Bases:
object
-
class
DelayedSkillData
(creator: EntityID = 0, skill_name: str = 'none', skill_instance: Optional[Skill] = None, duration: int = 0, sprite_paths: TraitSpritePathsData = TraitSpritePathsData(render_order=<RenderLayer.BOTTOM: 10>, icon='none', idle='skills/delayed_skill.png', attack='none', hit='none', dead='none', move='none'))[source]¶ Bases:
object
Data class for a Delayed Skill
-
__init__
(creator: EntityID = 0, skill_name: str = 'none', skill_instance: Optional[Skill] = None, duration: int = 0, sprite_paths: TraitSpritePathsData = TraitSpritePathsData(render_order=<RenderLayer.BOTTOM: 10>, icon='none', idle='skills/delayed_skill.png', attack='none', hit='none', dead='none', move='none')) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
creator
: EntityID = 0¶
-
skill_instance
: Optional[Skill] = None¶
-
sprite_paths
: TraitSpritePathsData = TraitSpritePathsData(render_order=<RenderLayer.BOTTOM: 10>, icon='none', idle='skills/delayed_skill.png', attack='none', hit='none', dead='none', move='none')¶
-
-
class
Dimensions
(height: int = 0, width: int = 0)[source]¶ Bases:
object
-
class
EffectData
(effect_type: EffectTypeType, success_effects: List[Effect] = <factory>, failure_effects: List[Effect] = <factory>)[source]¶ Bases:
abc.ABC
Base data class for an effect.
-
__init__
(effect_type: EffectTypeType, success_effects: List[Effect] = <factory>, failure_effects: List[Effect] = <factory>) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
effect_type
: EffectTypeType¶
-
failure_effects
: List[Effect]¶
-
success_effects
: List[Effect]¶
-
-
class
GameConfigData
(hit_types: 'HitTypeData' = <factory>, base_values: 'BaseValueData' = <factory>, default_values: 'DefaultValueData' = <factory>)[source]¶ Bases:
object
-
__init__
(hit_types: scripts.engine.internal.definition.HitTypeData = <factory>, base_values: scripts.engine.internal.definition.BaseValueData = <factory>, default_values: scripts.engine.internal.definition.DefaultValueData = <factory>) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
base_values
: scripts.engine.internal.definition.BaseValueData¶
-
default_values
: scripts.engine.internal.definition.DefaultValueData¶
-
-
class
GodData
(name: str = 'none', description: str = 'none', attitudes: Dict[ReactionTriggerType, int] = <factory>, reactions: Dict[ReactionTriggerType, scripts.engine.internal.definition.ReactionData] = <factory>)[source]¶ Bases:
object
Data class for a god. If a reaction.reactions is a skill name (a str) then the skill name must also be in known_skills.
-
__init__
(name: str = 'none', description: str = 'none', attitudes: Dict[ReactionTriggerType, int] = <factory>, reactions: Dict[ReactionTriggerType, scripts.engine.internal.definition.ReactionData] = <factory>) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
reactions
: Dict[ReactionTriggerType, scripts.engine.internal.definition.ReactionData]¶
-
-
class
HitInfoData
(value: int = 0, modifier: float = 0.0)[source]¶ Bases:
object
-
class
HitTypeData
(graze: 'HitInfoData' = <factory>, hit: 'HitInfoData' = <factory>, crit: 'HitInfoData' = <factory>)[source]¶ Bases:
object
-
class
LightData
(radius: int = 0, colour: Tuple[int, int, int] = (0, 0, 0), alpha: int = 0)[source]¶ Bases:
object
Data for a light source. Also used to hold and map data from json.
-
class
MapData
(name: str = 'none', key: str = 'none', width: int = 0, height: int = 0, min_rooms: int = 0, max_rooms: int = 0, max_tunnel_length: int = 0, min_path_distance_for_shortcut: int = 0, max_room_entrances: int = 0, extra_entrance_chance: int = 0, chance_of_tunnel_winding: int = 0, rooms: Dict[str, float] = <factory>, sprite_paths: Dict[str, str] = <factory>)[source]¶ Bases:
object
Data class for a Map, specifically for generation. A map is a collection of rooms. Defines the rooms on the map, how they are placed and joined up ( with tunnels). Also used to hold and map data from json.
-
__init__
(name: str = 'none', key: str = 'none', width: int = 0, height: int = 0, min_rooms: int = 0, max_rooms: int = 0, max_tunnel_length: int = 0, min_path_distance_for_shortcut: int = 0, max_room_entrances: int = 0, extra_entrance_chance: int = 0, chance_of_tunnel_winding: int = 0, rooms: Dict[str, float] = <factory>, sprite_paths: Dict[str, str] = <factory>) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
MoveEffectData
(effect_type: EffectTypeType = 'move', success_effects: List[Effect] = <factory>, failure_effects: List[Effect] = <factory>, direction: DirectionType = (0, 0), move_amount: int = 0)[source]¶ Bases:
scripts.engine.internal.definition.EffectData
The data for a apply affliction effect. Also used to hold and map data from json.
-
__init__
(effect_type: EffectTypeType = 'move', success_effects: List[Effect] = <factory>, failure_effects: List[Effect] = <factory>, direction: DirectionType = (0, 0), move_amount: int = 0) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
direction
: DirectionType = (0, 0)¶
-
effect_type
: EffectTypeType = 'move'¶
-
-
class
ProjectileData
(creator: EntityID = 0, skill_name: str = 'none', skill_instance: Optional[Skill] = None, target_tags: List[TileTagType] = <factory>, direction: Optional[DirectionType] = None, sprite_paths: TraitSpritePathsData = <factory>, speed: ProjectileSpeedType = 10, travel_method: TravelMethodType = 'standard', range: int = 1, terrain_collision: Optional[TerrainCollisionType] = None, expiry_type: Optional[ProjectileExpiryType] = None)[source]¶ Bases:
object
Data class for a projectile
-
__init__
(creator: EntityID = 0, skill_name: str = 'none', skill_instance: Optional[Skill] = None, target_tags: List[TileTagType] = <factory>, direction: Optional[DirectionType] = None, sprite_paths: TraitSpritePathsData = <factory>, speed: ProjectileSpeedType = 10, travel_method: TravelMethodType = 'standard', range: int = 1, terrain_collision: Optional[TerrainCollisionType] = None, expiry_type: Optional[ProjectileExpiryType] = None) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
creator
: EntityID = 0¶
-
direction
: Optional[DirectionType] = None¶
-
expiry_type
: Optional[ProjectileExpiryType] = None¶
-
skill_instance
: Optional[Skill] = None¶
-
speed
: ProjectileSpeedType = 10¶
-
sprite_paths
: TraitSpritePathsData¶
-
terrain_collision
: Optional[TerrainCollisionType] = None¶
-
travel_method
: TravelMethodType = 'standard'¶
-
-
class
ReactionData
(required_opinion: Optional[int] = None, reaction: Union[scripts.engine.internal.definition.EffectData, str] = '', chance: int = 100)[source]¶ Bases:
object
Data class for a reaction.
-
__init__
(required_opinion: Optional[int] = None, reaction: Union[scripts.engine.internal.definition.EffectData, str] = '', chance: int = 100) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
reaction
: Union[scripts.engine.internal.definition.EffectData, str] = ''¶
-
-
class
RoomConceptData
(name: str = 'none', key: str = 'none', min_width: int = 0, min_height: int = 0, max_width: int = 0, max_height: int = 0, design: str = '', max_neighbouring_walls_in_room: int = 0, chance_of_spawning_wall: float = 0.0, actors: Dict[str, float] = <factory>, min_actors: int = 0, max_actors: int = 0, sprite_paths: Dict[str, str] = <factory>)[source]¶ Bases:
object
Data class for a RoomConcept. Only used in generation.
-
__init__
(name: str = 'none', key: str = 'none', min_width: int = 0, min_height: int = 0, max_width: int = 0, max_height: int = 0, design: str = '', max_neighbouring_walls_in_room: int = 0, chance_of_spawning_wall: float = 0.0, actors: Dict[str, float] = <factory>, min_actors: int = 0, max_actors: int = 0, sprite_paths: Dict[str, str] = <factory>) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
SecondaryStatModData
(name: str = 'none', secondary_stat_type: SecondaryStatType = 'max_health', vigour_mod: int = 0, clout_mod: int = 0, skullduggery_mod: int = 0, bustle_mod: int = 0, exactitude_mod: int = 0)[source]¶ Bases:
object
Data class for secondary stats
-
__init__
(name: str = 'none', secondary_stat_type: SecondaryStatType = 'max_health', vigour_mod: int = 0, clout_mod: int = 0, skullduggery_mod: int = 0, bustle_mod: int = 0, exactitude_mod: int = 0) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
secondary_stat_type
: SecondaryStatType = 'max_health'¶
-
-
class
SkillData
(name: str = 'none', description: str = 'none', icon_path: str = 'none', cast_tags: List[TileTagType] = <factory>, target_tags: List[TileTagType] = <factory>, resource_type: ResourceType = 'stamina', resource_cost: int = 0, time_cost: int = 0, cooldown: int = 0, targeting_method: TargetingMethodType = 'tile', target_directions: List[DirectionType] = <factory>, range: int = 1, shape: ShapeType = 'target', shape_size: int = 1, uses_projectile: bool = False, projectile_data: Optional[scripts.engine.internal.definition.ProjectileData] = None, is_delayed: bool = False, delayed_skill_data: Optional[scripts.engine.internal.definition.DelayedSkillData] = None, types: List[str] = <factory>)[source]¶ Bases:
object
Data class for a skill. Also used to hold and map data from json.
-
__init__
(name: str = 'none', description: str = 'none', icon_path: str = 'none', cast_tags: List[TileTagType] = <factory>, target_tags: List[TileTagType] = <factory>, resource_type: ResourceType = 'stamina', resource_cost: int = 0, time_cost: int = 0, cooldown: int = 0, targeting_method: TargetingMethodType = 'tile', target_directions: List[DirectionType] = <factory>, range: int = 1, shape: ShapeType = 'target', shape_size: int = 1, uses_projectile: bool = False, projectile_data: Optional[scripts.engine.internal.definition.ProjectileData] = None, is_delayed: bool = False, delayed_skill_data: Optional[scripts.engine.internal.definition.DelayedSkillData] = None, types: List[str] = <factory>) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
delayed_skill_data
: Optional[scripts.engine.internal.definition.DelayedSkillData] = None¶
-
projectile_data
: Optional[scripts.engine.internal.definition.ProjectileData] = None¶
-
resource_type
: ResourceType = 'stamina'¶
-
shape
: ShapeType = 'target'¶
-
target_directions
: List[DirectionType]¶
-
targeting_method
: TargetingMethodType = 'tile'¶
-
-
class
TerrainData
(name: str = 'none', description: str = 'none', height: HeightType = 1, blocks_movement: bool = False, position_offsets: List[Tuple[int, int]] = <factory>, sprite_paths: scripts.engine.internal.definition.TraitSpritePathsData = <factory>, reactions: Dict[ReactionTriggerType, scripts.engine.internal.definition.ReactionData] = <factory>, light: Optional[scripts.engine.internal.definition.LightData] = None)[source]¶ Bases:
object
Data class for terrain. Also used to hold and map data from json.
-
__init__
(name: str = 'none', description: str = 'none', height: HeightType = 1, blocks_movement: bool = False, position_offsets: List[Tuple[int, int]] = <factory>, sprite_paths: scripts.engine.internal.definition.TraitSpritePathsData = <factory>, reactions: Dict[ReactionTriggerType, scripts.engine.internal.definition.ReactionData] = <factory>, light: Optional[scripts.engine.internal.definition.LightData] = None) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
height
: HeightType = 1¶
-
light
: Optional[scripts.engine.internal.definition.LightData] = None¶
-
reactions
: Dict[ReactionTriggerType, scripts.engine.internal.definition.ReactionData]¶
-
sprite_paths
: scripts.engine.internal.definition.TraitSpritePathsData¶
-
-
class
TraitData
(name: str = 'none', group: TraitGroupType = 'npc', description: str = 'none', sprite_paths: scripts.engine.internal.definition.TraitSpritePathsData = <factory>, sight_range: int = 0, vigour: int = 0, clout: int = 0, skullduggery: int = 0, bustle: int = 0, exactitude: int = 0, known_skills: List[str] = <factory>, permanent_afflictions: List[str] = <factory>)[source]¶ Bases:
object
Data class for a trait. Also used to hold and map data from json.
-
__init__
(name: str = 'none', group: TraitGroupType = 'npc', description: str = 'none', sprite_paths: scripts.engine.internal.definition.TraitSpritePathsData = <factory>, sight_range: int = 0, vigour: int = 0, clout: int = 0, skullduggery: int = 0, bustle: int = 0, exactitude: int = 0, known_skills: List[str] = <factory>, permanent_afflictions: List[str] = <factory>) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
group
: TraitGroupType = 'npc'¶
-
sprite_paths
: scripts.engine.internal.definition.TraitSpritePathsData¶
-
-
class
TraitSpritePathsData
(render_order: scripts.engine.internal.constant.RenderLayer = <RenderLayer.BOTTOM: 10>, icon: str = 'none', idle: str = 'none', attack: str = 'none', hit: str = 'none', dead: str = 'none', move: str = 'none')[source]¶ Bases:
object
Possible sprites paths for a trait. Also used to hold and map data from json.
-
__init__
(render_order: scripts.engine.internal.constant.RenderLayer = <RenderLayer.BOTTOM: 10>, icon: str = 'none', idle: str = 'none', attack: str = 'none', hit: str = 'none', dead: str = 'none', move: str = 'none') → None¶ Initialize self. See help(type(self)) for accurate signature.
-
render_order
: scripts.engine.internal.constant.RenderLayer = 10¶
-
-
class
TraitSpritesData
(icon: Optional[pygame.Surface] = None, idle: Optional[pygame.Surface] = None, attack: Optional[pygame.Surface] = None, hit: Optional[pygame.Surface] = None, dead: Optional[pygame.Surface] = None, move: Optional[pygame.Surface] = None)[source]¶ Bases:
object
Possible sprites.
-
__init__
(icon: Optional[pygame.Surface] = None, idle: Optional[pygame.Surface] = None, attack: Optional[pygame.Surface] = None, hit: Optional[pygame.Surface] = None, dead: Optional[pygame.Surface] = None, move: Optional[pygame.Surface] = None) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
attack
: Optional[pygame.Surface] = None¶
-
dead
: Optional[pygame.Surface] = None¶
-
hit
: Optional[pygame.Surface] = None¶
-
icon
: Optional[pygame.Surface] = None¶
-
idle
: Optional[pygame.Surface] = None¶
-
move
: Optional[pygame.Surface] = None¶
-
-
class
VideoConfigData
(base_window: 'Dimensions' = <factory>, desired_window: 'Dimensions' = <factory>, fps_limit: 'int' = 60)[source]¶ Bases:
object
-
__init__
(base_window: scripts.engine.internal.definition.Dimensions = <factory>, desired_window: scripts.engine.internal.definition.Dimensions = <factory>, fps_limit: int = 60) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
base_window
: scripts.engine.internal.definition.Dimensions¶
-
desired_window
: scripts.engine.internal.definition.Dimensions¶
-
scripts.engine.internal.event module¶
-
class
AffectCooldownEvent
(origin: int, target: int, amount: int)[source]¶ Bases:
scripts.engine.internal.event.Event
Base class for events
-
class
AffectStatEvent
(origin: int, target: int, stat_to_target: PrimaryStatType, amount: int)[source]¶ Bases:
scripts.engine.internal.event.Event
Base class for events
-
class
AfflictionEvent
(origin: int, target: int, affliction_name: str)[source]¶ Bases:
scripts.engine.internal.event.Event
Base class for events
-
class
AlterTerrainEvent
(origin: int, target: int, terrain_name: str, duration: int)[source]¶ Bases:
scripts.engine.internal.event.Event
Base class for events
-
class
ChangeMapEvent
[source]¶ Bases:
scripts.engine.internal.event.Event
Base class for events
-
class
DamageEvent
(origin: int, target: int, amount: int, damage_type: DamageTypeType, remaining_hp: int)[source]¶ Bases:
scripts.engine.internal.event.Event
Base class for events
-
class
EndRoundEvent
[source]¶ Bases:
scripts.engine.internal.event.Event
Base class for events
-
class
EndTurnEvent
[source]¶ Bases:
scripts.engine.internal.event.Event
Base class for events
-
class
Event
(event_type: scripts.engine.internal.constant.EventType)[source]¶ Bases:
abc.ABC
Events to cause top level actions to take place
Base class for events
-
__init__
(event_type: scripts.engine.internal.constant.EventType)[source]¶ Base class for events
-
-
class
EventHub
[source]¶ Bases:
object
Event hub to handle the interactions between events and subscribers
-
peek
(event)[source]¶ Check if an event exists in the queue. Return None if nothing is found so the result can be used as a bool.
-
post
(event: scripts.engine.internal.event.Event)[source]¶ Log an event ready for notifying subscribers.
-
subscribe
(event_type: scripts.engine.internal.constant.EventType, subscriber: scripts.engine.internal.event.Subscriber)[source]¶ Register a subscriber with an EventType
-
unsubscribe
(event_type: scripts.engine.internal.constant.EventType, subscriber: scripts.engine.internal.event.Subscriber)[source]¶ Remove a subscribers registration to an EventType
-
-
class
ExitGameEvent
[source]¶ Bases:
scripts.engine.internal.event.Event
Base class for events
-
class
ExitMenuEvent
(menu: scripts.engine.internal.constant.UIElement)[source]¶ Bases:
scripts.engine.internal.event.Event
Base class for events
-
__init__
(menu: scripts.engine.internal.constant.UIElement)[source]¶ Base class for events
-
-
class
LoadGameEvent
[source]¶ Bases:
scripts.engine.internal.event.Event
Base class for events
-
class
LoseConditionMetEvent
[source]¶ Bases:
scripts.engine.internal.event.Event
Base class for events
-
class
MessageEvent
(message: str)[source]¶ Bases:
scripts.engine.internal.event.Event
Base class for events
-
class
MoveEvent
(origin: int, target: int, direction: DirectionType, new_pos: Tuple[int, int])[source]¶ Bases:
scripts.engine.internal.event.Event
Base class for events
-
class
NewGameEvent
[source]¶ Bases:
scripts.engine.internal.event.Event
Base class for events
-
class
NewRoundEvent
[source]¶ Bases:
scripts.engine.internal.event.Event
Base class for events
-
class
NewTurnEvent
[source]¶ Bases:
scripts.engine.internal.event.Event
Base class for events
-
class
ShrineEvent
(entity_id: int)[source]¶ Bases:
scripts.engine.internal.event.Event
Base class for events
-
class
ShrineMenuEvent
(blessing_options: List[Any])[source]¶ Bases:
scripts.engine.internal.event.Event
Base class for events
-
class
StartGameEvent
(player_data: scripts.engine.internal.definition.ActorData)[source]¶ Bases:
scripts.engine.internal.event.Event
Base class for events
-
__init__
(player_data: scripts.engine.internal.definition.ActorData)[source]¶ Base class for events
-
-
class
Subscriber
(name: str)[source]¶ Bases:
abc.ABC
Class to set default behaviour for handlers listening for events
-
abstract
process_event
(event: scripts.engine.internal.event.Event)[source]¶ Process game events.
-
subscribe
(event_type: scripts.engine.internal.constant.EventType)[source]¶
-
unsubscribe
(event_type: scripts.engine.internal.constant.EventType)[source]¶
-
abstract
-
class
UseSkillEvent
(origin: int, skill_name: str)[source]¶ Bases:
scripts.engine.internal.event.Event
Base class for events
-
class
WinConditionMetEvent
[source]¶ Bases:
scripts.engine.internal.event.Event
Base class for events
scripts.engine.internal.extend_json module¶
-
class
ExtendedJsonEncoder
(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]¶ Bases:
json.encoder.JSONEncoder
Extend the json Encoder to handle dataclass types
Constructor for JSONEncoder, with sensible defaults.
If skipkeys is false, then it is a TypeError to attempt encoding of keys that are not str, int, float or None. If skipkeys is True, such items are simply skipped.
If ensure_ascii is true, the output is guaranteed to be str objects with all incoming non-ASCII characters escaped. If ensure_ascii is false, the output can contain non-ASCII characters.
If check_circular is true, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an OverflowError). Otherwise, no such check takes place.
If allow_nan is true, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats.
If sort_keys is true, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis.
If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation.
If specified, separators should be an (item_separator, key_separator) tuple. The default is (‘, ‘, ‘: ‘) if indent is
None
and (‘,’, ‘: ‘) otherwise. To get the most compact JSON representation, you should specify (‘,’, ‘:’) to eliminate whitespace.If specified, default is a function that gets called for objects that can’t otherwise be serialized. It should return a JSON encodable version of the object or raise a
TypeError
.
scripts.engine.internal.interaction module¶
-
class
InteractionEventSubscriber
[source]¶ Bases:
scripts.engine.internal.event.Subscriber
Handle interaction events.