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) class Test2 (Test1): 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) tester.run_test (test_ah.Game (Test1 ())) tester.run_test (test_ah.Game (Test2 ()))
class Test(tester.Controller): def __init__(self, proto, aspect): tester.Controller.__init__(self) self.aspect = aspect self.module = proto() def setup_players(self, game): self.inv, = self.use_investigators(game, ["\"Ashcan\" Pete"]) def add_modules(self, idx): idx.add_module(self.module) 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) tester.run_test(test_ah.Game(Test(ModuleProto1, arkham.health_stamina))) tester.run_test(test_ah.Game(Test(ModuleProto2, arkham.health_sanity))) tester.run_test(test_ah.Game(Test(ModuleProto3, arkham.health_stamina))) tester.run_test(test_ah.Game(Test(ModuleProto4, arkham.health_stamina))) tester.run_test(test_ah.Game(Test(ModuleProto5, arkham.health_stamina)))
item = game.deck (self.__class__.item_deck)\ .draw (lambda arg: arg.name () == self.__class__.item_name) inv.take_item(game, item) assert inv.wield_item(game, item) class MyMonster(arkham.MonsterProto): def __init__(self): arkham.MonsterProto.__init__(self, "MyMonster") def horror_check(self): return arkham.pass_check for i in range(5): game.add_monster(arkham.Monster(MyMonster()), inv.location()) @classmethod 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) if __name__ == "__main__": tester.run_test(test_ah.Game(Test(ModuleProto1))) tester.run_test(test_ah.Game(Test(ModuleProto2))) tester.run_test(test_ah.Game(Test(ModuleProto3)))
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) return t if __name__ == "__main__": tester.run_test(test_ah.Game(Test(test_item("Old Journal", test1)))) tester.run_test(test_ah.Game(Test(test_item("Ancient Tome", test2)))) tester.run_test( test_ah.Game( Test(test_item("Alien Statue", test3, mod_unique.UniqueDeck)))) tester.run_test( test_ah.Game( Test(test_item("Ancient Tablet", test4, mod_unique.UniqueDeck)))) tester.run_test( test_ah.Game( Test(test_item("Cabala of Saboth", test5, mod_unique.UniqueDeck)))) tester.run_test( test_ah.Game( Test(test_item("Cultes des Goules", test6, mod_unique.UniqueDeck)))) tester.run_test(
import mod_common import mod_unique from test_ah_items import * 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) if __name__ == "__main__": tester.run_test( test_ah.Game( Test(test_item("Book of Dzyan", test1, mod_unique.UniqueDeck))))
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) return t 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) if __name__ == "__main__": tester.run_test (test_ah.Game (Test (test_weapon ("Dynamite", test1)))) tester.run_test (test_ah.Game (Test (test_weapon ("Powder of Ibn-Ghazi", test2, mod_unique.UniqueDeck)))) tester.run_test (test_ah.Game (Test (test_weapon ("Silver Key", test3, mod_unique.UniqueDeck)))) tester.run_test (test_ah.Game (Test (test_weapon ("Warding Statue", test4, mod_unique.UniqueDeck)))) tester.run_test (test_ah.Game (Test (test_weapon ("Dread Curse of Azathoth", test5 (-2, +9), mod_spell.SpellDeck)))) tester.run_test (test_ah.Game (Test (test_weapon ("Bind Monster", test6 (1), mod_spell.SpellDeck, toughness=1)))) tester.run_test (test_ah.Game (Test (test_weapon ("Bind Monster", test6 (2), mod_spell.SpellDeck, toughness=2)))) tester.run_test (test_ah.Game (Test (test_weapon ("Bind Monster", test6 (3), mod_spell.SpellDeck, toughness=3)))) tester.run_test (test_ah.Game (Test (test_weapons (test7, [("Enchant Weapon", mod_spell.SpellDeck), (".18 Derringer", mod_common.CommonDeck)], {arkham.monster_physical: arkham.reslev_immunity})))) tester.run_test (test_ah.Game (Test (test_weapon ("Mists of Releh", test8 (-1), mod_spell.SpellDeck, awareness=-1)))) tester.run_test (test_ah.Game (Test (test_weapon ("Mists of Releh", test8 (+1), mod_spell.SpellDeck, awareness=+1)))) # Test nighmarish/overwhelming. tester.run_test (test_ah.Game (Test (test_weapon (".18 Derringer", test9 (1), mod_common.CommonDeck,