Search in sources :

Example 31 with DC_Obj

use of eidolons.entity.obj.DC_Obj in project Eidolons by IDemiurge.

the class CoatingRule method unitIsHit.

public static void unitIsHit(BattleFieldObject target, Unit source, boolean offhand, DC_ActiveObj action, Attack attack, DC_Obj weapon) {
    boolean throwing = false;
    // DC_WeaponObj weaponObj = (DC_WeaponObj) weapon;
    if (action.isRanged()) {
        if (action.getRef().getObj(KEYS.RANGED) != null) {
            if (!action.isThrow()) {
                if (action.getRef().getObj(KEYS.RANGED).getRef().getObj(KEYS.AMMO) != null) {
                    weapon = (DC_Obj) action.getRef().getObj(KEYS.RANGED).getRef().getObj(KEYS.AMMO);
                }
            }
        }
    }
    if (action instanceof DC_QuickItemAction) {
        weapon = (DC_Obj) action.getRef().getObj(KEYS.ITEM);
        throwing = true;
    }
    DC_Obj armor = (DC_Obj) target.getRef().getObj(KEYS.ARMOR);
    for (COUNTER c : COATING_COUNTERS) {
        boolean ranged = action.isRanged() || throwing;
        applyCounters(target, weapon, source, c, action, throwing);
        if (// TODO throwing doesn't count?
        ranged) {
            continue;
        }
        // counters could have effect on items as well, durability at least
        if (armor != null) {
            applyCounters(source, armor, target, c, action, throwing);
        }
    }
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) DC_QuickItemAction(eidolons.entity.active.DC_QuickItemAction) COUNTER(main.content.enums.entity.UnitEnums.COUNTER)

Example 32 with DC_Obj

use of eidolons.entity.obj.DC_Obj in project Eidolons by IDemiurge.

the class ConcealmentRule method getMissChance.

// DEPENDING ON VISIBILITY_LEVEL?
public static int getMissChance(DC_ActiveObj action) {
    DC_Obj source = action.getOwnerObj();
    Obj target = action.getRef().getTargetObj();
    Obj cell = source.getGame().getCellByCoordinate(source.getCoordinates());
    // if (source.checkPassive(STANDARD_PASSIVES.DARKVISION))
    // return false;
    // if (source.checkPassive(STANDARD_PASSIVES.LIGHTVISION))
    // return false;
    int chance = target.getIntParam(PARAMS.CONCEALMENT) - source.getIntParam(PARAMS.DETECTION) - // - target.getIntParam(PARAMS.NOISE) / 2
    source.getIntParam(PARAMS.ACCURACY) - source.getIntParam(PARAMS.ILLUMINATION) + // vision...
    cell.getIntParam(PARAMS.CONCEALMENT);
    if (chance < 0) {
        chance = 0;
    }
    chance -= source.getIntParam(PARAMS.ILLUMINATION);
    if (chance < 0) {
        chance += 500;
        if (chance < 0)
            return -(chance) / 2;
        else
            return 0;
    }
    return (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 33 with DC_Obj

use of eidolons.entity.obj.DC_Obj in project Eidolons by IDemiurge.

the class EvasionRule method getMissChance.

public static int getMissChance(DC_ActiveObj action) {
    DC_Obj source = action.getOwnerObj();
    Obj target = action.getRef().getTargetObj();
    int chance = target.getIntParam(PARAMS.EVASION) - source.getIntParam(PARAMS.ACCURACY);
    return 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 34 with DC_Obj

use of eidolons.entity.obj.DC_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 35 with DC_Obj

use of eidolons.entity.obj.DC_Obj in project Eidolons by IDemiurge.

the class BfGridComp method repaintToBuffer.

private void repaintToBuffer() {
    Graphics2D g = (Graphics2D) bufferImage.getGraphics();
    // TODO imageManager update
    for (int i = 0; i < getDisplayedCellsX(); i++) {
        for (int j = 0; j < getDisplayedCellsY(); j++) {
            if (i + getOffsetX() >= cells.length) {
                return;
            }
            if (j + getOffsetY() >= cells[0].length) {
                continue;
            }
            CellComp cellComp = cells[i + getOffsetX()][j + getOffsetY()];
            if (editMode) {
                Coordinates c = new Coordinates(i + getOffsetX(), j + getOffsetY());
                cellComp.setObjects(getGame().getObjectsOnCoordinate(c));
                // cellComp.setOverlayingObjects(getGame().getOverlayingObjects(c));
                cellComp.setSizeFactor(zoom);
                cellComp.setWidth(getCellWidth());
                cellComp.setHeight(getCellHeight());
                cellComp.refresh();
            }
            BufferedImage compImage = cellComp.getPaintImage();
            g.drawImage(compImage, getX(i), getY(j), null);
        }
    }
    // DrawMasterStatic.drawDiagonalJoints(zoom, g, getOffsetX(), getOffsetY(), getCellWidth(),
    // getCellHeight(), getGame().getBattleFieldManager().getDiagonalJoints());
    Unit activeObj = getGame().getManager().getActiveObj();
    if (activeObj != null) {
        // if (!activeObj.isAnimated())
        if (!getGame().getAnimationManager().isStackAnimOverride(activeObj.getCoordinates())) {
            drawSelectionGlowOverlay(g, activeObj, false);
        }
    }
    drawUnderlays(g);
    DC_Obj infoObj = getGame().getManager().getInfoObj();
    if (infoObj != null) {
        // if (!activeObj.isAnimated())
        if (!getGame().getAnimationManager().isStackAnimOverride(infoObj.getCoordinates())) {
            drawSelectionGlowOverlay(g, infoObj, true);
        }
    }
    drawOverlays(g);
    if (!editMode) {
        DrawMasterStatic.drawWatchInfo(zoom, g);
    }
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) Coordinates(main.game.bf.Coordinates) Unit(eidolons.entity.obj.unit.Unit) BufferedImage(java.awt.image.BufferedImage)

Aggregations

DC_Obj (eidolons.entity.obj.DC_Obj)49 Unit (eidolons.entity.obj.unit.Unit)13 Obj (main.entity.obj.Obj)13 Coordinates (main.game.bf.Coordinates)12 ArrayList (java.util.ArrayList)11 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)9 DIRECTION (main.game.bf.Coordinates.DIRECTION)7 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)5 DC_Cell (eidolons.entity.obj.DC_Cell)4 BufferedImage (java.awt.image.BufferedImage)4 List (java.util.List)3 ModifyCounterEffect (eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect)2 DC_UnitAction (eidolons.entity.active.DC_UnitAction)2 HashMap (java.util.HashMap)2 PARAMETER (main.content.values.parameters.PARAMETER)2 Ref (main.entity.Ref)2 BuffObj (main.entity.obj.BuffObj)2 Pair (org.apache.commons.lang3.tuple.Pair)2 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)1 Image (com.badlogic.gdx.scenes.scene2d.ui.Image)1