示例#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)
示例#3
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)
示例#4
0
def spell_frost_breath(sn, level, ch, victim, target):
    handler_game.act("$n breathes out a freezing cone of frost! ", ch, None, victim, merc.TO_NOTVICT)
    handler_game.act("$n breathes a freezing cone of frost over you! ", ch, None, victim, merc.TO_VICT)
    handler_game.act("You breath out a cone of frost.", ch, None, None, merc.TO_CHAR)

    hpch = max(12, ch.hit)
    hp_dam = random.randint(hpch // 11 + 1, hpch // 6)
    dice_dam = game_utils.dice(level, 16)

    dam = max(hp_dam + dice_dam // 10, dice_dam + hp_dam // 10)
    effects.cold_effect(victim.in_room, level, dam // 2, merc.TARGET_ROOM)

    for vch in victim.in_room.people[:]:
        if fight.is_safe_spell(ch, vch, True) or (vch.is_npc() and ch.is_npc() and (ch.fighting != vch or vch.fighting != ch)):
            continue

        if vch == victim:  # full damage */
            if handler_magic.saves_spell(level, vch, merc.DAM_COLD):
                effects.cold_effect(vch, level // 2, dam // 4, merc.TARGET_CHAR)
                fight.damage(ch, vch, dam // 2, sn, merc.DAM_COLD, True)
            else:
                effects.cold_effect(vch, level, dam, merc.TARGET_CHAR)
                fight.damage(ch, vch, dam, sn, merc.DAM_COLD, True)
        else:
            if handler_magic.saves_spell(level - 2, vch, merc.DAM_COLD):
                effects.cold_effect(vch, level // 4, dam // 8, merc.TARGET_CHAR)
                fight.damage(ch, vch, dam // 4, sn, merc.DAM_COLD, True)
            else:
                effects.cold_effect(vch, level // 2, dam // 4, merc.TARGET_CHAR)
                fight.damage(ch, vch, dam // 2, sn, merc.DAM_COLD, True)
示例#5
0
def spell_chain_lightning(sn, level, ch, victim, target):
    # H first strike */
    handler_game.act("A lightning bolt leaps from $n's hand and arcs to $N.",
                     ch, None, victim, merc.TO_ROOM)
    handler_game.act("A lightning bolt leaps from your hand and arcs to $N.",
                     ch, None, victim, merc.TO_CHAR)
    handler_game.act("A lightning bolt leaps from $n's hand and hits you! ",
                     ch, None, victim, merc.TO_VICT)

    dam = game_utils.dice(level, 6)
    if handler_magic.saves_spell(level, victim, merc.DAM_LIGHTNING):
        dam = dam // 3
    fight.damage(ch, victim, dam, sn, merc.DAM_LIGHTNING, True)
    last_vict = victim
    level = level - 4  # decrement damage */

    # new targets */
    while level > 0:
        found = False
        for tmp_vict_id in ch.in_room.people:
            tmp_vict = instance.characters[tmp_vict_id]
            if not fight.is_safe_spell(ch, tmp_vict,
                                       True) and tmp_vict is not last_vict:
                found = True
                last_vict = tmp_vict
                handler_game.act("The bolt arcs to $n! ", tmp_vict, None, None,
                                 merc.TO_ROOM)
                handler_game.act("The bolt hits you! ", tmp_vict, None, None,
                                 merc.TO_CHAR)
                dam = game_utils.dice(level, 6)
                if handler_magic.saves_spell(level, tmp_vict,
                                             merc.DAM_LIGHTNING):
                    dam = dam // 3
                fight.damage(ch, tmp_vict, dam, sn, merc.DAM_LIGHTNING, True)
                level = level - 4  # decrement damage */

        if not found:  # no target found, hit the caster */
            if ch == None:
                return

            if last_vict == ch:  # no double hits */
                handler_game.act("The bolt seems to have fizzled out.", ch,
                                 None, None, merc.TO_ROOM)
                handler_game.act("The bolt grounds out through your body.", ch,
                                 None, None, merc.TO_CHAR)
                return

            last_vict = ch
            handler_game.act("The bolt arcs to $n...whoops! ", ch, None, None,
                             merc.TO_ROOM)
            ch.send("You are struck by your own lightning! \n")
            dam = game_utils.dice(level, 6)
            if handler_magic.saves_spell(level, ch, merc.DAM_LIGHTNING):
                dam = dam // 3
            fight.damage(ch, ch, dam, sn, merc.DAM_LIGHTNING, True)
            level = level - 4  # decrement damage */
            if ch == None:
                return
def spell_chain_lightning(sn, level, ch, victim, target):
    # H first strike */
    handler_game.act("A lightning bolt leaps from $n's hand and arcs to $N.", ch, None, victim, merc.TO_ROOM)
    handler_game.act("A lightning bolt leaps from your hand and arcs to $N.", ch, None, victim, merc.TO_CHAR)
    handler_game.act("A lightning bolt leaps from $n's hand and hits you! ", ch, None, victim, merc.TO_VICT)

    dam = game_utils.dice(level, 6)
    if handler_magic.saves_spell(level, victim, merc.DAM_LIGHTNING):
        dam = dam // 3
    fight.damage(ch, victim, dam, sn, merc.DAM_LIGHTNING, True)
    last_vict = victim
    level = level - 4  # decrement damage */

    # new targets */
    while level > 0:
        found = False
        for tmp_vict_id in ch.in_room.people:
            tmp_vict = instance.characters[tmp_vict_id]
            if not fight.is_safe_spell(ch, tmp_vict, True) and tmp_vict is not last_vict:
                found = True
                last_vict = tmp_vict
                handler_game.act("The bolt arcs to $n! ", tmp_vict, None, None, merc.TO_ROOM)
                handler_game.act("The bolt hits you! ", tmp_vict, None, None, merc.TO_CHAR)
                dam = game_utils.dice(level, 6)
                if handler_magic.saves_spell(level, tmp_vict, merc.DAM_LIGHTNING):
                    dam = dam // 3
                fight.damage(ch, tmp_vict, dam, sn, merc.DAM_LIGHTNING, True)
                level = level - 4  # decrement damage */

        if not found:  # no target found, hit the caster */
            if ch == None:
                return

            if last_vict == ch:  # no double hits */
                handler_game.act("The bolt seems to have fizzled out.", ch, None, None, merc.TO_ROOM)
                handler_game.act("The bolt grounds out through your body.", ch, None, None, merc.TO_CHAR)
                return

            last_vict = ch
            handler_game.act("The bolt arcs to $n...whoops! ", ch, None, None, merc.TO_ROOM)
            ch.send("You are struck by your own lightning! \n")
            dam = game_utils.dice(level, 6)
            if handler_magic.saves_spell(level, ch, merc.DAM_LIGHTNING):
                dam = dam // 3
            fight.damage(ch, ch, dam, sn, merc.DAM_LIGHTNING, True)
            level = level - 4  # decrement damage */
            if ch == None:
                return
示例#7
0
def spell_ray_of_truth(sn, level, ch, victim, target):
    if ch.is_evil():
        victim = ch
        ch.send("The energy explodes inside you! \n")
    if victim != ch:
        handler_game.act("$n raises $s hand, and a blinding ray of light shoots forth! ", ch, None, None, merc.TO_ROOM)
        ch.send("You raise your hand and a blinding ray of light shoots forth! \n")

    if state_checks.IS_GOOD(victim):
        handler_game.act("$n seems unharmed by the light.", victim, None, victim, merc.TO_ROOM)
        victim.send("The light seems powerless to affect you.\n")
        return

    dam = game_utils.dice(level, 10)
    if handler_magic.saves_spell(level, victim, merc.DAM_HOLY):
        dam = dam // 2

    align = victim.alignment
    align -= 350

    if align < -1000:
        align = -1000 + (align + 1000) // 3

    dam = (dam * align * align) // 1000000

    fight.damage(ch, victim, dam, sn, merc.DAM_HOLY, True)
    const.skill_table['blindness'].spell_fun('blindness', 3 * level // 4, ch, victim, merc.TARGET_CHAR)
示例#8
0
def spell_nexus(sn, level, ch, victim, target):
    from_room = ch.in_room
    victim = ch.get_char_world(handler_magic.target_name)
    to_room = victim.in_room

    if not victim \
            or victim == ch \
            or not to_room \
            or not ch.can_see_room(to_room.instance_id) or not ch.can_see_room(from_room.instance_id) \
            or state_checks.IS_SET(to_room.room_flags, merc.ROOM_SAFE) \
            or state_checks.IS_SET(from_room.room_flags, merc.ROOM_SAFE) \
            or state_checks.IS_SET(to_room.room_flags, merc.ROOM_PRIVATE) \
            or state_checks.IS_SET(to_room.room_flags, merc.ROOM_SOLITARY) \
            or state_checks.IS_SET(to_room.room_flags, merc.ROOM_NO_RECALL) \
            or state_checks.IS_SET(from_room.room_flags, merc.ROOM_NO_RECALL) \
            or victim.level >= level + 3 \
            or (not victim.is_npc() and victim.level >= merc.LEVEL_HERO) \
            or (victim.is_npc() and state_checks.IS_SET(victim.imm_flags, merc.IMM_SUMMON)) \
            or (victim.is_npc() and handler_magic.saves_spell(level, victim, merc.DAM_NONE) ) \
            or (victim.is_clan() and not ch.is_same_clan(victim)):
        ch.send("You failed.\n")
        return

    stone = ch.slots.held
    if not ch.is_immortal() and (stone is None or stone.item_type != merc.ITEM_WARP_STONE):
        ch.send("You lack the proper component for this spell.\n")
        return

    if stone and stone.item_type == merc.ITEM_WARP_STONE:
        handler_game.act("You draw upon the power of $p.", ch, stone, None, merc.TO_CHAR)
        handler_game.act("It flares brightly and vanishes! ", ch, stone, None, merc.TO_CHAR)
        ch.unequip(stone.equipped_to)
        ch.get(stone)
        stone.extract()

    # portal one */
    portal = object_creator.create_item(instance.item_templates[merc.OBJ_VNUM_PORTAL], 0)
    portal.timer = 1 + level // 10
    portal.value[3] = to_room.instance_id

    from_room.put(portal)

    handler_game.act("$p rises up from the ground.", ch, portal, None, merc.TO_ROOM)
    handler_game.act("$p rises up before you.", ch, portal, None, merc.TO_CHAR)

    # no second portal if rooms are the same */
    if to_room == from_room:
        return

    # portal two */
    portal = object_creator.create_item(instance.item_templates[merc.OBJ_VNUM_PORTAL], 0)
    portal.timer = 1 + level // 10
    portal.value[3] = from_room.instance_id

    to_room.put(portal)

    if to_room.people:
        vch = instance.characters[to_room.people[0]]
        handler_game.act("$p rises up from the ground.", vch, portal, None, merc.TO_ROOM)
        handler_game.act("$p rises up from the ground.", vch, portal, None, merc.TO_CHAR)
示例#9
0
def poison_effect(vo, level, dam, target):
    if target == merc.TARGET_ROOM:  # nail objects on the floor */
        room = vo
        for item_id in room.inventory[:]:
            item = instance.items[item_id]
            poison_effect(item, level, dam, merc.TARGET_ITEM)
        return

    if target == merc.TARGET_CHAR:  # do the effect on a victim */
        victim = vo
        # chance of poisoning */
        if not handler_magic.saves_spell(level // 4 + dam // 20, victim,
                                         merc.DAM_POISON):
            af = handler_game.AFFECT_DATA()

            victim.send("You feel poison coursing through your veins.\n\r")
            handler_game.act("$n looks very ill.", victim, None, None,
                             merc.TO_ROOM)

            af.where = merc.TO_AFFECTS
            af.type = 'poison'
            af.level = level
            af.duration = level // 2
            af.location = merc.APPLY_STR
            af.modifier = -1
            af.bitvector = merc.AFF_POISON
            victim.affect_join(af)
            # equipment */
        for item_id in victim.inventory[:]:
            item = instance.items[item_id]
            poison_effect(item, level, dam, merc.TARGET_ITEM)
        return
    if target == merc.TARGET_ITEM:  # do some poisoning */
        item = vo
        if item.flags.burn_proof or item.flags.bless or random.randint(0,
                                                                       4) == 0:
            return

        chance = level // 4 + dam // 10
        if chance > 25:
            chance = (chance - 25) // 2 + 25
        if chance > 50:
            chance = (chance - 50) // 2 + 50

        chance -= item.level * 2

        if item.item_type == merc.ITEM_FOOD:
            pass
        if item.item_type == merc.ITEM_DRINK_CON:
            if item.value[0] == item.value[1]:
                return
        else:
            return
        chance = max(5, min(chance, 95))

        if random.randint(1, 99) > chance:
            return

        item.value[3] = 1
        return
def spl_dispel_magic(sn, level, ch, victim, target):
    if victim != ch and (handler_magic.saves_spell(level, victim)
                         or level < victim.level):
        ch.send("You failed.\n")
        return

    if not victim.affected:
        ch.send("Nothing happens.\n")
        return

    for aff in victim.affected[:]:
        victim.affect_remove(aff)

    if ch == victim:
        handler_game.act("You remove all magical affects from yourself.", ch,
                         None, None, merc.TO_CHAR)
        handler_game.act("$n has removed all magical affects from $mself.", ch,
                         None, None, merc.TO_ROOM)
    else:
        handler_game.act("You remove all magical affects from $N.", ch, None,
                         victim, merc.TO_CHAR)
        handler_game.act("$n has removed all magical affects from $N.", ch,
                         None, victim, merc.TO_NOTVICT)
        handler_game.act("$n has removed all magical affects from you.", ch,
                         None, victim, merc.TO_VICT)
示例#11
0
def spl_charm_person(sn, level, ch, victim, target):
    if ch == victim:
        ch.send("You like yourself even better!\n")
        return

    if not victim.is_npc() and victim.immune.is_set(merc.IMM_CHARM):
        ch.send("You failed.\n")
        return

    # I don't want people charming ghosts and stuff - KaVir
    if victim.is_npc() and victim.is_affected(merc.AFF_ETHEREAL):
        ch.send("You failed.\n")
        return

    if victim.is_immortal():
        ch.send("You can cast puny mortal magic on immortals!\n")
        return

    if victim.is_affected(merc.AFF_CHARM) or ch.is_affected(
            merc.AFF_CHARM
    ) or level < victim.level or handler_magic.saves_spell(level, victim):
        return

    if victim.master:
        victim.stop_follower()

    victim.add_follower(ch)
    aff = handler_game.AffectData(type=sn,
                                  duration=game_utils.number_fuzzy(level // 4),
                                  bitvector=merc.AFF_CHARM)
    victim.affect_add(aff)
    handler_game.act("Isn't $n just so nice?", ch, None, victim, merc.TO_VICT)

    if ch != victim:
        ch.send("Ok.\n")
示例#12
0
def spl_web(sn, level, ch, victim, target):
    handler_game.act(
        "You point your finger at $N and a web flies from your hand!", ch,
        None, victim, merc.TO_CHAR)
    handler_game.act("$n points $s finger at $N and a web flies from $s hand!",
                     ch, None, victim, merc.TO_NOTVICT)
    handler_game.act(
        "$n points $s finger at you and a web flies from $s hand!", ch, None,
        victim, merc.TO_VICT)

    if victim.is_affected(merc.AFF_WEBBED):
        ch.send("But they are already webbed!\n")
        return

    if fight.is_safe(ch, victim):
        return

    if handler_magic.saves_spell(
            level, victim) and victim.position >= merc.POS_FIGHTING:
        victim.send("You dodge the web!\n")
        handler_game.act("$n dodges the web!", victim, None, None,
                         merc.TO_ROOM)
        return

    aff = handler_game.AffectData(type=sn,
                                  location=merc.APPLY_AC,
                                  modifier=200,
                                  duration=game_utils.number_range(1, 2),
                                  bitvector=merc.AFF_WEBBED)
    victim.affect_join(aff)
    victim.send("You are coated in a sticky web!\n")
    handler_game.act("$n is coated in a sticky web!", victim, None, None,
                     merc.TO_ROOM)
示例#13
0
def spl_energy_drain(sn, level, ch, victim, target):
    if handler_magic.saves_spell(level, victim):
        return

    if not ch.is_hero():
        ch.alignment = max(-1000, ch.alignment - 200)

    if victim.level <= 2:
        dam = ch.hit + 1
    else:
        dam = game_utils.dice(1, level)

        if victim.is_npc() or not victim.immune.is_set(merc.IMM_DRAIN):
            victim.mana //= 2
            victim.move //= 2
            ch.hit += dam

            if ch.hit > (2 * ch.max_hit):
                ch.hit = (2 * ch.max_hit)

    fight.damage(
        ch, victim, 0 if (not victim.is_npc()
                          and victim.immune.is_set(merc.IMM_DRAIN)) else dam,
        sn)

    if not ch.is_npc() and ch != victim:
        ch.beastlike()
示例#14
0
def spell_gas_breath(sn, level, ch, victim, target):
    handler_game.act("$n breathes out a cloud of poisonous gas! ", ch, None,
                     None, merc.TO_ROOM)
    handler_game.act("You breath out a cloud of poisonous gas.", ch, None,
                     None, merc.TO_CHAR)

    hpch = max(16, ch.hit)
    hp_dam = random.randint(hpch // 15 + 1, 8)
    dice_dam = game_utils.dice(level, 12)

    dam = max(hp_dam + dice_dam // 10, dice_dam + hp_dam // 10)
    effects.poison_effect(ch.in_room, level, dam, merc.TARGET_ROOM)

    for vch_id in ch.in_room.people:

        vch = instance.characters[vch_id]
        if fight.is_safe_spell(
                ch, vch, True) or (ch.is_npc() and vch.is_npc() and
                                   (ch.fighting == vch or vch.fighting == ch)):
            continue

        if handler_magic.saves_spell(level, vch, merc.DAM_POISON):
            effects.poison_effect(vch, level // 2, dam // 4, merc.TARGET_CHAR)
            fight.damage(ch, vch, dam // 2, sn, merc.DAM_POISON, True)
        else:
            effects.poison_effect(vch, level, dam, merc.TARGET_CHAR)
            fight.damage(ch, vch, dam, sn, merc.DAM_POISON, True)
示例#15
0
def spell_slow(sn, level, ch, victim, target):
    if state_checks.is_affected(victim, sn) or victim.is_affected( merc.AFF_SLOW):
        if victim == ch:
            ch.send("You can't move any slower! \n")
        else:
            handler_game.act("$N can't get any slower than that.", ch, None, victim, merc.TO_CHAR)
        return

    if handler_magic.saves_spell(level, victim, merc.DAM_OTHER) or state_checks.IS_SET(victim.imm_flags, merc.IMM_MAGIC):
        if victim != ch:
            ch.send("Nothing seemed to happen.\n")
        victim.send("You feel momentarily lethargic.\n")
        return

    if victim.is_affected( merc.AFF_HASTE):
        if not handler_magic.check_dispel(level, victim, const.skill_table['haste']):
            if victim != ch:
                ch.send("Spell failed.\n")
            victim.send("You feel momentarily slower.\n")
            return
        handler_game.act("$n is moving less quickly.", victim, None, None, merc.TO_ROOM)
        return

    af = handler_game.AFFECT_DATA()
    af.where = merc.TO_AFFECTS
    af.type = sn
    af.level = level
    af.duration = level // 2
    af.location = merc.APPLY_DEX
    af.modifier = -1 - (level >= 18) - (level >= 25) - (level >= 32)
    af.bitvector = merc.AFF_SLOW
    victim.affect_add(af)
    victim.send("You feel yourself slowing d o w n...\n")
    handler_game.act("$n starts to move in slow motion.", victim, None, None, merc.TO_ROOM)
示例#16
0
def spl_call_lightning(sn, level, ch, victim, target):
    if not ch.is_outside():
        ch.send("You must be out of doors.\n")
        return

    if handler_game.weather_info.sky < merc.SKY_RAINING:
        ch.send("You need bad weather.\n")
        return

    dam = game_utils.dice(level // 2, 8)
    ch.send("God's lightning strikes your foes!\n")
    handler_game.act("$n calls God's lightning to strike $s foes!", ch, None, None, merc.TO_ROOM)

    for vch in list(instance.characters.values()):
        if not vch.in_room:
            continue

        if vch.in_room == ch.in_room and vch != ch and (not vch.is_npc() if ch.is_npc() else vch.is_npc()):
            if vch.itemaff.is_set(merc.ITEMA_SHOCKSHIELD):
                continue

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

            fight.damage(ch, vch, 0 if (not vch.is_npc() and vch.immune.is_set(merc.IMM_LIGHTNING)) else dam, sn)
            continue

        if vch.in_room.area == ch.in_room.area and vch.is_outside() and vch.is_awake():
            vch.send("Lightning flashes in the sky.\n")
示例#17
0
def spell_ray_of_truth(sn, level, ch, victim, target):
    if ch.is_evil():
        victim = ch
        ch.send("The energy explodes inside you! \n")
    if victim != ch:
        handler_game.act(
            "$n raises $s hand, and a blinding ray of light shoots forth! ",
            ch, None, None, merc.TO_ROOM)
        ch.send(
            "You raise your hand and a blinding ray of light shoots forth! \n")

    if state_checks.IS_GOOD(victim):
        handler_game.act("$n seems unharmed by the light.", victim, None,
                         victim, merc.TO_ROOM)
        victim.send("The light seems powerless to affect you.\n")
        return

    dam = game_utils.dice(level, 10)
    if handler_magic.saves_spell(level, victim, merc.DAM_HOLY):
        dam = dam // 2

    align = victim.alignment
    align -= 350

    if align < -1000:
        align = -1000 + (align + 1000) // 3

    dam = (dam * align * align) // 1000000

    fight.damage(ch, victim, dam, sn, merc.DAM_HOLY, True)
    const.skill_table['blindness'].spell_fun('blindness', 3 * level // 4, ch,
                                             victim, merc.TARGET_CHAR)
示例#18
0
def spell_change_sex(sn, level, ch, victim, target):
    if state_checks.is_affected(victim, sn):
        if victim == ch:
            ch.send("You've already been changed.\n")
        else:
            handler_game.act("$N has already had $s(?) sex changed.", ch, None,
                             victim, merc.TO_CHAR)
        return

    if handler_magic.saves_spell(level, victim, merc.DAM_OTHER):
        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_SEX

    while af.modifier == 0:
        af.modifier = random.randint(0, 2) - victim.sex

    af.bitvector = 0
    victim.affect_add(af)
    victim.send("You feel different.\n")
    handler_game.act("$n doesn't look like $mself anymore...", victim, None,
                     None, merc.TO_ROOM)
def spl_general_purpose(sn, level, ch, victim, target):
    dam = game_utils.number_range(25, 100)

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

    fight.damage(ch, victim, dam, sn)
示例#20
0
def spell_summon(sn, level, ch, victim, target):
    victim = ch.get_char_world(handler_magic.target_name)
    if not victim \
            or victim == ch \
            or victim.in_room == None \
            or state_checks.IS_SET(ch.in_room.room_flags, merc.ROOM_SAFE) \
            or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_SAFE) \
            or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_PRIVATE) \
            or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_SOLITARY) \
            or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_NO_RECALL) \
            or (victim.is_npc() and victim.act.is_set(merc.ACT_AGGRESSIVE)) \
            or victim.level >= level + 3 \
            or (not victim.is_npc() and victim.level >= merc.LEVEL_IMMORTAL) \
            or victim.fighting is not None \
            or (victim.is_npc() and victim.imm_flags.is_set(merc.IMM_SUMMON)) \
            or (victim.is_npc() and victim.pShop is not None) \
            or (not victim.is_npc() and victim.act.is_set(merc.PLR_NOSUMMON)) \
            or (victim.is_npc() and handler_magic.saves_spell(level, victim, merc.DAM_OTHER)):
        ch.send("You failed.\n")
        return

    handler_game.act("$n disappears suddenly.", victim, None, None, merc.TO_ROOM)
    victim.in_room.get(victim)
    ch.in_room.put(victim)
    handler_game.act("$n arrives suddenly.", victim, None, None, merc.TO_ROOM)
    handler_game.act("$n has summoned you! ", ch, None, victim, merc.TO_VICT)
    victim.do_look("auto")
示例#21
0
def spell_chill_touch(sn, level, ch, victim, target):
    dam_each = [
        0, 0, 0, 6, 7, 8, 9, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16,
        16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22,
        22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 27
    ]

    level = min(level, len(dam_each) - 1)
    level = max(0, level)
    dam = random.randint(dam_each[level] // 2, dam_each[level] * 2)
    if not handler_magic.saves_spell(level, victim, merc.DAM_COLD):
        handler_game.act("$n turns blue and shivers.", victim, None, None,
                         merc.TO_ROOM)
        af = handler_game.AFFECT_DATA()
        af.where = merc.TO_AFFECTS
        af.type = sn
        af.level = level
        af.duration = 6
        af.location = merc.APPLY_STR
        af.modifier = -1
        af.bitvector = 0
        victim.affect_join(af)
    else:
        dam = dam // 2
    fight.damage(ch, victim, dam, sn, merc.DAM_COLD, True)
示例#22
0
 def spread_plague(self, plague_carrier):
     af = [af for af in plague_carrier.affected if af.type == 'plague']
     if not af:
         plague_carrier.affected_by.rem_bit(merc.AFF_PLAGUE)
         return
     af = af[0]
     if af.level == 1:
         return
     plague = handler_game.AFFECT_DATA()
     plague.where = merc.TO_AFFECTS
     plague.type = "plague"
     plague.level = af.level - 1
     plague.duration = random.randint(1, 2 * plague.level)
     plague.location = merc.APPLY_STR
     plague.modifier = -5
     plague.bitvector = merc.AFF_PLAGUE
     for vch_id in self.people[:]:
         vch = instance.characters[vch_id]
         if not handler_magic.saves_spell(plague.level - 2, vch, merc.DAM_DISEASE) \
                 and not vch.is_immortal() and not vch.is_affected(merc.AFF_PLAGUE) \
                 and random.randint(0, 5) == 0:
             vch.send("You feel hot and feverish.\n\r")
             handler_game.act("$n shivers and looks very ill.", vch, None,
                              None, merc.TO_ROOM)
             vch.affect_join(plague)
示例#23
0
def spell_chill_touch(sn, level, ch, victim, target):
    dam_each = [0,
                0, 0, 6, 7, 8, 9, 12, 13, 13, 13,
                14, 14, 14, 15, 15, 15, 16, 16, 16, 17,
                17, 17, 18, 18, 18, 19, 19, 19, 20, 20,
                20, 21, 21, 21, 22, 22, 22, 23, 23, 23,
                24, 24, 24, 25, 25, 25, 26, 26, 26, 27]

    level = min(level, len(dam_each) - 1)
    level = max(0, level)
    dam = random.randint(dam_each[level] // 2, dam_each[level] * 2)
    if not handler_magic.saves_spell(level, victim, merc.DAM_COLD):
        handler_game.act("$n turns blue and shivers.", victim, None, None, merc.TO_ROOM)
        af = handler_game.AFFECT_DATA()
        af.where = merc.TO_AFFECTS
        af.type = sn
        af.level = level
        af.duration = 6
        af.location = merc.APPLY_STR
        af.modifier = -1
        af.bitvector = 0
        victim.affect_join(af)
    else:
        dam = dam // 2
    fight.damage(ch, victim, dam, sn, merc.DAM_COLD, True)
示例#24
0
def spell_call_lightning(sn, level, ch, victim, target):
    if not state_checks.IS_OUTSIDE(ch):
        ch.send("You must be out of doors.\n")
        return

    if handler_game.weather_info.sky < merc.SKY_RAINING:
        ch.send("You need bad weather.\n")
        return

    dam = game_utils.dice(level // 2, 8)

    ch.send("Mota's lightning strikes your foes! \n")
    handler_game.act("$n calls Mota's lightning to strike $s foes! ", ch, None,
                     None, merc.TO_ROOM)

    for vch in instance.characters.values():
        if vch.in_room == None:
            continue
        if vch.in_room == ch.in_room:
            if vch is not ch and (not vch.is_npc()
                                  if ch.is_npc() else vch.is_npc()):
                fight.damage(
                    ch, vch, dam // 2 if handler_magic.saves_spell(
                        level, vch, merc.DAM_LIGHTNING) else dam, sn,
                    merc.DAM_LIGHTNING, True)
            continue

        if vch.in_room.area == ch.in_room.area and state_checks.IS_OUTSIDE(
                vch) and vch.is_awake():
            vch.send("Lightning flashes in the sky.\n")
示例#25
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")
示例#26
0
def shock_effect(vo, level, dam, target):
    if target == merc.TARGET_ROOM:
        room = vo
        for item_id in room.inventory[:]:
            item = instance.items[item_id]
            shock_effect(item, level, dam, merc.TARGET_ITEM)
        return

    if target == merc.TARGET_CHAR:
        victim = vo
        # daze and confused? */
        if not handler_magic.saves_spell(level // 4 + dam // 20, victim,
                                         merc.DAM_LIGHTNING):
            victim.send("Your muscles stop responding.\n\r")
            state_checks.DAZE_STATE(victim, max(12, level // 4 + dam / 20))
        # toast some gear */
        for item_id in victim.inventory[:]:
            item = instance.items[item_id]
            shock_effect(item, level, dam, merc.TARGET_ITEM)
        return
    if target == merc.TARGET_ITEM:
        item = vo
        if item.flags.burn_proof or item.flags.no_purge or random.randint(
                0, 4) == 0:
            return

        chance = level // 4 + dam // 10

        if chance > 25:
            chance = (chance - 25) // 2 + 25
        if chance > 50:
            chance = (chance - 50) // 2 + 50

        if item.flags.bless:
            chance -= 5

        chance -= item.level * 2

        if item.item_type == merc.ITEM_WAND \
                or item.item_type == merc.ITEM_STAFF:
            chance += 10
            msg = "$p overloads and explodes!"
        elif item.item_type == merc.ITEM_JEWELRY:
            chance -= 10
            msg = "$p is fused into a worthless lump."
        else:
            return
        chance = max(5, min(chance, 95))

        if random.randint(1, 99) > chance:
            return

        if item.in_living:
            handler_game.act(msg, item.in_living, item, None, merc.TO_ALL)
        elif item.in_room and item.in_room.people:
            handler_game.act(msg, item.in_room.people, item, None, merc.TO_ALL)
        item.extract()
        return
示例#27
0
def spell_ventriloquate(sn, level, ch, victim, target):
    target_name, speaker = game_utils.read_word(target_name)
    buf1 = "%s says '%s'.\n" % (speaker.capitalize(), target_name)
    buf2 = "Someone makes %s say '%s'.\n" % (speaker, target_name)

    for vch_id in ch.in_room.people:
        vch = instance.characters[vch_id]
        if not is_exact_name(speaker, vch.name) and state_checks.IS_AWAKE(vch):
            vch.send(buf2 if handler_magic.saves_spell(level, vch, merc.DAM_OTHER) else buf1)
示例#28
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")
示例#29
0
def spl_weaken(sn, level, ch, victim, target):
    if victim.is_affected(sn) or handler_magic.saves_spell(level, victim):
        return

    aff = handler_game.AffectData(type=sn, duration=level // 2, location=merc.APPLY_STR, modifier=-2)
    victim.affect_join(aff)
    victim.send("You feel weaker.\n")

    if ch != victim:
        ch.send("Ok.\n")
def spl_chaos_blast(sn, level, ch, victim, target):
    if victim.itemaff.is_set(merc.ITEMA_CHAOSSHIELD):
        return

    dam = game_utils.dice(level, 6)

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

    fight.damage(ch, victim, dam, sn)
示例#31
0
def spell_poison(sn, level, ch, victim, target):
    if target == merc.TARGET_ITEM:
        obj = victim

        if obj.item_type == merc.ITEM_FOOD or obj.item_type == merc.ITEM_DRINK_CON:
            if obj.flags.bless or obj.flags.burn_proof:
                handler_game.act("Your spell fails to corrupt $p.", ch, obj, None, merc.TO_CHAR)
                return
            obj.value[3] = 1
            handler_game.act("$p is infused with poisonous vapors.", ch, obj, None, merc.TO_ALL)
            return
        if obj.item_type == merc.ITEM_WEAPON:
            if state_checks.IS_WEAPON_STAT(obj, merc.WEAPON_FLAMING) \
                    or state_checks.IS_WEAPON_STAT(obj, merc.WEAPON_FROST) \
                    or state_checks.IS_WEAPON_STAT(obj, merc.WEAPON_VAMPIRIC) \
                    or state_checks.IS_WEAPON_STAT(obj, merc.WEAPON_SHARP) \
                    or state_checks.IS_WEAPON_STAT(obj, merc.WEAPON_VORPAL) \
                    or state_checks.IS_WEAPON_STAT(obj, merc.WEAPON_SHOCKING) \
                    or obj.flags.bless \
                    or obj.flags.burn_proof:
                handler_game.act("You can't seem to envenom $p.", ch, obj, None, merc.TO_CHAR)
                return
            if state_checks.IS_WEAPON_STAT(obj, merc.WEAPON_POISON):
                handler_game.act("$p is already envenomed.", ch, obj, None, merc.TO_CHAR)
                return
            af = handler_game.AFFECT_DATA()
            af.where = merc.TO_WEAPON
            af.type = sn
            af.level = level // 2
            af.duration = level // 8
            af.location = 0
            af.modifier = 0
            af.bitvector = merc.WEAPON_POISON
            obj.affect_add(af)
            handler_game.act("$p is coated with deadly venom.", ch, obj, None, merc.TO_ALL)
            return
        handler_game.act("You can't poison $p.", ch, obj, None, merc.TO_CHAR)
        return

    if handler_magic.saves_spell(level, victim, merc.DAM_POISON):
        handler_game.act("$n turns slightly green, but it passes.", victim, None, None, merc.TO_ROOM)
        victim.send("You feel momentarily ill, but it passes.\n")
        return

    af = handler_game.AFFECT_DATA()
    af.where = merc.TO_AFFECTS
    af.type = sn
    af.level = level
    af.duration = level
    af.location = merc.APPLY_STR
    af.modifier = -2
    af.bitvector = merc.AFF_POISON
    victim.affect_join(af)
    victim.send("You feel very sick.\n")
    handler_game.act("$n looks very ill.", victim, None, None, merc.TO_ROOM)
示例#32
0
def spl_gas_breath(sn, level, ch, victim, target):
    for vch_id in ch.in_room.people[:]:
        vch = instance.characters[vch_id]

        if not vch.is_npc() if ch.is_npc() else vch.is_npc():
            hpch = max(10, ch.hit)
            dam = game_utils.number_range(hpch // 16 + 1, hpch // 8)

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

            fight.damage(ch, vch, 0 if (not vch.is_npc() and vch.is_vampire()) else dam, sn)
示例#33
0
def spl_sleep(sn, level, ch, victim, target):
    if victim.is_affected(merc.AFF_SLEEP) or level < victim.level or (not victim.is_npc() and victim.immune.is_set(merc.IMM_SLEEP)) or \
            (victim.is_npc() and victim.is_affected(merc.AFF_ETHEREAL)) or handler_magic.saves_spell(level, victim):
        return

    aff = handler_game.AffectData(type=sn, duration=4 * level, location=merc.APPLY_NONE, bitvector=merc.AFF_SLEEP)
    victim.affect_add(aff)

    if victim.is_awake():
        victim.send("You feel very sleepy ..... zzzzzz.\n")
        handler_game.act("$n goes to sleep.", victim, None, None, merc.TO_ROOM)
        victim.position = merc.POS_SLEEPING
示例#34
0
def spell_magic_missile(sn, level, ch, victim, target):
    dam_each = [
        0, 3, 3, 4, 4, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9,
        9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13,
        13, 13, 13, 13, 14, 14, 14, 14, 14
    ]

    level = min(level, len(dam_each) - 1)
    level = max(0, level)
    dam = random.randint(dam_each[level] // 2, dam_each[level] * 2)
    if handler_magic.saves_spell(level, victim, merc.DAM_ENERGY):
        dam = dam // 2
    fight.damage(ch, victim, dam, sn, merc.DAM_ENERGY, True)
def spl_ventriloquate(sn, level, ch, victim, target):
    handler_magic.target_name, speaker = game_utils.read_word(
        handler_magic.target_name)

    buf1 = "{} says '{}'.\n".format(speaker, handler_magic.target_name)
    buf2 = "Someone makes {} say '{}'.\n".format(speaker,
                                                 handler_magic.target_name)

    for vch_id in ch.in_room.people[:]:
        vch = instance.characters[vch_id]

        if not game_utils.is_name(speaker, vch.name):
            vch.send(buf2 if handler_magic.saves_spell(level, vch) else buf1)
示例#36
0
def spell_fireball(sn, level, ch, victim, target):
    dam_each = [
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 35, 40, 45, 50, 55,
        60, 65, 70, 75, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104,
        106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130
    ]

    level = min(level, len(dam_each) - 1)
    level = max(0, level)
    dam = random.randint(dam_each[level] // 2, dam_each[level] * 2)
    if handler_magic.saves_spell(level, victim, merc.DAM_FIRE):
        dam = dam // 2
    fight.damage(ch, victim, dam, sn, merc.DAM_FIRE, True)
示例#37
0
def spell_burning_hands(sn, level, ch, victim, target):
    dam_each = [
        0, 0, 0, 0, 0, 14, 17, 20, 23, 26, 29, 29, 29, 30, 30, 31, 31, 32, 32,
        33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41,
        42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48, 48
    ]

    level = min(level, len(dam_each) - 1)
    level = max(0, level)
    dam = random.randint(dam_each[level] // 2, dam_each[level] * 2)
    if handler_magic.saves_spell(level, victim, merc.DAM_FIRE):
        dam = dam // 2
    fight.damage(ch, victim, dam, sn, merc.DAM_FIRE, True)
示例#38
0
def spl_acid_blast(sn, level, ch, victim, target):
    if victim.itemaff.is_set(merc.ITEMA_ACIDSHIELD):
        return

    dam = game_utils.dice(level, 6)

    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)
示例#39
0
def spell_lightning_bolt(sn, level, ch, victim, target):
    dam_each = [0,
                0, 0, 0, 0, 0, 0, 0, 0, 25, 28,
                31, 34, 37, 40, 40, 41, 42, 42, 43, 44,
                44, 45, 46, 46, 47, 48, 48, 49, 50, 50,
                51, 52, 52, 53, 54, 54, 55, 56, 56, 57,
                58, 58, 59, 60, 60, 61, 62, 62, 63, 64]

    level = min(level, len(dam_each) - 1)
    level = max(0, level)
    dam = random.randint(dam_each[level] // 2, dam_each[level] * 2)
    if handler_magic.saves_spell(level, victim, merc.DAM_LIGHTNING):
        dam = dam // 2
    fight.damage(ch, victim, dam, sn, merc.DAM_LIGHTNING, True)
示例#40
0
def spell_burning_hands(sn, level, ch, victim, target):
    dam_each = [0,
                0, 0, 0, 0, 14, 17, 20, 23, 26, 29,
                29, 29, 30, 30, 31, 31, 32, 32, 33, 33,
                34, 34, 35, 35, 36, 36, 37, 37, 38, 38,
                39, 39, 40, 40, 41, 41, 42, 42, 43, 43,
                44, 44, 45, 45, 46, 46, 47, 47, 48, 48]

    level = min(level, len(dam_each) - 1)
    level = max(0, level)
    dam = random.randint(dam_each[level] // 2, dam_each[level] * 2)
    if handler_magic.saves_spell(level, victim, merc.DAM_FIRE):
        dam = dam // 2
    fight.damage(ch, victim, dam, sn, merc.DAM_FIRE, True)
示例#41
0
def spell_weaken(sn, level, ch, victim, target):
    if state_checks.is_affected(victim, sn) or handler_magic.saves_spell(level, victim, merc.DAM_OTHER):
        return
    af = handler_game.AFFECT_DATA()
    af.where = merc.TO_AFFECTS
    af.type = sn
    af.level = level
    af.duration = level // 2
    af.location = merc.APPLY_STR
    af.modifier = -1 * (level // 5)
    af.bitvector = merc.AFF_WEAKEN
    victim.affect_add(af)
    victim.send("You feel your strength slip away.\n")
    handler_game.act("$n looks tired and weak.", victim, None, None, merc.TO_ROOM)
示例#42
0
def spell_blindness(sn, level, ch, victim, target):
    if victim.is_affected(merc.AFF_BLIND) or handler_magic.saves_spell(level, victim, merc.DAM_OTHER):
        return

    af = handler_game.AFFECT_DATA()
    af.where = merc.TO_AFFECTS
    af.type = sn
    af.level = level
    af.location = merc.APPLY_HITROLL
    af.modifier = -4
    af.duration = 1 + level
    af.bitvector = merc.AFF_BLIND
    victim.affect_add(af)
    victim.send("You are blinded! \n")
    handler_game.act("$n appears to be blinded.", victim, send_to=merc.TO_ROOM)
示例#43
0
def spell_colour_spray(sn, level, ch, victim, target):
    dam_each = [0,
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                30, 35, 40, 45, 50, 55, 55, 55, 56, 57,
                58, 58, 59, 60, 61, 61, 62, 63, 64, 64,
                65, 66, 67, 67, 68, 69, 70, 70, 71, 72,
                73, 73, 74, 75, 76, 76, 77, 78, 79, 79]

    level = min(level, len(dam_each) - 1)
    level = max(0, level)
    dam = random.randint(dam_each[level] // 2, dam_each[level] * 2)
    if handler_magic.saves_spell(level, victim, merc.DAM_LIGHT):
        dam //= 2
    else:
        const.skill_table["blindness"].spell_fun('blindness', level // 2, ch, victim, merc.TARGET_CHAR)

    fight.damage(ch, victim, dam, sn, merc.DAM_LIGHT, True)
示例#44
0
def spell_demonfire(sn, level, ch, victim, target):
    # RT replacement demonfire spell */
    if not ch.is_npc() and not ch.is_evil():
        victim = ch
        ch.send("The demons turn upon you! \n")

    ch.alignment = max(-1000, ch.alignment - 50)

    if victim != ch:
        handler_game.act("$n calls forth the demons of Hell upon $N! ", ch, None, victim, merc.TO_ROOM)
        handler_game.act("$n has assailed you with the demons of Hell! ", ch, None, victim, merc.TO_VICT)
        ch.send("You conjure forth the demons of hell! \n")
    dam = game_utils.dice(level, 10)
    if handler_magic.saves_spell(level, victim, merc.DAM_NEGATIVE):
        dam = dam // 2
    fight.damage(ch, victim, dam, sn, merc.DAM_NEGATIVE, True)
    const.skill_table['curse'].spell_fun('curse', 3 * level // 4, ch, victim, merc.TARGET_CHAR)
示例#45
0
def spell_lightning_breath(sn, level, ch, victim, target):
    handler_game.act("$n breathes a bolt of lightning at $N.", ch, None, victim, merc.TO_NOTVICT)
    handler_game.act("$n breathes a bolt of lightning at you! ", ch, None, victim, merc.TO_VICT)
    handler_game.act("You breathe a bolt of lightning at $N.", ch, None, victim, merc.TO_CHAR)

    hpch = max(10, ch.hit)
    hp_dam = random.randint(hpch // 9 + 1, hpch // 5)
    dice_dam = game_utils.dice(level, 20)

    dam = max(hp_dam + dice_dam // 10, dice_dam + hp_dam // 10)

    if handler_magic.saves_spell(level, victim, merc.DAM_LIGHTNING):
        effects.shock_effect(victim, level // 2, dam // 4, merc.TARGET_CHAR)
        fight.damage(ch, victim, dam // 2, sn, merc.DAM_LIGHTNING, True)
    else:
        effects.shock_effect(victim, level, dam, merc.TARGET_CHAR)
        fight.damage(ch, victim, dam, sn, merc.DAM_LIGHTNING, True)
示例#46
0
def spell_acid_breath(sn, level, ch, victim, target):
    # NPC spells.
    handler_game.act("$n spits acid at $N.", ch, None, victim, merc.TO_NOTVICT)
    handler_game.act("$n spits a stream of corrosive acid at you.", ch, None, victim, merc.TO_VICT)
    handler_game.act("You spit acid at $N.", ch, None, victim, merc.TO_CHAR)

    hpch = max(12, ch.hit)
    hp_dam = random.randint(hpch // 11 + 1, hpch // 6)
    dice_dam = game_utils.dice(level, 16)

    dam = max(hp_dam + dice_dam // 10, dice_dam + hp_dam // 10)

    if handler_magic.saves_spell(level, victim, merc.DAM_ACID):
        effects.acid_effect(victim, level // 2, dam // 4, merc.TARGET_CHAR)
        fight.damage(ch, victim, dam // 2, sn, merc.DAM_ACID, True)
    else:
        effects.acid_effect(victim, level, dam, merc.TARGET_CHAR)
        fight.damage(ch, victim, dam, sn, merc.DAM_ACID, True)
示例#47
0
def spell_dispel_good(sn, level, ch, victim, target):
    if not ch.is_npc() and ch.is_good():
        victim = ch

    if state_checks.IS_EVIL(victim):
        handler_game.act("$N is protected by $S evil.", ch, None, victim, merc.TO_ROOM)
        return

    if state_checks.IS_NEUTRAL(victim):
        handler_game.act("$N does not seem to be affected.", ch, None, victim, merc.TO_CHAR)
        return

    if victim.hit > (ch.level * 4):
        dam = game_utils.dice(level, 4)
    else:
        dam = max(victim.hit, game_utils.dice(level, 4))
    if handler_magic.saves_spell(level, victim, merc.DAM_NEGATIVE):
        dam = dam // 2
    fight.damage(ch, victim, dam, sn, merc.DAM_NEGATIVE, True)
示例#48
0
def spell_teleport(sn, level, ch, victim, target):
    if victim.in_room == None \
            or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_NO_RECALL) \
            or ( victim != ch and victim.imm_flags.is_set(merc.IMM_SUMMON)) \
            or ( not ch.is_npc() and victim.fighting is not None ) \
            or ( victim != ch \
                         and ( handler_magic.saves_spell(level - 5, victim, merc.DAM_OTHER))):
        ch.send("You failed.\n")
        return

    random_room = handler_room.get_random_room(victim)

    if victim != ch:
        victim.send("You have been teleported! \n")

    handler_game.act("$n vanishes! ", victim, None, None, merc.TO_ROOM)
    victim.in_room.get(victim)
    random_room.put(victim)
    handler_game.act("$n slowly fades into existence.", victim, None, None, merc.TO_ROOM)
    victim.do_look("auto")
示例#49
0
def spell_faerie_fog(sn, level, ch, victim, target):
    handler_game.act("$n conjures a cloud of purple smoke.", ch, None, None, merc.TO_ROOM)
    ch.send("You conjure a cloud of purple smoke.\n")

    for ich_id in ch.in_room.people:

        ich = instance.characters[ich_id]
        if ich.invis_level > 0:
            continue

        if ich == ch or handler_magic.saves_spell(level, ich, merc.DAM_OTHER):
            continue

        ich.affect_strip('invis')
        ich.affect_strip('mass_invis')
        ich.affect_strip('sneak')
        ich.affected_by.rem_bit(merc.AFF_HIDE)
        ich.affected_by.rem_bit(merc.AFF_INVISIBLE)
        ich.affected_by.rem_bit(merc.AFF_SNEAK)
        handler_game.act("$n is revealed! ", ich, None, None, merc.TO_ROOM)
        ich.send("You are revealed! \n")
示例#50
0
def spell_energy_drain(sn, level, ch, victim, target):
    # Drain XP, MANA, HP.
    # Caster gains HP.
    if victim != ch:
        ch.alignment = max(-1000, ch.alignment - 50)

    if handler_magic.saves_spell(level, victim, merc.DAM_NEGATIVE):
        victim.send("You feel a momentary chill.\n")
        return
    if victim.level <= 2:
        dam = ch.hit + 1
    else:
        update.gain_exp(victim, 0 - random.randint(level // 2, 3 * level // 2))
        victim.mana //= 2
        victim.move //= 2
        dam = game_utils.dice(1, level)
        ch.hit += dam

    victim.send("You feel your life slipping away! \n")
    ch.send("Wow....what a rush! \n")
    fight.damage(ch, victim, dam, sn, merc.DAM_NEGATIVE, True)
示例#51
0
def spell_gate(sn, level, ch, victim, target):
    # RT ROM-style gate */
    victim = ch.get_char_world(handler_magic.target_name)
    if not victim \
            or victim == ch \
            or victim.in_room == None \
            or not ch.can_see_room(victim.in_room.instance_id) \
            or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_SAFE) \
            or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_PRIVATE) \
            or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_SOLITARY) \
            or state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_NO_RECALL) \
            or state_checks.IS_SET(ch.in_room.room_flags, merc.ROOM_NO_RECALL) \
            or victim.level >= level + 3 \
            or (victim.is_clan() and not ch.is_same_clan(victim)) \
            or (not victim.is_npc() and victim.level >= merc.LEVEL_HERO) \
            or (victim.is_npc() and victim.imm_flags.is_set(merc.IMM_SUMMON)) \
            or (victim.is_npc() and handler_magic.saves_spell(level, victim, merc.DAM_OTHER) ):
        ch.send("You failed.\n")
        return

    if ch.pet and ch.in_room == ch.pet.in_room:
        gate_pet = True
    else:
        gate_pet = False

    handler_game.act("$n steps through a gate and vanishes.", ch, None, None, merc.TO_ROOM)
    ch.send("You step through a gate and vanish.\n")
    ch.in_room.get(ch)
    victim.in_room.put(ch)

    handler_game.act("$n has arrived through a gate.", ch, None, None, merc.TO_ROOM)
    ch.do_look("auto")

    if gate_pet:
        handler_game.act("$n steps through a gate and vanishes.", ch.pet, None, None, merc.TO_ROOM)
        instance.characters[ch.pet].send("You step through a gate and vanish.\n")
        instance.characters[ch.pet].in_room.get(instance.characters[ch.pet])
        ch.in_room.put(instance.characters[ch.pet])
        handler_game.act("$n has arrived through a gate.", ch.pet, None, None, merc.TO_ROOM)
        ch.pet.do_look("auto")
示例#52
0
def spell_plague(sn, level, ch, victim, target):
    # RT plague spell, very nasty */
    if handler_magic.saves_spell(level, victim, merc.DAM_DISEASE) or (
        victim.is_npc() and victim.act.is_set(merc.ACT_UNDEAD)):
        if ch == victim:
            ch.send("You feel momentarily ill, but it passes.\n")
        else:
            handler_game.act("$N seems to be unaffected.", ch, None, victim, merc.TO_CHAR)
        return

    af = handler_game.AFFECT_DATA()
    af.where = merc.TO_AFFECTS
    af.type = sn
    af.level = level * 3 // 4
    af.duration = level
    af.location = merc.APPLY_STR
    af.modifier = -5
    af.bitvector = merc.AFF_PLAGUE
    victim.affect_join(af)

    victim.send("You scream in agony as plague sores erupt from your skin.\n")
    handler_game.act("$n screams in agony as plague sores erupt from $s skin.", victim, None, None, merc.TO_ROOM)
示例#53
0
def spell_gas_breath(sn, level, ch, victim, target):
    handler_game.act("$n breathes out a cloud of poisonous gas! ", ch, None, None, merc.TO_ROOM)
    handler_game.act("You breath out a cloud of poisonous gas.", ch, None, None, merc.TO_CHAR)

    hpch = max(16, ch.hit)
    hp_dam = random.randint(hpch // 15 + 1, 8)
    dice_dam = game_utils.dice(level, 12)

    dam = max(hp_dam + dice_dam // 10, dice_dam + hp_dam // 10)
    effects.poison_effect(ch.in_room, level, dam, merc.TARGET_ROOM)

    for vch_id in ch.in_room.people:

        vch = instance.characters[vch_id]
        if fight.is_safe_spell(ch, vch, True) or (ch.is_npc() and vch.is_npc() and (ch.fighting == vch or vch.fighting == ch)):
            continue

        if handler_magic.saves_spell(level, vch, merc.DAM_POISON):
            effects.poison_effect(vch, level // 2, dam // 4, merc.TARGET_CHAR)
            fight.damage(ch, vch, dam // 2, sn, merc.DAM_POISON, True)
        else:
            effects.poison_effect(vch, level, dam, merc.TARGET_CHAR)
            fight.damage(ch, vch, dam, sn, merc.DAM_POISON, True)
示例#54
0
def spell_charm_person(sn, level, ch, victim, target):
    if fight.is_safe(ch, victim):
        return

    if victim == ch:
        ch.send("You like yourself even better! \n")
        return

    if ( victim.is_affected( merc.AFF_CHARM) \
                 or ch.is_affected(merc.AFF_CHARM) \
                 or level < victim.level \
                 or state_checks.IS_SET(victim.imm_flags, merc.IMM_CHARM) \
                 or handler_magic.saves_spell(level, victim, merc.DAM_CHARM) ):
        return

    if state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_LAW):
        ch.send("The mayor does not allow charming in the city limits.\n")
        return

    if victim.master:
        handler_ch.stop_follower(victim)
    handler_ch.add_follower(victim, ch)
    victim.leader = ch
    af = handler_game.AFFECT_DATA()
    af.where = merc.TO_AFFECTS
    af.type = sn
    af.level = level
    af.duration = game_utils.number_fuzzy(level // 4)
    af.location = 0
    af.modifier = 0
    af.bitvector = merc.AFF_CHARM
    victim.affect_add(af)
    #TODO: Known broken. Mob will immediately try to fight you after casting this, because this is an offensive spell.
    #ROM had some stipulation to prevent this combat, possibly in fight.py:is_safe()
    handler_game.act("Isn't $n just so nice?", ch, None, victim, merc.TO_VICT)
    if ch is not victim:
        handler_game.act("$N looks at you with adoring eyes.", ch, None, victim, merc.TO_CHAR)
示例#55
0
def spell_change_sex(sn, level, ch, victim, target):
    if state_checks.is_affected(victim, sn):
        if victim == ch:
            ch.send("You've already been changed.\n")
        else:
            handler_game.act("$N has already had $s(?) sex changed.", ch, None, victim, merc.TO_CHAR)
        return

    if handler_magic.saves_spell(level, victim, merc.DAM_OTHER):
        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_SEX

    while af.modifier == 0:
        af.modifier = random.randint(0, 2) - victim.sex

    af.bitvector = 0
    victim.affect_add(af)
    victim.send("You feel different.\n")
    handler_game.act("$n doesn't look like $mself anymore...", victim, None, None, merc.TO_ROOM)
示例#56
0
 def spread_plague(self, plague_carrier):
     af = [af for af in plague_carrier.affected if af.type == 'plague']
     if not af:
         plague_carrier.affected_by.rem_bit(merc.AFF_PLAGUE)
         return
     af = af[0]
     if af.level == 1:
             return
     plague = handler_game.AFFECT_DATA()
     plague.where = merc.TO_AFFECTS
     plague.type = "plague"
     plague.level = af.level - 1
     plague.duration = random.randint(1, 2 * plague.level)
     plague.location = merc.APPLY_STR
     plague.modifier = -5
     plague.bitvector = merc.AFF_PLAGUE
     for vch_id in self.people[:]:
             vch = instance.characters[vch_id]
             if not handler_magic.saves_spell(plague.level - 2, vch, merc.DAM_DISEASE) \
                     and not vch.is_immortal() and not vch.is_affected(merc.AFF_PLAGUE) \
                     and random.randint(0, 5) == 0:
                 vch.send("You feel hot and feverish.\n\r")
                 handler_game.act("$n shivers and looks very ill.", vch, None, None, merc.TO_ROOM)
                 vch.affect_join(plague)
示例#57
0
def spell_flamestrike(sn, level, ch, victim, target):
    dam = game_utils.dice(6 + level // 2, 8)
    if handler_magic.saves_spell(level, victim, merc.DAM_FIRE):
        dam = dam // 2
    fight.damage(ch, victim, dam, sn, merc.DAM_FIRE, True)
示例#58
0
def spell_high_explosive(sn, level, ch, victim, target):
    dam = random.randint(30, 120)
    if handler_magic.saves_spell(level, victim, merc.DAM_PIERCE):
        dam = dam // 2
    fight.damage(ch, victim, dam, sn, merc.DAM_PIERCE, True)