use of main.system.datatypes.DequeImpl in project Eidolons by IDemiurge.
the class SightMaster method getSpectrumCoordinates.
public DequeImpl<Coordinates> getSpectrumCoordinates(Integer range, Integer side_penalty, Integer back_bonus, BattleFieldObject source, boolean vision, FACING_DIRECTION facing, boolean extended) {
DequeImpl<Coordinates> list = new DequeImpl<>();
BattleFieldObject unit = null;
Coordinates orig = source.getCoordinates();
if (source instanceof BattleFieldObject) {
unit = (BattleFieldObject) source;
}
if (facing == null) {
if (unit != null) {
facing = unit.getFacing();
}
}
DIRECTION direction;
if (facing == null) {
facing = FacingMaster.getRandomFacing();
}
direction = facing.getDirection();
if (range == null) {
range = source.getIntParam(PARAMS.SIGHT_RANGE);
if (extended) {
range = MathMaster.applyModIfNotZero(range, source.getIntParam(PARAMS.SIGHT_RANGE_EXPANSION));
}
}
if (side_penalty == null) {
side_penalty = source.getIntParam(PARAMS.SIDE_SIGHT_PENALTY);
if (extended) {
side_penalty = MathMaster.applyModIfNotZero(side_penalty, source.getIntParam(PARAMS.SIGHT_RANGE_EXPANSION_SIDES));
}
}
if (back_bonus == null) {
back_bonus = source.getIntParam(PARAMS.BEHIND_SIGHT_BONUS);
if (!extended)
back_bonus--;
// back_bonus = MathMaster.applyModIfNotZero(back_bonus, source
// .getIntParam(PARAMS.SIGHT_RANGE_EXPANSION_BACKWARD));
}
addLine(orig.getAdjacentCoordinate(direction), range, list, direction, true);
addSides(list, orig, direction, range - side_penalty, false);
DIRECTION backDirection = DirectionMaster.flip(direction);
Coordinates backCoordinate = orig.getAdjacentCoordinate(backDirection);
if (back_bonus > 0) {
if (backCoordinate != null) {
addLine(backCoordinate, back_bonus, list, backDirection, true);
// if (back_bonus > side_penalty)
// addSides(list, backCoordinate, backDirection, back_bonus -
// side_penalty, false);
}
}
Collection<Coordinates> blocked = getBlockedList(list, source, facing);
list.removeAll(blocked);
list.add(source.getCoordinates());
return list;
}
use of main.system.datatypes.DequeImpl in project Eidolons by IDemiurge.
the class NewsWatcher method readConfig.
private static void readConfig() {
List<String> list = StringMaster.openContainer(readFile(getKeywordsPath(), cyrillic), "#");
NewsFilterer.setKeywords(list);
list = StringMaster.openContainer(readFile(getWebsitesPath(), false), "\n");
NewsReader.setWebsites(new DequeImpl(list));
list = StringMaster.openContainer(readFile(getEmailsPath(), false), "\n");
NewsAlerter.setEmails(list);
}
use of main.system.datatypes.DequeImpl in project Eidolons by IDemiurge.
the class DeathMaster method killAllUnits.
public void killAllUnits(boolean removeBfObjects, boolean retainPlayerParty, boolean quiet) {
DequeImpl<BattleFieldObject> list = new DequeImpl();
List<BattleFieldObject> toRemove = new ArrayList<>();
list.addAll(getGame().getUnits());
if (removeBfObjects) {
list.addAll(getGame().getStructures());
}
for (BattleFieldObject unit : list) {
if (retainPlayerParty) {
if (PartyHelper.getParty() != null) {
if (PartyHelper.getParty().getMembers().contains(unit)) {
continue;
}
}
// if (unit.isMine())
// continue;
}
unit.kill(unit, false, quiet);
toRemove.add(unit);
}
// if (remove)
for (BattleFieldObject unit : toRemove) {
getGame().remove(unit);
}
// reset();
// refreshAll();
// WaitMaster.receiveInput(WAIT_OPERATIONS.ACTION_COMPLETE, true);
}
use of main.system.datatypes.DequeImpl in project Eidolons by IDemiurge.
the class BfMouseListener method checkAnimationClick.
public boolean checkAnimationClick(MouseEvent e) {
point = e.getPoint();
DequeImpl<PhaseAnimation> animations = new DequeImpl<>(gridComp.getGame().getAnimationManager().getAnimations());
animations.addAll(gridComp.getGame().getAnimationManager().getTempAnims());
if (SwingUtilities.isRightMouseButton(e)) {
for (PhaseAnimation anim : animations) {
if (checkToggleTooltip(anim, e)) {
return true;
}
if (anim.contains(e.getPoint())) {
if (e.getClickCount() > 1) {
if (anim.isPaused()) {
anim.resume();
} else {
anim.pause();
}
return true;
}
AnimPhase phase = anim.getPhase();
if (phase != null) {
if (anim.subPhaseClosed()) {
DC_SoundMaster.playStandardSound(STD_SOUNDS.BACK);
return true;
}
}
}
}
}
for (PhaseAnimation anim : animations) {
if (anim.getMouseMap() != null) {
for (Rectangle rect : anim.getMouseMap().keySet()) {
if (rect.contains(point)) {
MouseItem item = anim.getMouseMap().get(rect);
return itemClicked(item, anim);
}
}
}
}
return false;
}
use of main.system.datatypes.DequeImpl in project Eidolons by IDemiurge.
the class EditorParticleMaster method removeClosest.
public void removeClosest(int x, int y) {
float minDistance = Float.MAX_VALUE;
Actor actor = null;
DequeImpl<Actor> list = new DequeImpl<>(particles.getEmitterMap().get(time));
list.addAll(map.get(time));
for (Actor sub : list) {
if (sub instanceof EmitterActor) {
float distance = new Vector2(x, y).dst(new Vector2(sub.getX(), sub.getY()));
if (distance < minDistance) {
minDistance = distance;
actor = sub;
}
}
// can we not attach click listeners to emtiterActors?!
}
removeEmitter((EmitterActor) actor, time);
}
Aggregations