Exemplo n.º 1
0
  /**
   * Gets the chance a unit can hit its target
   *
   * @param a The attacking Unit
   * @param b The defending Unit
   * @param m The map it takes place on.
   * @return The hit chance.
   */
  public static int hitChance(Unit a, Unit b, Map m) {
    // Determine Hit Rate, Evasion, and Weapon Advantage.
    int hitRate = a.getTotalSkill() * 2 + a.getTotalLuck() + a.getEquppedWeapon().getHit();
    int evade =
        b.getTotalSpd() * 2 + b.getTotalLuck() + m.getTerrainAtPoint(b.getCoord()).getEvade();
    int weaponAdvantage = weaponAdvantageAccuracy(a.getEquppedWeapon(), b.getEquppedWeapon());

    return (hitRate + weaponAdvantage - evade);
  }
Exemplo n.º 2
0
  public static int critChance(Unit a, Unit b) {
    // Determine crit chance
    int critRate = a.getEquppedWeapon().getCrit() + a.getTotalSkill() / 2;
    int avoid = b.getTotalLuck();

    return critRate - avoid;
  }