@gamepark/skyrift 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SkyriftRules.d.ts +2 -2
- package/dist/SkyriftRules.js +2 -2
- package/dist/material/decks/gravehurt/CallOfTheEclipse.js +1 -1
- package/dist/material/decks/heathblade/ArmadaEffectRule.d.ts +1 -0
- package/dist/material/decks/heathblade/ArmadaEffectRule.js +4 -0
- package/dist/rules/DiscardEffectRule.js +4 -3
- package/dist/rules/StunEffectRule.d.ts +11 -0
- package/dist/rules/StunEffectRule.js +45 -0
- package/package.json +2 -2
package/dist/SkyriftRules.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ import { StartPlayerTurnRule } from './rules/StartPlayerTurnRule';
|
|
|
27
27
|
import { StartRoundRule } from './rules/StartRoundRule';
|
|
28
28
|
import { StashPowerTokensEffectRule } from './rules/StashPowerTokensEffectRule';
|
|
29
29
|
import { StealCrystalEffectRule } from './rules/StealCrystalEffectRule';
|
|
30
|
-
import {
|
|
30
|
+
import { StunEffectRule } from './rules/StunEffectRule';
|
|
31
31
|
export declare class SkyriftRules extends SecretMaterialRules<Deck, MaterialType, LocationType> implements TimeLimit<MaterialGame<Deck, MaterialType, LocationType>, MaterialMove<Deck, MaterialType, LocationType>, Deck> {
|
|
32
32
|
rules: {
|
|
33
33
|
1: typeof StartRoundRule;
|
|
@@ -41,7 +41,7 @@ export declare class SkyriftRules extends SecretMaterialRules<Deck, MaterialType
|
|
|
41
41
|
22: typeof DrawEffectRule;
|
|
42
42
|
23: typeof DiscardEffectRule;
|
|
43
43
|
24: typeof DestroyEffectRule;
|
|
44
|
-
25: typeof
|
|
44
|
+
25: typeof StunEffectRule;
|
|
45
45
|
26: typeof ReturnCardEffectRule;
|
|
46
46
|
27: typeof PutPowerTokenEffectRule;
|
|
47
47
|
28: typeof StashPowerTokensEffectRule;
|
package/dist/SkyriftRules.js
CHANGED
|
@@ -30,7 +30,7 @@ import { StartPlayerTurnRule } from './rules/StartPlayerTurnRule';
|
|
|
30
30
|
import { StartRoundRule } from './rules/StartRoundRule';
|
|
31
31
|
import { StashPowerTokensEffectRule } from './rules/StashPowerTokensEffectRule';
|
|
32
32
|
import { StealCrystalEffectRule } from './rules/StealCrystalEffectRule';
|
|
33
|
-
import {
|
|
33
|
+
import { StunEffectRule } from './rules/StunEffectRule';
|
|
34
34
|
export class SkyriftRules extends SecretMaterialRules {
|
|
35
35
|
rules = {
|
|
36
36
|
[RuleId.StartRound]: StartRoundRule,
|
|
@@ -44,7 +44,7 @@ export class SkyriftRules extends SecretMaterialRules {
|
|
|
44
44
|
[RuleId.DrawEffect]: DrawEffectRule,
|
|
45
45
|
[RuleId.DiscardEffect]: DiscardEffectRule,
|
|
46
46
|
[RuleId.DestroyEffect]: DestroyEffectRule,
|
|
47
|
-
[RuleId.StunEffect]:
|
|
47
|
+
[RuleId.StunEffect]: StunEffectRule,
|
|
48
48
|
[RuleId.ReturnCardEffect]: ReturnCardEffectRule,
|
|
49
49
|
[RuleId.PutPowerTokensEffect]: PutPowerTokenEffectRule,
|
|
50
50
|
[RuleId.StashPowerTokensEffect]: StashPowerTokensEffectRule,
|
|
@@ -14,7 +14,7 @@ class CallOfTheEclipseRule extends CardRule {
|
|
|
14
14
|
return this.material(MaterialType.Card)
|
|
15
15
|
.location(LocationType.PlayerHand)
|
|
16
16
|
.player(this.player)
|
|
17
|
-
.id((id) => cardProperties[id.front].suit === CardSuit.Night);
|
|
17
|
+
.id((id) => id.front !== undefined && cardProperties[id.front].suit === CardSuit.Night);
|
|
18
18
|
}
|
|
19
19
|
isPlayCardOptional() {
|
|
20
20
|
return true;
|
|
@@ -2,6 +2,7 @@ import { CustomMove } from '@gamepark/rules-api';
|
|
|
2
2
|
import { DiscardEffectRule } from '../../../rules/DiscardEffectRule';
|
|
3
3
|
export declare class ArmadaEffectRule extends DiscardEffectRule {
|
|
4
4
|
getPlayerMoves(): import("@gamepark/rules-api").MaterialMove[];
|
|
5
|
+
onRuleStart(): never[];
|
|
5
6
|
onDiscard(): never[];
|
|
6
7
|
onCustomMove(move: CustomMove): import("@gamepark/rules-api").MaterialMove[];
|
|
7
8
|
}
|
|
@@ -7,6 +7,10 @@ export class ArmadaEffectRule extends DiscardEffectRule {
|
|
|
7
7
|
moves.push(this.customMove(CustomMoveType.Pass));
|
|
8
8
|
return moves;
|
|
9
9
|
}
|
|
10
|
+
onRuleStart() {
|
|
11
|
+
this.memorize(Memory.EffectCount, 0);
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
10
14
|
onDiscard() {
|
|
11
15
|
this.memorize(Memory.EffectCount, (count) => count + 1);
|
|
12
16
|
return [];
|
|
@@ -8,14 +8,15 @@ export class DiscardEffectRule extends EffectRule {
|
|
|
8
8
|
return this.cardRule.getDiscardCount?.() ?? 1;
|
|
9
9
|
}
|
|
10
10
|
onRuleStart() {
|
|
11
|
-
this.memorize(Memory.EffectCount, 0);
|
|
12
11
|
const targets = this.getTargets();
|
|
13
12
|
if (!targets.length) {
|
|
14
13
|
return this.endEffect();
|
|
15
14
|
}
|
|
16
15
|
if (this.cardRule.isAutoDiscard?.()) {
|
|
16
|
+
this.memorize(Memory.EffectCount, targets.length);
|
|
17
17
|
return targets.moveItems((item) => ({ type: LocationType.PlayerDiscard, player: item.location.player }));
|
|
18
18
|
}
|
|
19
|
+
this.memorize(Memory.EffectCount, this.discardCount);
|
|
19
20
|
return [];
|
|
20
21
|
}
|
|
21
22
|
getTargets() {
|
|
@@ -34,8 +35,8 @@ export class DiscardEffectRule extends EffectRule {
|
|
|
34
35
|
return [];
|
|
35
36
|
}
|
|
36
37
|
onDiscard(_move) {
|
|
37
|
-
const
|
|
38
|
-
if (
|
|
38
|
+
const remaining = this.memorize(Memory.EffectCount, (c) => c - 1);
|
|
39
|
+
if (remaining <= 0) {
|
|
39
40
|
return this.endEffect();
|
|
40
41
|
}
|
|
41
42
|
return [];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ItemMove, Material, MaterialMove } from '@gamepark/rules-api';
|
|
2
|
+
import { StunEffect } from '../material/EffectTraits';
|
|
3
|
+
import { EffectRule } from './EffectRule';
|
|
4
|
+
export declare class StunEffectRule extends EffectRule<StunEffect> {
|
|
5
|
+
onRuleStart(): MaterialMove[];
|
|
6
|
+
getPlayerMoves(): MaterialMove[];
|
|
7
|
+
stunTargets(): MaterialMove[];
|
|
8
|
+
getTargets(): Material;
|
|
9
|
+
afterItemMove(move: ItemMove): MaterialMove[];
|
|
10
|
+
onRuleEnd(): never[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { isCreateItemType } from '@gamepark/rules-api';
|
|
2
|
+
import { LocationType } from '../material/LocationType';
|
|
3
|
+
import { MaterialType } from '../material/MaterialType';
|
|
4
|
+
import { Memory } from '../Memory';
|
|
5
|
+
import { EffectRule } from './EffectRule';
|
|
6
|
+
export class StunEffectRule extends EffectRule {
|
|
7
|
+
onRuleStart() {
|
|
8
|
+
this.memorize(Memory.EffectCount, []);
|
|
9
|
+
if (!this.getTargets().length) {
|
|
10
|
+
return this.endEffect();
|
|
11
|
+
}
|
|
12
|
+
if (this.cardRule.isAutoStun?.()) {
|
|
13
|
+
return this.stunTargets();
|
|
14
|
+
}
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
getPlayerMoves() {
|
|
18
|
+
return this.stunTargets();
|
|
19
|
+
}
|
|
20
|
+
stunTargets() {
|
|
21
|
+
const stunCount = this.cardRule.getStunCount?.() ?? 1;
|
|
22
|
+
return this.getTargets().sort((item) => item.location.x).getIndexes().map((creatureIndex) => this.material(MaterialType.StunToken).createItem({
|
|
23
|
+
location: { type: LocationType.CardStunTokens, parent: creatureIndex },
|
|
24
|
+
quantity: stunCount
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
getTargets() {
|
|
28
|
+
const stunned = this.remind(Memory.EffectCount);
|
|
29
|
+
const targets = this.cardRule.getStunTargets?.() ?? this.cardRule.creatures;
|
|
30
|
+
return targets.index((index) => !stunned.includes(index));
|
|
31
|
+
}
|
|
32
|
+
afterItemMove(move) {
|
|
33
|
+
if (isCreateItemType(MaterialType.StunToken)(move) && move.item.location.type === LocationType.CardStunTokens) {
|
|
34
|
+
const stunned = this.memorize(Memory.EffectCount, (s) => [...s, move.item.location.parent]);
|
|
35
|
+
if ((!this.cardRule.isAutoStun?.() && stunned.length >= (this.cardRule.getStunTargetsCount?.() ?? 1)) || !this.getTargets().length) {
|
|
36
|
+
return this.endEffect();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
onRuleEnd() {
|
|
42
|
+
this.forget(Memory.EffectCount);
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gamepark/skyrift",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "The rules of SkyRift adapted for Game Park",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"es-toolkit": "^1.43.0",
|
|
31
31
|
"vitest": "^4.0.15"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "e9084054f7da0b172340a4a24de6f26170bd06c5"
|
|
34
34
|
}
|