NotQuiteParadise2

nqp.command package

Submodules

nqp.command.basic_entity_behaviour module

class BasicEntityBehaviour(game: Game, unit: Unit, entity: EntityID)[source]

Bases: nqp.base_classes.entity_behaviour.EntityBehaviour

__init__(game: Game, unit: Unit, entity: EntityID)[source]
apply_regen()[source]

Create heal component on entity

determine_next_action(focus_entity: bool)[source]

Determine what to do next, i.e. what state to transition into.

If focus_entity is True then should a target position exist it will be overwritten by the target entity’s position.

update(delta_time: float)[source]
update_path()[source]

Update pathing to target.

nqp.command.commander module

class Commander(game: Game, type_: str)[source]

Bases: object

__init__(game: Game, type_: str)[source]

nqp.command.troupe module

class Troupe(game: Game, team: str, allies: List[str])[source]

Bases: object

Management of a group of units

__init__(game: Game, team: str, allies: List[str])[source]
add_unit(unit: nqp.command.unit.Unit)[source]

Add a unit instance to the troupe. Used when buying an existing unit, e.g. from Inn.

debug_init_units() List[int][source]

Initialise all units for Troupe faction. Returns list of created ids.

property entities: List[EntityID]
generate_specific_units(unit_types: List[str]) List[int][source]

Generate units for the Troupe, based on parameters given. Returns list of created ids.

unit_types is expressed as [unit.type, …]

generate_units(number_of_units: int, tiers_allowed: List[int] = None, duplicates: bool = False) List[int][source]

Generate units for the Troupe, based on parameters given.

Returns

list of created ids.

get_random_unit() nqp.command.unit.Unit[source]

Return a random unit from the Troupe.

remove_all_units()[source]

Remove all units from the Troupe

remove_unit(id_: int)[source]
set_force_idle(active: bool)[source]

Set the forced_idle attr for all units in the Troupe

property units: Dict[int, Unit]
update(delta_time: float)[source]
upgrade_unit(id_: int, upgrade_type: str)[source]

Upgrade a unit with a given upgrade.

nqp.command.unit module

class Unit(game: Game, id_: int, unit_type: str, team: str, pos: pygame.Vector2)[source]

Bases: object

__init__(game: Game, id_: int, unit_type: str, team: str, pos: pygame.Vector2)[source]
add_modifier(stat: str, amount: int)[source]

Add a modifier to a stat. Stub

delete_entities(immediately: bool = False)[source]

Delete all entities. If “immediately” = False this will happen on the next frame.

draw_banner(surface: pygame.Surface, shift: pygame.math.Vector2 = (0, 0))[source]

Draw’s the Unit’s banner.

draw_border(surface: pygame.Surface, shift: pygame.math.Vector2 = (0, 0))[source]

Draw the border around the unit.

generate_border_surface()[source]

Generate a new border around the Unit. Stub

get_modified_status(stat: str) nqp.core.constants.StatModifiedStatus[source]

Check if a given stat is modified. Stub.

property is_alive
reset_for_combat()[source]

Reset the in combat values ready to begin combat.

set_position(pos: pygame.math.Vector2)[source]

Set the unit’s position and moves the Entities to match.

spawn_entities()[source]

Spawn the Unit’s Entities. Deletes any existing Entities first.

update(delta_time: float)[source]
update_position()[source]

Update unit position by averaging the positions of all its entities.

nqp.command.unit_behaviour module

class UnitBehaviour(game: Game, unit: Unit)[source]

Bases: object

__init__(game: Game, unit: Unit)[source]
find_target()[source]

Find the nearest enemy from a different team and update the target.

property leader: EntityID
update(delta_time: float)[source]
update_valid_targets()[source]

Module contents