RPG in rust with decorator pattern [update]

Hi!

I’m starting with a project in rust about making a turn based rpg videogame, but for simplicity with all the possible combinations of effects and situations, i want to use the decorator design patern. You can think on it like a “Pokemon clone”, at least at the begginning.

I’m not new at programming but doing it on "rust", so i wanted to know if i'm “in the right path” or not, so, can i show you my implementation based on enums?

Disclamer: searching i found a “traits based implementation” of the decorator pattern but it was about giving the same behavior to different objects, not giving different behaviors to the same object depending on the situation.

Here is my code~

-pastebin-

I'm that the best improve could be replace the method continue_cleaning_down by a macro like

MM @ Mons::_!(mon, ..) => MM(mon.do_stuff(), ..)

MM would be the enum variant constructor, mon the Mons inside and the ".." preserves the other params if there are someones.

Thanks!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.