public void addAffectOrBehavior(String substr) {
   int x = substr.indexOf('=');
   if (x >= 0) {
     String nam = substr.substring(0, x);
     if (nam.trim().length() == 0) {
       reactToName = substr.substring(1);
       return;
     }
     Behavior B = CMClass.getBehavior(nam);
     if (B != null) {
       B.setSavable(false);
       Object[] SET = new Object[] {B, substr.substring(x + 1)};
       unmanagedYet.add(SET);
       return;
     }
     Ability A = CMClass.getAbility(nam);
     if (A != null) {
       A.setSavable(false);
       A.makeNonUninvokable();
       Object[] SET = new Object[] {A, substr.substring(x + 1)};
       unmanagedYet.add(SET);
       return;
     }
     Command C = CMClass.getCommand(nam);
     if (C != null) {
       Object[] SET = new Object[] {C, substr.substring(x + 1)};
       unmanagedYet.add(SET);
     }
   }
 }
Exemple #2
0
 @Override
 public void spring(MOB target) {
   if ((target != invoker()) && (target.location() != null)) {
     if ((doesSaveVsTraps(target))
         || (invoker().getGroupMembers(new HashSet<MOB>()).contains(target)))
       target
           .location()
           .show(
               target,
               null,
               null,
               CMMsg.MASK_ALWAYS | CMMsg.MSG_NOISE,
               L("<S-NAME> avoid(s) setting off a gas trap!"));
     else if (target
         .location()
         .show(
             target,
             target,
             this,
             CMMsg.MASK_ALWAYS | CMMsg.MSG_NOISE,
             L("<S-NAME> set(s) off a trap! The room fills with gas!"))) {
       super.spring(target);
       Ability A = CMClass.getAbility(text());
       if (A == null) A = CMClass.getAbility("Poison");
       for (int i = 0; i < target.location().numInhabitants(); i++) {
         final MOB M = target.location().fetchInhabitant(i);
         if ((M != null) && (M != invoker()) && (A != null))
           if (invoker().mayIFight(M)) A.invoke(invoker(), M, true, 0);
       }
       if ((canBeUninvoked()) && (affected instanceof Item)) disable();
     }
   }
 }
Exemple #3
0
 @Override
 public void executeMsg(final Environmental myHost, final CMMsg msg) {
   if ((msg.tool() == this)
       && (msg.targetMinor() == CMMsg.TYP_WEAPONATTACK)
       && (weaponClassification() == Weapon.CLASS_THROWN)) return;
   // msg.addTrailerMsg(CMClass.getMsg(msg.source(),this,CMMsg.MSG_DROP,null));
   else if ((msg.tool() == this)
       && (msg.targetMinor() == CMMsg.TYP_DAMAGE)
       && (msg.target() != null)
       && (msg.target() instanceof MOB)
       && (weaponClassification() == Weapon.CLASS_THROWN)) {
     unWear();
     msg.addTrailerMsg(
         CMClass.getMsg(msg.source(), this, CMMsg.MASK_ALWAYS | CMMsg.MSG_DROP, null));
     msg.addTrailerMsg(
         CMClass.getMsg((MOB) msg.target(), this, CMMsg.MASK_ALWAYS | CMMsg.MSG_GET, null));
     msg.addTrailerMsg(
         CMClass.getMsg(
             msg.source(), msg.target(), this, CMMsg.MASK_ALWAYS | CMMsg.TYP_GENERAL, null));
   } else if ((msg.tool() == this)
       && (msg.target() instanceof MOB)
       && (msg.targetMinor() == CMMsg.TYP_GENERAL)
       && (((MOB) msg.target()).isMine(this))
       && (msg.sourceMessage() == null)) {
     final Ability A = CMClass.getAbility("Thief_Bind");
     if (A != null) {
       A.setAffectedOne(this);
       A.invoke(msg.source(), (MOB) msg.target(), true, phyStats().level());
     }
   } else super.executeMsg(myHost, msg);
 }
Exemple #4
0
  public void initializeClass() {
    super.initializeClass();
    CMLib.ableMapper().addCharAbilityMapping(ID(), 1, "Skill_Spellcraft", 50, true);
    CMLib.ableMapper().addCharAbilityMapping(ID(), 1, "Skill_ScrollCopy", 100, true);
    CMLib.ableMapper().addCharAbilityMapping(ID(), 1, "Spell_Scribe", 75, true);
    CMLib.ableMapper().addCharAbilityMapping(ID(), 1, "Papermaking", 75, true);
    CMLib.ableMapper().addCharAbilityMapping(ID(), 1, "Spell_ReadMagic", 100, true);

    CMLib.ableMapper().addCharAbilityMapping(ID(), 1, "Spell_MagicMissile", false);
    CMLib.ableMapper().addCharAbilityMapping(ID(), 1, "Spell_ResistMagicMissiles", false);
    CMLib.ableMapper().addCharAbilityMapping(ID(), 1, "Spell_Shield", false);
    CMLib.ableMapper().addCharAbilityMapping(ID(), 1, "Spell_IronGrip", false);

    for (Enumeration a = CMClass.abilities(); a.hasMoreElements(); ) {
      Ability A = (Ability) a.nextElement();
      if ((A != null) && ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_SPELL)) {
        int level = CMLib.ableMapper().getQualifyingLevel(ID(), true, A.ID());
        if (level > 0) {
          AbilityMapper.AbilityMapping able = CMLib.ableMapper().getAbleMap(ID(), A.ID());
          if ((able != null) && (!CMLib.ableMapper().getDefaultGain(ID(), true, A.ID()))) {
            able.costOverrides =
                new Integer[] {
                  Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0)
                };
            able.defaultProficiency = 100;
          }
        }
      }
    }
  }
Exemple #5
0
 @Override
 public void spring(MOB target) {
   if (target.location() != null) {
     if ((!invoker().mayIFight(target))
         || (isLocalExempt(target))
         || (invoker().getGroupMembers(new HashSet<MOB>()).contains(target))
         || (target == invoker())
         || (doesSaveVsTraps(target)))
       target
           .location()
           .show(
               target,
               null,
               null,
               CMMsg.MASK_ALWAYS | CMMsg.MSG_NOISE,
               L("<S-NAME> avoid(s) the water bomb!"));
     else if (target
         .location()
         .show(
             invoker(),
             target,
             this,
             CMMsg.MASK_ALWAYS | CMMsg.MSG_NOISE,
             L("@x1 explodes water all over <T-NAME>!", affected.name()))) {
       super.spring(target);
       final Ability A = CMClass.getAbility("Spell_Irritation");
       if (A != null) A.invoke(target, target, true, invoker().phyStats().level() + abilityCode());
     }
   }
 }
Exemple #6
0
 @Override
 public String secretIdentity() {
   String id = super.secretIdentity();
   final Ability A = getSpell();
   if (A != null) id = "'A wand of " + A.name() + "' Charges: " + usesRemaining() + "\n\r" + id;
   return id + "\n\rSay the magic word :`" + secretWord + "` to the target.";
 }
Exemple #7
0
 public void spring(MOB target) {
   if (target.location() != null) {
     if ((!invoker().mayIFight(target))
         || (isLocalExempt(target))
         || (invoker().getGroupMembers(new HashSet<MOB>()).contains(target))
         || (target == invoker())
         || (doesSaveVsTraps(target)))
       target
           .location()
           .show(
               target,
               null,
               null,
               CMMsg.MASK_ALWAYS | CMMsg.MSG_NOISE,
               "<S-NAME> avoid(s) the smoke bomb!");
     else if (target
         .location()
         .show(
             invoker(),
             target,
             this,
             CMMsg.MASK_ALWAYS | CMMsg.MSG_NOISE,
             affected.name() + " explodes smoke into <T-YOUPOSS> eyes!")) {
       super.spring(target);
       Ability A = CMClass.getAbility("Spell_Blindness");
       if (A != null) A.invoke(target, target, true, 0);
     }
   }
 }
Exemple #8
0
  public void setTrapped(Environmental myThang, Trap theTrap, boolean isTrapped) {
    for (int a = 0; a < myThang.numEffects(); a++) {
      Ability A = myThang.fetchEffect(a);
      if ((A != null) && (A instanceof Trap)) A.unInvoke();
    }

    if ((isTrapped) && (myThang.fetchEffect(theTrap.ID()) == null)) myThang.addEffect(theTrap);
  }
 @Override
 public Ability fetchAbility(String ID) {
   for (final Enumeration<Ability> a = abilities(); a.hasMoreElements(); ) {
     final Ability A = a.nextElement();
     if (A == null) continue;
     if (A.ID().equalsIgnoreCase(ID)) return A;
   }
   return null;
 }
Exemple #10
0
 public static Ability isPlant(Item I) {
   if ((I != null) && (I.rawSecretIdentity().length() > 0)) {
     for (int a = 0; a < I.numEffects(); a++) {
       Ability A = I.fetchEffect(a);
       if ((A != null) && (A.invoker() != null) && (A instanceof Chant_SummonPlants)) return A;
     }
   }
   return null;
 }
 public static boolean isPlant(Item I) {
   if ((I != null) && (I.rawSecretIdentity().length() > 0)) {
     for (final Enumeration<Ability> a = I.effects(); a.hasMoreElements(); ) {
       final Ability A = a.nextElement();
       if ((A != null) && (A.invoker() != null) && (A instanceof Chant_SummonPlants)) return true;
     }
   }
   return false;
 }
Exemple #12
0
  public List<Ability> returnOffensiveAffects(Physical fromMe) {
    final Vector offenders = new Vector();

    for (final Enumeration<Ability> a = fromMe.effects(); a.hasMoreElements(); ) {
      final Ability A = a.nextElement();
      if ((A != null) && ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_POISON))
        offenders.addElement(A);
    }
    return offenders;
  }
  @Override
  public boolean tick(Tickable ticking, int tickID) {
    if (!super.tick(ticking, tickID)) return false;

    if (affected == null) return false;
    if (!(affected instanceof MOB)) return false;
    final MOB mob = (MOB) affected;
    if (mob.location().numInhabitants() == 1) return true;
    final Vector choices = new Vector();
    for (final Enumeration<Ability> a = mob.effects(); a.hasMoreElements(); ) {
      final Ability A = a.nextElement();
      if ((A != null)
          && (A.canBeUninvoked())
          && (!A.ID().equals(ID()))
          && (A.abstractQuality() == Ability.QUALITY_MALICIOUS)
          && (((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_SPELL)
              || ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_PRAYER))
          && (!A.isAutoInvoked())) choices.addElement(A);
    }
    if (choices.size() == 0) return true;
    final MOB target = mob.location().fetchRandomInhabitant();
    final Ability thisOne = (Ability) choices.elementAt(CMLib.dice().roll(1, choices.size(), -1));
    if ((target == null) || (thisOne == null) || (target.fetchEffect(ID()) != null)) return true;
    if (CMLib.dice().rollPercentage() > (target.charStats().getSave(CharStats.STAT_SAVE_DISEASE))) {
      ((Ability) this.copyOf()).invoke(target, target, true, 0);
      if (target.fetchEffect(ID()) != null)
        ((Ability) thisOne.copyOf()).invoke(target, target, true, 0);
    } else spreadImmunity(target);
    return true;
  }
  public List<Ability> returnOffensiveAffects(Physical fromMe) {
    final Vector offenders = new Vector();

    for (int a = 0; a < fromMe.numEffects(); a++) // personal
    {
      final Ability A = fromMe.fetchEffect(a);
      if ((A != null) && ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_POISON))
        offenders.addElement(A);
    }
    return offenders;
  }
 public ClimbableSurface() {
   super();
   name = "the surface";
   basePhyStats.setWeight(4);
   climbA = CMClass.getAbility("Prop_Climbable");
   if (climbA != null) {
     climbA.setAffectedOne(this);
     climbA.makeNonUninvokable();
   }
   recoverPhyStats();
 }
Exemple #16
0
 @Override
 public void endCharacter(MOB mob) {
   final Vector<Ability> otherChoices = new Vector<Ability>();
   for (int a = 0; a < mob.numAbilities(); a++) {
     final Ability A2 = mob.fetchAbility(a);
     if ((A2 != null)
         && (!A2.isSavable())
         && ((A2.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_SPELL))
       otherChoices.addElement(A2);
   }
   for (int a = 0; a < otherChoices.size(); a++) mob.delAbility(otherChoices.elementAt(a));
 }
Exemple #17
0
  public void startCharacter(MOB mob, boolean isBorrowedClass, boolean verifyOnly) {
    if (!loaded()) {
      setLoaded(true);
      LinkedList<CharClass> charClassesOrder = new LinkedList<CharClass>();
      HashSet<String> names = new HashSet<String>();
      for (Enumeration<CharClass> c = CMClass.charClasses(); c.hasMoreElements(); ) {
        CharClass C = c.nextElement();
        if (C.baseClass().equals(C.ID())
            && (!C.baseClass().equalsIgnoreCase("Archon"))
            && (!C.baseClass().equalsIgnoreCase("PlayerClass"))
            && (!C.baseClass().equalsIgnoreCase("Qualifier"))
            && (!C.baseClass().equalsIgnoreCase("StdCharClass"))) {
          names.add(C.ID());
          charClassesOrder.add(C);
        }
      }
      for (Enumeration<CharClass> c = CMClass.charClasses(); c.hasMoreElements(); ) {
        CharClass C = c.nextElement();
        if (!names.contains(C.ID()) && names.contains(C.baseClass())) charClassesOrder.add(C);
      }
      for (Enumeration<CharClass> c = CMClass.charClasses(); c.hasMoreElements(); ) {
        CharClass C = c.nextElement();
        if (C.baseClass().equals("Commoner") && (!names.contains(C.ID()))) charClassesOrder.add(C);
      }

      for (CharClass C : charClassesOrder) {
        LinkedList<List<String>> prevSets = new LinkedList<List<String>>();
        for (int lvl = 1; lvl < CMProps.getIntVar(CMProps.Int.LASTPLAYERLEVEL); lvl++) {
          List<String> curSet = CMLib.ableMapper().getLevelListings(C.ID(), false, lvl);
          for (String ID : curSet) {
            String defaultParam = CMLib.ableMapper().getDefaultParm(C.ID(), true, ID);
            if (CMLib.ableMapper().getQualifyingLevel(ID(), false, ID) < 0) {
              Ability A = CMClass.getAbility(ID);
              if (A == null) {
                Log.errOut("Unknonwn class: " + ID);
                continue;
              }
              List<String> reqSet = makeRequirements(prevSets, A);
              if (reqSet.size() > 0) reqSet = new XVector<String>(CMParms.toStringList(reqSet));
              int level = 0;
              if (!this.leveless() && (!CMSecurity.isDisabled(DisFlag.LEVELS)))
                level = CMLib.ableMapper().lowestQualifyingLevel(A.ID());
              if (level < 0) level = 0;
              CMLib.ableMapper()
                  .addCharAbilityMapping(ID(), 0, ID, 0, defaultParam, false, false, reqSet, "");
            }
          }
          if (curSet.size() > 0) prevSets.add(curSet);
        }
      }
    }
    super.startCharacter(mob, false, verifyOnly);
  }
Exemple #18
0
  public int classDurationModifier(MOB myChar, Ability skill, int duration) {
    if (myChar == null) return duration;
    if (((skill.classificationCode() & Ability.ALL_DOMAINS) == Ability.DOMAIN_CRAFTINGSKILL)
        && (myChar.charStats().getCurrentClass().ID().equals(ID()))
        && (!skill.ID().equals("FoodPrep"))
        && (!skill.ID().equals("Cooking"))
        && (!skill.ID().equals("Herbalism"))
        && (!skill.ID().equals("Weaving"))
        && (!skill.ID().equals("Masonry"))) return duration * 2;

    return duration;
  }
Exemple #19
0
  public boolean invoke(
      MOB mob, Vector commands, Environmental givenTarget, boolean auto, int asLevel) {
    Item target = super.getTarget(mob, mob.location(), givenTarget, commands, Wearable.FILTER_ANY);
    if (target == null) return false;

    if ((!(target instanceof Ammunition))
        || (!((Ammunition) target).ammunitionType().equalsIgnoreCase("arrows"))) {
      mob.tell(mob, target, null, "You can't enchant <T-NAME> ith an Enchant Arrows spell!");
      return false;
    }

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

    int experienceToLose = getXPCOSTAdjustment(mob, 5);
    CMLib.leveler().postExperience(mob, null, null, -experienceToLose, false);

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

    if (success) {
      CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              verbalCastCode(mob, target, auto),
              auto ? "" : "^S<S-NAME> hold(s) <T-NAMESELF> and cast(s) a spell.^?");
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        Ability A = target.fetchEffect(ID());
        if ((A != null) && (CMath.s_int(A.text()) > 2))
          mob.tell("You are not able to enchant " + target.name() + " further.");
        else {
          mob.location().show(mob, target, CMMsg.MSG_OK_VISUAL, "<T-NAME> glows!");
          if (A == null) {
            A = (Ability) copyOf();
            target.addNonUninvokableEffect(A);
          }
          A.setMiscText("" + (CMath.s_int(A.text()) + 1));
          target.recoverEnvStats();
          mob.recoverEnvStats();
        }
      }

    } else
      beneficialWordsFizzle(
          mob,
          target,
          "<S-NAME> hold(s) <T-NAMESELF> tightly and whisper(s), but fail(s) to cast a spell.");

    // return whether it worked
    return success;
  }
  @Override
  public void executeMsg(final Environmental myHost, final CMMsg msg) {
    super.executeMsg(myHost, msg);
    // the sex rules
    if (!(affected instanceof MOB)) return;

    final MOB myChar = (MOB) affected;
    if (msg.target() instanceof MOB) {
      final MOB mate = (MOB) msg.target();
      if ((msg.amISource(myChar))
          && (msg.tool() instanceof Social)
          && (msg.tool().Name().equals("MATE <T-NAME>") || msg.tool().Name().equals("SEX <T-NAME>"))
          && (msg.sourceMinor() != CMMsg.TYP_CHANNEL)
          && (myChar.charStats().getStat(CharStats.STAT_GENDER)
              != mate.charStats().getStat(CharStats.STAT_GENDER))
          && ((mate.charStats().getStat(CharStats.STAT_GENDER) == ('M'))
              || (mate.charStats().getStat(CharStats.STAT_GENDER) == ('F')))
          && ((myChar.charStats().getStat(CharStats.STAT_GENDER) == ('M'))
              || (myChar.charStats().getStat(CharStats.STAT_GENDER) == ('F')))
          && (!mate.charStats().getMyRace().canBreedWith(myChar.charStats().getMyRace()))
          && (myChar.location() == mate.location())
          && (myChar
                  .fetchWornItems(
                      Wearable.WORN_LEGS | Wearable.WORN_WAIST, (short) -2048, (short) 0)
                  .size()
              == 0)
          && (mate.fetchWornItems(
                      Wearable.WORN_LEGS | Wearable.WORN_WAIST, (short) -2048, (short) 0)
                  .size()
              == 0)
          && ((mate.charStats().getStat(CharStats.STAT_AGE) == 0)
              || ((mate.charStats().ageCategory() > Race.AGE_CHILD)
                  && (mate.charStats().ageCategory() < Race.AGE_OLD)))
          && ((myChar.charStats().getStat(CharStats.STAT_AGE) == 0)
              || ((myChar.charStats().ageCategory() > Race.AGE_CHILD)
                  && (myChar.charStats().ageCategory() < Race.AGE_OLD)))) {
        MOB female = myChar;
        MOB male = mate;
        if ((mate.charStats().getStat(CharStats.STAT_GENDER) == ('F'))) {
          female = mate;
          male = myChar;
        }
        final Ability A = CMClass.getAbility("Pregnancy");
        if ((A != null)
            && (female.fetchAbility(A.ID()) == null)
            && (female.fetchEffect(A.ID()) == null)) {
          A.invoke(male, female, true, 0);
          unInvoke();
        }
      }
    }
  }
  @Override
  public boolean okMessage(final Environmental myHost, final CMMsg msg) {
    if (affected == null) return super.okMessage(myHost, msg);

    if (affected instanceof MOB) {
      final MOB mob = (MOB) affected;
      if ((msg.amITarget(mob))
          && (!msg.amISource(mob))
          && (mob.location() != msg.source().location())
          && (msg.tool() instanceof Ability)
          && (CMath.bset(((Ability) msg.tool()).flags(), Ability.FLAG_TRANSPORTING))
          && (!mob.amDead())) {
        final Ability A = (Ability) msg.tool();
        if (((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_CHANT)
            || ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_SPELL)
            || ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_PRAYER)
            || ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_SONG))
          msg.source()
              .location()
              .showHappens(
                  CMMsg.MSG_OK_VISUAL, L("Magical energy fizzles and is absorbed into the air!"));
        return false;
      }
    } else if (affected instanceof Room) {
      final Room R = (Room) affected;
      if ((msg.tool() instanceof Ability)
          && (msg.source().location() != null)
          && (msg.sourceMinor() != CMMsg.TYP_LEAVE)) {
        final boolean summon = CMath.bset(((Ability) msg.tool()).flags(), Ability.FLAG_SUMMONING);
        final boolean teleport =
            CMath.bset(((Ability) msg.tool()).flags(), Ability.FLAG_TRANSPORTING);
        final boolean shere =
            (msg.source().location() == affected)
                || ((affected instanceof Area)
                    && (((Area) affected).inMyMetroArea(msg.source().location().getArea())));
        if ((!shere)
            && (!summon)
            && (teleport)
            && (!CMLib.law().doesHavePriviledgesHere(msg.source(), R))) {
          if ((msg.source().location() != null) && (msg.source().location() != R))
            msg.source()
                .location()
                .showHappens(
                    CMMsg.MSG_OK_VISUAL, L("Magical energy fizzles and is absorbed into the air!"));
          R.showHappens(
              CMMsg.MSG_OK_VISUAL, L("Magic energy fizzles and is absorbed into the air."));
          return false;
        }
      }
    }
    return super.okMessage(myHost, msg);
  }
Exemple #22
0
 private void clearAbilityFromSpellcraftList(MOB mob, Ability A) {
   final Ability enabledA = mob.fetchAbility("Skill_Spellcraft");
   if (enabledA != null) {
     final List<String> ables = CMParms.parseCommas(enabledA.text(), true);
     if (ables.contains(A.ID())) {
       if (!CMSecurity.isAllowed(mob, mob.location(), CMSecurity.SecFlag.ALLSKILLS)) {
         ables.remove(A.ID());
         enabledA.setMiscText(CMParms.toListString(ables));
         mob.delAbility(A);
       }
     }
   }
 }
 public void unAffectAffected(Object[] Os) {
   final CMObject O = (CMObject) Os[0];
   final Physical P = affected;
   if (O instanceof Ability) {
     ((Ability) O).unInvoke();
     ((Ability) O).destroy();
   }
   affects.remove(Os);
   if (P != null) P.recoverPhyStats();
   if (P instanceof MOB) {
     ((MOB) P).recoverCharStats();
     ((MOB) P).recoverMaxState();
   }
 }
Exemple #24
0
 public void unInvoke() {
   if ((affected instanceof MOB) && (myChants != null)) {
     Vector V = myChants;
     myChants = null;
     for (int i = 0; i < V.size(); i++) {
       Ability A = (Ability) V.elementAt(i);
       if ((A.affecting() != null) && (A.ID().equals(ID())) && (A.affecting() instanceof Item)) {
         Item I = (Item) A.affecting();
         I.delEffect(A);
       }
     }
   }
   super.unInvoke();
 }
 public String spellAccountingsWithMask(String pre, String post) {
   final List<Ability> spellList = getMySpellsV();
   String id = "";
   for (int v = 0; v < spellList.size(); v++) {
     final Ability A = spellList.get(v);
     if (spellList.size() == 1) id += A.name();
     else if (v == (spellList.size() - 1)) id += "and " + A.name();
     else id += A.name() + ", ";
   }
   if (spellList.size() > 0) id = pre + id + post;
   final String maskString = getMaskString(text());
   if (maskString.length() > 0) id += "  Restrictions: " + CMLib.masking().maskDesc(maskString);
   return id;
 }
Exemple #26
0
 protected boolean parsedOutIndividualSkill(MOB mob, String qual, Vector acodes) {
   if ((qual == null) || (qual.length() == 0) || (qual.equalsIgnoreCase("all"))) return false;
   if (qual.length() > 0)
     for (int i = 1; i < Ability.DOMAIN_DESCS.length; i++)
       if (Ability.DOMAIN_DESCS[i].replace('_', ' ').equalsIgnoreCase(qual)) return false;
       else if ((Ability.DOMAIN_DESCS[i].replace('_', ' ').indexOf('/') >= 0)
           && (Ability.DOMAIN_DESCS[i]
               .replace('_', ' ')
               .substring(Ability.DOMAIN_DESCS[i].indexOf('/') + 1)
               .equalsIgnoreCase(qual))) return false;
   final Ability A = CMClass.findAbility(qual);
   if ((A != null)
       && (CMLib.ableMapper().qualifiesByAnyCharClass(A.ID()))
       && (acodes.contains(Integer.valueOf(A.classificationCode() & Ability.ALL_ACODES)))) {
     final Ability A2 = mob.fetchAbility(A.ID());
     if (A2 == null) mob.tell(L("You don't know '@x1'.", A.name()));
     else {
       int level = CMLib.ableMapper().qualifyingLevel(mob, A2);
       if (level < 0) level = 0;
       final StringBuffer line = new StringBuffer("");
       line.append("\n\rLevel ^!" + level + "^?:\n\r");
       line.append(
           "^N[^H"
               + CMStrings.padRight(Integer.toString(A2.proficiency()), 3)
               + "%^?]^N "
               + CMStrings.padRight("^<HELP^>" + A2.name() + "^</HELP^>", 19));
       line.append("^?\n\r");
       if (mob.session() != null) mob.session().wraplessPrintln(line.toString());
     }
     return true;
   }
   return false;
 }
  public void unInvoke() {
    // undo the affects of this spell
    if (!(affected instanceof MOB)) return;
    MOB mob = (MOB) affected;

    super.unInvoke();

    if (canBeUninvoked()) {
      if (buddy != null) {
        mob.tell("Your health is no longer linked with " + buddy.name() + ".");
        Ability A = buddy.fetchEffect(ID());
        if (A != null) A.unInvoke();
      }
    }
  }
 public void finishInit(CMObject A) {
   if (affected == null) return;
   if (A instanceof Ability) {
     ((Ability) A).makeNonUninvokable();
     ((Ability) A).makeLongLasting();
     ((Ability) A).setAffectedOne(affected);
   }
   if ((A instanceof Behavior) && (affected instanceof PhysicalAgent))
     ((Behavior) A).startBehavior((PhysicalAgent) affected);
   if (affected != null) affected.recoverPhyStats();
   if (affected instanceof MOB) {
     ((MOB) affected).recoverCharStats();
     ((MOB) affected).recoverMaxState();
   }
   initialized = true;
 }
  @Override
  public void unInvoke() {
    // undo the affects of this spell
    if (!(affected instanceof MOB)) return;
    final MOB mob = (MOB) affected;
    final List<Ability> poisonAffects = this.poisonAffects;
    super.unInvoke();

    if (canBeUninvoked() && (poisonAffects != null)) {
      mob.tell(L("The poisons in your system are reviving."));
      for (Ability A : poisonAffects) {
        mob.addEffect(A);
        A.setAffectedOne(mob);
      }
      this.poisonAffects = null;
    }
  }
Exemple #30
0
 public boolean canBeLearnedBy(MOB teacher, MOB student) {
   if (student != null) {
     for (int a = 0; a < student.numAbilities(); a++) {
       Ability A = student.fetchAbility(a);
       if ((A != null) && (A instanceof Spell_BaseClanEq)) {
         teacher.tell(
             student.name()
                 + " already knows '"
                 + A.name()
                 + "', and may not learn another clan enchantment.");
         student.tell("You may only learn a single clan enchantment.");
         return false;
       }
     }
   }
   return super.canBeLearnedBy(teacher, student);
 }