Esempio n. 1
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);
 }
Esempio n. 2
0
 public ClimbableSurface() {
   super();
   name = "the surface";
   basePhyStats.setWeight(4);
   climbA = CMClass.getAbility("Prop_Climbable");
   if (climbA != null) {
     climbA.setAffectedOne(this);
     climbA.makeNonUninvokable();
   }
   recoverPhyStats();
 }
Esempio n. 3
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;
 }
Esempio n. 4
0
  @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;
    }
  }
Esempio n. 5
0
  @Override
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    final MOB target = 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 List<Ability> offensiveAffects = returnOffensiveAffects(target);

    if ((success) && (offensiveAffects.size() > 0)) {
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              verbalCastCode(mob, target, auto),
              auto
                  ? L("<T-NAME> feel(s) the poison slowing down.")
                  : L("^S<S-NAME> chant(s) for the poisons in <T-NAME> to be slowed down.^?"));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        Chant_DelayPoison pA = (Chant_DelayPoison) beneficialAffect(mob, target, asLevel, 0);
        if (pA != null) {
          pA.poisonAffects = offensiveAffects;
          for (Ability A : offensiveAffects) {
            target.delEffect(A);
            A.setAffectedOne(target);
          }
        }
        target.recoverPhyStats();
      }
    } else
      beneficialWordsFizzle(
          mob, target, auto ? "" : L("<S-NAME> chant(s) for <T-NAME>, but nothing happens."));

    // return whether it worked
    return success;
  }