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 void executeMsg(final Environmental myHost, final CMMsg msg) { if ((msg.tool() == this) && (msg.targetMinor() == CMMsg.TYP_WEAPONATTACK) && (weaponClassification() == Weapon.CLASS_THROWN)) return; // msg.addTrailerMsg(CMClass.getMsg(msg.source(),this,CMMsg.MSG_DROP,null)); else if ((msg.tool() == this) && (msg.targetMinor() == CMMsg.TYP_DAMAGE) && (msg.target() != null) && (msg.target() instanceof MOB) && (weaponClassification() == Weapon.CLASS_THROWN)) { unWear(); msg.addTrailerMsg( CMClass.getMsg(msg.source(), this, CMMsg.MASK_ALWAYS | CMMsg.MSG_DROP, null)); msg.addTrailerMsg( CMClass.getMsg((MOB) msg.target(), this, CMMsg.MASK_ALWAYS | CMMsg.MSG_GET, null)); msg.addTrailerMsg( CMClass.getMsg( msg.source(), msg.target(), this, CMMsg.MASK_ALWAYS | CMMsg.TYP_GENERAL, null)); } else if ((msg.tool() == this) && (msg.target() instanceof MOB) && (msg.targetMinor() == CMMsg.TYP_GENERAL) && (((MOB) msg.target()).isMine(this)) && (msg.sourceMessage() == null)) { final Ability A = CMClass.getAbility("Thief_Bind"); if (A != null) { A.setAffectedOne(this); A.invoke(msg.source(), (MOB) msg.target(), true, phyStats().level()); } } else super.executeMsg(myHost, msg); }
@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; // now see if it worked final boolean success = proficiencyCheck(mob, 0, auto); if (success) { final CMMsg msg = CMClass.getMsg( mob, target, this, somanticCastCode(mob, target, auto), L( (auto ? "A " : "^S<S-NAME> incant(s) and point(s) at <T-NAMESELF>. A ") + "long shard of ice streaks through the air!^?") + CMLib.protocol().msp("spelldam2.wav", 40)); final CMMsg msg2 = CMClass.getMsg( mob, target, this, CMMsg.MSK_CAST_MALICIOUS_VERBAL | CMMsg.TYP_COLD | (auto ? CMMsg.MASK_ALWAYS : 0), null); if ((mob.location().okMessage(mob, msg)) && (mob.location().okMessage(mob, msg2))) { mob.location().send(mob, msg); invoker = mob; int damage = 0; final int maxDie = (adjustedLevel(mob, asLevel) + (2 * super.getX1Level(mob))) / 2; damage += CMLib.dice().roll(maxDie, 6, 15); mob.location().send(mob, msg2); if ((msg2.value() > 0) || (msg.value() > 0)) damage = (int) Math.round(CMath.div(damage, 2.0)); if (target.location() == mob.location()) CMLib.combat() .postDamage( mob, target, this, damage, CMMsg.MASK_ALWAYS | CMMsg.TYP_COLD, Weapon.TYPE_FROSTING, L("The lance <DAMAGE> <T-NAME>!")); } } else return maliciousFizzle( mob, target, L("<S-NAME> incant(s) and point(s) at <T-NAMESELF>, but flub(s) the spell.")); // return whether it worked 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; final boolean undead = CMLib.flags().isUndead(target); 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, (undead ? 0 : CMMsg.MASK_MALICIOUS) | verbalCastCode(mob, target, auto), L( auto ? "A seriously painful burst assaults <T-NAME>." : "^S<S-NAME> " + prayWord(mob) + " for a serious burst of pain at <T-NAMESELF>!^?") + CMLib.protocol().msp("spelldam1.wav", 40)); final CMMsg msg2 = CMClass.getMsg( mob, target, this, CMMsg.MSK_CAST_MALICIOUS_VERBAL | CMMsg.TYP_UNDEAD | (auto ? CMMsg.MASK_ALWAYS : 0), null); final Room R = target.location(); if ((R != null) && (R.okMessage(mob, msg)) && ((R.okMessage(mob, msg2)))) { R.send(mob, msg); R.send(mob, msg2); if ((msg.value() <= 0) && (msg2.value() <= 0)) { final int harming = CMLib.dice().roll(1, adjustedLevel(mob, asLevel) + 6, 4); CMLib.combat() .postDamage( mob, target, this, harming, CMMsg.MASK_ALWAYS | CMMsg.TYP_UNDEAD, Weapon.TYPE_BURSTING, L("The unholy spell <DAMAGE> <T-NAME>!")); } } } else return maliciousFizzle( mob, target, L("<S-NAME> point(s) at <T-NAMESELF> and @x1, but nothing happens.", prayWord(mob))); // return whether it worked return success; }
public boolean open( MOB mob, Environmental openThis, String openableWord, int dirCode, boolean quietly) { final String openWord = (!(openThis instanceof Exit)) ? "open" : ((Exit) openThis).openWord(); final String openMsg = quietly ? null : ("<S-NAME> " + openWord + "(s) <T-NAMESELF>.") + CMLib.protocol().msp("dooropen.wav", 10); final CMMsg msg = CMClass.getMsg(mob, openThis, null, CMMsg.MSG_OPEN, openMsg, openableWord, openMsg); if (openThis instanceof Exit) { final boolean open = ((Exit) openThis).isOpen(); if ((mob.location().okMessage(msg.source(), msg)) && (!open)) { mob.location().send(msg.source(), msg); if (dirCode < 0) for (int d = Directions.NUM_DIRECTIONS() - 1; d >= 0; d--) if (mob.location().getExitInDir(d) == openThis) { dirCode = d; break; } if ((dirCode >= 0) && (mob.location().getRoomInDir(dirCode) != null)) { final Room opR = mob.location().getRoomInDir(dirCode); final Exit opE = mob.location().getPairedExit(dirCode); if (opE != null) { final CMMsg altMsg = CMClass.getMsg( msg.source(), opE, msg.tool(), msg.sourceCode(), null, msg.targetCode(), null, msg.othersCode(), null); opE.executeMsg(msg.source(), altMsg); } final int opCode = Directions.getOpDirectionCode(dirCode); if ((opE != null) && (opE.isOpen()) && (((Exit) openThis).isOpen())) { final boolean useShipDirs = (opR instanceof BoardableShip) || (opR.getArea() instanceof BoardableShip); final String inDirName = useShipDirs ? Directions.getShipInDirectionName(opCode) : Directions.getInDirectionName(opCode); opR.showHappens(CMMsg.MSG_OK_ACTION, L("@x1 @x2 opens.", opE.name(), inDirName)); } return true; } } } else if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); return true; } return false; }
@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; Room R = CMLib.map().roomLocation(target); if (R == null) R = mob.location(); 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, somanticCastCode(mob, target, auto), L( auto ? "<T-NAME> <T-IS-ARE> sprayed with acid." : "^S<S-NAME> reach(es) for <T-NAMESELF>, spraying acid all over <T-HIM-HER>!^?") + CMLib.protocol().msp("spelldam1.wav", 40)); final CMMsg msg2 = CMClass.getMsg( mob, target, this, CMMsg.MSK_CAST_MALICIOUS_VERBAL | CMMsg.TYP_ACID | (auto ? CMMsg.MASK_ALWAYS : 0), null); if ((R.okMessage(mob, msg)) && ((R.okMessage(mob, msg2)))) { R.send(mob, msg); R.send(mob, msg2); invoker = mob; final int numDice = (adjustedLevel(mob, asLevel) + (2 * super.getX1Level(invoker()))) / 2; int damage = CMLib.dice().roll(2, numDice, 1); if ((msg2.value() > 0) || (msg.value() > 0)) damage = (int) Math.round(CMath.div(damage, 2.0)); CMLib.combat() .postDamage( mob, target, this, damage, CMMsg.MASK_ALWAYS | CMMsg.TYP_ACID, Weapon.TYPE_MELTING, L("The acid <DAMAGE> <T-NAME>!")); maliciousAffect(mob, target, asLevel, 3, -1); } } else return maliciousFizzle( mob, target, L("<S-NAME> reach(es) for <T-NAMESELF>, but nothing more 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; 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; }
public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { if (commands != null) commands = new XVector(commands); if (!conCheck(mob, commands, givenTarget, auto, asLevel)) return false; Vector V = new Vector(); V.addElement(commands.elementAt(0)); MOB target = this.getTarget(mob, V, givenTarget); if (target == null) return false; commands.removeElementAt(0); int oldProficiency = proficiency(); if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; int levelDiff = ((mob.phyStats().level() + (2 * super.getXLEVELLevel(mob))) - target.phyStats().level()) * 10; if (levelDiff > 0) levelDiff = 0; boolean success = proficiencyCheck( mob, (mob.charStats().getStat(CharStats.STAT_CHARISMA) * 2) + levelDiff, auto); if (!success) { CMMsg msg = CMClass.getMsg( mob, target, this, CMMsg.MSG_SPEAK, "^T<S-NAME> tr(ys) to con <T-NAMESELF> to '" + CMParms.combine(commands, 0) + "', but <S-IS-ARE> unsuccessful.^?"); if (mob.location().okMessage(mob, msg)) mob.location().send(mob, msg); } else { CMMsg msg = CMClass.getMsg( mob, target, this, CMMsg.MSG_SPEAK, "^T<S-NAME> con(s) <T-NAMESELF> to '" + CMParms.combine(commands, 0) + "'.^?"); mob.recoverPhyStats(); CMMsg omsg = CMClass.getMsg(mob, target, null, CMMsg.MSG_ORDER, null); if ((mob.location().okMessage(mob, msg)) && (mob.location().okMessage(mob, omsg))) { mob.location().send(mob, msg); mob.location().send(mob, omsg); if (omsg.sourceMinor() == CMMsg.TYP_ORDER) target.enqueCommand(commands, Command.METAFLAG_FORCED | Command.METAFLAG_ORDER, 0); } target.recoverPhyStats(); } if (target == lastChecked) setProficiency(oldProficiency); lastChecked = target; 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); final Room R = target.location(); if (success) { final Prayer_Thunderbolt newOne = (Prayer_Thunderbolt) this.copyOf(); final CMMsg msg = CMClass.getMsg( mob, target, newOne, verbalCastCode(mob, target, auto), L( auto ? "<T-NAME> is filled with a holy charge!" : "^S<S-NAME> " + prayForWord(mob) + " to strike down <T-NAMESELF>!^?") + CMLib.protocol().msp("lightning.wav", 40)); final CMMsg msg2 = CMClass.getMsg( mob, target, this, CMMsg.MSK_CAST_MALICIOUS_VERBAL | CMMsg.TYP_ELECTRIC | (auto ? CMMsg.MASK_ALWAYS : 0), null); if ((R.okMessage(mob, msg)) && ((R.okMessage(mob, msg2)))) { R.send(mob, msg); R.send(mob, msg2); if ((msg.value() <= 0) && (msg2.value() <= 0)) { final int harming = CMLib.dice().roll(1, adjustedLevel(mob, asLevel), adjustedLevel(mob, asLevel)); CMLib.combat() .postDamage( mob, target, this, harming, CMMsg.MASK_ALWAYS | CMMsg.TYP_ELECTRIC, Weapon.TYPE_STRIKING, L("^SThe STRIKE of @x1 <DAMAGES> <T-NAME>!^?", hisHerDiety(mob))); } } } else return maliciousFizzle(mob, target, L("<S-NAME> @x1, but nothing happens.", prayWord(mob))); // return whether it worked return success; }
@Override 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; Room R = CMLib.map().roomLocation(target); if (R == null) R = mob.location(); if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; if ((auto) && (givenTarget != null) && (givenTarget instanceof MOB)) target = (MOB) givenTarget; // now see if it worked final boolean success = proficiencyCheck(mob, 0, auto); if (success) { final CMMsg msg = CMClass.getMsg( mob, target, this, somanticCastCode(mob, target, auto), auto ? "" : L("^S<S-NAME> speak(s) and gesture(s) to <T-NAMESELF>.^?")); if (R.okMessage(mob, msg)) { R.send(mob, msg); R.show(target, null, CMMsg.MSG_OK_VISUAL, L("<S-NAME> seem(s) much more likeable!")); beneficialAffect(mob, target, asLevel, 0); } } else return beneficialVisualFizzle( mob, target, L("<S-NAME> incant(s) gracefully to <T-NAMESELF>, but nothing more happens.")); // 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; }
public boolean okMessage(final Environmental myHost, final CMMsg msg) { if (!super.okMessage(myHost, msg)) return false; if (!(affected instanceof MOB)) return true; MOB mob = (MOB) affected; if (!mob.isInCombat()) this.unInvoke(); else if ((msg.amITarget(mob)) && (msg.targetMinor() == CMMsg.TYP_DAMAGE) && ((msg.value()) > 0)) { if ((msg.tool() != null) && (!mob.amDead()) && (msg.tool() instanceof Weapon)) { msg.modify( msg.source(), msg.target(), msg.tool(), CMMsg.NO_EFFECT, null, CMMsg.NO_EFFECT, null, CMMsg.NO_EFFECT, null); if (!((MOB) msg.target()).amDead()) msg.addTrailerMsg( CMClass.getMsg( (MOB) msg.target(), msg.source(), CMMsg.MSG_OK_VISUAL, "<S-NAME> tumble(s) around the attack from <T-NAME>.")); if ((++hits) >= 2) unInvoke(); } } return true; }
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if ((affected instanceof MOB) && (msg.amISource((MOB) affected)) && (msg.targetMinor() == CMMsg.TYP_DAMAGE) && (msg.tool() instanceof Weapon) && (msg.value() > 0) && (msg.target() instanceof MOB) && (((Weapon) msg.tool()).weaponClassification() == Weapon.CLASS_THROWN)) { if (CMLib.dice().rollPercentage() < 25) helpProficiency((MOB) affected, 0); final CMMsg msg2 = CMClass.getMsg( (MOB) msg.target(), msg.tool(), this, CMMsg.MSG_OK_VISUAL, L("^F^<FIGHT^><T-NAME> fragment(s) in <S-NAME>!^</FIGHT^>^?")); CMLib.color().fixSourceFightColor(msg2); msg.addTrailerMsg(msg2); msg.setValue( msg.value() + (int) Math.round( CMath.mul( 3.0 * msg.value(), CMath.div(proficiency(), 100.0 - (10.0 * getXLEVELLevel(invoker())))))); } return super.okMessage(myHost, msg); }
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, 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) { 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 invoke(MOB mob, Vector 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, "<S-NAME> <S-IS-ARE> detecting undead things."); 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> gain(s) dark cold senses!" : "^S<S-NAME> incant(s) softly, and gain(s) dark cold senses!^?"); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); beneficialAffect(mob, target, asLevel, 0); } } else beneficialVisualFizzle( mob, null, "<S-NAME> incant(s) and open(s) <S-HIS-HER> cold eyes, but the spell fizzles."); 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) { 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; }
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("^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) { 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 = 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, 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 void executeMsg(Environmental affecting, CMMsg msg) { super.executeMsg(affecting, msg); final MOB source = msg.source(); if (!canFreelyBehaveNormal(affecting)) return; final MOB observer = (MOB) affecting; if ((source != observer) && (msg.amITarget(observer)) && (msg.targetMinor() == CMMsg.TYP_GIVE) && (msg.tool() instanceof Coins)) { if ((CMLib.flags().canBeSeenBy(source, observer)) && (CMLib.flags().canBeSeenBy(observer, source))) { double value = ((Coins) msg.tool()).getTotalValue(); final String currency = ((Coins) msg.tool()).getCurrency().toUpperCase(); double takeCut = getMyCut(affecting, currency); double amountToTake = CMLib.beanCounter().abbreviatedRePrice(observer, value * takeCut); if ((amountToTake > 0.0) && (amountToTake < CMLib.beanCounter() .getLowestDenomination(CMLib.beanCounter().getCurrency(observer)))) amountToTake = CMLib.beanCounter().getLowestDenomination(CMLib.beanCounter().getCurrency(observer)); value -= amountToTake; observer.recoverPhyStats(); final Coins C = CMLib.beanCounter().makeBestCurrency(observer, value); if ((value > 0.0) && (C != null)) { // this message will actually end up triggering the hand-over. final CMMsg newMsg = CMClass.getMsg( observer, source, C, CMMsg.MSG_SPEAK, L("^T<S-NAME> say(s) 'Thank you for your business' to <T-NAMESELF>.^?")); C.setOwner(observer); final long num = C.getNumberOfCoins(); final String curr = C.getCurrency(); final double denom = C.getDenomination(); C.destroy(); C.setNumberOfCoins(num); C.setCurrency(curr); C.setDenomination(denom); msg.addTrailerMsg(newMsg); } else CMLib.commands().postSay(observer, source, L("Gee, thanks. :)"), true, false); ((Coins) msg.tool()).destroy(); } else if (!CMLib.flags().canBeSeenBy(source, observer)) CMLib.commands() .postSay(observer, null, L("Wha? Where did this come from? Cool!"), true, false); } else if ((msg.source() == observer) && (msg.target() instanceof MOB) && (msg.targetMinor() == CMMsg.TYP_SPEAK) && (msg.tool() instanceof Coins) && (((Coins) msg.tool()).amDestroyed()) && (!msg.source().isMine(msg.tool())) && (!((MOB) msg.target()).isMine(msg.tool()))) CMLib.beanCounter() .giveSomeoneMoney(msg.source(), (MOB) msg.target(), ((Coins) msg.tool()).getTotalValue()); }
@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 (target.charStats().getBodyPart(Race.BODY_FOOT) == 0) { mob.tell(L("@x1 has no feet!", target.name(mob))); 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) | CMMsg.MASK_MALICIOUS, auto ? "" : L("^S<S-NAME> chant(s) at <T-YOUPOSS> feet!^?")); final CMMsg msg2 = CMClass.getMsg( mob, target, this, verbalCastMask(mob, target, auto) | CMMsg.TYP_DISEASE, null); if ((mob.location().okMessage(mob, msg)) && (mob.location().okMessage(mob, msg2))) { mob.location().send(mob, msg); mob.location().send(mob, msg2); if ((msg.value() <= 0) && (msg2.value() <= 0)) { invoker = mob; maliciousAffect(mob, target, asLevel, Ability.TICKS_ALMOST_FOREVER, -1); mob.location() .show( target, null, CMMsg.MSG_OK_VISUAL, L("A fungus sprouts up between <S-YOUPOSS> toes!")); } else spreadImmunity(target); } } else return maliciousFizzle( mob, target, L("<S-NAME> chant(s) at <T-YOUPOSS> feet, but nothing happens.")); // return whether it worked return success; }
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { super.executeMsg(myHost, msg); if ((msg.source().location() != null) && (msg.targetMinor() == CMMsg.TYP_DAMAGE) && ((msg.value()) > 0) && (msg.tool() == this) && (msg.target() instanceof MOB) && (!((MOB) msg.target()).amDead()) && (CMLib.flags().isEvil((MOB) msg.target()))) { final CMMsg msg2 = CMClass.getMsg( msg.source(), msg.target(), new HolyAvenger(), CMMsg.MSG_OK_ACTION, CMMsg.MSK_MALICIOUS_MOVE | CMMsg.TYP_UNDEAD, CMMsg.MSG_NOISYMOVEMENT, null); if (msg.source().location().okMessage(msg.source(), msg2)) { msg.source().location().send(msg.source(), msg2); int damage = CMLib.dice().roll(1, 15, 0); if (msg.value() > 0) damage = damage / 2; msg.addTrailerMsg( CMClass.getMsg( msg.source(), msg.target(), CMMsg.MSG_OK_ACTION, L( "@x1 dispels evil within <T-NAME> and @x2 <T-HIM-HER>>!", name(), CMLib.combat().standardHitWord(Weapon.TYPE_BURSTING, damage)))); final CMMsg msg3 = CMClass.getMsg( msg.source(), msg.target(), null, CMMsg.MSG_OK_VISUAL, CMMsg.MSG_DAMAGE, CMMsg.NO_EFFECT, null); msg3.setValue(damage); msg.addTrailerMsg(msg3); } } }
public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { if (commands.size() < 1) { mob.tell("Grow plants where?"); return false; } String areaName = CMParms.combine(commands, 0).trim().toUpperCase(); Room anyRoom = null; Room newRoom = null; try { List<Room> rooms = CMLib.map().findRooms(CMLib.map().rooms(), mob, areaName, true, 10); for (Room R : rooms) { anyRoom = R; if (R.domainType() == Room.DOMAIN_INDOORS_CAVE) { newRoom = R; break; } } } catch (NoSuchElementException e) { } if (newRoom == null) { if (anyRoom == null) mob.tell("You don't know of a place called '" + CMParms.combine(commands, 0) + "'."); else if ((anyRoom.domainType() & Room.INDOORS) == 0) mob.tell("There IS such a place, but it is outdoors, where your fungus will not grow."); else if ((anyRoom.domainType() == Room.DOMAIN_INDOORS_UNDERWATER) || (anyRoom.domainType() == Room.DOMAIN_INDOORS_WATERSURFACE)) mob.tell("There IS such a place, but it is on or in the water, so your magic would fail."); else mob.tell("There IS such a place, but it is not in a cave, so your magic would fail."); 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, null, this, verbalCastCode(mob, null, auto), "^S<S-NAME> chant(s) about a far away place.^?"); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); Item newItem = Chant_SummonFungus.buildFungus(mob, newRoom); mob.tell("You feel a distant connection with " + newItem.name()); } } else beneficialWordsFizzle( mob, null, "<S-NAME> chant(s) about a far away place, but the magic fades."); // return whether it worked return success; }