def test_experimental(): print() i = Item(Changer(score=1, resource=Initiative), name='Paktol') j = Item(Changer(score=2, resource=Initiative), name='Swagtastic') c = Character(items=[i, j], init_rolls=[10 for _ in range(6)]) print('PRE DELETE', c, '\n') assert i in c.items and j in c.items c.delete_item(i) assert i not in c.items print('\nAFTER DELETE', c, '\n')
def test_ability_score_mediator(): print() Amun.awaken(items=[ Item(Changer(score=1, resource=ABILITY.STR), Changer(score=1, resource=ABILITY.STR), MaxSetter(score=1, resource=ABILITY.STR), Setter(score=666, resource=ABILITY.STR)) ], init_rolls=[10 for _ in range(6)]) from pprint import pprint for char in StorageGod.characters: pprint(Horus.view(char, ABILITY))
class Athlete(Feat): def __init__(self): super().__init__(*self.custom(), ) def custom(self) -> List[Component]: while (uin := input('STR or DEX? ')) not in ['STR', 'DEX']: pass return [Changer(score=1, resource=ABILITY.__members__[uin])]
class TavernBrawler(Feat): def __init__(self): super().__init__(*self.custom()) def custom(self) -> List[Component]: while (uin := input('STR, CON ?')) not in ['STR', 'CON']: pass return [Changer(score=1, resource=ABILITY.__members__[uin])]
class Observant(Feat): def __init__(self): super().__init__(*self.custom()) def custom(self) -> List[Component]: while (uin := input('INT or WIS? ')) not in ['INT', 'WIS']: pass return [Changer(score=1, resource=ABILITY.__members__[uin])]
class LightlyArmored(Feat): def __init__(self): super().__init__(*self.custom(), Proficiency(resource=ARMORTYPE.LIGHT)) def custom(self) -> List[Component]: while (uin := input('STR or DEX? ')) not in ['STR', 'DEX']: pass return [Changer(score=1, resource=ABILITY.__members__[uin])]
def test_view(): print() c = Azathoth.awaken('new', items=[Item(Changer(score=1, resource=ABILITY.STR))]) pprint(Azathoth.awaken('view', c, ABILITY.STR)) # pprint(Azathoth.awaken('view', c, Initiative)) # pprint(Azathoth.awaken('view', c, AC)) pprint(Azathoth.awaken('view', c, ABILITY))
class Resilient(Feat): def __init__(self): super().__init__(*self.custom()) def custom(self) -> List[Component]: while (uin := input(str(ABILITY.__members__.values()) + ' ?')) not in ABILITY.__members__.values(): pass return [Changer(score=1, resource=ABILITY.__members__[uin])]
def test_resources(resource): ch = Character(feats=[ Feat(Weight(60), Changer(score=5, resource=resource)), HeavyArmorMaster() ]) ch._initiative = 10 print('\n', ch.abilities[ABILITY.WIS], ch.initiative) print(ch.feats) for feat in ch.feats: for comp in feat.components: if isinstance(comp, Changer) and comp.resource is resource: if resource is Initiative: ch._initiative += comp.score assert ch.initiative == 15 print('\ncheck initiative') elif resource is ABILITY.WIS: ch.abilities[resource].score += comp.score assert ch.abilities[resource].score == 17 print('\ncheck ability score') else: assert False, 'check resource types' print('\n', ch.abilities[ABILITY.WIS], ch.initiative)
def __init__(self): super().__init__(Changer(score=1, resource=AC))
def __init__(self): super().__init__(Changer(score=5, resource=Initiative), )
def __init__(self): super().__init__( Changer(score=1, resource=ABILITY.CHA), Adv(resource=SKILL.DECEPTION), Adv(resource=SKILL.PERFORMANCE), )
def __init__(self): super().__init__(Changer(score=10, resource=Speed))
def __init__(self): super().__init__(Changer(score=1, resource=ABILITY.INT))
def __init__(self): super().__init__(Changer(score=1, resource=ABILITY.STR), prerequisite=Proficiency(resource=ARMORTYPE.HEAVY))
import pytest from character import Character, ABILITY from components.score_manipulator import Setter, MaxSetter, Changer from item import Item from overseer import AbilityOverseer @pytest.mark.parametrize( 'manipulator, score', [ # (Changer(score=10, resource=Ability(name=ABILITY.STR)), 25), # (Setter(score=10, resource=Ability(name=ABILITY.STR)), 10), # (MaxSetter(score=10, resource=Ability(name=ABILITY.STR)), 10) (Changer(score=10, resource=ABILITY.STR), 25), (Setter(score=10, resource=ABILITY.STR), 10), (MaxSetter(score=10, resource=ABILITY.STR), 10) ]) def test_score_manip(manipulator, score): ch = Character(items=[Item(manipulator)]) AbilityOverseer.calculate_ability_scores(ch) if isinstance(manipulator, MaxSetter): num = ch.abilities[ABILITY.STR].max else: num = ch.abilities[ABILITY.STR].score assert num == score