Closed palra closed 9 years ago
What's the difference between apply and onRegister?
onRegisters is executed when the item is added to the inventory of a character, apply is called when we want to use the item, for a cure for example : we can't make use of a cure when grabing it on the map, we have to delay the action, with a CureAction
But apply, for a cure, is the equivalent to CureAction
and it will force us to create ApplyCommand, applyAction etc...
In fact, forgot what I said
For the moment, apply method is defined only in Cure : https://github.com/palra/univ-mmorpg/blob/feature/serialization/src/main/java/fr/univdevs/mmorpg/engine/character/item/Cure.java#L65-L72 Why wouldn't we move this method to
item
, allowing every item to apply a given effect on a given Character ? This method should not be abstract, as onRegister and onUnregister, allowing the possibility to an child item to not redefine this method, if it doesn't use it.