PokeyGame Entities

Over the past two weeks I’ve spent some time getting the WorldGenerator integrated with the PokeyGame framework, and level templates are now able to be automatically generated and tested for a valid path from point to point.  A template is returned as a dictionary to the game and the logic behind creating a dungeon can be built.

Is it living?

The next step in generating the dungeon will be filling the template with tiles, mobs, chests, traps, doors (some with locks) and more.  I decided to refactor the Player class and extract some of the core methods that will be implemented in a more general Entity class – Players, Mobs, and ultimately NPCs will all be children to this Entity class.

As such, I had to consider which attributes and methods will need to be available to all three of these categories.  Among shared attributes are :

trigger_seal - true if the entity will trigger seal-type Spells (Players) (bool)
lootable - true if the entity can be looted (bool)
living - true until the Entity ends a turn with health <= 0 (bool)
attack - base damage (int)
defense - base resistance to combat damage (int)
focus - base mana amount (int)
resist_fire - resistance to fire elemental damage (int)
resist_frost - resistance to frost elemental damage (int)
resist_magic - general spell resistance (int)
resist_poison - resistance to poison elemental damage (int)
resist_death - if high enough, mitigate a blow that would kill the entity (int)
blind - eliminates the map from view (Players) (bool)
paralyzed - prevents movement on the map (may still engage in combat) (bool)
slow - limit movement to every other turn (bool)
haste - two movements per turn (bool)
berzerk - grants a bonus to attack and defense when under 20% health (bool)
protected - mitigates all spell damage (bool)
immune - mitigates all status effects (bool)
invincible - mitigates all combat damage (bool)
stunned - prevents combat and movement for one turn (bool)

Players and Mobs will actively use these attributes, NPCs will be protected/immune/invincible so that no status effects or damage can be applied.  The methods available require a bit more explanation.

Methods

proc_dmg_effect
proc_status_effect
process_effects
living_check
dead
turn_upkeep
turn_initialize
resist_roll

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.