@Override public boolean tick(Tickable ticking, int tickID) { super.tick(ticking, tickID); if ((canAct(ticking, tickID)) && (ticking instanceof MOB)) { if (DoneEquipping) return true; final MOB mob = (MOB) ticking; final Room thisRoom = mob.location(); if (thisRoom.numItems() == 0) return true; DoneEquipping = true; final Vector<Item> stuffIHad = new Vector<Item>(); for (int i = 0; i < mob.numItems(); i++) stuffIHad.addElement(mob.getItem(i)); mob.enqueCommand(new XVector<String>("GET", "ALL"), MUDCmdProcessor.METAFLAG_FORCED, 0); Item I = null; final Vector<Item> dropThisStuff = new Vector<Item>(); for (int i = 0; i < mob.numItems(); i++) { I = mob.getItem(i); if ((I != null) && (!stuffIHad.contains(I))) { if (I instanceof DeadBody) dropThisStuff.addElement(I); else if ((I.container() != null) && (I.container() instanceof DeadBody)) I.setContainer(null); } } for (int d = 0; d < dropThisStuff.size(); d++) mob.enqueCommand( new XVector<String>("DROP", "$" + dropThisStuff.elementAt(d).Name() + "$"), MUDCmdProcessor.METAFLAG_FORCED, 0); mob.enqueCommand(new XVector<String>("WEAR", "ALL"), MUDCmdProcessor.METAFLAG_FORCED, 0); } return true; }
@Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { if ((!auto) && (!(CMLib.flags().isGood(mob)))) { mob.tell(L("Your alignment has alienated you from your god.")); return false; } final List<String> V = new Vector<String>(); if (commands.size() > 0) { V.add((String) commands.elementAt(0)); commands.removeElementAt(0); } final MOB target = getTarget(mob, V, givenTarget); if (target == null) return false; if (commands.size() == 0) { if (mob.isMonster()) commands.addElement("FLEE"); else { if (V.size() > 0) mob.tell(L("Command @x1 to do what?", V.get(0))); return false; } } if (!target.charStats().getMyRace().racialCategory().equals("Equine")) { mob.tell(L("@x1 is not a horse!", 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, verbalSpeakCode(mob, target, auto), auto ? "" : L( "^S<S-NAME> command(s) <T-NAMESELF> to '@x1'.^?", CMParms.combine(commands, 0))); final CMMsg msg2 = CMClass.getMsg( mob, target, this, CMMsg.MASK_MALICIOUS | CMMsg.MASK_SOUND | CMMsg.TYP_MIND | (auto ? CMMsg.MASK_ALWAYS : 0), null); final CMMsg omsg = CMClass.getMsg(mob, target, null, CMMsg.MSG_ORDER, null); if ((mob.location().okMessage(mob, msg)) && ((mob.location().okMessage(mob, msg2))) && (mob.location().okMessage(mob, omsg))) { mob.location().send(mob, msg); if (msg.value() <= 0) { mob.location().send(mob, msg2); mob.location().send(mob, omsg); if ((msg2.value() <= 0) && (omsg.sourceMinor() == CMMsg.TYP_ORDER)) { invoker = mob; target.makePeace(); target.enqueCommand(commands, Command.METAFLAG_FORCED | Command.METAFLAG_ORDER, 0); } } } } else return maliciousFizzle( mob, target, L("<S-NAME> attempt(s) to command <T-NAMESELF>, but it definitely didn't work.")); // return whether it worked return success; }