use of eidolons.game.module.dungeoncrawl.dungeon.Entrance in project Eidolons by IDemiurge.
the class Location method initEntrances.
public void initEntrances() {
if (StringMaster.isEmpty(entranceData)) {
entranceData = getProperty(PROPS.DUNGEON_MAIN_ENTRANCES, true);
}
if (StringMaster.isEmpty(entranceData)) {
return;
}
String enterData = entranceData.split(DungeonLevelMaster.ENTRANCE_SEPARATOR)[0];
String name = VariableManager.removeVarPart(enterData);
Coordinates c = new Coordinates(true, VariableManager.getVar(enterData));
for (Entrance e : getEntrances()) {
if (e.getCoordinates().equals(c)) {
if (e.getName().equals(name)) {
setMainEntrance(e);
}
}
}
if (getMainEntrance() == null) {
setMainEntrance(new Entrance(c.x, c.y, DataManager.getType(name, DC_TYPE.BF_OBJ), getDungeon(), getDungeon()));
}
if (entranceData.split(DungeonLevelMaster.ENTRANCE_SEPARATOR).length < 2) {
return;
}
String exitData = entranceData.split(DungeonLevelMaster.ENTRANCE_SEPARATOR)[1];
name = VariableManager.removeVarPart(exitData);
c = new Coordinates(true, VariableManager.getVar(exitData));
for (Entrance e : getEntrances()) {
if (e.getCoordinates().equals(c)) {
if (e.getName().equals(name)) {
setMainExit(e);
}
}
}
if (getMainExit() == null) {
setMainExit(new Entrance(c.x, c.y, DataManager.getType(name, DC_TYPE.BF_OBJ), getDungeon(), getDungeon()));
}
}
use of eidolons.game.module.dungeoncrawl.dungeon.Entrance in project Eidolons by IDemiurge.
the class DC_ActionManager method addSpecialActions.
private void addSpecialActions(Unit unit, DequeImpl<ActiveObj> actives) {
// should be another passive to deny unit even those commodities...
actives.add(getOrCreateAction(DUMMY_ACTION, unit));
if (unit.isBfObj()) {
return;
}
actives.add(getOrCreateAction(MOVE_LEFT, unit));
actives.add(getOrCreateAction(MOVE_RIGHT, unit));
actives.add(getOrCreateAction(MOVE_BACK, unit));
if (!unit.isHuge() && !unit.checkPassive(UnitEnums.STANDARD_PASSIVES.CLUMSY)) {
actives.add(getOrCreateAction(CLUMSY_LEAP, unit));
}
if (UnitAnalyzer.checkOffhand(unit)) {
actives.add(getOrCreateAction(OFFHAND_ATTACK, unit));
addOffhandActions(unit.getActionMap().get(ACTION_TYPE.STANDARD_ATTACK), unit);
addOffhandActions(unit.getActionMap().get(ACTION_TYPE.SPECIAL_ATTACK), unit);
}
actives.addAll(getStandardActionsForGroup(ActionEnums.ACTION_TYPE.STANDARD_ATTACK, unit));
if (RuleMaster.checkFeature(FEATURE.DUAL_ATTACKS))
if (UnitAnalyzer.checkDualWielding(unit)) {
actives.addAll(DualAttackMaster.getDualAttacks(unit));
// good idea! :) dual thrust, dual
// stunning blow, many possibilities! :) but it will be tricky...
// TODO should add all dual actions
}
actives.add(getOrCreateAction(STD_SPEC_ACTIONS.Wait.name(), unit));
if (RuleMaster.checkFeature(FEATURE.USE_INVENTORY)) {
if (unit.canUseItems()) {
actives.add(getOrCreateAction(USE_INVENTORY, unit));
}
}
if (RuleMaster.checkFeature(FEATURE.WATCH)) {
actives.add(getOrCreateAction(STD_SPEC_ACTIONS.Watch.name(), unit));
}
if (RuleMaster.checkFeature(FEATURE.FLEE)) {
if (FleeRule.isFleeAllowed()) {
actives.add(getOrCreateAction(FLEE, unit));
}
}
if (RuleMaster.checkFeature(FEATURE.PICK_UP)) {
try {
if (unit.getGame().getDroppedItemManager().checkHasItemsBeneath(unit)) {
actives.add(getOrCreateAction(PICK_UP, unit));
}
} catch (Exception e) {
// main.system.ExceptionMaster.printStackTrace(e);
}
}
if (RuleMaster.checkFeature(FEATURE.DIVINATION)) {
if (unit.canDivine()) {
actives.add(getOrCreateAction(DIVINATION, unit));
}
}
if (RuleMaster.checkFeature(FEATURE.TOSS_ITEM)) {
if (ListMaster.isNotEmpty(unit.getQuickItems())) {
actives.add(getOrCreateAction(TOSS_ITEM, unit));
}
}
if (RuleMaster.checkFeature(FEATURE.ENTER)) {
for (Entrance e : DungeonLevelMaster.getAvailableDungeonEntrances(unit)) {
actives.add(getEnterAction(unit, e));
}
}
actives.add(getOrCreateAction(SEARCH_MODE, unit));
if (RuleMaster.checkFeature(FEATURE.GUARD_MODE))
actives.add(getOrCreateAction(StringMaster.getWellFormattedString(STD_SPEC_ACTIONS.Guard_Mode.name()), unit));
// for (Entity e : LockMaster.getObjectsToUnlock(unit)) {
// actives.add(getUnlockAction(unit, e));
// }
// for (Trap trap : TrapMaster.getTrapsToDisarm(unit)) {
// actives.add(getDisarmAction(unit, trap));
// }
}
use of eidolons.game.module.dungeoncrawl.dungeon.Entrance in project Eidolons by IDemiurge.
the class LE_PlanPanel method handleLevelControl.
public void handleLevelControl(LEVEL_CONTROLS control, boolean alt) {
switch(control) {
case ENTRANCES:
Entrance entrance = getLevel().getLocation().getMainEntrance();
Entrance exit = getLevel().getLocation().getMainExit();
DialogMaster.ask(" Entrance: " + (entrance == null ? "" : entrance.getNameAndCoordinate()) + ", exit: " + (exit == null ? "" : exit.getNameAndCoordinate()) + " What to do?", true, // String[] options = {
"Set Entrance", "Set Exit", "Swap");
Boolean result = (Boolean) WaitMaster.waitForInput(WAIT_OPERATIONS.OPTION_DIALOG);
if (result == null) {
getLevel().getLocation().setMainEntrance(exit);
getLevel().getLocation().setMainExit(entrance);
} else {
if (result) {
// swap places?
//
int index = DialogMaster.optionChoice(getLevel().getLocation().getEntrances().toArray(), "Choose an entrance");
} else {
}
}
break;
case LAYERS:
// "Units", "Encounters", "Treasures", "Custom Props"
newGroup();
// LayerMaster.save(LevelEditor.getCurrentLevel().getLayer());
break;
case REPLACE:
LE_ObjMaster.replace();
break;
case META:
int i = DialogMaster.optionChoice("Choose meta info to set...", "Player Spawn Coordinates", "Enemy Spawn Coordinates", "Level readiness", "Auto-set Points");
if (i == -1) {
return;
}
Coordinates c;
switch(i) {
case 4:
break;
case 0:
c = LE_MapMaster.pickCoordinate();
if (c != null) {
LevelEditor.getCurrentLevel().getDungeon().setProperty(PROPS.PARTY_SPAWN_COORDINATES, c.toString(), false);
}
break;
case 1:
c = LE_MapMaster.pickCoordinate();
if (c == null) {
if (!alt) {
if (DialogMaster.confirm("Remove last Encounter Point?")) {
LevelEditor.getCurrentLevel().getDungeon().removeLastPartFromProperty(PROPS.ENCOUNTER_SPAWN_POINTS);
}
} else if (DialogMaster.confirm("Clear Encounter Points?")) {
LevelEditor.getCurrentLevel().getDungeon().removeProperty(PROPS.ENCOUNTER_SPAWN_POINTS);
}
return;
}
if (alt) {
LevelEditor.getCurrentLevel().getDungeon().setProperty(PROPS.ENEMY_SPAWN_COORDINATES, c.toString(), false);
} else {
LevelEditor.getCurrentLevel().getDungeon().addOrRemoveProperty(PROPS.ENCOUNTER_SPAWN_POINTS, c.toString());
}
break;
case 2:
String text = ListChooser.chooseEnum(WORKSPACE_GROUP.class);
if (text != null) {
LevelEditor.getCurrentLevel().getDungeon().setProperty(G_PROPS.WORKSPACE_GROUP, text, false);
}
break;
}
break;
default:
break;
}
}
use of eidolons.game.module.dungeoncrawl.dungeon.Entrance in project Eidolons by IDemiurge.
the class Level method removeObj.
public void removeObj(DC_Obj obj) {
Chronos.mark("removing " + obj);
Unit unit = null;
if (obj instanceof Unit) {
unit = (Unit) obj;
}
if (obj instanceof Entrance) {
if (location.getMainEntrance() != null) {
location.setMainEntrance(null);
location.getPlan().setEntranceLayout(null);
} else if (location.getMainExit() == null) {
location.setMainExit(null);
location.getPlan().setExitLayout(null);
}
location.getEntrances().remove(obj);
}
// TODO getOrCreate Top object!
// ++ ZOrder...
Coordinates coordinates = obj.getCoordinates();
LevelEditor.getSimulation().remove(obj);
// TODO ???
// obj = dungeon.getMinimap().getGrid().getTopObj(coordinates);
// if (obj != null)
// if (!unit.isOverlaying())TODO
MapBlock b = LevelEditor.getMapMaster().getBlock();
if (b == null) {
b = getBlockForCoordinate(coordinates, false);
}
if (b != null) {
boolean result = !b.removeObject(obj, coordinates);
if (result) {
if (unit.isLandscape()) {
b.addCoordinate(obj.getCoordinates());
}
}
} else {
b = LevelEditor.getMainPanel().getPlanPanel().getSelectedBlock();
if (b == null) {
b = getBlockForCoordinate(coordinates, true);
} else if (!CoordinatesMaster.isAdjacent(b.getCoordinates(), coordinates)) {
b = getBlockForCoordinate(coordinates, true);
}
if (b != null) {
if (!unit.isOverlaying()) {
b.addCoordinate(obj.getCoordinates());
}
}
}
if (unit != null) {
if (!unit.isOverlaying()) // if (LevelEditor.isMinimapMode())
{
if (LE_MapViewComp.isMinimapMode()) {
LevelEditor.getMainPanel().getMiniGrid().refreshComp(null, obj.getCoordinates());
} else {
LE_MapViewComp comp = LevelEditor.getMainPanel().getMapViewComp();
comp.getGrid().getCompForObject(obj).refresh();
comp.getGrid().refresh();
comp.getGrid().getCompForObject(obj).refresh();
comp.getGrid().getPanel().repaint();
}
}
}
// TODO ADD COORDINATE!
Chronos.logTimeElapsedForMark("removing " + obj);
}
Aggregations