Exemplo n.º 1
0
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')
Exemplo n.º 2
0
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))
Exemplo n.º 3
0
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])]
Exemplo n.º 4
0
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])]
Exemplo n.º 5
0
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])]
Exemplo n.º 6
0
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])]
Exemplo n.º 7
0
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))
Exemplo n.º 8
0
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])]
Exemplo n.º 9
0
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)
Exemplo n.º 10
0
 def __init__(self):
     super().__init__(Changer(score=1, resource=AC))
Exemplo n.º 11
0
 def __init__(self):
     super().__init__(Changer(score=5, resource=Initiative), )
Exemplo n.º 12
0
 def __init__(self):
     super().__init__(
         Changer(score=1, resource=ABILITY.CHA),
         Adv(resource=SKILL.DECEPTION),
         Adv(resource=SKILL.PERFORMANCE),
     )
Exemplo n.º 13
0
 def __init__(self):
     super().__init__(Changer(score=10, resource=Speed))
Exemplo n.º 14
0
 def __init__(self):
     super().__init__(Changer(score=1, resource=ABILITY.INT))
Exemplo n.º 15
0
 def __init__(self):
     super().__init__(Changer(score=1, resource=ABILITY.STR),
                      prerequisite=Proficiency(resource=ARMORTYPE.HEAVY))
Exemplo n.º 16
0
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