コード例 #1
0
        def upkeep_2 (self, game, owner, item):
            if item.exhausted ():
                return []

            def qualifies (investigator):
                if investigator.location () != owner.location ():
                    return False
                h = investigator.health (arkham.health_stamina)
                return h.cur () < h.max ()

            if not any (qualifies (investigator)
                        for investigator in game.investigators ()):
                return []

            def success_action (successes):
                return arkham.GameplayAction_WithSelectedInvestigator \
                    (qualifies,
                     "you or other investigator on the same location",
                     lambda investigator: \
                         arkham.GameplayAction_Heal \
                                (arkham.Heal ({arkham.health_stamina:
                                                   successes})))

            return [arkham.GameplayAction_Multiple \
                        ([arkham.GameplayAction_Exhaust (item),
                           arkham.GameplayAction_CauseHarm \
                               (game, owner, item,
                                arkham.HarmSanity (1)),
                           arkham.GameplayAction_WithNumberOfSuccesses \
                               (game, owner, item,
                                arkham.SkillCheck (arkham.checkbase_lore, +1),
                                success_action)])]
コード例 #2
0
        def combat_turn (self, combat, owner, monster, item):
            if item.exhausted ():
                return []

            match_weapon = arkham.match_proto (arkham.Weapon)
            if not any (match_weapon (item) for item in owner.wields_items ()):
                return []

            return \
                [arkham.GameplayAction_Multiple \
                     ([arkham.GameplayAction_Exhaust (item),
                       arkham.GameplayAction_CauseHarm \
                           (combat.game, owner, item,
                            arkham.HarmSanity (1)),
                       arkham.GameplayAction_Conditional \
                           (combat.game, owner, item,
                            arkham.SkillCheck (arkham.checkbase_lore, 0),
                            arkham.GameplayAction_WithSelectedItem \
                                (match_weapon, "weapon",
                                 lambda item: \
                                     arkham.GameplayAction_ForCombat \
                                        (combat,
                                         arkham.GameplayAction_Flag \
                                             (item, "enchanted"),
                                         arkham.GameplayAction_Unflag \
                                             (item, "enchanted"))))
                       ])]
コード例 #3
0
 def movement (self, game, owner, item):
     mp = owner.movement_points ()
     # We don't check whether the investigator can sustain
     # the harm before offering the action, because the
     # player may wish to perform that action nonetheless.
     # Besides the investigator can have a couple aces up
     # his sleeve, such as a card that reduces caused
     # damage by 1.  Checking accurately for that is not
     # worth the trouble.
     if mp != None and mp >= movement_points \
             and not item.exhausted ():
         """Exhaust and spend MOVEMENT_POINTS to make a
         CHECK. If you pass, do ACTION and discard Ancient
         Tome. If you fail, nothing happens."""
         return [
             arkham.GameplayAction_Multiple \
                 ([arkham.GameplayAction_Exhaust (item),
                   arkham.GameplayAction_SpendMovementPoints \
                       (movement_points),
                   arkham.GameplayAction_CauseHarm \
                       (game, owner, item, harm) if harm else None,
                   arkham.GameplayAction_Conditional \
                       (game, owner, item, check,
                        arkham.GameplayAction_Multiple \
                            ([success_action_ctor \
                                  (game, owner, item),
                              arkham.GameplayAction_Discard \
                                  (item)]),
                        fail_action_ctor (game, owner, item))])
             ]
     else:
         return []
コード例 #4
0
 def movement (self, game, owner, item):
     if owner.movement_points () != None and not item.exhausted ():
         # i.e. the movement is not over yet
         return [arkham.GameplayAction_Multiple \
                     ([arkham.GameplayAction_Exhaust (item),
                       arkham.GameplayAction_GainMovementPoints (1)])]
     else:
         return []
コード例 #5
0
    def do (game, investigator, subject, item,
            check_base, modifier, difficulty):
        """Any Phase: Cast and exhaust to pass an Evade check. The
        casting modifier is equal to the monster's Awareness."""

        return [arkham.GameplayAction_Multiple \
                    ([arkham.GameplayAction_Exhaust (item),
                      arkham.GameplayAction_Conditional \
                          (game, investigator, item,
                           arkham.SkillCheck (arkham.checkbase_lore, modifier),
                           arkham.GameplayAction_PassCheck ())])]
コード例 #6
0
    def do (game, owner, subject, item, damage):
        if item.exhausted ():
            return []

        if arkham.health_stamina not in damage.aspects ():
            return []

        return [arkham.GameplayAction_Multiple \
                    ([arkham.GameplayAction_Exhaust (item),
                       arkham.GameplayAction_CauseHarm \
                           (game, owner, item,
                            arkham.HarmSanity (1)),
                       arkham.GameplayAction_Conditional \
                           (game, owner, item,
                            arkham.SkillCheck (arkham.checkbase_lore, -2),
                            arkham.GameplayAction_CancelDamage \
                                (damage, arkham.health_stamina))])]
コード例 #7
0
        def gen_bonus_action (self, game, owner, item):
            if item.exhausted ():
                return []

            inst = arkham.Item (VoiceOfRa.Instance (self))
            if not owner.find_wield (game, inst, inst.hands ()):
                return []

            return [arkham.GameplayAction_Multiple \
                        ([arkham.GameplayAction_Exhaust (item),
                          arkham.GameplayAction_CauseHarm \
                              (game, owner, item,
                               arkham.HarmSanity (1)),
                          arkham.GameplayAction_Conditional \
                              (game, owner, item,
                               arkham.SkillCheck (arkham.checkbase_lore, -1),
                               arkham.GameplayAction_ForTurn \
                                   (arkham.GameplayAction_WieldItem \
                                        (inst, True),
                                    arkham.GameplayAction_Discard (inst)))])]
コード例 #8
0
            def combat_turn (self, combat, owner, monster, item):
                if item.exhausted ():
                    return []

                inst = arkham.Item (SimpleBonusSpell.Instance (self))
                if not owner.find_wield (combat.game, inst, inst.hands ()):
                    return []

                return [arkham.GameplayAction_Multiple \
                            ([arkham.GameplayAction_Exhaust (item),
                              arkham.GameplayAction_CauseHarm \
                                  (combat.game, owner, item,
                                   arkham.HarmSanity (sanity_cost)),
                              arkham.GameplayAction_Conditional \
                                  (combat.game, owner, item,
                                   arkham.SkillCheck (arkham.checkbase_lore,
                                                      lore_mod),
                                   action_ctor \
                                       (combat,
                                        arkham.GameplayAction_WieldItem \
                                            (inst, True),
                                        arkham.GameplayAction_Discard (inst)))])]
コード例 #9
0
ファイル: itsup.py プロジェクト: pmachata/unnamable
 def action (self, **kwargs):
     return arkham.GameplayAction_Exhaust (kwargs["item"])
コード例 #10
0
 def do (game, investigator, subject, item, checkbase, roll):
     return [arkham.GameplayAction_Multiple \
                 ([arkham.GameplayAction_Exhaust (item),
                   arkham.GameplayAction_Reroll \
                       (subject, checkbase, roll)])]
コード例 #11
0
        def combat_turn (self, combat, owner, monster, item):
            """Any Phase: Cast and exhaust to lower a monster's
            toughness by 1 (to a minimum of 1) and ignore one of its
            special abilities other than Magical Immunity until the
            end of this combat. """

            if item.exhausted ():
                return []

            a1 = r1 = a2 = r2 = None

            cc = monster.combat_check ()
            # xxx better solution: difficulty modifiers.  Make them
            # decorators.  Make everything that can be altered like
            # this the same way, based on some sort of decorator
            # object.  Action will be installation of a new decorator,
            # reaction will be removal of that same decorator.
            if fun.matchclass (arkham.SkillCheck) (cc) \
                    and cc.difficulty () > 1:
                a1 = arkham.GameplayAction_ReduceMonsterToughness \
                    (monster, 1, 1)
                r1 = arkham.GameplayAction_SetMonsterToughness \
                    (monster, cc.difficulty ())

            def build_candidates ():
                return list \
                    (ability
                     for ability, parameter \
                         in monster.special_abilities ().iteritems ()
                     if ability != arkham.monster_magical
                     or parameter != arkham.reslev_immunity)

            # xxx I believe this could be done the same way as above.
            # The decorator would filter out or include any abilities
            # that it wishes to.
            if len (build_candidates ()) > 0:
                class mem:
                    def set (self, content):
                        self._content = content
                    def get (self):
                        return self._content

                def build_action_ctor (m, action_ctor):
                    def ctor (candidate):
                        class Action (arkham.GameplayAction_One):
                            def __init__ (self, action):
                                arkham.GameplayAction_One.__init__ \
                                    (self, action, action.name ())

                            def perform (self, game, investigator):
                                m.set (candidate)
                                self.m_action.perform (game, investigator)
                        return Action (action_ctor (candidate))
                    return ctor

                class Reaction (arkham.GameplayAction):
                    def __init__ (self, name, ctor):
                        arkham.GameplayAction.__init__ (self, name)
                        self.m_ctor = ctor

                    def perform (self, game, investigator):
                        selected = m.get ()
                        self.m_ctor (selected).perform (game, investigator)

                m = mem ()

                a2 = arkham.GameplayAction_WithSelected \
                    (build_candidates,
                     "one of monster's special abilities " \
                         + "other than Magical Immunity",
                     build_action_ctor \
                         (m, lambda candidate:
                              arkham.GameplayAction_DropSpecialAbility \
                                (monster, candidate)),
                     arkham.MonsterSpecialAbility ("selected"))
                r2 = Reaction \
                    ("reintroduce once dropped special ability",
                     lambda selected:
                       arkham.GameplayAction_CancelSpecialAbilityCustomization \
                         (monster, selected))

            if a1 == None and a2 == None:
                return []

            return [
                arkham.GameplayAction_Multiple \
                    ([arkham.GameplayAction_Exhaust (item),
                      arkham.GameplayAction_CauseHarm \
                          (combat.game, owner, item, arkham.HarmSanity (1)),
                      arkham.GameplayAction_Conditional \
                          (combat.game, owner, item,
                           arkham.SkillCheck (arkham.checkbase_lore, -1),
                           arkham.GameplayAction_ForCombat \
                               (combat,
                                arkham.GameplayAction_Multiple ([a1, a2]),
                                arkham.GameplayAction_Multiple ([r1, r2])))])]