I've implemented reaction types.
It works, works perfectly and tested thoroughly.
Scripting has never been easier thanks to 1.5 enums.
A lot of people argue it's more powerfull to write a parser and then compile the scripts internally.
I think that's not true.
If you hard code many different situations(reactions and conditions) you can even combine them into a single super script you will end up with limitless possibilities.
This is how I use them.
I'm going to create a map editor which will allow you to place scripts inside.
Example of how they are used:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| ConditionType con = ConditionType.IS_IN_LOCATION; con.setInput(pc); con.setLocation(new Rectangle(50, 50, 100, 100)); ReactionType react = ReactionType.HEAL_MAX; react.setInput(pc); currentMap.add(new ConditionalChecks(con, react)); con = ConditionType.IS_DEAD; con.setInput(pc); con.setLocation(new Rectangle(50, 50, 100, 100)); react = ReactionType.HEAL_MAX; react.setInput(pc); currentMap.add(new ConditionalChecks(con, react)); |