@Override public void grantAbilities(MOB mob, boolean isBorrowedClass) { super.grantAbilities(mob, isBorrowedClass); if (mob.playerStats() == null) { final List<AbilityMapper.AbilityMapping> V = CMLib.ableMapper() .getUpToLevelListings(ID(), mob.charStats().getClassLevel(ID()), false, false); for (final AbilityMapper.AbilityMapping able : V) { final Ability A = CMClass.getAbility(able.abilityID); if ((A != null) && ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_CHANT) && (!CMLib.ableMapper().getDefaultGain(ID(), true, A.ID()))) giveMobAbility( mob, A, CMLib.ableMapper().getDefaultProficiency(ID(), true, A.ID()), CMLib.ableMapper().getDefaultParm(ID(), true, A.ID()), isBorrowedClass); } return; } final Vector grantable = new Vector(); final int level = mob.charStats().getClassLevel(this); int numChants = 2; for (final Enumeration<Ability> a = CMClass.abilities(); a.hasMoreElements(); ) { final Ability A = a.nextElement(); if ((CMLib.ableMapper().getQualifyingLevel(ID(), true, A.ID()) == level) && ((CMLib.ableMapper().getQualifyingLevel(ID(), true, A.ID()) <= 25) && (!CMLib.ableMapper().getSecretSkill(ID(), true, A.ID())) && (!CMLib.ableMapper().getDefaultGain(ID(), true, A.ID())) && ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_CHANT))) { if (!grantable.contains(A.ID())) grantable.addElement(A.ID()); } } for (int a = 0; a < mob.numAbilities(); a++) { final Ability A = mob.fetchAbility(a); if (grantable.contains(A.ID())) { grantable.remove(A.ID()); numChants--; } } for (int i = 0; i < numChants; i++) { if (grantable.size() == 0) break; final String AID = (String) grantable.elementAt(CMLib.dice().roll(1, grantable.size(), -1)); if (AID != null) { grantable.removeElement(AID); giveMobAbility( mob, CMClass.getAbility(AID), CMLib.ableMapper().getDefaultProficiency(ID(), true, AID), CMLib.ableMapper().getDefaultParm(ID(), true, AID), isBorrowedClass); } } }
@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 void affectPhyStats(Physical affected, PhyStats affectableStats) { super.affectPhyStats(affected, affectableStats); if (affected instanceof MOB) { if (CMLib.flags().isStanding((MOB) affected)) { final MOB mob = (MOB) affected; final int attArmor = (((int) Math.round(CMath.div(mob.charStats().getStat(CharStats.STAT_DEXTERITY), 9.0))) + 1) * (mob.charStats().getClassLevel(this) - 1); affectableStats.setArmor(affectableStats.armor() - attArmor); } } }
@Override public void spring(MOB M) { if ((!sprung) && (CMLib.dice().rollPercentage() + (2 * getXLEVELLevel(invoker())) > M.charStats().getSave(CharStats.STAT_SAVE_TRAPS))) CMLib.combat().postDeath(invoker(), M, null); }
@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; }
public static void doAnimalFollowerLevelingCheck(CharClass C, Environmental host, CMMsg msg) { if ((msg.sourceMessage() == null) && (msg.sourceMinor() == CMMsg.TYP_LEVEL) && (msg.source().isMonster())) { final MOB druidM = msg.source().amUltimatelyFollowing(); if ((druidM != null) && (!druidM.isMonster()) && (druidM.charStats().getCurrentClass().ID().equals(C.ID())) && (CMLib.flags().isAnimalIntelligence(msg.source()) || msg.source() .charStats() .getMyRace() .racialCategory() .equalsIgnoreCase("Vegetation") || msg.source() .charStats() .getMyRace() .racialCategory() .equalsIgnoreCase("Stone Golem"))) { final int xp = msg.source().phyStats().level() * 5; if (xp > 0) { druidM.tell( CMLib.lang().L("Your stewardship has benefitted @x1.", msg.source().name(druidM))); CMLib.leveler().postExperience(druidM, null, null, xp, false); } } } }
@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 level(MOB mob, List<String> newAbilityIDs) { super.level(mob, newAbilityIDs); if (CMSecurity.isDisabled(CMSecurity.DisFlag.LEVELS)) return; final int attArmor = (((int) Math.round(CMath.div(mob.charStats().getStat(CharStats.STAT_DEXTERITY), 9.0))) + 1); mob.tell(L("^NYour grace grants you a defensive bonus of ^H@x1^?.^N", "" + attArmor)); }
@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, Vector commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target = this.getTarget(mob, commands, givenTarget); if (target == null) return false; if ((!target.charStats().getMyRace().racialCategory().equals("Earth Elemental")) && (!target.charStats().getMyRace().racialCategory().equals("Stone Golem")) && (!target.charStats().getMyRace().racialCategory().equals("Metal Golem"))) { mob.tell(L("@x1 is not an stone/metal golem or earth elemental!", target.name(mob))); return false; } if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; // now see if it worked boolean success = proficiencyCheck(mob, 0, auto); if (success) { final String str = auto ? "" : L("^S<S-NAME> chant(s) at <T-NAMESELF>.^?"); final CMMsg msg = CMClass.getMsg(mob, target, this, verbalCastCode(mob, target, auto), str); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); if (msg.value() <= 0) { success = maliciousAffect(mob, target, asLevel, 0, -1) != null; if (success) { if (target.isInCombat()) target.makePeace(); CMLib.commands().postFollow(target, mob, false); CMLib.combat().makePeaceInGroup(mob); if (target.amFollowing() != mob) mob.tell(L("@x1 seems unwilling to follow you.", target.name(mob))); } } } } if (!success) return maliciousFizzle( mob, target, L("<S-NAME> chant(s) at <T-NAMESELF>, but nothing happens.")); // return whether it worked return success; }
@Override public int classDurationModifier(MOB myChar, Ability skill, int duration) { if (myChar == null) return duration; if (((skill.classificationCode() & Ability.ALL_DOMAINS) == Ability.DOMAIN_CRAFTINGSKILL) && (myChar.charStats().getCurrentClass().ID().equals(ID())) && (!skill.ID().equals("FoodPrep")) && (!skill.ID().equals("Cooking")) && (!skill.ID().equals("Herbalism")) && (!skill.ID().equals("Weaving")) && (!skill.ID().equals("Masonry"))) return duration * 2; return duration; }
@Override public void executeMsg(Environmental host, CMMsg msg) { if (host instanceof MOB) { final MOB myChar = (MOB) host; if (msg.amISource(myChar) && (msg.tool() instanceof Ability) && (!myChar.isMonster()) && (msg.sourceMinor() == CMMsg.TYP_PREINVOKE) && (myChar.isMine(msg.tool())) && (myChar.charStats().getClassLevel(this) >= 30) && (CMLib.ableMapper().getQualifyingLevel(ID(), true, msg.tool().ID()) < 1)) invokable = new WeakReference(msg.tool()); } super.executeMsg(host, msg); Bard.visitationBonusMessage(host, msg); }
@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 boolean okMessage(final Environmental myHost, final CMMsg msg) { if (!(myHost instanceof MOB)) return super.okMessage(myHost, msg); final MOB myChar = (MOB) myHost; if (msg.tool() instanceof Ability) { if (msg.amISource(myChar) && (!myChar.isMonster()) && (msg.sourceMinor() != CMMsg.TYP_PREINVOKE)) { final WeakReference<Ability> curRef = invokable; if ((curRef != null) && (msg.tool() == curRef.get())) { curRef.clear(); final Ability A = ((Ability) msg.tool()); final int[] usageCost = A.usageCost(myChar, false); if (CMath.bset(A.usageType(), Ability.USAGE_MANA)) myChar.curState().adjMana(usageCost[Ability.USAGEINDEX_MANA] / 4, myChar.maxState()); if (CMath.bset(A.usageType(), Ability.USAGE_MOVEMENT)) myChar .curState() .adjMovement(usageCost[Ability.USAGEINDEX_MOVEMENT] / 4, myChar.maxState()); if (CMath.bset(A.usageType(), Ability.USAGE_HITPOINTS)) myChar .curState() .adjHitPoints(usageCost[Ability.USAGEINDEX_HITPOINTS] / 4, myChar.maxState()); } } else if (msg.amITarget(myChar)) { if (((((Ability) msg.tool()).classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_SPELL) && ((((Ability) msg.tool()).classificationCode() & Ability.ALL_DOMAINS) == Ability.DOMAIN_DIVINATION) && (CMLib.dice().roll(1, 100, 0) < (myChar.charStats().getClassLevel(this) * 4))) { myChar .location() .show( msg.source(), myChar, CMMsg.MSG_OK_ACTION, L( "<T-NAME> fool(s) <S-NAMESELF>, causing <S-HIM-HER> to fizzle @x1.", msg.tool().name())); return false; } } } return super.okMessage(myHost, msg); }
@Override public boolean execute(MOB mob, List<String> commands, int metaFlags) throws java.io.IOException { final StringBuffer head = new StringBuffer(""); final boolean isArchonLooker = CMSecurity.isASysOp(mob); head.append("^x["); head.append(CMStrings.padRight(L("Class"), 16) + " "); head.append(CMStrings.padRight(L("Race"), 8) + " "); head.append(CMStrings.padRight(L("Lvl"), 4) + " "); if (isArchonLooker) head.append(CMStrings.padRight(L("Last"), 18) + " "); head.append("] Character Name^.^?\n\r"); mob.tell( "^x[" + CMStrings.centerPreserve( L("The Administrators of @x1", CMProps.getVar(CMProps.Str.MUDNAME)), head.length() - 10) + "]^.^?"); final java.util.List<PlayerLibrary.ThinPlayer> allUsers = CMLib.database().getExtendedUserList(); String mask = CMProps.getVar(CMProps.Str.WIZLISTMASK); if (mask.length() == 0) mask = "-ANYCLASS +Archon"; final MaskingLibrary.CompiledZMask compiledMask = CMLib.masking().maskCompile(mask); for (final PlayerLibrary.ThinPlayer U : allUsers) { CharClass C; final MOB player = CMLib.players().getPlayer(U.name()); if (player != null) C = player.charStats().getCurrentClass(); else C = CMClass.getCharClass(U.charClass()); if (C == null) C = CMClass.findCharClass(U.charClass()); if (((player != null) && (CMLib.masking().maskCheck(compiledMask, player, true))) || (CMLib.masking().maskCheck(compiledMask, U))) { head.append("["); if (C != null) head.append(CMStrings.padRight(C.name(), 16) + " "); else head.append(CMStrings.padRight(L("Unknown"), 16) + " "); head.append(CMStrings.padRight(U.race(), 8) + " "); if ((C == null) || (!C.leveless())) head.append(CMStrings.padRight("" + U.level(), 4) + " "); else head.append(CMStrings.padRight(" ", 4) + " "); if (isArchonLooker) head.append(CMStrings.padRight(CMLib.time().date2String(U.last()), 18) + " "); head.append("] " + U.name()); head.append("\n\r"); } } mob.tell(head.toString()); return false; }
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if ((myHost == null) || (!(myHost instanceof MOB))) return super.okMessage(myHost, msg); final MOB mob = (MOB) myHost; if ((msg.amISource(mob)) && (mob.charStats().getClassLevel(this) > 4)) { if (((msg.sourceMinor() == CMMsg.TYP_BUY) || (msg.sourceMinor() == CMMsg.TYP_LIST)) && (msg.tool() instanceof Potion)) { mob.basePhyStats().setDisposition(mob.basePhyStats().disposition() | PhyStats.IS_BONUS); mob.recoverPhyStats(); mob.recoverCharStats(); } else if ((mob.basePhyStats().disposition() & PhyStats.IS_BONUS) == PhyStats.IS_BONUS) { mob.basePhyStats().setDisposition(mob.basePhyStats().disposition() - PhyStats.IS_BONUS); mob.recoverPhyStats(); mob.recoverCharStats(); } } return super.okMessage(myHost, msg); }
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if (!(myHost instanceof MOB)) return super.okMessage(myHost, msg); final MOB myChar = (MOB) myHost; if (!super.okMessage(myChar, msg)) return false; if ((msg.amITarget(myChar)) && (msg.targetMinor() == CMMsg.TYP_DAMAGE) && (msg.sourceMinor() == CMMsg.TYP_ELECTRIC)) { final int recovery = myChar.charStats().getClassLevel(this); msg.setValue(msg.value() - recovery); } else if ((msg.amITarget(myChar)) && (msg.targetMinor() == CMMsg.TYP_DAMAGE) && (msg.sourceMinor() == CMMsg.TYP_ACID)) { final int recovery = msg.value(); msg.setValue(msg.value() + recovery); } return true; }
@Override public void grantAbilities(MOB mob, boolean isBorrowedClass) { super.grantAbilities(mob, isBorrowedClass); if (mob.playerStats() == null) { final List<AbilityMapper.AbilityMapping> V = CMLib.ableMapper() .getUpToLevelListings(ID(), mob.charStats().getClassLevel(ID()), false, false); for (final AbilityMapper.AbilityMapping able : V) { final Ability A = CMClass.getAbility(able.abilityID); if ((A != null) && ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_SONG) && (!CMLib.ableMapper().getDefaultGain(ID(), true, A.ID()))) giveMobAbility( mob, A, CMLib.ableMapper().getDefaultProficiency(ID(), true, A.ID()), CMLib.ableMapper().getDefaultParm(ID(), true, A.ID()), isBorrowedClass); } } }
@Override public boolean invoke( MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final Physical target = getAnyTarget(mob, commands, givenTarget, Wearable.FILTER_ANY, true); if (target == null) return false; if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; int type = verbalCastCode(mob, target, auto); if ((target instanceof MOB) && (CMath.bset(type, CMMsg.MASK_MALICIOUS)) && (((MOB) target).charStats().getStat(CharStats.STAT_AGE) > 0)) { final MOB mobt = (MOB) target; if (mobt.charStats().ageCategory() <= Race.AGE_CHILD) type = CMath.unsetb(type, CMMsg.MASK_MALICIOUS); else if ((mobt.getLiegeID().equals(mob.Name())) || (mobt.amFollowing() == mob)) type = CMath.unsetb(type, CMMsg.MASK_MALICIOUS); else if ((mobt.charStats().ageCategory() <= Race.AGE_MATURE) && (mobt.getLiegeID().length() > 0)) type = CMath.unsetb(type, CMMsg.MASK_MALICIOUS); } if ((target instanceof Item) || ((target instanceof MOB) && (((MOB) target).isMonster()) && (CMLib.flags().isAnimalIntelligence((MOB) target)) && (CMLib.law().doesHavePriviledgesHere(mob, mob.location())))) { type = CMath.unsetb(type, CMMsg.MASK_MALICIOUS); } boolean success = proficiencyCheck(mob, 0, auto); if (success) { final CMMsg msg = CMClass.getMsg( mob, target, this, type, auto ? "" : L("^S<S-NAME> chant(s) to <T-NAMESELF>.^?")); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); final Ability A = target.fetchEffect("Age"); if ((!(target instanceof MOB)) && (!(target instanceof CagedAnimal)) && (A == null)) { if (target instanceof Food) { mob.tell(L("@x1 rots away!", target.name(mob))); ((Item) target).destroy(); } else if (target instanceof Item) { switch (((Item) target).material() & RawMaterial.MATERIAL_MASK) { case RawMaterial.MATERIAL_CLOTH: case RawMaterial.MATERIAL_FLESH: case RawMaterial.MATERIAL_LEATHER: case RawMaterial.MATERIAL_PAPER: case RawMaterial.MATERIAL_VEGETATION: case RawMaterial.MATERIAL_WOODEN: { mob.location() .showHappens(CMMsg.MSG_OK_VISUAL, L("@x1 rots away!", target.name())); if (target instanceof Container) ((Container) target).emptyPlease(false); ((Item) target).destroy(); break; } default: mob.location() .showHappens( CMMsg.MSG_OK_VISUAL, L("@x1 ages, but nothing happens to it.", target.name())); break; } } else mob.location() .showHappens( CMMsg.MSG_OK_VISUAL, L("@x1 ages, but nothing happens to it.", target.name())); success = false; } else if ((target instanceof MOB) && ((A == null) || (A.displayText().length() == 0))) { final MOB M = (MOB) target; mob.location().show(M, null, CMMsg.MSG_OK_VISUAL, L("<S-NAME> age(s) a bit.")); if (M.baseCharStats().getStat(CharStats.STAT_AGE) <= 0) M.setAgeMinutes(M.getAgeMinutes() + (M.getAgeMinutes() / 10)); else if ((M.playerStats() != null) && (M.playerStats().getBirthday() != null)) { final TimeClock C = CMLib.time().localClock(M.getStartRoom()); final double aging = CMath.mul(M.baseCharStats().getStat(CharStats.STAT_AGE), .10); int years = (int) Math.round(Math.floor(aging)); final int monthsInYear = C.getMonthsInYear(); int months = (int) Math.round(CMath.mul(aging - Math.floor(aging), monthsInYear)); if ((years <= 0) && (months == 0)) months++; M.playerStats().getBirthday()[PlayerStats.BIRTHDEX_YEAR] -= years; M.playerStats().getBirthday()[PlayerStats.BIRTHDEX_MONTH] -= months; if (M.playerStats().getBirthday()[PlayerStats.BIRTHDEX_MONTH] < 1) { M.playerStats().getBirthday()[PlayerStats.BIRTHDEX_YEAR]--; years++; M.playerStats().getBirthday()[PlayerStats.BIRTHDEX_MONTH] = monthsInYear + M.playerStats().getBirthday()[PlayerStats.BIRTHDEX_MONTH]; } M.baseCharStats() .setStat(CharStats.STAT_AGE, M.baseCharStats().getStat(CharStats.STAT_AGE) + years); } M.recoverPhyStats(); M.recoverCharStats(); } else if (A != null) { final long start = CMath.s_long(A.text()); long age = System.currentTimeMillis() - start; final long millisPerMudday = CMProps.getIntVar(CMProps.Int.TICKSPERMUDDAY) * CMProps.getTickMillis(); if (age < millisPerMudday) age = millisPerMudday; final long millisPerMonth = CMLib.time().globalClock().getDaysInMonth() * millisPerMudday; final long millisPerYear = CMLib.time().globalClock().getMonthsInYear() * millisPerMonth; long ageBy = age / 10; if (ageBy < millisPerMonth) ageBy = millisPerMonth + 1; else if (ageBy < millisPerYear) ageBy = millisPerYear + 1; A.setMiscText("" + (start - ageBy)); if (target instanceof MOB) mob.location() .show((MOB) target, null, CMMsg.MSG_OK_VISUAL, L("<S-NAME> age(s) a bit.")); else mob.location().showHappens(CMMsg.MSG_OK_VISUAL, L("@x1 ages a bit.", target.name())); target.recoverPhyStats(); } else return beneficialWordsFizzle( mob, target, L("<S-NAME> chant(s) to <T-NAMESELF>, but the magic fades.")); } } else if (CMath.bset(type, CMMsg.MASK_MALICIOUS)) return maliciousFizzle( mob, target, L("<S-NAME> chant(s) to <T-NAMESELF>, but the magic fades.")); 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) { 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; }
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { super.executeMsg(myHost, msg); if ((myHost == null) || (!(myHost instanceof MOB))) return; final MOB mob = (MOB) myHost; if (msg.amISource(mob)) { if (((msg.sourceMinor() == CMMsg.TYP_LOOK) || (msg.sourceMinor() == CMMsg.TYP_EXAMINE)) && (msg.target() instanceof Wand) && (mob.charStats().getClassLevel(this) >= 30)) { final String message = "<O-NAME> has " + ((Wand) msg.target()).usesRemaining() + " charges remaining."; msg.addTrailerMsg( CMClass.getMsg( mob, null, msg.target(), CMMsg.MSG_OK_VISUAL, CMMsg.NO_EFFECT, CMMsg.NO_EFFECT, message)); } else if (msg.tool() != null) { if (msg.tool().ID().equals("Skill_Spellcraft")) { if ((msg.tool().text().length() > 0) && (msg.target() instanceof MOB)) { Ability A = ((MOB) msg.target()).fetchAbility(msg.tool().text()); if (A == null) return; final Ability myA = mob.fetchAbility(A.ID()); if (myA != null) { if ((!A.isSavable()) && ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_SPELL) && (CMLib.ableMapper().lowestQualifyingLevel(A.ID()) < 30)) addAbilityToSpellcraftList(mob, A); } else if (CMLib.ableMapper().lowestQualifyingLevel(A.ID()) < 30) { final Vector<Ability> otherChoices = new Vector<Ability>(); for (int a = 0; a < mob.numAbilities(); a++) { final Ability A2 = mob.fetchAbility(a); if ((A2 != null) && (!A2.isSavable()) && ((A2.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_SPELL)) otherChoices.addElement(A2); } A = (Ability) A.copyOf(); A.setProficiency(0); A.setSavable(false); if (otherChoices.size() > (mob.charStats().getClassLevel(this) / 3)) { final Ability A2 = otherChoices.elementAt(CMLib.dice().roll(1, otherChoices.size(), -1)); clearAbilityFromSpellcraftList(mob, A2); } addAbilityToSpellcraftList(mob, A); } } } else if (msg.tool().ID().equals("Spell_Scribe") || msg.tool().ID().equals("Spell_EnchantWand") || msg.tool().ID().equals("Spell_MagicItem") || msg.tool().ID().equals("Spell_StoreSpell") || msg.tool().ID().equals("Spell_WardArea")) { final Ability A = mob.fetchAbility(msg.tool().text()); if ((A != null) && (!A.isSavable())) clearAbilityFromSpellcraftList(mob, A); } else if (msg.tool() instanceof Ability) { final Ability A = mob.fetchAbility(msg.tool().ID()); if ((A != null) && (!A.isSavable()) && ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_SPELL)) clearAbilityFromSpellcraftList(mob, A); } } } }
@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) { boolean announce = false; if (commands.size() > 0) { if (((String) commands.lastElement()).equals("!")) { commands.removeElementAt(commands.size() - 1); announce = true; } } final MOB target = getTargetAnywhere(mob, commands, givenTarget, true); 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.MASK_MOVE | CMMsg.TYP_JUSTICE | (auto ? CMMsg.MASK_ALWAYS : 0), auto ? L("<T-NAME> <T-IS-ARE> knocked out of <T-HIS-HER> shoes!!!") : L( "^F**<S-NAME> BLAST(S) <T-NAMESELF>**, knocking <T-HIM-HER> out of <T-HIS-HER> shoes!!^?")); CMLib.color().fixSourceFightColor(msg); if (target.location().okMessage(mob, msg)) { target.location().send(mob, msg); if (target.curState().getHitPoints() > 2) target.curState().setHitPoints(target.curState().getHitPoints() / 2); if (target.curState().getMana() > 2) target.curState().setMana(target.curState().getMana() / 2); if (target.curState().getMovement() > 2) target.curState().setMovement(target.curState().getMovement() / 2); final Item I = target.fetchFirstWornItem(Wearable.WORN_FEET); if (I != null) { I.unWear(); I.removeFromOwnerContainer(); target.location().addItem(I, ItemPossessor.Expire.Player_Drop); } Log.sysOut("Banish", mob.Name() + " wrathed " + target.name() + "."); if (announce) { final Command C = CMClass.getCommand("Announce"); try { C.execute( mob, new XVector( "ANNOUNCE", target.name() + " is knocked out of " + target.charStats().hisher() + " shoes!!!"), Command.METAFLAG_FORCED); } catch (final Exception e) { } } } } else return beneficialVisualFizzle( mob, target, L("<S-NAME> attempt(s) to inflict <S-HIS-HER> wrath upon <T-NAMESELF>, but fail(s).")); return success; }
@Override public boolean invoke( MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final Room trapThis = mob.location(); Item resource = CMLib.materials().findMostOfMaterial(mob.location(), RawMaterial.MATERIAL_METAL); if (resource == null) resource = CMLib.materials().findMostOfMaterial(mob.location(), RawMaterial.MATERIAL_MITHRIL); int amount = 0; if (resource != null) amount = CMLib.materials().findNumberOfResource(mob.location(), resource.material()); if (amount < 100) { mob.tell(L("You need 100 pounds of raw metal to build this trap.")); return false; } if (mob.isInCombat()) { mob.tell(L("You are too busy to get that done right now.")); return false; } if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; final boolean success = proficiencyCheck(mob, 0, auto); if (resource != null) CMLib.materials().destroyResourcesValue(mob.location(), 100, resource.material(), -1, null); final CMMsg msg = CMClass.getMsg( mob, trapThis, this, auto ? CMMsg.MSG_OK_ACTION : CMMsg.MSG_THIEF_ACT, CMMsg.MASK_ALWAYS | CMMsg.MSG_DELICATE_HANDS_ACT, CMMsg.MSG_OK_ACTION, (auto ? L("@x1 begins to glow!", trapThis.name()) : L("<S-NAME> attempt(s) to lay a trap here."))); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); if (success) { mob.tell(L("You have set the trap.")); setTrap( mob, trapThis, mob.charStats().getClassLevel(mob.charStats().getCurrentClass()), (CMLib.ableMapper().qualifyingClassLevel(mob, this) - CMLib.ableMapper().lowestQualifyingLevel(ID())) + 1, false); final Thief_DeathTrap T = (Thief_DeathTrap) trapThis.fetchEffect(ID()); if (T != null) T.setMiscText(mob.Name()); } else { if (CMLib.dice().rollPercentage() > 50) { final Trap T = setTrap( mob, trapThis, mob.charStats().getClassLevel(mob.charStats().getCurrentClass()), (CMLib.ableMapper().qualifyingClassLevel(mob, this) - CMLib.ableMapper().lowestQualifyingLevel(ID())) + 1, false); mob.location() .show(mob, null, CMMsg.MSG_OK_ACTION, L("<S-NAME> trigger(s) the trap on accident!")); T.spring(mob); } else { mob.tell(L("You fail in your attempt to set the death trap.")); } } } return success; }
@Override public void grantAbilities(MOB mob, boolean isBorrowedClass) { super.grantAbilities(mob, isBorrowedClass); // if he already has one, don't give another! if (mob.playerStats() != null) { final int classLevel = mob.baseCharStats().getClassLevel(this); if (classLevel < 2) return; if ((classLevel % 2) != 0) return; int maxSkills = classLevel / 2; // now only give one, for current level, respecting alignment! // first, get a list of all skills you don't qualify for that you MIGHT have gained or will // gain final List<Ability> choices = new Vector<Ability>(); for (final Enumeration<Ability> a = CMClass.abilities(); a.hasMoreElements(); ) { final Ability A = a.nextElement(); final int lql = CMLib.ableMapper().lowestQualifyingLevel(A.ID()); if ((CMLib.ableMapper().qualifyingLevel(mob, A) <= 0) && (lql < 25) && (lql > 0) && (!CMLib.ableMapper().getSecretSkill(A.ID())) && (CMLib.ableMapper().qualifiesByAnyCharClass(A.ID())) && (CMLib.ableMapper().availableToTheme(A.ID(), Area.THEME_FANTASY, true)) && (!CMLib.ableMapper().qualifiesOnlyByClan(mob, A)) && (!CMLib.ableMapper().qualifiesOnlyByRace(mob, A)) && (A.isAutoInvoked() || ((A.triggerStrings() != null) && (A.triggerStrings().length > 0)))) choices.add(A); } // now count those you already have for (int a = choices.size() - 1; a >= 0; a--) { final Ability A = choices.get(a); if (mob.fetchAbility(A.ID()) != null) maxSkills--; } if (maxSkills < 1) // if that reduced you to 0, you are done. return; // now eliminate those you already have, and those that are // above your level, if you are <25 for (int a = choices.size() - 1; a >= 0; a--) { final Ability A = choices.get(a); final int lql = CMLib.ableMapper().lowestQualifyingLevel(A.ID()); if ((mob.fetchAbility(ID()) != null) || ((lql != classLevel) && (lql != classLevel - 1) && (classLevel < 25))) choices.remove(a); } if (choices.size() == 0) return; final Ability A = choices.get(CMLib.dice().roll(1, choices.size(), -1)); if (A != null) giveMobAbility(mob, A, 0, "", isBorrowedClass); } else { final List<AbilityMapper.AbilityMapping> V = CMLib.ableMapper() .getUpToLevelListings(ID(), mob.charStats().getClassLevel(ID()), false, false); for (final AbilityMapper.AbilityMapping able : V) { final Ability A = CMClass.getAbility(able.abilityID); if ((A != null) && (!CMLib.ableMapper().getAllQualified(ID(), true, A.ID())) && (!CMLib.ableMapper().getDefaultGain(ID(), true, A.ID()))) giveMobAbility( mob, A, CMLib.ableMapper().getDefaultProficiency(ID(), true, A.ID()), CMLib.ableMapper().getDefaultParm(ID(), true, A.ID()), isBorrowedClass); } } }
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { super.executeMsg(myHost, msg); // the sex rules if (!(affected instanceof MOB)) return; final MOB myChar = (MOB) affected; if (msg.target() instanceof MOB) { final MOB mate = (MOB) msg.target(); if ((msg.amISource(myChar)) && (msg.tool() instanceof Social) && (msg.tool().Name().equals("MATE <T-NAME>") || msg.tool().Name().equals("SEX <T-NAME>")) && (msg.sourceMinor() != CMMsg.TYP_CHANNEL) && (myChar.charStats().getStat(CharStats.STAT_GENDER) != mate.charStats().getStat(CharStats.STAT_GENDER)) && ((mate.charStats().getStat(CharStats.STAT_GENDER) == ('M')) || (mate.charStats().getStat(CharStats.STAT_GENDER) == ('F'))) && ((myChar.charStats().getStat(CharStats.STAT_GENDER) == ('M')) || (myChar.charStats().getStat(CharStats.STAT_GENDER) == ('F'))) && (!mate.charStats().getMyRace().canBreedWith(myChar.charStats().getMyRace())) && (myChar.location() == mate.location()) && (myChar .fetchWornItems( Wearable.WORN_LEGS | Wearable.WORN_WAIST, (short) -2048, (short) 0) .size() == 0) && (mate.fetchWornItems( Wearable.WORN_LEGS | Wearable.WORN_WAIST, (short) -2048, (short) 0) .size() == 0) && ((mate.charStats().getStat(CharStats.STAT_AGE) == 0) || ((mate.charStats().ageCategory() > Race.AGE_CHILD) && (mate.charStats().ageCategory() < Race.AGE_OLD))) && ((myChar.charStats().getStat(CharStats.STAT_AGE) == 0) || ((myChar.charStats().ageCategory() > Race.AGE_CHILD) && (myChar.charStats().ageCategory() < Race.AGE_OLD)))) { MOB female = myChar; MOB male = mate; if ((mate.charStats().getStat(CharStats.STAT_GENDER) == ('F'))) { female = mate; male = myChar; } final Ability A = CMClass.getAbility("Pregnancy"); if ((A != null) && (female.fetchAbility(A.ID()) == null) && (female.fetchEffect(A.ID()) == null)) { A.invoke(male, female, true, 0); unInvoke(); } } } }
@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; }