public boolean invoke( MOB mob, Vector commands, Environmental givenTarget, boolean auto, int asLevel) { if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; HashSet h = properTargets(mob, givenTarget, auto); if (h == null) return false; boolean success = proficiencyCheck(mob, 0, auto); boolean nothingDone = true; if (success) { for (Iterator e = h.iterator(); e.hasNext(); ) { MOB target = (MOB) e.next(); // it worked, so build a copy of this ability, // and add it to the affects list of the // affected MOB. Then tell everyone else // what happened. CMMsg msg = CMClass.getMsg( mob, target, this, verbalCastCode(mob, target, auto) | CMMsg.MASK_MALICIOUS, auto ? "" : "^S<S-NAME> " + prayForWord(mob) + " an unholy paralysis upon <T-NAMESELF>.^?"); CMMsg msg2 = CMClass.getMsg( mob, target, this, CMMsg.MASK_MALICIOUS | CMMsg.TYP_PARALYZE | (auto ? CMMsg.MASK_ALWAYS : 0), null); if ((target != mob) && (mob.location().okMessage(mob, msg)) && (mob.location().okMessage(mob, msg2))) { int levelDiff = target.envStats().level() - (mob.envStats().level() + (2 * super.getXLEVELLevel(mob))); if (levelDiff < 0) levelDiff = 0; if (levelDiff > 6) levelDiff = 6; mob.location().send(mob, msg); mob.location().send(mob, msg2); if ((msg.value() <= 0) && (msg2.value() <= 0)) { success = maliciousAffect(mob, target, asLevel, 8 - levelDiff, -1); mob.location().show(target, null, CMMsg.MSG_OK_VISUAL, "<S-NAME> can't move!"); } nothingDone = false; } } } if (nothingDone) return maliciousFizzle( mob, null, "<S-NAME> attempt(s) to paralyze everyone, but flub(s) it."); // return whether it worked return success; }
@Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { if (mob.isInCombat()) { mob.tell(L("You can't hibernate while in combat!")); return false; } if (!CMLib.flags().isSitting(mob)) { mob.tell(L("You must be in a sitting, restful position to hibernate.")); return false; } // now see if it worked final boolean success = proficiencyCheck(mob, 0, auto); if (success) { invoker = mob; final CMMsg msg = CMClass.getMsg( mob, null, this, CMMsg.MSG_SLEEP | CMMsg.MASK_MAGIC, L("<S-NAME> begin(s) to hibernate...")); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); oldState = mob.curState(); beneficialAffect(mob, mob, asLevel, Ability.TICKS_FOREVER); helpProficiency(mob, 0); } } else return beneficialVisualFizzle( mob, null, L("<S-NAME> chant(s) to hibernate, but lose(s) concentration.")); // return whether it worked return success; }
@Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { final Item I = getTarget(mob, mob.location(), givenTarget, commands, Wearable.FILTER_UNWORNONLY); if (I == null) return false; if (((I.material() & RawMaterial.MATERIAL_MASK) != RawMaterial.MATERIAL_VEGETATION) && ((I.material() & RawMaterial.MATERIAL_MASK) != RawMaterial.MATERIAL_WOODEN)) { mob.tell(L("Your plant knowledge can tell you nothing about @x1.", I.name(mob))); return false; } if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; final boolean success = proficiencyCheck(mob, 0, auto); if (!success) mob.tell(L("Your plant senses fail you.")); else { final CMMsg msg = CMClass.getMsg(mob, I, null, CMMsg.MSG_DELICATE_SMALL_HANDS_ACT | CMMsg.MASK_MAGIC, null); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); final StringBuffer str = new StringBuffer(""); str.append( L( "@x1 is a kind of @x2. ", I.name(mob), RawMaterial.CODES.NAME(I.material()).toLowerCase())); if (isPlant(I)) str.append(L("It was summoned by @x1.", I.rawSecretIdentity())); else str.append(L("It is either processed by hand, or grown wild.")); mob.tell(str.toString()); } } return success; }
public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { MOB target = this.getTarget(mob, commands, givenTarget); if (target == null) return false; if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; boolean success = proficiencyCheck(mob, 0, auto); if (success) { // it worked, so build a copy of this ability, // and add it to the affects list of the // affected MOB. Then tell everyone else // what happened. CMMsg msg = CMClass.getMsg( mob, target, this, CMMsg.MSK_MALICIOUS_MOVE | CMMsg.TYP_PARALYZE | (auto ? CMMsg.MASK_ALWAYS : 0), auto ? "" : "^S<S-NAME> paralyze(s) <T-NAMESELF>.^?"); if (target.location().okMessage(target, msg)) { target.location().send(target, msg); if (msg.value() <= 0) { success = maliciousAffect(mob, target, asLevel, 5, -1); mob.location().show(target, null, CMMsg.MSG_OK_VISUAL, "<S-NAME> can't move!"); } } } else return maliciousFizzle( mob, target, "<S-NAME> attempt(s) to paralyze <T-NAMESELF>, but fail(s)!"); // return whether it worked return success; }
@Override public boolean invoke( MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target = mob; if ((auto) && (givenTarget != null) && (givenTarget instanceof MOB)) target = (MOB) givenTarget; if (target.fetchEffect(this.ID()) != null) { mob.tell(target, null, null, L("<S-NAME> <S-IS-ARE> already observing.")); return false; } if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; final boolean success = proficiencyCheck(mob, 0, auto); final CMMsg msg = CMClass.getMsg( mob, target, this, auto ? CMMsg.MSG_OK_ACTION : (CMMsg.MSG_DELICATE_HANDS_ACT | CMMsg.MASK_EYES), auto ? L("<T-NAME> become(s) observant.") : L( "<S-NAME> open(s) <S-HIS-HER> eyes and observe(s) <S-HIS-HER> surroundings carefully.")); if (!success) return beneficialVisualFizzle( mob, null, L("<S-NAME> look(s) around carefully, but become(s) distracted.")); else if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); beneficialAffect(mob, target, asLevel, 0); } return success; }
@Override public boolean invoke( MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target = this.getTarget(mob, commands, givenTarget); if (target == null) return false; if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; final boolean success = proficiencyCheck(mob, 0, auto); if (success) { final CMMsg msg = CMClass.getMsg( mob, target, this, verbalCastCode(mob, target, auto), auto ? "" : L("^S<S-NAME> chant(s) to <T-NAMESELF>.^?")); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); mob.location() .show(target, null, CMMsg.MSG_OK_VISUAL, L("<S-NAME> seem(s) strangely fertile!")); beneficialAffect(mob, target, asLevel, Ability.TICKS_ALMOST_FOREVER); } } else return beneficialWordsFizzle( mob, target, L("<S-NAME> chant(s) to <T-NAMESELF>, but the magic fades.")); // return whether it worked return success; }
@Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { if ((!auto) && (!mob.isInCombat())) { mob.tell(L("You must be in combat first!")); return false; } MOB target = mob; if ((auto) && (givenTarget != null) && (givenTarget instanceof MOB)) target = (MOB) givenTarget; if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; // now see if it worked final boolean success = proficiencyCheck(mob, 0, auto); if (success) { final CMMsg msg = CMClass.getMsg( mob, target, this, CMMsg.MSG_QUIETMOVEMENT, auto ? L("<T-NAME> is braced for an attack!") : L("<S-NAME> brace(s) for an attack!")); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); beneficialAffect(mob, target, asLevel, 0); } } else return beneficialVisualFizzle( mob, null, L("<S-NAME> attempt(s) to brace <S-HIM-HERSELF>, but get(s) distracted.")); // return whether it worked return success; }
@Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target = getTarget(mob, commands, givenTarget); if (target == null) return false; if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; final boolean success = proficiencyCheck(mob, 0, auto); if (success) { invoker = mob; final CMMsg msg = CMClass.getMsg( mob, target, this, verbalCastCode(mob, target, auto), auto ? "" : L("^S<S-NAME> incant(s) to <T-NAMESELF>.^?")); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); if (msg.value() <= 0) { target .curState() .adjThirst( -150 - ((mob.phyStats().level() + (2 * getXLEVELLevel(mob))) * 100), target.maxState().maxThirst(target.baseWeight())); mob.location() .show(target, null, CMMsg.MSG_OK_VISUAL, L("<S-NAME> feel(s) incredibly thirsty!")); } } } else return maliciousFizzle( mob, target, L("<S-NAME> incant(s) to <T-NAMESELF>, but the spell fades.")); // return whether it worked return success; }
@Override public void spring(MOB target) { if (target.location() != null) { if ((!invoker().mayIFight(target)) || (isLocalExempt(target)) || (invoker().getGroupMembers(new HashSet<MOB>()).contains(target)) || (target == invoker()) || (doesSaveVsTraps(target))) target .location() .show( target, null, null, CMMsg.MASK_ALWAYS | CMMsg.MSG_NOISE, L("<S-NAME> avoid(s) the water bomb!")); else if (target .location() .show( invoker(), target, this, CMMsg.MASK_ALWAYS | CMMsg.MSG_NOISE, L("@x1 explodes water all over <T-NAME>!", affected.name()))) { super.spring(target); final Ability A = CMClass.getAbility("Spell_Irritation"); if (A != null) A.invoke(target, target, true, invoker().phyStats().level() + abilityCode()); } } }
@Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; final boolean success = proficiencyCheck(mob, 0, auto); if (success) { final CMMsg msg = CMClass.getMsg( mob, null, this, CMMsg.MSG_SPEAK, auto ? "" : L("^S<S-NAME> scream(s) a mighty RALLYING CRY!!^?")); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); final Set<MOB> h = properTargets(mob, givenTarget, auto); if (h == null) return false; for (final Object element : h) { final MOB target = (MOB) element; target.location().show(target, null, CMMsg.MSG_OK_VISUAL, L("<S-NAME> seem(s) rallied!")); timesTicking = 0; hpUp = mob.phyStats().level() + (2 * getXLEVELLevel(mob)); beneficialAffect(mob, target, asLevel, 0); target.recoverMaxState(); if (target.fetchEffect(ID()) != null) mob.curState().adjHitPoints(hpUp, mob.maxState()); } } } else beneficialWordsFizzle(mob, null, auto ? "" : L("<S-NAME> mumble(s) a weak rally cry.")); // return whether it worked return success; }
public boolean execute(MOB mob, Vector commands, int metaFlags) throws java.io.IOException { if (commands != null) commands.removeElementAt(0); if ((commands == null) || (commands.size() == 0)) { if (!CMLib.flags().isSleeping(mob)) mob.tell("You aren't sleeping!?"); else { CMMsg msg = CMClass.getMsg(mob, null, null, CMMsg.MSG_STAND, "<S-NAME> awake(s) and stand(s) up."); if (mob.location().okMessage(mob, msg)) mob.location().send(mob, msg); } } else { String whom = CMParms.combine(commands, 0); MOB M = mob.location().fetchInhabitant(whom); if ((M == null) || (!CMLib.flags().canBeSeenBy(M, mob))) { mob.tell("You don't see '" + whom + "' here."); return false; } if (!CMLib.flags().isSleeping(M)) { mob.tell(M.name() + " is awake!"); return false; } CMMsg msg = CMClass.getMsg( mob, M, null, CMMsg.MSG_NOISYMOVEMENT, "<S-NAME> attempt(s) to wake <T-NAME> up."); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); execute(M, null, metaFlags | Command.METAFLAG_ORDER); } } return false; }
public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { String dir = CMParms.combine(commands, 0); if (commands.size() > 0) dir = (String) commands.lastElement(); int dirCode = Directions.getGoodDirectionCode(dir); if (!preInvoke(mob, commands, givenTarget, auto, asLevel, 0, 0.0)) return false; MOB highestMOB = getHighestLevelMOB(mob, null); int levelDiff = mob.phyStats().level() + (2 * super.getXLEVELLevel(mob)) - getMOBLevel(highestMOB); if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; boolean success = false; CMMsg msg = CMClass.getMsg( mob, null, this, auto ? CMMsg.MSG_OK_VISUAL : CMMsg.MSG_DELICATE_HANDS_ACT, "<S-NAME> walk(s) carefully " + Directions.getDirectionName(dirCode) + "."); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); if (levelDiff < 0) levelDiff = levelDiff * 8; else levelDiff = levelDiff * 10; success = proficiencyCheck(mob, levelDiff, auto); int oldDex = mob.baseCharStats().getStat(CharStats.STAT_DEXTERITY); if (success) mob.baseCharStats().setStat(CharStats.STAT_DEXTERITY, oldDex + 100); mob.recoverCharStats(); CMLib.tracking().walk(mob, dirCode, false, false); if (oldDex != mob.baseCharStats().getStat(CharStats.STAT_DEXTERITY)) mob.baseCharStats().setStat(CharStats.STAT_DEXTERITY, oldDex); mob.recoverCharStats(); } return success; }
public void affectCharState(MOB affected, CharState affectableState) { super.affectCharState(affected, affectableState); if (affected.location() != null) { Room room = affected.location(); if (affected.charStats().getClassLevel(this) >= 5) { if (CMLib.flags().isInDark(room)) { affectableState.setMana(affectableState.getMana() - (affectableState.getMana() / 4)); affectableState.setMovement( affectableState.getMovement() - (affectableState.getMovement() / 4)); } else if ((room.domainType() & Room.INDOORS) == 0) switch (room.getArea().getClimateObj().weatherType(room)) { case Climate.WEATHER_BLIZZARD: case Climate.WEATHER_CLOUDY: case Climate.WEATHER_DUSTSTORM: case Climate.WEATHER_HAIL: case Climate.WEATHER_RAIN: case Climate.WEATHER_SLEET: case Climate.WEATHER_SNOW: case Climate.WEATHER_THUNDERSTORM: break; default: affectableState.setMana(affectableState.getMana() + (affectableState.getMana() / 4)); affectableState.setMovement( affectableState.getMovement() + (affectableState.getMovement() / 4)); break; } } } }
@Override public boolean tick(Tickable ticking, int tickID) { if (!super.tick(ticking, tickID)) return false; if ((tickID == Tickable.TICKID_MOB) && (invoker() != null) && (affected instanceof MOB)) { final MOB mob = (MOB) affected; final Set<MOB> invokerGroup = invoker().getGroupMembers(new HashSet<MOB>()); if (mob != invoker()) { if (mob.location() != invoker().location()) unInvoke(); else { if (invokerGroup.contains(mob)) unInvoke(); else if (mob.isInCombat()) { int levels = invoker().charStats().getClassLevel("Templar"); if (levels < 0) levels = invoker().phyStats().level(); if (CMLib.dice().rollPercentage() >= levels) { final MOB newvictim = mob.location().fetchRandomInhabitant(); if (newvictim != mob) mob.setVictim(newvictim); } } } } else if ((mob.location() != null) && (CMLib.flags().isEvil(invoker()))) { for (int m = 0; m < mob.location().numInhabitants(); m++) { final MOB M = mob.location().fetchInhabitant(m); if ((M != null) && (M != invoker()) && (!invokerGroup.contains(M)) && (!M.Name().equals(mob.getLiegeID()))) beneficialAffect(invoker, M, 0, Ability.TICKS_FOREVER); } } } return true; }
@Override public boolean execute(MOB mob, Vector commands, int metaFlags) throws java.io.IOException { if (!(CMLib.intermud().imc2online())) { mob.tell(L("IMC2 is unavailable.")); return false; } commands.remove(0); if (commands.size() < 1) { IMC2Error(mob); return false; } final String str = (String) commands.get(0); if (!(CMLib.intermud().imc2online())) mob.tell(L("IMC2 is unavailable.")); else if (str.equalsIgnoreCase("list")) CMLib.intermud().giveIMC2MudList(mob); else if (str.equalsIgnoreCase("locate")) CMLib.intermud().i3locate(mob, CMParms.combine(commands, 1)); else if (str.equalsIgnoreCase("channels") && CMSecurity.isAllowed(mob, mob.location(), CMSecurity.SecFlag.IMC2)) CMLib.intermud().giveIMC2ChannelsList(mob); else if (str.equalsIgnoreCase("info")) CMLib.intermud().imc2mudInfo(mob, CMParms.combine(commands, 1)); else if (str.equalsIgnoreCase("restart") && CMSecurity.isAllowed(mob, mob.location(), CMSecurity.SecFlag.IMC2)) { try { mob.tell(CMLib.hosts().get(0).executeCommand("START IMC2")); } catch (final Exception e) { Log.errOut("IMC2Cmd", e); } } else IMC2Error(mob); return false; }
public void unInvoke() { // undo the affects of this spell if ((affected == null) || (!(affected instanceof MOB))) return; MOB mob = (MOB) affected; super.unInvoke(); if ((canBeUninvoked()) && (mob.location() != null)) { if ((failed) || (!CMLib.flags().isSitting(mob)) || (room == null) || (title == null) || (mob.location() != room)) mob.tell("You are no longer squatting."); else if (title.landOwner().length() > 0) { mob.tell( "Your squat has succeeded. This property no longer belongs to " + title.landOwner() + "."); title.setLandOwner(""); title.updateTitle(); title.updateLot(null); } else if (title.landOwner().length() > 0) { mob.tell("Your squat has succeeded. This property now belongs to you."); title.setLandOwner(mob.Name()); title.updateTitle(); title.updateLot(new XVector(mob.name())); } } failed = false; }
@Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target = getTarget(mob, commands, givenTarget); if (target == null) return false; if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; final boolean success = proficiencyCheck(mob, 0, auto); if (success) { final CMMsg msg = CMClass.getMsg( mob, target, this, verbalCastCode(mob, target, auto), auto ? "" : L("^S<S-NAME> whistle(s) to <T-NAMESELF>.^?")); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); mob.location() .show(target, null, CMMsg.MSG_OK_VISUAL, L("<S-NAME> attain(s) an aquatic aura!")); beneficialAffect(mob, target, asLevel, 0); } } else beneficialWordsFizzle( mob, target, L("<S-NAME> whistle(s) to <T-NAMESELF>, but nothing happens.")); return success; }
@Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target = this.getTarget(mob, commands, givenTarget); if (target == null) return false; if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; boolean success = proficiencyCheck(mob, 0, auto); if (success) { invoker = mob; final CMMsg msg = CMClass.getMsg( mob, target, this, verbalCastCode(mob, target, auto), auto ? "" : L("^S<S-NAME> incant(s) at <T-NAMESELF>.^?")); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); if (msg.value() <= 0) { mob.location().show(target, null, CMMsg.MSG_OK_VISUAL, L("<S-NAME> get(s) sick!")); success = maliciousAffect(mob, target, asLevel, 0, -1) != null; } } } else return maliciousFizzle( mob, target, L("<S-NAME> incant(s) at <T-NAMESELF>, but the spell fizzles.")); // return whether it worked return success; }
@Override public void spring(MOB target) { if ((target != invoker()) && (target.location() != null)) { if ((doesSaveVsTraps(target)) || (invoker().getGroupMembers(new HashSet<MOB>()).contains(target))) target .location() .show( target, null, null, CMMsg.MASK_ALWAYS | CMMsg.MSG_NOISE, L("<S-NAME> avoid(s) setting off a gas trap!")); else if (target .location() .show( target, target, this, CMMsg.MASK_ALWAYS | CMMsg.MSG_NOISE, L("<S-NAME> set(s) off a trap! The room fills with gas!"))) { super.spring(target); Ability A = CMClass.getAbility(text()); if (A == null) A = CMClass.getAbility("Poison"); for (int i = 0; i < target.location().numInhabitants(); i++) { final MOB M = target.location().fetchInhabitant(i); if ((M != null) && (M != invoker()) && (A != null)) if (invoker().mayIFight(M)) A.invoke(invoker(), M, true, 0); } if ((canBeUninvoked()) && (affected instanceof Item)) disable(); } } }
public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { Physical target = getAnyTarget(mob, commands, givenTarget, Wearable.FILTER_ANY); if (target == null) return false; if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; boolean success = proficiencyCheck(mob, 0, auto); if (success) { // it worked, so build a copy of this ability, // and add it to the affects list of the // affected MOB. Then tell everyone else // what happened. CMMsg msg = CMClass.getMsg( mob, target, this, verbalCastCode(mob, target, auto), auto ? "" : "^S<S-NAME> " + prayWord(mob) + " to extinguish <T-NAMESELF>.^?"); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); CMLib.utensils().extinguish(mob, target, false); target.recoverPhyStats(); mob.location().recoverRoomStats(); } } else return beneficialWordsFizzle( mob, target, "<S-NAME> " + prayWord(mob) + " to extinguish <T-NAMESELF>, but nothing happens."); // return whether it worked return success; }
public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { if (!rightPlace(mob, auto)) return false; if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; // now see if it worked boolean success = proficiencyCheck(mob, 0, auto); if (success) { CMMsg msg = CMClass.getMsg( mob, null, this, verbalCastCode(mob, null, auto), auto ? "" : "^S<S-NAME> chant(s) to the ground.^?"); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); buildMyThing(mob, mob.location()); } } else return beneficialWordsFizzle( mob, null, "<S-NAME> chant(s) to the ground, but nothing happens."); // return whether it worked return success; }
public boolean invoke( MOB mob, Vector commands, Environmental givenTarget, boolean auto, int asLevel) { MOB target = getTarget(mob, commands, givenTarget); if (target == null) return false; if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; boolean success = proficiencyCheck(mob, 0, auto); if (success) { CMMsg msg = CMClass.getMsg( mob, target, this, verbalCastCode(mob, target, auto), auto ? "<T-NAME> feel(s) magically protected." : "^S<S-NAME> invoke(s) an absorbing barrier of protection around <T-NAMESELF>.^?"); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); beneficialAffect(mob, target, asLevel, 0); } } else beneficialWordsFizzle( mob, target, "<S-NAME> attempt(s) to invoke an absorbing barrier, but fail(s)."); return success; }
@Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target = getTarget(mob, commands, givenTarget); if (target == null) return false; if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; final boolean success = proficiencyCheck(mob, 0, auto); if (success) { final CMMsg msg = CMClass.getMsg( mob, target, this, verbalCastCode(mob, target, auto), auto ? L("An anti-plant shell surrounds <T-NAME>!") : L("^S<S-NAME> cast(s) the anti-plant shell around <T-NAMESELF>!^?")); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); beneficialAffect(mob, target, asLevel, 0); } } else return beneficialWordsFizzle( mob, target, L("<S-NAME> cast(s) a shell at <T-NAMESELF>, but the magic fizzles.")); // return whether it worked return success; }
public boolean okMessage(Environmental myHost, CMMsg msg) { if (!super.okMessage(myHost, msg)) return false; if (msg.targetMinor() == CMMsg.TYP_ENTER) { if (msg.target() == this) { MOB mob = msg.source(); if ((mob.location() != null) && (mob.location().roomID().length() > 0)) { int direction = -1; for (int d = Directions.NUM_DIRECTIONS() - 1; d >= 0; d--) { if (mob.location().getRoomInDir(d) == this) direction = d; } if (direction < 0) { mob.tell("Some great evil is preventing your movement that way."); return false; } msg.modify( msg.source(), getAltRoomFrom(mob.location(), direction), msg.tool(), msg.sourceCode(), msg.sourceMessage(), msg.targetCode(), msg.targetMessage(), msg.othersCode(), msg.othersMessage()); } } } return true; }
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if (!super.okMessage(myHost, msg)) return false; final MOB mob = msg.source(); if (mob.location() == null) return true; if (msg.amITarget(this)) switch (msg.targetMinor()) { case CMMsg.TYP_HOLD: case CMMsg.TYP_WEAR: case CMMsg.TYP_WIELD: case CMMsg.TYP_GET: if ((!msg.source().charStats().getCurrentClass().ID().equals("Paladin")) || (!CMLib.flags().isGood(msg.source()))) { unWear(); mob.location() .show( mob, null, CMMsg.MSG_OK_ACTION, L("@x1 flashes and flies out of <S-HIS-HER> hands!", name())); if (msg.source().isMine(this)) CMLib.commands().postDrop(msg.source(), this, true, false, false); return false; } break; default: break; } return true; }
@Override public boolean tick(Tickable ticking, int tickID) { if (!super.tick(ticking, tickID)) return false; if (affected == null) return false; if (!(affected instanceof MOB)) return false; final MOB mob = (MOB) affected; if (mob.location().numInhabitants() == 1) return true; final Vector choices = new Vector(); for (final Enumeration<Ability> a = mob.effects(); a.hasMoreElements(); ) { final Ability A = a.nextElement(); if ((A != null) && (A.canBeUninvoked()) && (!A.ID().equals(ID())) && (A.abstractQuality() == Ability.QUALITY_MALICIOUS) && (((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_SPELL) || ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_PRAYER)) && (!A.isAutoInvoked())) choices.addElement(A); } if (choices.size() == 0) return true; final MOB target = mob.location().fetchRandomInhabitant(); final Ability thisOne = (Ability) choices.elementAt(CMLib.dice().roll(1, choices.size(), -1)); if ((target == null) || (thisOne == null) || (target.fetchEffect(ID()) != null)) return true; if (CMLib.dice().rollPercentage() > (target.charStats().getSave(CharStats.STAT_SAVE_DISEASE))) { ((Ability) this.copyOf()).invoke(target, target, true, 0); if (target.fetchEffect(ID()) != null) ((Ability) thisOne.copyOf()).invoke(target, target, true, 0); } else spreadImmunity(target); return true; }
@Override public boolean invoke( MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target = null; Ability reAffect = null; if (mob.isInCombat()) { if (mob.rangeToTarget() > 0) { mob.tell(L("You are too far away to touch!")); return false; } final MOB victim = mob.getVictim(); reAffect = victim.fetchEffect("Undead_WeakEnergyDrain"); if (reAffect == null) reAffect = victim.fetchEffect("Undead_EnergyDrain"); if (reAffect != null) target = victim; } if (target == null) target = this.getTarget(mob, commands, givenTarget); if (target == null) return false; if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; boolean success = proficiencyCheck(mob, 0, auto); String str = null; if (success) { str = auto ? "" : L("^S<S-NAME> extend(s) an energy draining hand to <T-NAMESELF>!^?"); final CMMsg msg = CMClass.getMsg( mob, target, this, CMMsg.MSK_MALICIOUS_MOVE | CMMsg.TYP_UNDEAD | (auto ? CMMsg.MASK_ALWAYS : 0), str); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); if (msg.value() <= 0) { mob.location().show(target, null, CMMsg.MSG_OK_VISUAL, L("<S-NAME> <S-IS-ARE> drained!")); if (reAffect != null) { if (reAffect instanceof Undead_EnergyDrain) ((Undead_EnergyDrain) reAffect).levelsDown++; ((StdAbility) reAffect) .setTickDownRemaining( ((StdAbility) reAffect).getTickDownRemaining() + mob.phyStats().level()); mob.recoverPhyStats(); mob.recoverCharStats(); mob.recoverMaxState(); } else { direction = 1; if (target.charStats().getMyRace().racialCategory().equalsIgnoreCase("Undead")) direction = -1; success = maliciousAffect(mob, target, asLevel, 0, -1) != null; } } } } else return maliciousFizzle( mob, target, L("<S-NAME> attempt(s) to drain <T-NAMESELF>, but fail(s).")); return success; }
@Override public boolean securityCheck(MOB mob) { return (mob == null) || (mob.isMonster()) || (mob.location() == null) || ((!(mob.location() instanceof BoardableShip)) && (!(mob.location().getArea() instanceof BoardableShip))); }
@Override public boolean invoke( MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if (commands.size() < 1) { mob.tell( L( "You must specify an item to fence, and possibly a ShopKeeper (unless it is implied).")); return false; } commands.add(0, "SELL"); // will be instantly deleted by parseshopkeeper final Environmental shopkeeper = CMLib.english().parseShopkeeper(mob, commands, L("Fence what to whom?")); if (shopkeeper == null) return false; if (commands.size() == 0) { mob.tell(L("Fence what?")); return false; } if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; final boolean success = proficiencyCheck(mob, 0, auto); if (success) { final CMMsg msg = CMClass.getMsg( mob, shopkeeper, this, CMMsg.MSG_SPEAK, auto ? "" : L("<S-NAME> fence(s) stolen loot to <T-NAMESELF>.")); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); invoker = mob; addBackMap.clear(); mob.addEffect(this); mob.recoverCharStats(); commands.add(0, CMStrings.capitalizeAndLower("SELL")); mob.doCommand(commands, MUDCmdProcessor.METAFLAG_FORCED); commands.add(shopkeeper.name()); mob.delEffect(this); for (Item I : addBackMap.keySet()) { if (mob.isMine(I)) { I.addEffect(addBackMap.get(I)); } } addBackMap.clear(); mob.recoverCharStats(); } } else beneficialWordsFizzle( mob, shopkeeper, L( "<S-NAME> attempt(s) to fence stolen loot to <T-NAMESELF>, but make(s) <T-HIM-HER> too nervous.")); // return whether it worked return success; }
@Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { Item target = null; if ((commands.size() == 0) && (!auto) && (givenTarget == null)) target = Prayer_Sacrifice.getBody(mob.location()); if (target == null) target = getTarget(mob, mob.location(), givenTarget, commands, Wearable.FILTER_UNWORNONLY); if (target == null) return false; if ((!(target instanceof DeadBody)) || (target.rawSecretIdentity().toUpperCase().indexOf("FAKE") >= 0)) { mob.tell(L("You may only desecrate the dead.")); return false; } if ((((DeadBody) target).isPlayerCorpse()) && (!((DeadBody) target).getMobName().equals(mob.Name())) && (((DeadBody) target).hasContent())) { mob.tell(L("You are not allowed to desecrate a players corpse.")); return false; } if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; final boolean success = proficiencyCheck(mob, 0, auto); if (success) { final CMMsg msg = CMClass.getMsg( mob, target, this, verbalCastCode(mob, target, auto), auto ? L("<T-NAME> feel(s) desecrated!") : L("^S<S-NAME> desecrate(s) <T-NAMESELF> before @x1.^?", hisHerDiety(mob))); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); if (CMLib.flags().isEvil(mob)) { double exp = 5.0; final int levelLimit = CMProps.getIntVar(CMProps.Int.EXPRATE); final int levelDiff = (mob.phyStats().level()) - target.phyStats().level(); if (levelDiff > levelLimit) exp = 0.0; if (exp > 0.0) CMLib.leveler() .postExperience( mob, null, null, (int) Math.round(exp) + super.getXPCOSTLevel(mob), false); } target.destroy(); mob.location().recoverRoomStats(); } } else beneficialWordsFizzle( mob, target, L("<S-NAME> attempt(s) to desecrate <T-NAMESELF>, but fail(s).")); // return whether it worked return success; }