Exemplo n.º 1
0
def spl_frost_breath(sn, level, ch, victim, target):
    if victim.itemaff.is_set(merc.ITEMA_ICESHIELD):
        return

    if game_utils.number_percent(
    ) < 2 * level and not handler_magic.saves_spell(level, victim):
        for loc in victim.equipped.keys():
            obj = victim.get_eq(loc)
            if not obj or game_utils.number_bits(
                    2) != 0 or obj.flags.spellproof:
                continue

            if obj.item_type == [
                    merc.ITEM_CONTAINER, merc.ITEM_DRINK_CON, merc.ITEM_POTION
            ]:
                handler_game.act("$p freezes and shatters!", victim, obj, None,
                                 merc.TO_CHAR)
                obj.extract()

    hpch = max(10, ch.hit)
    dam = game_utils.number_range(hpch // 16 + 1, hpch // 8)

    if handler_magic.saves_spell(level, victim):
        dam //= 2

    fight.damage(
        ch, victim, dam * 0.5 if
        (not victim.is_npc() and victim.is_vampire()) else 0 if
        (not victim.is_npc() and victim.immune.is_set(merc.IMM_COLD)) else 1,
        sn)
def spl_acid_breath(sn, level, ch, victim, target):
    if victim.itemaff.is_set(merc.ITEMA_ACIDSHIELD):
        return

    if game_utils.number_percent() < 2 * level and not handler_magic.saves_spell(level, victim):
        for loc in victim.equipped.keys():
            obj = victim.get_eq(loc)
            if not obj or game_utils.number_bits(2) != 0 or obj.flags.spellproof:
                continue

            if obj.item_type == merc.ITEM_ARMOR:
                if obj.value[0] > 0:
                    handler_game.act("$p is pitted and etched!", victim, obj, None, merc.TO_CHAR)
                    victim.armor -= obj.apply_ac()
                    obj.value[0] -= 1
                    obj.cost = 0
                    victim.armor += obj.apply_ac()
            elif obj.item_type == merc.ITEM_CONTAINER:
                handler_game.act("$p fumes and dissolves!", victim, obj, None, merc.TO_CHAR)
                obj.extract()

    hpch = max(10, ch.hit)
    dam = game_utils.number_range(hpch // 16 + 1, hpch // 8)

    if handler_magic.saves_spell(level, victim):
        dam //= 2

    fight.damage(ch, victim, 0 if (not victim.is_npc() and victim.immune.is_set(merc.IMM_ACID)) else dam, sn)
Exemplo n.º 3
0
def cmd_recall(ch, argument):
    handler_game.act("Your body flickers with green energy.", ch, None, None,
                     merc.TO_CHAR)
    handler_game.act("$n's body flickers with green energy.", ch, None, None,
                     merc.TO_ROOM)

    location = handler_room.get_room_by_vnum(ch.home)
    if not location:
        location = handler_room.get_room_by_vnum(merc.ROOM_VNUM_TEMPLE)
        if not location:
            ch.send("You are completely lost.\n")
            return

    if ch.in_room == location:
        return

    if ch.in_room.room_flags.is_set(merc.ROOM_NO_RECALL) or ch.is_affected(
            merc.AFF_CURSE):
        ch.send("You are unable to recall.\n")
        return

    victim = ch.fighting
    if victim:
        if game_utils.number_bits(1) == 0:
            ch.wait_state(4)
            ch.send("You failed!\n")
            return

        ch.send("You recall from combat!\n")
        fight.stop_fighting(ch, True)

    handler_game.act("$n disappears.", ch, None, None, merc.TO_ROOM)
    ch.in_room.get(ch)
    location.put(ch)
    handler_game.act("$n appears in the room.", ch, None, None, merc.TO_ROOM)
    ch.cmd_look("auto")

    mount = ch.mount
    if mount:
        mount.in_room.get(mount)
        location.put(mount)
Exemplo n.º 4
0
def spl_fire_breath(sn, level, ch, victim, target):
    if victim.itemaff.is_set(merc.ITEMA_FIRESHIELD):
        return

    if game_utils.number_percent(
    ) < 2 * level and not handler_magic.saves_spell(level, victim):
        for loc in victim.equipped.keys():
            obj = victim.get_eq(loc)
            if not obj or game_utils.number_bits(
                    2) != 0 or obj.flags.spellproof:
                continue

            item_list = [(merc.ITEM_CONTAINER, "$p ignites and burns!"),
                         (merc.ITEM_POTION, "$p bubbles and boils!"),
                         (merc.ITEM_SCROLL, "$p crackles and burns!"),
                         (merc.ITEM_STAFF, "$p smokes and chars!"),
                         (merc.ITEM_WAND, "$p sparks and sputters!"),
                         (merc.ITEM_FOOD, "$p blackens and crisps!"),
                         (merc.ITEM_PILL, "$p melts and drips!")]
            for (aa, bb) in item_list:
                if obj.item_type == aa:
                    msg = bb
                    break
            else:
                continue

            handler_game.act(msg, victim, obj, None, merc.TO_CHAR)
            obj.extract()

    hpch = max(10, ch.hit)
    dam = game_utils.number_range(hpch // 16 + 1, hpch // 8)

    if handler_magic.saves_spell(level, victim):
        dam //= 2

    fight.damage(
        ch, victim, dam * 2 if
        (not victim.is_npc() and victim.is_vampire()) else 0 if
        (not victim.is_npc() and victim.immune.is_set(merc.IMM_HEAT)) else 1,
        sn)
Exemplo n.º 5
0
    def check_social(self, command, argument):
        cmd = None
        for key, social in const.social_table.items():
            if command[0] == social.name[0] and game_utils.str_prefix(
                    command, social.name):
                cmd = social
                break

        if not cmd:
            return False

        if not self.is_npc() and self.sentances.is_set(merc.SENT_NO_EMOTE):
            self.send("You are anti-social!\n")
            return True

        if self.position == merc.POS_DEAD:
            self.send("Lie still; you are DEAD.\n")
            return True
        if self.position in [merc.POS_INCAP, merc.POS_MORTAL]:
            self.send("You are hurt far too bad for that.\n")
            return True
        if self.position == merc.POS_STUNNED:
            self.send("You are too stunned to do that.\n")
            return True
        if self.position == merc.POS_SLEEPING:
            # I just know this is the path to a 12" 'if' statement.  :(
            # But two players asked for it already!  -- Furey
            if not game_utils.str_cmp(cmd.name, "snore"):
                self.send("In your dreams, or what?\n")
                return True

        holder, arg = game_utils.read_word(argument)
        victim = self.get_char_room(arg)
        if not arg:
            handler_game.act(cmd.others_no_arg, self, None, victim,
                             merc.TO_ROOM)
            handler_game.act(cmd.char_no_arg, self, None, victim, merc.TO_CHAR)
        elif not victim:
            self.not_here(arg)
        elif victim == self:
            handler_game.act(cmd.others_auto, self, None, victim, merc.TO_ROOM)
            handler_game.act(cmd.char_auto, self, None, victim, merc.TO_CHAR)
        else:
            handler_game.act(cmd.others_found, self, None, victim,
                             merc.TO_NOTVICT)
            handler_game.act(cmd.char_found, self, None, victim, merc.TO_CHAR)
            handler_game.act(cmd.vict_found, self, None, victim, merc.TO_VICT)

            if not self.is_npc() and victim.is_npc(
            ) and not victim.is_affected(merc.AFF_CHARM) and victim.is_awake():
                chance = game_utils.number_bits(4)
                if chance == 0:
                    fight.multi_hit(victim, self, merc.TYPE_UNDEFINED)
                elif chance in [1, 2, 3, 4, 5, 6, 7, 8]:
                    handler_game.act(cmd.others_found, victim, None, self,
                                     merc.TO_NOTVICT)
                    handler_game.act(cmd.char_found, victim, None, self,
                                     merc.TO_CHAR)
                    handler_game.act(cmd.vict_found, victim, None, self,
                                     merc.TO_VICT)
                elif chance in [9, 10, 11, 12]:
                    handler_game.act("$n slaps $N.", victim, None, self,
                                     merc.TO_NOTVICT)
                    handler_game.act("You slap $N.", victim, None, self,
                                     merc.TO_CHAR)
                    handler_game.act("$n slaps you.", victim, None, self,
                                     merc.TO_VICT)
        return True
Exemplo n.º 6
0
def weather_update():
    buf = ""
    handler_game.time_info.hour += 1
    if handler_game.time_info.hour == 5:
        handler_game.weather_info.sunlight = merc.SUN_LIGHT
        buf = "The day has begun.\n"
    elif handler_game.time_info.hour == 6:
        handler_game.weather_info.sunlight = merc.SUN_RISE
        buf = "The sun rises in the east.\n"
    elif handler_game.time_info.hour == 19:
        handler_game.weather_info.sunlight = merc.SUN_SET
        buf = "The sun slowly disappears in the west.\n"
    elif handler_game.time_info.hour == 20:
        handler_game.weather_info.sunlight = merc.SUN_DARK
        buf = "The night has begun.\n"
    elif handler_game.time_info.hour == 24:
        handler_game.time_info.hour = 0
        handler_game.time_info.day += 1
        buf = "You hear a clock in the distance strike midnight.\n"

        import nanny
        for wch in list(instance.players.values()):
            char_up = False
            if wch.desc.is_connected(nanny.con_playing) and wch.is_vampire():
                if wch.hit < wch.max_hit:
                    wch.hit = wch.max_hit
                    char_up = True
                if wch.mana < wch.max_mana:
                    wch.mana = wch.max_mana
                    char_up = True
                if wch.move < wch.max_move:
                    wch.move = wch.max_move
                    char_up = True

                if char_up:
                    wch.send(
                        "You feel the strength of the kindred flow through your veins!\n"
                    )

    if handler_game.time_info.day >= 35:
        handler_game.time_info.day = 0
        handler_game.time_info.month += 1
    if handler_game.time_info.month >= 17:
        handler_game.time_info.month = 0
        handler_game.time_info.year += 1

    # Weather change.
    if 9 <= handler_game.time_info.month <= 16:
        diff = -2 if handler_game.weather_info.mmhg > 985 else 2
    else:
        diff = -2 if handler_game.weather_info.mmhg > 1015 else 2

    handler_game.weather_info.change += diff * game_utils.dice(
        1, 4) + game_utils.dice(2, 6) - game_utils.dice(2, 6)
    handler_game.weather_info.change = max(handler_game.weather_info.change,
                                           -12)
    handler_game.weather_info.change = min(handler_game.weather_info.change,
                                           12)

    handler_game.weather_info.mmhg += handler_game.weather_info.change
    handler_game.weather_info.mmhg = max(handler_game.weather_info.mmhg, 960)
    handler_game.weather_info.mmhg = min(handler_game.weather_info.mmhg, 1040)

    if handler_game.weather_info.sky == merc.SKY_CLOUDLESS:
        if handler_game.weather_info.mmhg < 990 or (
                handler_game.weather_info.mmhg < 1010
                and game_utils.number_bits(2) == 0):
            buf += "The sky is getting cloudy.\n"
            handler_game.weather_info.sky = merc.SKY_CLOUDY
    elif handler_game.weather_info.sky == merc.SKY_CLOUDY:
        if handler_game.weather_info.mmhg < 970 or (
                handler_game.weather_info.mmhg < 990
                and game_utils.number_bits(2) == 0):
            buf += "It starts to rain.\n"
            handler_game.weather_info.sky = merc.SKY_RAINING

        if handler_game.weather_info.mmhg > 1030 and game_utils.number_bits(
                2) == 0:
            buf += "The clouds disappear.\n"
            handler_game.weather_info.sky = merc.SKY_CLOUDLESS
    elif handler_game.weather_info.sky == merc.SKY_RAINING:
        if handler_game.weather_info.mmhg < 970 and game_utils.number_bits(
                2) == 0:
            buf += "Lightning flashes in the sky.\n"
            handler_game.weather_info.sky = merc.SKY_LIGHTNING

        if handler_game.weather_info.mmhg > 1030 or (
                handler_game.weather_info.mmhg > 1010
                and game_utils.number_bits(2) == 0):
            buf += "The rain stopped.\n"
            handler_game.weather_info.sky = merc.SKY_CLOUDY
    elif handler_game.weather_info.sky == merc.SKY_LIGHTNING:
        if handler_game.weather_info.mmhg > 1010 or (
                handler_game.weather_info.mmhg > 990
                and game_utils.number_bits(2) == 0):
            buf += "The lightning has stopped.\n"
            handler_game.weather_info.sky = merc.SKY_RAINING
    else:
        comm.notify(
            "weather_update: bad sky {}".format(handler_game.weather_info.sky),
            merc.CONSOLE_WARNING)
        handler_game.weather_info.sky = merc.SKY_CLOUDLESS

    if buf:
        import nanny
        for wch in list(instance.players.values()):
            if wch.desc.is_connected(
                    nanny.con_playing) and wch.is_outside() and wch.is_awake():
                wch.send(buf)