def gain_condition(ch, value): if value == 0 or ch.is_npc() or not ch.is_vampire(): return condition = ch.blood ch.blood = state_checks.urange(0, condition + value, 48) if ch.blood == 0: ch.send("You are DYING from lack of blood!\n") handler_game.act("$n gets a hungry look in $s eyes.", ch, None, None, merc.TO_ROOM) ch.hit -= game_utils.number_range(2, 5) if game_utils.number_percent() <= ch.beast and ch.beast > 0: ch.vamp_rage() if not ch.vampaff.is_set(merc.VAM_FANGS): ch.cmd_fangs("") elif ch.blood < 10: ch.send("You crave blood.\n") if game_utils.number_range(1, 1000) <= ch.beast and ch.beast > 0: ch.vamp_rage() if game_utils.number_percent( ) > ch.blood + 75 and not ch.vampaff.is_set(merc.VAM_FANGS): ch.cmd_fangs("")
def quest_object(self): quest_selection = [ 102, 9201, 9225, 605, 1329, 2276, 5112, 6513, 6517, 6519, 5001, 5005, 5011, 5012, 5013, 2902, 1352, 2348, 2361, 3005, 5011, 5012, 5013, 2902, 1352, 2348, 2361, 3005, 300, 303, 307, 7216, 1100, 100, 30315, 5110, 6001, 3050, 301, 5230, 30302, 663, 7303, 2915, 2275, 8600, 8601, 8602, 8603, 5030, 9321, 6010, 1304, 1307, 1332, 1333, 1342, 1356, 1361, 2304, 2322, 2331, 2382, 8003, 8005, 5300, 5302, 5309, 5310, 5311, 4000, 601, 664, 900, 906, 923, 311, 7203, 7206, 1101, 5214, 5223, 5228, 2804, 1612, 5207, 9302, 5301, 5224, 7801, 9313, 6304, 2003, 3425, 3423, 608, 1109, 30319, 8903, 9317, 9307, 4050, 911, 2204, 4100, 3428, 310, 5113, 3402, 5319, 6512, 5114, 913, 30316, 2106, 8007, 6601, 2333, 3610, 2015, 5022, 1394, 2202, 1401, 6005, 1614, 647, 1388, 9311, 3604, 4701, 30325, 6106, 2003, 7190, 9322, 1384, 3412, 2342, 1374, 2210, 2332, 2901, 7200, 7824, 3410, 2013, 1510, 8306, 3414, 2005 ] if self.item_type != merc.ITEM_QUESTCARD: return selection = game_utils.number_range(self.level, self.level + 100) selection = 0 if selection not in range(1, 151) else selection self.value[0] = quest_selection[selection] selection = game_utils.number_range(self.level, self.level + 100) selection = 0 if selection not in range(1, 151) else selection self.value[1] = quest_selection[selection] selection = game_utils.number_range(self.level, self.level + 100) selection = 0 if selection not in range(1, 151) else selection self.value[2] = quest_selection[selection] selection = game_utils.number_range(self.level, self.level + 100) selection = 0 if selection not in range(1, 151) else selection self.value[3] = quest_selection[selection]
def cmd_poison(ch, argument): if ch.is_npc(): return if not ch.is_vampire(): ch.huh() return if not ch.vampaff.is_set(merc.VAM_SERPENTIS): ch.send("You are not trained in the Serpentis discipline.\n") return item = ch.get_eq("right_hand") if not item or item.item_type != merc.ITEM_WEAPON: item = ch.get_eq("left_hand") if not item or item.item_type != merc.ITEM_WEAPON: ch.send("You must wield the weapon you wish to poison.\n") return if item.value[0] != 0: ch.send("This weapon cannot be poisoned.\n") return if ch.blood < 15: ch.send("You have insufficient blood.\n") return ch.blood -= game_utils.number_range(5, 15) handler_game.act("You run your tongue along $p, poisoning it.", ch, item, None, merc.TO_CHAR) handler_game.act("$n runs $s tongue along $p, poisoning it.", ch, item, None, merc.TO_ROOM) item.value[0] = 53 item.timer = game_utils.number_range(10, 20)
def update_handler(): global previous_pulse global pulse_area global pulse_npc global pulse_point global pulse_violence global pulse_ww current_time = get_precise_time() if previous_pulse == -1: previous_pulse = current_time - 1 while current_time >= previous_pulse + merc.MILLISECONDS_PER_PULSE: previous_pulse += merc.MILLISECONDS_PER_PULSE pulse_area -= 1 pulse_npc -= 1 pulse_point -= 1 pulse_violence -= 1 pulse_ww -= 1 for ch in instance.characters.values(): if ch.wait > 0: ch.wait -= 1 if pulse_ww <= 0: pulse_ww = merc.PULSE_WW ww_update() if pulse_area <= 0: pulse_area = game_utils.number_range(merc.PULSE_AREA // 2, 3 * merc.PULSE_AREA // 2) db.area_update() instance_number_save( ) # Piggyback on area updates to save the instance number. if pulse_npc <= 0: pulse_npc = merc.PULSE_MOBILE npc_update() if pulse_violence <= 0: hotfix.poll_files() pulse_violence = merc.PULSE_VIOLENCE fight.violence_update() if pulse_point <= 0: pulse_point = game_utils.number_range(merc.PULSE_TICK // 2, 3 * merc.PULSE_TICK // 2) weather_update() char_update() item_update() aggr_update()
def cmd_regenerate(ch, argument): if ch.is_npc(): return if not ch.is_vampire(): ch.huh() return if ch.powers[merc.UNI_RAGE] > 0: ch.send( "You cannot control your regenerative powers while the beast is so strong.\n" ) return if ch.position == merc.POS_FIGHTING: ch.send("You cannot regenerate while fighting.\n") return if ch.hit >= ch.max_hit and ch.mana >= ch.max_mana and ch.move >= ch.max_move: ch.send("But you are already completely regenerated!\n") return if ch.blood < 5: ch.send("You have insufficient blood.\n") return ch.blood -= game_utils.number_range(2, 5) if ch.hit >= ch.max_hit and ch.mana >= ch.max_mana and ch.move >= ch.max_move: ch.send("Your body has completely regenerated.\n") handler_game.act("$n's body completely regenerates itself.", ch, None, None, merc.TO_ROOM) else: ch.send("Your body slowly regenerates itself.\n") if ch.hit < 1: ch.hit += 1 fight.update_pos(ch) ch.wait_state(merc.PULSE_VIOLENCE * 2) else: rmin = 5 rmax = 10 rmin += 10 - ch.powers[merc.UNI_GEN] rmax += 20 - (ch.powers[merc.UNI_GEN] * 2) ch.hit = min(ch.hit + game_utils.number_range(rmin, rmax), ch.max_hit) ch.mana = min(ch.mana + game_utils.number_range(rmin, rmax), ch.max_mana) ch.move = min(ch.move + game_utils.number_range(rmin, rmax), ch.max_move) fight.update_pos(ch)
def cmd_rage(ch, argument): if ch.is_npc(): return if ch.is_vampire(): if ch.powers[merc.UNI_RAGE] >= 25: ch.send("Your beast is already controlling you.\n") return if not ch.vampaff.is_set(merc.VAM_NIGHTSIGHT): ch.cmd_nightsight("") if not ch.vampaff.is_set(merc.VAM_FANGS): ch.cmd_fangs("") if not ch.vampaff.is_set(merc.VAM_CLAWS): ch.cmd_claws("") ch.send( "You bare yours fangs and growl as your inner beast consumes you.\n" ) handler_game.act( "$n bares $s fangs and growls as $s inner beast consumes $m.", ch, None, None, merc.TO_ROOM) ch.powers[merc.UNI_RAGE] += game_utils.number_range(10, 20) if ch.beast > 0: ch.beastlike() ch.wait_state(merc.PULSE_VIOLENCE) return if not ch.is_werewolf() or ch.powers[merc.WPOWER_BEAR] < 2: ch.huh() return if not ch.special.is_set(merc.SPC_WOLFMAN): ch.send("You start snarling angrilly.\n") handler_game.act("$n starts snarling angrilly.", ch, None, None, merc.TO_ROOM) ch.powers[merc.UNI_RAGE] += game_utils.number_range(10, 20) if ch.powers[merc.UNI_RAGE] >= 100: ch.werewolf() ch.wait_state(merc.PULSE_VIOLENCE) return ch.send("But you are already in a rage!\n")
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)
def cmd_darkheart(ch, argument): if ch.is_npc(): return if not ch.is_vampire(): ch.huh() return if not ch.vampaff.is_set(merc.VAM_SERPENTIS): ch.send("You are not trained in the Serpentis discipline.\n") return if ch.immune.is_set(merc.IMM_STAKE): ch.send("But you've already torn your heart out!\n") return if ch.blood < 100: ch.send("You have insufficient blood.\n") return ch.blood -= 100 ch.send("You rip your heart from your body and toss it to the ground.\n") handler_game.act("$n rips $s heart out and tosses it to the ground.", ch, None, None, merc.TO_ROOM) object_creator.make_part(ch, "heart") ch.hit -= game_utils.number_range(10, 20) fight.update_pos(ch) if ch.position == merc.POS_DEAD and not ch.is_hero(): ch.send("You have been KILLED!!\n\n") fight.raw_kill(ch) return ch.immune.set_bit(merc.IMM_STAKE)
def p_reset(parea, preset, last, level, npc): if preset.arg1 not in instance.item_templates.keys(): comm.notify("p_reset: 'P': bad vnum {}".format(preset.arg1), merc.CONSOLE_WARNING) return last, level, npc else: item_template = instance.item_templates[preset.arg1] if preset.arg3 not in instance.item_templates.keys(): comm.notify("p_reset: 'P': bad vnum {}".format(preset.arg3), merc.CONSOLE_WARNING) return last, level, npc else: item_to_template = instance.item_templates[preset.arg3] item_to = None item_to_list = instance.instances_by_item.get(item_to_template.vnum, None) if item_to_list: item_to = instance.global_instances[item_to_list[0]] if parea.player_count > 0 or not item_to or not item_to.in_room or handler_item.count_obj_list( item_template, item_to.inventory) > 0: last = False return last, level, npc item = object_creator.create_item(item_template, game_utils.number_range(1, 50)) item_to.put(item) last = True return last, level, npc
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 cmd_eyespy(ch, argument): if ch.head.is_set(merc.LOST_EYE_L) and ch.head.is_set(merc.LOST_EYE_R): ch.send("But you don't have any more eyes to pluck out!\n") return if not ch.head.is_set(merc.LOST_EYE_L) and game_utils.number_range(1, 2) == 1: handler_game.act("You pluck out your left eyeball and throw it to the ground.", ch, None, None, merc.TO_CHAR) handler_game.act("$n plucks out $s left eyeball and throws it to the ground.", ch, None, None, merc.TO_ROOM) elif not ch.head.is_set(merc.LOST_EYE_R): handler_game.act("You pluck out your right eyeball and throw it to the ground.", ch, None, None, merc.TO_CHAR) handler_game.act("$n plucks out $s right eyeball and throws it to the ground.", ch, None, None, merc.TO_ROOM) else: handler_game.act("You pluck out your left eyeball and throw it to the ground.", ch, None, None, merc.TO_CHAR) handler_game.act("$n plucks out $s left eyeball and throws it to the ground.", ch, None, None, merc.TO_ROOM) familiar = ch.familiar if familiar: object_creator.make_part(ch, "eyeball") return if merc.MOB_VNUM_EYE not in instance.npc_templates: ch.send("Error - please inform an Immortal.\n") return victim = object_creator.create_mobile(instance.npc_templates[merc.MOB_VNUM_EYE]) ch.in_room.put(victim) ch.familiar = victim victim.wizard = ch
def spl_teleport(sn, level, ch, victim, target): if not victim.in_room or victim.in_room.room_flags.is_set(merc.ROOM_NO_RECALL) or victim.in_room.room_flags.is_set(merc.ROOM_SAFE) or \ victim.in_room.room_flags.is_set(merc.ROOM_NO_TELEPORT) or (not ch.is_npc() and victim.fighting) or \ (not victim.is_npc() and not victim.immune.is_set(merc.IMM_SUMMON)) or (victim != ch and handler_magic.saves_spell(level, victim)): ch.send("You failed.\n") return while True: to_room = game_utils.number_range(0, 65535) proomindex = instance.rooms[to_room] if proomindex and not proomindex.room_flags.is_set(merc.ROOM_PRIVATE) and not proomindex.room_flags.is_set(merc.ROOM_SOLITARY) and \ proomindex.room_flags.is_set(merc.ROOM_NO_TELEPORT) and to_room not in [30008, 30002]: 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")
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)
def cmd_shield(ch, argument): if ch.is_npc(): return if not ch.is_werewolf() or ch.powers[merc.WPOWER_OWL] < 2: if not ch.is_vampire(): ch.huh() return if not ch.vampaff.is_set(merc.VAM_OBFUSCATE) and not ch.vampaff.is_set( merc.VAM_DOMINATE) and not ch.is_werewolf(): ch.send( "You are not trained in the Obfuscate or Dominate disciplines.\n") return if ch.is_vampire(): if ch.blood < 60: ch.send("You have insufficient blood.\n") return ch.blood -= game_utils.number_range(50, 60) ch.immune.tog_bit(merc.IMM_SHIELDED) if ch.immune.is_set(merc.IMM_SHIELDED): ch.send("You shield your aura from those around you.\n") else: ch.send("You stop shielding your aura.\n")
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)
def o_reset(parea, preset, last, level, npc): if preset.arg1 not in instance.item_templates.keys(): comm.notify("o_reset: 'O': bad vnum {}".format(preset.arg1), merc.CONSOLE_WARNING) return last, level, npc else: item_template = instance.item_templates[preset.arg1] if preset.arg3 not in instance.room_templates.keys(): comm.notify("o_reset: 'R': bad vnum {}".format(preset.arg3), merc.CONSOLE_WARNING) return last, level, npc else: room_instance_id = instance.instances_by_room[preset.arg3][0] room_instance = instance.global_instances[room_instance_id] if parea.player_count > 0 or handler_item.count_obj_list( item_template, room_instance.items) > 0: last = False return last, level, npc item = object_creator.create_item(item_template, game_utils.number_range(1, 50)) item.cost = 0 room_instance.put(item) last = True return last, level, npc
def cmd_shadowsight(ch, argument): if ch.is_npc(): return if ch.is_demon() or ch.special.is_set(merc.SPC_CHAMPION): if not ch.dempower(merc.DEM_SHADOWSIGHT): ch.send("You haven't been granted the gift of shadowsight.\n") return elif not ch.is_werewolf() or ch.powers[merc.WPOWER_HAWK] < 2: if not ch.is_vampire(): ch.huh() return if not ch.vampaff.is_set(merc.VAM_OBTENEBRATION): ch.send("You are not trained in the Obtenebration discipline.\n") return if ch.is_affected(merc.AFF_SHADOWSIGHT): ch.send("You can no longer see between planes.\n") ch.affected_by.rem_bit(merc.AFF_SHADOWSIGHT) return if ch.is_vampire(): if ch.blood < 10: ch.send("You have insufficient blood.\n") return ch.blood -= game_utils.number_range(5, 10) ch.send("You can now see between planes.\n") ch.affected_by.set_bit(merc.AFF_SHADOWSIGHT)
def spl_portal(sn, level, ch, victim, target): handler_magic.target_name, arg = game_utils.read_word(handler_magic.target_name) if not arg: ch.send("Who do you wish to create a portal to?\n") return victim = ch.get_char_world(arg) if not victim or victim == ch or not victim.in_room or ch.is_npc() or victim.is_npc() or \ (not victim.is_npc() and not victim.immune.is_set(merc.IMM_SUMMON)) or ch.in_room.room_flags.is_set(merc.ROOM_PRIVATE) or \ ch.in_room.room_flags.is_set(merc.ROOM_SOLITARY) or ch.in_room.room_flags.is_set(merc.ROOM_NO_RECALL) or \ victim.in_room.room_flags.is_set(merc.ROOM_PRIVATE) or victim.in_room.room_flags.is_set(merc.ROOM_SOLITARY) or \ victim.in_room.room_flags.is_set(merc.ROOM_NO_RECALL) or victim.in_room == ch.in_room: ch.send("You failed.\n") return duration = game_utils.number_range(2, 3) item = object_creator.create_item(instance.item_templates[merc.OBJ_VNUM_PORTAL], 0) item.value[0] = victim.in_room.vnum item.value[3] = ch.in_room.vnum item.timer = duration item.flags.shadowplane = ch.is_affected(merc.AFF_SHADOWPLANE) ch.in_room.put(item) item = object_creator.create_item(instance.item_templates[merc.OBJ_VNUM_PORTAL], 0) item.value[0] = ch.in_room.vnum item.value[3] = victim.in_room.vnum item.timer = duration item.flags.shadowplane = victim.is_affected(merc.AFF_SHADOWPLANE) victim.in_room.put(item) handler_game.act("$p appears in front of $n.", ch, item, None, merc.TO_ROOM) handler_game.act("$p appears in front of you.", ch, item, None, merc.TO_CHAR) handler_game.act("$p appears in front of $n.", victim, item, None, merc.TO_ROOM) handler_game.act("$p appears in front of you.", ch, item, victim, merc.TO_VICT)
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)
def ww_update(): for victim in list(instance.characters.values()): if victim.is_npc() or victim.is_immortal( ) or not victim.in_room or victim.chobj or victim.is_werewolf(): continue if not victim.in_room.room_flags.is_set(merc.ROOM_BLADE_BARRIER): continue handler_game.act( "The scattered blades on the ground fly up into the air ripping into you.", victim, None, None, merc.TO_CHAR) handler_game.act( "The scattered blades on the ground fly up into the air ripping into $n.", victim, None, None, merc.TO_ROOM) handler_game.act("The blades drop to the ground inert.", victim, None, None, merc.TO_CHAR) handler_game.act("The blades drop to the ground inert.", victim, None, None, merc.TO_ROOM) dam = game_utils.number_range(7, 14) dam = dam // 100 dam = victim.hit * dam dam = max(dam, 100) victim.hit -= dam if victim.hit < -10: victim.hit = -10 fight.update_pos(victim)
def make_corpse(ch): if ch.is_npc(): name = ch.short_descr corpse = create_item(instance.item_templates[merc.OBJ_VNUM_CORPSE_NPC], 0) corpse.timer = game_utils.number_range(4, 8) corpse.value[2] = ch.vnum else: name = ch.name corpse = create_item(instance.item_templates[merc.OBJ_VNUM_CORPSE_PC], 0) corpse.timer = game_utils.number_range(25, 40) # Why should players keep their gold? if ch.gold > 0: gold = create_money(ch.gold) if ch.is_affected(merc.AFF_SHADOWPLANE): gold.flags.shadowplane = True corpse.put(gold) ch.gold = 0 corpse.short_descr = corpse.short_descr % name corpse.description = corpse.description % name for item_id in ch.equipped.values(): if not item_id: continue item = instance.items[item_id] ch.unequip(item.equipped_to, silent=True, forced=True) for item_id in ch.inventory[:]: item = instance.items[item_id] ch.get(item) if item.flags.vanish: item.extract() else: if ch.is_affected(merc.AFF_SHADOWPLANE): item.flags.shadowplane = True corpse.put(item) if ch.is_affected(merc.AFF_SHADOWPLANE): corpse.flags.shadowplane = True ch.in_room.put(corpse)
def cmd_scry(ch, argument): argument, arg = game_utils.read_word(argument) if ch.is_npc(): return if ch.is_demon() or ch.special.is_set(merc.SPC_CHAMPION): if not ch.dempower.is_set(merc.DEM_SCRY): ch.send("You haven't been granted the gift of claws.\n") return elif not ch.is_vampire() and not ch.itemaff.is_set(merc.ITEMA_VISION): ch.huh() return if not ch.is_demon() and not ch.special.is_set(merc.SPC_CHAMPION) and not ch.vampaff.is_set(merc.VAM_AUSPEX) and \ not ch.itemaff.is_set(merc.ITEMA_VISION): ch.send("You are not trained in the Auspex discipline.\n") return if not arg: ch.send("Scry on whom?\n") return victim = ch.get_char_world(arg) if not victim: ch.not_here(arg) return if ch.is_vampire() and not ch.itemaff.is_set(merc.ITEMA_VISION): if ch.blood < 25: ch.send("You have insufficient blood.\n") return ch.blood -= game_utils.number_range(15, 25) if not victim.is_npc() and victim.immune.is_set( merc.IMM_SHIELDED) and not ch.itemaff.is_set(merc.ITEMA_VISION): ch.send("You are unable to locate them.\n") return chroom = ch.in_room victimroom = victim.in_room ch.in_room.get(ch) victimroom.put(ch) if ch.is_affected(merc.AFF_SHADOWPLANE) and not victim.is_affected( merc.AFF_SHADOWPLANE): ch.affected_by.rem_bit(merc.AFF_SHADOWPLANE) ch.cmd_look("auto") ch.affected_by.set_bit(merc.AFF_SHADOWPLANE) elif not ch.is_affected(merc.AFF_SHADOWPLANE) and victim.is_affected( merc.AFF_SHADOWPLANE): ch.affected_by.set_bit(merc.AFF_SHADOWPLANE) ch.cmd_look("auto") ch.affected_by.rem_bit(merc.AFF_SHADOWPLANE) else: ch.cmd_look("auto") ch.in_room.get(ch) chroom.put(ch)
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)
def spl_lightning_breath(sn, level, ch, victim, target): if victim.itemaff.is_set(merc.ITEMA_SHOCKSHIELD): return 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_LIGHTNING)) else dam, sn)
def init_time(): lhour = int(merc.current_time - 650336715) // (merc.PULSE_TICK // merc.PULSE_PER_SECOND) handler_game.time_info.hour = lhour % 24 lday = lhour // 24 handler_game.time_info.day = int(lday % 35) lmonth = lday // 35 handler_game.time_info.month = lmonth % 17 handler_game.time_info.year = lmonth // 17 if handler_game.time_info.hour < 5: handler_game.weather_info.sunlight = merc.SUN_DARK elif handler_game.time_info.hour < 6: handler_game.weather_info.sunlight = merc.SUN_RISE elif handler_game.time_info.hour < 19: handler_game.weather_info.sunlight = merc.SUN_LIGHT elif handler_game.time_info.hour < 20: handler_game.weather_info.sunlight = merc.SUN_SET else: handler_game.weather_info.sunlight = merc.SUN_DARK handler_game.weather_info.change = 0 handler_game.weather_info.mmhg = 960 if 7 <= handler_game.time_info.month <= 12: handler_game.weather_info.mmhg += game_utils.number_range(1, 50) else: handler_game.weather_info.mmhg += game_utils.number_range(1, 80) if handler_game.weather_info.mmhg <= 980: handler_game.weather_info.sky = merc.SKY_LIGHTNING elif handler_game.weather_info.mmhg <= 1000: handler_game.weather_info.sky = merc.SKY_RAINING elif handler_game.weather_info.mmhg <= 1020: handler_game.weather_info.sky = merc.SKY_CLOUDY else: handler_game.weather_info.sky = merc.SKY_CLOUDLESS
def r_reset(preset, last, level, npc): if preset.arg1 not in instance.room_templates.keys(): comm.notify("r_reset: 'R': bad vnum {}".format(preset.arg1), merc.CONSOLE_WARNING) return last, level, npc else: room_instance_id = instance.instances_by_room[preset.arg1][0] room_instance = instance.global_instances[room_instance_id] for d0 in merc.irange(preset.arg2 - 1): d1 = game_utils.number_range(d0, preset.arg2 - 1) pexit = room_instance.exit[d0] room_instance.exit[d0] = room_instance.exit[d1] room_instance.exit[d1] = pexit return last, level, npc
def spl_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, 15, 20, 25, 30, 35, 40, 45, 55, 65, 75 ] 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)
def cmd_serpent(ch, argument): if ch.is_npc(): return if not ch.is_vampire(): ch.huh() return if not ch.vampaff.is_set(merc.VAM_SERPENTIS): ch.send("You are not trained in the Serpentis discipline.\n") return if ch.is_affected(merc.AFF_POLYMORPH): if not ch.polyaff.is_set(merc.POLY_SERPENT): ch.send("You cannot polymorph from this form.\n") return handler_game.act("You transform back into human.", ch, None, None, merc.TO_CHAR) handler_game.act("$n transform into human form.", ch, None, None, merc.TO_ROOM) ch.polyaff.rem_bit(merc.POLY_SERPENT) ch.affected_by.rem_bit(merc.AFF_POLYMORPH) ch.clear_stats() ch.morph = "" return if ch.blood < 50: ch.send("You have insufficient blood.\n") return ch.blood -= game_utils.number_range(40, 50) ch.clear_stats() if ch.stance[0] != -1: ch.cmd_stance("") if ch.mounted == merc.IS_RIDING: ch.cmd_dismount("") ch.mod_str = 10 handler_game.act("You transform into a huge serpent.", ch, None, None, merc.TO_CHAR) handler_game.act("$n transforms into a huge serpent.", ch, None, None, merc.TO_ROOM) ch.polyaff.set_bit(merc.POLY_SERPENT) ch.affected_by.set_bit(merc.AFF_POLYMORPH) ch.morph = "{} the huge serpent".format(ch.name)
def spl_chill_touch(sn, level, ch, victim, target): dam_each = [9, 10, 10, 10, 11, 11, 12, 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, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120] level = min(level, len(dam_each) - 1) level = max(0, level) dam = game_utils.number_range(dam_each[level] // 2, dam_each[level] * 2) no_dam = (not victim.is_npc() and victim.immune.is_set(merc.IMM_COLD)) if not no_dam and (not handler_magic.saves_spell(level, victim) or victim.is_npc() or not victim.is_vampire()): aff = handler_game.AffectData(type=sn, duration=6, location=merc.APPLY_STR, modifier=-1) victim.affect_add(aff) else: dam //= 2 fight.damage(ch, victim, 0 if no_dam else dam, sn)
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)