public void executeMsg(final Environmental myHost, final CMMsg msg) { try { super.executeMsg(myHost, msg); if (spy == null) return; if (invoker == null) return; if ((msg.amISource(spy)) && ((msg.sourceMinor() == CMMsg.TYP_LOOK) || (msg.sourceMinor() == CMMsg.TYP_EXAMINE)) && (msg.target() != null) && ((invoker.location() != spy.location()) || (!(msg.target() instanceof Room)))) { disable = true; CMMsg newAffect = CMClass.getMsg(invoker, msg.target(), msg.sourceMinor(), null); msg.target().executeMsg(invoker, newAffect); } else if ((!msg.amISource(invoker)) && (invoker.location() != spy.location()) && (msg.source().location() == spy.location()) && (msg.othersCode() != CMMsg.NO_EFFECT) && (msg.othersMessage() != null) && (!disable)) { disable = true; invoker.executeMsg(invoker, msg); } else if (msg.amISource(invoker) && (!disable) && (msg.sourceMinor() == CMMsg.TYP_SPEAK) && (msg.sourceMessage() != null) && ((msg.sourceMajor() & CMMsg.MASK_MAGIC) == 0)) { int start = msg.sourceMessage().indexOf("\'"); int end = msg.sourceMessage().lastIndexOf("\'"); if ((start > 0) && (end > start)) { String msg2 = msg.sourceMessage().substring(start + 1, end).trim(); if (msg2.length() > 0) spy.enqueCommand(CMParms.parse(msg2.trim()), Command.METAFLAG_FORCED, 0); } } } finally { disable = false; if ((spy != null) && ((spy.amFollowing() != invoker) || (spy.amDead()) || (!CMLib.flags().isInTheGame(spy, false)) || (!CMLib.flags().isInTheGame(invoker, true)))) unInvoke(); } }
public boolean okMessage(final Environmental myHost, final CMMsg msg) { if (!super.okMessage(myHost, msg)) return false; if ((affected == null) || (!(affected instanceof MOB))) return true; MOB mob = (MOB) affected; if (msg.amISource(mob) && (msg.targetMinor() == CMMsg.TYP_DAMAGE) && (msg.tool() instanceof Weapon) && (msg.tool() == naturalWeapon)) msg.setValue(msg.value() + naturalWeapon.basePhyStats().damage() + super.getXLEVELLevel(mob)); return true; }
public void executeMsg(final Environmental myHost, final CMMsg msg) { super.executeMsg(myHost, msg); if ((affected != null) && (affected instanceof Room) && (invoker() != null) && (invoker().location() != null) && (sourceRoom != null) && (!invoker().isInCombat()) && (invoker().location() == sourceRoom)) { if (invoker().location() == room) { if ((msg.sourceMinor() == CMMsg.TYP_SPEAK) && (msg.othersCode() == CMMsg.NO_EFFECT) && (msg.othersMessage() == null) && (msg.sourceMessage() != null) && (!msg.amISource(invoker())) && (!msg.amITarget(invoker())) && (!lastSaid.equals(msg.sourceMessage()))) { lastSaid = msg.sourceMessage(); if ((invoker().phyStats().level() + (getXLEVELLevel(invoker()) * 10)) > msg.source().phyStats().level()) invoker().tell(msg.source(), msg.target(), msg.tool(), msg.sourceMessage()); else invoker() .tell( msg.source(), null, null, "<S-NAME> said something, but you couldn't quite make it out."); } } else if ((msg.sourceMinor() == CMMsg.TYP_SPEAK) && (msg.othersMinor() == CMMsg.TYP_SPEAK) && (msg.othersMessage() != null) && (msg.sourceMessage() != null) && (!lastSaid.equals(msg.sourceMessage()))) { lastSaid = msg.sourceMessage(); if ((invoker().phyStats().level() + (getXLEVELLevel(invoker()) * 10)) > msg.source().phyStats().level()) invoker().tell(msg.source(), msg.target(), msg.tool(), msg.sourceMessage()); else invoker() .tell( msg.source(), null, null, "<S-NAME> said something, but you couldn't quite make it out."); } } else unInvoke(); }
public boolean okMessage(final Environmental myHost, final CMMsg msg) { if ((affected == null) || (!(affected instanceof MOB))) return true; MOB mob = (MOB) affected; // when this spell is on a MOBs Affected list, // it should consistantly prevent the mob // from trying to do ANYTHING except sleep if (msg.amISource(mob)) { switch (msg.sourceMinor()) { case CMMsg.TYP_ENTER: case CMMsg.TYP_ADVANCE: case CMMsg.TYP_LEAVE: case CMMsg.TYP_FLEE: mob.tell("You are frozen, and cant go anywhere."); return false; } } return super.okMessage(myHost, msg); }
public boolean okMessage(final Environmental myHost, final CMMsg msg) { if (affected == null) return super.okMessage(myHost, msg); if (affected instanceof MOB) { MOB mob = (MOB) affected; if ((msg.amITarget(mob)) && (!msg.amISource(mob)) && (mob.location() != msg.source().location()) && (msg.tool() != null) && (msg.tool() instanceof Ability) && (CMath.bset(((Ability) msg.tool()).flags(), Ability.FLAG_SUMMONING)) && (!mob.amDead())) { msg.source() .location() .showHappens( CMMsg.MSG_OK_VISUAL, "Magical energy fizzles and is absorbed into the air!"); return false; } } else if (affected instanceof Room) { Room R = (Room) affected; if ((msg.tool() != null) && (msg.tool() instanceof Ability) && (CMath.bset(((Ability) msg.tool()).flags(), Ability.FLAG_SUMMONING))) { Ability A = (Ability) msg.tool(); if (((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_CHANT) || ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_SPELL) || ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_PRAYER) || ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_SONG)) { if ((msg.source().location() != null) && (msg.source().location() != R)) msg.source() .location() .showHappens( CMMsg.MSG_OK_VISUAL, "Magical energy fizzles and is absorbed into the air!"); R.showHappens( CMMsg.MSG_OK_VISUAL, "Magical energy fizzles and is absorbed into the air!"); } return false; } } return super.okMessage(myHost, msg); }
public boolean okMessage(final Environmental myHost, final CMMsg msg) { if ((affected == null) || (!(affected instanceof MOB))) return true; MOB mob = (MOB) affected; // when this spell is on a MOBs Affected list, // it should consistantly prevent the mob // from trying to do ANYTHING except sleep if (msg.amISource(mob)) { if (msg.sourceMinor() == CMMsg.TYP_ADVANCE) { if (mob.location() .show( mob, null, CMMsg.MSG_OK_ACTION, "<S-NAME> struggle(s) against the repulsion field.")) { amountRemaining -= mob.charStats().getStat(CharStats.STAT_STRENGTH); if (amountRemaining < 0) unInvoke(); } return false; } } return super.okMessage(myHost, msg); }