C - The battlefield cell typepublic final class BattlefieldSight<C extends BattlefieldCell> extends Object
| Constructor and Description |
|---|
BattlefieldSight(DofusMap<C> battlefield) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
between(C source,
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 |
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> |
from(C cell)
Get the line of sight of a cell
Usage:
final BattlefieldSight<FightCell> sight = new BattlefieldSight<>(map);
sight.from(fighter.cell()).to(target.cell()).forEachRemaining(cell -> {
// Iterator on line of sight
});
|
CellSight<C> |
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
});
|
public boolean between(C source, C target)
sight.from(source).isFree(target)
Usage:
final BattlefieldSight<FightCell> sight = new BattlefieldSight<>(map);
if (!sight.between(fighter.cell(), target.cell())) {
throw new Exception("Target is no reachable");
}
source - The source celltarget - The target cellCellSight.isFree(BattlefieldCell)public boolean between(CoordinateCell<C> source, CoordinateCell<C> target)
sight.from(source).isFree(target)
Usage:
final BattlefieldSight<FightCell> sight = new BattlefieldSight<>(map);
final CoordinateCell<FightCell> from = new CoordinateCell<>(fighter.cell());
final CoordinateCell<FightCell> to = new CoordinateCell<>(target.cell());
if (!sight.between(from, to)) {
throw new Exception("Target is no reachable");
}
source - The source celltarget - The target cellCellSight.isFree(CoordinateCell)public CellSight<C> from(CoordinateCell<C> cell)
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
});
cell - The cell to checkpublic CellSight<C> from(C cell)
final BattlefieldSight<FightCell> sight = new BattlefieldSight<>(map);
sight.from(fighter.cell()).to(target.cell()).forEachRemaining(cell -> {
// Iterator on line of sight
});
cell - The cell to checkCopyright © 2022. All rights reserved.