bgio-effects
bgio-effects copied to clipboard
Send effects to some players only
In some cases, it can be useful to restrict an effect to be seen only by a subset of players. For example, in the case of a mulligan in a card game, one player shouldn't receive the mulliganing effects of their opponent.
User story
As a developer, I want to call an effect and have it sent to only a subset of players. That means the players not in that subset should not even know about the existence of that effect or its data, as that can contain private data.
API proposition
Here's a proposition of API based on my usage of the library and the existing code:
// Definition
ctx.effects.myEffect(data, position, duration, players);
// Call example
ctx.effects.myEffect({ secret: 1 }, '>', '1', [ '0' ]);
Questions
Looking at the code, and based on my current knowledge of boardgame.io, I'm not sure how the "unconcerned players do not know about the effect" feature can be implemented. Is there an equivalent of stripSecrets
for plugins / ctx
?