示例#1
0
  public InvisibleStalker() {
    super();
    Random randomizer = new Random(System.currentTimeMillis());

    username = "******";
    setDescription("A shimmering blob of energy.");
    setDisplayText("An invisible stalker hunts here.");
    CMLib.factions().setAlignment(this, Faction.ALIGN_NEUTRAL);
    setMoney(0);
    basePhyStats.setWeight(10 + Math.abs(randomizer.nextInt() % 10));

    baseCharStats().setStat(CharStats.STAT_INTELLIGENCE, 12 + Math.abs(randomizer.nextInt() % 3));
    baseCharStats().setStat(CharStats.STAT_STRENGTH, 20);
    baseCharStats().setStat(CharStats.STAT_DEXTERITY, 13);

    basePhyStats().setDamage(16);
    basePhyStats().setSpeed(1.0);
    basePhyStats().setAbility(0);
    basePhyStats().setLevel(4);
    basePhyStats().setArmor(0);
    basePhyStats().setDisposition(basePhyStats().disposition() | PhyStats.IS_INVISIBLE);

    baseState.setHitPoints(CMLib.dice().roll(basePhyStats().level(), 20, basePhyStats().level()));

    addBehavior(CMClass.getBehavior("Aggressive"));
    addBehavior(CMClass.getBehavior("Mobile"));

    recoverMaxState();
    resetToMaxState();
    recoverPhyStats();
    recoverCharStats();
  }
示例#2
0
文件: Wake.java 项目: Cocanuta/Marble
 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;
 }
示例#3
0
  public HeavenlyServent() {
    super();

    Random randomizer = new Random(System.currentTimeMillis());

    username = "******";
    setDescription(
        "An angelic form in gowns of white, with golden hair, and an ever present smile.");
    setDisplayText("A servant of the Archons is running errands.");
    CMLib.factions().setAlignment(this, Faction.ALIGN_NEUTRAL);
    setMoney(0);
    basePhyStats.setWeight(20 + Math.abs(randomizer.nextInt() % 55));
    setWimpHitPoint(2);

    addBehavior(CMClass.getBehavior("Mobile"));
    addBehavior(CMClass.getBehavior("MudChat"));

    basePhyStats().setDamage(25);

    basePhyStats().setAbility(0);
    basePhyStats().setLevel(10);
    basePhyStats().setArmor(0);
    baseCharStats().setMyRace(CMClass.getRace("Human"));
    baseCharStats().getMyRace().startRacing(this, false);

    baseState.setHitPoints(CMLib.dice().roll(basePhyStats().level(), 20, basePhyStats().level()));

    recoverMaxState();
    resetToMaxState();
    recoverPhyStats();
    recoverCharStats();
  }
示例#4
0
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {

    if (commands.size() < 1) {
      mob.tell("Chant to whom?");
      return false;
    }
    String mobName = CMParms.combine(commands, 0).trim().toUpperCase();
    MOB target = getTarget(mob, commands, givenTarget);

    Room newRoom = mob.location();
    if (target != null) {
      newRoom = target.location();
      if ((!CMLib.flags().isAnimalIntelligence(target)) || (target.amFollowing() != mob)) {
        mob.tell("You have no animal follower named '" + mobName + "' here.");
        return false;
      }
    } else {
      mob.tell("You have no animal follower named '" + mobName + "' here.");
      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
                  ? ""
                  : "^S<S-NAME> chant(s) to <T-NAMESELF>, invoking the a mystical connection.^?");
      CMMsg msg2 = CMClass.getMsg(mob, target, this, verbalCastCode(mob, target, auto), null);
      if ((mob.location().okMessage(mob, msg))
          && ((newRoom == mob.location()) || (newRoom.okMessage(mob, msg2)))) {
        mob.location().send(mob, msg);
        if (newRoom != mob.location()) newRoom.send(target, msg2);
        spy = target;
        beneficialAffect(mob, spy, asLevel, 0);
        Ability A = spy.fetchEffect(ID());
        if (A != null) {
          mob.addNonUninvokableEffect((Ability) A.copyOf());
          A.setAffectedOne(spy);
        }
      }

    } else
      beneficialVisualFizzle(
          mob, target, "<S-NAME> chant(s) to <T-NAMESELF>, but the magic fades.");

    // return whether it worked
    return success;
  }
示例#5
0
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    if (mob.fetchEffect("Thief_Hide") != null) {
      mob.tell("You are already hiding.");
      return false;
    }

    if (mob.isInCombat()) {
      mob.tell("Not while in combat!");
      return false;
    }

    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    Set<MOB> H = mob.getGroupMembers(new HashSet<MOB>());
    if (!H.contains(mob)) H.add(mob);
    int numBesidesMe = 0;
    for (Iterator e = H.iterator(); e.hasNext(); ) {
      MOB M = (MOB) e.next();
      if ((M != mob) && (mob.location().isInhabitant(M))) numBesidesMe++;
    }
    if (numBesidesMe == 0) {
      mob.tell("You need a group to set up an ambush!");
      return false;
    }
    for (int i = 0; i < mob.location().numInhabitants(); i++) {
      MOB M = mob.location().fetchInhabitant(i);
      if ((M != null) && (M != mob) && (!H.contains(M)) && (CMLib.flags().canSee(M))) {
        mob.tell(M, null, null, "<S-NAME> is watching you too closely.");
        return false;
      }
    }
    boolean success = proficiencyCheck(mob, 0, auto);

    if (!success)
      beneficialVisualFizzle(mob, null, "<S-NAME> attempt(s) to set up an ambush, but fail(s).");
    else {
      CMMsg msg =
          CMClass.getMsg(
              mob,
              null,
              this,
              auto ? CMMsg.MSG_OK_ACTION : (CMMsg.MSG_DELICATE_HANDS_ACT | CMMsg.MASK_MOVE),
              "<S-NAME> set(s) up an ambush, directing everyone to hiding places.");
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        invoker = mob;
        Ability hide = CMClass.getAbility("Thief_Hide");
        for (Iterator e = H.iterator(); e.hasNext(); ) {
          MOB M = (MOB) e.next();
          hide.invoke(M, M, true, adjustedLevel(mob, asLevel));
        }
      } else success = false;
    }
    return success;
  }
示例#6
0
  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;
  }
示例#7
0
  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;
  }
示例#8
0
  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;
  }
示例#9
0
  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;
  }
示例#10
0
 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;
 }
示例#11
0
 public ClanPosition addPosition() {
   Authority[] pows = new Authority[Function.values().length];
   for (int i = 0; i < pows.length; i++) pows[i] = Authority.CAN_NOT_DO;
   Set<Integer> roles = new HashSet<Integer>();
   int highestRank = 0;
   for (ClanPosition pos : positions) {
     roles.add(Integer.valueOf(pos.getRoleID()));
     if (highestRank < pos.getRank()) highestRank = pos.getRank();
   }
   if (positions.length > 0)
     for (int i = 0; i < pows.length; i++) pows[i] = positions[0].getFunctionChart()[i];
   positions = Arrays.copyOf(positions, positions.length + 1);
   ClanPosition P = (ClanPosition) CMClass.getCommon("DefaultClanPosition");
   P.setID(positions.length + "" + Math.random());
   P.setRoleID(0);
   P.setRank(highestRank);
   P.setName("Unnamed");
   P.setPluralName("Unnameds");
   P.setMax(Integer.MAX_VALUE);
   P.setInnerMaskStr("");
   P.setFunctionChart(pows);
   P.setPublic(true);
   positions[positions.length - 1] = P;
   for (int i = 0; i < positions.length; i++)
     if (!roles.contains(Integer.valueOf(i))) {
       P.setRoleID(i);
       break;
     }
   return P;
 }
示例#12
0
  public List<Ability> getClanLevelEffectsList(final MOB mob, final Integer level) {
    if (clanEffectNames == null) return empty;

    if ((clanEffectMap == null)
        && (clanEffectNames != null)
        && (clanEffectLevels != null)
        && (clanEffectParms != null)) clanEffectMap = new Hashtable<Integer, List<Ability>>();

    if (clanEffectMap == null) return empty;

    if (clanEffectMap.containsKey(level)) return clanEffectMap.get(level);
    final CMObjUniqSortSVec<Ability> finalV = new CMObjUniqSortSVec<Ability>();
    for (int v = 0; v < clanEffectLevels.length; v++) {
      if ((clanEffectLevels[v] <= level.intValue())
          && (clanEffectNames.length > v)
          && (clanEffectParms.length > v)) {
        Ability A = CMClass.getAbility(clanEffectNames[v]);
        if (A != null) {
          // mob was set to null here to make the cache map actually relevant .. see caching below
          A.setProficiency(CMLib.ableMapper().getMaxProficiency((MOB) null, true, A.ID()));
          A.setMiscText(clanEffectParms[v]);
          A.makeNonUninvokable();
          A.setSavable(false); // must go AFTER the ablve
          finalV.add(A);
        }
      }
    }
    finalV.trimToSize();
    clanEffectMap.put(level, finalV);
    return finalV;
  }
示例#13
0
  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;
  }
示例#14
0
 public Weapon myNaturalWeapon() {
   if (naturalWeapon == null) {
     naturalWeapon = CMClass.getWeapon("StdWeapon");
     naturalWeapon.setName("sharp claws");
     naturalWeapon.setWeaponType(Weapon.TYPE_SLASHING);
   }
   return naturalWeapon;
 }
示例#15
0
 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;
 }
示例#16
0
 public void executeMsg(final Environmental myHost, final CMMsg msg) {
   if ((msg.amITarget(littlePlants)) && (msg.targetMinor() == CMMsg.TYP_GET))
     msg.addTrailerMsg(
         CMClass.getMsg(
             msg.source(),
             littlePlants,
             null,
             CMMsg.MSG_OK_VISUAL,
             CMMsg.MASK_ALWAYS | CMMsg.MSG_DEATH,
             CMMsg.NO_EFFECT,
             null));
 }
示例#17
0
 public Item buildMyThing(MOB mob, Room room) {
   Area A = room.getArea();
   boolean bonusWorthy = (Druid_MyPlants.myPlant(room, mob, 0) == null);
   Vector V = Druid_MyPlants.myAreaPlantRooms(mob, room.getArea());
   int pct = 0;
   if (A.getAreaIStats()[Area.Stats.VISITABLE_ROOMS.ordinal()] > 10)
     pct =
         (int)
             Math.round(
                 100.0
                     * CMath.div(
                         V.size(), A.getAreaIStats()[Area.Stats.VISITABLE_ROOMS.ordinal()]));
   Item I = buildMyPlant(mob, room);
   if ((I != null)
       && ((mob.charStats().getCurrentClass().baseClass().equalsIgnoreCase("Druid"))
           || (CMSecurity.isASysOp(mob)))) {
     if (!CMLib.law().isACity(A)) {
       if (pct > 0) {
         int newPct =
             (int)
                 Math.round(
                     100.0
                         * CMath.div(
                             V.size(), A.getAreaIStats()[Area.Stats.VISITABLE_ROOMS.ordinal()]));
         if ((newPct >= 50) && (A.fetchEffect("Chant_DruidicConnection") == null)) {
           Ability A2 = CMClass.getAbility("Chant_DruidicConnection");
           if (A2 != null) A2.invoke(mob, A, true, 0);
         }
       }
     } else if ((bonusWorthy) && (!mob.isMonster())) {
       long[] num = (long[]) plantBonuses.get(mob.Name() + "/" + room.getArea().Name());
       if ((num == null)
           || (System.currentTimeMillis() - num[1]
               > (room.getArea().getTimeObj().getDaysInMonth()
                   * room.getArea().getTimeObj().getHoursInDay()
                   * CMProps.getMillisPerMudHour()))) {
         num = new long[2];
         plantBonuses.remove(mob.Name() + "/" + room.getArea().Name());
         plantBonuses.put(mob.Name() + "/" + room.getArea().Name(), num);
         num[1] = System.currentTimeMillis();
       }
       if (V.size() >= num[0]) {
         num[0]++;
         if (num[0] < 19) {
           mob.tell("You have made this city greener.");
           CMLib.leveler().postExperience(mob, null, null, (int) num[0], false);
         }
       }
     }
   }
   return I;
 }
示例#18
0
  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;
  }
示例#19
0
  public List<Ability> returnOffensiveAffects(MOB caster, Physical fromMe) {
    MOB newMOB = CMClass.getFactoryMOB();
    MOB newerMOB = CMClass.getFactoryMOB();
    Vector offenders = new Vector(1);

    CMMsg msg = CMClass.getMsg(newMOB, newerMOB, null, CMMsg.MSG_LOOK, null);
    for (int a = 0; a < fromMe.numEffects(); a++) // personal
    {
      Ability A = fromMe.fetchEffect(a);
      if (A != null) {
        newMOB.recoverPhyStats();
        A.affectPhyStats(newMOB, newMOB.phyStats());
        if ((!CMLib.flags().canSee(newMOB)) || (!A.okMessage(newMOB, msg)))
          if ((A.invoker() == null)
              || ((A.invoker() != null)
                  && (A.invoker().phyStats().level())
                      <= (caster.phyStats().level() + 1 + (2 * getXLEVELLevel(caster)))))
            offenders.addElement(A);
      }
    }
    newMOB.destroy();
    newerMOB.destroy();
    return offenders;
  }
示例#20
0
 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;
 }
示例#21
0
  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;
  }
示例#22
0
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {

    int type = mob.location().domainType();
    if (((type & Room.INDOORS) > 0)
        || (type == Room.DOMAIN_OUTDOORS_AIR)
        || (type == Room.DOMAIN_OUTDOORS_CITY)
        || (type == Room.DOMAIN_OUTDOORS_SPACEPORT)
        || (type == Room.DOMAIN_OUTDOORS_UNDERWATER)
        || (type == Room.DOMAIN_OUTDOORS_WATERSURFACE)) {
      mob.tell("That magic won't work here.");
      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,
              mob.location(),
              this,
              verbalCastCode(mob, mob.location(), auto),
              auto ? "" : "^S<S-NAME> " + prayForWord(mob) + " to make the land fruitful.^?");
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        beneficialAffect(
            mob,
            mob.location(),
            asLevel,
            CMLib.ableMapper().qualifyingClassLevel(mob, this)
                * (int)
                    ((CMProps.getMillisPerMudHour()
                            * ((long) mob.location().getArea().getTimeObj().getHoursInDay()))
                        / CMProps.getTickMillis()));
      }

    } else
      beneficialWordsFizzle(
          mob,
          null,
          "<S-NAME> " + prayForWord(mob) + " to make the land fruitful, but nothing happens.");

    // return whether it worked
    return success;
  }
示例#23
0
 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;
 }
示例#24
0
  public void executeMsg(final Environmental myHost, final CMMsg msg) {
    try {
      super.executeMsg(myHost, msg);
      if (spy == null) return;
      if (invoker == null) return;

      if ((msg.amISource(spy))
          && ((msg.sourceMinor() == CMMsg.TYP_LOOK) || (msg.sourceMinor() == CMMsg.TYP_EXAMINE))
          && (msg.target() != null)
          && ((invoker.location() != spy.location()) || (!(msg.target() instanceof Room)))) {
        disable = true;
        CMMsg newAffect = CMClass.getMsg(invoker, msg.target(), msg.sourceMinor(), null);
        msg.target().executeMsg(invoker, newAffect);
      } else if ((!msg.amISource(invoker))
          && (invoker.location() != spy.location())
          && (msg.source().location() == spy.location())
          && (msg.othersCode() != CMMsg.NO_EFFECT)
          && (msg.othersMessage() != null)
          && (!disable)) {
        disable = true;
        invoker.executeMsg(invoker, msg);
      } else if (msg.amISource(invoker)
          && (!disable)
          && (msg.sourceMinor() == CMMsg.TYP_SPEAK)
          && (msg.sourceMessage() != null)
          && ((msg.sourceMajor() & CMMsg.MASK_MAGIC) == 0)) {
        int start = msg.sourceMessage().indexOf("\'");
        int end = msg.sourceMessage().lastIndexOf("\'");
        if ((start > 0) && (end > start)) {
          String msg2 = msg.sourceMessage().substring(start + 1, end).trim();
          if (msg2.length() > 0)
            spy.enqueCommand(CMParms.parse(msg2.trim()), Command.METAFLAG_FORCED, 0);
        }
      }
    } finally {
      disable = false;
      if ((spy != null)
          && ((spy.amFollowing() != invoker)
              || (spy.amDead())
              || (!CMLib.flags().isInTheGame(spy, false))
              || (!CMLib.flags().isInTheGame(invoker, true)))) unInvoke();
    }
  }
示例#25
0
  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;
    Room R = CMLib.map().roomLocation(target);
    if (R == null) R = mob.location();

    // 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;

    if ((auto) && (givenTarget != null) && (givenTarget instanceof MOB)) target = (MOB) givenTarget;
    // now see if it worked
    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> speak(s) and gesture(s) to <T-NAMESELF>.^?");
      if (R.okMessage(mob, msg)) {
        R.send(mob, msg);
        R.show(target, null, CMMsg.MSG_OK_VISUAL, "<S-NAME> seem(s) much more likeable!");
        beneficialAffect(mob, target, asLevel, 0);
      }
    } else
      return beneficialWordsFizzle(
          mob, target, "<S-NAME> incant(s) gracefully to <T-NAMESELF>, but nothing more happens.");

    // return whether it worked
    return success;
  }
示例#26
0
 public boolean tick(Tickable ticking, int tickID) {
   if (!super.tick(ticking, tickID)) return false;
   if ((tickID == Tickable.TICKID_MOB) && (affected != null) && (affected instanceof MOB)) {
     MOB mob = (MOB) affected;
     if ((mob.isInCombat())
         && (CMLib.flags().aliveAwakeMobileUnbound(mob, true))
         && (mob.rangeToTarget() == 0)
         && (mob.charStats().getBodyPart(Race.BODY_HAND) > 1)
         && (!anyWeapons(mob))) {
       if (CMLib.dice().rollPercentage() > 95) helpProficiency(mob, 0);
       if ((naturalWeapon == null) || (naturalWeapon.amDestroyed())) {
         naturalWeapon = CMClass.getWeapon("GenWeapon");
         naturalWeapon.setName("a knife hand");
         naturalWeapon.setWeaponType(Weapon.TYPE_PIERCING);
         naturalWeapon.basePhyStats().setDamage(7);
         naturalWeapon.recoverPhyStats();
       }
       CMLib.combat().postAttack(mob, mob.getVictim(), naturalWeapon);
     }
   }
   return true;
 }
示例#27
0
  public boolean preInvoke(
      MOB mob,
      List<String> commands,
      Physical givenTarget,
      boolean auto,
      int asLevel,
      int secondsElapsed,
      double actionsRemaining) {
    if (secondsElapsed == 0) {
      String dir = CMParms.combine(commands, 0);
      if (commands.size() > 0) dir = (String) commands.get(commands.size() - 1);
      int dirCode = Directions.getGoodDirectionCode(dir);
      if (dirCode < 0) {
        mob.tell("Step where?");
        return false;
      }
      if (mob.isInCombat()) {
        mob.tell("Not while you are fighting!");
        return false;
      }

      if ((mob.location().getRoomInDir(dirCode) == null)
          || (mob.location().getExitInDir(dirCode) == null)) {
        mob.tell("Step where?");
        return false;
      }
      CMMsg msg =
          CMClass.getMsg(
              mob,
              null,
              this,
              auto ? CMMsg.MSG_OK_VISUAL : CMMsg.MSG_DELICATE_HANDS_ACT,
              "<S-NAME> start(s) walking carefully " + Directions.getDirectionName(dirCode) + ".");
      if (mob.location().okMessage(mob, msg)) mob.location().send(mob, msg);
      else return false;
    }
    return true;
  }
示例#28
0
 public List<Ability> getClanLevelAbilities(Integer level) {
   if ((clanAbilityMap == null)
       && (clanAbilityNames != null)
       && (clanAbilityLevels != null)
       && (clanAbilityProficiencies != null)
       && (clanAbilityQuals != null)) {
     CMLib.ableMapper().delCharMappings(ID()); // necessary for a "clean start"
     clanAbilityMap = new Hashtable<Integer, List<Ability>>();
     for (int i = 0; i < clanAbilityNames.length; i++) {
       CMLib.ableMapper()
           .addDynaAbilityMapping(
               ID(),
               clanAbilityLevels[i],
               clanAbilityNames[i],
               clanAbilityProficiencies[i],
               "",
               !clanAbilityQuals[i],
               false);
     }
   }
   if (clanAbilityMap == null) return empty;
   if (clanAbilityMap.containsKey(level)) return clanAbilityMap.get(level);
   List<AbilityMapper.AbilityMapping> V =
       CMLib.ableMapper().getUpToLevelListings(ID(), level.intValue(), true, true);
   CMObjUniqSortSVec<Ability> finalV = new CMObjUniqSortSVec<Ability>();
   for (AbilityMapper.AbilityMapping able : V) {
     Ability A = CMClass.getAbility(able.abilityID);
     if (A != null) {
       A.setProficiency(CMLib.ableMapper().getDefaultProficiency(ID(), false, A.ID()));
       A.setSavable(false);
       A.setMiscText(CMLib.ableMapper().getDefaultParm(ID(), false, A.ID()));
       finalV.add(A);
     }
   }
   finalV.trimToSize();
   clanAbilityMap.put(level, finalV);
   return finalV;
 }
示例#29
0
文件: Wear.java 项目: Cocanuta/Marble
 public boolean wear(MOB mob, Item item, int locationIndex, boolean quiet) {
   String str = "<S-NAME> put(s) on <T-NAME>.";
   int msgType = CMMsg.MSG_WEAR;
   if (item.rawProperLocationBitmap() == Wearable.WORN_HELD) {
     str = "<S-NAME> hold(s) <T-NAME>.";
     msgType = CMMsg.MSG_HOLD;
   } else if ((item.rawProperLocationBitmap() == Wearable.WORN_WIELD)
       || (item.rawProperLocationBitmap() == (Wearable.WORN_HELD | Wearable.WORN_WIELD))) {
     str = "<S-NAME> wield(s) <T-NAME>.";
     msgType = CMMsg.MSG_WIELD;
   } else if (locationIndex != 0)
     str =
         "<S-NAME> put(s) <T-NAME> on <S-HIS-HER> "
             + Wearable.CODES.NAME(locationIndex).toLowerCase()
             + ".";
   CMMsg newMsg = CMClass.getMsg(mob, item, null, msgType, quiet ? null : str);
   newMsg.setValue(locationIndex);
   if (mob.location().okMessage(mob, newMsg)) {
     mob.location().send(mob, newMsg);
     return true;
   }
   return false;
 }
示例#30
0
  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);
    List<Ability> offensiveAffects = returnOffensiveAffects(mob, target);

    if ((success) && (offensiveAffects.size() > 0)) {
      // 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
                  ? "A visible glow surrounds <T-NAME>."
                  : "^S<S-NAME> " + prayWord(mob) + " for <T-NAMESELF> to see the light.^?");
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        for (int a = offensiveAffects.size() - 1; a >= 0; a--)
          ((Ability) offensiveAffects.get(a)).unInvoke();
      }
    } else
      beneficialWordsFizzle(
          mob,
          target,
          auto ? "" : "<S-NAME> " + prayWord(mob) + " for <T-NAMESELF>, but nothing happens.");

    // return whether it worked
    return success;
  }