Skip to content

Effectable behavior refactor for rooms/items/characters #60

@shawncplus

Description

@shawncplus

Character effects methods/properties should be abstracted into an Effectable behavior that can be used by both Character and GameEntity (room/item/area). Effectable should also include the functionality of attributes thus moving all attribute and effect code into this behavior

This will allow all game entities to have effects. In addition effects should be updated with some new functionality: property modifiers.

Property Modifiers

Attribute modifiers exist to allow effects to temporarily alter an attribute's max value but attributes are purely numeric stats on a character. Property modifiers should allow effects to temporarily modify any property on an entity:

  • A disguise effect that temporarily changes a how player's name appears to other players
  • a darken effect that changes a room's description to be "It is pitch dark."
  • a poison effect that changes an item's room desc to append " (poisoned)" in addition to its other effects

To facilitate this Effect.modifiers should support a new properties key. This should act nearly identically to attribute modifiers. Effect will also need a new modifyProperty a la modifyAttribute mutatis mutandis. EffectList therefor will need an evaluateProperty a la evaluateAttribute. Finally to actually access these modified properties the Effectable behavior should have a getProperty(string propertyName) method a la getAttribute(string attributeName).

Effect docs will need to be updated to demonstrate these features as well as reinforce the the fact that when using modifiers one should never directly modify a property via an effect, e.g., this.name = "newName"; as that could result in Very Bad Things(tm).

Metadata

Metadata

Assignees

No one assigned

    Labels

    active PRIssue has a open PR waiting for review/mergeenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions