use of main.content.values.parameters.PARAMETER in project Eidolons by IDemiurge.
the class ResistanceRule method getResistance.
public static int getResistance(Ref ref) {
DC_ActiveObj spell = (DC_ActiveObj) ref.getObj(KEYS.SPELL);
if (spell == null) {
return 0;
}
Obj target = ref.getTargetObj();
Obj source = ref.getSourceObj();
DAMAGE_TYPE type = spell.getEnergyType();
int specResist = 0;
PARAMETER typeResistance = DC_ContentManager.getDamageTypeResistance(type);
if (typeResistance != null) {
specResist = target.getIntParam(typeResistance);
}
int resistance = specResist;
// int resistance = target.getIntParam(PARAMS.RESISTANCE);
// resistance = MathMaster.addFactor(resistance, specResist);
resistance -= source.getIntParam(PARAMS.RESISTANCE_PENETRATION);
int mod = spell.getIntParam(PARAMS.RESISTANCE_MOD);
resistance = MathMaster.applyMod(resistance, mod);
return resistance;
}
use of main.content.values.parameters.PARAMETER in project Eidolons by IDemiurge.
the class DrawMaster method drawParamInfo.
private void drawParamInfo(Graphics g, Obj obj, PARAMETER p) {
if (obj.isFull(p)) {
return;
}
PARAMETER c_p = ContentManager.getCurrentParam(p);
VALUE_CASES CASE = SmartTextManager.getParamCase(c_p, obj);
String string = obj.getIntParam(c_p) + "/" + obj.getIntParam(p);
SmartText text = new SmartText(string, CASE.getColor());
Point c = DrawHelper.getPointForDisplayedParameter(p, text, compSize);
drawText(g, text, c);
}
use of main.content.values.parameters.PARAMETER in project Eidolons by IDemiurge.
the class DrawMaster method drawActiveIcons.
private void drawActiveIcons(Graphics g, Obj obj) {
// DrawHelper.AP_ICON_SIZE * objSize
int size = 28;
Image image = ImageManager.getSizedVersion(STD_IMAGES.ACTIONS.getPath(), size).getImage();
// if (isMultiObj())
// size = size * getMultiObjSizeMod() / 100; // image itself will be
// sized along with the
// rest
// DrawHelper.AP_ICON_X *
int x = getCompWidth() - size;
// DrawHelper.AP_ICON_Y *
int y = getCompHeight() - size;
Point p = new Point(x, y);
g.drawImage(image, p.x, p.y, null);
PARAMETER c_p = ContentManager.getCurrentParam(PARAMS.N_OF_ACTIONS);
VALUE_CASES CASE = SmartTextManager.getParamCase(c_p, obj);
String string = obj.getParam(c_p);
SmartText text = new SmartText(string, CASE.getColor());
int width = getCompWidth();
int height = getCompHeight();
Point c = new Point(width - FontMaster.getStringWidth(text.getFont(), text.getText()), height - FontMaster.getFontHeight(text.getFont()) / 2);
drawText(g, text, c);
// TODO after sizing down stacked objects, this becomes invalid!!!
Rectangle rect = new Rectangle(x, y, size, size);
cellComp.getMouseMap().put(rect, INTERACTIVE_ELEMENT.AP);
}
use of main.content.values.parameters.PARAMETER in project Eidolons by IDemiurge.
the class PropertyPage method getComponent.
@Override
protected EntityValueComponent getComponent(VALUE v) {
if (v instanceof PARAMETER) {
ParamElement pElement = new ParamElement(v);
pElement.setEntity(entity);
return pElement;
}
PROPERTY p = (PROPERTY) v;
if (isIconContainer(p)) {
ContainerIconElement containerIconElement = new ContainerIconElement(p);
X = STD_COMP_IMAGES.ARROW_3_RIGHT.getImg().getWidth(null) / 2 + (VISUALS.INFO_PANEL.getImage().getWidth(null) - ValueInfoPage.INNER_WIDTH) / 2;
containerIconElement.setEntity(entity);
return containerIconElement;
}
if (isWrappedText(p)) {
X = (VISUALS.INFO_PANEL.getImage().getWidth(null) - ValueInfoPage.INNER_WIDTH) / 2;
ContainerTextElement containerTextElement = new ContainerTextElement(p);
containerTextElement.setEntity(entity);
containerTextElement.refresh();
return containerTextElement;
}
PropertyElement propertyElement = new PropertyElement(p);
propertyElement.setEntity(entity);
return propertyElement;
}
use of main.content.values.parameters.PARAMETER in project Eidolons by IDemiurge.
the class FilterMaster method filter.
public static Collection<?> filter(Collection<?> list, String valueName, String value, OBJ_TYPE TYPE, boolean prop, boolean filterOut, Boolean strict_or_greater_less_equal) {
List<Object> filteredList = new ArrayList<>();
for (Object l : list) {
Entity entity;
if (l instanceof Entity) {
entity = (Entity) l;
} else {
entity = DataManager.getType(l.toString(), TYPE);
}
if (entity == null) {
continue;
}
boolean result;
if (prop) {
PROPERTY property = ContentManager.getPROP(valueName);
if (property.isContainer()) // if (!BooleanMaster.isFalse(strict_or_greater_less_equal))
{
result = entity.checkContainerProp(property, value, strict_or_greater_less_equal == null);
} else {
result = StringMaster.compareByChar(entity.getProperty(property), value, BooleanMaster.isTrue(strict_or_greater_less_equal));
}
// entity.checkProperty();
} else {
PARAMETER param = ContentManager.getPARAM(valueName);
int amount = new Formula(value).getInt(new Ref(entity));
if (strict_or_greater_less_equal == null) {
result = entity.getIntParam(param) == amount;
} else {
result = entity.checkParam(param, "" + amount);
if (!strict_or_greater_less_equal) {
result = !result;
}
}
}
if (filterOut) {
if (result) {
filteredList.add(l);
}
} else if (!result) {
filteredList.add(l);
}
}
for (Object l : filteredList) {
list.remove(l);
}
return list;
}
Aggregations