Пример #1
0
 public ClimbableSurface() {
   super();
   name = "the surface";
   basePhyStats.setWeight(4);
   climbA = CMClass.getAbility("Prop_Climbable");
   if (climbA != null) {
     climbA.setAffectedOne(this);
     climbA.makeNonUninvokable();
   }
   recoverPhyStats();
 }
Пример #2
0
 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;
 }
Пример #3
0
 public boolean addMeIfNeccessary(
     PhysicalAgent source, Physical target, boolean makeLongLasting, int asLevel, short maxTicks) {
   final List<Ability> V = getMySpellsV();
   if ((target == null)
       || (V.size() == 0)
       || ((compiledMask != null) && (!CMLib.masking().maskCheck(compiledMask, target, true))))
     return false;
   final List VTOO = convertToV2(V, target);
   if (VTOO.size() == 0) return false;
   final MOB qualMOB = getInvokerMOB(source, target);
   for (int v = 0; v < VTOO.size(); v += 2) {
     final Ability A = (Ability) VTOO.get(v);
     final Vector V2 = (Vector) VTOO.get(v + 1);
     if (level >= 0) asLevel = level;
     else if (asLevel <= 0) asLevel = (affected != null) ? affected.phyStats().level() : 0;
     A.invoke(qualMOB, V2, target, true, asLevel);
     final Ability EA = target.fetchEffect(A.ID());
     lastMOB = target;
     // this needs to go here because otherwise it makes non-item-invoked spells long lasting,
     // which means they dont go away when item is removed.
     if (EA != null) {
       if ((maxTicks > 0)
           && (maxTicks < Short.MAX_VALUE)
           && (CMath.s_int(EA.getStat("TICKDOWN")) > maxTicks))
         EA.setStat("TICKDOWN", Short.toString(maxTicks));
       else if (makeLongLasting) {
         EA.makeLongLasting();
         if (!uninvocable) {
           EA.makeNonUninvokable();
           if (unrevocableSpells == null) unrevocableSpells = new Vector<Ability>();
           unrevocableSpells.add(EA);
         }
       }
     }
   }
   return true;
 }