@Override public String displayClassLevelOnly(MOB mob) { if (mob == null) return ""; if (displayClassLevel != null) return displayClassLevel; final int classLevel = getClassLevel(getCurrentClass()); String levelStr = null; if (classLevel >= mob.phyStats().level()) levelStr = "" + mob.phyStats().level(); else levelStr = classLevel + "/" + mob.phyStats().level(); return levelStr; }
@Override public boolean tick(Tickable ticking, int tickID) { if (!(affected instanceof MOB)) return super.tick(ticking, tickID); final MOB mob = (MOB) affected; if (tickID != Tickable.TICKID_MOB) return true; if (!proficiencyCheck(null, 0, false)) return true; if ((!mob.isInCombat()) && (CMLib.flags().isSleeping(mob))) { roundsHibernating++; final double man = ((mob.charStats().getStat(CharStats.STAT_INTELLIGENCE) + mob.charStats().getStat(CharStats.STAT_WISDOM))); mob.curState() .adjMana( (int) Math.round( (man * .1) + ((mob.phyStats().level() + (2.0 * super.getXLEVELLevel(invoker()))) / 2.0)), mob.maxState()); mob.curState().setHunger(oldState.getHunger()); mob.curState().setThirst(oldState.getThirst()); final double move = mob.charStats().getStat(CharStats.STAT_STRENGTH); mob.curState() .adjMovement( (int) Math.round( (move * .1) + ((mob.phyStats().level() + (2.0 * super.getXLEVELLevel(invoker()))) / 2.0)), mob.maxState()); if (!CMLib.flags().isGolem(mob)) { final double hp = mob.charStats().getStat(CharStats.STAT_CONSTITUTION); if (!CMLib.combat() .postHealing( mob, mob, this, CMMsg.MASK_ALWAYS | CMMsg.TYP_CAST_SPELL, (int) Math.round( (hp * .1) + ((mob.phyStats().level() + (2.0 * super.getXLEVELLevel(invoker()))) / 2.0)), null)) unInvoke(); } } else { unInvoke(); return false; } return super.tick(ticking, tickID); }
@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; }
public MOB victimHere(Room room, MOB mob) { if (room == null) return null; if (mob == null) return null; for (int i = 0; i < room.numInhabitants(); i++) { final MOB M = room.fetchInhabitant(i); if ((M != null) && (M != mob) && (!CMLib.flags().isEvil(M)) && (mob.mayIFight(M)) && (M.phyStats().level() < (mob.phyStats().level() + 5))) return M; } return null; }
@Override public String displayClassLevel(MOB mob, boolean shortForm) { if (displayClassLevel != null) { if (shortForm) return displayClassName() + " " + displayClassLevel; return "level " + displayClassLevel + " " + displayClassName; } if (mob == null) return ""; final int classLevel = getClassLevel(getCurrentClass()); String levelStr = null; if (classLevel >= mob.phyStats().level()) levelStr = "" + mob.phyStats().level(); else levelStr = classLevel + "/" + mob.phyStats().level(); if (shortForm) return displayClassName() + " " + levelStr; return "level " + levelStr + " " + displayClassName(); }
@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 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 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 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; }
protected StringBuilder getAbilities( MOB viewerM, MOB ableM, Vector ofTypes, int mask, boolean addQualLine, int maxLevel) { final int COL_LEN1 = ListingLibrary.ColFixer.fixColWidth(3.0, viewerM); final int COL_LEN2 = ListingLibrary.ColFixer.fixColWidth(18.0, viewerM); final int COL_LEN3 = ListingLibrary.ColFixer.fixColWidth(19.0, viewerM); int highestLevel = 0; final int lowestLevel = ableM.phyStats().level() + 1; final StringBuilder msg = new StringBuilder(""); for (final Enumeration<Ability> a = ableM.allAbilities(); a.hasMoreElements(); ) { final Ability A = a.nextElement(); int level = CMLib.ableMapper().qualifyingLevel(ableM, A); if (level < 0) level = 0; if ((A != null) && (level > highestLevel) && (level < lowestLevel) && (ofTypes.contains(Integer.valueOf(A.classificationCode() & mask)))) highestLevel = level; } if ((maxLevel >= 0) && (maxLevel < highestLevel)) highestLevel = maxLevel; for (int l = 0; l <= highestLevel; l++) { final StringBuilder thisLine = new StringBuilder(""); int col = 0; for (final Enumeration<Ability> a = ableM.allAbilities(); a.hasMoreElements(); ) { final Ability A = a.nextElement(); int level = CMLib.ableMapper().qualifyingLevel(ableM, A); if (level < 0) level = 0; if ((A != null) && (level == l) && (ofTypes.contains(Integer.valueOf(A.classificationCode() & mask)))) { if (thisLine.length() == 0) thisLine.append("\n\rLevel ^!" + l + "^?:\n\r"); if ((++col) > 3) { thisLine.append("\n\r"); col = 1; } thisLine.append( "^N[^H" + CMStrings.padRight(Integer.toString(A.proficiency()), COL_LEN1) + "%^?]^N" + " " // +(A.isAutoInvoked()?"^H.^N":" ") + CMStrings.padRight( "^<HELP^>" + A.name() + "^</HELP^>", (col == 3) ? COL_LEN2 : COL_LEN3)); } } if (thisLine.length() > 0) msg.append(thisLine); } if (msg.length() == 0) msg.append(L("^!None!^?")); else if (addQualLine) msg.append( L( "\n\r\n\rUse QUALIFY to see additional skills you can GAIN.")); // ^H.^N = // passive/auto-invoked.")); return msg; }
@Override public boolean invoke( MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final Item target = getTarget(mob, null, givenTarget, commands, Wearable.FILTER_UNWORNONLY); if (target == null) return false; if (!(target instanceof Armor)) { mob.tell(L("@x1 cannot be refitted.", target.name(mob))); return false; } if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; final boolean success = proficiencyCheck( mob, (((mob.phyStats().level() + (2 * getXLEVELLevel(mob))) - target.phyStats().level()) * 5), auto); if (success) { final CMMsg msg = CMClass.getMsg( mob, target, this, verbalCastCode(mob, target, auto), (auto ? "<T-NAME> begins to shimmer!" : "^S<S-NAME> incant(s) at <T-NAMESELF>!^?")); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); if (target.phyStats().height() == 0) mob.tell(L("Nothing happens to @x1.", target.name(mob))); else { mob.location() .show( mob, target, CMMsg.MSG_OK_VISUAL, L("<T-NAME> begin(s) to magically resize itself!")); target.basePhyStats().setHeight(0); } target.recoverPhyStats(); mob.location().recoverRoomStats(); } } else beneficialWordsFizzle( mob, target, L("<S-NAME> incant(s) at <T-NAMESELF>, but nothing happens.")); // 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; final boolean success = proficiencyCheck(mob, 0, auto); if (success && (target.phyStats().level() < ((mob.phyStats().level() + super.getXLEVELLevel(mob)) / 2))) { final CMMsg msg = CMClass.getMsg( mob, target, this, verbalCastCode(mob, target, auto) | CMMsg.MASK_MALICIOUS, L("^S<S-NAME> @x1 for <T-NAME> to die.^?", prayForWord(mob))); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); CMLib.combat().postDeath(target, target, null); DeadBody body = null; for (Enumeration<Item> i = mob.location().items(); i.hasMoreElements(); ) { final Item I = i.nextElement(); if ((I instanceof DeadBody) && (((DeadBody) I).getMobName().equals(target.Name()))) body = (DeadBody) I; } if (body == null) mob.tell(L("The death did not appear to create a body!")); else beneficialAffect(mob, body, asLevel, 0); } } else return maliciousFizzle( mob, target, L("^S<S-NAME> @x1 <T-NAME> to die, but nothing happens.^?", prayForWord(mob))); // return whether it worked return success; }
public MOB getInvokerMOB(Environmental source, Environmental target) { MOB mob = getBestInvokerMOB(affected); if (mob == null) mob = getBestInvokerMOB(source); if (mob == null) mob = getBestInvokerMOB(target); if (mob == null) mob = invokerMOB; if (mob == null) { Room R = CMLib.map().roomLocation(target); if (R == null) R = CMLib.map().roomLocation(target); if (R == null) R = CMLib.map().getRandomRoom(); mob = CMLib.map().getFactoryMOB(R); mob.setName(L("invoker")); mob.basePhyStats().setLevel(affected.phyStats().level()); mob.phyStats().setLevel(affected.phyStats().level()); } invokerMOB = mob; return invokerMOB; }
public int getUndeadLevel(final MOB mob, double baseLvl, double corpseLevel) { final ExpertiseLibrary exLib = CMLib.expertises(); final double deathLoreExpertiseLevel = super.getXLEVELLevel(mob); final double appropriateLoreExpertiseLevel = super.getX1Level(mob); final double charLevel = mob.phyStats().level(); final double maxDeathLoreExpertiseLevel = exLib.getHighestListableStageBySkill(mob, ID(), ExpertiseLibrary.Flag.LEVEL); final double maxApproLoreExpertiseLevel = exLib.getHighestListableStageBySkill(mob, ID(), ExpertiseLibrary.Flag.X1); double lvl = (charLevel * appropriateLoreExpertiseLevel / maxApproLoreExpertiseLevel) - (baseLvl + 4 + (2 * maxDeathLoreExpertiseLevel)); if (lvl < 0.0) lvl = 0.0; lvl += baseLvl + (2 * deathLoreExpertiseLevel); if (lvl > corpseLevel) lvl = corpseLevel; return (int) Math.round(lvl); }
@Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { final Item target = getTarget(mob, null, givenTarget, commands, Wearable.FILTER_ANY); if (target == null) return false; if (!target.subjectToWearAndTear()) { mob.tell(L("@x1 cannot be mended.", target.name(mob))); return false; } if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; final boolean success = proficiencyCheck( mob, (((mob.phyStats().level() + (2 * getXLEVELLevel(mob))) - target.phyStats().level()) * 5), auto); if (success) { final CMMsg msg = CMClass.getMsg( mob, target, this, verbalCastCode(mob, target, auto), (auto ? "<T-NAME> begins to shimmer!" : "^S<S-NAME> incant(s) at <T-NAMESELF>!^?")); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); if (target.usesRemaining() >= 100) mob.tell(L("Nothing happens to @x1.", target.name(mob))); else { mob.location() .show(mob, target, CMMsg.MSG_OK_VISUAL, L("<T-NAME> begin(s) to glow and mend!")); target.setUsesRemaining(100); } target.recoverPhyStats(); mob.location().recoverRoomStats(); } } else beneficialWordsFizzle( mob, target, L("<S-NAME> incant(s) at <T-NAMESELF>, but nothing happens.")); // return whether it worked return success; }
public static java.util.List<Ability> returnOffensiveAffects(Physical fromMe) { final MOB newMOB = CMClass.getFactoryMOB(); newMOB.setLocation(CMLib.map().roomLocation(fromMe)); final List<Ability> offenders = new Vector<Ability>(); for (int a = 0; a < fromMe.numEffects(); a++) // personal { final Ability A = fromMe.fetchEffect(a); if ((A != null) && (A.canBeUninvoked())) { try { newMOB.recoverPhyStats(); A.affectPhyStats(newMOB, newMOB.phyStats()); if (CMLib.flags().isInvisible(newMOB) || CMLib.flags().isHidden(newMOB)) offenders.add(A); } catch (final Exception e) { } } } newMOB.destroy(); return offenders; }
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if (!(affected instanceof MOB)) return true; final MOB mob = (MOB) affected; if ((msg.amITarget(mob)) && (CMath.bset(msg.targetMajor(), CMMsg.MASK_MALICIOUS)) && (msg.tool() instanceof Ability) && (!mob.amDead())) { final Ability A = (Ability) msg.tool(); if (CMath.bset(A.flags(), Ability.FLAG_PARALYZING)) { msg.addTrailerMsg( CMClass.getMsg( mob, null, CMMsg.MSG_OK_VISUAL, L("The uninhibiting barrier around <S-NAME> repels the @x1.", A.name()))); return false; } final MOB newMOB = CMClass.getFactoryMOB(); final CMMsg msg2 = CMClass.getMsg(newMOB, null, null, CMMsg.MSG_SIT, null); newMOB.recoverPhyStats(); try { A.affectPhyStats(newMOB, newMOB.phyStats()); if ((!CMLib.flags().aliveAwakeMobileUnbound(newMOB, true)) || (CMath.bset(A.flags(), Ability.FLAG_PARALYZING)) || (!A.okMessage(newMOB, msg2))) { msg.addTrailerMsg( CMClass.getMsg( mob, null, CMMsg.MSG_OK_VISUAL, L("The uninhibiting barrier around <S-NAME> repels the @x1.", A.name()))); newMOB.destroy(); return false; } } catch (final Exception e) { } newMOB.destroy(); } return true; }
@Override public void spring(MOB mob) { final Room room = mob.location(); if (room != null) { final Set<MOB> friendlySet = new HashSet<MOB>(); if (invoker() != null) invoker().getGroupMembers(friendlySet); room.show( mob, affected, CMMsg.MSG_OK_ACTION, L("<T-NAME> explodes, spraying clumps of stomach acid everywhere!")); for (final Enumeration<MOB> m = room.inhabitants(); m.hasMoreElements(); ) { MOB M = m.nextElement(); if ((M != null) && (!friendlySet.contains(M))) { final MOB invoker = (invoker() != null) ? invoker() : M; final int damage = CMLib.dice().roll(4, 5 + invoker.phyStats().level(), 0); CMLib.combat() .postDamage( invoker, M, this, damage, CMMsg.MASK_MALICIOUS | CMMsg.MASK_ALWAYS | CMMsg.TYP_ACID, Weapon.TYPE_MELTING, L("The acid clumps <DAMAGE> <T-NAME>!")); if ((!M.isInCombat()) && (M.isMonster()) && (M != invoker) && (M.location() == invoker.location()) && (M.location().isInhabitant(invoker)) && (CMLib.flags().canBeSeenBy(invoker, M))) CMLib.combat().postAttack(M, invoker, M.fetchWieldedItem()); } } } Physical affected = this.affected; unInvoke(); if (affected instanceof Item) ((Item) affected).destroy(); }
@Override public boolean invoke( MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if (commands.size() < 2) { if (mob.isMonster() && (commands.size() == 1)) { final String parm = correctItem(mob); if (parm != null) commands.add(parm); } if (commands.size() < 2) { mob.tell(L("You must specify a target, and what item to swap on the target!")); return false; } } final Item I = mob.findItem(null, commands.get(commands.size() - 1)); if ((I == null) || (!CMLib.flags().canBeSeenBy(I, mob))) { mob.tell(L("You don't seem to have '@x1'.", (commands.get(commands.size() - 1)))); return false; } if (((I instanceof Armor) && (I.basePhyStats().armor() > 1)) || ((I instanceof Weapon) && (I.basePhyStats().damage() > 1))) { mob.tell(L("@x1 is not buffoonish enough!", I.name(mob))); return false; } commands.remove(commands.size() - 1); final MOB target = getTarget(mob, commands, givenTarget); if (target == null) return false; final Item targetItem = targetItem(target); if (targetItem == null) { if (!freePosition(target)) { mob.tell(L("@x1 has no free wearing positions!", target.name(mob))); return false; } } if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; int levelDiff = target.phyStats().level() - mob.phyStats().level(); final boolean success = proficiencyCheck(mob, 0, auto); if (levelDiff > 0) levelDiff = -(levelDiff * ((!CMLib.flags().canBeSeenBy(mob, target)) ? 5 : 15)); else levelDiff = -(levelDiff * ((!CMLib.flags().canBeSeenBy(mob, target)) ? 1 : 2)); if (success) { final CMMsg msg = CMClass.getMsg( mob, target, this, (CMMsg.MSG_NOISYMOVEMENT | CMMsg.MASK_DELICATE | CMMsg.MASK_MALICIOUS) | (auto ? CMMsg.MASK_ALWAYS : 0), auto ? "" : L("<S-NAME> do(es) buffoonery to <T-NAMESELF>.")); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); long position = -1; if (targetItem != null) { position = targetItem.rawWornCode(); targetItem.unWear(); } else { final Vector<Long> free = getFreeWearingPositions(target); if (free.size() < 1) { mob.tell(L("@x1 has no free wearing positions!", target.name(mob))); return false; } if ((free.contains(Long.valueOf(Wearable.WORN_WIELD))) && ((I instanceof Weapon) || (!(I instanceof Armor)))) position = Wearable.WORN_WIELD; else position = free.elementAt(CMLib.dice().roll(1, free.size(), -1)).longValue(); } if (position >= 0) { I.unWear(); target.moveItemTo(I); I.wearAt(position); } } } else return beneficialVisualFizzle( mob, target, L("<S-NAME> attempt(s) buffoonery on <T-NAMESELF>, but fail(s).")); return success; }
public StringBuffer deviations(MOB mob, String rest) { final Vector<String> V = CMParms.parse(rest); if ((V.size() == 0) || ((!V.get(0).equalsIgnoreCase("mobs")) && (!V.get(0).equalsIgnoreCase("items")) && (!V.get(0).equalsIgnoreCase("both")))) return new StringBuffer( "You must specify whether you want deviations on MOBS, ITEMS, or BOTH."); final String type = V.get(0).toLowerCase(); if (V.size() == 1) return new StringBuffer( "You must also specify a mob or item name, or the word room, or the word area."); final Room mobR = mob.location(); Faction useFaction = null; for (final Enumeration<Faction> e = CMLib.factions().factions(); e.hasMoreElements(); ) { final Faction F = e.nextElement(); if (F.showInSpecialReported()) useFaction = F; } final String where = V.get(1).toLowerCase(); final Environmental E = mobR.fetchFromMOBRoomFavorsItems(mob, null, where, Wearable.FILTER_ANY); final Vector<Environmental> check = new Vector<Environmental>(); if (where.equalsIgnoreCase("room")) fillCheckDeviations(mobR, type, check); else if (where.equalsIgnoreCase("area")) { for (final Enumeration<Room> r = mobR.getArea().getFilledCompleteMap(); r.hasMoreElements(); ) { final Room R = r.nextElement(); fillCheckDeviations(R, type, check); } } else if (where.equalsIgnoreCase("world")) { for (final Enumeration<Room> r = CMLib.map().roomsFilled(); r.hasMoreElements(); ) { final Room R = r.nextElement(); fillCheckDeviations(R, type, check); } } else if (E == null) return new StringBuffer("'" + where + "' is an unknown item or mob name."); else if (type.equals("items") && (!(E instanceof Weapon)) && (!(E instanceof Armor))) return new StringBuffer("'" + where + "' is not a weapon or armor item."); else if (type.equals("mobs") && (!(E instanceof MOB))) return new StringBuffer("'" + where + "' is not a MOB."); else if ((!(E instanceof Weapon)) && (!(E instanceof Armor)) && (!(E instanceof MOB))) return new StringBuffer("'" + where + "' is not a MOB, or Weapon, or Item."); else check.add(E); final StringBuffer str = new StringBuffer(""); str.append(L("Deviations Report:\n\r")); final StringBuffer itemResults = new StringBuffer(); final StringBuffer mobResults = new StringBuffer(); for (int c = 0; c < check.size(); c++) { if (check.get(c) instanceof Item) { final Item I = (Item) check.get(c); Weapon W = null; if (I instanceof Weapon) W = (Weapon) I; final Map<String, String> vals = CMLib.itemBuilder() .timsItemAdjustments( I, I.phyStats().level(), I.material(), I.rawLogicalAnd() ? 2 : 1, (W == null) ? 0 : W.weaponClassification(), I.maxRange(), I.rawProperLocationBitmap()); itemResults.append(CMStrings.padRight(I.name(), 20) + " "); itemResults.append(CMStrings.padRight(I.ID(), 10) + " "); itemResults.append(CMStrings.padRight("" + I.phyStats().level(), 4) + " "); itemResults.append( CMStrings.padRight( "" + getDeviation(I.basePhyStats().attackAdjustment(), vals, "ATTACK"), 5) + " "); itemResults.append( CMStrings.padRight("" + getDeviation(I.basePhyStats().damage(), vals, "DAMAGE"), 5) + " "); itemResults.append( CMStrings.padRight("" + getDeviation(I.basePhyStats().damage(), vals, "ARMOR"), 5) + " "); itemResults.append( CMStrings.padRight("" + getDeviation(I.baseGoldValue(), vals, "VALUE"), 5) + " "); itemResults.append( CMStrings.padRight( "" + ((I.phyStats().rejuv() == PhyStats.NO_REJUV) ? " MAX" : "" + I.phyStats().rejuv()), 5) + " "); if (I instanceof Weapon) itemResults.append(CMStrings.padRight("" + I.basePhyStats().weight(), 4)); else itemResults.append( CMStrings.padRight("" + getDeviation(I.basePhyStats().weight(), vals, "WEIGHT"), 4) + " "); if (I instanceof Armor) itemResults.append(CMStrings.padRight("" + ((Armor) I).phyStats().height(), 4)); else itemResults.append(CMStrings.padRight(" - ", 4) + " "); itemResults.append("\n\r"); } else { final MOB M = (MOB) check.get(c); mobResults.append(CMStrings.padRight(M.name(), 20) + " "); mobResults.append(CMStrings.padRight("" + M.phyStats().level(), 4) + " "); mobResults.append( CMStrings.padRight( "" + getDeviation( M.basePhyStats().attackAdjustment(), CMLib.leveler().getLevelAttack(M)), 5) + " "); mobResults.append( CMStrings.padRight( "" + getDeviation( M.basePhyStats().damage(), (int) Math.round( CMath.div( CMLib.leveler().getLevelMOBDamage(M), M.basePhyStats().speed()))), 5) + " "); mobResults.append( CMStrings.padRight( "" + getDeviation( M.basePhyStats().armor(), CMLib.leveler().getLevelMOBArmor(M)), 5) + " "); mobResults.append( CMStrings.padRight( "" + getDeviation( M.basePhyStats().speed(), CMLib.leveler().getLevelMOBSpeed(M)), 5) + " "); mobResults.append( CMStrings.padRight( "" + ((M.phyStats().rejuv() == PhyStats.NO_REJUV) ? " MAX" : "" + M.phyStats().rejuv()), 5) + " "); if (useFaction != null) mobResults.append( CMStrings.padRight( "" + (M.fetchFaction(useFaction.factionID()) == Integer.MAX_VALUE ? "N/A" : "" + M.fetchFaction(useFaction.factionID())), 7) + " "); double value = CMLib.beanCounter().getTotalAbsoluteNativeValue(M); double[] range = CMLib.leveler().getLevelMoneyRange(M); if (value < range[0]) mobResults.append(CMStrings.padRight("" + getDeviation(value, range[0]), 5) + " "); else if (value > range[1]) mobResults.append(CMStrings.padRight("" + getDeviation(value, range[1]), 5) + " "); else mobResults.append(CMStrings.padRight("0%", 5) + " "); int reallyWornCount = 0; for (int j = 0; j < M.numItems(); j++) { final Item Iw = M.getItem(j); if (!(Iw.amWearingAt(Wearable.IN_INVENTORY))) reallyWornCount++; } mobResults.append(CMStrings.padRight("" + reallyWornCount, 5) + " "); mobResults.append("\n\r"); } } if (itemResults.length() > 0) str.append(itemHeader() + itemResults.toString()); if (mobResults.length() > 0) str.append(mobHeader(useFaction) + mobResults.toString()); return str; }
@Override public boolean invoke( MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if (commands.size() < 1) { mob.tell(L("Pay Off Whom?")); return false; } final MOB target = this.getTarget(mob, commands, givenTarget); if (target == null) return false; if ((target.charStats().getStat(CharStats.STAT_INTELLIGENCE) < 3) || (!target.isMonster())) { mob.tell(L("You can't pay off @x1.", target.name(mob))); return false; } final LegalBehavior B = CMLib.law().getLegalBehavior(mob.location()); final Area A = (B == null) ? null : CMLib.law().getLegalObject(mob.location()); if ((A == null) || (B == null)) { mob.tell(L("There's no point in paying off @x1.", target.name(mob))); return false; } boolean isJudge = B.isJudge(A, target); if ((!isJudge) && (!B.isAnyOfficer(A, target))) { mob.tell(L("Paying off @x1 won't help you.", target.name(mob))); return false; } final List<LegalWarrant> warrants = B.getWarrantsOf(A, mob); if ((warrants == null) || (warrants.size() == 0)) { mob.tell(L("Pay off @x1? Why? You aren't in any trouble.", target.name(mob))); return false; } if (target.fetchEffect(ID()) != null) { mob.tell(L("@x1 is already paid off.", target.name(mob))); return false; } if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; double amountRequired = CMLib.beanCounter().getTotalAbsoluteNativeValue(target) + ((double) ((100l - ((mob.charStats().getStat(CharStats.STAT_CHARISMA) + (2l * getXLEVELLevel(mob))) * 2))) * target.phyStats().level()); if (isJudge) amountRequired *= 2; final String currency = CMLib.beanCounter().getCurrency(target); boolean success = proficiencyCheck(mob, 0, auto); if ((!success) || (CMLib.beanCounter().getTotalAbsoluteValue(mob, currency) < amountRequired)) { final CMMsg msg = CMClass.getMsg( mob, target, this, CMMsg.MSG_SPEAK, L( "^T<S-NAME> attempt(s) to pay off <T-NAMESELF> to '@x1', but no deal is reached.^?", CMParms.combine(commands, 0))); if (mob.location().okMessage(mob, msg)) mob.location().send(mob, msg); if (CMLib.beanCounter().getTotalAbsoluteValue(mob, currency) < amountRequired) { final String costWords = CMLib.beanCounter().nameCurrencyShort(currency, amountRequired); mob.tell(L("@x1 requires @x2 to do this.", target.charStats().HeShe(), costWords)); } success = false; } else { final String costWords = CMLib.beanCounter().nameCurrencyShort(target, amountRequired); final CMMsg msg = CMClass.getMsg( mob, target, this, CMMsg.MSG_THIEF_ACT, L("^T<S-NAME> pay(s) off <T-NAMESELF>.^?", CMParms.combine(commands, 0), costWords)); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); CMLib.beanCounter().subtractMoney(mob, currency, amountRequired); CMLib.beanCounter().addMoney(mob, currency, amountRequired); if (isJudge) { for (LegalWarrant W : warrants) { if (W.punishment() > 0) W.setPunishment(W.punishment() - 1); } } else { clearWarrants(target, mob, mob.location(), A, B); super.beneficialAffect(mob, target, asLevel, 0); } } target.recoverPhyStats(); } return success; }
@Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { final MOB mobTarget = getTarget(mob, commands, givenTarget, true, false); Item target = getPossibility(mobTarget); if (target == null) target = getTarget(mob, mob.location(), givenTarget, commands, Wearable.FILTER_ANY); if (target == null) return false; if (((target.material() & RawMaterial.MATERIAL_MASK) != RawMaterial.MATERIAL_WOODEN) || (!target.subjectToWearAndTear())) { mob.tell(L("That can't be warped.")); 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> starts warping!") : L("^S<S-NAME> chant(s) at <T-NAMESELF>.^?")); final CMMsg msg2 = CMClass.getMsg(mob, mobTarget, this, verbalCastCode(mob, mobTarget, auto), null); if ((mob.location().okMessage(mob, msg)) && ((mobTarget == null) || (mob.location().okMessage(mob, msg2)))) { mob.location().send(mob, msg); if (mobTarget != null) mob.location().send(mob, msg2); if (msg.value() <= 0) { int damage = 100 + (mob.phyStats().level() + (2 * super.getXLEVELLevel(mob))) - target.phyStats().level(); if (CMLib.flags().isABonusItems(target)) damage = (int) Math.round(CMath.div(damage, 2.0)); target.setUsesRemaining(target.usesRemaining() - damage); if (mobTarget == null) mob.location() .show(mob, target, CMMsg.MSG_OK_VISUAL, L("<T-NAME> begin(s) to twist and warp!")); else mob.location() .show( mobTarget, target, CMMsg.MSG_OK_VISUAL, L("<T-NAME>, possessed by <S-NAME>, twists and warps!")); if (target.usesRemaining() > 0) target.recoverPhyStats(); else { target.setUsesRemaining(100); mob.location().show(mob, target, CMMsg.MSG_OK_VISUAL, L("<T-NAME> is destroyed!")); target.unWear(); target.destroy(); mob.location().recoverRoomStats(); } } } } else return maliciousFizzle(mob, null, L("<S-NAME> chant(s), but nothing happens.")); // 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) return true; if (affected == null) return false; if (--fallTickDown > 0) return true; fallTickDown = 1; int direction = Directions.DOWN; String addStr = L("down"); if (reversed()) { direction = Directions.UP; addStr = L("upwards"); } if (affected instanceof MOB) { final MOB mob = (MOB) affected; if (mob == null) return false; if (mob.location() == null) return false; if (CMLib.flags().isInFlight(mob)) { damageToTake = 0; unInvoke(); return false; } else if (!canFallFrom(mob.location(), direction)) return stopFalling(mob); else { if (mob.phyStats().weight() < 1) { mob.tell(L("\n\r\n\rYou are floating gently @x1.\n\r\n\r", addStr)); } else { mob.tell(L("\n\r\n\rYOU ARE FALLING @x1!!\n\r\n\r", addStr.toUpperCase())); int damage = CMLib.dice() .roll( 1, (int) Math.round( CMath.mul( CMath.mul(mob.maxState().getHitPoints(), 0.1), CMath.div(mob.baseWeight(), 150.0))), 0); if (damage > (mob.maxState().getHitPoints() / 3)) damage = (mob.maxState().getHitPoints() / 3); damageToTake = reversed() ? damage : (damageToTake + damage); } temporarilyDisable = true; CMLib.tracking().walk(mob, direction, false, false); temporarilyDisable = false; if (!canFallFrom(mob.location(), direction)) return stopFalling(mob); return true; } } else if (affected instanceof Item) { final Item item = (Item) affected; if ((room == null) && (item.owner() != null) && (item.owner() instanceof Room)) room = (Room) item.owner(); if ((room == null) || ((room != null) && (!room.isContent(item))) || (!CMLib.flags().isGettable(item)) || (item.container() != null) || (CMLib.flags().isInFlight(item.ultimateContainer(null))) || (room.getRoomInDir(direction) == null)) { unInvoke(); return false; } if (room.numItems() > 100) { fallTickDown = CMLib.dice().roll(1, room.numItems() / 50, 0); if ((--fallTickDown) > 0) return true; } final Room nextRoom = room.getRoomInDir(direction); if (canFallFrom(room, direction)) { room.show(invoker, null, item, CMMsg.MSG_OK_ACTION, L("<O-NAME> falls @x1.", addStr)); nextRoom.moveItemTo(item, ItemPossessor.Expire.Player_Drop); room = nextRoom; nextRoom.show( invoker, null, item, CMMsg.MSG_OK_ACTION, L("<O-NAME> falls in from @x1.", (reversed() ? "below" : "above"))); return true; } if (reversed()) return true; unInvoke(); return false; } return false; }
@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 ((mob.getWorshipCharID().length() == 0) || (CMLib.map().getDeity(mob.getWorshipCharID()) == null)) { if (!auto) mob.tell(L("You must worship a god to use this prayer.")); return false; } final Deity D = CMLib.map().getDeity(mob.getWorshipCharID()); if ((target.getWorshipCharID().length() > 0) && (CMLib.map().getDeity(target.getWorshipCharID()) != null)) { if (!auto) mob.tell( L( "@x1 worships @x2, and may not be converted with this prayer.", target.name(mob), target.getWorshipCharID())); return false; } if ((CMLib.flags().isAnimalIntelligence(target) || CMLib.flags().isGolem(target) || (D == null))) { if (!auto) mob.tell(L("@x1 can not be converted with this prayer.", target.name(mob))); return false; } if (!auto) { if (convertStack.contains(target)) { final Long L = (Long) convertStack.elementAt(convertStack.indexOf(target), 2); if ((System.currentTimeMillis() - L.longValue()) > CMProps.getMillisPerMudHour() * 5) convertStack.removeElement(target); } if (convertStack.contains(target)) { mob.tell(L("@x1 must wait to be undeniably faithful again.", target.name(mob))); return false; } } if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; int levelDiff = target.phyStats().level() - (mob.phyStats().level() + (2 * getXLEVELLevel(mob))); if (levelDiff < 0) levelDiff = 0; final boolean success = proficiencyCheck(mob, -(levelDiff * 25), auto); int type = verbalCastCode(mob, target, auto); int mal = CMMsg.MASK_MALICIOUS; if (auto) { type = CMath.unsetb(type, CMMsg.MASK_MALICIOUS); mal = 0; } if (success) { final CMMsg msg = CMClass.getMsg( mob, target, this, type, auto ? "" : L("^S<S-NAME> @x1 for <T-NAMESELF> to BELIEVE!^?", prayWord(mob))); final CMMsg msg2 = CMClass.getMsg(target, D, this, CMMsg.MSG_SERVE, L("<S-NAME> BELIEVE(S) !!!")); final CMMsg msg3 = CMClass.getMsg( mob, target, this, CMMsg.MSK_CAST_VERBAL | mal | CMMsg.TYP_MIND | (auto ? CMMsg.MASK_ALWAYS : 0), null); if ((mob.location().okMessage(mob, msg)) && (mob.location().okMessage(mob, msg3)) && (mob.location().okMessage(mob, msg2))) { mob.location().send(mob, msg); mob.location().send(mob, msg3); if ((msg.value() <= 0) && (msg3.value() <= 0)) { target.location().send(target, msg2); target.setWorshipCharID(godName); if (mob != target) CMLib.leveler().postExperience(mob, target, null, 25, false); godName = mob.getWorshipCharID(); beneficialAffect(mob, target, asLevel, CMProps.getIntVar(CMProps.Int.TICKSPERMUDMONTH)); convertStack.addElement(target, Long.valueOf(System.currentTimeMillis())); } } } else beneficialWordsFizzle( mob, target, auto ? "" : L("<S-NAME> @x1 for <T-NAMESELF>, but nothing happens.", prayWord(mob))); // 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; if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; int levelDiff = target.phyStats().level() - (mob.phyStats().level() + (2 * getXLEVELLevel(mob))); if (levelDiff < 0) levelDiff = 0; final boolean success = proficiencyCheck(mob, -(levelDiff * 25), auto); Item Bread = null; Item BreadContainer = null; for (int i = 0; i < target.numItems(); i++) { final Item I = target.getItem(i); if ((I != null) && (I instanceof Food)) { if (I.container() != null) { Bread = I; BreadContainer = I.container(); } else { Bread = I; BreadContainer = null; break; } } } if ((Bread != null) && (BreadContainer != null)) CMLib.commands().postGet(target, BreadContainer, Bread, false); if (Bread == null) { final ShopKeeper SK = CMLib.coffeeShops().getShopKeeper(target); if (SK != null) { for (final Iterator<Environmental> i = SK.getShop().getStoreInventory(); i.hasNext(); ) { final Environmental E2 = i.next(); if ((E2 != null) && (E2 instanceof Food)) { Bread = (Item) E2.copyOf(); target.addItem(Bread); break; } } } } if ((success) && (Bread != null)) { CMMsg msg = CMClass.getMsg( mob, target, this, verbalCastCode(mob, target, auto), L( "^S<S-NAME> @x1 for <T-NAMESELF> to provide <S-HIS-HER> daily bread!^?", prayWord(mob))); final CMMsg msg2 = CMClass.getMsg( mob, target, this, CMMsg.MSK_CAST_MALICIOUS_VERBAL | CMMsg.TYP_MIND | (auto ? CMMsg.MASK_ALWAYS : 0), 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)) { msg = CMClass.getMsg( target, mob, Bread, CMMsg.MSG_GIVE, L("<S-NAME> gladly donate(s) <O-NAME> to <T-NAMESELF>.")); if (mob.location().okMessage(mob, msg)) mob.location().send(mob, msg); } } } else maliciousFizzle( mob, target, auto ? "" : L( "<S-NAME> @x1 for <T-NAMESELF> to provide <S-HIS-HER> daily bread, but nothing happens.", prayWord(mob))); // return whether it worked return success; }
@Override public boolean invoke( MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target = super.getTarget(mob, commands, givenTarget); if (target == null) return false; final Race R = target.charStats().getMyRace(); if (R.bodyMask()[Race.BODY_HEAD] <= 0) { mob.tell(L("@x1 has no head!", target.name(mob))); return false; } LegalBehavior B = null; if (mob.location() != null) B = CMLib.law().getLegalBehavior(mob.location()); List<LegalWarrant> warrants = new Vector<LegalWarrant>(); if (B != null) warrants = B.getWarrantsOf(CMLib.law().getLegalObject(mob.location()), target); if ((warrants.size() == 0) && (!CMSecurity.isAllowed(mob, mob.location(), CMSecurity.SecFlag.ABOVELAW))) { mob.tell(L("You are not allowed to behead @x1 at this time.", target.Name())); return false; } final Item w = mob.fetchWieldedItem(); Weapon ww = null; if ((w == null) || (!(w instanceof Weapon))) { mob.tell(L("You cannot behead without a weapon!")); return false; } ww = (Weapon) w; if ((!auto) && (!CMSecurity.isASysOp(mob))) { if (ww.weaponDamageType() != Weapon.TYPE_SLASHING) { mob.tell(L("You cannot behead with a @x1!", ww.name())); return false; } if (mob.isInCombat() && (mob.rangeToTarget() > 0)) { mob.tell(L("You are too far away to try that!")); return false; } if (!CMLib.flags().isBoundOrHeld(target)) { mob.tell(L("@x1 is not bound and would resist.", target.charStats().HeShe())); return false; } } if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; int levelDiff = target.phyStats().level() - (mob.phyStats().level() + (2 * getXLEVELLevel(mob))); if (levelDiff > 0) levelDiff = levelDiff * 3; else levelDiff = 0; final boolean hit = (auto) || CMLib.combat().rollToHit(mob, target); boolean success = proficiencyCheck(mob, 0, auto) && (hit); if (success) { final CMMsg msg = CMClass.getMsg( mob, target, this, CMMsg.MASK_MALICIOUS | CMMsg.MASK_MOVE | CMMsg.MASK_SOUND | CMMsg.TYP_JUSTICE | (auto ? CMMsg.MASK_ALWAYS : 0), null); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); target.curState().setHitPoints(1); final Ability A2 = target.fetchEffect("Injury"); if (A2 != null) A2.setMiscText(mob.Name() + "/head"); CMLib.combat() .postDamage( mob, target, ww, Integer.MAX_VALUE / 2, CMMsg.MSG_WEAPONATTACK, ww.weaponClassification(), auto ? "" : L( "^F^<FIGHT^><S-NAME> rear(s) back and behead(s) <T-NAME>!^</FIGHT^>^?@x1", CMLib.protocol().msp("decap.wav", 30))); mob.location().recoverRoomStats(); final Item limb = CMClass.getItem("GenLimb"); limb.setName(L("@x1`s head", target.Name())); limb.basePhyStats().setAbility(1); limb.setDisplayText(L("the bloody head of @x1 is sitting here.", target.Name())); limb.setSecretIdentity(target.name() + "`s bloody head."); int material = RawMaterial.RESOURCE_MEAT; for (int r = 0; r < R.myResources().size(); r++) { final Item I = R.myResources().get(r); final int mat = I.material() & RawMaterial.MATERIAL_MASK; if (((mat == RawMaterial.MATERIAL_FLESH)) || (r == R.myResources().size() - 1)) { material = I.material(); break; } } limb.setMaterial(material); limb.basePhyStats().setLevel(1); limb.basePhyStats().setWeight(5); limb.recoverPhyStats(); mob.location().addItem(limb, ItemPossessor.Expire.Player_Drop); for (int i = 0; i < warrants.size(); i++) { final LegalWarrant W = warrants.get(i); W.setCrime("pardoned"); W.setOffenses(0); } } else success = false; if (mob.getVictim() == target) mob.makePeace(true); if (target.getVictim() == mob) target.makePeace(true); } else maliciousFizzle(mob, target, L("<S-NAME> attempt(s) a beheading and fail(s)!")); return success; }