NotQuiteParadise2

nqp.world_elements package

Submodules

nqp.world_elements.actions module

class Action(game)[source]

Bases: object

__init__(game)[source]
use()[source]
class Fireball(*args)[source]

Bases: nqp.world_elements.actions.Action

__init__(*args)[source]
use(location)[source]

nqp.world_elements.camera module

class Camera(size: pygame.math.Vector2)[source]

Bases: object

Basic math for getting view of game world

zoom

positive numbers “zoom out”, negative numbers “zoom in”

  • World units are equal to pixels at zoom level of 0.0

__init__(size: pygame.math.Vector2)[source]
centre(pos: pygame.math.Vector2)[source]

Immediately centre the camera on a world point

clamp(rect: pygame.Rect)[source]

Move camera so that it is contained in the rect

Has same behaviour as pygame.Rect.clamp

get_centre() pygame.math.Vector2[source]

Get copy of the position

get_rect() pygame.Rect[source]

Return Pygame Rect representing the visible area of the camera

get_size() pygame.math.Vector2[source]

Return vector of the size after zoom is applied

move(x: int = 0, y: int = 0)[source]

Immediately move the camera by relative amount

render_offset() pygame.math.Vector2[source]

Return vector for drawing offset

reset_movement()[source]

Immediately move camera to tracked position

set_target_entity(entity: Optional[int])[source]

Smoothly track a game entity. Pass None to clear.

set_target_position(pos: Optional[pygame.math.Vector2])[source]

Move camera to position over time. Pass None to clear.

update(delta_time: float)[source]

Update camera movements

nqp.world_elements.entity_components module

class AI(behaviour: BasicEntityBehaviour)[source]

Bases: snecs.component.RegisteredComponent

An Entity’s AI. This should handle the outputs of AI decisions and actions.

__init__(behaviour: BasicEntityBehaviour)[source]
classmethod deserialize(*serialised)[source]

Deserialize a serialized instance of this component.

Will get the output of serialize as an argument.

Override this in all your Component classes to make use of snecs’ full-World serialization feature.

serialize()[source]

Serialize an instance of this component into a simpler type.

Override this in all your Component classes to make use of snecs’ full-World serialization feature.

class Aesthetic(animation: nqp.base_classes.animation.Animation)[source]

Bases: snecs.component.RegisteredComponent

An Entity’s visual information

__init__(animation: nqp.base_classes.animation.Animation)[source]
classmethod deserialize(*serialised)[source]

Deserialize a serialized instance of this component.

Will get the output of serialize as an argument.

Override this in all your Component classes to make use of snecs’ full-World serialization feature.

serialize()[source]

Serialize an instance of this component into a simpler type.

Override this in all your Component classes to make use of snecs’ full-World serialization feature.

class Allegiance(team: str, unit: nqp.command.unit.Unit)[source]

Bases: snecs.component.RegisteredComponent

An Entity’s allegiance.

__init__(team: str, unit: nqp.command.unit.Unit)[source]
classmethod deserialize(*serialised)[source]

Deserialize a serialized instance of this component.

Will get the output of serialize as an argument.

Override this in all your Component classes to make use of snecs’ full-World serialization feature.

serialize()[source]

Serialize an instance of this component into a simpler type.

Override this in all your Component classes to make use of snecs’ full-World serialization feature.

class Attributes[source]

Bases: snecs.component.RegisteredComponent

A series of flags defining the attributes of a Unit

__init__()[source]
classmethod deserialize(*serialised)[source]

Deserialize a serialized instance of this component.

Will get the output of serialize as an argument.

Override this in all your Component classes to make use of snecs’ full-World serialization feature.

serialize()[source]

Serialize an instance of this component into a simpler type.

Override this in all your Component classes to make use of snecs’ full-World serialization feature.

class DamageReceived(amount: int, damage_type: nqp.core.constants.DamageType, penetration: int, is_crit: bool)[source]

Bases: snecs.component.RegisteredComponent

Damage to be applied to the Entity.

__init__(amount: int, damage_type: nqp.core.constants.DamageType, penetration: int, is_crit: bool)[source]
classmethod deserialize(*serialised)[source]

Deserialize a serialized instance of this component.

Will get the output of serialize as an argument.

Override this in all your Component classes to make use of snecs’ full-World serialization feature.

serialize()[source]

Serialize an instance of this component into a simpler type.

Override this in all your Component classes to make use of snecs’ full-World serialization feature.

class HealReceived(amount: int, healing_source: nqp.core.constants.HealingSource)[source]

Bases: snecs.component.RegisteredComponent

Healing to be applied to the Entity.

__init__(amount: int, healing_source: nqp.core.constants.HealingSource)[source]
add_heal(amount: int, healing_source: nqp.core.constants.HealingSource)[source]
classmethod deserialize(*serialised)[source]

Deserialize a serialized instance of this component.

Will get the output of serialize as an argument.

Override this in all your Component classes to make use of snecs’ full-World serialization feature.

serialize()[source]

Serialize an instance of this component into a simpler type.

Override this in all your Component classes to make use of snecs’ full-World serialization feature.

class IsDead[source]

Bases: snecs.component.RegisteredComponent

Flag to indicate if the Entity is dead.

__init__()[source]
class IsReadyToAttack[source]

Bases: snecs.component.RegisteredComponent

Flag to indicate if the Entity is ready to attack.

class Position(pos: pygame.math.Vector2)[source]

Bases: snecs.component.RegisteredComponent

An Entity’s location in the world.

__init__(pos: pygame.math.Vector2)[source]
classmethod deserialize(pos: pygame.math.Vector2)[source]

Deserialize a serialized instance of this component.

Will get the output of serialize as an argument.

Override this in all your Component classes to make use of snecs’ full-World serialization feature.

serialize()[source]

Serialize an instance of this component into a simpler type.

Override this in all your Component classes to make use of snecs’ full-World serialization feature.

property x: float
property y: float
class RangedAttack(ammo: int, projectile_sprite: nqp.base_classes.image.Image, projectile_speed: int)[source]

Bases: snecs.component.RegisteredComponent

An Entity’s ability to use projectiles.

__init__(ammo: int, projectile_sprite: nqp.base_classes.image.Image, projectile_speed: int)[source]
classmethod deserialize(*serialised)[source]

Deserialize a serialized instance of this component.

Will get the output of serialize as an argument.

Override this in all your Component classes to make use of snecs’ full-World serialization feature.

serialize()[source]

Serialize an instance of this component into a simpler type.

Override this in all your Component classes to make use of snecs’ full-World serialization feature.

class Stats(parent_unit: nqp.command.unit.Unit)[source]

Bases: snecs.component.RegisteredComponent

An Entity’s stats, such as attack.

__init__(parent_unit: nqp.command.unit.Unit)[source]
classmethod deserialize(*serialised)[source]

Deserialize a serialized instance of this component.

Will get the output of serialize as an argument.

Override this in all your Component classes to make use of snecs’ full-World serialization feature.

classmethod get_stat_names() List[str][source]

Get a list of all the stats.

N.B. this is manually populated so if a stat is missing check here.

serialize()[source]

Serialize an instance of this component into a simpler type.

Override this in all your Component classes to make use of snecs’ full-World serialization feature.

class Tracked[source]

Bases: snecs.component.RegisteredComponent

A component to track an entity’s actions.

__init__()[source]
classmethod deserialize(*serialised)[source]

Deserialize a serialized instance of this component.

Will get the output of serialize as an argument.

Override this in all your Component classes to make use of snecs’ full-World serialization feature.

serialize()[source]

Serialize an instance of this component into a simpler type.

Override this in all your Component classes to make use of snecs’ full-World serialization feature.

nqp.world_elements.hitbox module

class Hitbox(entities, shape_type, shape_data, damage, owner=None, friendly_fire=False)[source]

Bases: object

__init__(entities, shape_type, shape_data, damage, owner=None, friendly_fire=False)[source]
apply()[source]

nqp.world_elements.item module

class Item(name: str, is_signature: bool)[source]

Bases: snecs.component.RegisteredComponent

Item component – WIP

__init__(name: str, is_signature: bool)[source]
class ItemData(name: str, is_signature: bool, effects: List[Dict[str, str]])[source]

Bases: object

Schema for the YAML Item data files

__init__(name: str, is_signature: bool, effects: List[Dict[str, str]]) None
effects: List[Dict[str, str]]
is_signature: bool
name: str

nqp.world_elements.particle module

class Particle(loc: pygame.math.Vector2, vel: pygame.math.Vector2, dur, colour)[source]

Bases: object

__init__(loc: pygame.math.Vector2, vel: pygame.math.Vector2, dur, colour)[source]
draw(surf: pygame.Surface, offset: pygame.math.Vector2 = <Vector2(0, 0)>)[source]
update(dt)[source]

nqp.world_elements.particle_manager module

class ParticleManager[source]

Bases: object

Class to manage all particles and their functionality, including creating, drawing and deletion.

__init__()[source]
create_blood_spray(pos: pygame.Vector2, blood_colour: Tuple[int, int, int] = Colour.BLOOD_RED)[source]
create_smoke(pos: pygame.math.Vector2)[source]
draw(surface: pygame.Surface, offset=(0, 0))[source]
update(delta_time: float)[source]

nqp.world_elements.projectile module

class Projectile(game: Game, owner: EntityID, target: EntityID, projectile_data: Dict[str, Union[Image, int]], damage: int, damage_type: DamageType, penetration: int, is_crit: bool)[source]

Bases: object

__init__(game: Game, owner: EntityID, target: EntityID, projectile_data: Dict[str, Union[Image, int]], damage: int, damage_type: DamageType, penetration: int, is_crit: bool)[source]
draw(surf, offset: pygame.math.Vector2)[source]
update(delta_time: float)[source]

nqp.world_elements.projectile_manager module

class ProjectileManager(game: Game)[source]

Bases: object

__init__(game: Game)[source]
add_projectile(owner: EntityID, target: EntityID, projectile_data: Dict[str, Union[Image, int]], damage: int, damage_type: DamageType, penetration: int, is_crit: bool)[source]
draw(surf, offset: pygame.math.Vector2)[source]
update(delta_time: float)[source]

nqp.world_elements.stats module

class FloatStat(base_value: float)[source]

Bases: nqp.base_classes.stat.Stat

__init__(base_value: float)[source]
property base_value: float
property value: float
class IntStat(base_value: int)[source]

Bases: nqp.base_classes.stat.Stat

__init__(base_value: int)[source]
property base_value: int
property value: int

nqp.world_elements.unit_attribute module

class UnitAttribute(base_value: bool)[source]

Bases: abc.ABC

A container for a Unit’s Attribute

# TODO - This is currently a copy of Stat and needs to be updated to work for bools only

with False taking precedence over True

__init__(base_value: bool)[source]
apply_modifier(func: Callable, key: Any)[source]

Add a modifier

When value is calculated, func will be called with the base value

Parameters
  • func – Any callable function

  • key – Unique identifier for adding and removing

property base_value
has_modifier(key: Any)[source]

Check if modifier is applied

Parameters

key – Unique identifier for adding and removing

override(value)[source]

Force the value and ignore modifiers

remove_modifier(key: Any)[source]

Remove a modifier

Parameters

key – Unique identifier for adding and removing

reset()[source]

Set value back to base value.

property value

Module contents