コード例 #1
0
 @Override
 public int castingQuality(MOB mob, Physical target) {
   if (mob != null) {
     if (mob.getGroupMembers(new HashSet<MOB>()).size() < 2) return Ability.QUALITY_INDIFFERENT;
   }
   return super.castingQuality(mob, target);
 }
コード例 #2
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 (mob.fetchEffect(ID()) != null) {
      mob.tell("Your health is already linked with someones!");
      return false;
    }
    if (target.fetchEffect(ID()) != null) {
      mob.tell(target.name(mob) + "'s health is already linked with someones!");
      return false;
    }

    if (!mob.getGroupMembers(new HashSet<MOB>()).contains(target)) {
      mob.tell(target.name(mob) + " is not in your group.");
      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)
                      + " that <S-HIS-HER> health be linked with <T-NAME>.^?");
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        mob.location()
            .show(mob, target, CMMsg.MSG_OK_VISUAL, "<S-NAME> and <T-NAME> are linked in health.");
        buddy = mob;
        beneficialAffect(mob, target, asLevel, 0);
        buddy = target;
        beneficialAffect(mob, mob, asLevel, 0);
      }
    } else
      return beneficialWordsFizzle(
          mob,
          target,
          "<S-NAME> "
              + prayWord(mob)
              + " for a link with <T-NAME>, but <S-HIS-HER> plea is not answered.");

    // return whether it worked
    return success;
  }