Skip to content

Commit 061fdc2

Browse files
committed
feat: Update boardgame.io version to v0.50
1 parent 3af2afc commit 061fdc2

File tree

11 files changed

+8385
-5233
lines changed

11 files changed

+8385
-5233
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ npm i bgio-effects
2121
Call effects from your moves or other game code:
2222

2323
```js
24-
function move(G, ctx) {
25-
ctx.effects.explode();
24+
function move({ G, effects }) {
25+
effects.explode();
2626
}
2727
```
2828

docs/src/pages/demo/Game.ts

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,21 @@ const effectsConfig = {
1717

1818
export type EffectsConfig = typeof effectsConfig;
1919

20-
const game: Game<
21-
Record<string, never>,
22-
Ctx & EffectsCtxMixin<EffectsConfig>
23-
> = {
20+
const game: Game<Record<string, never>, Ctx & EffectsCtxMixin<EffectsConfig>> = {
2421
plugins: [EffectsPlugin(effectsConfig)],
2522
moves: {
26-
One: (_, ctx) => {
27-
ctx.effects.A('one');
28-
ctx.effects.A('two', '<+0.5');
29-
ctx.effects.B('hello', '<+0.5');
30-
ctx.effects.A('three', '<+0.25');
31-
ctx.effects.B('world', '<+0.5');
23+
One: ({ effects }) => {
24+
effects.A('one');
25+
effects.A('two', '<+0.5');
26+
effects.B('hello', '<+0.5');
27+
effects.A('three', '<+0.25');
28+
effects.B('world', '<+0.5');
3229
},
33-
Two: (_, ctx) => {
34-
ctx.effects.A('synch-');
35-
ctx.effects.B('ronise', '<');
36-
ctx.effects.A('effects', '<+0.5');
37-
ctx.effects.B('FX!', '<');
30+
Two: ({ effects }) => {
31+
effects.A('synch-');
32+
effects.B('ronise', '<');
33+
effects.A('effects', '<+0.5');
34+
effects.B('FX!', '<');
3835
},
3936
},
4037
};

docs/src/pages/plugin/config.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,16 @@ const game = {
5050
// Each effect type declared in your config will
5151
// be available in your moves as ctx.effects[effectType]
5252
moves: {
53-
roll: (G, ctx) => {
54-
const roll = ctx.random.D6();
55-
ctx.effects.rollDie(roll);
53+
roll: ({ G, random, effects }) => {
54+
const roll = random.D6();
55+
effects.rollDie(roll);
5656
if (roll > 4) ctx.effects.explode();
5757
G.roll = roll;
5858
},
5959

60-
end: (G, ctx) => {
61-
ctx.events.endTurn();
62-
ctx.effects.endTurn();
60+
end: ({ G, events, effects }) => {
61+
events.endTurn();
62+
effects.endTurn();
6363
},
6464
},
6565
};

docs/src/pages/tutorial/Game.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ export const BaseGame: Game<G> = {
1212
score: 0,
1313
}),
1414
moves: {
15-
roll: (G: G, ctx): void => {
16-
G.roll = ctx.random.D6();
15+
roll: ({ G: G, random }): void => {
16+
G.roll = random.D6();
1717
if (G.roll === 6) G.score++;
1818
},
1919
},
@@ -33,9 +33,9 @@ export const GameWithRollEffect: Game<G> = {
3333
plugins: [EffectsPlugin(baseEffectsConfig)],
3434
moves: {
3535
...BaseGame.moves,
36-
roll: (G, ctx) => {
37-
G.roll = ctx.random.D6();
38-
ctx.effects.roll(G.roll);
36+
roll: ({ G, random, effects }) => {
37+
G.roll = random.D6();
38+
effects.roll(G.roll);
3939
if (G.roll === 6) G.score++;
4040
},
4141
},
@@ -55,9 +55,9 @@ export const GameWithTimedRollEffect: Game<G> = {
5555
plugins: [EffectsPlugin(timedEffectsConfig)],
5656
moves: {
5757
...BaseGame.moves,
58-
roll: (G, ctx) => {
59-
G.roll = ctx.random.D6();
60-
ctx.effects.roll(G.roll);
58+
roll: ({ G, random, effects }) => {
59+
G.roll = random.D6();
60+
effects.roll(G.roll);
6161
if (G.roll === 6) G.score++;
6262
},
6363
},

docs/src/pages/tutorial/index.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ const game = {
2626
setup: () => ({ roll: 1, score: 0 }),
2727

2828
moves: {
29-
roll: (G, ctx) => {
30-
const roll = ctx.random.D6();
29+
roll: ({ G, random }) => {
30+
const roll = random.D6();
3131
G.roll = roll;
3232
if (roll === 6) G.score++;
3333
},
3434
},
3535

3636
// End the game when the player has scored 5 points.
37-
endIf: (G) => G.score >= 5,
37+
endIf: ({ G }) => G.score >= 5,
3838
};
3939
```
4040

@@ -154,16 +154,16 @@ const game = {
154154
setup: () => ({ roll: 1, score: 0 }),
155155

156156
moves: {
157-
roll: (G, ctx) => {
158-
const roll = ctx.random.D6();
157+
roll: ({ G, random, effects }) => {
158+
const roll = random.D6();
159159
// Call the newly added roll effect.
160-
ctx.effects.roll(roll);
160+
effects.roll(roll);
161161
G.roll = roll;
162162
if (G.roll === 6) G.score++;
163163
},
164164
},
165165

166-
endIf: (G) => G.score >= 5,
166+
endIf: ({ G }) => G.score >= 5,
167167
};
168168
```
169169

0 commit comments

Comments
 (0)