|
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-2020 Vincent Quatrevieux |
|
18
|
|
|
*/ |
|
19
|
|
|
|
|
20
|
|
|
package fr.arakne.utils.maps; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* Base type for a dofus map cell |
|
24
|
|
|
*/ |
|
25
|
|
|
public interface MapCell { |
|
26
|
|
|
/** |
|
27
|
|
|
* Get the cell id |
|
28
|
|
|
* |
|
29
|
|
|
* @return The cell id. Starts at 0 |
|
30
|
|
|
*/ |
|
31
|
|
|
public int id(); |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* Check if the cell is walkable |
|
35
|
|
|
* |
|
36
|
|
|
* @return true if walkable |
|
37
|
|
|
*/ |
|
38
|
|
|
public boolean walkable(); |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Get the container map |
|
42
|
|
|
* |
|
43
|
|
|
* @return The parent DofusMap |
|
44
|
|
|
*/ |
|
45
|
|
|
public DofusMap<?> map(); |
|
|
|
|
|
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Get the coordinate of the current cell |
|
49
|
|
|
* This is equivalent to {@code new CoordinateCell<>(cell)} |
|
50
|
|
|
* |
|
51
|
|
|
* Note: this method will always recreate a new {@link CoordinateCell} instance |
|
52
|
|
|
* |
|
53
|
|
|
* <pre>{@code |
|
54
|
|
|
* // Compute distance between two cells |
|
55
|
|
|
* int distance = current.coordinate().distance(target.coordinate()); |
|
56
|
|
|
* }</pre> |
|
57
|
|
|
* |
|
58
|
|
|
* @return The cell coordinate |
|
59
|
|
|
*/ |
|
60
|
|
|
public default CoordinateCell<? extends MapCell> coordinate() { |
|
|
|
|
|
|
61
|
1 |
|
return new CoordinateCell<>(this); |
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|