RanvierMUD/core

Effect listeners should have access to GameState

Closed this issue · 0 comments

The scenario is that a player has an effect which allows for a chance for their heal to do an extra 50% healing as a HoT. Currently this is not possible as you can't access the EffectFactory inside the heal listeners to create the HoT effect.

My initial idea for a solution is to allow the listeners property of an Effect configuration to either be the current { /* stuff */ } style or a new state => ({ /* stuff */ }) style.

  • Update EffectFactory#add to take a third parameter which is the GameState
    • When adding the Effect's listeners to the event manager check which form the listeners property is in and handle accordingly
  • Update BundleManager#loadEffects to pass GameState to EffectFactory.add