コード例 #1
0
 def v_subs(cls, v):
     if v is None:
         return v
     if len(v) > 3:
         raise TypeError('Sub-abilities array has more than 3 items.')
     # if (non-None appears after None):
     #     raise TypeError('Unlocked sub-abilities appear after locked ones.')
     for sub in v:
         if sub is not None:
             if not (ability := get_object_by_id('abilities', sub)):
                 raise InvalidID(obj='abilities', id=sub)
             if exclusive := ability.get('exclusive'):
                 raise TypeError(f'Ability is exclusive. ({exclusive})')
コード例 #2
0
 def v_weapon(cls, v):
     if v is None:
         return v
     if not get_object_by_id('weapons', v['class'], v['id']):
         raise InvalidID(obj='weapons',
                         id=f"{v['id']} and class ID: {v['class']}")
     return v
コード例 #3
0
 def v_id(cls, v):
     if v is None:
         return v
     if not get_object_by_id('shoes', v):
         raise InvalidID(obj='shoes', id=v)
     return v
コード例 #4
0
 def v_main(cls, v):
     if v is None:
         return v
     if not (ability := get_object_by_id('abilities', v)):
         raise InvalidID(obj='abilities', id=v)