@lippelt/srd-dnd5e-2014 0.1.0 → 0.1.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/README.md +56 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
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).
|
|
6
|
+
|
|
7
|
+
## O que inclui
|
|
8
|
+
|
|
9
|
+
- **d20 com vantagem/desvantagem** — `roll('check' | 'd20', { modifier, advantage?, disadvantage? })`. Vantagem e desvantagem se cancelam (regra SRD).
|
|
10
|
+
- **Attack roll vs AC** — `roll('attack', { modifier, targetAC?, advantage?, disadvantage? })`. Crítico natural 20 sempre acerta; 1 sempre erra.
|
|
11
|
+
- **Saving throw** — `roll('save', { modifier, dc?, advantage?, disadvantage? })`.
|
|
12
|
+
- **Damage roll** — `roll('damage', { count, sides, modifier, critical? })`. `critical: true` dobra os dados.
|
|
13
|
+
- **Helpers exportados**:
|
|
14
|
+
- `abilityMod(score)` — `floor((score - 10) / 2)`
|
|
15
|
+
- `spellSaveDC(proficiency, casterMod)` — `8 + prof + mod`
|
|
16
|
+
- `spellAttackBonus(proficiency, casterMod)` — `prof + mod`
|
|
17
|
+
- **20 conditions** — Blinded, Charmed, Deafened, Exhaustion (níveis 1–6), Frightened, Grappled, Incapacitated, Invisible, Paralyzed, Petrified, Poisoned, Prone, Restrained, Stunned, Unconscious.
|
|
18
|
+
- **3 tracker fields** — AC (Classe de Armadura), Death Successes ✓, Death Failures ✗.
|
|
19
|
+
- **9 dice presets** — d20, d20 advantage/disadvantage, d4/d6/d8/d10/d12 (damage), d100.
|
|
20
|
+
|
|
21
|
+
## Não inclui
|
|
22
|
+
|
|
23
|
+
Spells, classes, races, monstros, items específicos — esse conteúdo deve vir do livro/SRD oficial ou de uma camada acima (compendium do consumidor). Este pacote modela só **mecânicas** (dice, condições, modificadores derivados).
|
|
24
|
+
|
|
25
|
+
## Uso
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { register, getSystem } from '@lippelt/srd-core'
|
|
29
|
+
import { dnd5e2014, abilityMod, spellSaveDC } from '@lippelt/srd-dnd5e-2014'
|
|
30
|
+
|
|
31
|
+
register(dnd5e2014)
|
|
32
|
+
|
|
33
|
+
const sys = getSystem('dnd5e-2014')!
|
|
34
|
+
|
|
35
|
+
// Attack roll com vantagem contra CA 16
|
|
36
|
+
const atk = sys.rules!.roll!('attack', { modifier: 6, targetAC: 16, advantage: true })
|
|
37
|
+
// → { total: 24, notes: ['vantagem', 'acertou (CA 16)'], ... }
|
|
38
|
+
|
|
39
|
+
// DC de feitiço pra um warlock CHA 18 com proficiência +3
|
|
40
|
+
const dc = spellSaveDC(3, abilityMod(18)) // 14
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Testes determinísticos
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import { setRoller, resetRoller } from '@lippelt/srd-dnd5e-2014'
|
|
47
|
+
|
|
48
|
+
setRoller(() => 20) // todo d20 vira 20
|
|
49
|
+
const r = dnd5e2014.rules!.roll!('attack', { modifier: 5 })
|
|
50
|
+
// → crítico natural 20
|
|
51
|
+
resetRoller()
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Licença
|
|
55
|
+
|
|
56
|
+
[MIT](LICENSE) (código). Mecânicas do SRD 5.1 sob CC-BY 4.0 (atribuição: Wizards of the Coast LLC).
|