-
Notifications
You must be signed in to change notification settings - Fork 2
PendingAction with tests #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
assert str(pa) == "PendingAction: draw_cards(100)" Asserts can be used without a message? |
Also by saying it only supports functions with a single argument, do you mean it isn't possible or it's just not implemented yet? |
Yep. Not the best practice but quick and easy. |
Just not implemented. It could easily be expanded to support any number of arguments, but it also makes it a little harder to work with. The idea is to just pass around an object that represents "I'm about to attack/block/buff/whatever for X amount -- does anyone care enough to change/cancel this?". That would allow most relics/effects/anything reactive to have their code not be mixed in with the player/enemy classes or game engine. The player class shouldn't have any relic-specific things. Like ALL of this should eventually be removed:
With the right setup, we should be able to implement relics/effects without changing player/combat/message_bus/etc. |
How would it make it harder? I figure if most of the function calls that have to do with those items (attack, block, etc) use more than 1 argument then it should be implemented |
Maybe? What are the other args -- cards? player/enemy? target? Is there any relic/effect that's going to change those? Also, any function that uses multiple args can be reduced to a function of one arg easily with a lambda or |
uh oh |
merge conflicts |
Easier to start this from scratch |
Example of
PendingAction
with tests.Lets you specify an action, then publish it to the message bus where others can modify/cancel it, then you can execute it.
So it could let you publish
draw_cards(x)
, to let that be modified. Orblocking(x)
. Or really anything.Only supports functions with a single argument.