Пример #1
0
 def t (test):
     for y in fight_and_horror_check (5, 5, 5): yield y # +1 horror
     yield fun.matchclass (arkham.GameplayAction_Fight)
     yield fun.matchclass (arkham.GameplayAction_NormalCheckHook)
     for y in [5] * (5 + (3 if undead else 0)): yield y
     yield fun.matchclass (arkham.GameplayAction_Stay)
     raise tester.EndTest (True)
Пример #2
0
def test3 (test):
    yield fun.matchclass (arkham.GameplayAction_Stay)
    yield fun.matchclass (arkham.GameplayAction_DealWithMonster)
    yield fun.matchclass (arkham.GameplayAction_Evade)
    yield fun.matchclass (arkham.GameplayAction_Multiple)
    yield fun.matchclass (arkham.GameplayAction_Stay)
    raise tester.EndTest (True)
Пример #3
0
def test17 (test):
    for y in fight_and_horror_check (5, 5): yield y
    yield fun.matchclass (arkham.GameplayAction_Fight)
    yield fun.matchclass (arkham.GameplayAction_NormalCheckHook)
    for y in 1,1,1,1,1,1,1,1,6: yield y
    yield fun.matchclass (arkham.GameplayAction_Stay)
    raise tester.EndTest (True)
Пример #4
0
 def t(test):
     h = test.inv.health (arkham.health_sanity)
     hv = h.cur ()
     for y in fight_and_horror_check (5, 5): yield y
     assert h.cur () == hv - n
     yield fun.matchclass (arkham.GameplayAction_Fight)
     raise tester.EndTest (True)
Пример #5
0
def test3(test, name):
    # turn 1
    yield fun.and_(action_bound_item_named(name),
                   fun.matchclass(arkham.GameplayAction_Multiple))
    sanity = test.inv.health(arkham.health_sanity).cur()
    stamina = test.inv.health(arkham.health_stamina).cur()
    yield fun.matchclass(arkham.GameplayAction_IncurDamage)
    assert test.inv.health(arkham.health_sanity).cur() == sanity - 1
    yield fun.matchclass(arkham.GameplayAction_NormalCheckHook)
    yield 1  # failure
    sanity = test.inv.health(arkham.health_sanity).cur()
    yield fun.matchclass(arkham.GameplayAction_IncurDamage)
    assert test.inv.health(arkham.health_stamina).cur() == stamina - 2
    test.inv.health(arkham.health_sanity).add(4)
    yield fun.matchclass(arkham.GameplayAction_Stay)

    # turn 2
    yield fun.and_(action_bound_item_named(name),
                   fun.matchclass(arkham.GameplayAction_Multiple))
    sanity = test.inv.health(arkham.health_sanity).cur()
    yield fun.matchclass(arkham.GameplayAction_IncurDamage)
    assert test.inv.health(arkham.health_sanity).cur() == sanity - 1
    yield fun.matchclass(arkham.GameplayAction_NormalCheckHook)
    yield 5  # success
    clues = test.inv.clues()
    yield lambda arg: "gain" in arg.name() and "clues" in arg.name()
    assert test.inv.clues() == clues + 3
    raise tester.EndTest(True)
Пример #6
0
def test11(test, name):
    yield fun.and_(action_bound_item_named(name),
                   fun.matchclass(arkham.GameplayAction_Multiple))
    clues = test.inv.clues()
    yield fun.matchclass(arkham.GameplayAction_NormalCheckHook)
    yield 5
    assert test.inv.clues() == clues + 4
    raise tester.EndTest(True)
Пример #7
0
 def actions(cls, test):
     yield fun.matchclass(arkham.GameplayAction_Stay)
     yield fun.take_first()
     yield fun.matchclass(arkham.GameplayAction_Fight)
     yield fun.matchclass(arkham.GameplayAction_Multiple)
     yield fun.matchclass(arkham.GameplayAction_IncurDamage)
     assert len(test.inv.trophies()) == 5
     raise tester.EndTest(True)
Пример #8
0
def test5(test, name):
    items1 = set(item.proto() for item in test.inv.m_items)
    yield fun.and_(action_bound_item_named(name),
                   fun.matchclass(arkham.GameplayAction_Multiple))
    yield fun.matchclass(arkham.GameplayAction_NormalCheckHook)
    yield 5
    items2 = set(item.proto() for item in test.inv.m_items)
    discard_gain_new(items1, items2)
    raise tester.EndTest(True)
Пример #9
0
def test12 (test):
    trophies = len (test.inv.trophies ())
    for y in fight_and_horror_check (5, 5): yield y
    yield fun.matchclass (arkham.GameplayAction_Fight)
    yield fun.matchclass (arkham.GameplayAction_NormalCheckHook) # combat check
    for i in 5, 5, 5, 5, 5, 5, 5: yield i
    assert trophies == len (test.inv.trophies ())
    yield fun.matchclass (arkham.GameplayAction_Stay)
    raise tester.EndTest (True)
Пример #10
0
 def test (test):
     for y in fight_and_horror_check (5, 5): yield y
     for y in cast_spell (True, *[5 if i < combat_successes else 1
                            for i in range (7)]):
         yield y
     yield fun.matchclass (arkham.GameplayAction_Stay)
     assert len (test.inv.m_temporary_items) == 0 # check the spell didn't get stuck
     assert len (test.inv.m_active_items) == 0 # check the spell was discarded
     assert len (test.inv.m_items) == 0 # check the spell was discarded
     raise tester.EndTest (True)
Пример #11
0
 def actions(cls, test):
     yield fun.matchclass(arkham.GameplayAction_Stay)
     yield fun.matchclass(arkham.GameplayAction_DealWithMonster)
     yield fun.matchclass(arkham.GameplayAction_Fight)
     trophies = len(test.inv.trophies())
     yield fun.if_else(action_bound_item_named(cls.item_name),
                       fun.matchclass(arkham.GameplayAction_Multiple))
     yield fun.matchclass(arkham.GameplayAction_IncurDamage)
     assert len(test.inv.trophies()) == trophies + 1
     raise tester.EndTest(True)
Пример #12
0
 def t(test):
     h = test.inv.health (arkham.health_stamina)
     hv = h.cur ()
     for y in fight_and_horror_check (5, 5): yield y
     yield fun.matchclass (arkham.GameplayAction_Fight)
     yield fun.matchclass (arkham.GameplayAction_NormalCheckHook) # combat check
     for y in 1, 1, 1, 1, 1, 5, 5: yield y # pass combat check
     assert h.cur () == hv - n
     yield fun.matchclass (arkham.GameplayAction_Stay)
     raise tester.EndTest (True)
Пример #13
0
 def t (test):
     yield fun.matchclass (arkham.GameplayAction_Stay)
     yield fun.matchclass (arkham.GameplayAction_DealWithMonster)
     yield fun.matchclass (arkham.GameplayAction_Evade)
     yield lambda action: (" lore(%+d) " % awareness) in action.name ()
     yield fun.matchclass (arkham.GameplayAction_NormalCheckHook) # lore check
     for i in range (3 + awareness):
         yield 5
     yield fun.matchclass (arkham.GameplayAction_Stay)
     raise tester.EndTest (True)
Пример #14
0
 def t(test, name):
     h = test.inv.health(arkham.health_stamina)
     h.reduce(5)
     hv = h.cur()
     yield fun.matchclass(arkham.GameplayAction_Stay)  # wait for next round
     for y in cast_spell(True, *list(5 if i < n else 1 for i in range(4))):
         yield y
     yield lambda action: " %d " % n in action.name()
     assert h.cur() == hv + n
     yield fun.matchclass(arkham.GameplayAction_Stay)
     raise tester.EndTest(True)
Пример #15
0
 def actions(self):
     x = self.module.heal_action_times()
     y = self.module.expected_increment(x)
     h = self.inv.health(self.aspect).cur()
     for i in range(x):
         for action in self.module.actions():
             yield action
     if y != _damage:
         yield fun.matchclass(arkham.GameplayAction_IncurDamage)
     assert self.inv.health(self.aspect).cur() == h - _damage + y
     raise tester.EndTest(True)
Пример #16
0
def test4 (test):
    for y in fight_and_horror_check (5, 5): yield y
    yield fun.matchclass (arkham.GameplayAction_Fight)
    yield fun.matchclass (arkham.GameplayAction_NormalCheckHook)
    for i in xrange (5): yield 1 # fail combat hook
    yield fun.matchclass (arkham.GameplayAction_FailRoll)
    stamina = test.inv.health (arkham.health_stamina).cur ()
    yield fun.matchclass (arkham.GameplayAction_Multiple) # cancel stamina, discard
    assert stamina == test.inv.health (arkham.health_stamina).cur ()
    yield fun.matchclass (arkham.GameplayAction_Fight)
    raise tester.EndTest (True)
Пример #17
0
 def actions (self):
     self.inv.health (arkham.health_sanity).reduce (3)
     yield fun.matchclass (arkham.GameplayAction_Stay)
     yield fun.matchclass (arkham.GameplayAction_DealWithMonster)
     yield fun.matchclass (arkham.GameplayAction_Fight)
     yield fun.matchclass (arkham.GameplayAction_NormalCheckHook)
     for roll in 1,: yield roll # fail horror check
     yield fun.matchclass (arkham.GameplayAction_FailRoll)
     yield fun.matchclass (arkham.GameplayAction_IncurDamage)
     yield fun.matchclass (mod_ah.GameplayAction_Incapacitated)
     assert self.inv.location ().attributes ().flag ("asylum")
     raise tester.EndTest (True)
Пример #18
0
 def actions(self):
     yield fun.matchclass(arkham.GameplayAction_Stay)
     yield fun.matchclass(arkham.GameplayAction_DealWithMonster)
     yield fun.matchclass(arkham.GameplayAction_Fight)
     yield fun.matchclass(arkham.GameplayAction_NormalCheckHook)
     yield 5  # pass horror check
     yield fun.matchclass(arkham.GameplayAction_Fight)
     yield fun.matchclass(arkham.GameplayAction_NormalCheckHook)
     for die in roll:
         yield die
     yield fun.matchclass(arkham.GameplayAction_Stay)
     raise tester.EndTest(True)
Пример #19
0
def test15 (test):
    for y in fight_and_horror_check (5, 5): yield y
    yield fun.matchclass (arkham.GameplayAction_Fight)
    yield fun.matchclass (arkham.GameplayAction_NormalCheckHook)
    for y in 1,1,1,1,1,1: yield y
    yield lambda action: "reroll" in action.name ()
    for y in 1,1,1,1,1,1: yield y
    # now only "spend clue token" matches this, meaning that "exhaust
    # & reroll" option is gone.
    yield fun.matchclass (arkham.GameplayAction_Multiple)
    yield 5
    yield fun.matchclass (arkham.GameplayAction_Stay)
    raise tester.EndTest (True)
Пример #20
0
def test1 (test):
    for y in fight_and_horror_check (5, 5): yield y
    yield fun.matchclass (arkham.GameplayAction_Fight)
    yield fun.matchclass (arkham.GameplayAction_NormalCheckHook)
    for i in xrange (13): yield 1 # fail combat hook
    yield fun.matchclass (arkham.GameplayAction_FailRoll)
    yield fun.matchclass (arkham.GameplayAction_EndCauseHarmLoop)
    yield fun.matchclass (arkham.GameplayAction_IncurDamage)
    yield fun.matchclass (arkham.GameplayAction_Fight)
    yield fun.matchclass (arkham.GameplayAction_NormalCheckHook)
    for i in xrange (5): yield 5 # pass combat hook, this time with fewer die
    yield fun.matchclass (arkham.GameplayAction_Stay)
    raise tester.EndTest (True)
Пример #21
0
def test4(test, name):
    items1 = set(item.proto() for item in test.inv.m_items)
    yield fun.and_(action_bound_item_named(name),
                   fun.matchclass(arkham.GameplayAction_Multiple))
    clues = test.inv.clues()
    yield fun.matchclass(arkham.GameplayAction_NormalCheckHook)
    yield 1  # failure
    assert test.inv.clues() == clues + 2
    yield fun.matchclass(arkham.GameplayAction_NormalCheckHook)
    yield 5  # pass
    items2 = set(item.proto() for item in test.inv.m_items)
    discard_gain_new(items1, items2)
    raise tester.EndTest(True)
Пример #22
0
 def actions(cls, test):
     yield fun.matchclass(arkham.GameplayAction_Stay)
     yield fun.matchclass(arkham.GameplayAction_DealWithMonster)
     yield fun.matchclass(arkham.GameplayAction_Fight)
     yield fun.matchclass(arkham.GameplayAction_Fight)
     yield fun.matchclass(arkham.GameplayAction_NormalCheckHook)
     for die in 1, 1, 1, 1, 1:
         yield die
     trophies = len(test.inv.trophies())
     yield action_bound_item_named(cls.item_name)
     yield fun.matchclass(
         arkham.GameplayAction_IncurDamage)  # use costs -2 sanity
     assert len(test.inv.trophies()) == trophies + 1
     raise tester.EndTest(True)
Пример #23
0
def test14 (test):
    for y in cast_spell (True, 5, 5): yield y
    for y in fight_and_horror_check (5, 5, 5): yield y # note: +1 in effect
    yield fun.matchclass (arkham.GameplayAction_Evade)
    yield fun.matchclass (arkham.GameplayAction_NormalCheckHook) # evade check
    # evade check: 3 base, +1 monster, +1 Voice of Ra
    for y in 5, 5, 5, 5, 5: yield y
    for y in fight_and_horror_check (5, 5): yield y # note: +1 not in effect anymore
    yield fun.matchclass (arkham.GameplayAction_Evade)
    yield fun.matchclass (arkham.GameplayAction_NormalCheckHook) # evade check
    # evade check: 3 base, +1 monster
    for y in 5, 5, 5, 5: yield y
    yield fun.matchclass (arkham.GameplayAction_Stay)
    raise tester.EndTest (True)
Пример #24
0
 def t (test):
     for y in fight_and_horror_check (5, 5): yield y
     for y in cast_spell (damage, *list (5 for i in xrange (3 + lore_mod))): yield y
     yield fun.matchclass (arkham.GameplayAction_Fight)
     yield fun.matchclass (arkham.GameplayAction_NormalCheckHook) # combat check
     for i in xrange (5 + combat_mod): yield 1 # fail combat hook
     yield fun.matchclass (arkham.GameplayAction_FailRoll)
     yield fun.matchclass (arkham.GameplayAction_EndCauseHarmLoop)
     yield fun.matchclass (arkham.GameplayAction_IncurDamage) # monster hit
     yield fun.matchclass (arkham.GameplayAction_Fight)
     yield fun.matchclass (arkham.GameplayAction_NormalCheckHook) # combat check
     for i in xrange (5 + combat_mod): yield 5 # check we still have the bonus
     yield fun.matchclass (arkham.GameplayAction_Stay)
     assert len (test.inv.m_temporary_items) == 0 # check the spell didn't get stuck
     raise tester.EndTest (True)
Пример #25
0
def test7 (test):
    for y in fight_and_horror_check (5, 5): yield y
    yield fun.matchclass (arkham.GameplayAction_Fight)
    yield fun.matchclass (arkham.GameplayAction_NormalCheckHook) # combat check
    for y in 1, 1, 1, 1, 1: yield y # fail first roll with five die
    yield fun.matchclass (arkham.GameplayAction_FailRoll)
    yield fun.matchclass (arkham.GameplayAction_EndCauseHarmLoop)
    yield fun.matchclass (arkham.GameplayAction_IncurDamage) # monster hit
    for y in cast_spell (True, 5, 5, 5): yield y
    yield fun.matchclass (arkham.GameplayAction_ForCombat)
    yield fun.matchclass (arkham.GameplayAction_Fight)
    yield fun.matchclass (arkham.GameplayAction_NormalCheckHook) # combat check
    for y in 1, 1, 1, 1, 1, 5, 5: yield y # pass second roll with seven die
    yield fun.matchclass (arkham.GameplayAction_Stay)
    raise tester.EndTest (True)
Пример #26
0
 def actions (self):
     yield fun.matchclass (arkham.GameplayAction_Stay)
     yield fun.matchclass (arkham.GameplayAction_DealWithMonster)
     yield fun.matchclass (arkham.GameplayAction_Fight)
     yield fun.matchclass (arkham.GameplayAction_NormalCheckHook)
     for roll in 5,: yield roll # pass horror check
     for i in 1,2:
         yield fun.matchclass (arkham.GameplayAction_Fight)
         yield fun.matchclass (arkham.GameplayAction_NormalCheckHook)
         for roll in 1,1,1: yield roll
         yield fun.matchclass (arkham.GameplayAction_FailRoll)
         yield fun.matchclass (arkham.GameplayAction_EndCauseHarmLoop)
         yield fun.matchclass (arkham.GameplayAction_IncurDamage)
     yield fun.matchclass (mod_ah.GameplayAction_Incapacitated)
     assert self.inv.location ().attributes ().flag ("hospital")
     raise tester.EndTest (True)
Пример #27
0
def test11 (n):
    """ Check that ambush monster presents an option to evade before
    the combat begins, but not in the middle of the combat. """
    yield fun.matchclass (arkham.GameplayAction_Stay)
    yield fun.matchclass (arkham.GameplayAction_DealWithMonster)
    e1 = look_for_action (fun.matchclass (arkham.GameplayAction_Evade),
                          fun.matchclass (arkham.GameplayAction_Fight))
    yield e1
    assert e1.seen == 1
    yield fun.matchclass (arkham.GameplayAction_NormalCheckHook)
    for i in 5, 5: yield i

    e2 = look_for_action (fun.matchclass (arkham.GameplayAction_Evade),
                          fun.matchclass (arkham.GameplayAction_Fight))
    yield e2
    assert e2.seen == 0
    yield fun.matchclass (arkham.GameplayAction_NormalCheckHook) # combat check
    raise tester.EndTest (True)
Пример #28
0
def test13 (test):
    trophies = len (test.inv.trophies ())
    for y in fight_and_horror_check (5, 5): yield y
    for y in cast_spell (True, 5, 5): yield y
    e1 = look_for_action (lambda action: True,
                          lambda action: "endless" in action.name ())
    yield e1
    assert e1.seen == 2 # we expect two matches, not three,
                        # because magical immunity has to be
                        # ignored
    yield fun.matchclass (arkham.GameplayAction_Fight)
    yield fun.matchclass (arkham.GameplayAction_NormalCheckHook) # combat check
    for i in 5, 1, 1, 1, 1, : yield i # check that one success is
                                      # enough even for toughness 2
                                      # monster
    assert len (test.inv.trophies ()) == trophies + 1
    yield fun.matchclass (arkham.GameplayAction_Stay)
    raise tester.EndTest (True)
Пример #29
0
def test1(test, name):
    yield fun.and_(action_bound_item_named(name),
                   fun.matchclass(arkham.GameplayAction_Multiple))
    yield fun.matchclass(arkham.GameplayAction_NormalCheckHook)
    for die in 5, 5:
        yield die
    yield fun.matchclass(arkham.GameplayAction_IncurDamage)
    yield fun.matchclass(arkham.GameplayAction_Stay)
    yield fun.and_(action_bound_item_named(name),
                   fun.matchclass(arkham.GameplayAction_Multiple))
    yield fun.matchclass(arkham.GameplayAction_NormalCheckHook)
    for die in 5, 5:
        yield die
    yield fun.matchclass(arkham.GameplayAction_IncurDamage)
    yield fun.matchclass(arkham.GameplayAction_Stay)
    # check the item got dropped after two uses
    for item in test.inv.wields_items():
        assert item.name() != name
    raise tester.EndTest(True)
Пример #30
0
def test7(test, name):
    h = []
    for aspect in arkham.health_sanity, arkham.health_stamina:
        health = test.inv.health(aspect)
        health.reduce(1)
        h.append(health.cur())

    yield fun.matchclass(arkham.GameplayAction_Stay)
    yield lambda arg: arg.name().find("sanity") >= 0
    assert test.inv.health(arkham.health_sanity).cur() == h[0] + 1

    yield fun.matchclass(arkham.GameplayAction_Stay)

    # Use matchclass now to make sure that we have only one available
    # match: to heal stamina.
    yield lambda arg: "stamina" in arg.name()
    assert test.inv.health(arkham.health_stamina).cur() == h[1] + 1

    yield fun.matchclass(arkham.GameplayAction_Stay)
    raise tester.EndTest(True)