def spl_enchant_weapon(sn, level, ch, victim, target): item = victim if item.item_type != merc.ITEM_WEAPON or item.flags.enchanted or item.flags.artifact or item.chobj: ch.send("You are unable to enchant this weapon.\n") return aff = handler_game.AffectData(type=sn, duration=-1, location=merc.APPLY_HITROLL, modifier=level // 5) item.affect_add(aff) aff = handler_game.AffectData(type=sn, duration=-1, location=merc.APPLY_DAMROLL, modifier=level // 10) item.affect_add(aff) if ch.is_good(): item.flags.anti_evil = True item.flags.enchanted = True handler_game.act("$p glows blue.", ch, item, None, merc.TO_CHAR) handler_game.act("$p glows blue.", ch, item, None, merc.TO_ROOM) elif ch.is_evil(): item.flags.anti_good = True item.flags.enchanted = True handler_game.act("$p glows red.", ch, item, None, merc.TO_CHAR) handler_game.act("$p glows red.", ch, item, None, merc.TO_ROOM) else: item.flags.anti_evil = True item.flags.anti_good = True item.flags.enchanted = True handler_game.act("$p glows yellow.", ch, item, None, merc.TO_CHAR) handler_game.act("$p glows yellow.", ch, item, None, merc.TO_ROOM)
def spl_guardian(sn, level, ch, victim, target): if ch.followers > 4: ch.send("Nothing happens.\n") return ch.followers += 1 victim = object_creator.create_mobile( instance.npc_templates[merc.MOB_VNUM_GUARDIAN]) victim.level = level victim.hit = 100 * level victim.max_hit = 100 * level 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)
def spl_frenzy(sn, level, ch, victim, target): if victim.is_affected(sn): return aff = handler_game.AffectData(type=sn, duration=1 + level // 10, location=merc.APPLY_HITROLL, modifier=level // 5) victim.affect_join(aff) aff.location = merc.APPLY_DAMROLL aff.modifier = level // 5 victim.affect_join(aff) aff.location = merc.APPLY_AC aff.modifier = level // 2 victim.affect_join(aff) if ch != victim: ch.send("Ok.\n") handler_game.act("$n is consumed with rage.", victim, None, None, merc.TO_ROOM) victim.send("You are consumed with rage!\n") if not victim.is_npc(): victim.beastlike()
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 enhance_stat(self, level, victim, apply_bit, bonuses, affect_bit): if victim.itemaff.is_set(merc.ITEMA_REFLECT): # noinspection PyUnresolvedReferences self.send("You are unable to focus your spell.\n") return if state_checks.is_set(affect_bit, merc.AFF_WEBBED) and victim.is_affected( merc.AFF_WEBBED): state_checks.remove_bit(affect_bit, merc.AFF_WEBBED) elif state_checks.is_set( affect_bit, merc.AFF_WEBBED) and fight.is_safe(self, victim): state_checks.remove_bit(affect_bit, merc.AFF_WEBBED) if state_checks.is_set( affect_bit, merc.AFF_CHARM) and not victim.is_affected.is_set( merc.AFF_CHARM): if victim.level <= 50 and ( victim.is_npc() or not victim.immune.is_set(merc.IMM_CHARM)): if victim.master: victim.stop_follower() victim.add_follower(self) else: # noinspection PyUnresolvedReferences self.send("The spell failed.\n") return aff = handler_game.AffectData(type="reserved", duration=level, location=apply_bit, modifier=bonuses, bitvector=affect_bit) victim.affect_join(aff)
def spl_charm_person(sn, level, ch, victim, target): if ch == victim: ch.send("You like yourself even better!\n") return if not victim.is_npc() and victim.immune.is_set(merc.IMM_CHARM): ch.send("You failed.\n") return # I don't want people charming ghosts and stuff - KaVir if victim.is_npc() and victim.is_affected(merc.AFF_ETHEREAL): ch.send("You failed.\n") return if victim.is_immortal(): ch.send("You can cast puny mortal magic on immortals!\n") return if victim.is_affected(merc.AFF_CHARM) or ch.is_affected( merc.AFF_CHARM ) or level < victim.level or handler_magic.saves_spell(level, victim): return if victim.master: victim.stop_follower() victim.add_follower(ch) aff = handler_game.AffectData(type=sn, duration=game_utils.number_fuzzy(level // 4), bitvector=merc.AFF_CHARM) victim.affect_add(aff) handler_game.act("Isn't $n just so nice?", ch, None, victim, merc.TO_VICT) if ch != victim: ch.send("Ok.\n")
def spl_fly(sn, level, ch, victim, target): if victim.is_affected(merc.AFF_FLYING): return aff = handler_game.AffectData(type=sn, duration=level * 3, bitvector=merc.AFF_FLYING) victim.affect_add(aff) victim.send("You rise up off the ground.\n") handler_game.act("$n rises up off the ground.", victim, None, None, merc.TO_ROOM)
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")
def cmd_eat(ch, argument): argument, arg = game_utils.read_word(argument) if not arg: ch.send("Eat what?\n") return item = ch.get_item_carry(arg) if not item: ch.send("You do not have that item.\n") return if not ch.is_immortal(): if not ch.is_npc() and ch.is_vampire( ) and item.item_type == merc.ITEM_FOOD: ch.send("You are unable to stomach it.\n") return if item.item_type not in [ merc.ITEM_FOOD, merc.ITEM_PILL, merc.ITEM_EGG, merc.ITEM_QUEST ]: if ch.is_npc() or not ch.special.is_set( merc.SPC_WOLFMAN) or item.item_type != merc.ITEM_TRASH: ch.send("That's not edible.\n") return handler_game.act("$n eats $p.", ch, item, None, merc.TO_ROOM) handler_game.act("You eat $p.", ch, item, None, merc.TO_CHAR) itype = item.item_type if itype in [merc.ITEM_FOOD, merc.ITEM_EGG]: if item.value[3] != 0: # The shit was poisoned! handler_game.act("$n chokes and gags.", ch, None, None, merc.TO_ROOM) ch.send("You choke and gag.\n") aff = handler_game.AffectData(type="poison", duration=item.value[0] * 2, locattion=merc.APPLY_NONE, bitvector=merc.AFF_POISON) ch.affect_join(aff) elif itype == merc.ITEM_PILL: handler_magic.obj_cast_spell(item.value[1], item.value[0], ch, ch, None) handler_magic.obj_cast_spell(item.value[2], item.value[0], ch, ch, None) handler_magic.obj_cast_spell(item.value[3], item.value[0], ch, ch, None) if ch.position == merc.POS_FIGHTING: ch.wait_state(merc.PULSE_VIOLENCE // 2) elif itype == merc.ITEM_QUEST: if not ch.is_npc(): ch.quest += item.value[0] item.extract()
def spl_protection(sn, level, ch, victim, target): if victim.is_affected(merc.AFF_PROTECT): return aff = handler_game.AffectData(type=sn, duration=24, location=merc.APPLY_NONE, bitvector=merc.AFF_PROTECT) victim.affect_add(aff) victim.send("You feel protected.\n") if ch != victim: ch.send("Ok.\n")
def spl_weaken(sn, level, ch, victim, target): if victim.is_affected(sn) or handler_magic.saves_spell(level, victim): return aff = handler_game.AffectData(type=sn, duration=level // 2, location=merc.APPLY_STR, modifier=-2) victim.affect_join(aff) victim.send("You feel weaker.\n") if ch != victim: ch.send("Ok.\n")
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")
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")
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")
def spl_sanctuary(sn, level, ch, victim, target): if victim.is_affected(merc.AFF_SANCTUARY): return aff = handler_game.AffectData(type=sn, duration=game_utils.number_fuzzy(level // 8), location=merc.APPLY_NONE, bitvector=merc.AFF_SANCTUARY) victim.affect_add(aff) 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 spl_shield(sn, level, ch, victim, target): if victim.is_affected(sn): return aff = handler_game.AffectData(type=sn, duration=level + 8, location=merc.APPLY_AC, modifier=-20) victim.affect_add(aff) 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")
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
def spl_detect_hidden(sn, level, ch, victim, target): if victim.is_affected(merc.AFF_DETECT_HIDDEN): return aff = handler_game.AffectData(type=sn, duration=level, location=merc.APPLY_NONE, bitvector=merc.AFF_DETECT_HIDDEN) victim.affect_join(aff) victim.send("Your awareness improves.\n") if ch != victim: ch.send("Ok.\n")
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)
def spl_infravision(sn, level, ch, victim, target): if victim.is_affected(merc.AFF_INFRARED): return aff = handler_game.AffectData(type=sn, duration=2 * level, location=merc.APPLY_NONE, bitvector=merc.AFF_INFRARED) victim.affect_join(aff) handler_game.act("$n's eyes glow red.", ch, None, None, merc.TO_ROOM) victim.send("Your eyes glow red.\n") if ch != victim: ch.send("Ok.\n")
def cmd_sneak(ch, argument): ch.send("You attempt to move silently.\n") ch.affect_strip("sneak") if ch.is_affected(merc.AFF_SNEAK): return if ch.is_npc() or game_utils.number_percent() < ch.learned["sneak"]: aff = handler_game.AffectData() aff.type = "sneak" aff.duration = ch.level aff.location = merc.APPLY_NONE aff.bitvector = merc.AFF_SNEAK ch.affect_add(aff)
def spl_armor(sn, level, ch, victim, target): if victim.is_affected(sn): return aff = handler_game.AffectData(type=sn, duration=24, modifier=-20, location=merc.APPLY_AC) victim.affect_add(aff) handler_game.act("$n is shrouded in a suit of translucent glowing armor.", victim, None, None, merc.TO_ROOM) victim.send("You are shrouded in a suit of translucent glowing armor.\n") if ch != victim: ch.send("Ok.\n")
def spl_invis(sn, level, ch, victim, target): if victim.is_affected(merc.AFF_INVISIBLE): return aff = handler_game.AffectData(type=sn, duration=24, location=merc.APPLY_NONE, bitvector=merc.AFF_INVISIBLE) victim.affect_join(aff) handler_game.act("$n fades out of existence.", victim, None, None, merc.TO_ROOM) victim.send("You fade out of existence.\n") if ch != victim: ch.send("Ok.\n")
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_blindness(sn, level, ch, victim, target): if victim.is_affected(merc.AFF_BLIND) or handler_magic.saves_spell( level, victim): return aff = handler_game.AffectData(type=sn, location=merc.APPLY_HITROLL, modifier=-4, duration=1 + level, bitvector=merc.AFF_BLIND) victim.affect_add(aff) victim.send("You are blinded!\n") if victim != ch: handler_game.act("$N is blinded!", ch, None, victim, merc.TO_CHAR)
def spl_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") aff = handler_game.AffectData(type=sn, duration=24, location=merc.APPLY_NONE, bitvector=merc.AFF_INVISIBLE) gch.affect_join(aff) ch.send("Ok.\n")
def spl_bless(sn, level, ch, victim, target): if victim.is_affected(sn): return aff = handler_game.AffectData(type=sn, duration=6 + level, location=merc.APPLY_HITROLL, modifier=level // 6) victim.affect_add(aff) aff.location = merc.APPLY_SAVING_SPELL aff.modifier = 0 - level // 8 victim.affect_add(aff) handler_game.act("$n is blessed.", victim, None, None, merc.TO_ROOM) victim.send("You feel righteous.\n") if ch != victim: ch.send("Ok.\n")
def spl_darkblessing(sn, level, ch, victim, target): if victim.is_affected(sn): return aff = handler_game.AffectData(type=sn, duration=level // 2, location=merc.APPLY_HITROLL, modifier=1 + level // 14) victim.affect_join(aff) aff.location = merc.APPLY_DAMROLL aff.modifier = 1 + level // 14 victim.affect_join(aff) if ch != victim: ch.send("Ok.\n") handler_game.act("$n looks wicked.", victim, None, None, merc.TO_ROOM) victim.send("You feel wicked.\n")
def spl_curse(sn, level, ch, victim, target): if victim.is_affected(merc.AFF_CURSE) or handler_magic.saves_spell( level, victim): return aff = handler_game.AffectData(type=sn, duration=4 * level, location=merc.APPLY_HITROLL, modifier=-1, bitvector=merc.AFF_CURSE) victim.affect_join(aff) aff.location = merc.APPLY_SAVING_SPELL aff.modifier = 1 victim.affect_join(aff) victim.send("You feel unclean.\n") if ch != victim: ch.send("Ok.\n")
def spl_poison(sn, level, ch, victim, target): # Ghosts cannot be poisoned - KaVir if victim.is_npc() and victim.is_affected(merc.AFF_ETHEREAL): return if not victim.is_npc() and victim.is_vampire() and victim.vampaff.is_set(merc.VAM_SERPENTIS): return elif not victim.is_npc() and victim.is_werewolf() and victim.powers[merc.WPOWER_SPIDER] > 2: return if handler_magic.saves_spell(level, victim): return aff = handler_game.AffectData(type=sn, duration=level, location=merc.APPLY_STR, modifier=0 - game_utils.number_range(1, 3), bitvector=merc.AFF_POISON) victim.affect_join(aff) victim.send("You feel very sick.\n") if ch != victim: handler_game.act("$N looks very sick as your poison takes affect.", ch, None, victim, merc.TO_CHAR)