Search in sources :

Example 86 with Obj

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);
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) DC_Obj(eidolons.entity.obj.DC_Obj) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Obj(main.entity.obj.Obj)

Example 87 with Obj

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;
            }
        }
    }
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) Obj(main.entity.obj.Obj) Coordinates(main.game.bf.Coordinates) BufferedImage(java.awt.image.BufferedImage)

Example 88 with Obj

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);
}
Also used : Obj(main.entity.obj.Obj) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) ListMaster(main.system.auxiliary.data.ListMaster)

Example 89 with Obj

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;
}
Also used : Ref(main.entity.Ref) OwnershipCondition(main.elements.conditions.standard.OwnershipCondition) Filter(main.elements.Filter) Obj(main.entity.obj.Obj) Conditions(main.elements.conditions.Conditions)

Example 90 with Obj

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());
        }
    }
}
Also used : ObjType(main.entity.type.ObjType) Obj(main.entity.obj.Obj) VALUE(main.content.VALUE)

Aggregations

Obj (main.entity.obj.Obj)127 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)34 DC_Obj (eidolons.entity.obj.DC_Obj)30 Coordinates (main.game.bf.Coordinates)27 Unit (eidolons.entity.obj.unit.Unit)24 ArrayList (java.util.ArrayList)19 Ref (main.entity.Ref)15 DC_SpellObj (eidolons.entity.active.DC_SpellObj)14 BuffObj (main.entity.obj.BuffObj)13 DC_WeaponObj (eidolons.entity.item.DC_WeaponObj)12 DC_QuickItemObj (eidolons.entity.item.DC_QuickItemObj)11 ActiveObj (main.entity.obj.ActiveObj)10 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)9 PassiveAbilityObj (main.ability.PassiveAbilityObj)9 ObjType (main.entity.type.ObjType)8 DC_HeroItemObj (eidolons.entity.item.DC_HeroItemObj)7 DC_BuffObj (eidolons.entity.obj.attach.DC_BuffObj)7 PARAMETER (main.content.values.parameters.PARAMETER)7 Conditions (main.elements.conditions.Conditions)6 MicroObj (main.entity.obj.MicroObj)6