Support multiple ability checks
This commit is contained in:
parent
1ad7b2c502
commit
b992873072
@ -18,7 +18,7 @@ class Spell(typing.NamedTuple):
|
||||
name: str
|
||||
source: str
|
||||
description: str
|
||||
ability_check: typing.Optional[Ability]
|
||||
ability_check: typing.Set[Ability]
|
||||
# remaining: 'affectsCreatureType', 'alias', 'areaTags', 'basicRules2024', 'components', 'conditionImmune', 'conditionInflict', 'damageImmune', 'damageInflict', 'damageResist', 'damageVulnerable', 'duration', 'entriesHigherLevel', 'hasFluffImages', 'level', 'meta', 'miscTags', 'page', 'range', 'savingThrow', 'scalingLevelDice', 'school', 'spellAttack', 'srd52', 'time'
|
||||
|
||||
@classmethod
|
||||
@ -41,12 +41,10 @@ class Spell(typing.NamedTuple):
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def ability_check_from_json(cls, json_data) -> typing.Optional[Ability]:
|
||||
def ability_check_from_json(cls, json_data) -> typing.Set[Ability]:
|
||||
if "abilityCheck" not in json_data:
|
||||
return None
|
||||
elif len(json_data["abilityCheck"]) > 1:
|
||||
raise Exception(f"Unexpected abilityCheck length")
|
||||
return Ability(json_data["abilityCheck"][0])
|
||||
return set()
|
||||
return {Ability(c) for c in json_data["abilityCheck"]}
|
||||
|
||||
@classmethod
|
||||
def description_from_json(cls, json_data) -> str:
|
||||
|
Loading…
x
Reference in New Issue
Block a user