@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; }
@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("<T-NAME> feel(s) freely protected.") : L( "^S<S-NAME> invoke(s) an uninhibiting 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, L("<S-NAME> attempt(s) to invoke an uninhibiting barrier, but fail(s).")); 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) { 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; }
@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 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 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 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 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 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, 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, 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 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; }
@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; }
@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 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 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(); } } }
@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; }
@Override public Trap setTrap(MOB mob, Physical P, int trapBonus, int qualifyingClassLevel, boolean perm) { if (P == null) return null; if (mob != null) { final Item I = findMostOfMaterial(mob.location(), RawMaterial.MATERIAL_METAL); if (I != null) super.destroyResources(mob.location(), I.material(), 10); } return super.setTrap(mob, P, trapBonus, qualifyingClassLevel, perm); }
@Override public boolean invoke( MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) 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, null, this, verbalCastCode(mob, null, auto), auto ? "" : L("^S<S-NAME> @x1 for knowledge of the lower law here.^?", prayWord(mob))); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); final Area O = CMLib.law().getLegalObject(mob.location()); final LegalBehavior B = CMLib.law().getLegalBehavior(mob.location()); if ((B == null) || (O == null)) mob.tell(L("No lower law is established here.")); else { final Law L = B.legalInfo(O); final Vector<String> crimes = new Vector<String>(); possiblyAddLaw(L, crimes, "TRESPASSING"); possiblyAddLaw(L, crimes, "ASSAULT"); possiblyAddLaw(L, crimes, "MURDER"); possiblyAddLaw(L, crimes, "NUDITY"); possiblyAddLaw(L, crimes, "ARMED"); possiblyAddLaw(L, crimes, "RESISTINGARREST"); possiblyAddLaw(L, crimes, "PROPERTYROB"); for (final String key : L.abilityCrimes().keySet()) if (key.startsWith("$")) crimes.add(key.substring(1)); if (L.taxLaws().containsKey("TAXEVASION")) crimes.add(((String[]) L.taxLaws().get("TAXEVASION"))[Law.BIT_CRIMENAME]); for (int x = 0; x < L.bannedSubstances().size(); x++) { final String name = L.bannedBits().get(x)[Law.BIT_CRIMENAME]; if (!crimes.contains(name)) crimes.add(name); } for (int x = 0; x < L.otherCrimes().size(); x++) { final String name = L.otherBits().get(x)[Law.BIT_CRIMENAME]; if (!crimes.contains(name)) crimes.add(name); } mob.tell( L( "The following lower crimes are divinely revealed to you: @x1.", CMLib.english().toEnglishStringList(crimes.toArray(new String[0])))); } } } else beneficialWordsFizzle(mob, null, L("<S-NAME> @x1, but nothing is revealed.", prayWord(mob))); return success; }
@Override public void affectCharState(MOB affected, CharState affectableState) { super.affectCharState(affected, affectableState); if (affected.location() != null) for (int i = 0; i < affected.location().numItems(); i++) { final Item I = affected.location().getItem(i); if ((I != null) && (I.ID().equals("DruidicMonument"))) affectableState.setMana(affectableState.getMana() + (affectableState.getMana() / 2)); } }
@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; final boolean success = proficiencyCheck(mob, 0, auto); if (success) { final CMMsg msg = CMClass.getMsg( mob, target, this, CMMsg.MSK_CAST_MALICIOUS_VERBAL | CMMsg.TYP_UNDEAD | (auto ? CMMsg.MASK_ALWAYS : 0), null); final CMMsg msg2 = CMClass.getMsg( mob, target, this, verbalCastCode(mob, target, auto), auto ? "" : L("^S<S-NAME> reach(es) at <T-NAMESELF>, @x1!^?", prayingWord(mob))); if ((mob.location().okMessage(mob, msg)) && (mob.location().okMessage(mob, msg2))) { mob.location().send(mob, msg2); mob.location().send(mob, msg); if ((msg.value() <= 0) && (msg2.value() <= 0)) { final int damage = CMLib.dice().roll(1, adjustedLevel(mob, asLevel), 0); CMLib.combat() .postDamage( mob, target, this, damage, CMMsg.MASK_ALWAYS | CMMsg.TYP_UNDEAD, Weapon.TYPE_BURSTING, auto ? L("<T-NAME> shudder(s) in a draining magical wake.") : L("The draining grasp <DAMAGE> <T-NAME>.")); if (mob != target) CMLib.combat() .postHealing( mob, mob, this, CMMsg.MASK_ALWAYS | CMMsg.TYP_CAST_SPELL, damage, null); } } } else return maliciousFizzle( mob, target, L("<S-NAME> reach(es) for <T-NAMESELF>, @x1, but the spell fades.", prayingWord(mob))); // return whether it worked return success; }
@Override public boolean invoke( MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if (!mob.isInCombat()) { mob.tell(L("You must be in combat to do this!")); return false; } final MOB victim = super.getTarget(mob, commands, givenTarget); if (victim == null) return false; if (((victim == mob.getVictim()) && (mob.rangeToTarget() > 0)) || ((victim.getVictim() == mob) && (victim.rangeToTarget() > 0))) { mob.tell(L("You are too far away to disarm!")); return false; } if (mob.fetchWieldedItem() == null) { mob.tell(L("You need a weapon to disarm someone!")); return false; } Item hisWeapon = victim.fetchWieldedItem(); if (hisWeapon == null) hisWeapon = victim.fetchHeldItem(); if ((hisWeapon == null) || (!(hisWeapon instanceof Weapon)) || ((((Weapon) hisWeapon).weaponClassification() == Weapon.CLASS_NATURAL))) { mob.tell(L("@x1 is not wielding a weapon!", victim.charStats().HeShe())); return false; } if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; int levelDiff = victim.phyStats().level() - (mob.phyStats().level() + (2 * getXLEVELLevel(mob))); if (levelDiff > 0) levelDiff = levelDiff * 5; else levelDiff = 0; final boolean hit = (auto) || CMLib.combat().rollToHit(mob, victim); final boolean success = proficiencyCheck(mob, -levelDiff, auto) && (hit); if ((success) && ((hisWeapon.fitsOn(Wearable.WORN_WIELD)) || hisWeapon.fitsOn(Wearable.WORN_WIELD | Wearable.WORN_HELD))) { if (mob.location().show(mob, victim, this, CMMsg.MSG_NOISYMOVEMENT, null)) { final CMMsg msg = CMClass.getMsg(victim, hisWeapon, null, CMMsg.MSG_DROP, null); if (mob.location().okMessage(mob, msg)) { mob.location().send(victim, msg); mob.location() .show( mob, victim, CMMsg.MSG_NOISYMOVEMENT, auto ? L("<T-NAME> is disarmed!") : L("<S-NAME> disarm(s) <T-NAMESELF>!")); } } } else maliciousFizzle(mob, victim, L("<S-NAME> attempt(s) to disarm <T-NAMESELF> and fail(s)!")); return success; }
@Override public boolean invoke( MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target = CMLib.players().getLoadPlayer(CMParms.combine(commands, 0)); if (target == null) target = getTargetAnywhere(mob, commands, givenTarget, false, true, false); if (target == null) return false; final Archon_Record A = (Archon_Record) target.fetchEffect(ID()); if (A != null) { target.delEffect(A); if (target.playerStats() != null) target.playerStats().setLastUpdated(0); mob.tell(L("@x1 will no longer be recorded.", target.Name())); return true; } 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, CMMsg.MASK_MOVE | CMMsg.TYP_JUSTICE | (auto ? CMMsg.MASK_ALWAYS : 0), L("^F<S-NAME> begin(s) recording <T-NAMESELF>.^?")); CMLib.color().fixSourceFightColor(msg); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); final String filename = "/" + target.Name() + System.currentTimeMillis() + ".log"; final CMFile file = new CMFile(filename, null, CMFile.FLAG_LOGERRORS); if (!file.canWrite()) { if (!CMSecurity.isASysOp(mob) || (CMSecurity.isASysOp(target))) Log.sysOut("Record", mob.Name() + " failed to start recording " + target.name() + "."); } else { if (!CMSecurity.isASysOp(mob) || (CMSecurity.isASysOp(target))) Log.sysOut( "Record", mob.Name() + " started recording " + target.name() + " to /" + filename + "."); final Archon_Record A2 = (Archon_Record) copyOf(); final Session F = (Session) CMClass.getCommon("FakeSession"); F.initializeSession(null, Thread.currentThread().getThreadGroup().getName(), filename); if (target.session() == null) target.setSession(F); A2.sess = F; target.addNonUninvokableEffect(A2); mob.tell(L("Enter RECORD @x1 again to stop recording.", target.Name())); } } } else return beneficialVisualFizzle( mob, target, L("<S-NAME> attempt(s) to hush <T-NAMESELF>, but fail(s).")); return success; }
@Override public boolean canSetTrapOn(MOB mob, Physical P) { if (!super.canSetTrapOn(mob, P)) return false; if (mob != null) { final Item I = findMostOfMaterial(mob.location(), RawMaterial.MATERIAL_METAL); if ((I == null) || (super.findNumberOfResource(mob.location(), I.material()) < 10)) { mob.tell(L("You'll need to set down at least 10 pounds of metal first.")); return false; } } return true; }
@Override public void unInvoke() { // undo the affects of this spell if (!(affected instanceof MOB)) return; final MOB M = (MOB) affected; super.unInvoke(); if ((canBeUninvoked()) && (M != null) && (!M.amDead()) && (M.location() != null)) M.location() .show(M, null, CMMsg.MSG_OK_VISUAL, L("The aura of strife around <S-NAME> fades.")); }
protected Item getPoison(MOB mob) { if (mob == null) return null; if (mob.location() == null) return null; for (int i = 0; i < mob.location().numItems(); i++) { final Item I = mob.location().getItem(i); if ((I != null) && (I instanceof Drink)) { final List<Ability> V = returnOffensiveAffects(I); if (V.size() > 0) return I; } } return null; }