public void check(MOB mob, Armor A) { if (!layered) { checked = true; disabled = false; } if (A.amWearingAt(Wearable.IN_INVENTORY)) { checked = false; return; } if (checked) return; Item I = null; disabled = false; for (int i = 0; i < mob.numItems(); i++) { I = mob.getItem(i); if ((I instanceof Armor) && (!I.amWearingAt(Wearable.IN_INVENTORY)) && ((I.rawWornCode() & A.rawWornCode()) > 0) && (I != A)) { disabled = A.getClothingLayer() <= ((Armor) I).getClothingLayer(); if (disabled) { break; } } } checked = true; }
public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { if (!rightPlace(mob, auto)) 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) { CMMsg msg = CMClass.getMsg( mob, null, this, verbalCastCode(mob, null, auto), auto ? "" : "^S<S-NAME> chant(s) to the ground.^?"); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); buildMyThing(mob, mob.location()); } } else return beneficialWordsFizzle( mob, null, "<S-NAME> chant(s) to the ground, but nothing happens."); // return whether it worked return success; }
public boolean processFollow(MOB mob, MOB tofollow, boolean quiet) { if (mob == null) return false; Room R = mob.location(); if (R == null) return false; if (tofollow != null) { if (tofollow == mob) { return nofollow(mob, true, false); } if (mob.getGroupMembers(new HashSet<MOB>()).contains(tofollow)) { if (!quiet) mob.tell("You are already a member of " + tofollow.name() + "'s group!"); return false; } if (nofollow(mob, false, false)) { CMMsg msg = CMClass.getMsg( mob, tofollow, null, CMMsg.MSG_FOLLOW, quiet ? null : "<S-NAME> follow(s) <T-NAMESELF>."); if (R.okMessage(mob, msg)) R.send(mob, msg); else return false; } else return false; } else return nofollow(mob, !quiet, quiet); return true; }
public void unInvoke() { if ((affected == null) || (!(affected instanceof MOB))) return; MOB mob = (MOB) affected; super.unInvoke(); if (canBeUninvoked()) mob.tell("You begin to feel more like your regular cranky self."); }
public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { MOB 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); if (success) { // it worked, so build a copy of this ability, // and add it to the affects list of the // affected MOB. Then tell everyone else // what happened. CMMsg msg = CMClass.getMsg( mob, target, this, CMMsg.MSK_MALICIOUS_MOVE | CMMsg.TYP_PARALYZE | (auto ? CMMsg.MASK_ALWAYS : 0), auto ? "" : "^S<S-NAME> paralyze(s) <T-NAMESELF>.^?"); if (target.location().okMessage(target, msg)) { target.location().send(target, msg); if (msg.value() <= 0) { success = maliciousAffect(mob, target, asLevel, 5, -1); mob.location().show(target, null, CMMsg.MSG_OK_VISUAL, "<S-NAME> can't move!"); } } } else return maliciousFizzle( mob, target, "<S-NAME> attempt(s) to paralyze <T-NAMESELF>, but fail(s)!"); // return whether it worked return success; }
public boolean execute(MOB mob, Vector commands, int metaFlags) throws java.io.IOException { if (commands != null) commands.removeElementAt(0); if ((commands == null) || (commands.size() == 0)) { if (!CMLib.flags().isSleeping(mob)) mob.tell("You aren't sleeping!?"); else { CMMsg msg = CMClass.getMsg(mob, null, null, CMMsg.MSG_STAND, "<S-NAME> awake(s) and stand(s) up."); if (mob.location().okMessage(mob, msg)) mob.location().send(mob, msg); } } else { String whom = CMParms.combine(commands, 0); MOB M = mob.location().fetchInhabitant(whom); if ((M == null) || (!CMLib.flags().canBeSeenBy(M, mob))) { mob.tell("You don't see '" + whom + "' here."); return false; } if (!CMLib.flags().isSleeping(M)) { mob.tell(M.name() + " is awake!"); return false; } CMMsg msg = CMClass.getMsg( mob, M, null, CMMsg.MSG_NOISYMOVEMENT, "<S-NAME> attempt(s) to wake <T-NAME> up."); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); execute(M, null, metaFlags | Command.METAFLAG_ORDER); } } return false; }
public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { Physical target = getAnyTarget(mob, commands, givenTarget, Wearable.FILTER_ANY); if (target == null) return false; if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; boolean success = proficiencyCheck(mob, 0, auto); if (success) { // it worked, so build a copy of this ability, // and add it to the affects list of the // affected MOB. Then tell everyone else // what happened. CMMsg msg = CMClass.getMsg( mob, target, this, verbalCastCode(mob, target, auto), auto ? "" : "^S<S-NAME> " + prayWord(mob) + " to extinguish <T-NAMESELF>.^?"); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); CMLib.utensils().extinguish(mob, target, false); target.recoverPhyStats(); mob.location().recoverRoomStats(); } } else return beneficialWordsFizzle( mob, target, "<S-NAME> " + prayWord(mob) + " to extinguish <T-NAMESELF>, but nothing happens."); // return whether it worked return success; }
public void unInvoke() { if ((affected == null) || (!(affected instanceof MOB))) return; MOB mob = (MOB) affected; super.unInvoke(); if (canBeUninvoked()) mob.tell("You are no longer freezed!"); }
public boolean supportsMending(Physical item) { if (!(item instanceof MOB)) return false; MOB caster = CMClass.getFactoryMOB(); caster.basePhyStats().setLevel(CMProps.getIntVar(CMProps.SYSTEMI_LASTPLAYERLEVEL)); caster.phyStats().setLevel(CMProps.getIntVar(CMProps.SYSTEMI_LASTPLAYERLEVEL)); boolean canMend = returnOffensiveAffects(caster, item).size() > 0; caster.destroy(); return canMend; }
public boolean tick(Tickable ticking, int tickID) { if (!super.tick(ticking, tickID)) return false; if ((tickID == Tickable.TICKID_MOB) && (affected == spy)) { if (spy.amDead() || (spy.amFollowing() != invoker) || (!CMLib.flags().isInTheGame(spy, false))) unInvoke(); } return true; }
public void unInvoke() { // undo the affects of this spell if ((affected == null) || (!(affected instanceof MOB))) return; MOB mob = (MOB) affected; super.unInvoke(); if (canBeUninvoked()) mob.tell("The paralysis eases out of your muscles."); }
public void unInvoke() { // undo the affects of this spell if ((affected == null) || (!(affected instanceof MOB))) { super.unInvoke(); return; } MOB mob = (MOB) affected; if (canBeUninvoked()) mob.tell("Your summoning ward dissipates."); super.unInvoke(); }
public boolean okMessage(final Environmental myHost, final CMMsg msg) { if (!super.okMessage(myHost, msg)) return false; if (msg.amITarget(this)) { MOB mob = msg.source(); switch (msg.targetMinor()) { case CMMsg.TYP_DRINK: if ((mob.isMine(this)) || (phyStats().weight() > 1000) || (!CMLib.flags().isGettable(this))) { if (!containsDrink()) { mob.tell(name() + " is empty."); return false; } if ((liquidType() == RawMaterial.RESOURCE_SALTWATER) || (liquidType() == RawMaterial.RESOURCE_LAMPOIL)) { mob.tell( "You don't want to be drinking " + RawMaterial.CODES.NAME(liquidType()).toLowerCase() + "."); return false; } return true; } mob.tell("You don't have that."); return false; case CMMsg.TYP_FILL: if ((liquidRemaining() >= amountOfLiquidHeld) && (liquidHeld() < 500000)) { mob.tell(name() + " is full."); return false; } if ((msg.tool() != null) && (msg.tool() != msg.target()) && (msg.tool() instanceof Drink)) { Drink thePuddle = (Drink) msg.tool(); if (!thePuddle.containsDrink()) { mob.tell(thePuddle.name() + " is empty."); return false; } if ((liquidRemaining() > 0) && (liquidType() != thePuddle.liquidType())) { mob.tell( "There is still some " + RawMaterial.CODES.NAME(liquidType()).toLowerCase() + " left in " + name() + ". You must empty it before you can fill it with " + RawMaterial.CODES.NAME(thePuddle.liquidType()).toLowerCase() + "."); return false; } return true; } mob.tell("You can't fill " + name() + " from that."); return false; default: break; } } return true; }
public void unfollow(MOB mob, boolean quiet) { nofollow(mob, false, quiet); Vector V = new Vector(); for (int f = 0; f < mob.numFollowers(); f++) { MOB F = mob.fetchFollower(f); if (F != null) V.addElement(F); } for (int v = 0; v < V.size(); v++) { MOB F = (MOB) V.elementAt(v); nofollow(F, false, quiet); } }
public void unInvoke() { // undo the affects of this spell if ((affected == null) || (!(affected instanceof MOB))) { super.unInvoke(); return; } MOB mob = (MOB) affected; super.unInvoke(); if (canBeUninvoked()) if ((mob.location() != null) && (!mob.amDead())) mob.location().show(mob, null, CMMsg.MSG_OK_VISUAL, "<S-NAME> fade(s) back into view."); }
public void unInvoke() { // undo the affects of this spell if ((affected == null) || (!(affected instanceof MOB))) return; MOB mob = (MOB) affected; super.unInvoke(); if ((canBeUninvoked()) && (mob.location() != null)) { if ((failed) || (!CMLib.flags().isSitting(mob)) || (room == null) || (title == null) || (mob.location() != room)) mob.tell("You are no longer squatting."); else if (title.landOwner().length() > 0) { mob.tell( "Your squat has succeeded. This property no longer belongs to " + title.landOwner() + "."); title.setLandOwner(""); title.updateTitle(); title.updateLot(null); } else if (title.landOwner().length() > 0) { mob.tell("Your squat has succeeded. This property now belongs to you."); title.setLandOwner(mob.Name()); title.updateTitle(); title.updateLot(new XVector(mob.name())); } } failed = false; }
public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { String dir = CMParms.combine(commands, 0); if (commands.size() > 0) dir = (String) commands.lastElement(); int dirCode = Directions.getGoodDirectionCode(dir); if (!preInvoke(mob, commands, givenTarget, auto, asLevel, 0, 0.0)) return false; MOB highestMOB = getHighestLevelMOB(mob, null); int levelDiff = mob.phyStats().level() + (2 * super.getXLEVELLevel(mob)) - getMOBLevel(highestMOB); if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; boolean success = false; CMMsg msg = CMClass.getMsg( mob, null, this, auto ? CMMsg.MSG_OK_VISUAL : CMMsg.MSG_DELICATE_HANDS_ACT, "<S-NAME> walk(s) carefully " + Directions.getDirectionName(dirCode) + "."); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); if (levelDiff < 0) levelDiff = levelDiff * 8; else levelDiff = levelDiff * 10; success = proficiencyCheck(mob, levelDiff, auto); int oldDex = mob.baseCharStats().getStat(CharStats.STAT_DEXTERITY); if (success) mob.baseCharStats().setStat(CharStats.STAT_DEXTERITY, oldDex + 100); mob.recoverCharStats(); CMLib.tracking().walk(mob, dirCode, false, false); if (oldDex != mob.baseCharStats().getStat(CharStats.STAT_DEXTERITY)) mob.baseCharStats().setStat(CharStats.STAT_DEXTERITY, oldDex); mob.recoverCharStats(); } return success; }
public boolean execute(MOB mob, Vector commands, int metaFlags) throws java.io.IOException { if (!mob.isMonster()) { if ((CMath.bset(mob.getBitmap(), MOB.ATT_MXP)) || (mob.session().clientTelnetMode(Session.TELNET_MXP))) { if (mob.session().clientTelnetMode(Session.TELNET_MXP)) mob.session().rawOut("\033[3z \033[7z"); mob.setBitmap(CMath.unsetb(mob.getBitmap(), MOB.ATT_MXP)); mob.session().changeTelnetMode(Session.TELNET_MXP, false); mob.session().setClientTelnetMode(Session.TELNET_MXP, false); mob.tell("MXP codes are disabled.\n\r"); } else mob.tell("MXP codes are already disabled.\n\r"); } return false; }
public boolean tick(Tickable ticking, int tickID) { if ((affected != null) && (affected instanceof Room)) { Room R = (Room) affected; if ((R.myResource() & RawMaterial.MATERIAL_MASK) == RawMaterial.MATERIAL_VEGETATION) for (int m = 0; m < R.numInhabitants(); m++) { MOB M = R.fetchInhabitant(m); if (M != null) { Ability A = M.fetchEffect("Farming"); if (A == null) A = M.fetchEffect("Foraging"); if (A != null) A.setAbilityCode(2); } } } return super.tick(ticking, tickID); }
public void executeMsg(Environmental host, CMMsg msg) { if (affected instanceof MOB) { MOB mob = (MOB) affected; if ((msg.source() == mob) && (msg.target() == mob.location()) && (msg.targetMinor() == CMMsg.TYP_LEAVE)) { failed = true; unInvoke(); } else if ((CMLib.flags().isStanding(mob)) || (mob.location() != room)) { failed = true; unInvoke(); } } super.executeMsg(host, msg); }
public static Item buildPlant(MOB mob, Room room) { Item newItem = CMClass.getItem("GenItem"); newItem.setMaterial(RawMaterial.RESOURCE_GREENS); switch (CMLib.dice().roll(1, 5, 0)) { case 1: newItem.setName("some happy flowers"); newItem.setDisplayText("some happy flowers are growing here."); newItem.setDescription("Happy flowers with little red and yellow blooms."); break; case 2: newItem.setName("some happy weeds"); newItem.setDisplayText("some happy weeds are growing here."); newItem.setDescription("Long stalked little plants with tiny bulbs on top."); break; case 3: newItem.setName("a pretty fern"); newItem.setDisplayText("a pretty fern is growing here."); newItem.setDescription("Like a tiny bush, this dark green plant is lovely."); break; case 4: newItem.setName("a patch of sunflowers"); newItem.setDisplayText("a patch of sunflowers is growing here."); newItem.setDescription("Happy flowers with little yellow blooms."); break; case 5: newItem.setName("a patch of bluebonnets"); newItem.setDisplayText("a patch of bluebonnets is growing here."); newItem.setDescription("Happy flowers with little blue and purple blooms."); break; } Chant_SummonPlants newChant = new Chant_SummonPlants(); newItem.basePhyStats().setLevel(10 + (10 * newChant.getX1Level(mob))); newItem.basePhyStats().setWeight(1); newItem.setSecretIdentity(mob.Name()); newItem.setMiscText(newItem.text()); room.addItem(newItem); newItem.setExpirationDate(0); room.showHappens(CMMsg.MSG_OK_ACTION, "Suddenly, " + newItem.name() + " sprout(s) up here."); newChant.PlantsLocation = room; newChant.littlePlants = newItem; if (CMLib.law().doesOwnThisProperty(mob, room)) { newChant.setInvoker(mob); newChant.setMiscText(mob.Name()); newItem.addNonUninvokableEffect(newChant); } else newChant.beneficialAffect(mob, newItem, 0, (newChant.adjustedLevel(mob, 0) * 240) + 450); room.recoverPhyStats(); return newItem; }
public void unInvoke() { // undo the affects of this spell if ((affected == null) || (!(affected instanceof MOB))) return; MOB mob = (MOB) affected; super.unInvoke(); if (canBeUninvoked()) { mob.location() .show( mob, null, CMMsg.MSG_NOISYMOVEMENT, "<S-NAME> manage(s) to break <S-HIS-HER> way free of the repulsion field."); CMLib.commands().postStand(mob, true); } }
public static void pickAWimpyFight( MOB observer, boolean mobKiller, boolean misBehave, String attackMsg, String zapStr) { if (!canFreelyBehaveNormal(observer)) return; Room R = observer.location(); if (R != null) for (int i = 0; i < R.numInhabitants(); i++) { MOB mob = R.fetchInhabitant(i); if ((mob != null) && (mob != observer) && (CMLib.flags().isSleeping(mob)) && (CMLib.masking().maskCheck(zapStr, observer, false))) { startFight(observer, mob, mobKiller, misBehave, attackMsg); if (observer.isInCombat()) break; } } }
public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { MOB 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); CMMsg msg2 = null; if ((mob != target) && (!mob.getGroupMembers(new HashSet<MOB>()).contains(target))) msg2 = CMClass.getMsg( mob, target, this, verbalCastCode(mob, target, auto) | CMMsg.MASK_MALICIOUS, "<T-NAME> do(es) not seem to like <S-NAME> messing with <T-HIS-HER> head."); if (success && (CMLib.factions().getFaction(CMLib.factions().AlignID()) != null)) { // it worked, so build a copy of this ability, // and add it to the affects list of the // affected MOB. Then tell everyone else // what happened. CMMsg msg = CMClass.getMsg( mob, target, this, verbalCastCode(mob, target, auto), (auto ? "<T-NAME> feel(s) more good." : "^S<S-NAME> " + prayWord(mob) + " to atone <T-NAMESELF>!^?")); if ((mob.location().okMessage(mob, msg)) && ((msg2 == null) || (mob.location().okMessage(mob, msg2)))) { mob.location().send(mob, msg); if ((msg.value() <= 0) && ((msg2 == null) || (msg2.value() <= 0))) { target.tell("Good, pure thoughts fill your head."); int evilness = CMLib.dice().roll(10, adjustedLevel(mob, asLevel), 0); CMLib.factions().postFactionChange(target, this, CMLib.factions().AlignID(), evilness); } if (msg2 != null) mob.location().send(mob, msg2); } } else { if ((msg2 != null) && (mob.location().okMessage(mob, msg2))) mob.location().send(mob, msg2); return beneficialWordsFizzle( mob, target, "<S-NAME> point(s) at <T-NAMESELF> and " + prayWord(mob) + ", but nothing happens."); } // return whether it worked return success; }
public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { Set<MOB> h = properTargets(mob, givenTarget, false); if (h == null) { mob.tell("There doesn't appear to be anyone here worth floating."); return false; } // the invoke method for spells receives as // parameters the invoker, and the REMAINING // command line parameters, divided into words, // and added as String objects to a vector. if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; boolean success = proficiencyCheck(mob, 0, auto); if (success) { if (mob.location() .show( mob, null, this, verbalCastCode(mob, null, auto), auto ? "" : "^S<S-NAME> wave(s) <S-HIS-HER> arms and speak(s) lightly.^?")) for (Iterator f = h.iterator(); f.hasNext(); ) { MOB target = (MOB) f.next(); // it worked, so build a copy of this ability, // and add it to the affects list of the // affected MOB. Then tell everyone else // what happened. CMMsg msg = CMClass.getMsg(mob, target, this, verbalCastCode(mob, target, auto), null); if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); Spell_FeatherFall fall = new Spell_FeatherFall(); fall.setProficiency(proficiency()); fall.beneficialAffect(mob, target, asLevel, 0); } } } else return beneficialWordsFizzle( mob, null, "<S-NAME> wave(s) <S-HIS-HER> arms and speak(s) lightly, but the spell fizzles."); // return whether it worked return success; }
public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { boolean foundOne = false; for (int a = 0; a < mob.numEffects(); a++) // personal affects { Ability A = mob.fetchEffect(a); if ((A != null) && (A instanceof Play)) foundOne = true; } if (!foundOne) { mob.tell(auto ? "There is noone playing." : "You aren't playing anything."); return true; } unplayAll(mob, mob); mob.location() .show(mob, null, CMMsg.MSG_NOISE, auto ? "Silence." : "<S-NAME> stop(s) playing."); mob.location().recoverRoomStats(); return true; }
public int castingQuality(MOB mob, Physical target) { if (mob != null) { if (!rightPlace(mob, false)) return Ability.QUALITY_INDIFFERENT; Item myPlant = Druid_MyPlants.myPlant(mob.location(), mob, 0); if (myPlant == null) return super.castingQuality(mob, target, Ability.QUALITY_BENEFICIAL_SELF); } return super.castingQuality(mob, target); }
public boolean nofollow(MOB mob, boolean errorsOk, boolean quiet) { if (mob == null) return false; Room R = mob.location(); if (R == null) return false; if (mob.amFollowing() != null) { CMMsg msg = CMClass.getMsg( mob, mob.amFollowing(), null, CMMsg.MSG_NOFOLLOW, quiet ? null : "<S-NAME> stop(s) following <T-NAMESELF>."); // no room OKaffects, since the damn leader may not be here. if (mob.okMessage(mob, msg)) R.send(mob, msg); else return false; } else if (errorsOk) mob.tell("You aren't following anyone!"); return true; }
public int castingQuality(MOB mob, Physical target) { if (mob != null) { Room R = mob.location(); if (R != null) { if (CMath.bset(weatherQue(R), WEATHERQUE_RAIN)) return super.castingQuality(mob, target, Ability.QUALITY_BENEFICIAL_SELF); } } return super.castingQuality(mob, target); }
public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { Physical target = null; if (commands.size() > 0) { String s = CMParms.combine(commands, 0); if (s.equalsIgnoreCase("room")) target = mob.location(); else if (s.equalsIgnoreCase("here")) target = mob.location(); else if (CMLib.english().containsString(mob.location().ID(), s) || CMLib.english().containsString(mob.location().name(), s) || CMLib.english().containsString(mob.location().displayText(), s)) target = mob.location(); } if (target == null) target = getTarget(mob, commands, givenTarget); if (target == null) return false; if ((target instanceof Room) && (target.fetchEffect(ID()) != null)) { mob.tell("This place is already under a summoning ward."); return false; } if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false; boolean success = proficiencyCheck(mob, 0, auto); if (success) { CMMsg msg = CMClass.getMsg( mob, target, this, verbalCastCode(mob, target, auto), auto ? "<T-NAME> seem(s) magically protected." : "^S<S-NAME> invoke(s) a summoning ward upon <T-NAMESELF>.^?"); if (target instanceof Room) quality = Ability.QUALITY_MALICIOUS; if (mob.location().okMessage(mob, msg)) { mob.location().send(mob, msg); if ((target instanceof Room) && ((CMLib.law().doesOwnThisProperty(mob, ((Room) target))))) { target.addNonUninvokableEffect((Ability) this.copyOf()); CMLib.database().DBUpdateRoom((Room) target); } else { beneficialAffect(mob, target, asLevel, 0); if (target instanceof Room) { Spell_SummoningWard A = (Spell_SummoningWard) target.fetchEffect(ID()); if (A != null) A.quality = Ability.QUALITY_MALICIOUS; } } } } else beneficialWordsFizzle( mob, target, "<S-NAME> attempt(s) to invoke a summoning ward, but fail(s)."); quality = Ability.QUALITY_INDIFFERENT; return success; }