@swrpg-online/dice 0.0.0-development
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/LICENSE +21 -0
- package/README.md +136 -0
- package/dist/bundle.cjs.js +2 -0
- package/dist/bundle.cjs.js.map +1 -0
- package/dist/bundle.esm.js +2 -0
- package/dist/bundle.esm.js.map +1 -0
- package/dist/bundle.umd.js +2 -0
- package/dist/bundle.umd.js.map +1 -0
- package/dist/cli.d.ts +5 -0
- package/dist/cli.js +168 -0
- package/dist/dice.d.ts +16 -0
- package/dist/dice.js +695 -0
- package/dist/hints.d.ts +11 -0
- package/dist/hints.js +251 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +10 -0
- package/dist/pools.d.ts +32 -0
- package/dist/pools.js +53 -0
- package/dist/types.d.ts +60 -0
- package/dist/types.js +13 -0
- package/package.json +98 -0
package/dist/hints.js
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hints = void 0;
|
|
4
|
+
exports.hintCostDisplayText = hintCostDisplayText;
|
|
5
|
+
const types_1 = require("./types");
|
|
6
|
+
// 1 advantage or 1 triumph
|
|
7
|
+
const recoverOneStrain = "Recover one strain (may be applied more than once).";
|
|
8
|
+
const addBoostDieToActiveAlly = "Add a boost die to the next allied active character's check.";
|
|
9
|
+
const noticeImportantPoint = "Notice a single important point in the ongoing conflict, such as the location of a blast door's control panel or a weak point on an attack speeder.";
|
|
10
|
+
const inflictCriticalInjury = "Inflict a Critical Injury with a successful attack that deals damage past soak (Advantage cost may vary).";
|
|
11
|
+
const activateWeaponQuality = "Activate a weapon quality (Advantage cost may vary).";
|
|
12
|
+
// 2 advantage or 1 triumph
|
|
13
|
+
const performManeuver = "Perform an immediate free maneuver that does not exceed the two maneuver per turn limit.";
|
|
14
|
+
const addSetbackDie = "Add a setback die to the targeted character's next check.";
|
|
15
|
+
const addBoostDieToAnyAlly = "Add a boost die to any allied character's next check, including that of the active character.";
|
|
16
|
+
// 3 advantage or 1 triumph
|
|
17
|
+
const negateEnemy = "Negate the targeted enemy's defensive bonuses (such as the defense gained from cover, equipment, or performing the Guarded Stance maneuver) util the end of the current round.";
|
|
18
|
+
const ignoreEnvironment = "Ignore penalizing environmental effects such as inclement weather, zero gravity, or similar circumstances until the end of the active character's next turn.";
|
|
19
|
+
const disableOpponent = "When dealing damage to a target, have the attack disable the opponent or one piece of gear rather than dealing wounds or strain. This could include hobbling them temporarily with a shot to the leg, or disabling their comlink. This should be agreed upon by the player and the GM, and the effects are up to the GM (although Table 6-10: Critical Injury Result is a god resource to consult for possible effects). The effects should be temporary and not too excessive.";
|
|
20
|
+
const gainDefense = "Gain + 1 melee or ranged defense until the end of the active character's next turn.";
|
|
21
|
+
const dropWeapon = "Force the target to drop a melee or ranged weapon they are wielding.";
|
|
22
|
+
// 1 triumph
|
|
23
|
+
const upgradeDifficultyTargetedCharacter = "Upgrade the difficulty of the targeted character's next check.";
|
|
24
|
+
const doSomethingVital = "Do something vital, such as shooting the controls to the nearby blast doors to seal them shut.";
|
|
25
|
+
const upgradeAnyAllyCheck = "Upgrade any allied character's next check, including that of the current active character.";
|
|
26
|
+
// 2 triumph
|
|
27
|
+
const destroyEquipment = "When dealing damage to a target, have the attack destroy a piece of equipment the target is using, such as blowing up his blaster or destroying a personal shield generator.";
|
|
28
|
+
// 1 threat or 1 despair
|
|
29
|
+
const sufferStrain = "The active character suffers 1 strain.";
|
|
30
|
+
const loseManeuverBenefit = "The active character loses the benefits of a prior maneuver (such as from taking cover or assuming a Guarded Stance) until they perform the maneuver again.";
|
|
31
|
+
// 2 threat or 1 despair
|
|
32
|
+
const freeManeuver = "An opponent may immediately perform one free maneuver in response to the active character's check.";
|
|
33
|
+
const addBoostDieToTargetedCharacter = "Add a boost die to the targeted character's next check.";
|
|
34
|
+
const sufferSetback = "The active character or an allied character suffers a setback die on their next action.";
|
|
35
|
+
// 3 threat or 1 despair
|
|
36
|
+
const fallProne = "The active character falls prone.";
|
|
37
|
+
const gainSignificantAdvantage = "The active character grants the enemy a significant advantage in the ongoing encounter, such as accidentally blasting the controls to a bridge the active character was planning to use for their escape.";
|
|
38
|
+
// 1 despair
|
|
39
|
+
const outOfAmmo = "The character's ranged weapon imediately runs out of ammunition and may not be used for the remainder of the encounter.";
|
|
40
|
+
const upgradeDifficultyAlliedCharacter = "Upgrade the difficulty of an allied character's next check, including that of the current active character.";
|
|
41
|
+
const damagedItem = "The tool or melee weapon the character is using becomes damaged.";
|
|
42
|
+
exports.hints = [
|
|
43
|
+
// 1 advantage or 1 triumph
|
|
44
|
+
{
|
|
45
|
+
description: recoverOneStrain,
|
|
46
|
+
cost: {
|
|
47
|
+
[types_1.SYMBOLS.ADVANTAGE]: 1,
|
|
48
|
+
[types_1.SYMBOLS.TRIUMPH]: 1,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
description: addBoostDieToActiveAlly,
|
|
53
|
+
cost: {
|
|
54
|
+
[types_1.SYMBOLS.ADVANTAGE]: 1,
|
|
55
|
+
[types_1.SYMBOLS.TRIUMPH]: 1,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
description: noticeImportantPoint,
|
|
60
|
+
cost: {
|
|
61
|
+
[types_1.SYMBOLS.ADVANTAGE]: 1,
|
|
62
|
+
[types_1.SYMBOLS.TRIUMPH]: 1,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
description: inflictCriticalInjury,
|
|
67
|
+
cost: {
|
|
68
|
+
[types_1.SYMBOLS.ADVANTAGE]: 1,
|
|
69
|
+
[types_1.SYMBOLS.TRIUMPH]: 1,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
description: activateWeaponQuality,
|
|
74
|
+
cost: {
|
|
75
|
+
[types_1.SYMBOLS.ADVANTAGE]: 1,
|
|
76
|
+
[types_1.SYMBOLS.TRIUMPH]: 1,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
// 2 advantage or 1 triumph
|
|
80
|
+
{
|
|
81
|
+
description: performManeuver,
|
|
82
|
+
cost: {
|
|
83
|
+
[types_1.SYMBOLS.ADVANTAGE]: 2,
|
|
84
|
+
[types_1.SYMBOLS.TRIUMPH]: 1,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
description: addSetbackDie,
|
|
89
|
+
cost: {
|
|
90
|
+
[types_1.SYMBOLS.ADVANTAGE]: 2,
|
|
91
|
+
[types_1.SYMBOLS.TRIUMPH]: 1,
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
description: addBoostDieToAnyAlly,
|
|
96
|
+
cost: {
|
|
97
|
+
[types_1.SYMBOLS.ADVANTAGE]: 2,
|
|
98
|
+
[types_1.SYMBOLS.TRIUMPH]: 1,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
// 3 advantage or 1 triumph
|
|
102
|
+
{
|
|
103
|
+
description: negateEnemy,
|
|
104
|
+
cost: {
|
|
105
|
+
[types_1.SYMBOLS.ADVANTAGE]: 3,
|
|
106
|
+
[types_1.SYMBOLS.TRIUMPH]: 1,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
description: ignoreEnvironment,
|
|
111
|
+
cost: {
|
|
112
|
+
[types_1.SYMBOLS.ADVANTAGE]: 3,
|
|
113
|
+
[types_1.SYMBOLS.TRIUMPH]: 1,
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
description: disableOpponent,
|
|
118
|
+
cost: {
|
|
119
|
+
[types_1.SYMBOLS.ADVANTAGE]: 3,
|
|
120
|
+
[types_1.SYMBOLS.TRIUMPH]: 1,
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
description: gainDefense,
|
|
125
|
+
cost: {
|
|
126
|
+
[types_1.SYMBOLS.ADVANTAGE]: 3,
|
|
127
|
+
[types_1.SYMBOLS.TRIUMPH]: 1,
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
description: dropWeapon,
|
|
132
|
+
cost: {
|
|
133
|
+
[types_1.SYMBOLS.ADVANTAGE]: 3,
|
|
134
|
+
[types_1.SYMBOLS.TRIUMPH]: 1,
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
// 1 triumph
|
|
138
|
+
{
|
|
139
|
+
description: upgradeDifficultyTargetedCharacter,
|
|
140
|
+
cost: {
|
|
141
|
+
[types_1.SYMBOLS.TRIUMPH]: 1,
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
description: doSomethingVital,
|
|
146
|
+
cost: {
|
|
147
|
+
[types_1.SYMBOLS.TRIUMPH]: 1,
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
description: upgradeAnyAllyCheck,
|
|
152
|
+
cost: {
|
|
153
|
+
[types_1.SYMBOLS.TRIUMPH]: 1,
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
// 2 triumph
|
|
157
|
+
{
|
|
158
|
+
description: destroyEquipment,
|
|
159
|
+
cost: {
|
|
160
|
+
[types_1.SYMBOLS.TRIUMPH]: 2,
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
// 1 threat or 1 despair
|
|
164
|
+
{
|
|
165
|
+
description: sufferStrain,
|
|
166
|
+
cost: {
|
|
167
|
+
[types_1.SYMBOLS.THREAT]: 1,
|
|
168
|
+
[types_1.SYMBOLS.DESPAIR]: 1,
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
description: loseManeuverBenefit,
|
|
173
|
+
cost: {
|
|
174
|
+
[types_1.SYMBOLS.THREAT]: 1,
|
|
175
|
+
[types_1.SYMBOLS.DESPAIR]: 1,
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
// 2 threat or 1 despair
|
|
179
|
+
{
|
|
180
|
+
description: freeManeuver,
|
|
181
|
+
cost: {
|
|
182
|
+
[types_1.SYMBOLS.THREAT]: 2,
|
|
183
|
+
[types_1.SYMBOLS.DESPAIR]: 1,
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
description: addBoostDieToTargetedCharacter,
|
|
188
|
+
cost: {
|
|
189
|
+
[types_1.SYMBOLS.THREAT]: 1,
|
|
190
|
+
[types_1.SYMBOLS.DESPAIR]: 1,
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
description: sufferSetback,
|
|
195
|
+
cost: {
|
|
196
|
+
[types_1.SYMBOLS.THREAT]: 2,
|
|
197
|
+
[types_1.SYMBOLS.DESPAIR]: 1,
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
// 3 threat or 1 despair
|
|
201
|
+
{
|
|
202
|
+
description: fallProne,
|
|
203
|
+
cost: {
|
|
204
|
+
[types_1.SYMBOLS.THREAT]: 3,
|
|
205
|
+
[types_1.SYMBOLS.DESPAIR]: 1,
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
description: gainSignificantAdvantage,
|
|
210
|
+
cost: {
|
|
211
|
+
[types_1.SYMBOLS.THREAT]: 3,
|
|
212
|
+
[types_1.SYMBOLS.DESPAIR]: 1,
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
// 1 despair
|
|
216
|
+
{
|
|
217
|
+
description: outOfAmmo,
|
|
218
|
+
cost: {
|
|
219
|
+
[types_1.SYMBOLS.DESPAIR]: 1,
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
description: upgradeDifficultyAlliedCharacter,
|
|
224
|
+
cost: {
|
|
225
|
+
[types_1.SYMBOLS.DESPAIR]: 1,
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
description: damagedItem,
|
|
230
|
+
cost: {
|
|
231
|
+
[types_1.SYMBOLS.DESPAIR]: 1,
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
];
|
|
235
|
+
function hintCostDisplayText(hint) {
|
|
236
|
+
if (!hint.cost || Object.keys(hint.cost).length === 0) {
|
|
237
|
+
return "No cost";
|
|
238
|
+
}
|
|
239
|
+
const parts = Object.entries(hint.cost)
|
|
240
|
+
.filter(([_, count]) => count && count > 0)
|
|
241
|
+
.map(([symbol, count]) => {
|
|
242
|
+
const symbolName = symbol.charAt(0).toUpperCase() + symbol.toLowerCase().slice(1);
|
|
243
|
+
const plural = count > 1 ? "s" : "";
|
|
244
|
+
return `${count} ${symbolName}${plural}`;
|
|
245
|
+
});
|
|
246
|
+
// Use "OR" in uppercase for clarity when multiple options exist
|
|
247
|
+
if (parts.length > 1) {
|
|
248
|
+
return parts.join(" OR ");
|
|
249
|
+
}
|
|
250
|
+
return parts.length > 0 ? parts[0] : "No cost";
|
|
251
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createDifficultyPool = exports.createOpposedCheck = exports.createCombatCheck = exports.createSkillCheck = exports.roll = void 0;
|
|
4
|
+
var dice_1 = require("./dice");
|
|
5
|
+
Object.defineProperty(exports, "roll", { enumerable: true, get: function () { return dice_1.roll; } });
|
|
6
|
+
var pools_1 = require("./pools");
|
|
7
|
+
Object.defineProperty(exports, "createSkillCheck", { enumerable: true, get: function () { return pools_1.createSkillCheck; } });
|
|
8
|
+
Object.defineProperty(exports, "createCombatCheck", { enumerable: true, get: function () { return pools_1.createCombatCheck; } });
|
|
9
|
+
Object.defineProperty(exports, "createOpposedCheck", { enumerable: true, get: function () { return pools_1.createOpposedCheck; } });
|
|
10
|
+
Object.defineProperty(exports, "createDifficultyPool", { enumerable: true, get: function () { return pools_1.createDifficultyPool; } });
|
package/dist/pools.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DicePool } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a basic skill check dice pool
|
|
4
|
+
* @param ability Number of ability (green) dice
|
|
5
|
+
* @param proficiency Number of proficiency (yellow) dice
|
|
6
|
+
* @returns DicePool configured for a basic skill check
|
|
7
|
+
*/
|
|
8
|
+
export declare const createSkillCheck: (ability: number, proficiency: number) => DicePool;
|
|
9
|
+
/**
|
|
10
|
+
* Creates a combat check dice pool with optional boost die
|
|
11
|
+
* @param ability Number of ability (green) dice
|
|
12
|
+
* @param proficiency Number of proficiency (yellow) dice
|
|
13
|
+
* @param boost Number of boost (blue) dice
|
|
14
|
+
* @returns DicePool configured for a combat check
|
|
15
|
+
*/
|
|
16
|
+
export declare const createCombatCheck: (ability: number, proficiency: number, boost?: number) => DicePool;
|
|
17
|
+
/**
|
|
18
|
+
* Creates an opposed check dice pool
|
|
19
|
+
* @param ability Number of ability (green) dice
|
|
20
|
+
* @param proficiency Number of proficiency (yellow) dice
|
|
21
|
+
* @param difficulty Number of difficulty (purple) dice
|
|
22
|
+
* @param challenge Number of challenge (red) dice
|
|
23
|
+
* @returns DicePool configured for an opposed check
|
|
24
|
+
*/
|
|
25
|
+
export declare const createOpposedCheck: (ability: number, proficiency: number, difficulty: number, challenge?: number) => DicePool;
|
|
26
|
+
/**
|
|
27
|
+
* Creates a difficulty check dice pool
|
|
28
|
+
* @param difficulty Number of difficulty (purple) dice
|
|
29
|
+
* @param challenge Number of challenge (red) dice
|
|
30
|
+
* @returns DicePool configured for a pure difficulty check
|
|
31
|
+
*/
|
|
32
|
+
export declare const createDifficultyPool: (difficulty: number, challenge?: number) => DicePool;
|
package/dist/pools.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createDifficultyPool = exports.createOpposedCheck = exports.createCombatCheck = exports.createSkillCheck = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Creates a basic skill check dice pool
|
|
6
|
+
* @param ability Number of ability (green) dice
|
|
7
|
+
* @param proficiency Number of proficiency (yellow) dice
|
|
8
|
+
* @returns DicePool configured for a basic skill check
|
|
9
|
+
*/
|
|
10
|
+
const createSkillCheck = (ability, proficiency) => ({
|
|
11
|
+
abilityDice: Math.max(0, ability),
|
|
12
|
+
proficiencyDice: Math.max(0, proficiency),
|
|
13
|
+
});
|
|
14
|
+
exports.createSkillCheck = createSkillCheck;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a combat check dice pool with optional boost die
|
|
17
|
+
* @param ability Number of ability (green) dice
|
|
18
|
+
* @param proficiency Number of proficiency (yellow) dice
|
|
19
|
+
* @param boost Number of boost (blue) dice
|
|
20
|
+
* @returns DicePool configured for a combat check
|
|
21
|
+
*/
|
|
22
|
+
const createCombatCheck = (ability, proficiency, boost = 0) => ({
|
|
23
|
+
abilityDice: Math.max(0, ability),
|
|
24
|
+
proficiencyDice: Math.max(0, proficiency),
|
|
25
|
+
boostDice: Math.max(0, boost),
|
|
26
|
+
});
|
|
27
|
+
exports.createCombatCheck = createCombatCheck;
|
|
28
|
+
/**
|
|
29
|
+
* Creates an opposed check dice pool
|
|
30
|
+
* @param ability Number of ability (green) dice
|
|
31
|
+
* @param proficiency Number of proficiency (yellow) dice
|
|
32
|
+
* @param difficulty Number of difficulty (purple) dice
|
|
33
|
+
* @param challenge Number of challenge (red) dice
|
|
34
|
+
* @returns DicePool configured for an opposed check
|
|
35
|
+
*/
|
|
36
|
+
const createOpposedCheck = (ability, proficiency, difficulty, challenge = 0) => ({
|
|
37
|
+
abilityDice: Math.max(0, ability),
|
|
38
|
+
proficiencyDice: Math.max(0, proficiency),
|
|
39
|
+
difficultyDice: Math.max(0, difficulty),
|
|
40
|
+
challengeDice: Math.max(0, challenge),
|
|
41
|
+
});
|
|
42
|
+
exports.createOpposedCheck = createOpposedCheck;
|
|
43
|
+
/**
|
|
44
|
+
* Creates a difficulty check dice pool
|
|
45
|
+
* @param difficulty Number of difficulty (purple) dice
|
|
46
|
+
* @param challenge Number of challenge (red) dice
|
|
47
|
+
* @returns DicePool configured for a pure difficulty check
|
|
48
|
+
*/
|
|
49
|
+
const createDifficultyPool = (difficulty, challenge = 0) => ({
|
|
50
|
+
difficultyDice: Math.max(0, difficulty),
|
|
51
|
+
challengeDice: Math.max(0, challenge),
|
|
52
|
+
});
|
|
53
|
+
exports.createDifficultyPool = createDifficultyPool;
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export type DicePool = {
|
|
2
|
+
boostDice?: number;
|
|
3
|
+
abilityDice?: number;
|
|
4
|
+
proficiencyDice?: number;
|
|
5
|
+
setBackDice?: number;
|
|
6
|
+
difficultyDice?: number;
|
|
7
|
+
challengeDice?: number;
|
|
8
|
+
forceDice?: number;
|
|
9
|
+
};
|
|
10
|
+
export type DiceResult = {
|
|
11
|
+
successes: number;
|
|
12
|
+
failures: number;
|
|
13
|
+
advantages: number;
|
|
14
|
+
threats: number;
|
|
15
|
+
triumphs: number;
|
|
16
|
+
despair: number;
|
|
17
|
+
lightSide: number;
|
|
18
|
+
darkSide: number;
|
|
19
|
+
hints?: string[];
|
|
20
|
+
};
|
|
21
|
+
export type DieType = "boost" | "ability" | "proficiency" | "setback" | "difficulty" | "challenge" | "force";
|
|
22
|
+
export type DetailedDieResult = {
|
|
23
|
+
type: DieType;
|
|
24
|
+
roll: number;
|
|
25
|
+
result: DiceResult;
|
|
26
|
+
};
|
|
27
|
+
export type RollResult = {
|
|
28
|
+
results: DetailedDieResult[];
|
|
29
|
+
summary: DiceResult;
|
|
30
|
+
};
|
|
31
|
+
export declare const SYMBOLS: {
|
|
32
|
+
readonly SUCCESS: "SUCCESS";
|
|
33
|
+
readonly FAILURE: "FAILURE";
|
|
34
|
+
readonly ADVANTAGE: "ADVANTAGE";
|
|
35
|
+
readonly THREAT: "THREAT";
|
|
36
|
+
readonly TRIUMPH: "TRIUMPH";
|
|
37
|
+
readonly DESPAIR: "DESPAIR";
|
|
38
|
+
readonly LIGHT: "LIGHT";
|
|
39
|
+
readonly DARK: "DARK";
|
|
40
|
+
};
|
|
41
|
+
export type Symbol = keyof typeof SYMBOLS;
|
|
42
|
+
export type RollOptions = {
|
|
43
|
+
hints?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Maximum number of dice allowed per die type.
|
|
46
|
+
* Default: 100
|
|
47
|
+
*/
|
|
48
|
+
maxDicePerType?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Maximum total number of dice allowed in a single roll.
|
|
51
|
+
* Default: 500
|
|
52
|
+
*/
|
|
53
|
+
maxTotalDice?: number;
|
|
54
|
+
/**
|
|
55
|
+
* Whether to throw an error when dice limits are exceeded.
|
|
56
|
+
* If false, dice counts will be silently capped to the maximum.
|
|
57
|
+
* Default: false
|
|
58
|
+
*/
|
|
59
|
+
throwOnLimitExceeded?: boolean;
|
|
60
|
+
};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SYMBOLS = void 0;
|
|
4
|
+
exports.SYMBOLS = {
|
|
5
|
+
SUCCESS: "SUCCESS",
|
|
6
|
+
FAILURE: "FAILURE",
|
|
7
|
+
ADVANTAGE: "ADVANTAGE",
|
|
8
|
+
THREAT: "THREAT",
|
|
9
|
+
TRIUMPH: "TRIUMPH",
|
|
10
|
+
DESPAIR: "DESPAIR",
|
|
11
|
+
LIGHT: "LIGHT",
|
|
12
|
+
DARK: "DARK",
|
|
13
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@swrpg-online/dice",
|
|
3
|
+
"version": "0.0.0-development",
|
|
4
|
+
"description": "A TypeScript library that creates dice rolls using the narrative dice system for the Star Wars Roleplaying Game by Fantasy Flight Games and Edge Studio.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"swrpg",
|
|
7
|
+
"dice",
|
|
8
|
+
"rpg",
|
|
9
|
+
"star wars",
|
|
10
|
+
"star-wars",
|
|
11
|
+
"rpg",
|
|
12
|
+
"dice",
|
|
13
|
+
"edge-studio",
|
|
14
|
+
"narrative-dice",
|
|
15
|
+
"typescript",
|
|
16
|
+
"cli",
|
|
17
|
+
"swrpg",
|
|
18
|
+
"genesys",
|
|
19
|
+
"fantasy-flight-games",
|
|
20
|
+
"ffg",
|
|
21
|
+
"roleplaying",
|
|
22
|
+
"tabletop",
|
|
23
|
+
"dice-roller"
|
|
24
|
+
],
|
|
25
|
+
"homepage": "https://github.com/swrpg-online/dice",
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/swrpg-online/dice/issues"
|
|
28
|
+
},
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"author": "@swrpg-online",
|
|
31
|
+
"contributors": [],
|
|
32
|
+
"main": "dist/bundle.cjs.js",
|
|
33
|
+
"module": "dist/bundle.esm.js",
|
|
34
|
+
"browser": "dist/bundle.umd.js",
|
|
35
|
+
"types": "dist/index.d.ts",
|
|
36
|
+
"bin": {
|
|
37
|
+
"swrpg-dice": "dist/cli.js"
|
|
38
|
+
},
|
|
39
|
+
"exports": {
|
|
40
|
+
".": {
|
|
41
|
+
"types": "./dist/index.d.ts",
|
|
42
|
+
"import": "./dist/bundle.esm.js",
|
|
43
|
+
"require": "./dist/bundle.cjs.js",
|
|
44
|
+
"browser": "./dist/bundle.umd.js",
|
|
45
|
+
"default": "./dist/index.js"
|
|
46
|
+
},
|
|
47
|
+
"./cli": "./dist/cli.js",
|
|
48
|
+
"./bundle": {
|
|
49
|
+
"import": "./dist/bundle.esm.js",
|
|
50
|
+
"require": "./dist/bundle.cjs.js",
|
|
51
|
+
"browser": "./dist/bundle.umd.js"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"directories": {
|
|
55
|
+
"test": "tests"
|
|
56
|
+
},
|
|
57
|
+
"files": [
|
|
58
|
+
"dist/**"
|
|
59
|
+
],
|
|
60
|
+
"scripts": {
|
|
61
|
+
"test": "npx jest --verbose",
|
|
62
|
+
"ci:test": "tsc --noEmit && npx jest --verbose",
|
|
63
|
+
"build": "tsc && npm run bundle",
|
|
64
|
+
"bundle": "rollup -c",
|
|
65
|
+
"prepare": "npm run build && husky install"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@rollup/plugin-commonjs": "^28.0.6",
|
|
69
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
70
|
+
"@rollup/plugin-typescript": "^12.1.4",
|
|
71
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
72
|
+
"@semantic-release/git": "^10.0.1",
|
|
73
|
+
"@semantic-release/github": "^11.0.1",
|
|
74
|
+
"@semantic-release/npm": "^12.0.1",
|
|
75
|
+
"@types/jest": "^29.5.14",
|
|
76
|
+
"@types/node": "^22.10.0",
|
|
77
|
+
"husky": "^8.0.3",
|
|
78
|
+
"jest": "^29.7.0",
|
|
79
|
+
"lint-staged": "^15.2.10",
|
|
80
|
+
"prettier": "3.4.1",
|
|
81
|
+
"rollup": "^2.79.2",
|
|
82
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
83
|
+
"semantic-release": "^24.2.0",
|
|
84
|
+
"ts-jest": "^29.4.1",
|
|
85
|
+
"tslib": "^2.8.1",
|
|
86
|
+
"typescript": "^5.7.2"
|
|
87
|
+
},
|
|
88
|
+
"repository": {
|
|
89
|
+
"type": "git",
|
|
90
|
+
"url": "https://github.com/swrpg-online/dice"
|
|
91
|
+
},
|
|
92
|
+
"engines": {
|
|
93
|
+
"node": ">=21"
|
|
94
|
+
},
|
|
95
|
+
"lint-staged": {
|
|
96
|
+
"**/*": "prettier --write --ignore-unknown"
|
|
97
|
+
}
|
|
98
|
+
}
|