Final attack number including body state (level, fatigue, wounds, curses...), used weapon and action.

@param Distance $targetDistance
@param Size $targetSize
@return AttackNumber
486067
public function getAttackNumber(Distance $targetDistance, Size $targetSize): AttackNumber
    {
        return $this->createBaseAttackNumber()->add($this->getAttackNumberModifier($targetDistance, $targetSize));
    }
337659
function damerauLevenshteinDistance(source, target) {
  if (!source || source.length === 0)
    if (!target || target.length === 0)
      return 0;
    else
      return target.length;
  else if (!target)
    return source.length;

  var sourceLength = source.length;
  var targetLength = target.length;
  var score = [];

  var INF = sourceLength + targetLength;
  score[0] = [INF];
  for (var i=0 ; i <= sourceLength ; i++) { score[i + 1] = []; score[i + 1][1] = i; score[i + 1][0] = INF; }
  for (var i=0 ; i <= targetLength ; i++) { score[1][i + 1] = i; score[0][i + 1] = INF; }

  var sd = {};
  var combinedStrings = source + target;
  var combinedStringsLength = combinedStrings.length;
  for(var i=0 ; i < combinedStringsLength ; i++) {
    var letter = combinedStrings[i];
    if (!sd.hasOwnProperty(letter))
      sd[letter] = 0;
  }

  for (var i=1 ; i <= sourceLength ; i++) {
    var DB = 0;
    for (var j=1 ; j <= targetLength ; j++) {
      var i1 = sd[target[j - 1]];
      var j1 = DB;

      if (source[i - 1] == target[j - 1]) {
        score[i + 1][j + 1] = score[i][j];
        DB = j;
      }
      else
        score[i + 1][j + 1] = Math.min(score[i][j], Math.min(score[i + 1][j], score[i][j + 1])) + 1;

      score[i + 1][j + 1] = Math.min(score[i + 1][j + 1], score[i1][j1] + (i - i1 - 1) + 1 + (j - j1 - 1));
    }
    sd[source[i - 1]] = i;
  }
  return score[sourceLength + 1][targetLength + 1];
}
926589
public function fitHeight(&$source, $target, array $action)
    {
        $height = reset($action['value']);

        if ($this->image->set($source)->fitToHeight($height)->save($target)) {
            $source = $target;
            return true;
        }

        return false;
    }
302530
public function getTargetClass($target): int
    {
        if (!in_array($target, $this->classes, true)) {
            throw new InvalidArgumentException(
                sprintf('Target with value "%s" is not part of the accepted classes', $target)
            );
        }

        return array_search($target, $this->classes, true);
    }
359243
@SuppressWarnings("unchecked")
    protected final void ensureCapacity(long targetSize) {
        long capacity = capacity();
        if (targetSize > capacity) {
            inflateSpine();
            for (int i=spineIndex+1; targetSize > capacity; i++) {
                if (i >= spine.length) {
                    int newSpineSize = spine.length * 2;
                    spine = Arrays.copyOf(spine, newSpineSize);
                    priorElementCount = Arrays.copyOf(priorElementCount, newSpineSize);
                }
                int nextChunkSize = chunkSize(i);
                spine[i] = (E[]) new Object[nextChunkSize];
                priorElementCount[i] = priorElementCount[i-1] + spine[i-1].length;
                capacity += nextChunkSize;
            }
        }
    }
1040595
public function shiftedRight(int $distance) : BigInteger
    {
        if ($distance === 0) {
            return $this;
        }

        if ($distance < 0) {
            return $this->shiftedLeft(- $distance);
        }

        $operand = BigInteger::of(2)->power($distance);

        if ($this->isPositiveOrZero()) {
            return $this->quotient($operand);
        }

        return $this->dividedBy($operand, RoundingMode::UP);
    }
389567
public static int distanceP(int index0, int index1, int size) {
		int difference = index1-index0;
		if( difference < 0 ) {
			difference = size+difference;
		}
		return difference;
	}
71976
@VisibleForTesting static long calculateTargetReps(long reps, long nanos, long targetNanos,
      double gaussian) {
    double targetReps = (((double) reps) / nanos) * targetNanos;
    return Math.max(1L, Math.round((gaussian * (targetReps / 5)) + targetReps));
  }
1062108
public function getEdge( $sourceNode, $targetNode )
	{
		$index = $this->getEdgeIndex( $sourceNode, $targetNode );
		return $this->edges[$index];
	}
1207691
def select(actor, targets)
    targets.find_all {|target| Utility.find_distance(actor.location, target.location) <= @distance}
  end
616690
public function setTargetPort($targetPort)
    {
        if (
               $this->getAddressType() != AF_UNIX
            && !is_integer($targetPort)
        ) {
            throw new \InvalidArgumentException('Target port parameter must be an integer');
        }
        $this->targetPort = $targetPort;

        return $this;
    }
815207
protected function findTransition(StateInterface $sourceState, StateInterface $targetState, $eventName = null, ConditionInterface $condition = null)
    {
        $conditionName = $condition ? $condition->getName() : null;
        /* @var $transition TransitionInterface */
        foreach ($sourceState->getTransitions() as $transition) {
            $hasSameTargetState = ($transition->getTargetState() === $targetState);
            $hasSameCondition = ($transition->getConditionName() == $conditionName);
            $hasSameEvent = ($transition->getEventName() == $eventName);
            if ($hasSameTargetState && $hasSameCondition && $hasSameEvent) {
                return $transition;
            }
        }
    }
428071
def in_attack_range_of(self, unit: Unit, bonus_distance: Union[int, float] = 0) -> "Units":
        
        return self.filter(lambda x: unit.target_in_range(x, bonus_distance=bonus_distance))
1090897
private function getTargetSize($originalWidth, $originalHeight, $targetWidth, $targetHeight)
    {
        if ($targetWidth === null) {
            return $this->resizeByHeight($originalWidth, $originalHeight, $targetHeight);
        }

        if ($targetHeight === null) {
            return $this->resizeByWidth($originalWidth, $originalHeight, $targetWidth);
        }

        $diffWidth = $originalWidth / $targetWidth;
        $diffHeight = $originalHeight / $targetHeight;

        if ($diffWidth <= $diffHeight) {
            return $this->resizeByHeight($originalWidth, $originalHeight, $targetHeight);
        }

        if ($diffWidth > $diffHeight) {
            return $this->resizeByWidth($originalWidth, $originalHeight, $targetWidth);
        }
    }
201160
public function getRedirectTarget()
    {
        $target = $this->redirect_target;

        $pos = mb_strpos($target, '#');

        if ($pos === false) {
            return $target;
        }

        return mb_substr($target, 0, $pos);

    }
271079
protected static double calculateReachDistance(LofPoint basePoint, LofPoint targetPoint)
    {
        double distance = MathUtils.distance(basePoint.getDataPoint(), targetPoint.getDataPoint());

        double reachDistance = (double) ComparatorUtils.max(distance, targetPoint.getkDistance(),
                ComparatorUtils.NATURAL_COMPARATOR);
        return reachDistance;
    }
783354
public function getTargetId()
    {
        $targetId = $this->getPropertyValue(PropertyIds::TARGET_ID);
        if (empty($targetId)) {
            return null;
        }

        return $this->getSession()->createObjectId($targetId);
    }