Beispiel #1
0
  public boolean conCheck(
      MOB mob, List<String> commands, Environmental givenTarget, boolean auto, int asLevel) {
    if (commands != null) commands = new XVector<String>(commands);
    if (commands.size() < 1) {
      mob.tell("Con whom into doing what?");
      return false;
    }
    Vector V = new Vector();
    V.addElement(commands.get(0));
    MOB target = this.getTarget(mob, V, givenTarget);
    if (target == null) return false;

    commands.remove(0);

    if ((!target.mayIFight(mob))
        || (!target.isMonster())
        || (target.charStats().getStat(CharStats.STAT_INTELLIGENCE) < 3)) {
      mob.tell("You can't con " + target.name(mob) + ".");
      return false;
    }

    if (target.isInCombat()) {
      mob.tell(target.name(mob) + " is too busy fighting right now.");
      return false;
    }

    if (mob.isInCombat()) {
      mob.tell("You are too busy fighting right now.");
      return false;
    }

    if (commands.size() < 1) {
      mob.tell("Con " + target.charStats().himher() + " into doing what?");
      return false;
    }

    if (commands.get(0).toUpperCase().startsWith("FOL")) {
      mob.tell("You can't con someone into following you.");
      return false;
    }

    CMObject O = CMLib.english().findCommand(target, commands);
    if (O instanceof Command) {
      if ((!((Command) O).canBeOrdered())
          || (!((Command) O).securityCheck(mob))
          || (((Command) O).ID().equals("Sleep"))) {
        mob.tell("You can't con someone into doing that.");
        return false;
      }
    } else {
      if (O instanceof Ability) O = CMLib.english().getToEvoke(target, commands);
      if (O instanceof Ability) {
        if (CMath.bset(((Ability) O).flags(), Ability.FLAG_NOORDERING)) {
          mob.tell("You can't con " + target.name(mob) + " to do that.");
          return false;
        }
      }
    }
    return true;
  }
 public MOB victimHere(Room room, MOB mob) {
   if (room == null) return null;
   if (mob == null) return null;
   for (int i = 0; i < room.numInhabitants(); i++) {
     final MOB M = room.fetchInhabitant(i);
     if ((M != null)
         && (M != mob)
         && (!CMLib.flags().isEvil(M))
         && (mob.mayIFight(M))
         && (M.phyStats().level() < (mob.phyStats().level() + 5))) return M;
   }
   return null;
 }