class Chainmail(Metal):
    ProhibitedEntities = [Weapon]
    PermittedEntities = [Armor]
    Probability = 0.05
    Desirability = 6.0

    PriceMultiplier = 10.0
    WeightMultiplier = 4.0
    DurabilityMultiplier = 4.0
    FlexibilityMultiplier = 1.0

    MitigationMultipliers = {
        'bludgeoning': (0.1, 0.5),
        'slashing': (2, 1.5),
        'piercing': (2, 1.5),
    }

    InventoryDescription = "Provides better mobility, improves piercing/slashing mitigation, reduces bludgeoning mitigation"
    InventoryName = "Chainmail"

    Glances = [
        Observation(acuity=5,
                    sense=0,
                    result="that has been forged with chainmail")
    ]

    Inspects = [
        Observation(
            acuity=0,
            sense=0,
            result=
            "The {BaseType} has been forged with interlocking weaves of chain")
    ]

    PermittedEntities = [erukar.system.Armor]
class Steel(Metal):
    Probability = 100
    Desirability = 2.0

    InventoryDescription = "Strong, sturdy alloy; +10% durability"
    InventoryName = "Steel"

    PriceMultiplier = 6.7
    WeightMultiplier = 2.1
    DurabilityMultiplier = 9.5

    Glances = [
        Observation(acuity=5,
                    sense=0,
                    result="with a metallic {EssentialPart}"),
        Observation(acuity=20, sense=0, result="with a steel {EssentialPart}")
    ]

    Inspects = [
        Observation(
            acuity=5,
            sense=0,
            result=
            "The {EssentialPart} appears to be forged with some sort of metal."
        ),
        Observation(
            acuity=20,
            sense=0,
            result="The {EssentialPart} has been forged from a steel alloy.")
    ]

    PermittedEntities = [
        erukar.system.Weapon, erukar.system.Ammunition, erukar.system.Armor
    ]
class Oak(Wood):
    Probability = 0.05
    Desirability = 1.0
    InventoryName = "Oak"

    DurabilityMultiplier = 0.7
    WeightMultiplier = 0.6

    InventoryDescription = "A light tan, soft wood; preferred by mages for use in wands."

    Glances = [
        Observation(acuity=5, sense=0, result="with a wooden {EssentialPart}"),
        Observation(acuity=20, sense=0, result="with a oaken {EssentialPart}")
    ]

    Inspects = [
        Observation(acuity=5, sense=0, result="The {EssentialPart} has been carved from wood."),
        Observation(acuity=20, sense=0, result="The {EssentialPart} has been carved from white oak.")
    ]

    PermittedEntities = [
        erukar.system.inventory.ArcaneWeapon,
        erukar.system.inventory.BowWeapon,
        erukar.system.inventory.CrossbowWeapon,
        erukar.system.inventory.SimpleWeapon,
        erukar.system.Ammunition
    ]
class Iron(Metal):
    Probability = 0.05
    Desirability = 1.0
    InventoryName = "Iron"

    PriceMultiplier = 3.1
    WeightMultiplier = 1.5
    DurabilityMultiplier = 2.5

    InventoryName = 'Iron'
    InventoryDescription = 'A strong base metal -- hard to forge and fairly heavy but resilient'

    Glances = [
        Observation(acuity=5,
                    sense=0,
                    result="with a metallic gray {EssentialPart}"),
        Observation(acuity=10,
                    sense=0,
                    result="with an unpolished metallic gray {EssentialPart}"),
        Observation(acuity=10,
                    sense=10,
                    result="with a dull gray, heavy {EssentialPart}"),
        Observation(acuity=35, sense=0, result="with an iron {EssentialPart}")
    ]

    Inspects = [
        Observation(
            acuity=5,
            sense=0,
            result=
            "The {EssentialPart} has been forged with some sort of worked, gray metal."
        ),
        Observation(acuity=10,
                    sense=5,
                    result="The {BaseName} is lighter than you anticipate."),
        Observation(
            acuity=35,
            sense=0,
            result=
            "The {EssentialPart} of the {BaseName} has been forged from an unpolished aluminum."
        ),
        Observation(
            acuity=35,
            sense=5,
            result=
            "The {EssentialPart} of the {BaseName} is very light, as it has been forged from some sort of unpolished aluminum."
        ),
        Observation(
            acuity=35,
            sense=10,
            result=
            "The {BaseName}'s {EssentialPart} has been forged from a sturdy and lightweight, yet unpolished, aluminum."
        )
    ]

    PermittedEntities = [
        erukar.system.Weapon, erukar.system.Ammunition, erukar.system.Armor
    ]
Beispiel #5
0
class Bronze(Metal):
    Probability = 200
    Desirability = 2.0

    PriceMultiplier = 3
    WeightMultiplier = 3.5
    DurabilityMultiplier = 0.9

    InventoryName = 'Bronze'
    InventoryDescription = 'Heavy but cheap metal which is easy to work with'

    Glances = [
        Observation(acuity=5,
                    sense=0,
                    result="with a metallic yellow {BaseName}"),
        Observation(acuity=10,
                    sense=0,
                    result="with a dark, unpolished metal {EssentialPart}"),
        Observation(
            acuity=10,
            sense=10,
            result="with a heavy, unpolished metallic yellow {EssentialPart}"),
        Observation(acuity=35, sense=0, result="with a bronze {EssentialPart}")
    ]

    Inspects = [
        Observation(
            acuity=5,
            sense=0,
            result="The {EssentialPart} has been made of a dark, yellow metal."
        ),
        Observation(
            acuity=5,
            sense=5,
            result="The {EssentialPart} is made with a heavy, yellow metal."),
        Observation(
            acuity=10,
            sense=0,
            result=
            "The {EssentialPart} of this {BaseName} is some sort of dark, unpolished metal which has a hint of yellow tint."
        ),
        Observation(
            acuity=35,
            sense=0,
            result=
            "The dark and dull-yellow {EssentialPart} of the {BaseName} has been forged from Bronze."
        ),
        Observation(
            acuity=35,
            sense=10,
            result=
            "The Bronze {EssentialPart} is unpolished, heavy, and full of imperfections. However, its craftsmanship is top notch."
        )
    ]

    PermittedEntities = [
        erukar.system.Weapon, erukar.system.Ammunition, erukar.system.Armor
    ]
Beispiel #6
0
class Negacite(MagicOre):
    Probability = 0.05
    Desirability = 8.0

    InventoryDescription = "A grayish alloy infused with negative energies; enhances shielding effects by 25%"
    InventoryName = "Negacite"

    PriceMultiplier = 41
    WeightMultiplier = 0.5
    DurabilityMultiplier = 1.7

    Glances = [
        Observation(acuity=5, sense=0, result="with a white {EssentialPart}"),
        Observation(
            acuity=10,
            sense=0,
            result=
            "with a whitish {EssentialPart} which shimmers a faint blue light "
        ),
        Observation(acuity=10,
                    sense=10,
                    result="with a slightly magical {EssentialPart}"),
        Observation(
            acuity=35,
            sense=0,
            result=
            "with an white ore called Atherite, the {EssentialPart} shimmers in a faint blue light"
        )
    ]

    Inspects = [
        Observation(
            acuity=5,
            sense=0,
            result="The {EssentialPart} is white with a faint blue sheen."),
        Observation(
            acuity=10,
            sense=5,
            result=
            "The {EssentialPart} is whitish, with a shimmering blue light. A sign of magic."
        ),
        Observation(
            acuity=35,
            sense=0,
            result=
            "The {EssentialPart} of the {BaseName} has been forged from a metal known as Atherite."
        ),
        Observation(
            acuity=35,
            sense=10,
            result=
            "The {BaseName}'s {EssentialPart} has been forged from Atherite, a magical ore which is white and shimmers a blue light; you feel that this weapon possesses some link to magical chaos."
        )
    ]

    PermittedEntities = [
        erukar.system.Weapon, erukar.system.Ammunition, erukar.system.Armor
    ]
class Abyssium(Mineral):
    Probability = 200
    ProbabilityFromSanctity = -1.0
    Desirability = 2.0

    PriceMultiplier = 20
    WeightMultiplier = 1.2
    DurabilityMultiplier = 2.5

    InventoryDescription = "Rare ore mined from Demonic Ruins; predilection towards Unholiness and Curses"
    InventoryName = "Abyssium"

    Glances = [
        Observation(acuity=5, sense=0, result="with a dark red {EssentialPart}"),
        Observation(acuity=10, sense=10, result="with an unholy, dark red {EssentialPart}"),
        Observation(acuity=35, sense=0, result="with an Abyssium {EssentialPart}")
    ]

    Inspects = [
        Observation(acuity=5, sense=0, result="The {EssentialPart} appears to be carved out of a dark, reddish black stone."),
        Observation(acuity=10, sense=0, result="The {EssentialPart} appears to be carved out of a dark, reddish black stone that seems to lightly glow a faint red light."),
        Observation(acuity=10, sense=10, result="The {EssentialPart} appears to be carved out of some sort of unholy, reddish black stone that glows a faint red light."),
        Observation(acuity=35, sense=0, result="The {EssentialPart} is made of a blood red stone known as \"Abyssium\".")
    ]

    PermittedEntities = [
        erukar.system.Weapon,
        erukar.system.Ammunition,
        erukar.system.Armor
    ]
class Salericite(MagicOre):
    Probability = 0.05
    Desirability = 8.0

    InventoryDescription = "A black and orange alloy radiating positive energies; enhances outward effects by 25%"
    InventoryName = "Salericite"

    PriceMultiplier = 33
    WeightMultiplier = 1.8
    DurabilityMultiplier = 1.0

    Glances = [
        Observation(acuity=5, sense=0, result="with a black {EssentialPart}"),
        Observation(
            acuity=10,
            sense=0,
            result=
            "with a black {EssentialPart} which shimmers an orangish glare"),
        Observation(acuity=0,
                    sense=7,
                    result="with a slightly magical {EssentialPart}"),
        Observation(
            acuity=35,
            sense=7,
            result=
            "with a black Salericite {EssentialPart} which reflects an orangish glare"
        )
    ]

    Inspects = [
        Observation(acuity=5, sense=0, result="The {EssentialPart} is black."),
        Observation(
            acuity=10,
            sense=5,
            result=
            "The {EssentialPart} is black with an orangish glare; it emanates some sort of magic."
        ),
        Observation(
            acuity=35,
            sense=0,
            result=
            "The {EssentialPart} of the {BaseName} has been forged from a metal known as Salericite."
        ),
        Observation(
            acuity=35,
            sense=10,
            result=
            "The {BaseName}'s {EssentialPart} has been forged from Salericite, a magical ore which is black yet reflects an orangish light at certain angles."
        )
    ]

    PermittedEntities = [
        erukar.system.Weapon, erukar.system.Ammunition, erukar.system.Armor
    ]
Beispiel #9
0
class Magicite(MagicOre):
    Probability = 100
    Desirability = 8.0

    InventoryDescription = "Magically-infused, reddish alloy; enhances magic imbuements by 10%"
    InventoryName = "Magicite"

    PriceMultiplier = 17
    WeightMultiplier = 2.6
    DurabilityMultiplier = 1.7

    Glances = [
        Observation(acuity=5, sense=0,
                    result="with a reddish {EssentialPart}"),
        Observation(acuity=0,
                    sense=10,
                    result="with a magical {EssentialPart}"),
        Observation(acuity=10,
                    sense=10,
                    result="with a reddish, magical {EssentialPart}"),
        Observation(acuity=20,
                    sense=10,
                    result="with ~a_or_an~ {EssentialPart} made of Magicite")
    ]

    Inspects = [
        Observation(
            acuity=5,
            sense=0,
            result=
            "The {EssentialPart} has been crafted with some sort of reddish material."
        ),
        Observation(acuity=0,
                    sense=10,
                    result="The {BaseName} seems to emanate magic."),
        Observation(
            acuity=10,
            sense=10,
            result=
            "The {EssentialPart} has been crafted with some sort of magical, reddish material."
        ),
        Observation(
            acuity=20,
            sense=10,
            result=
            "The {EssentialPart} has been forged and enchanted with Magicite, a magically-infused reddish alloy."
        )
    ]

    PermittedEntities = [
        erukar.system.Weapon, erukar.system.Ammunition, erukar.system.Armor
    ]
class Candle(LightSource):
    BaseName = "Candle"
    EssentialPart = "wick"
    SupportPart = "base"
    BriefDescription = "a candle"
    SelfAuraDescription = "The soft white light of the candle in your hand slightly illuminates the room."
    Glances = [
        Observation(acuity=1, sense=1, result='Soft light fills the room.')
    ]

    MaxFuel = 100
    FuelConsumptionRate = 0.1
    StrengthAtMaxFuel = 3.0
    StrengthAtZeroFuel = 1.0
    DecayAtMaxFuel = 0.5
    DecayAtZeroFuel = 0.3
class Room(Containable):
    SelfDescription = "This room is fairly large."
    DecoDescription = "You see {}."
    ContainerDescription = "In the room you see {}."
    Glances = [Observation(acuity=0, sense=0, result="This is a room.")]

    def __init__(self, dungeon, coordinates=None):
        super().__init__([])
        self.linearity = 0
        self.dungeon = dungeon
        if isinstance(coordinates, types.GeneratorType):
            self.coordinates = list(coordinates)
        else:
            self.coordinates = [] if not coordinates else coordinates
        self.dungeon.add_room(self, self.coordinates)
        self.floor = None
        self.ceiling = None
        self.visible_in_room_description = False

    def calculate_luminosity(self):
        return 1.0

    def calculate_danger(self):
        return 1.0

    def calculate_desirability(self):
        return 1.0

    def initiate_aura(self, aura):
        aura.location = self
        self.dungeon.active_auras.add(aura)

    def on_start(self, *_):
        '''Called when the Instance has decorated and is actually starting'''
        for content in self.contents:
            content.on_start(self)

    def get_object_by_uuid(self, uuid):
        for found in super().get_object_by_uuid(uuid):
            yield found

    def annex(self, new_coordinates):
        if not isinstance(new_coordinates, list):
            new_coordinates = list(new_coordinates)
        self.coordinates += new_coordinates
        self.dungeon.annex(self, new_coordinates)
Beispiel #12
0
class Torch(LightSource):
    BaseName = "Torch"
    EssentialPart = "tip"
    SupportPart = "handle"
    BriefDescription = "a torch"
    SelfAuraDescription = "The light from your torch illuminates the room."
    AuraDescription = "The flickering, golden light of a torch flows into the room from {relative_direction}."
    Glances = [
        Observation(acuity=1, sense=1, result='Torchlight fills the room.')
    ]

    MaxFuel = 100
    FuelConsumptionRate = 0.3
    StrengthAtMaxFuel = 1.0
    StrengthAtZeroFuel = 0.2
    DistanceAtMaxFuel = 10
    DistanceAtZeroFuel = 3
class Brass(Metal):
    Probability = 200
    Desirability = 1.0

    InventoryName = 'Brass'
    InventoryDescription = 'Decreases weight by 40%; Decreases Durability by 35%'

    PriceMultiplier = 1.2
    WeightMultiplier = 0.6
    DurabilityMultiplier = 0.65

    Glances = [
        Observation(acuity=5,
                    sense=0,
                    result="with a metallic yellow {BaseName}"),
        Observation(acuity=10,
                    sense=0,
                    result="with an polished yellow metal {EssentialPart}"),
        Observation(
            acuity=10,
            sense=10,
            result="with a light, polished metallic yellow {EssentialPart}"),
        Observation(acuity=35, sense=0, result="with an brass {EssentialPart}")
    ]

    Inspects = [
        Observation(
            acuity=5,
            sense=0,
            result="The {EssentialPart} has been made of a yellow metal."),
        Observation(
            acuity=5,
            sense=5,
            result="The {EssentialPart} is made of an expensive metal."),
        Observation(
            acuity=10,
            sense=0,
            result=
            "The {EssentialPart} is made with a light, polished yellow metal"),
        Observation(
            acuity=35,
            sense=0,
            result=
            "The {EssentialPart} of the {BaseName} has been forged from Brass."
        ),
        Observation(
            acuity=35,
            sense=5,
            result=
            "The {EssentialPart} of the {BaseName} is light, as it has been forged polished brass."
        ),
        Observation(
            acuity=35,
            sense=10,
            result=
            "The {BaseName}'s {EssentialPart} has been forged from a resilient and lightweight brass."
        )
    ]

    PermittedEntities = [
        erukar.system.Weapon, erukar.system.Ammunition, erukar.system.Armor
    ]
class LightSource(Item):
    Persistent = True
    BaseName = "Light source"
    EssentialPart = "wick"
    SupportPart = "container"
    BriefDescription = "a source of light"
    SelfAuraDescription = "Your source of light brightens the room."
    AuraDescription = "A pale white glow shines through {relative_direction}."
    PersistentAttributes = ['fuel']
    EquipmentLocations = ['right', 'left']

    MaxFuel = 100
    FuelConsumptionRate = 0.25  # per five seconds
    StrengthAtMaxFuel = 1
    StrengthAtZeroFuel = 0.3
    DistanceAtMaxFuel = 0.5
    DistanceAtZeroFuel = 0.2

    Glances = [Observation(acuity=1, sense=1, result='Light flickers.')]

    def __init__(self):
        super().__init__(self.BaseName, self.BaseName)
        self.aura = None
        self.equipment_locations = ['left', 'right']
        self.fuel = random.uniform(self.MaxFuel / 2, self.MaxFuel)
        self.name = self.BaseName
        self.modifiers = []

    def on_inventory(self):
        return '{} ({}%)'.format(self.name, int(self.fuel))

    def on_inventory_inspect(self, lifeform):
        return '{}\n\t• {}% Fuel Remaining'.format(self.name, int(self.fuel))

    def tick(self):
        if self.aura is not None:
            self.fuel -= self.FuelConsumptionRate
            self.aura.aura_strength = self.strength()
            self.aura.max_distance = self.max_distance()
            if self.fuel <= 0:
                self.stop_aura()

    def on_start(self, dungeon):
        self.start_aura(dungeon)

    def on_take(self, lifeform):
        self.stop_aura()

    def on_drop(self, room, lifeform):
        self.start_aura(room)

    def on_move(self, *_):
        if self.aura:
            self.aura.move(self.aura.initiator.coordinates)

    def on_equip(self, lifeform):
        self.start_aura(lifeform)

    def on_unequip(self, lifeform):
        self.stop_aura()

    def modify_light(self, loc):
        if not self.aura:
            return 0
        return self.aura.strength_at(loc)

    def start_aura(self, initiator):
        if self.fuel <= 0:
            return
        self.aura = Aura((0, 0), self.strength(), self.max_distance())
        self.aura.Glances = self.Glances
        self.aura.initiator = initiator
        self.aura.blocked_by_walls = True
        self.aura.modify_light = self.modify_light
        if isinstance(initiator, Dungeon):
            self.aura.world = initiator
            initiator.initiate_aura(self.aura, self.coordinates)
        if isinstance(initiator, Lifeform):
            self.aura.world = initiator.world
            initiator.world.initiate_aura(self.aura, initiator.coordinates)

    def stop_aura(self):
        if self.aura:
            self.aura.is_expired = True
            self.aura = None

    def strength(self):
        return Curves.dropoff(0, self.MaxFuel, self.StrengthAtZeroFuel,
                              self.StrengthAtMaxFuel, self.fuel)

    def max_distance(self):
        return Curves.dropoff(0, self.MaxFuel, self.DistanceAtZeroFuel,
                              self.DistanceAtMaxFuel, self.fuel)
class Aluminum(Metal):
    Probability = 200
    ProbabilityFromFabrication = 0.1
    Desirability = 1.0

    PriceMultiplier = 1.5
    WeightMultiplier = 0.7
    DurabilityMultiplier = 0.8

    InventoryName = 'Aluminum'
    InventoryDescription = 'Lightweight metal lowers weight by 30% but is highly pliable, reducing durability by 20%'

    Glances = [
        Observation(acuity=5,
                    sense=0,
                    result="with a metallic gray {EssentialPart}"),
        Observation(acuity=10,
                    sense=0,
                    result="with an unpolished metallic gray {EssentialPart}"),
        Observation(
            acuity=10,
            sense=10,
            result=
            "with a lightweight, unpolished metallic gray {EssentialPart}"),
        Observation(acuity=35,
                    sense=0,
                    result="with an aluminum {EssentialPart}")
    ]

    Inspects = [
        Observation(
            acuity=5,
            sense=0,
            result=
            "The {EssentialPart} has been forged with some sort of worked, gray metal."
        ),
        Observation(acuity=10,
                    sense=5,
                    result="The {BaseName} is lighter than you anticipate."),
        Observation(
            acuity=35,
            sense=0,
            result=
            "The {EssentialPart} of the {BaseName} has been forged from an unpolished aluminum."
        ),
        Observation(
            acuity=35,
            sense=5,
            result=
            "The {EssentialPart} of the {BaseName} is very light, as it has been forged from some sort of unpolished aluminum."
        ),
        Observation(
            acuity=35,
            sense=10,
            result=
            "The {BaseName}'s {EssentialPart} has been forged from a sturdy and lightweight, yet unpolished, aluminum."
        )
    ]

    PermittedEntities = [
        erukar.system.Weapon, erukar.system.Ammunition, erukar.system.Armor
    ]