mardi 20 novembre 2018

Implementing decorator design pattern whilst allowing removal of decorators from component

I have an abstract class called Card, which has an abstract subclass called Monster & Enhance. Under enhance & Monster, I have concrete cards (such as Amplify damage & Fire Demon). I would like to use the decorator design pattern to apply enhancements to minions but am not sure how this would work since I also want functionality which allows me to remove all the Enhancements from the Monster when it dies.

Typical enhancements would include doubling the damage of the Monster, doubling it's health, making it invulnerable for one turn etc.

Aucun commentaire:

Enregistrer un commentaire