コード例 #1
0
ファイル: Swamp.java プロジェクト: renokun/CoffeeMud
 @Override
 public void executeMsg(final Environmental myHost, final CMMsg msg) {
   if ((msg.amITarget(this)
           || (msg.targetMinor() == CMMsg.TYP_ADVANCE)
           || (msg.targetMinor() == CMMsg.TYP_RETREAT))
       && (!msg.source().isMonster())
       && (msg.source().curState().getHitPoints() < msg.source().maxState().getHitPoints())
       && (CMLib.dice().rollPercentage() == 1)
       && (CMLib.dice().rollPercentage() == 1)
       && (!CMSecurity.isDisabled(CMSecurity.DisFlag.AUTODISEASE))) {
     Ability A = null;
     if (CMLib.dice().rollPercentage() > 50) A = CMClass.getAbility("Disease_Chlamydia");
     else A = CMClass.getAbility("Disease_Malaria");
     if ((A != null) && (msg.source().fetchEffect(A.ID()) == null))
       A.invoke(msg.source(), msg.source(), true, 0);
   }
   if (msg.amITarget(this) && (msg.targetMinor() == CMMsg.TYP_DRINK)) {
     final MOB mob = msg.source();
     final boolean thirsty = mob.curState().getThirst() <= 0;
     final boolean full =
         !mob.curState().adjThirst(thirstQuenched(), mob.maxState().maxThirst(mob.baseWeight()));
     if (thirsty) mob.tell(L("You are no longer thirsty."));
     else if (full) mob.tell(L("You have drunk all you can."));
     if (CMLib.dice().rollPercentage() < 10) {
       Ability A = CMClass.getAbility("Disease_Malaria");
       if ((A != null) && (msg.source().fetchEffect(A.ID()) == null))
         A.invoke(msg.source(), msg.source(), true, 0);
     }
   }
   super.executeMsg(myHost, msg);
 }
コード例 #2
0
ファイル: Song_Ode.java プロジェクト: bozimmerman/CoffeeMud
  @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;
  }
コード例 #3
0
 public Room getRandomGridChild() {
   int x = CMLib.dice().roll(1, xGridSize(), -1);
   int y = CMLib.dice().roll(1, yGridSize(), -1);
   Room R = getMakeGridRoom(x, y);
   if (R == null) Log.errOut("StdThinGrid", roomID() + " failed to get a random child!");
   return R;
 }
コード例 #4
0
  @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;
  }
コード例 #5
0
  @Override
  public boolean tick(Tickable ticking, int tickID) {
    super.tick(ticking, tickID);

    if (anyWetWeather(lastWeather)) {
      if (ticking instanceof Room) {
        final Room R = (Room) ticking;
        final Area A = R.getArea();
        if ((!anyWetWeather(A.getClimateObj().weatherType(R)))
            && (!dryWeather(A.getClimateObj().weatherType(R)))
            && (CMLib.dice().rollPercentage() < pct()))
          makePuddle(R, lastWeather, A.getClimateObj().weatherType(R));
      } else if (ticking instanceof Area) {
        final Area A = (Area) ticking;
        if ((!anyWetWeather(A.getClimateObj().weatherType(null)))
            && (!dryWeather(A.getClimateObj().weatherType(null)))) {
          for (final Enumeration<Room> e = A.getProperMap(); e.hasMoreElements(); ) {
            final Room R = e.nextElement();
            if (((R.domainType() & Room.INDOORS) == 0)
                && (R.domainType() != Room.DOMAIN_OUTDOORS_AIR)
                && (!CMLib.flags().isWateryRoom(R))
                && (CMLib.dice().rollPercentage() < pct()))
              makePuddle(R, lastWeather, A.getClimateObj().weatherType(null));
          }
        }
      }
    }

    if (ticking instanceof Room)
      lastWeather = ((Room) ticking).getArea().getClimateObj().weatherType((Room) ticking);
    else if (ticking instanceof Area)
      lastWeather = ((Area) ticking).getClimateObj().weatherType(null);
    return true;
  }
コード例 #6
0
  @Override
  public boolean tick(Tickable ticking, int tickID) {
    if ((affected == null) || (!(affected instanceof Room))) return super.tick(ticking, tickID);

    if ((--damageTickDown) >= 0) return super.tick(ticking, tickID);
    damageTickDown = 4;

    HashSet H = null;
    if ((invoker() != null) && (invoker().location() == affected)) {
      H = new HashSet();
      invoker().getGroupMembers(H);
    }
    final Room R = (Room) affected;
    for (int i = 0; i < R.numInhabitants(); i++) {
      final MOB M = R.fetchInhabitant(i);
      if ((M != null) && ((H == null) || (!H.contains(M)))) {
        if (invoker() != null) {
          final int harming = CMLib.dice().roll(1, adjustedLevel(invoker(), 0) / 3, 1);
          CMLib.combat()
              .postDamage(
                  invoker(),
                  M,
                  this,
                  harming,
                  CMMsg.MASK_MALICIOUS | CMMsg.TYP_UNDEAD,
                  Weapon.TYPE_BURSTING,
                  L("The unholy aura <DAMAGE> <T-NAME>!"));
        } else {
          final int harming =
              CMLib.dice().roll(1, CMLib.ableMapper().lowestQualifyingLevel(ID()) / 3, 1);
          CMLib.combat()
              .postDamage(
                  M,
                  M,
                  this,
                  harming,
                  CMMsg.MASK_MALICIOUS | CMMsg.TYP_UNDEAD,
                  Weapon.TYPE_BURSTING,
                  L("The unholy aura <DAMAGE> <T-NAME>!"));
        }
        if ((!M.isInCombat())
            && (M.isMonster())
            && (M != invoker)
            && (invoker != null)
            && (M.location() == invoker.location())
            && (M.location().isInhabitant(invoker))
            && (CMLib.flags().canBeSeenBy(invoker, M)))
          CMLib.combat().postAttack(M, invoker, M.fetchWieldedItem());
      }
    }
    return super.tick(ticking, tickID);
  }
コード例 #7
0
  @Override
  public boolean okMessage(final Environmental myHost, final CMMsg msg) {
    if (!super.okMessage(myHost, msg)) return false;
    if (!(affected instanceof MOB)) return true;

    if ((msg.target() == affected)
        && (msg.tool() instanceof Ability)
        && (msg.source() != affected)
        && (msg.targetMinor() == CMMsg.TYP_CAST_SPELL)
        && (msg.isTarget(CMMsg.MASK_MALICIOUS))
        && (CMLib.dice().rollPercentage() > 50)
        && ((((Ability) msg.tool()).classificationCode() & Ability.ALL_DOMAINS)
            == Ability.DOMAIN_CURSING)
        && (((Ability) msg.tool()).castingQuality(msg.source(), (MOB) msg.target())
            == Ability.QUALITY_MALICIOUS)) {
      msg.source()
          .location()
          .show(
              (MOB) affected,
              msg.source(),
              CMMsg.MSG_OK_VISUAL,
              L("An curse from <T-NAME> against <S-NAME> is magically repelled."));
      return false;
    }
    return true;
  }
コード例 #8
0
ファイル: Spell_Scatter.java プロジェクト: kingdavid127/MUD
 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;
 }
コード例 #9
0
  public StoneGiant() {
    super();
    Random randomizer = new Random(System.currentTimeMillis());

    Username = "******";
    setDescription("A tall humanoid standing about 18 feet tall with gray, hairless flesh.");
    setDisplayText("A Stone Giant glares at you.");
    CMLib.factions().setAlignment(this, Faction.ALIGN_EVIL);
    setMoney(0);
    baseEnvStats.setWeight(8000 + Math.abs(randomizer.nextInt() % 1001));

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

    baseEnvStats().setDamage(20);
    baseEnvStats().setSpeed(1.0);
    baseEnvStats().setAbility(0);
    baseEnvStats().setLevel(14);
    baseEnvStats().setArmor(0);

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

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

    recoverMaxState();
    resetToMaxState();
    recoverEnvStats();
    recoverCharStats();
  }
コード例 #10
0
  @Override
  public boolean okMessage(final Environmental myHost, final CMMsg msg) {
    if ((affected instanceof MOB)
        && (msg.amISource((MOB) affected))
        && (msg.targetMinor() == CMMsg.TYP_DAMAGE)
        && (msg.tool() instanceof Weapon)
        && (msg.value() > 0)
        && (msg.target() instanceof MOB)
        && (((Weapon) msg.tool()).weaponClassification() == Weapon.CLASS_THROWN)) {
      if (CMLib.dice().rollPercentage() < 25) helpProficiency((MOB) affected, 0);
      final CMMsg msg2 =
          CMClass.getMsg(
              (MOB) msg.target(),
              msg.tool(),
              this,
              CMMsg.MSG_OK_VISUAL,
              L("^F^<FIGHT^><T-NAME> fragment(s) in <S-NAME>!^</FIGHT^>^?"));
      CMLib.color().fixSourceFightColor(msg2);
      msg.addTrailerMsg(msg2);
      msg.setValue(
          msg.value()
              + (int)
                  Math.round(
                      CMath.mul(
                          3.0 * msg.value(),
                          CMath.div(proficiency(), 100.0 - (10.0 * getXLEVELLevel(invoker()))))));
    }

    return super.okMessage(myHost, msg);
  }
コード例 #11
0
 @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);
 }
コード例 #12
0
 @Override
 public boolean tick(Tickable ticking, int tickID) {
   if (!super.tick(ticking, tickID)) return false;
   if ((tickID == Tickable.TICKID_MOB) && (invoker() != null) && (affected instanceof MOB)) {
     final MOB mob = (MOB) affected;
     final Set<MOB> invokerGroup = invoker().getGroupMembers(new HashSet<MOB>());
     if (mob != invoker()) {
       if (mob.location() != invoker().location()) unInvoke();
       else {
         if (invokerGroup.contains(mob)) unInvoke();
         else if (mob.isInCombat()) {
           int levels = invoker().charStats().getClassLevel("Templar");
           if (levels < 0) levels = invoker().phyStats().level();
           if (CMLib.dice().rollPercentage() >= levels) {
             final MOB newvictim = mob.location().fetchRandomInhabitant();
             if (newvictim != mob) mob.setVictim(newvictim);
           }
         }
       }
     } else if ((mob.location() != null) && (CMLib.flags().isEvil(invoker()))) {
       for (int m = 0; m < mob.location().numInhabitants(); m++) {
         final MOB M = mob.location().fetchInhabitant(m);
         if ((M != null)
             && (M != invoker())
             && (!invokerGroup.contains(M))
             && (!M.Name().equals(mob.getLiegeID())))
           beneficialAffect(invoker, M, 0, Ability.TICKS_FOREVER);
       }
     }
   }
   return true;
 }
コード例 #13
0
ファイル: Monkey.java プロジェクト: bozimmerman/CoffeeMud
  public Monkey() {
    super();
    username = "******";
    setDescription("The monkey is brown with a big pink butt.");
    setDisplayText("A silly monkey lops around here.");
    CMLib.factions().setAlignment(this, Faction.Align.NEUTRAL);
    setMoney(0);
    setWimpHitPoint(2);

    basePhyStats().setDamage(1);

    baseCharStats().setMyRace(CMClass.getRace("Monkey"));
    baseCharStats().getMyRace().startRacing(this, false);

    basePhyStats().setAbility(0);
    basePhyStats().setLevel(2);
    basePhyStats().setArmor(90);

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

    recoverMaxState();
    resetToMaxState();
    recoverPhyStats();
    recoverCharStats();
  }
コード例 #14
0
ファイル: Toad.java プロジェクト: kingdavid127/MUD
  public Toad() {
    super();
    username = "******";
    setDescription("A stubby little dry amphibian with short legs.");
    setDisplayText("A toad is squatting here.");
    CMLib.factions().setAlignment(this, Faction.Align.NEUTRAL);
    setMoney(0);

    basePhyStats().setDamage(6);

    baseCharStats().setStat(CharStats.STAT_INTELLIGENCE, 1);

    basePhyStats().setAbility(0);
    basePhyStats().setLevel(1);
    basePhyStats().setArmor(90);

    baseCharStats().setMyRace(CMClass.getRace("Frog"));
    baseCharStats().getMyRace().startRacing(this, false);
    baseState.setHitPoints(CMLib.dice().rollHP(basePhyStats.level(), 20));

    recoverMaxState();
    resetToMaxState();
    recoverPhyStats();
    recoverCharStats();
  }
コード例 #15
0
ファイル: Chant.java プロジェクト: kingdavid127/MUD
  @Override
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    if ((!auto)
        && (!mob.isMonster())
        && (!disregardsArmorCheck(mob))
        && (mob.isMine(this))
        && (!renderedMundane)
        && (CMLib.dice().rollPercentage() < 50)) {
      if (!appropriateToMyFactions(mob)) {
        mob.tell(L("Extreme emotions disrupt your chant."));
        return false;
      } else if (!CMLib.utensils().armorCheck(mob, CharClass.ARMOR_LEATHER)) {
        mob.location()
            .show(
                mob,
                null,
                CMMsg.MSG_OK_VISUAL,
                L("<S-NAME> watch(es) <S-HIS-HER> armor absorb <S-HIS-HER> magical energy!"));
        return false;
      }
    }
    return true;
  }
コード例 #16
0
ファイル: Panther.java プロジェクト: kingdavid127/MUD
  public Panther() {
    super();
    final Random randomizer = new Random(System.currentTimeMillis());

    username = "******";
    setDescription(
        "A powerful cat with a deep chest and muscular limbs, covered in midnight black fur.");
    setDisplayText("A panther slowly stalks prey.");
    CMLib.factions().setAlignment(this, Faction.Align.NEUTRAL);
    setMoney(0);
    basePhyStats.setWeight(20 + Math.abs(randomizer.nextInt() % 45));
    setWimpHitPoint(2);

    basePhyStats.setWeight(200 + Math.abs(randomizer.nextInt() % 55));

    baseCharStats().setStat(CharStats.STAT_INTELLIGENCE, 1);
    baseCharStats().setStat(CharStats.STAT_STRENGTH, 12);
    baseCharStats().setStat(CharStats.STAT_DEXTERITY, 17);
    baseCharStats().setMyRace(CMClass.getRace("GreatCat"));
    baseCharStats().getMyRace().startRacing(this, false);

    basePhyStats().setDamage(8);
    basePhyStats().setSpeed(2.0);
    basePhyStats().setAbility(0);
    basePhyStats().setLevel(4);
    basePhyStats().setArmor(80);

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

    recoverMaxState();
    resetToMaxState();
    recoverPhyStats();
    recoverCharStats();
  }
コード例 #17
0
ファイル: Cow.java プロジェクト: bozimmerman/CoffeeMud
  public Cow() {
    super();
    username = "******";
    setDescription("A large lumbering beast that looks too slow to get out of your way.");
    setDisplayText("A fat happy cow wanders around here.");
    CMLib.factions().setAlignment(this, Faction.Align.NEUTRAL);
    setMoney(0);
    setWimpHitPoint(0);

    basePhyStats().setDamage(1);
    basePhyStats().setSpeed(1.0);
    basePhyStats().setAbility(0);
    basePhyStats().setLevel(2);
    basePhyStats().setArmor(90);
    baseCharStats().setStat(CharStats.STAT_GENDER, 'F');
    baseCharStats().setMyRace(CMClass.getRace("Cow"));
    baseCharStats().getMyRace().startRacing(this, false);

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

    recoverMaxState();
    resetToMaxState();
    recoverPhyStats();
    recoverCharStats();
  }
コード例 #18
0
ファイル: Rabbit.java プロジェクト: renokun/CoffeeMud
  public Rabbit() {
    super();
    final Random randomizer = new Random(System.currentTimeMillis());

    username = "******";
    setDescription("It\\`s small, cute, and fluffy with a cute cotton-ball tail.");
    setDisplayText("A rabbit hops by.");
    CMLib.factions().setAlignment(this, Faction.Align.NEUTRAL);
    setMoney(0);
    basePhyStats.setWeight(5 + Math.abs(randomizer.nextInt() % 5));
    setWimpHitPoint(2);

    basePhyStats().setDamage(2);

    baseCharStats().setStat(CharStats.STAT_INTELLIGENCE, 1);
    baseCharStats().setMyRace(CMClass.getRace("Rabbit"));
    baseCharStats().getMyRace().startRacing(this, false);

    basePhyStats().setAbility(0);
    basePhyStats().setLevel(1);
    basePhyStats().setArmor(90);

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

    recoverMaxState();
    resetToMaxState();
    recoverPhyStats();
    recoverCharStats();
  }
コード例 #19
0
ファイル: Lion.java プロジェクト: kingdavid127/MUD
  public Lion() {
    super();
    final Random randomizer = new Random(System.currentTimeMillis());

    username = "******";
    setDescription("Lions have reddish-orange fur and great furry manes.");
    setDisplayText("A lion watches you.");
    CMLib.factions().setAlignment(this, Faction.Align.NEUTRAL);
    setMoney(0);
    basePhyStats.setWeight(300 + Math.abs(randomizer.nextInt() % 55));

    baseCharStats().setStat(CharStats.STAT_INTELLIGENCE, 1);
    baseCharStats().setStat(CharStats.STAT_STRENGTH, 13);
    baseCharStats().setStat(CharStats.STAT_DEXTERITY, 17);
    baseCharStats().setMyRace(CMClass.getRace("GreatCat"));
    baseCharStats().getMyRace().startRacing(this, false);

    basePhyStats().setDamage(10);
    basePhyStats().setSpeed(2.0);
    basePhyStats().setAbility(0);
    basePhyStats().setLevel(5);
    basePhyStats().setArmor(80);

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

    recoverMaxState();
    resetToMaxState();
    recoverPhyStats();
    recoverCharStats();
  }
コード例 #20
0
ファイル: Python.java プロジェクト: renokun/CoffeeMud
  public Python() {
    super();
    username = "******";
    setDescription("A humungous snake that is known for squeezing you to DEATH.");
    setDisplayText("A python wants to give you a hug.");
    CMLib.factions().setAlignment(this, Faction.Align.NEUTRAL);
    setMoney(0);

    basePhyStats().setDamage(7);

    baseCharStats().setStat(CharStats.STAT_INTELLIGENCE, 1);

    basePhyStats().setAbility(0);
    basePhyStats().setLevel(1);
    basePhyStats().setArmor(90);

    baseCharStats().setMyRace(CMClass.getRace("Snake"));
    baseCharStats().getMyRace().startRacing(this, false);
    baseState.setHitPoints(CMLib.dice().roll(basePhyStats().level(), 20, basePhyStats().level()));

    recoverMaxState();
    resetToMaxState();
    recoverPhyStats();
    recoverCharStats();
  }
コード例 #21
0
  @Override
  public boolean tick(Tickable ticking, int tickID) {
    if (!super.tick(ticking, tickID)) return false;
    if ((affected == null) || (invoker == null)) return false;

    final MOB mob = (MOB) affected;
    if ((--diseaseTick) <= 0) {
      diseaseTick = 5;
      String str = null;
      switch (CMLib.dice().roll(1, 5, 0)) {
        case 1:
          str = L("<S-NAME> double(s) over and dry heave(s).");
          break;
        case 2:
          str = L("<S-NAME> sneeze(s). AAAAAAAAAAAAAACHOOO!!!!");
          break;
        case 3:
          str = L("<S-NAME> shake(s) feverishly.");
          break;
        case 4:
          str = L("<S-NAME> look(s) around weakly.");
          break;
        case 5:
          str = L("<S-NAME> cough(s) and shudder(s) feverishly.");
          break;
      }
      if (str != null) mob.location().show(mob, null, CMMsg.MSG_OK_VISUAL, str);
      return true;
    }
    return true;
  }
コード例 #22
0
  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;
      }
    }
  }
コード例 #23
0
ファイル: Spell_IceLance.java プロジェクト: kingdavid127/MUD
  @Override
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    final MOB target = this.getTarget(mob, commands, givenTarget);
    if (target == null) return false;

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

    // now see if it worked
    final boolean success = proficiencyCheck(mob, 0, auto);

    if (success) {
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              somanticCastCode(mob, target, auto),
              L(
                      (auto ? "A " : "^S<S-NAME> incant(s) and point(s) at <T-NAMESELF>. A ")
                          + "long shard of ice streaks through the air!^?")
                  + CMLib.protocol().msp("spelldam2.wav", 40));
      final CMMsg msg2 =
          CMClass.getMsg(
              mob,
              target,
              this,
              CMMsg.MSK_CAST_MALICIOUS_VERBAL | CMMsg.TYP_COLD | (auto ? CMMsg.MASK_ALWAYS : 0),
              null);
      if ((mob.location().okMessage(mob, msg)) && (mob.location().okMessage(mob, msg2))) {
        mob.location().send(mob, msg);
        invoker = mob;

        int damage = 0;
        final int maxDie = (adjustedLevel(mob, asLevel) + (2 * super.getX1Level(mob))) / 2;
        damage += CMLib.dice().roll(maxDie, 6, 15);
        mob.location().send(mob, msg2);
        if ((msg2.value() > 0) || (msg.value() > 0))
          damage = (int) Math.round(CMath.div(damage, 2.0));

        if (target.location() == mob.location())
          CMLib.combat()
              .postDamage(
                  mob,
                  target,
                  this,
                  damage,
                  CMMsg.MASK_ALWAYS | CMMsg.TYP_COLD,
                  Weapon.TYPE_FROSTING,
                  L("The lance <DAMAGE> <T-NAME>!"));
      }
    } else
      return maliciousFizzle(
          mob,
          target,
          L("<S-NAME> incant(s) and point(s) at <T-NAMESELF>, but flub(s) the spell."));

    // return whether it worked
    return success;
  }
コード例 #24
0
ファイル: Druid.java プロジェクト: kingdavid127/MUD
  @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);
      }
    }
  }
コード例 #25
0
  @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;
    final boolean undead = CMLib.flags().isUndead(target);

    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,
              (undead ? 0 : CMMsg.MASK_MALICIOUS) | verbalCastCode(mob, target, auto),
              L(
                      auto
                          ? "A seriously painful burst assaults <T-NAME>."
                          : "^S<S-NAME> "
                              + prayWord(mob)
                              + " for a serious burst of pain at <T-NAMESELF>!^?")
                  + CMLib.protocol().msp("spelldam1.wav", 40));
      final CMMsg msg2 =
          CMClass.getMsg(
              mob,
              target,
              this,
              CMMsg.MSK_CAST_MALICIOUS_VERBAL | CMMsg.TYP_UNDEAD | (auto ? CMMsg.MASK_ALWAYS : 0),
              null);
      final Room R = target.location();
      if ((R != null) && (R.okMessage(mob, msg)) && ((R.okMessage(mob, msg2)))) {
        R.send(mob, msg);
        R.send(mob, msg2);
        if ((msg.value() <= 0) && (msg2.value() <= 0)) {
          final int harming = CMLib.dice().roll(1, adjustedLevel(mob, asLevel) + 6, 4);
          CMLib.combat()
              .postDamage(
                  mob,
                  target,
                  this,
                  harming,
                  CMMsg.MASK_ALWAYS | CMMsg.TYP_UNDEAD,
                  Weapon.TYPE_BURSTING,
                  L("The unholy spell <DAMAGE> <T-NAME>!"));
        }
      }
    } else
      return maliciousFizzle(
          mob,
          target,
          L("<S-NAME> point(s) at <T-NAMESELF> and @x1, but nothing happens.", prayWord(mob)));

    // return whether it worked
    return success;
  }
コード例 #26
0
ファイル: Prayer_Drain.java プロジェクト: renokun/CoffeeMud
  @Override
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    final MOB target = this.getTarget(mob, commands, givenTarget);
    if (target == null) return false;

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

    final boolean success = proficiencyCheck(mob, 0, auto);

    if (success) {
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              CMMsg.MSK_CAST_MALICIOUS_VERBAL | CMMsg.TYP_UNDEAD | (auto ? CMMsg.MASK_ALWAYS : 0),
              null);
      final CMMsg msg2 =
          CMClass.getMsg(
              mob,
              target,
              this,
              verbalCastCode(mob, target, auto),
              auto ? "" : L("^S<S-NAME> reach(es) at <T-NAMESELF>, @x1!^?", prayingWord(mob)));
      if ((mob.location().okMessage(mob, msg)) && (mob.location().okMessage(mob, msg2))) {
        mob.location().send(mob, msg2);
        mob.location().send(mob, msg);
        if ((msg.value() <= 0) && (msg2.value() <= 0)) {
          final int damage = CMLib.dice().roll(1, adjustedLevel(mob, asLevel), 0);
          CMLib.combat()
              .postDamage(
                  mob,
                  target,
                  this,
                  damage,
                  CMMsg.MASK_ALWAYS | CMMsg.TYP_UNDEAD,
                  Weapon.TYPE_BURSTING,
                  auto
                      ? L("<T-NAME> shudder(s) in a draining magical wake.")
                      : L("The draining grasp <DAMAGE> <T-NAME>."));
          if (mob != target)
            CMLib.combat()
                .postHealing(
                    mob, mob, this, CMMsg.MASK_ALWAYS | CMMsg.TYP_CAST_SPELL, damage, null);
        }
      }
    } else
      return maliciousFizzle(
          mob,
          target,
          L("<S-NAME> reach(es) for <T-NAMESELF>, @x1, but the spell fades.", prayingWord(mob)));

    // return whether it worked
    return success;
  }
コード例 #27
0
ファイル: Spell_AcidSpray.java プロジェクト: kingdavid127/MUD
  @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;
    Room R = CMLib.map().roomLocation(target);
    if (R == null) R = mob.location();

    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,
              somanticCastCode(mob, target, auto),
              L(
                      auto
                          ? "<T-NAME> <T-IS-ARE> sprayed with acid."
                          : "^S<S-NAME> reach(es) for <T-NAMESELF>, spraying acid all over <T-HIM-HER>!^?")
                  + CMLib.protocol().msp("spelldam1.wav", 40));
      final CMMsg msg2 =
          CMClass.getMsg(
              mob,
              target,
              this,
              CMMsg.MSK_CAST_MALICIOUS_VERBAL | CMMsg.TYP_ACID | (auto ? CMMsg.MASK_ALWAYS : 0),
              null);
      if ((R.okMessage(mob, msg)) && ((R.okMessage(mob, msg2)))) {
        R.send(mob, msg);
        R.send(mob, msg2);
        invoker = mob;
        final int numDice = (adjustedLevel(mob, asLevel) + (2 * super.getX1Level(invoker()))) / 2;
        int damage = CMLib.dice().roll(2, numDice, 1);
        if ((msg2.value() > 0) || (msg.value() > 0))
          damage = (int) Math.round(CMath.div(damage, 2.0));
        CMLib.combat()
            .postDamage(
                mob,
                target,
                this,
                damage,
                CMMsg.MASK_ALWAYS | CMMsg.TYP_ACID,
                Weapon.TYPE_MELTING,
                L("The acid <DAMAGE> <T-NAME>!"));
        maliciousAffect(mob, target, asLevel, 3, -1);
      }
    } else
      return maliciousFizzle(
          mob, target, L("<S-NAME> reach(es) for <T-NAMESELF>, but nothing more happens."));

    return success;
  }
コード例 #28
0
  @Override
  public boolean invoke(
      MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) {
    final MOB target = this.getTarget(mob, commands, givenTarget);
    if (target == null) return false;

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

    final boolean success = proficiencyCheck(mob, 0, auto);

    final Room R = target.location();
    if (success) {
      final Prayer_Thunderbolt newOne = (Prayer_Thunderbolt) this.copyOf();
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              newOne,
              verbalCastCode(mob, target, auto),
              L(
                      auto
                          ? "<T-NAME> is filled with a holy charge!"
                          : "^S<S-NAME> " + prayForWord(mob) + " to strike down <T-NAMESELF>!^?")
                  + CMLib.protocol().msp("lightning.wav", 40));
      final CMMsg msg2 =
          CMClass.getMsg(
              mob,
              target,
              this,
              CMMsg.MSK_CAST_MALICIOUS_VERBAL | CMMsg.TYP_ELECTRIC | (auto ? CMMsg.MASK_ALWAYS : 0),
              null);
      if ((R.okMessage(mob, msg)) && ((R.okMessage(mob, msg2)))) {
        R.send(mob, msg);
        R.send(mob, msg2);
        if ((msg.value() <= 0) && (msg2.value() <= 0)) {
          final int harming =
              CMLib.dice().roll(1, adjustedLevel(mob, asLevel), adjustedLevel(mob, asLevel));
          CMLib.combat()
              .postDamage(
                  mob,
                  target,
                  this,
                  harming,
                  CMMsg.MASK_ALWAYS | CMMsg.TYP_ELECTRIC,
                  Weapon.TYPE_STRIKING,
                  L("^SThe STRIKE of @x1 <DAMAGES> <T-NAME>!^?", hisHerDiety(mob)));
        }
      }
    } else
      return maliciousFizzle(mob, target, L("<S-NAME> @x1, but nothing happens.", prayWord(mob)));

    // return whether it worked
    return success;
  }
コード例 #29
0
  public boolean tick(Tickable ticking, int tickID) {
    if (!super.tick(ticking, tickID)) return false;
    if (affected == null) return false;
    if (!(affected instanceof MOB)) return true;

    MOB mob = (MOB) affected;
    MOB diseaser = invoker;
    if (diseaser == null) diseaser = mob;
    if ((!mob.amDead()) && ((--diseaseTick) <= 0)) {
      diseaseTick = DISEASE_DELAY();
      mob.location().show(mob, null, CMMsg.MSG_NOISE, DISEASE_AFFECT());
      int damage = CMLib.dice().roll(2, diseaser.envStats().level() + 1, 1);
      if (CMLib.dice().rollPercentage() == 1) damage += CMLib.dice().roll(10, 10, 1);
      CMLib.combat()
          .postDamage(diseaser, mob, this, damage, CMMsg.MASK_ALWAYS | CMMsg.TYP_DISEASE, -1, null);
      catchIt(mob);
      return true;
    }
    return true;
  }
コード例 #30
0
 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;
 }