use of main.entity.obj.Obj in project Eidolons by IDemiurge.
the class EvasionRule method checkMissed.
public static boolean checkMissed(DC_ActiveObj action) {
DC_Obj source = action.getOwnerObj();
Obj target = action.getRef().getTargetObj();
if (source == null || target == null) {
return false;
}
if (source.checkPassive(UnitEnums.STANDARD_PASSIVES.TRUE_STRIKE)) {
return false;
}
int chance = getMissChance(action);
if (chance <= 0) {
return false;
}
return RandomWizard.chance(chance);
}
use of main.entity.obj.Obj in project Eidolons by IDemiurge.
the class DrawMaster method drawCorpses.
private void drawCorpses(Graphics g) {
if (isEditorMode()) {
return;
}
Coordinates coordinates = cellComp.getCoordinates();
List<Obj> deadUnits = cellComp.getGame().getGraveyardManager().getDeadUnits(coordinates);
if (deadUnits != null) {
Image img = STD_IMAGES.DEATH.getImage();
// ImageManager.getSizedVersion(img, new dimension());
int x = 0;
int y = 0;
if (emblemDrawn || isMultiObj()) {
y = getCompHeight() - img.getHeight(null);
}
for (Obj corpse : deadUnits) {
drawImage(g, img, x, y);
Rectangle rect = new Rectangle(x, y, img.getWidth(null), img.getHeight(null));
if (isSingleObj() || cellComp.isTerrain()) {
cellComp.getMouseMap().put(rect, corpse);
} else {
cellComp.getMouseMap().put(rect, INTERACTIVE_ELEMENT.CORPSES);
return;
}
y += img.getHeight(null) + 2;
if (y >= getCompHeight() - img.getHeight(null)) {
y = 0;
x += img.getWidth(null) + 2;
}
}
}
}
use of main.entity.obj.Obj in project Eidolons by IDemiurge.
the class DC_PagedLogPanel method getPageData.
@Override
protected List<List<String>> getPageData() {
if (descriptionMode && game.getManager().getInfoObj() != null) {
Obj entity = game.getManager().getInfoObj();
String descr = entity.getDescription();
String lore = entity.getProperty(G_PROPS.LORE);
List<String> descrPages = TextWrapper.wrap(descr, descrWrapLength);
List<String> lorePages = TextWrapper.wrap(lore, descrWrapLength);
List<List<String>> list = new ArrayList<>();
list.addAll(new ListMaster<String>().splitList(rowCount, descrPages));
list.addAll(new ListMaster<String>().splitList(rowCount, lorePages));
return list;
}
if (nodeViewMode) {
List<String> lines = entryNode.getTextLines();
return new ListMaster<String>().splitList(rowCount, lines);
}
ArrayList<String> lines = new ArrayList<>();
List<String> entries = game.getLogManager().getTopDisplayedEntries();
for (String entry : entries) {
for (String subString : TextWrapper.wrapIntoArray(entry, EntryNodeMaster.getWrapLength(isTopPage()))) {
lines.add(subString);
}
}
// splitList(list)
return new ListMaster<String>().splitList(getRowCount(), lines);
}
use of main.entity.obj.Obj in project Eidolons by IDemiurge.
the class FilterMaster method getPlayerControlledUnits.
public static Set<Obj> getPlayerControlledUnits(Player player) {
Conditions c = new Conditions();
Ref ref;
if (player == Player.NEUTRAL) {
c.add(new OwnershipCondition("MATCH", true));
c.add(ConditionMaster.getBFObjTypesCondition());
ref = new Ref(player.getGame());
} else {
c.add(new OwnershipCondition("MATCH", "SOURCE"));
c.add(ConditionMaster.getBFObjTypesCondition());
ref = player.getHeroObj().getRef();
}
// spells too?
Filter<Obj> filter = new Filter<>(ref, c);
Set<Obj> set = filter.getObjects();
return set;
}
use of main.entity.obj.Obj in project Eidolons by IDemiurge.
the class ValueHelper method setValue.
public void setValue(String valueName) {
if (getEntity() == null) {
return;
}
VALUE v = getValue(valueName);
String amount;
if (v != null) {
amount = getEntity().getValue(v);
foundValues.put(valueName, v);
} else {
valueName = CounterMaster.findCounter(valueName);
amount = "" + getEntity().getCounter(valueName);
}
String name = valueName;
if (v != null) {
name = v.getName();
}
String message = "Set value: " + name + " for " + getEntity().getName();
String input = JOptionPane.showInputDialog(parent, message, amount);
Set<VALUE> set = rejectedValues.get(valueName);
if (set == null) {
set = new HashSet<>();
rejectedValues.put(valueName, set);
}
if (input != null) {
set.remove(v);
} else {
set.add(v);
}
if (!StringMaster.isEmpty(input)) {
if (!input.equalsIgnoreCase(amount)) {
if (v != null) {
getEntity().setValue(v, input);
if (getEntity() instanceof Obj) {
getEntity().getType().setValue(v, input);
}
// if (getEntity() instanceof DC_HeroObj ) //set items
// initialized false!
} else {
getEntity().setCounter(valueName, StringMaster.getInteger(input));
}
game.getManager().reset();
game.getManager().refreshAll();
}
}
if (getEntity() instanceof ObjType) {
if (CoreEngine.isArcaneVault()) {
XML_Writer.writeXML_ForType((ObjType) getEntity());
}
}
}
Aggregations