Support multiple ability checks
This commit is contained in:
parent
1ad7b2c502
commit
b992873072
@ -18,7 +18,7 @@ class Spell(typing.NamedTuple):
|
|||||||
name: str
|
name: str
|
||||||
source: str
|
source: str
|
||||||
description: 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'
|
# 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
|
@classmethod
|
||||||
@ -41,12 +41,10 @@ class Spell(typing.NamedTuple):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@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:
|
if "abilityCheck" not in json_data:
|
||||||
return None
|
return set()
|
||||||
elif len(json_data["abilityCheck"]) > 1:
|
return {Ability(c) for c in json_data["abilityCheck"]}
|
||||||
raise Exception(f"Unexpected abilityCheck length")
|
|
||||||
return Ability(json_data["abilityCheck"][0])
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def description_from_json(cls, json_data) -> str:
|
def description_from_json(cls, json_data) -> str:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user