Ejemplo n.º 1
0
def d_reset(pReset, last, level, npc):
    if pReset.arg1 not in instance.room_templates.keys():
        logger.error("Reset_area: 'D': bad vnum %d.", pReset.arg1)
        return last, level, npc
    else:
        roomInstance_id = instance.instances_by_room[pReset.arg1][0]
        roomInstance = instance.global_instances[roomInstance_id]
        pexit = roomInstance.exit[pReset.arg2]
    if not pexit:
        return last, level, npc

    if pReset.arg3 == 0:
        pexit.exit_info = state_checks.REMOVE_BIT(pexit.exit_info,
                                                  merc.EX_CLOSED)
        pexit.exit_info = state_checks.REMOVE_BIT(pexit.exit_info,
                                                  merc.EX_LOCKED)
        return last, level, npc
    elif pReset.arg3 == 1:
        pexit.exit_info = state_checks.SET_BIT(pexit.exit_info, merc.EX_CLOSED)
        pexit.exit_info = state_checks.REMOVE_BIT(pexit.exit_info,
                                                  merc.EX_LOCKED)
        return last, level, npc
    elif pReset.arg3 == 2:
        pexit.exit_info = state_checks.SET_BIT(pexit.exit_info, merc.EX_CLOSED)
        pexit.exit_info = state_checks.SET_BIT(pexit.exit_info, merc.EX_LOCKED)
        return last, level, npc
    last = True
    return last, level, npc
Ejemplo n.º 2
0
def do_wiznet(ch, argument):
    if not argument:
        if state_checks.IS_SET(ch.wiznet, merc.WIZ_ON):
            ch.send("Signing off of Wiznet.\n")
            ch.wiznet = state_checks.REMOVE_BIT(ch.wiznet, merc.WIZ_ON)
        else:
            ch.send("Welcome to Wiznet!\n")
            ch.wiznet = state_checks.SET_BIT(ch.wiznet, merc.WIZ_ON)
        return

    if "on".startswith(argument):
        ch.send("Welcome to Wiznet!\n")
        ch.wiznet = state_checks.SET_BIT(ch.wiznet, merc.WIZ_ON)
        return
    if "off".startswith(argument):
        ch.send("Signing off of Wiznet.\n")
        ch.wiznet = state_checks.REMOVE_BIT(ch.wiznet, merc.WIZ_ON)
        return
    buf = ''
    # show wiznet status
    if "status".startswith(argument):
        if not state_checks.IS_SET(ch.wiznet, merc.WIZ_ON):
            buf += "off "
        for name, flag in const.wiznet_table.items():
            if state_checks.IS_SET(ch.wiznet, flag.bit):
                buf += name + " "
            ch.send("Wiznet status:\n%s\n" % buf)
            return
    if "show".startswith(argument):
        # list of all wiznet options
        buf = ''
        for name, flag in const.wiznet_table.items():
            if flag.level <= ch.trust:
                buf += name + " "
        ch.send("Wiznet options available to you are:\n%s\n" % buf)
        return
    flag = state_checks.prefix_lookup(const.wiznet_table, argument)
    if not flag or ch.trust < flag.level:
        ch.send("No such option.\n")
        return
    if state_checks.IS_SET(ch.wiznet, flag.bit):
        ch.send("You will no longer see %s on wiznet.\n" % flag.name)
        ch.wiznet = state_checks.REMOVE_BIT(ch.wiznet, flag.bit)
        return
    else:
        ch.send("You will now see %s on wiznet.\n" % flag.name)
        ch.wiznet = state_checks.SET_BIT(ch.wiznet, flag.bit)
        return
Ejemplo n.º 3
0
def do_notell(ch, argument):
    argument, arg = game_utils.read_word(argument)
    if not arg:
        ch.send("Notell whom?")
        return
    victim = ch.get_char_world(arg)
    if not victim:
        ch.send("They aren't here.\n")
        return
    if victim.trust >= ch.trust:
        ch.send("You failed.\n")
        return
    if victim.comm.is_set(merc.COMM_NOTELL):
        victim.comm = state_checks.REMOVE_BIT(victim.comm, merc.COMM_NOTELL)
        victim.send("You can tell again.\n")
        ch.send("NOTELL removed.\n")
        handler_game.wiznet("$N restores tells to %s." % victim.name, ch, None,
                            merc.WIZ_PENALTIES, merc.WIZ_SECURE, 0)
    else:
        victim.comm = state_checks.SET_BIT(victim.comm, merc.COMM_NOTELL)
        victim.send("You can't tell!\n")
        ch.send("NOTELL set.\n")
        handler_game.wiznet("$N revokes %s's tells." % victim.name, ch, None,
                            merc.WIZ_PENALTIES, merc.WIZ_SECURE, 0)
    return
Ejemplo n.º 4
0
def do_noshout(ch, argument):
    argument, arg = game_utils.read_word(argument)
    if not arg:
        ch.send("Noshout whom?\n")
        return
    victim = ch.get_char_world(arg)
    if not victim:
        ch.send("They aren't here.\n")
        return
    if victim.is_npc():
        ch.send("Not on NPC's.\n")
        return
    if victim.trust >= ch.trust:
        ch.send("You failed.\n")
        return
    if victim.comm.is_set(merc.COMM_NOSHOUT):
        victim.comm = state_checks.REMOVE_BIT(victim.comm, merc.COMM_NOSHOUT)
        victim.send("You can shout again.\n")
        ch.send("NOSHOUT removed.\n")
        handler_game.wiznet("$N restores shouts to %s." % victim.name, ch,
                            None, merc.WIZ_PENALTIES, merc.WIZ_SECURE, 0)
    else:
        victim.comm = state_checks.SET_BIT(victim.comm, merc.COMM_NOSHOUT)
        victim.send("You can't shout!\n")
        ch.send("NOSHOUT set.\n")
        handler_game.wiznet("$N revokes %s's shouts." % victim.name, ch, None,
                            merc.WIZ_PENALTIES, merc.WIZ_SECURE, 0)
    return
Ejemplo n.º 5
0
def do_nochannels(ch, argument):
    argument, arg = game_utils.read_word(argument)
    if not arg:
        ch.send("Nochannel whom?")
        return
    victim = ch.get_char_world(arg)
    if not victim:
        ch.send("They aren't here.\n")
        return
    if victim.trust >= ch.trust:
        ch.send("You failed.\n")
        return
    if victim.comm.is_set(merc.COMM_NOCHANNELS):
        victim.comm = state_checks.REMOVE_BIT(victim.comm,
                                              merc.COMM_NOCHANNELS)
        victim.send("The gods have restored your channel priviliges.\n")
        ch.send("NOCHANNELS removed.\n")
        handler_game.wiznet("$N restores channels to %s" % victim.name, ch,
                            None, merc.WIZ_PENALTIES, merc.WIZ_SECURE, 0)
    else:
        victim.comm = state_checks.SET_BIT(victim.comm, merc.COMM_NOCHANNELS)
        victim.send("The gods have revoked your channel priviliges.\n")
        ch.send("NOCHANNELS set.\n")
        handler_game.wiznet("$N revokes %s's channels." % victim.name, ch,
                            None, merc.WIZ_PENALTIES, merc.WIZ_SECURE, 0)
    return
Ejemplo n.º 6
0
def spell_dispel_magic(sn, level, ch, victim, target):
    # modified for enhanced use */
    if handler_magic.saves_spell(level, victim, merc.DAM_OTHER):
        victim.send("You feel a brief tingling sensation.\n")
        ch.send("You failed.\n")
        return

    spells = {
        'armor': None,
        'bless': None,
        'blindness': '$n is no longer blinded',
        'calm': '$n no longer looks so peaceful...',
        'change sex': '$n looks more like $mself again.',
        'charm person': '$n regains $s free will.',
        'chill touch': '$n looks warmer',
        'curse': None,
        'detect evil': None,
        'detect good': None,
        'detect hidden': None,
        'detect invis': None,
        'detect magic': None,
        'faerie fire': "$n's outline fades",
        'fly': '$n falls to the ground! ',
        'frenzy': "$n no longer looks so wild.",
        'giant strength': "$n no longer looks so mighty.",
        'haste': '$n is no longer moving so quickly',
        'infravision': None,
        'invis': '$n fades into existence.',
        'mass invis': '$n fades into existence',
        'pass door': None,
        'protection evil': None,
        'protection good': None,
        'sanctuary': "The white aura around $n's body vanishes.",
        'shield': 'The shield protecting $n vanishes',
        'sleep': None,
        'slow': '$n is no longer moving so slowly.',
        'stone skin': "$n's skin regains its normal texture.",
        'weaken': "$n looks stronger."
    }

    for k, v in spells.items():
        if handler_magic.check_dispel(level, victim, const.skill_table[k]):
            if v:
                handler_game.act(v, victim, None, None, merc.TO_ROOM)
            found = True

    if victim.is_affected(
            merc.AFF_SANCTUARY) and not handler_magic.saves_dispel(
                level, victim.level, -1) and not state_checks.is_affected(
                    victim, const.skill_table["sanctuary"]):
        state_checks.REMOVE_BIT(victim.affected_by, merc.AFF_SANCTUARY)
        handler_game.act("The white aura around $n's body vanishes.", victim,
                         None, None, merc.TO_ROOM)
        found = True

    if found:
        ch.send("Ok.\n")
    else:
        ch.send("Spell failed.\n")
Ejemplo n.º 7
0
def do_peace(ch, argument):
    for rch_id in ch.in_room.people[:]:
        rch = instance.characters[rch_id]
        if rch.fighting:
            fight.stop_fighting(rch, True)
        if rch.is_npc() and rch.act.is_set(merc.ACT_AGGRESSIVE):
            rch.act = state_checks.REMOVE_BIT(rch.act, merc.ACT_AGGRESSIVE)
    ch.send("Ok.\n")
    return
Ejemplo n.º 8
0
def spell_remove_curse(sn, level, ch, victim, target):
    found = False
    # do object cases first */
    if target == merc.TARGET_ITEM:
        obj = victim

        if obj.flags.no_drop or obj.flags.no_remove:
            if not obj.flags.no_uncurse and not handler_magic.saves_dispel(
                    level + 2, obj.level, 0):
                state_checks.REMOVE_BIT(obj.extra_flags, merc.ITEM_NODROP)
                state_checks.REMOVE_BIT(obj.extra_flags, merc.ITEM_NOREMOVE)
                handler_game.act("$p glows blue.", ch, obj, None, merc.TO_ALL)
                return
            handler_game.act("The curse on $p is beyond your power.", ch, obj,
                             None, merc.TO_CHAR)
            return

        handler_game.act("There doesn't seem to be a curse on $p.", ch, obj,
                         None, merc.TO_CHAR)
        return

    # characters */
    if handler_magic.check_dispel(level, victim, const.skill_table['curse']):
        victim.send("You feel better.\n")
        handler_game.act("$n looks more relaxed.", victim, None, None,
                         merc.TO_ROOM)

    for obj in victim.contents:
        if (obj.flags.no_drop \
                or obj.flags.no_remove)\
                and not obj.flags.no_uncurse:
            # attempt to remove curse */
            if not handler_magic.saves_dispel(level, obj.level, 0):
                state_checks.REMOVE_BIT(obj.extra_flags, merc.ITEM_NODROP)
                state_checks.REMOVE_BIT(obj.extra_flags, merc.ITEM_NOREMOVE)
                handler_game.act("Your $p glows blue.", victim, obj, None,
                                 merc.TO_CHAR)
                handler_game.act("$n's $p glows blue.", victim, obj, None,
                                 merc.TO_ROOM)
                break
Ejemplo n.º 9
0
def do_clantalk(ch, argument):
    if not ch.is_clan() or ch.clan.independent:
        ch.send("You aren't in a clan.\n")
        return
    if not argument:
        if state_checks.IS_SET(ch.comm, merc.COMM_NOCLAN):
            ch.send("Clan channel is now ON\n")
            ch.comm = state_checks.REMOVE_BIT(ch.comm, merc.COMM_NOCLAN)
        else:
            ch.send("Clan channel is now OFF\n")
            ch.comm = state_checks.SET_BIT(ch.comm, merc.COMM_NOCLAN)
        return
    if state_checks.IS_SET(ch.comm, merc.COMM_NOCHANNELS):
        ch.send("The gods have revoked your channel priviliges.\n")
        return
    ch.comm = state_checks.REMOVE_BIT(ch.comm, merc.COMM_NOCLAN)

    ch.send("You clan '%s'\n" % argument)
    for d in merc.descriptor_list:
        if d.is_connected(nanny.con_playing) and d.character != ch and ch.is_same_clan(d.character) \
                and not state_checks.IS_SET(d.character.comm, merc.COMM_NOCLAN) and not state_checks.IS_SET(d.character.comm,
                                                                                            merc.COMM_QUIET):
            merc.act("$n clans '$t'", ch, argument, d.character, merc.TO_VICT,
                     merc.POS_DEAD)
Ejemplo n.º 10
0
def do_nosummon(ch, argument):
    if ch.is_npc():
        if state_checks.IS_SET(ch.imm_flags, merc.IMM_SUMMON):
            ch.send("You are no longer immune to summon.\n")
            ch.imm_flags = state_checks.REMOVE_BIT(ch.imm_flags,
                                                   merc.IMM_SUMMON)
        else:
            ch.send("You are now immune to summoning.\n")
            ch.imm_flags = state_checks.SET_BIT(ch.imm_flags, merc.IMM_SUMMON)
    else:
        if ch.act.is_set(merc.PLR_NOSUMMON):
            ch.send("You are no longer immune to summon.\n")
            ch.act.rem_bit(merc.PLR_NOSUMMON)
        else:
            ch.send("You are now immune to summoning.\n")
            ch.act.set_bit(merc.PLR_NOSUMMON)
Ejemplo n.º 11
0
def do_protect(ch, argument):
    if not argument:
        ch.send("Protect whom from snooping?\n")
        return
    victim = ch.get_char_world(argument)
    if not victim:
        ch.send("You can't find them.\n")
        return
    if victim.comm.is_set(merc.COMM_SNOOP_PROOF):
        handler_game.act("$N is no longer snoop-proof.", ch, None, victim,
                         merc.TO_CHAR, merc.POS_DEAD)
        victim.send("Your snoop-proofing was just removed.\n")
        victim.comm = state_checks.REMOVE_BIT(victim.comm,
                                              merc.COMM_SNOOP_PROOF)
    else:
        handler_game.act("$N is now snoop-proof.", ch, None, victim,
                         merc.TO_CHAR, merc.POS_DEAD)
        victim.send("You are now immune to snooping.\n")
        victim.comm = state_checks.SET_BIT(victim.comm, merc.COMM_SNOOP_PROOF)
Ejemplo n.º 12
0
def do_pick(self, argument):
    ch = self
    argument, arg = game_utils.read_word(argument)

    if not arg:
        ch.send("Pick what?\n")
        return

    state_checks.WAIT_STATE(ch, const.skill_table["pick lock"].beats)

    # look for guards
    for gch_id in ch.in_room.people:
        gch = instance.characters[gch_id]
        if state_checks.IS_NPC(gch) and state_checks.IS_AWAKE(gch) and ch.level + 5 < gch.level:
            handler_game.act("$N is standing too close to the lock.", ch, None, gch, merc.TO_CHAR)
            return
        if not ch.is_npc() and random.randint(1, 99) > ch.get_skill("pick lock"):
            ch.send("You failed.\n")
            if ch.is_pc():
                ch.check_improve( "pick lock", False, 2)
            return
        obj = ch.get_item_here(arg)
        if obj:
            # portal stuff
            if obj.item_type == merc.ITEM_PORTAL:
                if not state_checks.IS_SET(obj.value[1], merc.EX_ISDOOR):
                    ch.send("You can't do that.\n")
                    return
                if not state_checks.IS_SET(obj.value[1], merc.EX_CLOSED):
                    ch.send("It's not closed.\n")
                    return
                if obj.value[4] < 0:
                    ch.send("It can't be unlocked.\n")
                    return
                if state_checks.IS_SET(obj.value[1], merc.EX_PICKPROOF):
                    ch.send("You failed.\n")
                    return
                state_checks.REMOVE_BIT(obj.value[1], merc.EX_LOCKED)
                handler_game.act("You pick the lock on $p.", ch, obj, None, merc.TO_CHAR)
                handler_game.act("$n picks the lock on $p.", ch, obj, None, merc.TO_ROOM)
                if ch.is_pc():
                    ch.check_improve( "pick lock", True, 2)
                return


                # 'pick object'
            if obj.item_type != merc.ITEM_CONTAINER:
                ch.send("That's not a container.\n")
                return
            if not state_checks.IS_SET(obj.value[1], merc.CONT_CLOSED):
                ch.send("It's not closed.\n")
                return
            if obj.value[2] < 0:
                ch.send("It can't be unlocked.\n")
                return
            if not state_checks.IS_SET(obj.value[1], merc.CONT_LOCKED):
                ch.send("It's already unlocked.\n")
                return
            if state_checks.IS_SET(obj.value[1], merc.CONT_PICKPROOF):
                ch.send("You failed.\n")
                return

            state_checks.REMOVE_BIT(obj.value[1], merc.CONT_LOCKED)
            handler_game.act("You pick the lock on $p.", ch, obj, None, merc.TO_CHAR)
            handler_game.act("$n picks the lock on $p.", ch, obj, None, merc.TO_ROOM)
            if ch.is_pc():
                ch.check_improve( "pick lock", True, 2)
            return
        door = handler_room.find_door(ch, arg)
        if door >= 0:
            # 'pick door'
            pexit = ch.in_room.exit[door]
            if not pexit.exit_info.is_set(merc.EX_CLOSED) and not ch.is_immortal():
                ch.send("It's not closed.\n")
                return
            if pexit.key < 0 and not ch.is_immortal():
                ch.send("It can't be picked.\n")
                return
            if not pexit.exit_info.is_set(merc.EX_LOCKED):
                ch.send("It's already unlocked.\n")
                return
            if pexit.exit_info.is_set(merc.EX_PICKPROOF) and not ch.is_immortal():
                ch.send("You failed.\n")
                return
            pexit.exit_info.rem_bit(merc.EX_LOCKED)
            ch.send("*Click*\n")
            handler_game.act("$n picks the $d.", ch, None, pexit.keyword, merc.TO_ROOM)
            if ch.is_pc():
                ch.check_improve( "pick_lock", True, 2)

            # unlock the other side
            to_room = pexit.to_room
            if to_room and to_room.exit[merc.rev_dir[door]] != 0 \
                    and to_room.exit[merc.rev_dir[door]].to_room == ch.in_room:
                to_room.exit[merc.rev_dir[door]].exit_info.rem_bit(merc.EX_LOCKED)
Ejemplo n.º 13
0
def do_unlock(ch, argument):
    argument, arg = game_utils.read_word(argument)

    if not arg:
        ch.send("Unlock what?\n")
        return
    obj = ch.get_item_here(arg)
    if obj:
        # portal stuff */
        if obj.item_type == merc.ITEM_PORTAL:
            if not state_checks.IS_SET(obj.value[1], merc.EX_ISDOOR):
                ch.send("You can't do that.\n")
                return
            if not state_checks.IS_SET(obj.value[1], merc.EX_CLOSED):
                ch.send("It's not closed.\n")
                return
            if obj.value[4] < 0:
                ch.send("It can't be unlocked.\n")
                return
            if not ch.has_key(obj.value[4]):
                ch.send("You lack the key.\n")
                return
            if not state_checks.IS_SET(obj.value[1], merc.EX_LOCKED):
                ch.send("It's already unlocked.\n")
                return
            state_checks.REMOVE_BIT(obj.value[1], merc.EX_LOCKED)
            handler_game.act("You unlock $p.", ch, obj, None, merc.TO_CHAR)
            handler_game.act("$n unlocks $p.", ch, obj, None, merc.TO_ROOM)
            return
            # 'unlock object'
        if obj.item_type != merc.ITEM_CONTAINER:
            ch.send("That's not a container.\n")
            return
        if not state_checks.IS_SET(obj.value[1], merc.CONT_CLOSED):
            ch.send("It's not closed.\n")
            return
        if obj.value[2] < 0:
            ch.send("It can't be unlocked.\n")
            return
        if not ch.has_key(obj.value[2]):
            ch.send("You lack the key.\n")
            return
        if not state_checks.IS_SET(obj.value[1], merc.CONT_LOCKED):
            ch.send("It's already unlocked.\n")
            return

        state_checks.REMOVE_BIT(obj.value[1], merc.CONT_LOCKED)
        handler_game.act("You unlock $p.", ch, obj, None, merc.TO_CHAR)
        handler_game.act("$n unlocks $p.", ch, obj, None, merc.TO_ROOM)
        return

    door = handler_room.find_door(ch, arg)
    if door >= 0:
        # 'unlock door'
        pexit = ch.in_room.exit[door]
        if not pexit.exit_info.is_set(merc.EX_CLOSED):
            ch.send("It's not closed.\n")
            return
        if pexit.key < 0:
            ch.send("It can't be unlocked.\n")
            return
        if not ch.has_key(pexit.key):
            ch.send("You lack the key.\n")
            return
        if not pexit.exit_info.is_set(merc.EX_LOCKED):
            ch.send("It's already unlocked.\n")
            return
        pexit.exit_info.rem_bit(merc.EX_LOCKED)
        ch.send("*Click*\n")
        handler_game.act("$n unlocks the $d.", ch, None, pexit.keyword, merc.TO_ROOM)

        # unlock the other side */
        to_room = pexit.to_room
        if to_room and to_room.exit[merc.rev_dir[door]] != 0 \
                and to_room.exit[merc.rev_dir[door]].to_room == ch.in_room:
            to_room.exit[merc.rev_dir[door]].exit_info.rem_bit(merc.EX_LOCKED)
Ejemplo n.º 14
0
def do_open(ch, argument):
    argument, arg = game_utils.read_word(argument)
    if not arg:
        ch.send("Open what?\n")
        return

    item = ch.get_item_here(arg)
    if item:
        # open portal
        if item.item_type == merc.ITEM_PORTAL:
            if not state_checks.IS_SET(item.value[1], merc.EX_ISDOOR):
                ch.send("You can't do that.\n")
                return
            if not state_checks.IS_SET(item.value[1], merc.EX_CLOSED):
                ch.send("It's already open.\n")
                return
            if state_checks.IS_SET(item.value[1], merc.EX_LOCKED):
                ch.send("It's locked.\n")
                return
            item.value[1] = state_checks.REMOVE_BIT(item.value[1],
                                                    merc.EX_CLOSED)
            handler_game.act("You open $p.", ch, item, None, merc.TO_CHAR)
            handler_game.act("$n opens $p.", ch, item, None, merc.TO_ROOM)
            return
            # 'open object'
        if item.item_type != merc.ITEM_CONTAINER:
            ch.send("That's not a container.\n")
            return
        if not state_checks.IS_SET(item.value[1], merc.CONT_CLOSED):
            ch.send("It's already open.\n")
            return
        if not state_checks.IS_SET(item.value[1], merc.CONT_CLOSEABLE):
            ch.send("You can't do that.\n")
            return
        if state_checks.IS_SET(item.value[1], merc.CONT_LOCKED):
            ch.send("It's locked.\n")
            return
        item.value[1] = state_checks.REMOVE_BIT(item.value[1],
                                                merc.CONT_CLOSED)
        handler_game.act("You open $p.", ch, item, None, merc.TO_CHAR)
        handler_game.act("$n opens $p.", ch, item, None, merc.TO_ROOM)
        return

    door = handler_room.find_door(ch, arg)
    if door >= 0:
        # 'open door'
        pexit = ch.in_room.exit[door]
        if not pexit.exit_info.is_set(merc.EX_CLOSED):
            ch.send("It's already open.\n")
            return
        if pexit.exit_info.is_set(merc.EX_LOCKED):
            ch.send("It's locked.\n")
            return
        pexit.exit_info.rem_bit(merc.EX_CLOSED)
        handler_game.act("$n opens the $d.", ch, None, pexit.keyword,
                         merc.TO_ROOM)
        ch.send("Ok.\n")

        # open the other side
        to_room = instance.rooms[pexit.to_room]
        pexit_rev = to_room.exit[merc.rev_dir[door]] if pexit.to_room else None
        if to_room and pexit_rev and pexit_rev.to_room == ch.in_room.instance_id:
            pexit_rev.exit_info.rem_bit(merc.EX_CLOSED)
            for rch_id in to_room.people[:]:
                rch = instance.characters[rch_id]
                handler_game.act("The $d opens.", rch, None, pexit_rev.keyword,
                                 merc.TO_CHAR)
Ejemplo n.º 15
0
def spell_bless(sn, level, ch, victim, target):
    # deal with the object case first */
    if target == merc.TARGET_ITEM:
        obj = victim
        if obj.flags.bless:
            handler_game.act("$p is already blessed.",
                             ch,
                             obj,
                             send_to=merc.TO_CHAR)
            return
        if obj.flags.evil:
            paf = state_checks.affect_find(obj.affected, "curse")
            level = obj.level
            if paf:
                level = paf.level
            if not handler_magic.saves_dispel(level, level, 0):
                if paf:
                    obj.affect_remove(paf)
                    handler_game.act("$p glows a pale blue.", ch, obj, None,
                                     merc.TO_ALL)
                    obj.extra_bits = state_checks.REMOVE_BIT(
                        obj.extra_flags, merc.ITEM_EVIL)
                    return
                else:
                    handler_game.act(
                        "The evil of $p is too powerful for you to overcome.",
                        ch,
                        obj,
                        send_to=merc.TO_CHAR)
                    return
        af = handler_game.AFFECT_DATA()
        af.where = merc.TO_OBJECT
        af.type = sn
        af.level = level
        af.duration = 6 + level
        af.location = merc.APPLY_SAVES
        af.modifier = -1
        af.bitvector = merc.ITEM_BLESS
        obj.affect_add(af)
        handler_game.act("$p glows with a holy aura.",
                         ch,
                         obj,
                         send_to=merc.TO_ALL)
        if obj.wear_loc != merc.WEAR_NONE:
            ch.saving_throw = ch.saving_throw - 1
        return

    # character target */
    if victim.position == merc.POS_FIGHTING or state_checks.is_affected(
            victim, sn):
        if victim == ch:
            ch.send("You are already blessed.\n")
        else:
            handler_game.act("$N already has divine favor.", ch, None, victim,
                             merc.TO_CHAR)
        return

    af = handler_game.AFFECT_DATA()
    af.where = merc.TO_AFFECTS
    af.type = sn
    af.level = level
    af.duration = 6 + level
    af.location = merc.APPLY_HITROLL
    af.modifier = level // 8
    af.bitvector = 0
    victim.affect_add(af)

    af.location = merc.APPLY_SAVING_SPELL
    af.modifier = 0 - level // 8
    victim.affect_add(af)
    victim.send("You feel righteous.\n")
    if ch is not victim:
        handler_game.act("You grant $N the favor of your god.", ch, None,
                         victim, merc.TO_CHAR)
Ejemplo n.º 16
0
def spell_curse(sn, level, ch, victim, target):
    # deal with the object case first */
    if target == merc.TARGET_ITEM:
        obj = victim
        if obj.flags.evil:
            handler_game.act("$p is already filled with evil.", ch, obj, None,
                             merc.TO_CHAR)
            return

        if obj.flags.bless:
            paf = state_checks.affect_find(obj.affected,
                                           const.skill_table["bless"])
            if not handler_magic.saves_dispel(
                    level, paf.level if paf is not None else obj.level, 0):
                if paf:
                    obj.affect_remove(paf)
                handler_game.act("$p glows with a red aura.", ch, obj, None,
                                 merc.TO_ALL)
                state_checks.REMOVE_BIT(obj.extra_flags, merc.ITEM_BLESS)
                return
            else:
                handler_game.act(
                    "The holy aura of $p is too powerful for you to overcome.",
                    ch, obj, None, merc.TO_CHAR)
                return
        af = handler_game.AFFECT_DATA()
        af.where = merc.TO_OBJECT
        af.type = sn
        af.level = level
        af.duration = 2 * level
        af.location = merc.APPLY_SAVES
        af.modifier = +1
        af.bitvector = merc.ITEM_EVIL
        obj.affect_add(af)

        handler_game.act("$p glows with a malevolent aura.", ch, obj, None,
                         merc.TO_ALL)

        if obj.wear_loc != merc.WEAR_NONE:
            ch.saving_throw += 1
        return

    # character curses */
    if victim.is_affected(merc.AFF_CURSE) or handler_magic.saves_spell(
            level, victim, merc.DAM_NEGATIVE):
        return
    af = handler_game.AFFECT_DATA()
    af.where = merc.TO_AFFECTS
    af.type = sn
    af.level = level
    af.duration = 2 * level
    af.location = merc.APPLY_HITROLL
    af.modifier = -1 * (level // 8)
    af.bitvector = merc.AFF_CURSE
    victim.affect_add(af)

    af.location = merc.APPLY_SAVING_SPELL
    af.modifier = level // 8
    victim.affect_add(af)

    victim.send("You feel unclean.\n")
    if ch != victim:
        handler_game.act("$N looks very uncomfortable.", ch, None, victim,
                         merc.TO_CHAR)