Example #1
0
# noinspection PyUnusedLocal
def spl_giant_strength(sn, level, ch, victim, target):
    if victim.is_affected(sn):
        return

    aff = handler_game.AffectData(type=sn,
                                  duration=level,
                                  location=merc.APPLY_STR,
                                  modifier=1 + int(level >= 18) +
                                  int(level >= 25))
    victim.affect_join(aff)
    victim.send("You feel stronger.\n")

    if ch != victim:
        ch.send("Ok.\n")


const.register_spell(
    const.skill_type(name="giant strength",
                     skill_level=4,
                     spell_fun=spl_giant_strength,
                     target=merc.TAR_CHAR_DEFENSIVE,
                     minimum_position=merc.POS_STANDING,
                     pgsn=None,
                     slot=const.slot(39),
                     min_mana=20,
                     beats=12,
                     noun_damage="",
                     msg_off="You feel weaker."))
Example #2
0
import random
import const
import fight
import handler_magic
import merc


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)


const.register_spell(const.skill_type("high explosive",
                          {'mage': 53, 'cleric': 53, 'thief': 53, 'warrior': 53},
                          {'mage': 0, 'cleric': 0, 'thief': 0, 'warrior': 0},
                          spell_high_explosive, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING,
                          None, const.SLOT(402), 0, 12, "high explosive ammo", "!High Explosive Ammo!",
                          ""))  # combat and weapons skills */)
Example #3
0
import merc


def spell_protection_evil(sn, level, ch, victim, target):
    if victim.is_affected( merc.AFF_PROTECT_EVIL) or victim.is_affected(
                                                                                           merc.AFF_PROTECT_GOOD):
        if victim == ch:
            ch.send("You are already protected.\n")
        else:
            handler_game.act("$N is already protected.", 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 = 24
    af.location = merc.APPLY_SAVING_SPELL
    af.modifier = -1
    af.bitvector = merc.AFF_PROTECT_EVIL
    victim.affect_add(af)
    victim.send("You feel holy and pure.\n")
    if ch != victim:
        handler_game.act("$N is protected from evil.", ch, None, victim, merc.TO_CHAR)


const.register_spell(const.skill_type("protection evil",
                          {'mage': 12, 'cleric': 9, 'thief': 17, 'warrior': 11},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_protection_evil, merc.TAR_CHAR_SELF, merc.POS_STANDING,
                          None, const.SLOT(34), 5, 12, "", "You feel less protected.", ""))
Example #4
0
            break

    handler_game.act("$n slowly fades out of existence.", victim, None, None, merc.TO_ROOM)
    victim.in_room.get(victim)
    proomindex.put(victim)
    handler_game.act("$n slowly fades into existence.", victim, None, None, merc.TO_ROOM)
    victim.cmd_look("auto")

    mount = ch.mount
    if mount:
        mount.in_room.get(mount)
        ch.in_room.put(mount)
        mount.cmd_look("auto")


const.register_spell(
    const.skill_type(
        name="teleport",
        skill_level=3,
        spell_fun=spl_teleport,
        target=merc.TAR_CHAR_SELF,
        minimum_position=merc.POS_FIGHTING,
        pgsn=None,
        slot=const.slot(2),
        min_mana=35,
        beats=12,
        noun_damage="",
        msg_off="!Teleport!"
    )
)
Example #5
0
import const
import fight
import game_utils
import handler_magic
import merc


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)


const.register_spell(const.skill_type("flamestrike",
                          {'mage': 53, 'cleric': 20, 'thief': 53, 'warrior': 27},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_flamestrike, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING,
                          None, const.SLOT(65), 20, 12, "flamestrike", "!Flamestrike!", ""))
Example #6
0
        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)


const.register_spell(
    const.skill_type("poison", {
        'mage': 17,
        'cleric': 12,
        'thief': 15,
        'warrior': 21
    }, {
        'mage': 1,
        'cleric': 1,
        'thief': 2,
        'warrior': 2
    }, spell_poison, merc.TAR_OBJ_CHAR_OFF, merc.POS_FIGHTING, None,
                     const.SLOT(33), 10, 12, "poison", "You feel less sick.",
                     "The poison on $p dries up."))
Example #7
0
    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)


const.register_spell(const.skill_type("bless",
                          {'mage': 53, 'cleric': 7, 'thief': 53, 'warrior': 8},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_bless, merc.TAR_OBJ_CHAR_DEF, merc.POS_STANDING, None,
                          const.SLOT(3), 5, 12, "", "You feel less righteous.", "$p's holy aura fades."))
Example #8
0
import const
import merc


def spell_refresh(sn, level, ch, victim, target):
    victim.move = min(victim.move + level, victim.max_move)
    if victim.max_move == victim.move:
        victim.send("You feel fully refreshed! \n")
    else:
        victim.send("You feel less tired.\n")
    if ch != victim:
        ch.send("Ok.\n")
    return


const.register_spell(const.skill_type("refresh",
                          {'mage': 8, 'cleric': 5, 'thief': 12, 'warrior': 9},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_refresh, merc.TAR_CHAR_DEFENSIVE, merc.POS_STANDING,
                          None, const.SLOT(81), 12, 18, "refresh", "!Refresh!", ""))
Example #9
0
    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)


const.register_spell(const.skill_type("frost breath",
                          {'mage': 34, 'cleric': 36, 'thief': 38, 'warrior': 40},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_frost_breath, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING,
                          None, const.SLOT(202), 125, 24, "blast of frost", "!Frost Breath!", ""))
Example #10
0
import const
import fight
import game_utils
import handler_magic
import merc


def spell_acid_blast(sn, level, ch, victim, target):
    dam = game_utils.dice(level, 12)
    if handler_magic.saves_spell(level, victim, merc.DAM_ACID):
        dam = dam // 2
    fight.damage(ch, victim, dam, sn, merc.DAM_ACID, True)


const.register_spell(const.skill_type("acid blast",
                          {'mage': 28, 'cleric': 53, 'thief': 35, 'warrior': 32},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_acid_blast, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING,
                          None, const.SLOT(70), 20, 12, "acid blast", "!Acid Blast!", ""))
Example #11
0
import const
import fight
import game_utils
import merc


def spell_cause_serious(sn, level, ch, victim, target):
    fight.damage(ch, victim, game_utils.dice(2, 8) + level // 2, sn, merc.DAM_HARM, True)
    return


const.register_spell(const.skill_type("cause serious",
                          {'mage': 53, 'cleric': 7, 'thief': 53, 'warrior': 10},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_cause_serious, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, None,
                          const.SLOT(64), 17, 12, "spell", "!Cause Serious!", "")

)
Example #12
0
        obj.value[2] = max(obj.value[1], obj.value[2])
        obj.value[1] = 0
        return
    elif percent <= chance:
        handler_game.act("$p glows softly.", ch, obj, None, merc.TO_CHAR)
        handler_game.act("$p glows softly.", ch, obj, None, merc.TO_CHAR)

        chargemax = obj.value[1] - obj.value[2]
        chargeback = 0
        if chargemax > 0:
            chargeback = max(1, chargemax * percent // 100)
        obj.value[2] += chargeback
        obj.value[1] = 0
        return
    elif percent <= min(95, 3 * chance // 2):
        ch.send("Nothing seems to happen.\n")
        if obj.value[1] > 1:
            obj.value[1] -= 1
        return
    else:  # whoops!  */
        handler_game.act("$p glows brightly and explodes! ", ch, obj, None, merc.TO_CHAR)
        handler_game.act("$p glows brightly and explodes! ", ch, obj, None, merc.TO_ROOM)
        obj.extract()


const.register_spell(const.skill_type("recharge",
                          {'mage': 9, 'cleric': 53, 'thief': 53, 'warrior': 53},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_recharge, merc.TAR_OBJ_INV, merc.POS_STANDING, None,
                          const.SLOT(517), 60, 24, "", "!Recharge!", ""))
Example #13
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")


const.register_spell(const.skill_type("faerie fog",
                          {'mage': 14, 'cleric': 21, 'thief': 16, 'warrior': 24},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_faerie_fog, merc.TAR_IGNORE, merc.POS_STANDING, None,
                          const.SLOT(73), 12, 12, "faerie fog", "!Faerie Fog!", ""))
Example #14
0
                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


const.register_spell(const.skill_type("remove curse",
                          {'mage': 53, 'cleric': 18, 'thief': 53, 'warrior': 22},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_remove_curse, merc.TAR_OBJ_CHAR_DEF, merc.POS_STANDING,
                          None, const.SLOT(35), 5, 12, "", "!Remove Curse!", ""))
Example #15
0
import const
import fight
import game_utils
import handler_magic
import merc


def spell_harm(sn, level, ch, victim, target):
    dam = max(20, victim.hit - game_utils.dice(1, 4))
    if handler_magic.saves_spell(level, victim, merc.DAM_HARM):
        dam = min(50, dam // 2)
    dam = min(100, dam)
    fight.damage(ch, victim, dam, sn, merc.DAM_HARM, True)


const.register_spell(const.skill_type("harm",
                          {'mage': 53, 'cleric': 23, 'thief': 53, 'warrior': 28},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_harm, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, None,
                          const.SLOT(27), 35, 12, "harm spell", "!Harm!", ""))
Example #16
0
                                 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


const.register_spell(
    const.skill_type("chain lightning", {
        'mage': 33,
        'cleric': 53,
        'thief': 39,
        'warrior': 36
    }, {
        'mage': 1,
        'cleric': 1,
        'thief': 2,
        'warrior': 2
    }, spell_chain_lightning, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, None,
                     const.SLOT(500), 25, 12, "lightning", "!Chain Lightning!",
                     ""))
Example #17
0
import handler_game
import merc


def spell_detect_hidden(sn, level, ch, victim, target):
    if victim.is_affected( merc.AFF_DETECT_HIDDEN):
        if victim == ch:
            ch.send("You are already as alert as you can be. \n")
        else:
            handler_game.act("$N can already sense hidden lifeforms.", 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 = level
    af.location = merc.APPLY_NONE
    af.modifier = 0
    af.bitvector = merc.AFF_DETECT_HIDDEN
    victim.affect_add(af)
    victim.send("Your awareness improves.\n")
    if ch != victim:
        ch.send("Ok.\n")


const.register_spell(const.skill_type("detect hidden",
                          {'mage': 15, 'cleric': 11, 'thief': 12, 'warrior': 53},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_detect_hidden, merc.TAR_CHAR_SELF, merc.POS_STANDING, None,
                          const.SLOT(44), 5, 12, "", "You feel less aware of your surroundings.", ""))
Example #18
0
        return

    af = handler_game.AFFECT_DATA()
    af.where = merc.TO_AFFECTS
    af.type = sn
    af.level = level
    af.duration = level // 6
    af.location = merc.APPLY_NONE
    af.modifier = 0
    af.bitvector = merc.AFF_SANCTUARY
    victim.affect_add(af)
    handler_game.act("$n is surrounded by a white aura.", victim, None, None,
                     merc.TO_ROOM)
    victim.send("You are surrounded by a white aura.\n")


const.register_spell(
    const.skill_type("sanctuary", {
        'mage': 36,
        'cleric': 20,
        'thief': 42,
        'warrior': 30
    }, {
        'mage': 1,
        'cleric': 1,
        'thief': 2,
        'warrior': 2
    }, spell_sanctuary, merc.TAR_CHAR_DEFENSIVE, merc.POS_STANDING, None,
                     const.SLOT(36), 75, 12, "",
                     "The white aura around your body fades.", ""))
Example #19
0
import merc


def spell_detect_magic(sn, level, ch, victim, target):
    if victim.is_affected( merc.AFF_DETECT_MAGIC):
        if victim == ch:
            ch.send("You can already sense magical auras.\n")
        else:
            handler_game.act("$N can already detect magic.", 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 = level
    af.modifier = 0
    af.location = merc.APPLY_NONE
    af.bitvector = merc.AFF_DETECT_MAGIC
    victim.affect_add(af)
    victim.send("Your eyes tingle.\n")
    if ch != victim:
        ch.send("Ok.\n")


const.register_spell(const.skill_type("detect magic",
                          {'mage': 2, 'cleric': 6, 'thief': 5, 'warrior': 53},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_detect_magic, merc.TAR_CHAR_SELF, merc.POS_STANDING, None,
                          const.SLOT(20), 5, 12, "", "The detect magic wears off.", ""))

# noinspection PyUnusedLocal
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)


const.register_spell(
    const.skill_type(name="acid blast",
                     skill_level=99,
                     spell_fun=spl_acid_blast,
                     target=merc.TAR_CHAR_OFFENSIVE,
                     minimum_position=merc.POS_FIGHTING,
                     pgsn=None,
                     slot=const.slot(70),
                     min_mana=20,
                     beats=12,
                     noun_damage="acid blast",
                     msg_off="!Acid Blast!"))
Example #21
0
import const
import fight
import game_utils
import merc


def spell_cause_critical(sn, level, ch, victim, target):
    fight.damage(ch, victim, game_utils.dice(3, 8) + level - 6, sn, merc.DAM_HARM, True)
    return


const.register_spell(const.skill_type("cause critical",
                          {'mage': 53, 'cleric': 13, 'thief': 53, 'warrior': 19},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_cause_critical, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING,
                          None, const.SLOT(63), 20, 12, "spell", "!Cause Critical!", ""))
Example #22
0
import const
import handler_game
import handler_magic
import merc
import state_checks


def spell_cure_poison(sn, level, ch, victim, target):
    if not state_checks.is_affected(victim, const.skill_table['poison']):
        if victim == ch:
            ch.send("You aren't poisoned.\n")
        else:
            handler_game.act("$N doesn't appear to be poisoned.", ch, None, victim, merc.TO_CHAR)
        return

    if handler_magic.check_dispel(level, victim, const.skill_table['poison']):
        victim.send("A warm feeling runs through your body.\n")
        handler_game.act("$n looks much better.", victim, None, None, merc.TO_ROOM)
        return

    ch.send("Spell failed.\n")


const.register_spell(const.skill_type("cure poison",
                          {'mage': 53, 'cleric': 14, 'thief': 53, 'warrior': 16},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_cure_poison, merc.TAR_CHAR_DEFENSIVE, merc.POS_STANDING,
                          None, const.SLOT(43), 5, 12, "", "!Cure Poison!", ""))
                    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


const.register_spell(const.skill_type("chain lightning",
                          {'mage': 33, 'cleric': 53, 'thief': 39, 'warrior': 36},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_chain_lightning, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING,
                          None, const.SLOT(500), 25, 12, "lightning", "!Chain Lightning!", ""))
Example #24
0
    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)


const.register_spell(const.skill_type("charm person",
                          {'mage': 20, 'cleric': 53, 'thief': 25, 'warrior': 53},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_charm_person, merc.TAR_CHAR_OFFENSIVE, merc.POS_STANDING,
                          None, const.SLOT(7), 5, 12, "", "You feel more self-confident.", "")
)
Example #25
0
import const
import handler_game
import merc
import object_creator

def spell_create_food(sn, level, ch, victim, target):
    mushroom = object_creator.create_item(instance.item_templates[merc.OBJ_VNUM_MUSHROOM], 0)
    mushroom.value[0] = level // 2
    mushroom.value[1] = level
    ch.in_room.put(mushroom)
    handler_game.act("$p suddenly appears.", ch, mushroom, None, merc.TO_ROOM)
    handler_game.act("$p suddenly appears.", ch, mushroom, None, merc.TO_CHAR)
    return


const.register_spell(const.skill_type("create food",
                          {'mage': 10, 'cleric': 5, 'thief': 11, 'warrior': 12},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_create_food, merc.TAR_IGNORE, merc.POS_STANDING, None,
                          const.SLOT(12), 5, 12, "", "!Create Food!", ""))
Example #26
0
import state_checks


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")


const.register_spell(const.skill_type("teleport",
                          {'mage': 13, 'cleric': 22, 'thief': 25, 'warrior': 36},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_teleport, merc.TAR_CHAR_SELF, merc.POS_FIGHTING, None,
                          const.SLOT(2), 35, 12, "", "!Teleport!", ""))
Example #27
0
            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")


const.register_spell(const.skill_type("summon",
                          {'mage': 24, 'cleric': 12, 'thief': 29, 'warrior': 22},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_summon, merc.TAR_IGNORE, merc.POS_STANDING, None,
                          const.SLOT(40), 50, 12, "", "!Summon!", ""))
Example #28
0
              'invisibility': '$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 found:
        ch.send("Ok.\n")
    else:
        ch.send("Spell failed.\n")


const.register_spell(const.skill_type("cancellation",
                          {'mage': 18, 'cleric': 26, 'thief': 34, 'warrior': 34},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_cancellation, merc.TAR_CHAR_DEFENSIVE, merc.POS_FIGHTING,
                          None, const.SLOT(507), 20, 12, "", "!cancellation!", "")
)
Example #29
0
import handler_game
import merc


def spell_detect_invis(sn, level, ch, victim, target):
    if victim.is_affected( merc.AFF_DETECT_INVIS):
        if victim == ch:
            ch.send("You can already see invisible.\n")
        else:
            handler_game.act("$N can already see invisible things.", 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 = level
    af.modifier = 0
    af.location = merc.APPLY_NONE
    af.bitvector = merc.AFF_DETECT_INVIS
    victim.affect_add(af)
    victim.send("Your eyes tingle.\n")
    if ch != victim:
        ch.send("Ok.\n")


const.register_spell(const.skill_type("detect invis",
                          {'mage': 3, 'cleric': 8, 'thief': 6, 'warrior': 53},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_detect_invis, merc.TAR_CHAR_SELF, merc.POS_STANDING,
                          None, const.SLOT(19), 5, 12, "", "You no longer see invisible objects.", ""))
Example #30
0

# noinspection PyUnusedLocal
def spl_faerie_fire(sn, level, ch, victim, target):
    if victim.is_affected(merc.AFF_FAERIE_FIRE):
        return

    aff = handler_game.AffectData(type=sn,
                                  duration=level,
                                  location=merc.APPLY_AC,
                                  modifier=2 * level,
                                  bitvector=merc.AFF_FAERIE_FIRE)
    victim.affect_add(aff)
    victim.send("You are surrounded by a pink outline.\n")
    handler_game.act("$n is surrounded by a pink outline.", victim, None, None,
                     merc.TO_ROOM)


const.register_spell(
    const.skill_type(name="faerie fire",
                     skill_level=99,
                     spell_fun=spl_faerie_fire,
                     target=merc.TAR_CHAR_OFFENSIVE,
                     minimum_position=merc.POS_FIGHTING,
                     pgsn=None,
                     slot=const.slot(72),
                     min_mana=5,
                     beats=12,
                     noun_damage="faerie fire",
                     msg_off="The pink aura around you fades away."))
# noinspection PyUnusedLocal
def spl_flamestrike(sn, level, ch, victim, target):
    if victim.itemaff.is_set(merc.ITEMA_FIRESHIELD):
        return

    dam = game_utils.dice(6, 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 0,
        sn)


const.register_spell(
    const.skill_type(name="flamestrike",
                     skill_level=99,
                     spell_fun=spl_flamestrike,
                     target=merc.TAR_CHAR_OFFENSIVE,
                     minimum_position=merc.POS_FIGHTING,
                     pgsn=None,
                     slot=const.slot(65),
                     min_mana=20,
                     beats=12,
                     noun_damage="flamestrike",
                     msg_off="!Flamestrike!"))
import merc


# noinspection PyUnusedLocal
def spl_detect_poison(sn, level, ch, victim, target):
    item = victim
    if item.item_type in [merc.ITEM_DRINK_CON, merc.ITEM_FOOD]:
        if item.value[3] != 0:
            ch.send("You smell poisonous fumes.\n")
        else:
            ch.send("It looks very delicious.\n")
    else:
        ch.send("It doesn't look poisoned.\n")


const.register_spell(
    const.skill_type(
        name="detect poison",
        skill_level=99,
        spell_fun=spl_detect_poison,
        target=merc.TAR_OBJ_INV,
        minimum_position=merc.POS_STANDING,
        pgsn=None,
        slot=const.slot(21),
        min_mana=5,
        beats=12,
        noun_damage="",
        msg_off="!Detect Poison!"
    )
)
# noinspection PyUnusedLocal
def spl_cure_critical(sn, level, ch, victim, target):
    heal = game_utils.dice(3, 8) + level - 6
    victim.hit = min(victim.hit + heal, victim.max_hit)
    fight.update_pos(victim)
    victim.send("You feel better!\n")

    if ch != victim:
        ch.send("Ok.\n")

        if not ch.is_npc():
            ch.humanity()


const.register_spell(
    const.skill_type(
        name="cure critical",
        skill_level=99,
        spell_fun=spl_cure_critical,
        target=merc.TAR_CHAR_DEFENSIVE,
        minimum_position=merc.POS_FIGHTING,
        pgsn=None,
        slot=const.slot(15),
        min_mana=20,
        beats=12,
        noun_damage="",
        msg_off="!Cure Critical!"
    )
)
Example #34
0
import const
import handler_game
import handler_magic
import merc
import state_checks


def spell_cure_disease(sn, level, ch, victim, target):
    if not state_checks.is_affected(victim, const.skill_table['plague']):
        if victim == ch:
            ch.send("You aren't ill.\n")
        else:
            handler_game.act("$N doesn't appear to be diseased.", ch, None, victim, merc.TO_CHAR)
        return

    if handler_magic.check_dispel(level, victim, const.skill_table['plague']):
        victim.send("Your sores vanish.\n")
        handler_game.act("$n looks relieved as $s sores vanish.", victim, None, None, merc.TO_ROOM)
        return

    ch.send("Spell failed.\n")


const.register_spell(const.skill_type("cure disease",
                          {'mage': 53, 'cleric': 13, 'thief': 53, 'warrior': 14},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_cure_disease, merc.TAR_CHAR_DEFENSIVE, merc.POS_STANDING,
                          None, const.SLOT(501), 20, 12, "", "!Cure Disease!", ""))
    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)


const.register_spell(
    const.skill_type(name="dispel magic",
                     skill_level=1,
                     spell_fun=spl_dispel_magic,
                     target=merc.TAR_CHAR_OFFENSIVE,
                     minimum_position=merc.POS_FIGHTING,
                     pgsn=None,
                     slot=const.slot(59),
                     min_mana=15,
                     beats=12,
                     noun_damage="",
                     msg_off="!Dispel Magic!"))
Example #36
0
import handler_game
import merc


# noinspection PyUnusedLocal
def spl_pass_door(sn, level, ch, victim, target):
    if victim.is_affected(merc.AFF_PASS_DOOR):
        return

    aff = handler_game.AffectData(type=sn,
                                  duration=game_utils.number_fuzzy(level // 6),
                                  location=merc.APPLY_NONE,
                                  bitvector=merc.AFF_PASS_DOOR)
    victim.affect_join(aff)
    handler_game.act("$n turns translucent.", victim, None, None, merc.TO_ROOM)
    victim.send("You turn translucent.\n")


const.register_spell(
    const.skill_type(name="pass door",
                     skill_level=4,
                     spell_fun=spl_pass_door,
                     target=merc.TAR_CHAR_SELF,
                     minimum_position=merc.POS_STANDING,
                     pgsn=None,
                     slot=const.slot(74),
                     min_mana=20,
                     beats=12,
                     noun_damage="",
                     msg_off="You feel solid again."))
Example #37
0
        return
    elif rune.value[2] > 0 and not state_checks.is_set(page.value[2],
                                                       rune.value[2]):
        page.value[2] += rune.value[2]
    elif rune.value[2] > 0:
        ch.send("That glyph has already been copied onto the page.\n")
        return
    elif rune.value[3] > 0 and not state_checks.is_set(page.value[3],
                                                       rune.value[3]):
        page.value[3] += rune.value[3]
    elif rune.value[3] > 0:
        ch.send("That glyph has already been copied onto the page.\n")
        return

    handler_game.act("You copy $p onto $P.", ch, rune, page, merc.TO_CHAR)
    handler_game.act("$n copies $p onto $P.", ch, rune, page, merc.TO_ROOM)


const.register_spell(
    const.skill_type(name="copy",
                     skill_level=4,
                     spell_fun=spl_copy,
                     target=merc.TAR_IGNORE,
                     minimum_position=merc.POS_STANDING,
                     pgsn=None,
                     slot=const.slot(552),
                     min_mana=100,
                     beats=12,
                     noun_damage="",
                     msg_off="!Copy!"))
Example #38
0
import const
import handler_game
import merc
import object_creator


def spell_create_spring(sn, level, ch, victim, target):
    spring = object_creator.create_item(
        instance.item_templates[merc.OBJ_VNUM_SPRING], 0)
    spring.timer = level
    ch.in_room.put(spring)
    handler_game.act("$p flows from the ground.", ch, spring, None,
                     merc.TO_ROOM)
    handler_game.act("$p flows from the ground.", ch, spring, None,
                     merc.TO_CHAR)


const.register_spell(
    const.skill_type("create spring", {
        'mage': 14,
        'cleric': 17,
        'thief': 23,
        'warrior': 20
    }, {
        'mage': 1,
        'cleric': 1,
        'thief': 2,
        'warrior': 2
    }, spell_create_spring, merc.TAR_IGNORE, merc.POS_STANDING, None,
                     const.SLOT(80), 20, 12, "", "!Create Spring!", ""))
Example #39
0
#  benefiting.  We hope that you share your changes too.  What goes
#  around, comes around.

import const
import instance
import merc
import object_creator


# noinspection PyUnusedLocal
def spl_gate(sn, level, ch, victim, target):
    mob = object_creator.create_mobile(instance.npc_templates[merc.MOB_VNUM_VAMPIRE])
    ch.in_room.put(mob)


const.register_spell(
    const.skill_type(
        name="gate",
        skill_level=99,
        spell_fun=spl_gate,
        target=merc.TAR_CHAR_DEFENSIVE,
        minimum_position=merc.POS_FIGHTING,
        pgsn=None,
        slot=const.slot(83),
        min_mana=50,
        beats=12,
        noun_damage="",
        msg_off="!Gate!"
    )
)

# noinspection PyUnusedLocal
def spl_detect_magic(sn, level, ch, victim, target):
    if victim.is_affected(merc.AFF_DETECT_MAGIC):
        return

    aff = handler_game.AffectData(type=sn, duration=level, location=merc.APPLY_NONE, bitvector=merc.AFF_DETECT_MAGIC)
    victim.affect_join(aff)
    victim.send("Your eyes tingle.\n")

    if ch != victim:
        ch.send("Ok.\n")


const.register_spell(
    const.skill_type(
        name="detect magic",
        skill_level=99,
        spell_fun=spl_detect_magic,
        target=merc.TAR_CHAR_SELF,
        minimum_position=merc.POS_STANDING,
        pgsn=None,
        slot=const.slot(20),
        min_mana=5,
        beats=12,
        noun_damage="",
        msg_off="The detect magic wears off."
    )
)
Example #41
0
        victim.short_descr = "{}'s white pegasus".format(ch.name)
        victim.long_descr = "A beautiful white pegasus stands here.\n"
    elif ch.is_evil():
        victim.name = "mount griffin"
        victim.short_descr = "{}'s griffin".format(ch.name)
        victim.long_descr = "A vicious looking griffin stands here.\n"
    else:
        victim.name = "mount black horse nightmare"
        victim.short_descr = "{}'s black nightmare".format(ch.name)
        victim.long_descr = "A large black demonic horse stands here.\n"

    ch.in_room.put(victim)
    handler_game.act("$N fades into existance.", ch, None, victim,
                     merc.TO_CHAR)
    handler_game.act("$N fades into existance.", ch, None, victim,
                     merc.TO_ROOM)


const.register_spell(
    const.skill_type(name="mount",
                     skill_level=2,
                     spell_fun=spl_mount,
                     target=merc.TAR_CHAR_DEFENSIVE,
                     minimum_position=merc.POS_STANDING,
                     pgsn=None,
                     slot=const.slot(618),
                     min_mana=100,
                     beats=12,
                     noun_damage="",
                     msg_off="!Mount!"))
            victim.head.set_bit(merc.LOST_TOOTH_2)

        if teeth >= 1:
            teeth -= 1
            victim.head.set_bit(merc.LOST_TOOTH_1)

        handler_game.act("You press $p into $N's mouth.", ch, item, victim,
                         merc.TO_CHAR)
        handler_game.act("$n presses $p into $N's mouth.", ch, item, victim,
                         merc.TO_NOTVICT)
        handler_game.act("$n presses $p into your mouth.", ch, item, victim,
                         merc.TO_VICT)
        item.extract()
    else:
        handler_game.act("There is nowhere to stick $p on $N.", ch, item,
                         victim, merc.TO_CHAR)


const.register_spell(
    const.skill_type(name="regenerate",
                     skill_level=1,
                     spell_fun=spl_regenerate,
                     target=merc.TAR_OBJ_INV,
                     minimum_position=merc.POS_STANDING,
                     pgsn=None,
                     slot=const.slot(608),
                     min_mana=100,
                     beats=12,
                     noun_damage="",
                     msg_off="!Regenerate!"))
import const
import game_utils
import handler_game
import merc


def spell_control_weather(sn, level, ch, victim, target):
    if victim.lower() == "better":
        handler_game.weather_info.change += game_utils.dice(level // 3, 4)
    elif victim.lower() == "worse":
        handler_game.weather_info.change -= game_utils.dice(level // 3, 4)
    else:
        ch.send("Do you want it to get better or worse?\n")

    ch.send("Ok.\n")
    return


const.register_spell(const.skill_type("control weather",
                          {'mage': 15, 'cleric': 19, 'thief': 28, 'warrior': 22},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_control_weather, merc.TAR_IGNORE, merc.POS_STANDING,
                          None, const.SLOT(11), 25, 12, "", "!Control Weather!", ""))
Example #44
0
    item.quest_object()
    ch.put(item)

    if ch.practice >= 50:
        ch.practice -= 50
        item.level = 50
    else:
        item.level = ch.practice
        ch.practice = 0

    handler_game.act("$p fades into existance in your hands.", ch, item, None,
                     merc.TO_CHAR)
    handler_game.act("$p fades into existance in $n's hands.", ch, item, None,
                     merc.TO_ROOM)
    item.questmaker = ch.name
    item.questowner = ch.name


const.register_spell(
    const.skill_type(name="quest",
                     skill_level=2,
                     spell_fun=spl_quest,
                     target=merc.TAR_IGNORE,
                     minimum_position=merc.POS_STANDING,
                     pgsn=None,
                     slot=const.slot(611),
                     min_mana=500,
                     beats=12,
                     noun_damage="",
                     msg_off="!Quest!"))
Example #45
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)


const.register_spell(
    const.skill_type("burning hands", {
        'mage': 7,
        'cleric': 53,
        'thief': 10,
        'warrior': 9
    }, {
        'mage': 1,
        'cleric': 1,
        'thief': 2,
        'warrior': 2
    }, spell_burning_hands, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, None,
                     const.SLOT(5), 15, 12, "burning hands", "!Burning Hands!",
                     ""))
Example #46
0
            handler_game.act("$N is already shifted out of phase.", 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 = game_utils.number_fuzzy(level // 4)
    af.location = merc.APPLY_NONE
    af.modifier = 0
    af.bitvector = merc.AFF_PASS_DOOR
    victim.affect_add(af)
    handler_game.act("$n turns translucent.", victim, None, None, merc.TO_ROOM)
    victim.send("You turn translucent.\n")


const.register_spell(
    const.skill_type("pass door", {
        'mage': 24,
        'cleric': 32,
        'thief': 25,
        'warrior': 37
    }, {
        'mage': 1,
        'cleric': 1,
        'thief': 2,
        'warrior': 2
    }, spell_pass_door, merc.TAR_CHAR_SELF, merc.POS_STANDING, None,
                     const.SLOT(74), 20, 12, "", "You feel solid again.", ""))
Example #47
0
import random
import const
import fight
import handler_magic
import merc


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)


const.register_spell(const.skill_type("burning hands",
                          {'mage': 7, 'cleric': 53, 'thief': 10, 'warrior': 9},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_burning_hands, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING,
                          None, const.SLOT(5), 15, 12, "burning hands", "!Burning Hands!", ""))
    book.get(page)
    ch.put(page)
    page.value[0] = 0
    handler_game.act("You remove $p from $P.", ch, page, book, merc.TO_CHAR)
    handler_game.act("$n removes $p from $P.", ch, page, book, merc.TO_ROOM)

    count = 0
    for page_id in book.inventory[:]:
        page = instance.items[page_id]

        count += 1
        page.value[0] = count

    book.value[3] = count
    if book.value[2] > book.value[3]:
        book.value[2] = book.value[3]


const.register_spell(
    const.skill_type(name="remove page",
                     skill_level=4,
                     spell_fun=spl_remove_page,
                     target=merc.TAR_IGNORE,
                     minimum_position=merc.POS_STANDING,
                     pgsn=None,
                     slot=const.slot(564),
                     min_mana=10,
                     beats=12,
                     noun_damage="",
                     msg_off="!Remove Page!"))
Example #49
0
import const
import fight
import game_utils
import merc


def spell_cause_serious(sn, level, ch, victim, target):
    fight.damage(ch, victim,
                 game_utils.dice(2, 8) + level // 2, sn, merc.DAM_HARM, True)
    return


const.register_spell(
    const.skill_type("cause serious", {
        'mage': 53,
        'cleric': 7,
        'thief': 53,
        'warrior': 10
    }, {
        'mage': 1,
        'cleric': 1,
        'thief': 2,
        'warrior': 2
    }, spell_cause_serious, merc.TAR_CHAR_OFFENSIVE, merc.POS_FIGHTING, None,
                     const.SLOT(64), 17, 12, "spell", "!Cause Serious!", ""))
Example #50
0
import merc


# noinspection PyUnusedLocal
def spl_stone_skin(sn, level, ch, victim, target):
    if ch.is_affected(sn):
        return

    aff = handler_game.AffectData(type=sn,
                                  duration=level,
                                  location=merc.APPLY_AC,
                                  modifier=-40)
    victim.affect_add(aff)
    handler_game.act("$n's skin turns to stone.", victim, None, None,
                     merc.TO_ROOM)
    victim.send("Your skin turns to stone.\n")


const.register_spell(
    const.skill_type(name="stone skin",
                     skill_level=4,
                     spell_fun=spl_stone_skin,
                     target=merc.TAR_CHAR_SELF,
                     minimum_position=merc.POS_STANDING,
                     pgsn=None,
                     slot=const.slot(66),
                     min_mana=12,
                     beats=18,
                     noun_damage="",
                     msg_off="Your skin feels soft again."))
Example #51
0
        added = -2

    # now add the enchantments */
    if obj.level < merc.LEVEL_HERO:
        obj.level = min(merc.LEVEL_HERO - 1, obj.level + 1)

    if ac_found:
        for paf in obj.affected:
            if paf.location == merc.APPLY_AC:
                paf.type = sn
                paf.modifier += added
                paf.level = max(paf.level, level)
    else:  # add a new affect */
        paf = handler_game.AFFECT_DATA()

        paf.where = merc.TO_OBJECT
        paf.type = sn
        paf.level = level
        paf.duration = -1
        paf.location = merc.APPLY_AC
        paf.modifier = added
        paf.bitvector = 0
        obj.affected.append(paf)


const.register_spell(const.skill_type("enchant armor",
                          {'mage': 16, 'cleric': 53, 'thief': 53, 'warrior': 53},
                          {'mage': 2, 'cleric': 2, 'thief': 4, 'warrior': 4},
                          spell_enchant_armor, merc.TAR_OBJ_INV, merc.POS_STANDING, None,
                          const.SLOT(510), 100, 24, "", "!Enchant Armor!", ""))
Example #52
0
import game_utils
import handler_game
import merc
import state_checks


def spell_earthquake(sn, level, ch, victim, target):
    ch.send("The earth trembles beneath your feet! \n")
    handler_game.act("$n makes the earth tremble and shiver.", ch, None, None, merc.TO_ROOM)

    for vch in instance.characters.values():
        if not vch.in_room:
            continue
        if vch.in_room == ch.in_room:
            if vch != ch and not fight.is_safe_spell(ch, vch, True):
                if state_checks.IS_AFFECTED(vch, merc.AFF_FLYING):
                    fight.damage(ch, vch, 0, sn, merc.DAM_BASH, True)
                else:
                    fight.damage(ch, vch, level + game_utils.dice(2, 8), sn, merc.DAM_BASH, True)
            continue

        if vch.in_room.area == ch.in_room.area:
            vch.send("The earth trembles and shivers.\n")


const.register_spell(const.skill_type("earthquake",
                          {'mage': 53, 'cleric': 10, 'thief': 53, 'warrior': 14},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_earthquake, merc.TAR_IGNORE, merc.POS_FIGHTING,
                          None, const.SLOT(23), 15, 12, "earthquake", "!Earthquake!", ""))
Example #53
0
    if victim.itemaff.is_set(merc.ITEMA_FIRESHIELD):
        return

    level = min(level, len(dam_each) - 1)
    level = max(0, level)
    dam = game_utils.number_range(dam_each[level] // 2, dam_each[level] * 2)

    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 0,
        sn)


const.register_spell(
    const.skill_type(name="fireball",
                     skill_level=1,
                     spell_fun=spl_fireball,
                     target=merc.TAR_CHAR_OFFENSIVE,
                     minimum_position=merc.POS_FIGHTING,
                     pgsn=None,
                     slot=const.slot(26),
                     min_mana=15,
                     beats=12,
                     noun_damage="fireball",
                     msg_off="!Fireball!"))
Example #54
0
    elif ap > 350:
        msg = "$N is of excellent moral character."
    elif ap > 100:
        msg = "$N is often kind and thoughtful."
    elif ap > -100:
        msg = "$N doesn't have a firm moral commitment."
    elif ap > -350:
        msg = "$N lies to $S friends."
    elif ap > -700:
        msg = "$N is a black-hearted murderer."
    else:
        msg = "$N is the embodiment of pure evil! ."

    handler_game.act(msg, ch, None, victim, merc.TO_CHAR)
    return


const.register_spell(
    const.skill_type("know alignment", {
        'mage': 12,
        'cleric': 9,
        'thief': 20,
        'warrior': 53
    }, {
        'mage': 1,
        'cleric': 1,
        'thief': 2,
        'warrior': 2
    }, spell_know_alignment, merc.TAR_CHAR_DEFENSIVE, merc.POS_FIGHTING, None,
                     const.SLOT(58), 9, 12, "", "!Know Alignment!", ""))
Example #55
0
        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")


const.register_spell(const.skill_type("gate",
                          {'mage': 27, 'cleric': 17, 'thief': 32, 'warrior': 28},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_gate, merc.TAR_IGNORE, merc.POS_FIGHTING, None, const.SLOT(83),
                          80, 12, "", "!Gate!", ""))
Example #56
0
# noinspection PyUnusedLocal
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


const.register_spell(
    const.skill_type(name="sleep",
                     skill_level=3,
                     spell_fun=spl_sleep,
                     target=merc.TAR_CHAR_OFFENSIVE,
                     minimum_position=merc.POS_STANDING,
                     pgsn=None,
                     slot=const.slot(38),
                     min_mana=15,
                     beats=12,
                     noun_damage="",
                     msg_off="You feel less tired."))
Example #57
0
import handler_game
import merc


def spell_detect_good(sn, level, ch, victim, target):
    if victim.is_affected( merc.AFF_DETECT_GOOD):
        if victim == ch:
            ch.send("You can already sense good.\n")
        else:
            handler_game.act("$N can already detect good.", 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 = level
    af.modifier = 0
    af.location = merc.APPLY_NONE
    af.bitvector = merc.AFF_DETECT_GOOD
    victim.affect_add(af)
    victim.send("Your eyes tingle.\n")
    if ch != victim:
        ch.send("Ok.\n")


const.register_spell(const.skill_type("detect good",
                          {'mage': 11, 'cleric': 4, 'thief': 12, 'warrior': 53},
                          {'mage': 1, 'cleric': 1, 'thief': 2, 'warrior': 2},
                          spell_detect_good, merc.TAR_CHAR_SELF, merc.POS_STANDING, None,
                          const.SLOT(513), 5, 12, "", "The gold in your vision disappears.", ""))