@lippelt/srd-dnd5e-2014 0.1.0 → 0.1.2
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/README.md +52 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# @lippelt/srd-dnd5e-2014
|
|
2
|
+
|
|
3
|
+
Módulo Dungeons & Dragons 5ª Edição (2014) para [`@lippelt/srd-core`](../core).
|
|
4
|
+
|
|
5
|
+
> D&D® é trademark da Wizards of the Coast LLC. Este pacote usa mecânicas do [System Reference Document 5.1](https://dnd.wizards.com/resources/systems-reference-document) sob a [Creative Commons Attribution 4.0 International License (CC-BY 4.0)](https://creativecommons.org/licenses/by/4.0/legalcode). Termos em PT-BR seguem a tradução oficial Galápagos Jogos.
|
|
6
|
+
|
|
7
|
+
## O que inclui
|
|
8
|
+
|
|
9
|
+
- **d20 com vantagem/desvantagem** — `roll('check' | 'd20', { modifier, advantage?, disadvantage? })`. Vantagem e desvantagem se cancelam (regra do SRD).
|
|
10
|
+
- **Rolagem de ataque vs CA** — `roll('attack', { modifier, targetAC?, advantage?, disadvantage? })`. 20 natural sempre acerta; 1 natural sempre erra.
|
|
11
|
+
- **Teste de resistência** — `roll('save', { modifier, dc?, advantage?, disadvantage? })`.
|
|
12
|
+
- **Rolagem de dano** — `roll('damage', { count, sides, modifier, critical? })`. `critical: true` dobra os dados.
|
|
13
|
+
- **Utilitários exportados:**
|
|
14
|
+
- `abilityMod(score)` — `floor((score - 10) / 2)`
|
|
15
|
+
- `spellSaveDC(proficiency, casterMod)` — `8 + prof + mod`
|
|
16
|
+
- `spellAttackBonus(proficiency, casterMod)` — `prof + mod`
|
|
17
|
+
- **20 condições** — Cego, Enfeitiçado, Surdo, Exaustão (níveis 1–6), Amedrontado, Agarrado, Incapacitado, Invisível, Paralisado, Petrificado, Envenenado, Caído, Contido, Atordoado, Inconsciente.
|
|
18
|
+
- **3 campos de status** — CA (Classe de Armadura), Mortes ✓, Mortes ✗.
|
|
19
|
+
- **9 presets de dados** — d20, d20 com vantagem/desvantagem, d4/d6/d8/d10/d12 (dano), d100.
|
|
20
|
+
|
|
21
|
+
## Uso
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { register, getSystem } from '@lippelt/srd-core'
|
|
25
|
+
import { dnd5e2014, abilityMod, spellSaveDC } from '@lippelt/srd-dnd5e-2014'
|
|
26
|
+
|
|
27
|
+
register(dnd5e2014)
|
|
28
|
+
|
|
29
|
+
const sys = getSystem('dnd5e-2014')!
|
|
30
|
+
|
|
31
|
+
// Ataque com vantagem contra CA 16
|
|
32
|
+
const atk = sys.rules!.roll!('attack', { modifier: 6, targetAC: 16, advantage: true })
|
|
33
|
+
// → { total: 24, notes: ['vantagem', 'acertou (CA 16)'], ... }
|
|
34
|
+
|
|
35
|
+
// CD de magia pra um warlock CAR 18 com proficiência +3
|
|
36
|
+
const cd = spellSaveDC(3, abilityMod(18)) // 14
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Testes determinísticos
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { setRoller, resetRoller } from '@lippelt/srd-dnd5e-2014'
|
|
43
|
+
|
|
44
|
+
setRoller(() => 20) // todo d20 vira 20
|
|
45
|
+
const r = dnd5e2014.rules!.roll!('attack', { modifier: 5 })
|
|
46
|
+
// → crítico natural 20
|
|
47
|
+
resetRoller()
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Licença
|
|
51
|
+
|
|
52
|
+
[MIT](LICENSE) (código). Mecânicas do SRD 5.1 sob CC-BY 4.0 (atribuição: Wizards of the Coast LLC).
|