Search in sources :

Example 86 with PARAMETER

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;
}
Also used : DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Obj(main.entity.obj.Obj) DAMAGE_TYPE(main.content.enums.GenericEnums.DAMAGE_TYPE) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) PARAMETER(main.content.values.parameters.PARAMETER)

Example 87 with PARAMETER

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);
}
Also used : VALUE_CASES(main.swing.renderers.SmartTextManager.VALUE_CASES) SmartText(main.system.text.SmartText) PARAMETER(main.content.values.parameters.PARAMETER)

Example 88 with PARAMETER

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);
}
Also used : VALUE_CASES(main.swing.renderers.SmartTextManager.VALUE_CASES) SmartText(main.system.text.SmartText) BufferedImage(java.awt.image.BufferedImage) PARAMETER(main.content.values.parameters.PARAMETER)

Example 89 with PARAMETER

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;
}
Also used : PROPERTY(main.content.values.properties.PROPERTY) PARAMETER(main.content.values.parameters.PARAMETER)

Example 90 with PARAMETER

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;
}
Also used : Entity(main.entity.Entity) Formula(main.system.math.Formula) Ref(main.entity.Ref) PROPERTY(main.content.values.properties.PROPERTY) ArrayList(java.util.ArrayList) PARAMETER(main.content.values.parameters.PARAMETER)

Aggregations

PARAMETER (main.content.values.parameters.PARAMETER)136 PROPERTY (main.content.values.properties.PROPERTY)22 ObjType (main.entity.type.ObjType)13 ArrayList (java.util.ArrayList)12 Formula (main.system.math.Formula)12 Ref (main.entity.Ref)9 VALUE (main.content.VALUE)7 Obj (main.entity.obj.Obj)7 PARAMS (eidolons.content.PARAMS)6 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)5 Cost (main.elements.costs.Cost)5 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)4 G_Panel (main.swing.generic.components.G_Panel)4 Node (org.w3c.dom.Node)4 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)3 HashMap (java.util.HashMap)3 DAMAGE_TYPE (main.content.enums.GenericEnums.DAMAGE_TYPE)3 Costs (main.elements.costs.Costs)3 Entity (main.entity.Entity)3 GraphicComponent (main.swing.generic.components.misc.GraphicComponent)3