コード例 #1
0
 def __init__(self, use):
     interaction.Interaction.__init__(self)
     self.use = use  # function
     self.mysteryWords = fList.FrequencyList([["a mysterious", 0.2],
                                              ["a strange", 0.2],
                                              ["an odd", 0.2],
                                              ["a peculiar", 0.2],
                                              ["an eerie", 0.2]])
     self.shrineAdjectives = fList.FrequencyList([["pyramidal", 0.1],
                                                  ["gray", 0.1],
                                                  ["broken", 0.1],
                                                  ["cracked", 0.1],
                                                  ["sunken", 0.1],
                                                  ["stone", 0.1],
                                                  ["chiseled", 0.1],
                                                  ["opulent", 0.1],
                                                  ["short", 0.1],
                                                  ["tall", 0.1]])
     self.shrineNouns = fList.FrequencyList([["pillar", 0.2],
                                             ["obelisk", 0.2],
                                             ["monolith", 0.2],
                                             ["shrine", 0.2],
                                             ["altar", 0.2]])
     self.nearWords = fList.FrequencyList([["a copse of dead trees", 0.2],
                                           ["a small hill", 0.2],
                                           ["a small cave", 0.2],
                                           ["a murky pond", 0.2],
                                           ["a faded signpost", 0.2]])
コード例 #2
0
def getDampLair():
    monsters = fList.FrequencyList([[AricneaTheSly(), 1]])

    def enter():
        sequel = ""
        if monsters[0].canRespawn():  # if Aricnea is alive...
            sequel = "A faint light glows in distance. A huge skeleton turns to face you."
        else:  # if Aricnea is dead...
            sequel = "Aricnea's bones lie untouched, scattered across the floor."
        output.proclaim(
            "Damp Lair: Cave moss grows on the arched ceiling of the cavern. "
            + sequel)

    def exit():
        output.proclaim("You have left Damp Lair.")

    def getMonster():
        return monsters.getOption(
            condition=lambda monster: monster.canRespawn())

    skeletonCaveActions = [actions.RestHeal(player)]
    skeletonCaveInteractions = [
        [fight.Fight(getMonster), 1],
    ]
    return location.Location("Damp Lair", enter, exit, skeletonCaveActions,
                             skeletonCaveInteractions)
コード例 #3
0
def getTheSilentForest():
    def enter():
        output.proclaim(
            "The Silent Forest: Great oaks sway endlessly to the southerly winds. The air's oppression is lifted but briefly at the occasional rustle. Trees obscure the view to Trainee Valley."
        )

    def exit():
        output.proclaim("You have left the Silent Forest.")

    monsters = fList.FrequencyList([[ProwlingFox(), 0.4], [Owl(), 0.35],
                                    [SorcererOutcast(), 0.2],
                                    [SkeletonScout(), 0.04],
                                    [DoomPanda(), 0.01]])

    def getMonster():
        return monsters.getOption(
            condition=lambda monster: monster.canRespawn())

    theSilentForestActions = [
        actions.RestHeal(player),
        actions.Scavenge(
            player,
            [
                [actions.ScavengeGold(player, 0, 4), 0.99],
                # health, armor, strength, spirit, criticalChance, criticalStrike, dodge
                [shrine.StatShrine([20, 10, 10, 10, 0.1, 1, 0.2], 50), 0.01]
            ])
    ]
    theSilentForestInteractions = [[actions.Nothing(), 0.8],
                                   [fight.Fight(getMonster), 0.2]]
    return location.Location("The Silent Forest", enter, exit,
                             theSilentForestActions,
                             theSilentForestInteractions)
コード例 #4
0
def getTraineeValley():
    def enter():
        output.proclaim(
            "Trainee Valley: Sparse trees occupy rolling expanses of lush grass. Fort Morning is barely visible in the distant north, while the Silent Forest looms to the east."
        )

    def exit():
        output.proclaim("You have left Trainee Valley.")

    monsters = fList.FrequencyList([[Wolf(), 0.8], [DrunkenTrainee(), 0.2],
                                    [GraglisTheGremlin(), 0.008]])

    def getMonster():
        return monsters.getOption(
            condition=lambda monster: monster.canRespawn())

    traineeValleyActions = [
        actions.RestHeal(player),
        actions.Scavenge(
            player,
            [
                [actions.ScavengeGold(player, 0, 2), 0.98],
                # health, armor, strength, spirit, criticalChance, criticalStrike, dodge
                [shrine.StatShrine([20, 10, 10, 10, 0.1, 1, 0.2], 50), 0.02]
            ]),
        actions.Talk(player, [oldHermit])
    ]
    traineeValleyInteractions = [[actions.Nothing(), 0.8],
                                 [fight.Fight(getMonster), 0.2]]
    return location.Location("Trainee Valley", enter, exit,
                             traineeValleyActions, traineeValleyInteractions)
コード例 #5
0
def getFortMorning():
    def enter():
        output.proclaim(
            "Fort Morning: Rough cobblestones pattern the streets of Fort Morning. The din of the market carries loudly to the Southern gate, whose wall protrudes ten feet from the earth below. Merchants frequent the fort, but the eastern wizards rarely visit."
        )

    def exit():
        output.proclaim("You have left the Fort Morning.")

    monsters = fList.FrequencyList([[GiantSewerRat(), 0.8],
                                    [UnholyOoze(), 0.2]])

    def getMonster():
        return monsters.getOption(
            condition=lambda monster: monster.canRespawn())

    fortMorningActions = [
        actions.RestHeal(player),
        actions.Scavenge(player, [[actions.ScavengeGold(player, 0, 3), 1]]),
        actions.Talk(player, [captainJorna]),
        actions.Shop(player, [morningWares, villageArmory])
    ]
    fortMorningInteractions = [[actions.Nothing(), 0.93],
                               [fight.Fight(getMonster), 0.07]]
    return location.Location("Fort Morning", enter, exit, fortMorningActions,
                             fortMorningInteractions)
コード例 #6
0
 def __init__(self, name, enter, leave, actions, interactions):
     self.name = name
     self.enter = enter  # function
     self.leave = leave  # function
     self.actions = actions
     self.interactions = fList.FrequencyList(interactions)
     self.taxi = None  # the taxi often contains circular reference to other locations, so it's set outside of the constructor
コード例 #7
0
 def __init__(self, name, gold, experience, items=[], dropAll=False):
     interaction.Interaction.__init__(
         self
     )  # the name of who gives the loot (monsters: "the wolf", "the ogre"; quest-givers: "Old Scar", "Timmy Fletcher")
     self.name = name
     self.gold = gold
     self.experience = experience
     self.items = fList.FrequencyList(items)
     self.dropAll = dropAll
コード例 #8
0
 def __init__(self, name, health, loot, abilities, **kwargs):
     creature.Creature.__init__(self, name, health,
         armor = kwargs.get("armor") if "armor" in kwargs else 0,
         strength = kwargs.get("strength") if "strength" in kwargs else 0,
         spirit = kwargs.get("spirit") if "spirit" in kwargs else 0,
         criticalChance = kwargs.get("criticalChance") if "criticalChance" in kwargs else 0.1,
         criticalStrike = kwargs.get("criticalStrike") if "criticalStrike" in kwargs else 2
     )
     self.loot = loot
     self.abilities = fList.FrequencyList(abilities)
     self.unique = kwargs.get("unique") if "unique" in kwargs else False
     self.respawns = 1 if self.unique else -1
     self.isPlayer = False
コード例 #9
0
    def __init__(self):
        def stingProc(wearer, target):
            if random.random() < 0.05:
                amount = wearer.dealDamage(target, 4 + random.random() * 6)
                output.say("Dark tendrils burst from Sting, crushing " +
                           target.the + " and dealing " +
                           output.formatNumber(amount) + " damage to it.")

        self.sting = gear.Weapon(
            "Sting, Bone Reaper",
            "Aricnea's blade pulses with an ineffable energy",
            sellCost=89,
            buyCost=299,
            stats={
                "strength": 12,
                "criticalStrike": 0.8
            },
            proc=stingProc)
        monster.Monster.__init__(
            self,
            "Aricnea the Sly",
            220,
            loot.Loot("Aricnea the Sly", 38, 1460, [[
                item.Item("undead invasion plans",
                          "someone at Fort Morning would want to see this", 9,
                          99), 1
            ], [self.sting, 1]], True),
            [  # the True signifies Aricnea will drop all items in his loot table, every time.
                # [name, cooldown, caster (always self), cast logic (takes ablty, which means ability but can't be confused with the module, and target)], probability
                [
                    ability.Ability(
                        "stab", 0, lambda ablty, caster, target: ability.
                        damage(ablty, caster, target, 11, 19)), 0.6
                ],
                [
                    ability.Ability(
                        "fan of knives", 0, lambda ablty, caster, target:
                        ability.damage(ablty, caster, target, 18, 26)), 0.2
                ],
                [
                    ability.Ability(
                        "draw shadows", 3,
                        lambda ablty, caster, target: caster.addEffect(
                            effect.ArmorBuff("draw shadows", 3, 0.8))), 0.2
                ]
            ],
            unique=True)
        self.gear.equip(self.sting)
        self.calledDogs = False
        self.dogs = fList.FrequencyList([[BoneHound(), 1]])
        self.dogFight = fight.Fight(lambda: self.dogs.getOption())
コード例 #10
0
def getSkeletonCave():
    def enter():
        output.proclaim(
            "Skeleton Cave: The stone walls smell of rotted flesh. Something here chafes with life."
        )

    def exit():
        output.proclaim("You have left Skeleton Cave.")

    monsters = fList.FrequencyList([[SkeletonWarrior(), 0.4],
                                    [SkeletonArcher(), 0.4], [Ghoul(), 0.2]])

    def getMonster():
        return monsters.getOption(
            condition=lambda monster: monster.canRespawn())

    skeletonCaveActions = [
        actions.RestHeal(player),
        actions.Scavenge(player, [
            [actions.ScavengeGold(player, 2, 6), 0.9],
            [
                actions.FindItem(
                    player, lambda drop:
                    "While exploring the gloomy cave, you stumble across an small iron chest. You find "
                    + str(drop) + ".", [[
                        potions.HealthPotion(
                            "viscous health potion",
                            "a ghoul might have taken a swig", 14, 49, 35), 0.6
                    ],
                                        [
                                            gear.Trinket(
                                                "misplaced femur",
                                                "where could its owner be?",
                                                sellCost=19,
                                                buyCost=59,
                                                stats={"health": 20}), 0.1
                                        ]]), 0.1
            ]
        ])
    ]
    skeletonCaveInteractions = [[actions.Nothing(), 0.7],
                                [fight.Fight(getMonster), 0.3]]
    return location.Location("Skeleton Cave", enter, exit, skeletonCaveActions,
                             skeletonCaveInteractions)
コード例 #11
0
ファイル: actions.py プロジェクト: Arongil/Adventure
 def __init__(self, player, interactions):
     action.Action.__init__(self, "scavenge", player)
     self.interactions = fList.FrequencyList(interactions)
コード例 #12
0
ファイル: actions.py プロジェクト: Arongil/Adventure
 def __init__(self, player, message, items):
     action.Action.__init__(self, "find", player)
     self.message = message  # function, takes item
     self.items = fList.FrequencyList(items)