# benefiting. We hope that you share your changes too. What goes # around, comes around. import const import fight import game_utils import handler_magic import merc # noinspection PyUnusedLocal def spl_high_explosive(sn, level, ch, victim, target): dam = game_utils.number_range(30, 120) if handler_magic.saves_spell(level, victim): dam //= 2 fight.damage(ch, victim, dam, sn) const.register_spell( const.skill_type(name="high explosive", skill_level=7, spell_fun=spl_high_explosive, target=merc.TAR_CHAR_OFFENSIVE, minimum_position=merc.POS_FIGHTING, pgsn=None, slot=const.slot(502), min_mana=0, beats=12, noun_damage="high explosive ammo", msg_off="!High Explosive Ammo!"))
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."))
# 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."))
# 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!"))
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!"))
# 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."))
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."))
if book.item_type != merc.ITEM_BOOK: ch.send("That item isn't a book.\n") return if state_checks.is_set(book.value[1], merc.CONT_CLOSED): ch.send("First you need to open it!\n") return ch.get(page) book.put(page) book.value[3] += 1 book.value[2] = book.value[3] book.value[0] = book.value[3] page.specpower = book.value[3] + 1 handler_game.act("You insert $p into $P.", ch, page, book, merc.TO_CHAR) handler_game.act("$n inserts $p into $P.", ch, page, book, merc.TO_ROOM) const.register_spell( const.skill_type(name="insert page", skill_level=4, spell_fun=spl_insert_page, target=merc.TAR_IGNORE, minimum_position=merc.POS_STANDING, pgsn=None, slot=const.slot(553), min_mana=10, beats=12, noun_damage="", msg_off="!Insert Page!"))
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 list(instance.characters.values()): if not vch.in_room: continue if vch.in_room == ch.in_room: if vch != ch and (not vch.is_npc() if ch.is_npc() else vch.is_npc()): fight.damage(ch, vch, level + game_utils.dice(2, 8), sn) continue if vch.in_room.area == ch.in_room.area: vch.send("The earth trembles and shivers.\n") const.register_spell( const.skill_type(name="earthquake", skill_level=99, spell_fun=spl_earthquake, target=merc.TAR_IGNORE, minimum_position=merc.POS_FIGHTING, pgsn=None, slot=const.slot(23), min_mana=15, beats=12, noun_damage="earthquake", msg_off="!Earthquake!"))
# noinspection PyUnusedLocal def spl_cure_poison(sn, level, ch, victim, target): if victim.is_affected("poison"): victim.affect_strip("poison") handler_game.act("$N looks better.", ch, None, victim, merc.TO_NOTVICT) victim.send("A warm feeling runs through your body.\n") if ch != victim: ch.send("Ok.\n") if not ch.is_npc(): ch.humanity() const.register_spell( const.skill_type( name="cure poison", skill_level=1, spell_fun=spl_cure_poison, target=merc.TAR_CHAR_DEFENSIVE, minimum_position=merc.POS_STANDING, pgsn=None, slot=const.slot(43), min_mana=5, beats=12, noun_damage="", msg_off="!Cure Poison!" ) )
def spl_colour_spray(sn, level, ch, victim, target): dam_each = [ 10, 15, 15, 15, 15, 15, 20, 20, 20, 20, 20, 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, 85, 95, 110, 125, 150, 175, 200, 250, 300, 350 ] 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, sn) const.register_spell( const.skill_type(name="colour spray", skill_level=99, spell_fun=spl_colour_spray, target=merc.TAR_CHAR_OFFENSIVE, minimum_position=merc.POS_FIGHTING, pgsn=None, slot=const.slot(10), min_mana=15, beats=12, noun_damage="colour spray", msg_off="!Colour Spray!"))
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() const.register_spell( const.skill_type(name="energy drain", skill_level=4, spell_fun=spl_energy_drain, target=merc.TAR_CHAR_OFFENSIVE, minimum_position=merc.POS_FIGHTING, pgsn=None, slot=const.slot(25), min_mana=35, beats=12, noun_damage="energy drain", msg_off="!Energy Drain!"))
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!", victim, None, ch, merc.TO_CHAR) victim.cmd_look("auto") mount = victim.mount if mount: mount.in_room.get(mount) victim.in_room.put(mount) mount.cmd_look("auto") const.register_spell( const.skill_type(name="summon", skill_level=3, spell_fun=spl_summon, target=merc.TAR_IGNORE, minimum_position=merc.POS_STANDING, pgsn=None, slot=const.slot(40), min_mana=50, beats=12, noun_damage="", msg_off="!Summon!"))
import merc # noinspection PyUnusedLocal def spl_cure_blindness(sn, level, ch, victim, target): if not victim.is_affected("blindness"): return victim.affect_strip("blindness") victim.send("Your vision returns!\n") if ch != victim: ch.send("Ok.\n") if not ch.is_npc(): ch.humanity() const.register_spell( const.skill_type(name="cure blindness", skill_level=1, spell_fun=spl_cure_blindness, target=merc.TAR_CHAR_DEFENSIVE, minimum_position=merc.POS_FIGHTING, pgsn=None, slot=const.slot(14), min_mana=5, beats=12, noun_damage="", msg_off="!Cure Blindness!"))
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!"))
# 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!"))
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!"))
handler_game.act("The stump of $n's left ankle stops bleeding.", victim, None, None, merc.TO_ROOM) handler_game.act("The stump of your left ankle stops bleeding.", victim, None, None, merc.TO_CHAR) victim.bleeding.rem_bit(merc.BLEEDING_FOOT_L) elif victim.bleeding.is_set(merc.BLEEDING_FOOT_R): handler_game.act("The stump of $n's right ankle stops bleeding.", victim, None, None, merc.TO_ROOM) handler_game.act("The stump of your right ankle stops bleeding.", victim, None, None, merc.TO_CHAR) victim.bleeding.rem_bit(merc.BLEEDING_FOOT_R) else: ch.send("They have no wounds to clot.\n") if not ch.is_npc() and victim != ch: ch.humanity() const.register_spell( const.skill_type(name="clot", skill_level=1, spell_fun=spl_clot, target=merc.TAR_CHAR_DEFENSIVE, minimum_position=merc.POS_STANDING, pgsn=None, slot=const.slot(609), min_mana=50, beats=12, noun_damage="", msg_off="!Clot!"))
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!" ) )
# 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." ) )
elif victim.body.is_set(merc.CUT_THROAT): if victim.bleeding.is_set(merc.BLEEDING_THROAT): ch.send("But their throat is still bleeding!\n") return handler_game.act("The wound in $n's throat closes up.", victim, None, None, merc.TO_ROOM) handler_game.act("The wound in your throat closes up.", victim, None, None, merc.TO_CHAR) victim.body.rem_bit(merc.CUT_THROAT) else: ch.send("They have no bones to mend.\n") if not ch.is_npc() and victim != ch: ch.humanity() const.register_spell( const.skill_type( name="mend", skill_level=1, spell_fun=spl_mend, target=merc.TAR_CHAR_DEFENSIVE, minimum_position=merc.POS_STANDING, pgsn=None, slot=const.slot(610), min_mana=50, beats=12, noun_damage="", msg_off="!Mend!" ) )
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!"))
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!"))
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!"))
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!"))
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!" ) )
# 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_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."))
victim.hitroll = level victim.damroll = level victim.armor = 100 - (level * 7) ch.cmd_say("Come forth, creature of darkness, and do my bidding!") ch.send("A demon bursts from the ground and bows before you.\n") handler_game.act("$N bursts from the ground and bows before $n.", ch, None, victim, merc.TO_ROOM) ch.in_room.put(victim) handler_ch.add_follower(victim, ch) aff = handler_game.AffectData(type=sn, duration=666, location=merc.APPLY_NONE, bitvector=merc.AFF_CHARM) victim.affect_join(aff) const.register_spell( const.skill_type(name="guardian", skill_level=1, spell_fun=spl_guardian, target=merc.TAR_CHAR_DEFENSIVE, minimum_position=merc.POS_STANDING, pgsn=None, slot=const.slot(600), min_mana=100, beats=12, noun_damage="", msg_off="!Guardian!"))