Beispiel #1
0
  /** Returns the target movement modifier for attacks. */
  public static int getMovementModifier(MechRemote mech) {
    int modifier = 0;
    int displacement = 0;

    try {
      if (mech.getMovementMode() == 3) {
        modifier = modifier + 1;
      } // Target jumping modifier
      displacement =
          (int) getDistance(mech.getLocation(), mech.getLastLocation())
              / mech.getMap().getMapGridSize();
    } catch (java.rmi.RemoteException e) {
      System.out.println("Rules RemoteException!");
    }

    if (displacement >= 10) {
      modifier = modifier + 4;
    } // Target displacement modifier
    else if (displacement >= 7) {
      modifier = modifier + 3;
    } else if (displacement >= 5) {
      modifier = modifier + 2;
    } else if (displacement >= 3) {
      modifier = modifier + 1;
    }

    return (modifier);
  }
Beispiel #2
0
  /** Returns the difficulty for physical attacks. */
  public static int getPhysicalAttackDifficulty(MechRemote shooter, MechRemote target, int base) {
    int difficulty = base;

    try {
      Map map = shooter.getMap();

      difficulty = difficulty + shooter.getMovementMode(); // Shooter movement modifiers

      difficulty = difficulty + getMovementModifier(target); // Target movement modifier

      difficulty = difficulty + map.getTerrainModifier(shooter, target); // Terrain modifiers

      if (target.isProne()) {
        difficulty = difficulty - 2;
      } // Prone target modifier

      if (target.isShutdown() || target.getMW().isUnconscious()) // Immobile target modifier
      {
        difficulty = difficulty - 4;
      }
    } catch (java.rmi.RemoteException e) {
      System.out.println("Rules RemoteException!");
    }

    return (difficulty);
  }