| Package | Description |
|---|---|
| fr.arakne.utils.maps | |
| fr.arakne.utils.maps.sight |
| Modifier and Type | Method and Description |
|---|---|
default CoordinateCell<C> |
MapCell.coordinate()
Get the coordinate of the current cell
This is equivalent to
new CoordinateCell<>(cell)
Note: this method will always recreate a new CoordinateCell instance
// Compute distance between two cells
int distance = current.coordinate().distance(target.coordinate());
You can optimise CoordinateCell creation by storing them into the cell instance,
optionally wrapped into a WeakReference :
{@code
class MyCell extends MapCell |
| Modifier and Type | Method and Description |
|---|---|
Direction |
CoordinateCell.directionTo(CoordinateCell<C> target)
Compute the direction to the target cell
https://github.com/Emudofus/Dofus/blob/1.29/ank/battlefield/utils/Pathfinding.as#L204
|
@NonNegative int |
CoordinateCell.distance(CoordinateCell<C> target)
Get the cell distance
Note: Do not compute a pythagorean distance, but "square" distance.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
BattlefieldSight.between(CoordinateCell<C> source,
CoordinateCell<C> target)
Check the line of sight between those two cells
This is equivalent to
sight.from(source).isFree(target)
Usage:
{@code
final BattlefieldSight |
boolean |
BattlefieldSight.between(CoordinateCell<C> source,
CoordinateCell<C> target)
Check the line of sight between those two cells
This is equivalent to
sight.from(source).isFree(target)
Usage:
{@code
final BattlefieldSight |
CellSight<C> |
BattlefieldSight.from(CoordinateCell<C> cell)
Get the line of sight of a cell
Usage:
final BattlefieldSight<FightCell> sight = new BattlefieldSight<>(map);
final CoordinateCell<FightCell> current = new CoordinateCell<>(fighter.cell());
sight.from(current).to(target.cell()).forEachRemaining(cell -> {
// Iterator on line of sight
});
|
boolean |
CellSight.isFree(CoordinateCell<C> target)
Check if the line of sight is free towards the target
Usage:
{@code
final CellSight
|
Iterator<C> |
CellSight.to(CoordinateCell<C> target)
Iterator of cells between current one and the target
Note: the current cell is excluded from the iterator, but not the target.
|
| Constructor and Description |
|---|
CellSight(BattlefieldSight<C> battlefield,
CoordinateCell<C> source) |
CellSight(CoordinateCell<C> source) |
Copyright © 2022. All rights reserved.