use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class CombatScriptExecutor method doReposition.
// moves all party members to new positions around given origin
private boolean doReposition(Ref ref, String[] args) {
// GuiEventManager.trigger(GuiEventType.SHADOW_MAP_FADE_IN, 100);
int i = 0;
// String group = args[i];
// i++;
List<Unit> members = getMaster().getMetaMaster().getPartyManager().getParty().getMembers();
List<Coordinates> coordinates = getCoordinatesListForUnits(args[i], getPlayerManager().getPlayer(true), members.stream().map(m -> m.getName()).collect(Collectors.toList()), ref);
i = 0;
for (Unit unit : members) {
unit.setCoordinates(coordinates.get(i));
i++;
}
for (Unit unit : members) {
GuiEventManager.trigger(GuiEventType.UNIT_MOVED, unit);
}
// GuiEventManager.trigger(GuiEventType.SHADOW_MAP_FADE_OUT, 0);
return true;
}
use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class GammaMaster method getAlphaForShadowMapCell.
public float getAlphaForShadowMapCell(int x, int y, SHADE_LIGHT type) {
if (type == SHADE_LIGHT.BLACKOUT) {
return getBlackoutAlpha(x, y);
}
if (type == SHADE_LIGHT.HIGLIGHT) {
return getHiglightAlpha(x, y);
}
Unit unit = Eidolons.game.getManager().getMainHero();
if (unit == null) {
unit = Eidolons.game.getManager().getActiveObj();
}
if (unit == null) {
switch(type) {
case GAMMA_SHADOW:
return 1;
}
return 0;
}
float alpha = 0;
float gamma = getGammaForCell(x, y);
switch(type) {
case GAMMA_SHADOW:
if (VisionManager.isVisionHacked()) {
return 0;
}
if (gamma >= 1)
return 0;
if (gamma < 0)
alpha = 1;
else
alpha = 1 - gamma;
if (unit.getX() == x && unit.getY() == y) {
alpha = alpha / 2;
}
break;
case GAMMA_LIGHT:
if (gamma < 0)
return 0;
alpha = (float) Math.min(Math.sqrt(gamma * 2), gamma / 3);
alpha = Math.min(alpha, 0.5f);
break;
case LIGHT_EMITTER:
for (Obj sub : DC_Game.game.getRules().getIlluminationRule().getEffectCache().keySet()) {
if (sub instanceof Unit)
// TODO illuminate some other way for units...
continue;
if (sub.getCoordinates().x == x)
if (sub.getCoordinates().y == y)
if (((DC_Obj) sub).getPlayerVisionStatus(false) == PLAYER_VISION.DETECTED) {
alpha += LIGHT_EMITTER_ALPHA_FACTOR * master.getGame().getRules().getIlluminationRule().getLightEmission((DC_Obj) sub);
}
}
if (alpha > 0) {
break;
}
break;
case CONCEALMENT:
alpha = // PARAMS.CONCEALMENT)*CONCEALMENT_ALPHA_FACTOR;
master.getIlluminationMaster().getConcealment(unit, Eidolons.game.getCellByCoordinate(new Coordinates(x, y))) * CONCEALMENT_ALPHA_FACTOR;
if (alpha > 0)
alpha += getAlphaForShadowMapCell(x, y, SHADE_LIGHT.LIGHT_EMITTER) / 3;
break;
}
return MathMaster.minMax(alpha, 0, 1);
}
use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class SightMaster method getBlockedList.
// TODO
private Collection<Coordinates> getBlockedList(DequeImpl<Coordinates> list, BattleFieldObject source, FACING_DIRECTION facing) {
Collection<Coordinates> removeList = new ArrayList<>();
for (Coordinates c : list) {
DC_Cell cell = master.getGame().getMaster().getCellByCoordinate(c);
Boolean clearShot = !isBlocked(cell, source);
if (!clearShot) {
removeList.add(c);
}
}
return removeList;
}
use of main.game.bf.Coordinates 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.game.bf.Coordinates in project Eidolons by IDemiurge.
the class SightMaster method getShadowingDirection.
// returns direction of the shadowing
private DIRECTION getShadowingDirection(Unit source, DC_Obj obj) {
if (obj.isTransparent()) {
return null;
}
// if (objComp.getObj().isTransparent()) return false;
DIRECTION direction;
Coordinates orig = source.getCoordinates();
Coordinates c = obj.getCoordinates();
if (checkDirectVerticalShadowing(orig, c)) {
direction = (!PositionMaster.isAbove(orig, c)) ? DIRECTION.UP : DIRECTION.DOWN;
return direction;
}
if (checkDirectHorizontalShadowing(orig, c)) {
direction = (!PositionMaster.isToTheLeft(orig, c)) ? DIRECTION.LEFT : DIRECTION.RIGHT;
return direction;
}
if (PositionMaster.isAbove(orig, c)) {
if (PositionMaster.isToTheLeft(orig, c)) {
direction = DIRECTION.DOWN_RIGHT;
} else {
direction = DIRECTION.DOWN_LEFT;
}
} else {
if (PositionMaster.isToTheLeft(orig, c)) {
direction = DIRECTION.UP_RIGHT;
} else {
direction = DIRECTION.UP_LEFT;
}
}
return direction;
}
Aggregations