public class Technique extends Object
Modifier and Type | Field and Description |
---|---|
AOE |
aoe |
protected static Coord |
DEFAULT_POINT |
protected char[][] |
dungeon |
String |
id |
String |
name |
Constructor and Description |
---|
Technique()
Creates a Technique that can target any adjacent single Coord, using
Chebyshev (8-way square) distance.
|
Technique(String name)
Creates a Technique that can target any adjacent single Coord,
using Chebyshev (8-way square) distance.
|
Technique(String name,
AOE aoe)
Creates a Technique that can target a Coord at a range specified by the given AOE's minRange and maxRange,
using a distance metric from the AOE, and use that target Coord for the given AOE.
|
Technique(String name,
String id,
AOE aoe)
Creates a Technique that can target a Coord at a range specified by the given AOE's minRange and maxRange,
using a distance metric from the AOE, and use that target Coord for the given AOE.
|
Modifier and Type | Method and Description |
---|---|
LinkedHashMap<Coord,Double> |
apply(Coord user,
Coord aimAt)
This does one last validation of the location aimAt (checking that it is within the valid range for this
Technique) before getting the area affected by the AOE targeting that cell.
|
LinkedHashMap<Coord,ArrayList<Coord>> |
idealLocations(Coord user,
Set<Coord> targets,
Set<Coord> requiredExclusions)
Get a mapping of Coord keys representing locations to apply this Technique to, to ArrayList of Coord values
representing which targets (by their location) are effected by choosing that Coord.
|
LinkedHashMap<Coord,ArrayList<Coord>> |
idealLocations(Coord user,
Set<Coord> priorityTargets,
Set<Coord> lesserTargets,
Set<Coord> requiredExclusions)
Get a mapping of Coord keys representing locations to apply this Technique to, to ArrayList of Coord values
representing which targets (by their location) are effected by choosing that Coord.
|
void |
setMap(char[][] map)
VITAL: Call this method before any calls to idealLocations() or apply(), and call it again if the map changes.
|
protected char[][] dungeon
protected static final Coord DEFAULT_POINT
public Technique()
public Technique(String name)
name
- An identifier that may be displayed to the user. Also used for id.public Technique(String name, AOE aoe)
name
- An identifier that may be displayed to the user. Also used for id.aoe
- An implementation of the AOE interface; typically needs construction beforehand.public Technique(String name, String id, AOE aoe)
name
- An identifier that may be displayed to the user.id
- An identifier that should always be internal, and will probably never be shown to the user.aoe
- An implementation of the AOE interface; typically needs construction beforehand.public void setMap(char[][] map)
map
- A char 2D array like one generated by squidpony.squidgrid.mapping.DungeonGenerator, with '#' for walls and bounded edges.public LinkedHashMap<Coord,ArrayList<Coord>> idealLocations(Coord user, Set<Coord> targets, Set<Coord> requiredExclusions)
user
- The location of the user of this Techniquetargets
- Set of Coord of desirable targets to include in the area of this Technique, as many as possible.requiredExclusions
- Set of Coord where each value is something this Technique will really try to avoid.public LinkedHashMap<Coord,ArrayList<Coord>> idealLocations(Coord user, Set<Coord> priorityTargets, Set<Coord> lesserTargets, Set<Coord> requiredExclusions)
user
- The location of the user of this TechniquepriorityTargets
- Set of Coord of important targets to include in the area of this Technique, preferring to target a single priorityTarget over four lesserTargets.lesserTargets
- Set of Coord of desirable targets to include in the area of this Technique, as many as possible without excluding priorityTargets.requiredExclusions
- Set of Coord where each value is something this Technique will really try to avoid.public LinkedHashMap<Coord,Double> apply(Coord user, Coord aimAt)
user
- The position of the Technique's user, x first, y second.aimAt
- A target Coord typically obtained from idealLocations that determines how to position the AOE.Copyright © 2012–2016. All rights reserved.