1
|
|
|
/* |
2
|
|
|
* This file is part of ArakneUtils. |
3
|
|
|
* |
4
|
|
|
* ArakneUtils is free software: you can redistribute it and/or modify |
5
|
|
|
* it under the terms of the GNU Lesser General Public License as published by |
6
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
7
|
|
|
* (at your option) any later version. |
8
|
|
|
* |
9
|
|
|
* ArakneUtils is distributed in the hope that it will be useful, |
10
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
11
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12
|
|
|
* GNU Lesser General Public License for more details. |
13
|
|
|
* |
14
|
|
|
* You should have received a copy of the GNU Lesser General Public License |
15
|
|
|
* along with ArakneUtils. If not, see <https://www.gnu.org/licenses/>. |
16
|
|
|
* |
17
|
|
|
* Copyright (c) 2017-2021 Vincent Quatrevieux |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
package fr.arakne.utils.maps; |
21
|
|
|
|
22
|
|
|
import fr.arakne.utils.maps.sight.CellSight; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Base type for a battlefield cell |
26
|
|
|
*/ |
27
|
|
|
public interface BattlefieldCell extends MapCell { |
28
|
|
|
/** |
29
|
|
|
* Check if the cell block line of sight |
30
|
|
|
* |
31
|
|
|
* @see CellSight |
32
|
|
|
* @see BattlefieldCell#sight() |
33
|
|
|
*/ |
34
|
|
|
public boolean sightBlocking(); |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Get the current cell sight |
38
|
|
|
* This method is equivalent to {@code new CellSight<>(cell)} |
39
|
|
|
* |
40
|
|
|
* Note: each call of this method will recreate a new {@link CellSight} instance |
41
|
|
|
* |
42
|
|
|
* <pre>{@code |
43
|
|
|
* // Check if the "target" cell is accessible from the current cell |
44
|
|
|
* if (!fighter.cell().sight().isFree(target)) { |
45
|
|
|
* return false; |
46
|
|
|
* } |
47
|
|
|
* }</pre> |
48
|
|
|
* |
49
|
|
|
* @return The current cell sight |
50
|
|
|
*/ |
51
|
|
|
public default CellSight<? extends BattlefieldCell> sight() { |
|
|
|
|
52
|
1 |
|
return new CellSight<>(new CoordinateCell<>(this)); |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|