@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 void removeMyAffectsFrom(Physical P) { if (P == null) return; int x = 0; final Vector<Ability> eff = new Vector<Ability>(); Ability thisAffect = null; for (x = 0; x < P.numEffects(); x++) // personal { thisAffect = P.fetchEffect(x); if (thisAffect != null) eff.addElement(thisAffect); } if (eff.size() > 0) { final Map<String, String> h = makeMySpellsH(getMySpellsV()); if (unrevocableSpells != null) { for (int v = unrevocableSpells.size() - 1; v >= 0; v--) { thisAffect = unrevocableSpells.get(v); if (h.containsKey(thisAffect.ID())) P.delEffect(thisAffect); } } else for (x = 0; x < eff.size(); x++) { thisAffect = eff.elementAt(x); final String ID = h.get(thisAffect.ID()); if ((ID != null) && (thisAffect.invoker() == getInvokerMOB(P, P))) { thisAffect.unInvoke(); if ((!uninvocable) && (!thisAffect.canBeUninvoked())) P.delEffect(thisAffect); } } unrevocableSpells = null; } }
public static InventoryList fetchInventory(MOB seer, MOB mob) { final InventoryList lst = new InventoryList(); Vector<Coins> coinsV = null; int insertAt = -1; CMLib.beanCounter().getTotalAbsoluteNativeValue(mob); for (final Enumeration<Item> i = mob.items(); i.hasMoreElements(); ) { final Item thisItem = i.nextElement(); if (thisItem == null) continue; if ((thisItem.container() == null) && (thisItem.amWearingAt(Wearable.IN_INVENTORY))) { if (CMLib.flags().canBeSeenBy(thisItem, seer)) lst.foundAndSeen = true; else lst.foundButUnseen = true; if ((!(thisItem instanceof Coins)) || (((Coins) thisItem).getDenomination() == 0.0)) lst.viewItems.add(thisItem); else { coinsV = lst.moneyItems.get(((Coins) thisItem).getCurrency()); if (coinsV == null) { coinsV = new Vector<Coins>(); lst.moneyItems.put(((Coins) thisItem).getCurrency(), coinsV); } for (insertAt = 0; insertAt < coinsV.size(); insertAt++) if (coinsV.get(insertAt).getDenomination() > ((Coins) thisItem).getDenomination()) break; if (insertAt >= coinsV.size()) coinsV.add((Coins) thisItem); else coinsV.insertElementAt((Coins) thisItem, insertAt); } } } return lst; }
@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); } } }
protected int parseOutLevel(Vector commands) { if ((commands.size() > 1) && (commands.lastElement() instanceof String) && (CMath.isNumber((String) commands.lastElement()))) { final int x = CMath.s_int((String) commands.lastElement()); commands.remove(commands.size() - 1); return x; } return -1; }
public Item targetItem(MOB target) { final Vector<Item> V = new Vector<Item>(); for (int i = 0; i < target.numItems(); i++) { final Item I2 = target.getItem(i); if ((!I2.amWearingAt(Wearable.IN_INVENTORY)) && (((I2 instanceof Weapon) && (I2.basePhyStats().damage() > 1)) || ((I2 instanceof Armor) && (I2.basePhyStats().armor() > 1))) && (I2.container() == null)) V.addElement(I2); } if (V.size() > 0) return V.elementAt(CMLib.dice().roll(1, V.size(), -1)); return null; }
public String composition() { String comp = ""; if (trail != null) { String t = trail.toString(); final int[] counts = new int[stuff.length]; int x = t.indexOf(';'); while (x >= 0) { final int q = CMath.s_int(t.substring(0, x)); t = t.substring(x + 1); if (q >= 0) { for (int i = 0; i < stuff.length; i++) { if (CMath.s_int(stuff[i][0]) == q) counts[i]++; } } x = t.indexOf(';'); } int wa = -1; for (int i = 0; i < stuff.length; i++) if (CMath.s_int(stuff[i][0]) == CMMsg.TYP_WEAPONATTACK) { wa = i; break; } if (wa >= 0) counts[wa] = counts[wa] / 25; final Vector<Integer> V = new Vector<Integer>(); while (V.size() < counts.length) { int high = -1; int which = -1; for (int i = 0; i < counts.length; i++) { if ((counts[i] > high) && (!V.contains(Integer.valueOf(i)))) { high = counts[i]; which = i; } } if (which >= 0) V.addElement(Integer.valueOf(which)); } final Vector<Integer> V2 = new Vector<Integer>(); for (int i = 0; i < 3; i++) { final Integer ref = V.elementAt(i); Integer which = null; while ((which == null) || (V2.contains(which))) { final Integer w = V.elementAt(CMLib.dice().roll(1, V.size(), -1)); if (counts[w.intValue()] == counts[ref.intValue()]) which = w; } V2.addElement(which); comp += which.intValue() + ";" + counts[which.intValue()] + ";"; } } return comp; }
@Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { String cmd = ""; if (commands.size() > 0) cmd = ((String) commands.firstElement()).toUpperCase(); if ((commands.size() < 2) || ((!cmd.equals("BUY") && (!cmd.equals("SELL"))))) { mob.tell( L( "You must specify BUY, SELL, an item, and possibly a ShopKeeper (unless it is implied).")); return false; } final Environmental shopkeeper = CMLib.english() .parseShopkeeper(mob, commands, CMStrings.capitalizeAndLower(cmd) + " what to whom?"); if (shopkeeper == null) return false; if (commands.size() == 0) { mob.tell(L("@x1 what?", CMStrings.capitalizeAndLower(cmd))); 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, shopkeeper, this, CMMsg.MSG_SPEAK, auto ? "" : L("<S-NAME> haggle(s) with <T-NAMESELF>.")); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); invoker = mob; mob.addEffect(this); mob.recoverCharStats(); commands.insertElementAt(CMStrings.capitalizeAndLower(cmd), 0); mob.doCommand(commands, Command.METAFLAG_FORCED); commands.addElement(shopkeeper.name()); mob.delEffect(this); mob.recoverCharStats(); } } else beneficialWordsFizzle( mob, shopkeeper, L("<S-NAME> haggle(s) with <T-NAMESELF>, but <S-IS-ARE> unconvincing.")); // return whether it worked return success; }
@Override public boolean tick(Tickable ticking, int tickID) { if ((!built) && (affected instanceof MOB)) { built = true; CharClass C = null; final Vector allowedClasses = new Vector(); final Vector allowedExpertises = new Vector(); final Vector<String> V = CMParms.parse(text()); String s = null; for (int v = 0; v < V.size(); v++) { s = V.elementAt(v); if (s.equalsIgnoreCase("all")) continue; C = CMClass.getCharClass(s); if (C != null) { if ((v > 0) && (V.elementAt(v - 1).equalsIgnoreCase("ALL"))) { final String baseClass = C.baseClass(); for (final Enumeration c = CMClass.charClasses(); c.hasMoreElements(); ) { C = (CharClass) c.nextElement(); if ((C.baseClass().equalsIgnoreCase(baseClass)) && (!allowedClasses.contains(C))) allowedClasses.addElement(C); } } else allowedClasses.addElement(C); } else { final ExpertiseLibrary.ExpertiseDefinition def = CMLib.expertises().getDefinition(s); if (def != null) allowedExpertises.addElement(def); } } if (allowedClasses.size() == 0) for (final Enumeration c = CMClass.charClasses(); c.hasMoreElements(); ) allowedClasses.addElement(c.nextElement()); if (allowedExpertises.size() == 0) for (final Enumeration e = CMLib.expertises().definitions(); e.hasMoreElements(); ) allowedExpertises.addElement(e.nextElement()); final MOB mob = (MOB) affected; for (int c = 0; c < allowedClasses.size(); c++) { C = (CharClass) allowedClasses.elementAt(c); addCharClassIfNotFound(mob, C); } for (int e = 0; e < allowedExpertises.size(); e++) mob.addExpertise( ((ExpertiseLibrary.ExpertiseDefinition) allowedExpertises.elementAt(e)).ID); mob.recoverCharStats(); mob.recoverPhyStats(); mob.recoverMaxState(); } return super.tick(ticking, tickID); }
@Override public boolean execute(MOB mob, Vector commands, int metaFlags) throws java.io.IOException { final StringBuilder msg = new StringBuilder(""); final Vector V = new Vector(); V.add(Integer.valueOf(Ability.ACODE_THIEF_SKILL)); V.add(Integer.valueOf(Ability.ACODE_SKILL)); V.add(Integer.valueOf(Ability.ACODE_COMMON_SKILL)); final String qual = CMParms.combine(commands, 1).toUpperCase(); if (parsedOutIndividualSkill(mob, qual, V)) return true; final int[] level = new int[1]; final int[] domain = new int[1]; final String[] domainName = new String[1]; domainName[0] = ""; level[0] = -1; parseDomainInfo(mob, commands, V, level, domain, domainName); int mask = Ability.ALL_ACODES; if (domain[0] >= 0) { mask = mask | Ability.ALL_DOMAINS; for (int v = 0; v < V.size(); v++) V.setElementAt(Integer.valueOf(((Integer) V.get(v)).intValue() + domain[0]), v); } if ((domain[0] >= 0) || (qual.length() == 0)) msg.append( L( "\n\r^HYour @x1skills:^? @x2", domainName[0].replace('_', ' '), getAbilities(mob, mob, V, mask, true, level[0]).toString())); if (!mob.isMonster()) mob.session().wraplessPrintln(msg.toString()); return false; }
@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 execute(MOB mob, Vector commands, int metaFlags) throws java.io.IOException { if (!(CMLib.intermud().imc2online())) { mob.tell(L("IMC2 is unavailable.")); return false; } commands.remove(0); if (commands.size() < 1) { IMC2Error(mob); return false; } final String str = (String) commands.get(0); if (!(CMLib.intermud().imc2online())) mob.tell(L("IMC2 is unavailable.")); else if (str.equalsIgnoreCase("list")) CMLib.intermud().giveIMC2MudList(mob); else if (str.equalsIgnoreCase("locate")) CMLib.intermud().i3locate(mob, CMParms.combine(commands, 1)); else if (str.equalsIgnoreCase("channels") && CMSecurity.isAllowed(mob, mob.location(), CMSecurity.SecFlag.IMC2)) CMLib.intermud().giveIMC2ChannelsList(mob); else if (str.equalsIgnoreCase("info")) CMLib.intermud().imc2mudInfo(mob, CMParms.combine(commands, 1)); else if (str.equalsIgnoreCase("restart") && CMSecurity.isAllowed(mob, mob.location(), CMSecurity.SecFlag.IMC2)) { try { mob.tell(CMLib.hosts().get(0).executeCommand("START IMC2")); } catch (final Exception e) { Log.errOut("IMC2Cmd", e); } } else IMC2Error(mob); return false; }
private Item getItem(MOB mobTarget) { final Vector goodPossibilities = new Vector(); final Vector possibilities = new Vector(); for (int i = 0; i < mobTarget.numItems(); i++) { final Item item = mobTarget.getItem(i); if (item != null) { if (item.amWearingAt(Wearable.IN_INVENTORY)) possibilities.addElement(item); else goodPossibilities.addElement(item); } } if (goodPossibilities.size() > 0) return (Item) goodPossibilities.elementAt(CMLib.dice().roll(1, goodPossibilities.size(), -1)); else if (possibilities.size() > 0) return (Item) possibilities.elementAt(CMLib.dice().roll(1, possibilities.size(), -1)); return null; }
@Override public boolean tick(Tickable ticking, int tickID) { final MOB mob = (MOB) affected; if (mob == null) return false; if (song == null) { if ((whom == null) || (commonRoomSet == null) || (!commonRoomSet.contains(whom.location())) || (CMLib.flags().isSleeping(invoker)) || (!CMLib.flags().canBeSeenBy(whom, invoker))) return unsingMe(mob, null); } if ((whom != null) && (song != null) && (affected == invoker()) && (CMLib.dice().rollPercentage() < 10)) { final Hashtable<Integer, Integer> H = getSongBenefits(song); final Vector<Integer> V = new Vector<Integer>(); for (final Enumeration<Integer> e = H.keys(); e.hasMoreElements(); ) V.addElement(e.nextElement()); final Integer I = V.elementAt(CMLib.dice().roll(1, V.size(), -1)); final String[] chk = stuff[I.intValue()]; invoker() .location() .show(invoker(), this, whom, CMMsg.MSG_SPEAK, L("<S-NAME> sing(s) '@x1'.", chk[3])); } if (!super.tick(ticking, tickID)) return false; return true; }
@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; }
@Override public List<RawMaterial> myResources() { synchronized (resources) { if (resources.size() == 0) { resources.addElement(makeResource(L("a stem"), RawMaterial.RESOURCE_VINE)); } } return resources; }
@Override public List<RawMaterial> myResources() { synchronized (resources) { if (resources.size() == 0) { resources.addElement(makeResource("some pebbles", RawMaterial.RESOURCE_STONE)); } } return resources; }
@Override public List<RawMaterial> myResources() { synchronized (resources) { if (resources.size() == 0) { resources.addElement(makeResource("a pound of clay", RawMaterial.RESOURCE_CLAY)); resources.addElement(makeResource("essence of golem", RawMaterial.RESOURCE_BLOOD)); } } return resources; }
@Override public List<RawMaterial> myResources() { synchronized (resources) { if (resources.size() == 0) { resources.addElement( makeResource(L("some @x1 pincers", name().toLowerCase()), RawMaterial.RESOURCE_BONE)); } } return resources; }
@Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { material = RawMaterial.RESOURCE_OAK; if ((mob.location().myResource() & RawMaterial.MATERIAL_MASK) == RawMaterial.MATERIAL_WOODEN) material = mob.location().myResource(); else { final List<Integer> V = mob.location().resourceChoices(); final Vector V2 = new Vector(); if (V != null) for (int v = 0; v < V.size(); v++) { if (((V.get(v).intValue() & RawMaterial.MATERIAL_MASK) == RawMaterial.MATERIAL_WOODEN) && ((V.get(v).intValue()) != RawMaterial.RESOURCE_WOOD)) V2.addElement(V.get(v)); } if (V2.size() > 0) material = ((Integer) V2.elementAt(CMLib.dice().roll(1, V2.size(), -1))).intValue(); } return super.invoke(mob, commands, givenTarget, auto, asLevel); }
@Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { if (super.checkStop(mob, commands)) return true; if (commands.size() == 0) { commonTell( mob, L( "Build what? Enter \"buildcage list\" for a list, \"buildcage learn <item>\" to gain recipes, or \"buildcage stop\" to cancel.")); return false; } return super.invoke(mob, commands, givenTarget, auto, asLevel); }
public Item getPossibility(MOB mobTarget) { if (mobTarget != null) { final Vector goodPossibilities = new Vector(); final Vector possibilities = new Vector(); for (int i = 0; i < mobTarget.numItems(); i++) { final Item item = mobTarget.getItem(i); if ((item != null) && ((item.material() & RawMaterial.MATERIAL_MASK) == RawMaterial.MATERIAL_WOODEN) && (item.subjectToWearAndTear())) { if (item.amWearingAt(Wearable.IN_INVENTORY)) possibilities.addElement(item); else goodPossibilities.addElement(item); } if (goodPossibilities.size() > 0) return (Item) goodPossibilities.elementAt(CMLib.dice().roll(1, goodPossibilities.size(), -1)); else if (possibilities.size() > 0) return (Item) possibilities.elementAt(CMLib.dice().roll(1, possibilities.size(), -1)); } } return null; }
@Override public boolean execute(MOB mob, Vector commands, int metaFlags) throws java.io.IOException { if ((commands.size() == 1) && (commands.get(0) instanceof MOB)) { commands.add(getInventory((MOB) commands.get(0), mob, null)); return true; } final StringBuilder msg = getInventory(mob, mob, CMParms.combine(commands, 1)); if (msg.length() == 0) mob.tell(L("^HYou are carrying:\n\r^!Nothing!^?\n\r")); else if (!mob.isMonster()) mob.session().wraplessPrintln(L("^HYou are carrying:^?\n\r@x1", msg.toString())); return false; }
@Override public void endCharacter(MOB mob) { 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); } for (int a = 0; a < otherChoices.size(); a++) mob.delAbility(otherChoices.elementAt(a)); }
@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 Vector V = new Vector(); TrackingLibrary.TrackingFlags flags; flags = new TrackingLibrary.TrackingFlags() .plus(TrackingLibrary.TrackingFlag.OPENONLY) .plus(TrackingLibrary.TrackingFlag.AREAONLY) .plus(TrackingLibrary.TrackingFlag.NOEMPTYGRIDS) .plus(TrackingLibrary.TrackingFlag.NOAIR) .plus(TrackingLibrary.TrackingFlag.NOWATER); CMLib.tracking() .getRadiantRooms(mob.location(), V, flags, null, adjustedLevel(mob, asLevel), null); for (int v = V.size() - 1; v >= 0; v--) { final Room R = (Room) V.elementAt(v); if ((R.domainType() != Room.DOMAIN_INDOORS_CAVE) || (R == mob.location())) V.removeElementAt(v); } if (V.size() > 0) { mob.location() .show( mob, null, CMMsg.MASK_ALWAYS | CMMsg.TYP_NOISE, L("The faint sound of fungus popping into existence can be heard.")); int done = 0; for (int v = 0; v < V.size(); v++) { final Room R = (Room) V.elementAt(v); if (R == mob.location()) continue; buildMyThing(mob, R); if ((done++) == adjustedLevel(mob, asLevel)) break; } } return true; }
@Override public List<RawMaterial> myResources() { synchronized (resources) { if (resources.size() == 0) { resources.addElement( makeResource(L("some @x1 hair", name().toLowerCase()), RawMaterial.RESOURCE_FUR)); resources.addElement( makeResource( L("a pair of @x1 teeth", name().toLowerCase()), RawMaterial.RESOURCE_BONE)); resources.addElement( makeResource(L("some @x1 blood", name().toLowerCase()), RawMaterial.RESOURCE_BLOOD)); } } return resources; }
@Override public List<RawMaterial> myResources() { synchronized (resources) { if (resources.size() == 0) { resources.addElement( makeResource("a " + name().toLowerCase() + " brain", RawMaterial.RESOURCE_MEAT)); resources.addElement( makeResource("some " + name().toLowerCase() + " blood", RawMaterial.RESOURCE_BLOOD)); resources.addElement( makeResource( "a pile of " + name().toLowerCase() + " bones", RawMaterial.RESOURCE_BONE)); } } return resources; }
@Override public List<RawMaterial> myResources() { synchronized (resources) { if (resources.size() == 0) { for (int i = 0; i < 25; i++) resources.addElement( makeResource("some " + name().toLowerCase(), RawMaterial.RESOURCE_FISH)); for (int i = 0; i < 15; i++) resources.addElement( makeResource("a " + name().toLowerCase() + " hide", RawMaterial.RESOURCE_HIDE)); resources.addElement( makeResource("some " + name().toLowerCase() + " blood", RawMaterial.RESOURCE_BLOOD)); } } return resources; }
public void tickLycanthropically(MOB mob) { if (mob == null) return; if (mob.location() == null) return; if (mob.isInCombat()) return; if ((CMLib.dice().rollPercentage() < 15) && ((mob.location().domainType() & Room.INDOORS) > 0)) mob.location() .show(mob, null, CMMsg.MSG_NOISE, L("<S-NAME> howl(s) at the moon! ARROOOOOOOO!!!!")); // time to tick lycanthropically final MOB M = victimHere(mob.location(), mob); if (M != null) { deathTrail = null; CMLib.combat().postAttack(mob, M, mob.fetchWieldedItem()); return; } if ((deathTrail != null) && (!deathTrail.contains(mob.location()))) deathTrail = null; if (deathTrail == null) { final Vector rooms = new Vector(); if ((findVictim(mob, mob.location(), rooms, 0)) && (rooms.size() > 0)) { TrackingLibrary.TrackingFlags flags; flags = new TrackingLibrary.TrackingFlags() .plus(TrackingLibrary.TrackingFlag.OPENONLY) .plus(TrackingLibrary.TrackingFlag.AREAONLY) .plus(TrackingLibrary.TrackingFlag.NOEMPTYGRIDS) .plus(TrackingLibrary.TrackingFlag.NOAIR) .plus(TrackingLibrary.TrackingFlag.NOWATER); deathTrail = CMLib.tracking().findBastardTheBestWay(mob.location(), rooms, flags, 50); if (deathTrail != null) deathTrail.add(mob.location()); } } if (deathTrail != null) { final int nextDirection = CMLib.tracking().trackNextDirectionFromHere(deathTrail, mob.location(), true); if ((nextDirection == 999) || (nextDirection == -1)) deathTrail = null; else if (nextDirection >= 0) { final Room nextRoom = mob.location().getRoomInDir(nextDirection); if ((nextRoom != null) && ((nextRoom.getArea() == mob.location().getArea())) || (!mob.isMonster())) { if (!CMLib.tracking().walk(mob, nextDirection, false, false)) deathTrail = null; else if (CMLib.dice().rollPercentage() < 15) mob.location().show(mob, null, CMMsg.MSG_NOISE, L("<S-NAME> sniff(s) at the air.")); } else deathTrail = null; } } }
public StringBuilder getInventory(MOB seer, MOB mob, String mask) { final StringBuilder msg = new StringBuilder(""); final InventoryList list = fetchInventory(seer, mob); if (((list.viewItems.size() > 0) || (list.moneyItems.size() > 0)) && (!list.foundAndSeen)) { list.viewItems.clear(); list.moneyItems.clear(); list.foundButUnseen = true; } else if ((mask != null) && (mask.trim().length() > 0)) { mask = mask.trim().toUpperCase(); if (!mask.startsWith("all")) mask = "all " + mask; final Vector<Item> V = (Vector<Item>) list.viewItems.clone(); list.viewItems.clear(); Item I = (V.size() > 0) ? (Item) V.get(0) : null; while (I != null) { I = (Item) CMLib.english().fetchEnvironmental(V, mask, false); if (I != null) { list.viewItems.add(I); V.remove(I); } } } if ((list.viewItems.size() == 0) && (list.moneyItems.size() == 0)) { if ((mask != null) && (mask.trim().length() > 0)) msg.append(L("(nothing like that you can see right now)")); else msg.append(L("(nothing you can see right now)")); } else { if (list.viewItems.size() > 0) msg.append( CMLib.lister() .lister( seer, list.viewItems, true, "MItem", "", false, seer.isAttribute(MOB.Attrib.COMPRESS))); if (list.foundButUnseen) msg.append(L("(stuff you can't see right now)")); msg.append(getShowableMoney(list)); } return msg; }