Skip to content

Commit 9e6b4ae

Browse files
authored
Improvements to class features and the importer (#108)
* Handle NPC stats with damage bonus/penalty. Closes #104. * Handle warrior attack bonus not being a dice expression. Closes #103. * Add title to upper level sheet header. Closes #99. * Handle missing weapons and avoid confusing armor with missing weapons. * Update details.sheetClass when the sheet class changes. * Implement the option to backstab for any character. Closes #94, Closes #102 * Format fixes. * Refactor crit and fumble lookups into their own functions. * Show crit and fumble roll and formula. Closes #98 * Support applying damage/healing from any chat card with a dice roll. Closes #106 * Add comments for rollCrit and rollFumble. * Prompt for confirmation before deleting items from actor sheets. Closes #77 * Cleric disapproval implementation. Allow selection of a compendium for disapproval tables in the system settings. Add field for selection of a disapproval table on the cleric sheet. Disapproval Range label increases disapproval range. Disapproval Table label rolls for disapproval (with prompt for the dice formula) Macros for Disapproval Range and Disapproval Table Closes #58 * Update system.json - version 0.17 compatible with Foundry 0.7.7 * Hide Purple Sorcerer link on NPC import form. Closes #107 * Implement a setting to enable the standard dice roll/table draw chat cards for attack and damage rolls, and crits and fumbles. Closes #93 * Highlight disapproval automatically for clerics. Migrate a flag into cleric spells that are implemented as skill checks to check for disapproval.
1 parent 61a4601 commit 9e6b4ae

24 files changed

+862
-265
lines changed

lang/en.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"DCC.AlignmentL": "Lawful",
4949
"DCC.AlignmentN": "Neutral",
5050
"DCC.Ammunition": "Ammunition",
51+
"DCC.ApplyDisapprovalMacroName": "Increase Disapproval Range",
5152
"DCC.Armor": "Armor",
5253
"DCC.ArmorClass": "Armor Class",
5354
"DCC.ArmorPropertiesACBonus": "AC Bonus",
@@ -58,11 +59,13 @@
5859
"DCC.Attack": "Attack",
5960
"DCC.AttackBonus": "Attack Bonus",
6061
"DCC.AttackPl": "Attacks",
62+
"DCC.AttackRoll": "Attack Roll",
6163
"DCC.AttackRollEmote": "Attacks with their {weaponName} and hits AC {rollHTML} for {damageRollHTML} points of damage!{crit}{fumble}",
6264
"DCC.Attributes": "Attributes",
6365
"DCC.Attuned": "Attuned",
6466
"DCC.Background": "Background",
6567
"DCC.Backstab": "Backstab",
68+
"DCC.BackstabRoll": "Backstab Roll",
6669
"DCC.BackstabEmote": "Backstabs with their {weaponName} and hits AC {rollHTML} for {damageRollHTML} points of damage!{crit}{fumble}",
6770
"DCC.BadValueFormulaWarning": "Bad formula in item value field!",
6871
"DCC.BaseACAbilityConfig": "Base AC Ability",
@@ -184,17 +187,24 @@
184187
"DCC.DamageLightning": "Lightning",
185188
"DCC.DamagePiercing": "Piercing",
186189
"DCC.DamagePoison": "Poison",
190+
"DCC.DamageRoll": "Damage Roll",
187191
"DCC.DamageSlashing": "Slashing",
188192
"DCC.Day": "Day",
189193
"DCC.DeedRoll": "Deed Roll",
190194
"DCC.Default": "Default",
191195
"DCC.DefaultAbilityCheck": "Default Ability Check",
192196
"DCC.Deity": "Deity",
197+
"DCC.DeleteItem": "Delete this item from the sheet?",
198+
"DCC.DeleteItemExplain": "This will remove the item and cannot be undone.",
193199
"DCC.Description": "Description",
194200
"DCC.Details": "Details",
195201
"DCC.DisableTrap": "Disable Trap",
196202
"DCC.Disadvantage": "Disadvantage",
203+
"DCC.DisapprovalFormulaWarning": "Invalid roll formula for disapproval '{formula}'.",
197204
"DCC.DisapprovalRange": "Disapproval Range",
205+
"DCC.DisapprovalRoll": "Disapproval Roll",
206+
"DCC.DisapprovalRollFormula": "Disapproval Roll",
207+
"DCC.DisapprovalTable": "Disapproval Table",
198208
"DCC.DisguiseSelf": "Disguise Self",
199209
"DCC.DistAny": "Any",
200210
"DCC.DistFt": "Feet",
@@ -391,6 +401,7 @@
391401
"DCC.Roll": "Roll",
392402
"DCC.RollAttackBonusConfig": "Roll Attack Bonus",
393403
"DCC.RollAttackBonusInfo": "Use @ab in ToHit or Damage for last roll",
404+
"DCC.RollDisapprovalMacroName": "Roll for Disapproval",
394405
"DCC.RollExample": "e.g. +1d4",
395406
"DCC.RollMode": "Roll Mode",
396407
"DCC.RollSituationalBonus": "Situational Bonus?",
@@ -408,10 +419,17 @@
408419
"DCC.Senses": "Senses",
409420
"DCC.SettingCriticalHitsCompendium": "Critical Hits Compendium",
410421
"DCC.SettingCriticalHitsCompendiumHint": "Compendium to look in for critical hit tables - table name must start with Crit Table XXX (where XXX is the actor's crit table)",
422+
"DCC.SettingDeleteItem": "Prompt for Item Deletion",
423+
"DCC.SettingDeleteItemHint": "Ask for confirmation before deleting equipment, spells, or custom skills from character sheets.",
424+
"DCC.SettingDisapprovalTablesCompendium": "Disapproval Tables Compendium",
425+
"DCC.SettingDisapprovalTablesCompendiumHint": "Compendium to look in for critical hit tables. The specific table to use is selectable from the Cleric sheet.",
411426
"DCC.SettingFumbleTable": "Fumble Table",
412427
"DCC.SettingFumbleTableHint": "Roll Table to use for fumbles - must be in a compendium pack",
428+
"DCC.SettingStandardDiceRoller": "Use standard chat cards for dice rolls",
429+
"DCC.SettingStandardDiceRollerHint": "Use Foundry's standard cards to display attack, damage, crit, and fumble rolls instead of the custom card.",
413430
"DCC.SheetConfig": "Sheet Configuration",
414431
"DCC.ShieldBash": "Shield Bash",
432+
"DCC.ShowBackstabConfig": "Show Backstab",
415433
"DCC.ShowMaxAbilitiesConfig": "Show Max Abilities",
416434
"DCC.ShowSkillsConfig": "Show Custom Skills Tab",
417435
"DCC.ShowSpellsConfig": "Show Custom Spells Tab",
@@ -528,6 +546,7 @@
528546
"DCC.TraitToolProf": "Tool Proficiencies",
529547
"DCC.TraitWeaponProf": "Weapon Proficiencies",
530548
"DCC.Treasure": "Treasure",
549+
"DCC.Title": "Title",
531550
"DCC.TurnUnholy": "Turn Unholy",
532551
"DCC.TwoWeaponFighting": "Two Weapon Fighting",
533552
"DCC.Type": "Type",

module/__tests__/npc-parser.test.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,3 +248,41 @@ test('familiar', () => {
248248
}
249249
expect(parsedNPC).toMatchObject(expected)
250250
})
251+
252+
/* Test damage modifiers */
253+
test('bonusguy', () => {
254+
const parsedNPC = parseNPC('Bonus Guy: Init -1; Atk big club +3 melee (1d4+2) or small club -2 melee (1d4 - 3); AC 13; HD 1d8+2; MV 30’; Act 1d20; SV Fort +2, Ref +1, Will -2; AL C.')
255+
const expected = {
256+
name: 'Bonus Guy',
257+
'data.attributes.init.value': '-1',
258+
'data.attributes.ac.value': '13',
259+
'data.attributes.hitDice.value': '1d8+2',
260+
'data.attributes.speed.value': '30’',
261+
'data.config.actionDice': '1d20',
262+
'data.saves.frt.value': '+2',
263+
'data.saves.ref.value': '+1',
264+
'data.saves.wil.value': '-2',
265+
'data.details.alignment': 'c',
266+
items: [
267+
{
268+
name: 'big club',
269+
type: 'weapon',
270+
data: {
271+
toHit: '+3',
272+
damage: '1d4+2',
273+
melee: true
274+
}
275+
},
276+
{
277+
name: 'small club',
278+
type: 'weapon',
279+
data: {
280+
toHit: '-2',
281+
damage: '1d4 - 3',
282+
melee: true
283+
}
284+
}
285+
]
286+
}
287+
expect(parsedNPC).toMatchObject(expected)
288+
})

module/__tests__/pc-parser.test.js

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,3 +1466,111 @@ Spells: (Spell Check: d20+5)
14661466
}
14671467
expect(parsedNPC).toMatchObject(expected)
14681468
})
1469+
1470+
/* Missing weapons test */
1471+
test('underarmed_warrior', () => {
1472+
const parsedNPC = parsePC(
1473+
`Generator Settings
1474+
Source: Rulebook | Roll Mode: 3d6 | HP: normal | HP-up: normal | Augur: normal
1475+
1476+
Lawful Warrior (1st level)
1477+
Occupation: Confidence artist
1478+
Strength: 13 (+1)
1479+
Agility: 11 (0)
1480+
Stamina: 15 (+1)
1481+
Personality: 14 (+1)
1482+
Intelligence: 9 (0)
1483+
Luck: 9 (0)
1484+
1485+
HP: 13; Speed: 30; Init: 1
1486+
Ref: 1; Fort: 2; Will: 1
1487+
1488+
Base Attack Mod: d3
1489+
Attack Dice: 1d20; Crit Die/Table: 1d12/III
1490+
Occupation Weapon: Dagger melee d3+1 (dmg 1d4+1+deed)
1491+
Main Weapon:
1492+
Secondary Weapon:
1493+
1494+
AC: (10) (Unarmored (+0) Check penalty (0) Fumble die (d4))
1495+
Equipment: Sack (large) (12 cp)
1496+
Trade good: Quality cloak
1497+
Starting Funds: 33 cp + 30 gp
1498+
Lucky sign: Righteous heart (Turn unholy checks) (+0)
1499+
Languages: Common
1500+
Warrior trait: Lucky weapon - choose one weapon that you apply your luck mod to`
1501+
)
1502+
const expected = {
1503+
'data.attributes.init.value': '1',
1504+
'data.attributes.speed.value': '30',
1505+
'data.details.occupation.value': 'Confidence artist',
1506+
'data.attributes.ac.value': '10',
1507+
'data.attributes.hp.value': '13',
1508+
'data.attributes.hp.max': '13',
1509+
'data.attributes.critical.die': '1d12',
1510+
'data.attributes.critical.table': 'III',
1511+
'data.abilities.str.value': '13',
1512+
'data.abilities.agl.value': '11',
1513+
'data.abilities.sta.value': '15',
1514+
'data.abilities.per.value': '14',
1515+
'data.abilities.int.value': '9',
1516+
'data.abilities.lck.value': '9',
1517+
'data.abilities.str.max': '13',
1518+
'data.abilities.agl.max': '11',
1519+
'data.abilities.sta.max': '15',
1520+
'data.abilities.per.max': '14',
1521+
'data.abilities.int.max': '9',
1522+
'data.abilities.lck.max': '9',
1523+
'data.class.className': 'Warrior',
1524+
'data.config.actionDice': '1d20',
1525+
'data.details.alignment': 'l',
1526+
'data.details.attackBonus': 'd3',
1527+
'data.details.birthAugur': 'Righteous heart (Turn unholy checks) (+0)',
1528+
'data.details.languages': 'Common',
1529+
'data.details.level.value': '1',
1530+
'data.saves.frt.value': '2',
1531+
'data.saves.ref.value': '1',
1532+
'data.saves.wil.value': '1',
1533+
items: [
1534+
{
1535+
name: 'Dagger',
1536+
type: 'weapon',
1537+
data: {
1538+
toHit: 'd3+1',
1539+
damage: '1d4+1+@ab',
1540+
melee: true
1541+
}
1542+
},
1543+
{
1544+
name: 'Unarmored',
1545+
type: 'armor',
1546+
data: {
1547+
acBonus: '+0',
1548+
checkPenalty: '0',
1549+
fumbleDie: '1d4'
1550+
}
1551+
},
1552+
{
1553+
name: 'Sack (large) (12 cp)',
1554+
type: 'equipment'
1555+
},
1556+
{
1557+
name: 'Quality cloak',
1558+
type: 'equipment'
1559+
},
1560+
{
1561+
name: 'Coins',
1562+
type: 'treasure',
1563+
data: {
1564+
value: {
1565+
pp: '0',
1566+
ep: '0',
1567+
gp: '30',
1568+
sp: '0',
1569+
cp: '33'
1570+
},
1571+
isCoins: true
1572+
}
1573+
}]
1574+
}
1575+
expect(parsedNPC).toMatchObject(expected)
1576+
})

0 commit comments

Comments
 (0)