def spell_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")
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 spell_cure_serious(sn, level, ch, victim, target): heal = game_utils.dice(2, 8) + level // 2 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")
def cmd_restore(ch, argument): argument, arg = game_utils.read_word(argument) if not arg: ch.send("Restore whom?\n") return victim = ch.get_char_world(arg) if not victim: ch.not_here(arg) return if victim.act.is_set( merc.PLR_GODLESS ) and ch.trust < merc.NO_GODLESS and not ch.extra.is_set( merc.EXTRA_ANTI_GODLESS): ch.send("You failed.\n") return victim.hit = victim.max_hit victim.mana = victim.max_mana victim.move = victim.max_move victim.head.erase() victim.arm_left.erase() victim.arm_right.erase() victim.body.erase() victim.leg_left.erase() victim.leg_right.erase() victim.bleeding.erase() fight.update_pos(victim) handler_game.act("$n has restored you.", ch, None, victim, merc.TO_VICT) ch.send("Ok.\n")
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 spl_mana(sn, level, ch, victim, target): if not ch.is_npc() and not ch.is_vampire() and ch.vampaff.is_set( merc.VAM_CELERITY): if ch.move < 25: ch.send("You are too exhausted to do that.\n") return ch.move -= 25 else: if ch.move < 50: ch.send("You are too exhausted to do that.\n") return ch.move -= 50 victim.mana = min(victim.mana + level + 10, victim.max_mana) fight.update_pos(ch) fight.update_pos(victim) if ch == victim: ch.send("You draw in energy from your surrounding area.\n") handler_game.act("$n draws in energy from $s surrounding area.", ch, None, None, merc.TO_ROOM) return handler_game.act( "You draw in energy from around you and channel it into $N.", ch, None, victim, merc.TO_CHAR) handler_game.act("$n draws in energy and channels it into $N.", ch, None, victim, merc.TO_NOTVICT) handler_game.act("$n draws in energy and channels it into you.", ch, None, victim, merc.TO_VICT) if not ch.is_npc() and ch != victim: ch.humanity()
def spell_heal(sn, level, ch, victim, target): victim.hit = min(victim.hit + 100, victim.max_hit) fight.update_pos(victim) victim.send("A warm feeling fills your body.\n") if ch != victim: ch.send("Ok.\n") return
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()
def spl_heal(sn, level, ch, victim, target): victim.hit = min(victim.hit + 100, victim.max_hit) fight.update_pos(victim) victim.send("A warm feeling fills your body.\n") if ch == victim: handler_game.act("$n heals $mself.", ch, None, None, merc.TO_ROOM) else: handler_game.act("$n heals $N.", ch, None, victim, merc.TO_NOTVICT) ch.send("Ok.\n") if not ch.is_npc(): ch.humanity()
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 do_restore(ch, argument): junky, arg = game_utils.read_word(argument) if not arg or arg == "room": # cure room for vch_id in ch.in_room.people: vch = instance.characters[vch_id] vch.affect_strip("plague") vch.affect_strip("poison") vch.affect_strip("blindness") vch.affect_strip("sleep") vch.affect_strip("curse") vch.hit = vch.max_hit vch.mana = vch.max_mana vch.move = vch.max_move fight.update_pos(vch) handler_game.act("$n has restored you.", ch, None, vch, merc.TO_VICT) handler_game.wiznet("$N restored room %d." % ch.in_room.vnum, ch, None, merc.WIZ_RESTORE, merc.WIZ_SECURE, ch.trust) ch.send("Room restored.\n") return if ch.trust >= merc.MAX_LEVEL - 1 and arg == "all": # cure all for d in merc.descriptor_list: victim = d.character if victim is None or victim.is_npc(): continue victim.affect_strip("plague") victim.affect_strip("poison") victim.affect_strip("blindness") victim.affect_strip("sleep") victim.affect_strip("curse") victim.hit = victim.max_hit victim.mana = victim.max_mana victim.move = victim.max_move fight.update_pos(victim) if victim.in_room: handler_game.act("$n has restored you.", ch, None, victim, merc.TO_VICT) ch.send("All active players restored.\n") return victim = ch.get_char_world(arg) if not victim: ch.send("They aren't here.\n") return victim.affect_strip("plague") victim.affect_strip("poison") victim.affect_strip("blindness") victim.affect_strip("sleep") victim.affect_strip("curse") victim.hit = victim.max_hit victim.mana = victim.max_mana victim.move = victim.max_move fight.update_pos(victim) handler_game.act("$n has restored you.", ch, None, victim, merc.TO_VICT) buf = "$N restored %s", (victim.short_descr if victim.is_npc() else victim.name) handler_game.wiznet(buf, ch, None, merc.WIZ_RESTORE, merc.WIZ_SECURE, ch.trust) ch.send("Ok.\n") return
def cmd_voodoo(ch, argument): argument, arg1 = game_utils.read_word(argument) argument, arg2 = game_utils.read_word(argument) if not arg1: ch.send("Who do you wish to use voodoo magic on?\n") return item = ch.get_eq("left_hand") if not item: item = ch.get_eq("right_hand") if not item: ch.send("You are not holding a voodoo doll.\n") return victim = ch.get_char_world(arg1) if not victim: ch.not_here(arg1) return if victim.is_npc(): ch.not_npc() return part1 = "{} voodoo doll".format(victim.name) part2 = item.name if not game_utils.str_cmp(part1, part2): ch.send("But you are holding {}, not {}!\n".format(item.short_descr, victim.name)) return if game_utils.str_cmp(arg2, "stab"): ch.wait_state(merc.PULSE_VIOLENCE) handler_game.act("You stab a pin through $p.", ch, item, None, merc.TO_CHAR) handler_game.act("$n stabs a pin through $p.", ch, item, None, merc.TO_ROOM) if not victim.is_npc() and victim.immune.is_set(merc.IMM_VOODOO): return handler_game.act("You feel an agonising pain in your chest!", victim, None, None, merc.TO_CHAR) handler_game.act("$n clutches $s chest in agony!", victim, None, None, merc.TO_ROOM) elif game_utils.str_cmp(arg2, "burn"): ch.wait_state(merc.PULSE_VIOLENCE) handler_game.act("You set fire to $p.", ch, item, None, merc.TO_CHAR) handler_game.act("$n sets fire to $p.", ch, item, None, merc.TO_ROOM) handler_game.act("$p burns to ashes.", ch, item, None, merc.TO_CHAR) handler_game.act("$p burns to ashes.", ch, item, None, merc.TO_ROOM) ch.get(item) item.extract() if not victim.is_npc() and victim.immune.is_set(merc.IMM_VOODOO) or victim.is_affected(merc.AFF_FLAMING): return victim.affected_by.set_bit(merc.AFF_FLAMING) handler_game.act("You suddenly burst into flames!", victim, None, None, merc.TO_CHAR) handler_game.act("$n suddenly bursts into flames!", victim, None, None, merc.TO_ROOM) elif game_utils.str_cmp(arg2, "throw"): ch.wait_state(merc.PULSE_VIOLENCE) handler_game.act("You throw $p to the ground.", ch, item, None, merc.TO_CHAR) handler_game.act("$n throws $p to the ground.", ch, item, None, merc.TO_ROOM) ch.get(item) ch.in_room.put(item) if not victim.is_npc() and victim.immuen.is_set(merc.IMM_VOODOO) or victim.position < merc.POS_STANDING: return if victim.position == merc.POS_FIGHTING: fight.stop_fighting(victim, True) handler_game.act("A strange force picks you up and hurls you to the ground!", victim, None, None, merc.TO_CHAR) handler_game.act("$n is hurled to the ground by a strange force.", victim, None, None, merc.TO_ROOM) victim.position = merc.POS_RESTING victim.hit = victim.hit - game_utils.number_range(ch.level, (5 * ch.level)) fight.update_pos(victim) if victim.position == merc.POS_DEAD and not victim.is_npc(): ch.cmd_killperson(victim) return else: ch.send("You can 'stab', 'burn' or 'throw' the doll.\n")
def cmd_hurl(ch, argument): argument, arg1 = game_utils.read_word(argument) argument, arg2 = game_utils.read_word(argument) if not ch.is_npc() and ch.learned["hurl"] < 1: ch.send("Maybe you should learn the skill first?\n") return if not arg1: ch.send("Who do you wish to hurl?\n") return victim = ch.get_char_room(arg1) if not victim: ch.not_here(arg1) return if ch == victim: ch.not_self() return if fight.is_safe(ch, victim): return mount = victim.mount if mount and victim.mounted == merc.IS_MOUNT: ch.send("But they have someone on their back!\n") return if mount and victim.mounted == merc.IS_RIDING: ch.send("But they are riding!\n") return if not victim.is_npc() and victim.immune.is_set(merc.IMM_HURL): ch.send("You are unable to get their feet of the ground.\n") return if victim.is_npc() and victim.level > 900: ch.send("You are unable to get their feet of the ground.\n") return if victim.hit < victim.max_hit or (victim.position == merc.POS_FIGHTING and victim.fighting != ch): handler_game.act("$N is hurt and suspicious, and you are unable to approach $M.", ch, None, victim, merc.TO_CHAR) return ch.wait_state(const.skill_table["hurl"].beats) if not ch.is_npc() and game_utils.number_percent() > ch.learned["hurl"]: ch.send("You are unable to get their feet of the ground.\n") fight.multi_hit(victim, ch, merc.TYPE_UNDEFINED) return if not arg2: door = game_utils.number_range(0, 3) else: if game_utils.str_cmp(arg2, ["n", "north"]): door = merc.DIR_NORTH elif game_utils.str_cmp(arg2, ["e", "east"]): door = merc.DIR_EAST elif game_utils.str_cmp(arg2, ["s", "south"]): door = merc.DIR_SOUTH elif game_utils.str_cmp(arg2, ["w", "west"]): door = merc.DIR_WEST else: ch.send("You can only hurl people north, south, east or west.\n") return if door == merc.DIR_NORTH: direction = "north" rev_dir = 2 elif door == merc.DIR_EAST: direction = "east" rev_dir = 3 elif door == merc.DIR_SOUTH: direction = "south" rev_dir = 0 else: direction = "west" rev_dir = 1 pexit = ch.in_room.exit[door] to_room = instance.rooms[pexit.to_room] if pexit else None if not pexit or not to_room: handler_game.act("$n hurls $N into the $t wall.", ch, direction, victim, merc.TO_NOTVICT) handler_game.act("You hurl $N into the $t wall.", ch, direction, victim, merc.TO_CHAR) handler_game.act("$n hurls you into the $t wall.", ch, direction, victim, merc.TO_VICT) dam = game_utils.number_range(ch.level, (ch.level * 4)) victim.hit -= dam fight.update_pos(victim) if victim.is_npc() and not ch.is_npc(): ch.mkill += 1 if not victim.is_npc() and ch.is_npc(): victim.mdeath += 1 if victim.position == merc.POS_DEAD: fight.raw_kill(victim) return return pexit = victim.in_room.exit[door] if pexit.exit_info.is_set(merc.EX_CLOSED) and not victim.is_affected(merc.AFF_PASS_DOOR) and not victim.is_affected(merc.AFF_ETHEREAL): pexit.exit_info.rem_bit(merc.EX_LOCKED) pexit.exit_info.rem_bit(merc.EX_CLOSED) handler_game.act("$n hoists $N in the air and hurls $M $t.", ch, direction, victim, merc.TO_NOTVICT) handler_game.act("You hoist $N in the air and hurl $M $t.", ch, direction, victim, merc.TO_CHAR) handler_game.act("$n hurls you $t, smashing you through the {}.".format(pexit.keyword), ch, direction, victim, merc.TO_VICT) handler_game.act("There is a loud crash as $n smashes through the $d.", victim, None, pexit.keyword, merc.TO_ROOM) to_room = pexit.to_room pexit_rev = instance.rooms[to_room].exit[rev_dir] if to_room and pexit_rev and pexit_rev.to_room == ch.in_room and pexit_rev.keyword: pexit_rev.exit_info.rem_bit(merc.EX_LOCKED) pexit_rev.exit_info.rem_bit(merc.EX_CLOSED) if door == 0: direction = "south" elif door == 1: direction = "west" elif door == 2: direction = "north" else: direction = "east" victim.in_room.get(victim) to_room.put(victim) handler_game.act("$n comes smashing in through the $t $d.", victim, direction, pexit.keyword, merc.TO_ROOM) dam = game_utils.number_range(ch.level, (ch.level * 6)) victim.hit -= dam fight.update_pos(victim) if victim.is_npc() and not ch.is_npc(): ch.mkill += 1 if not victim.is_npc() and ch.is_npc(): victim.mdeath += 1 if victim.position == merc.POS_DEAD: fight.raw_kill(victim) else: handler_game.act("$n hurls $N $t.", ch, direction, victim, merc.TO_NOTVICT) handler_game.act("You hurl $N $t.", ch, direction, victim, merc.TO_CHAR) handler_game.act("$n hurls you $t.", ch, direction, victim, merc.TO_VICT) if door == 0: direction = "south" elif door == 1: direction = "west" elif door == 2: direction = "north" else: direction = "east" victim.in_room.get(victim) to_room.put(victim) handler_game.act("$n comes flying in from the $t.", victim, direction, None, merc.TO_ROOM) dam = game_utils.number_range(ch.level, (ch.level * 2)) victim.hit -= dam fight.update_pos(victim) if victim.is_npc() and not ch.is_npc(): ch.mkill += 1 if not victim.is_npc() and ch.is_npc(): victim.mdeath += 1 if victim.position == merc.POS_DEAD: fight.raw_kill(victim)
def char_update(): # update save counter */ global save_number save_number += 1 if save_number > 29: save_number = 0 ch_quit = [] id_list = [instance_id for instance_id in instance.characters.keys()] for character_id in id_list: ch = instance.characters[character_id] if ch.timer > 30: ch_quit.append(ch) if ch.position >= merc.POS_STUNNED: # check to see if we need to go home */ if ch.is_npc() and ch.zone and ch.zone != instance.area_templates[ch.zone] \ and not ch.desc and not ch.fighting\ and not ch.is_affected(merc.AFF_CHARM) and random.randint(1, 99) < 5: handler_game.act("$n wanders on home.", ch, None, None, merc.TO_ROOM) ch.extract(True) id_list.remove(character_id) continue if ch.hit < ch.max_hit: ch.hit += hit_gain(ch) else: ch.hit = ch.max_hit if ch.mana < ch.max_mana: ch.mana += mana_gain(ch) else: ch.mana = ch.max_mana if ch.move < ch.max_move: ch.move += move_gain(ch) else: ch.move = ch.max_move if ch.position == merc.POS_STUNNED: fight.update_pos(ch) if not ch.is_npc() and ch.level < merc.LEVEL_IMMORTAL: item = ch.get_eq('light') if item and item.item_type == merc.ITEM_LIGHT and item.value[2] > 0: item.value[2] -= 1 if item.value[2] == 0 and ch.in_room is not None: ch.in_room.available_light -= 1 handler_game.act("$p goes out.", ch, item, None, merc.TO_ROOM) handler_game.act("$p flickers and goes out.", ch, item, None, merc.TO_CHAR) item.extract() elif item.value[2] <= 5 and ch.in_room: handler_game.act("$p flickers.", ch, item, None, merc.TO_CHAR) if ch.is_immortal(): ch.timer = 0 ch.timer += 1 if ch.timer >= 12: if not ch.was_in_room and ch.in_room: ch.was_in_room = ch.in_room if ch.fighting: fight.stop_fighting(ch, True) handler_game.act("$n disappears into the void.", ch, None, None, merc.TO_ROOM) ch.send("You disappear into the void.\n") if ch.level > 1: ch.save() limbo_id = instance.instances_by_room[merc.ROOM_VNUM_LIMBO][0] limbo = instance.rooms[limbo_id] ch.in_room.get(ch) limbo.put(ch) gain_condition(ch, merc.COND_DRUNK, -1) gain_condition(ch, merc.COND_FULL, -4 if ch.size > merc.SIZE_MEDIUM else -2) gain_condition(ch, merc.COND_THIRST, -1) gain_condition(ch, merc.COND_HUNGER, -2 if ch.size > merc.SIZE_MEDIUM else -1) for paf in ch.affected[:]: if paf.duration > 0: paf.duration -= 1 if random.randint(0, 4) == 0 and paf.level > 0: paf.level -= 1 # spell strength fades with time */ elif paf.duration < 0: pass else: # multiple affects. don't send the spelldown msg multi = [a for a in ch.affected if a.type == paf.type and a is not paf and a.duration > 0] if not multi and paf.type and const.skill_table[paf.type].msg_off: ch.send(const.skill_table[paf.type].msg_off + "\n") ch.affect_remove(paf) # # * Careful with the damages here, # * MUST NOT refer to ch after damage taken, # * as it may be lethal damage (on NPC). # */ if state_checks.is_affected(ch, 'plague') and ch: if ch.in_room is None: continue handler_game.act("$n writhes in agony as plague sores erupt from $s skin.", ch, None, None, merc.TO_ROOM) ch.send("You writhe in agony from the plague.\n") af = [a for a in ch.affected if af.type == 'plague'][:1] if not af: ch.affected_by.rem_bit(merc.AFF_PLAGUE) continue if af.level == 1: continue plague = handler_game.AFFECT_DATA() plague.where = merc.TO_AFFECTS plague.type = 'plague' plague.level = af.level - 1 plague.duration = random.randint(1, 2 * plague.level) plague.location = merc.APPLY_STR plague.modifier = -5 plague.bitvector = merc.AFF_PLAGUE for vch_id in ch.in_room.people[:]: vch = instance.characters[vch_id] if not handler_magic.saves_spell(plague.level - 2, vch, merc.DAM_DISEASE) and not vch.is_immmortal() \ and not vch.is_affected(merc.AFF_PLAGUE) and random.randint(0, 4) == 0: vch.send("You feel hot and feverish.\n") handler_game.act("$n shivers and looks very ill.", vch, None, None, merc.TO_ROOM) vch.affect_join(plague) dam = min(ch.level, af.level // 5 + 1) ch.mana -= dam ch.move -= dam fight.damage(ch, ch, dam, 'plague', merc.DAM_DISEASE, False) elif ch.is_affected(merc.AFF_POISON) and ch and not ch.is_affected(merc.AFF_SLOW): poison = state_checks.affect_find(ch.affected, 'poison') if poison: handler_game.act("$n shivers and suffers.", ch, None, None, merc.TO_ROOM) ch.send("You shiver and suffer.\n") fight.damage(ch, ch, poison.level // 10 + 1, 'poison', merc.DAM_POISON, False) elif ch.position == merc.POS_INCAP and random.randint(0, 1) == 0: fight.damage(ch, ch, 1, merc.TYPE_UNDEFINED, merc.DAM_NONE, False) elif ch.position == merc.POS_MORTAL: fight.damage(ch, ch, 1, merc.TYPE_UNDEFINED, merc.DAM_NONE, False) # # * Autosave and autoquit. # * Check that these chars still exist. # */ for ch in instance.characters.values(): if not ch.is_npc() and ch.desc and save_number == 28: ch.save() for ch in ch_quit[:]: ch.do_quit("")
def char_update(): drop_out = False save_time = merc.current_time ch_save = None ch_quit = [] id_list = [instance_id for instance_id in instance.characters.keys()] for character_id in id_list: ch = instance.characters[character_id] if not ch.environment: continue if not ch.is_npc() and (ch.head.is_set(merc.LOST_HEAD) or ch.extra.is_set(merc.EXTRA_OSWITCH)): is_obj = True elif not ch.is_npc() and ch.obj_vnum != 0: is_obj = True ch.extra.set_bit(merc.EXTRA_OSWITCH) else: is_obj = False # Find dude with oldest save time. if not ch.is_npc() and ( not ch.desc or ch.desc.is_connected(nanny.con_playing) ) and ch.level >= 2 and ch.save_time < save_time: ch_save = ch save_time = ch.save_time if ch.position > merc.POS_STUNNED and not is_obj: if ch.hit < ch.max_hit: ch.hit += hit_gain(ch) else: ch.hit = ch.max_hit if ch.mana < ch.max_mana: ch.mana += mana_gain(ch) else: ch.mana = ch.max_mana if ch.move < ch.max_move: ch.move += move_gain(ch) else: ch.move = ch.max_move if ch.position == merc.POS_STUNNED and not is_obj: ch.hit += game_utils.number_range(2, 4) fight.update_pos(ch) if not ch.is_npc() and ch.level < merc.LEVEL_IMMORTAL and not is_obj: item1 = ch.get_eq("right_hand") item2 = ch.get_eq("left_hand") if (item1 and item1.item_type == merc.ITEM_LIGHT and item1.value[2] > 0) or \ (item2 and item2.item_type == merc.ITEM_LIGHT and item2.value[2] > 0): if item1: item1.value[2] -= 1 if item1.value[2] == 0 and ch.in_room: ch.in_room.available_light -= 1 handler_game.act("$p goes out.", ch, item1, None, merc.TO_ROOM) handler_game.act("$p goes out.", ch, item1, None, merc.TO_CHAR) item1.extract() elif item2: item2.value[2] -= 1 if item2.value[2] == 0 and ch.in_room: ch.in_room.available_light -= 1 handler_game.act("$p goes out.", ch, item2, None, merc.TO_ROOM) handler_game.act("$p goes out.", ch, item2, None, merc.TO_CHAR) item2.extract() if ch.is_immortal(): ch.timer = 0 ch.timer += 1 if ch.timer >= 12: if not ch.was_in_room and ch.in_room: ch.was_in_room = ch.in_room if ch.fighting: fight.stop_fighting(ch, True) handler_game.act("$n disappears into the void.", ch, None, None, merc.TO_ROOM) ch.send("You disappear into the void.\n") ch.save(force=True) limbo_id = instance.instances_by_room[ merc.ROOM_VNUM_LIMBO][0] limbo = instance.rooms[limbo_id] ch.in_room.get(ch) limbo.put(ch) if ch.timer > 30: ch_quit.append(ch) if ch.is_vampire(): blood = -1 if ch.beast > 0: if ch.vampaff.is_set(merc.VAM_CLAWS): blood -= game_utils.number_range(1, 3) if ch.vampaff.is_set(merc.VAM_FANGS): blood -= 1 if ch.vampaff.is_set(merc.VAM_NIGHTSIGHT): blood -= 1 if ch.vampaff.is_set(merc.AFF_SHADOWSIGHT): blood -= game_utils.number_range(1, 3) if ch.act.is_set(merc.PLR_HOLYLIGHT): blood -= game_utils.number_range(1, 5) if ch.vampaff.is_set(merc.VAM_DISGUISED): blood -= game_utils.number_range(5, 10) if ch.vampaff.is_set(merc.VAM_CHANGED): blood -= game_utils.number_range(5, 10) if ch.immune.is_set(merc.IMM_SHIELDED): blood -= game_utils.number_range(1, 3) if ch.polyaff.is_set(merc.POLY_SERPENT): blood -= game_utils.number_range(1, 3) if ch.beast == 100: blood *= 2 gain_condition(ch, blood) for aff in ch.affected[:]: if aff.duration > 0: aff.duration -= 1 elif aff.duration < 0: pass else: multi = [ a for a in ch.affected if a.type == aff.type and a is not aff and a.duration > 0 ] if not multi and aff.type and const.skill_table[ aff.type].msg_off: ch.send(const.skill_table[aff.type].msg_off + "\n") ch.affect_remove(aff) # Careful with the damages here, # MUST NOT refer to ch after damage taken, # as it may be lethal damage (on NPC). if not ch.bleeding.empty() and not is_obj and ch.in_room: dam = 0 minhit = 0 if ch.is_npc() else -11 if ch.bleeding.is_set( merc.BLEEDING_HEAD) and ch.hit - dam > minhit: handler_game.act( "A spray of blood shoots from the stump of $n's neck.", ch, None, None, merc.TO_ROOM) ch.send( "A spray of blood shoots from the stump of your neck.\n") dam += game_utils.number_range(20, 50) if ch.bleeding.is_set( merc.BLEEDING_THROAT) and ch.hit - dam > minhit: handler_game.act("Blood pours from the slash in $n's throat.", ch, None, None, merc.TO_ROOM) ch.send("Blood pours from the slash in your throat.\n") dam += game_utils.number_range(10, 20) if ch.bleeding.is_set( merc.BLEEDING_ARM_L) and ch.hit - dam > minhit: handler_game.act( "A spray of blood shoots from the stump of $n's left arm.", ch, None, None, merc.TO_ROOM) ch.send( "A spray of blood shoots from the stump of your left arm.\n" ) dam += game_utils.number_range(10, 20) elif ch.bleeding.is_set( merc.BLEEDING_HAND_L) and ch.hit - dam > minhit: handler_game.act( "A spray of blood shoots from the stump of $n's left wrist.", ch, None, None, merc.TO_ROOM) ch.send( "A spray of blood shoots from the stump of your left wrist.\n" ) dam += game_utils.number_range(5, 10) if ch.bleeding.is_set( merc.BLEEDING_ARM_R) and ch.hit - dam > minhit: handler_game.act( "A spray of blood shoots from the stump of $n's right arm.", ch, None, None, merc.TO_ROOM) ch.send( "A spray of blood shoots from the stump of your right arm.\n" ) dam += game_utils.number_range(10, 20) elif ch.bleeding.is_set( merc.BLEEDING_HAND_R) and ch.hit - dam > minhit: handler_game.act( "A spray of blood shoots from the stump of $n's right wrist.", ch, None, None, merc.TO_ROOM) ch.send( "A spray of blood shoots from the stump of your right wrist.\n" ) dam += game_utils.number_range(5, 10) if ch.bleeding.is_set( merc.BLEEDING_LEG_L) and ch.hit - dam > minhit: handler_game.act( "A spray of blood shoots from the stump of $n's left leg.", ch, None, None, merc.TO_ROOM) ch.send( "A spray of blood shoots from the stump of your left leg.\n" ) dam += game_utils.number_range(10, 20) elif ch.bleeding.is_set( merc.BLEEDING_FOOT_L) and ch.hit - dam > minhit: handler_game.act( "A spray of blood shoots from the stump of $n's left ankle.", ch, None, None, merc.TO_ROOM) ch.send( "A spray of blood shoots from the stump of your left ankle.\n" ) dam += game_utils.number_range(5, 10) if ch.bleeding.is_set( merc.BLEEDING_LEG_R) and ch.hit - dam > minhit: handler_game.act( "A spray of blood shoots from the stump of $n's right leg.", ch, None, None, merc.TO_ROOM) ch.send( "A spray of blood shoots from the stump of your right leg.\n" ) dam += game_utils.number_range(10, 20) elif ch.bleeding.is_set( merc.BLEEDING_FOOT_R) and ch.hit - dam > minhit: handler_game.act( "A spray of blood shoots from the stump of $n's right ankle.", ch, None, None, merc.TO_ROOM) ch.send( "A spray of blood shoots from the stump of your right ankle.\n" ) dam += game_utils.number_range(5, 10) ch.hit -= dam if ch.is_hero() and ch.hit < 1: ch.hit = 1 fight.update_pos(ch) ch.in_room.blood += dam if ch.in_room.blood > 1000: ch.in_room.blood = 1000 if ch.hit <= -11 or (ch.is_npc() and ch.hit < 1): ch.killperson(ch) drop_out = True if ch.is_affected(merc.AFF_FLAMING ) and not is_obj and not drop_out and ch.in_room: if not ( not ch.is_npc() and (ch.is_hero() or (ch.immune.is_set(merc.IMM_HEAT) and not ch.is_vampire()))): handler_game.act("$n's flesh burns and crisps.", ch, None, None, merc.TO_ROOM) ch.send("Your flesh burns and crisps.\n") dam = game_utils.number_range(10, 20) if not ch.is_npc(): if ch.immune.is_set(merc.IMM_HEAT): dam //= 2 if ch.is_vampire(): dam *= 2 ch.hit -= dam fight.update_pos(ch) if ch.hit <= -11: ch.killperson(ch) drop_out = True elif not ch.is_npc() and ch.is_vampire() and not ch.is_affected(merc.AFF_SHADOWPLANE) and not ch.immune.is_set(merc.IMM_SUNLIGHT) and \ ch.in_room and ch.in_room.sector_type != merc.SECT_INSIDE and not is_obj and not ch.in_room.is_dark() and \ handler_game.weather_info.sunlight != merc.SUN_DARK: handler_game.act("$n's flesh smolders in the sunlight!", ch, None, None, merc.TO_ROOM) ch.send("Your flesh smolders in the sunlight!\n") # This one's to keep Zarkas quiet ;) if ch.polyaff.is_set(merc.POLY_SERPENT): ch.hit -= game_utils.number_range(2, 4) else: ch.hit -= game_utils.number_range(5, 10) fight.update_pos(ch) if ch.hit <= -11: ch.killperson(ch) drop_out = True elif ch.is_affected(merc.AFF_POISON) and not is_obj and not drop_out: handler_game.act("$n shivers and suffers.", ch, None, None, merc.TO_ROOM) ch.send("You shiver and suffer.\n") fight.damage(ch, ch, 2, "poison") elif ch.position == merc.POS_INCAP and not is_obj and not drop_out: if ch.is_hero(): ch.hit += game_utils.number_range(2, 4) else: ch.hit += game_utils.number_range(1, 2) fight.update_pos(ch) if ch.position > merc.POS_INCAP: handler_game.act("$n's wounds stop bleeding and seal up.", ch, None, None, merc.TO_ROOM) ch.send("Your wounds stop bleeding and seal up.\n") if ch.position > merc.POS_STUNNED: handler_game.act("$n clambers back to $s feet.", ch, None, None, merc.TO_ROOM) ch.send("You clamber back to your feet.\n") elif ch.position == merc.POS_MORTAL and not is_obj and not drop_out: drop_out = False if ch.is_hero(): ch.hit += game_utils.number_range(2, 4) else: ch.hit -= game_utils.number_range(1, 2) if not ch.is_npc() and ch.hit <= -11: ch.killperson(ch) drop_out = True if not drop_out: fight.update_pos(ch) if ch.position == merc.POS_INCAP: handler_game.act( "$n's wounds begin to close, and $s bones pop back into place.", ch, None, None, merc.TO_ROOM) ch.send( "Your wounds begin to close, and your bones pop back into place.\n" ) elif ch.position == merc.POS_DEAD and not is_obj and not drop_out: fight.update_pos(ch) if not ch.is_npc(): ch.killperson(ch) drop_out = False # Autosave and autoquit. # Check that these chars still exist. if ch_quit or ch_save: for ch in list(instance.players.values()): if ch == ch_save: ch.save() for ch in ch_quit[:]: ch.cmd_quit("")
def spl_energyflux(sn, level, ch, victim, target): victim.mana = min(victim.mana + 50, victim.max_mana) fight.update_pos(victim) victim.send("You feel mana channel into your body.\n")
def char_update(): # update save counter */ global save_number save_number += 1 if save_number > 29: save_number = 0 ch_quit = [] id_list = [instance_id for instance_id in instance.characters.keys()] for character_id in id_list: ch = instance.characters[character_id] if ch.timer > 30: ch_quit.append(ch) if ch.position >= merc.POS_STUNNED: # check to see if we need to go home */ if ch.is_npc() and ch.zone and ch.zone != instance.area_templates[ch.zone] \ and not ch.desc and not ch.fighting\ and not ch.is_affected(merc.AFF_CHARM) and random.randint(1, 99) < 5: handler_game.act("$n wanders on home.", ch, None, None, merc.TO_ROOM) ch.extract(True) id_list.remove(character_id) continue if ch.hit < ch.max_hit: ch.hit += hit_gain(ch) else: ch.hit = ch.max_hit if ch.mana < ch.max_mana: ch.mana += mana_gain(ch) else: ch.mana = ch.max_mana if ch.move < ch.max_move: ch.move += move_gain(ch) else: ch.move = ch.max_move if ch.position == merc.POS_STUNNED: fight.update_pos(ch) if not ch.is_npc() and ch.level < merc.LEVEL_IMMORTAL: item = ch.get_eq('light') if item and item.item_type == merc.ITEM_LIGHT and item.value[2] > 0: item.value[2] -= 1 if item.value[2] == 0 and ch.in_room is not None: ch.in_room.available_light -= 1 handler_game.act("$p goes out.", ch, item, None, merc.TO_ROOM) handler_game.act("$p flickers and goes out.", ch, item, None, merc.TO_CHAR) item.extract() elif item.value[2] <= 5 and ch.in_room: handler_game.act("$p flickers.", ch, item, None, merc.TO_CHAR) if ch.is_immortal(): ch.timer = 0 ch.timer += 1 if ch.timer >= 12: if not ch.was_in_room and ch.in_room: ch.was_in_room = ch.in_room if ch.fighting: fight.stop_fighting(ch, True) handler_game.act("$n disappears into the void.", ch, None, None, merc.TO_ROOM) ch.send("You disappear into the void.\n") if ch.level > 1: ch.save() limbo_id = instance.instances_by_room[ merc.ROOM_VNUM_LIMBO][0] limbo = instance.rooms[limbo_id] ch.in_room.get(ch) limbo.put(ch) gain_condition(ch, merc.COND_DRUNK, -1) gain_condition(ch, merc.COND_FULL, -4 if ch.size > merc.SIZE_MEDIUM else -2) gain_condition(ch, merc.COND_THIRST, -1) gain_condition(ch, merc.COND_HUNGER, -2 if ch.size > merc.SIZE_MEDIUM else -1) for paf in ch.affected[:]: if paf.duration > 0: paf.duration -= 1 if random.randint(0, 4) == 0 and paf.level > 0: paf.level -= 1 # spell strength fades with time */ elif paf.duration < 0: pass else: # multiple affects. don't send the spelldown msg multi = [ a for a in ch.affected if a.type == paf.type and a is not paf and a.duration > 0 ] if not multi and paf.type and const.skill_table[ paf.type].msg_off: ch.send(const.skill_table[paf.type].msg_off + "\n") ch.affect_remove(paf) # # * Careful with the damages here, # * MUST NOT refer to ch after damage taken, # * as it may be lethal damage (on NPC). # */ if state_checks.is_affected(ch, 'plague') and ch: if ch.in_room is None: continue handler_game.act( "$n writhes in agony as plague sores erupt from $s skin.", ch, None, None, merc.TO_ROOM) ch.send("You writhe in agony from the plague.\n") af = [a for a in ch.affected if af.type == 'plague'][:1] if not af: ch.affected_by.rem_bit(merc.AFF_PLAGUE) continue if af.level == 1: continue plague = handler_game.AFFECT_DATA() plague.where = merc.TO_AFFECTS plague.type = 'plague' plague.level = af.level - 1 plague.duration = random.randint(1, 2 * plague.level) plague.location = merc.APPLY_STR plague.modifier = -5 plague.bitvector = merc.AFF_PLAGUE for vch_id in ch.in_room.people[:]: vch = instance.characters[vch_id] if not handler_magic.saves_spell(plague.level - 2, vch, merc.DAM_DISEASE) and not vch.is_immmortal() \ and not vch.is_affected(merc.AFF_PLAGUE) and random.randint(0, 4) == 0: vch.send("You feel hot and feverish.\n") handler_game.act("$n shivers and looks very ill.", vch, None, None, merc.TO_ROOM) vch.affect_join(plague) dam = min(ch.level, af.level // 5 + 1) ch.mana -= dam ch.move -= dam fight.damage(ch, ch, dam, 'plague', merc.DAM_DISEASE, False) elif ch.is_affected( merc.AFF_POISON) and ch and not ch.is_affected(merc.AFF_SLOW): poison = state_checks.affect_find(ch.affected, 'poison') if poison: handler_game.act("$n shivers and suffers.", ch, None, None, merc.TO_ROOM) ch.send("You shiver and suffer.\n") fight.damage(ch, ch, poison.level // 10 + 1, 'poison', merc.DAM_POISON, False) elif ch.position == merc.POS_INCAP and random.randint(0, 1) == 0: fight.damage(ch, ch, 1, merc.TYPE_UNDEFINED, merc.DAM_NONE, False) elif ch.position == merc.POS_MORTAL: fight.damage(ch, ch, 1, merc.TYPE_UNDEFINED, merc.DAM_NONE, False) # # * Autosave and autoquit. # * Check that these chars still exist. # */ for ch in instance.characters.values(): if not ch.is_npc() and ch.desc and save_number == 28: ch.save() for ch in ch_quit[:]: ch.do_quit("")