def spell_invis(sn, level, ch, victim, target): # object invisibility */ if target == merc.TARGET_ITEM: obj = victim if obj.flags.invis: handler_game.act("$p is already invisible.", ch, obj, None, merc.TO_CHAR) return af = handler_game.AFFECT_DATA() af.where = merc.TO_OBJECT af.type = sn af.level = level af.duration = level + 12 af.location = merc.APPLY_NONE af.modifier = 0 af.bitvector = merc.ITEM_INVIS obj.affect_add(af) handler_game.act("$p fades out of sight.", ch, obj, None, merc.TO_ALL) return # character invisibility */ if victim.is_affected( merc.AFF_INVISIBLE): return handler_game.act("$n fades out of existence.", victim, None, None, merc.TO_ROOM) af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS af.type = sn af.level = level af.duration = level + 12 af.location = merc.APPLY_NONE af.modifier = 0 af.bitvector = merc.AFF_INVISIBLE victim.affect_add(af) victim.send("You fade out of existence.\n") return
def spread_plague(self, plague_carrier): af = [af for af in plague_carrier.affected if af.type == 'plague'] if not af: plague_carrier.affected_by.rem_bit(merc.AFF_PLAGUE) return af = af[0] if af.level == 1: return plague = handler_game.AFFECT_DATA() plague.where = merc.TO_AFFECTS plague.type = "plague" plague.level = af.level - 1 plague.duration = random.randint(1, 2 * plague.level) plague.location = merc.APPLY_STR plague.modifier = -5 plague.bitvector = merc.AFF_PLAGUE for vch_id in self.people[:]: vch = instance.characters[vch_id] if not handler_magic.saves_spell(plague.level - 2, vch, merc.DAM_DISEASE) \ and not vch.is_immortal() and not vch.is_affected(merc.AFF_PLAGUE) \ and random.randint(0, 5) == 0: vch.send("You feel hot and feverish.\n\r") handler_game.act("$n shivers and looks very ill.", vch, None, None, merc.TO_ROOM) vch.affect_join(plague)
def spell_change_sex(sn, level, ch, victim, target): if state_checks.is_affected(victim, sn): if victim == ch: ch.send("You've already been changed.\n") else: handler_game.act("$N has already had $s(?) sex changed.", ch, None, victim, merc.TO_CHAR) return if handler_magic.saves_spell(level, victim, merc.DAM_OTHER): return af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS af.type = sn af.level = level af.duration = 2 * level af.location = merc.APPLY_SEX while af.modifier == 0: af.modifier = random.randint(0, 2) - victim.sex af.bitvector = 0 victim.affect_add(af) victim.send("You feel different.\n") handler_game.act("$n doesn't look like $mself anymore...", victim, None, None, merc.TO_ROOM)
def affect_add(self, paf): paf_new = handler_game.AFFECT_DATA() self.affected.append(paf_new) # apply any affect vectors to the object's extra_flags if paf.bitvector: if paf.where == merc.TO_OBJECT: ret_str = game_utils.item_bitvector_flag_str( paf.bitvector, 'extra flags') if self.item_attribute_names.intersection(ret_str): self.item_attributes |= {ret_str} elif self.item_restriction_names.intersection(ret_str): self.item_restrictions |= {ret_str} else: raise ValueError( 'paf set attempt failed, unable to find flag %s' % ret_str) elif paf.where == merc.TO_WEAPON: if self.item_type == merc.ITEM_WEAPON: ret_str = game_utils.item_bitvector_flag_str( paf.bitvector, 'weapon flags') if self.weapon_attribute_names.intersection(ret_str): self.weapon_attributes |= {ret_str} else: raise ValueError( 'paf set attempt failed, unable to find flag %s' % ret_str)
def poison_effect(vo, level, dam, target): if target == merc.TARGET_ROOM: # nail objects on the floor */ room = vo for item_id in room.inventory[:]: item = instance.items[item_id] poison_effect(item, level, dam, merc.TARGET_ITEM) return if target == merc.TARGET_CHAR: # do the effect on a victim */ victim = vo # chance of poisoning */ if not handler_magic.saves_spell(level // 4 + dam // 20, victim, merc.DAM_POISON): af = handler_game.AFFECT_DATA() victim.send("You feel poison coursing through your veins.\n\r") handler_game.act("$n looks very ill.", victim, None, None, merc.TO_ROOM) af.where = merc.TO_AFFECTS af.type = 'poison' af.level = level af.duration = level // 2 af.location = merc.APPLY_STR af.modifier = -1 af.bitvector = merc.AFF_POISON victim.affect_join(af) # equipment */ for item_id in victim.inventory[:]: item = instance.items[item_id] poison_effect(item, level, dam, merc.TARGET_ITEM) return if target == merc.TARGET_ITEM: # do some poisoning */ item = vo if item.flags.burn_proof or item.flags.bless or random.randint(0, 4) == 0: return chance = level // 4 + dam // 10 if chance > 25: chance = (chance - 25) // 2 + 25 if chance > 50: chance = (chance - 50) // 2 + 50 chance -= item.level * 2 if item.item_type == merc.ITEM_FOOD: pass if item.item_type == merc.ITEM_DRINK_CON: if item.value[0] == item.value[1]: return else: return chance = max(5, min(chance, 95)) if random.randint(1, 99) > chance: return item.value[3] = 1 return
def spell_chill_touch(sn, level, ch, victim, target): dam_each = [ 0, 0, 0, 6, 7, 8, 9, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 27 ] level = min(level, len(dam_each) - 1) level = max(0, level) dam = random.randint(dam_each[level] // 2, dam_each[level] * 2) if not handler_magic.saves_spell(level, victim, merc.DAM_COLD): handler_game.act("$n turns blue and shivers.", victim, None, None, merc.TO_ROOM) af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS af.type = sn af.level = level af.duration = 6 af.location = merc.APPLY_STR af.modifier = -1 af.bitvector = 0 victim.affect_join(af) else: dam = dam // 2 fight.damage(ch, victim, dam, sn, merc.DAM_COLD, True)
def spell_calm(sn, level, ch, victim, target): # get sum of all mobile levels in the room */ count = 0 mlevel = 0 high_level = 0 for vch_id in ch.in_room.people: vch = instance.characters[vch_id] if vch.position == merc.POS_FIGHTING: count = count + 1 if vch.is_npc(): mlevel += vch.level else: mlevel += vch.level // 2 high_level = max(high_level, vch.level) # compute chance of stopping combat */ chance = 4 * level - high_level + 2 * count if ch.is_immortal(): # always works */ mlevel = 0 if random.randint(0, chance) >= mlevel: # hard to stop large fights */ for vch_id in ch.in_room.people: vch = instance.characters[vch_id] if vch.is_npc() and (vch.imm_flags.is_set(merc.IMM_MAGIC) \ or vch.act.is_set(merc.ACT_UNDEAD)): return if vch.is_affected(merc.AFF_CALM) or vch.is_affected(merc.AFF_BERSERK) \ or vch.is_affected('frenzy'): return vch.send("A wave of calm passes over you.\n") if vch.fighting or vch.position == merc.POS_FIGHTING: fight.stop_fighting(vch, False) af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS af.type = sn af.level = level af.duration = level // 4 af.location = merc.APPLY_HITROLL if not vch.is_npc(): af.modifier = -5 else: af.modifier = -2 af.bitvector = merc.AFF_CALM vch.affect_add(af) af.location = merc.APPLY_DAMROLL vch.affect_add(af)
def spell_faerie_fire(sn, level, ch, victim, target): if victim.is_affected( merc.AFF_FAERIE_FIRE): return af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS af.type = sn af.level = level af.duration = level af.location = merc.APPLY_AC af.modifier = 2 * level af.bitvector = merc.AFF_FAERIE_FIRE victim.affect_add(af) 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)
def affect_enchant(self): # okay, move all the old flags into new vectors if we have to if not self.enchanted: self.enchanted = True for paf in instance.item_templates[self.vnum].affected: af_new = handler_game.AFFECT_DATA() self.affected.append(af_new) af_new.where = paf.where af_new.type = max(0, paf.type) af_new.level = paf.level af_new.duration = paf.duration af_new.location = paf.location af_new.modifier = paf.modifier af_new.bitvector = paf.bitvector
def spell_blindness(sn, level, ch, victim, target): if victim.is_affected(merc.AFF_BLIND) or handler_magic.saves_spell( level, victim, merc.DAM_OTHER): return af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS af.type = sn af.level = level af.location = merc.APPLY_HITROLL af.modifier = -4 af.duration = 1 + level af.bitvector = merc.AFF_BLIND victim.affect_add(af) victim.send("You are blinded! \n") handler_game.act("$n appears to be blinded.", victim, send_to=merc.TO_ROOM)
def spell_weaken(sn, level, ch, victim, target): if state_checks.is_affected(victim, sn) or handler_magic.saves_spell( level, victim, merc.DAM_OTHER): return af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS af.type = sn af.level = level af.duration = level // 2 af.location = merc.APPLY_STR af.modifier = -1 * (level // 5) af.bitvector = merc.AFF_WEAKEN victim.affect_add(af) victim.send("You feel your strength slip away.\n") handler_game.act("$n looks tired and weak.", victim, None, None, merc.TO_ROOM)
def do_eat(ch, argument): argument, arg = game_utils.read_word(argument) if not arg: ch.send("Eat what?\n") return obj = ch.get_item_carry(arg, ch) if not obj: ch.send("You do not have that item.\n") return if not ch.is_immortal(): if obj.item_type != merc.ITEM_FOOD and obj.item_type != merc.ITEM_PILL: ch.send("That's not edible.\n") return if not ch.is_npc() and ch.condition[merc.COND_FULL] > 40: ch.send("You are too full to eat more.\n") return handler_game.act("$n eats $p.", ch, obj, None, merc.TO_ROOM) handler_game.act("You eat $p.", ch, obj, None, merc.TO_CHAR) if obj.item_type == merc.ITEM_FOOD: if not ch.is_npc(): condition = ch.condition[merc.COND_HUNGER] update.gain_condition(ch, merc.COND_FULL, obj.value[0]) update.gain_condition(ch, merc.COND_HUNGER, obj.value[1]) if condition == 0 and ch.condition[merc.COND_HUNGER] > 0: ch.send("You are no longer hungry.\n") elif ch.condition[merc.COND_FULL] > 40: ch.send("You are full.\n") if obj.value[3] != 0: # The food was poisoned! af = handler_game.AFFECT_DATA() handler_game.act("$n chokes and gags.", ch, 0, 0, merc.TO_ROOM) ch.send("You choke and gag.\n") af.where = merc.TO_AFFECTS af.type = "poison" af.level = game_utils.number_fuzzy(obj.value[0]) af.duration = 2 * obj.value[0] af.location = merc.APPLY_NONE af.modifier = 0 af.bitvector = merc.AFF_POISON ch.affect_join(af) elif obj.item_type == merc.ITEM_PILL: handler_magic.obj_cast_spell(obj.value[1], obj.value[0], ch, ch, None) handler_magic.obj_cast_spell(obj.value[2], obj.value[0], ch, ch, None) handler_magic.obj_cast_spell(obj.value[3], obj.value[0], ch, ch, None) obj.extract() return
def spell_mass_invis(sn, level, ch, victim, target): for gch_id in ch.in_room.people: gch = instance.characters[gch_id] if not gch.is_same_group(ch) or gch.is_affected(merc.AFF_INVISIBLE): continue handler_game.act("$n slowly fades out of existence.", gch, None, None, merc.TO_ROOM) gch.send("You slowly fade out of existence.\n") af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS af.type = sn af.level = level // 2 af.duration = 24 af.location = merc.APPLY_NONE af.modifier = 0 af.bitvector = merc.AFF_INVISIBLE gch.affect_add(af) ch.send("Ok.\n")
def spell_detect_evil(sn, level, ch, victim, target): if victim.is_affected( merc.AFF_DETECT_EVIL): if victim == ch: ch.send("You can already sense evil.\n") else: handler_game.act("$N can already detect evil.", 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_EVIL victim.affect_add(af) victim.send("Your eyes tingle.\n") if ch != victim: ch.send("Ok.\n")
def spell_sleep(sn, level, ch, victim, target): if victim.is_affected( merc.AFF_SLEEP) \ or (victim.is_npc() and victim.act.is_set(merc.ACT_UNDEAD)) \ or (level + 2) < victim.level \ or handler_magic.saves_spell(level - 4, victim, merc.DAM_CHARM): return af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS af.type = sn af.level = level af.duration = 4 + level af.location = merc.APPLY_NONE af.modifier = 0 af.bitvector = merc.AFF_SLEEP victim.affect_join(af) if state_checks.IS_AWAKE(victim): 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
def spell_stone_skin(sn, level, ch, victim, target): if state_checks.is_affected(ch, sn): if victim == ch: ch.send("Your skin is already as hard as a rock.\n") else: handler_game.act("$N is already as hard as can be.", 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_AC af.modifier = -40 af.bitvector = 0 victim.affect_add(af) handler_game.act("$n's skin turns to stone.", victim, None, None, merc.TO_ROOM) victim.send("Your skin turns to stone.\n")
def spell_fireproof(sn, level, ch, victim, target): obj = victim if obj.flags.burn_proof: handler_game.act("$p is already protected from burning.", ch, obj, None, merc.TO_CHAR) return af = handler_game.AFFECT_DATA() af.where = merc.TO_OBJECT 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.ITEM_BURN_PROOF obj.affect_add(af) handler_game.act("You protect $p from fire.", ch, obj, None, merc.TO_CHAR) handler_game.act("$p is surrounded by a protective aura.", ch, obj, None, merc.TO_ROOM)
def spell_giant_strength(sn, level, ch, victim, target): if state_checks.is_affected(victim, sn): if victim == ch: ch.send("You are already as strong as you can get! \n") else: handler_game.act("$N can't get any stronger.", 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_STR af.modifier = 1 + (level >= 18) + (level >= 25) + (level >= 32) af.bitvector = 0 victim.affect_add(af) victim.send("Your muscles surge with heightened power! \n") handler_game.act("$n's muscles surge with heightened power.", victim, None, None, merc.TO_ROOM)
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")
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)
def spell_pass_door(sn, level, ch, victim, target): if victim.is_affected(merc.AFF_PASS_DOOR): if victim == ch: ch.send("You are already out of phase.\n") else: 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")
def spell_frenzy(sn, level, ch, victim, target): # RT clerical berserking spell */ if state_checks.is_affected(victim, sn) or victim.is_affected( merc.AFF_BERSERK): if victim == ch: ch.send("You are already in a frenzy.\n") else: handler_game.act("$N is already in a frenzy.", ch, None, victim, merc.TO_CHAR) return if state_checks.is_affected(victim, const.skill_table['calm']): if victim == ch: ch.send("Why don't you just relax for a while?\n") else: handler_game.act("$N doesn't look like $e wants to fight anymore.", ch, None, victim, merc.TO_CHAR) return if (ch.is_good() and not state_checks.IS_GOOD(victim)) or \ (state_checks.IS_NEUTRAL(ch) and not state_checks.IS_NEUTRAL(victim)) or \ (ch.is_evil() and not state_checks.IS_EVIL(victim)): handler_game.act("Your god doesn't seem to like $N", 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 // 3 af.modifier = level // 6 af.bitvector = 0 af.location = merc.APPLY_HITROLL victim.affect_add(af) af.location = merc.APPLY_DAMROLL victim.affect_add(af) af.modifier = 10 * (level // 12) af.location = merc.APPLY_AC victim.affect_add(af) victim.send("You are filled with holy wrath! \n") handler_game.act("$n gets a wild look in $s eyes! ", victim, None, None, merc.TO_ROOM)
def spell_sanctuary(sn, level, ch, victim, target): if victim.is_affected(merc.AFF_SANCTUARY): if victim == ch: ch.send("You are already in sanctuary.\n") else: handler_game.act("$N is already in sanctuary.", 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 // 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")
def spell_fly(sn, level, ch, victim, target): if victim.is_affected(merc.AFF_FLYING): if victim == ch: ch.send("You are already airborne.\n") else: handler_game.act("$N doesn't need your help to fly.", 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 + 3 af.location = 0 af.modifier = 0 af.bitvector = merc.AFF_FLYING victim.affect_add(af) victim.send("Your feet rise off the ground.\n") handler_game.act("$n's feet rise off the ground.", victim, None, None, merc.TO_ROOM) return
def spell_armor(sn, level, ch, victim, target): if state_checks.is_affected(victim, sn): if victim == ch: ch.send("You are already armored.\n") else: handler_game.act("$N is already armored.", 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.modifier = -20 af.location = merc.APPLY_AC af.bitvector = 0 victim.affect_add(af) victim.send("You feel someone protecting you.\n") if ch is not victim: handler_game.act("$N is protected by your magic.", ch, None, victim, merc.TO_CHAR)
def spell_shield(sn, level, ch, victim, target): if state_checks.is_affected(victim, sn): if victim == ch: ch.send("You are already shielded from harm.\n") else: handler_game.act("$N is already protected by a shield.", 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 = 8 + level af.location = merc.APPLY_AC af.modifier = -20 af.bitvector = 0 victim.affect_add(af) handler_game.act("$n is surrounded by a force shield.", victim, None, None, merc.TO_ROOM) victim.send("You are surrounded by a force shield.\n") return
def spell_infravision(sn, level, ch, victim, target): if victim.is_affected(merc.AFF_INFRARED): if victim == ch: ch.send("You can already see in the dark.\n") else: handler_game.act("$N already has infravision.\n", ch, None, victim, merc.TO_CHAR) return handler_game.act("$n's eyes glow red.\n", ch, None, None, merc.TO_ROOM) af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS af.type = sn af.level = level af.duration = 2 * level af.location = merc.APPLY_NONE af.modifier = 0 af.bitvector = merc.AFF_INFRARED victim.affect_add(af) victim.send("Your eyes glow red.\n") return
def spell_charm_person(sn, level, ch, victim, target): if fight.is_safe(ch, victim): return if victim == ch: ch.send("You like yourself even better! \n") return if ( victim.is_affected( merc.AFF_CHARM) \ or ch.is_affected(merc.AFF_CHARM) \ or level < victim.level \ or state_checks.IS_SET(victim.imm_flags, merc.IMM_CHARM) \ or handler_magic.saves_spell(level, victim, merc.DAM_CHARM) ): return if state_checks.IS_SET(victim.in_room.room_flags, merc.ROOM_LAW): ch.send("The mayor does not allow charming in the city limits.\n") return if victim.master: handler_ch.stop_follower(victim) handler_ch.add_follower(victim, ch) victim.leader = ch af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS af.type = sn af.level = level af.duration = game_utils.number_fuzzy(level // 4) af.location = 0 af.modifier = 0 af.bitvector = merc.AFF_CHARM victim.affect_add(af) #TODO: Known broken. Mob will immediately try to fight you after casting this, because this is an offensive spell. #ROM had some stipulation to prevent this combat, possibly in fight.py:is_safe() handler_game.act("Isn't $n just so nice?", ch, None, victim, merc.TO_VICT) if ch is not victim: handler_game.act("$N looks at you with adoring eyes.", ch, None, victim, merc.TO_CHAR)
def spell_haste(sn, level, ch, victim, target): # RT haste spell */ if state_checks.is_affected(victim, sn) or victim.is_affected( merc.AFF_HASTE) or (victim.is_npc() and state_checks.IS_SET( victim.off_flags, merc.OFF_FAST)): if victim == ch: ch.send("You can't move any faster! \n") else: handler_game.act("$N is already moving as fast as $E can.", ch, None, victim, merc.TO_CHAR) return if victim.is_affected(merc.AFF_SLOW): if not handler_magic.check_dispel(level, victim, const.skill_table["slow"]): if victim != ch: ch.send("Spell failed.\n") victim.send("You feel momentarily faster.\n") return handler_game.act("$n is moving less slowly.", victim, None, None, merc.TO_ROOM) return af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS af.type = sn af.level = level if victim == ch: af.duration = level // 2 else: af.duration = level // 4 af.location = merc.APPLY_DEX af.modifier = 1 + (level >= 18) + (level >= 25) + (level >= 32) af.bitvector = merc.AFF_HASTE victim.affect_add(af) victim.send("You feel yourself moving more quickly.\n") handler_game.act("$n is moving more quickly.", victim, None, None, merc.TO_ROOM) if ch != victim: ch.send("Ok.\n")
def do_sneak(ch, argument): ch.send("You attempt to move silently.\n") ch.affect_strip("sneak") if ch.is_affected(merc.AFF_SNEAK): return if random.randint(1, 99) < ch.get_skill("sneak"): if ch.is_pc(): ch.check_improve("sneak", True, 3) af = handler_game.AFFECT_DATA() af.where = merc.TO_AFFECTS af.type = "sneak" af.level = ch.level af.duration = ch.level af.location = merc.APPLY_NONE af.modifier = 0 af.bitvector = merc.AFF_SNEAK ch.affect_add(af) else: if ch.is_pc(): ch.check_improve("sneak", False, 3) return