Search in sources :

Example 21 with Coordinates

use of main.game.bf.Coordinates in project Eidolons by IDemiurge.

the class AnimationManager method getMinNumberOfAnimsOutOfBounds.

private int getMinNumberOfAnimsOutOfBounds(int y, int x, int y1, int x1, boolean positive) {
    int minNumber = Integer.MAX_VALUE;
    // TODO consider the panning distance?
    int step = positive ? 1 : -1;
    while (MathMaster.compare(y, y1, !positive)) {
        x += step;
        if (MathMaster.compare(x, x1, positive)) {
            x = 0;
            y += step;
        }
        Coordinates c_offset = new Coordinates(x, y);
        adjustOffset(c_offset);
        ArrayList<PhaseAnimation> list = new ArrayList<>(pendingCameraAdjustmentAnims);
        for (PhaseAnimation anim : pendingCameraAdjustmentAnims) {
            boolean result = anim.updatePoints();
            if (result) {
                list.remove(anim);
            }
        }
        int size = list.size();
        if (size < minNumber) {
            minNumber = size;
        }
        offset = c_offset;
    }
    return minNumber;
}
Also used : Coordinates(main.game.bf.Coordinates)

Example 22 with Coordinates

use of main.game.bf.Coordinates in project Eidolons by IDemiurge.

the class DC_PositionMaster method getShapedCoordinates.

public static Set<Coordinates> getShapedCoordinates(Coordinates baseCoordinate, FACING_DIRECTION facing, int width, int height, SHAPES shape) {
    Set<Coordinates> list = new HashSet<>();
    List<Coordinates> line;
    switch(shape) {
        case CROSS:
            // 
            break;
        case STAR:
            // four diagonals
            break;
        case CONE:
            // getOrCreate horizontal lines of increasing width
            for (int i = 0; i < height; i++) {
                list.addAll(getLine(FacingMaster.rotate(facing, false).getDirection(), baseCoordinate, width));
                list.addAll(getLine(FacingMaster.rotate(facing, true).getDirection(), baseCoordinate, width));
                baseCoordinate = baseCoordinate.getAdjacentCoordinate(facing.getDirection());
                if (baseCoordinate == null) {
                    break;
                }
                width++;
            }
            break;
        case RECTANGLE:
            list.addAll(getLine(facing.getDirection(), baseCoordinate, height));
            line = getLine(facing.getDirection(), baseCoordinate, height);
            for (Coordinates c : line) {
                list.addAll(getLine(FacingMaster.rotate(facing, false).getDirection(), c, width));
                list.addAll(getLine(FacingMaster.rotate(facing, true).getDirection(), c, width));
            }
            line.remove(baseCoordinate);
            list.addAll(line);
            // }
            break;
    }
    return list;
}
Also used : Coordinates(main.game.bf.Coordinates) HashSet(java.util.HashSet)

Example 23 with Coordinates

use of main.game.bf.Coordinates in project Eidolons by IDemiurge.

the class DC_PagedLogPanel method addComponents.

protected void addComponents() {
    String pos = "pos 0 0";
    add(getCurrentComponent(), pos);
    addControls();
    returnButton = new CustomButton(VISUALS.ADD) {

        public void handleClick() {
            back();
        }

        protected void playClickSound() {
            DC_SoundMaster.playStandardSound(STD_SOUNDS.SLING);
        }

        public VISUALS getVisuals() {
            if (!isEnabled()) {
                return VISUALS.ADD_BLOCKED;
            }
            return super.getVisuals();
        }

        public boolean isEnabled() {
            // nodeViewMode
            return true;
        }
    };
    // toggleButton = new CustomButton(BUTTON_VISUALS) {
    // public void handleClick() {
    // toggleMode();
    // }
    // 
    // protected void playSound() {
    // DC_SoundMaster.playStandardSound(STD_SOUNDS.CLOCK);
    // }
    // 
    // };
    // 
    // pos = "pos " + (getPanelWidth() - BUTTON_VISUALS.getWidth()) + " "
    // + (getPanelHeight() - BUTTON_VISUALS.getHeight()) + "";
    // add(toggleButton, pos);
    pos = "pos 0 0";
    add(returnButton, pos);
    int i = 0;
    if (entryNodes != null) {
        for (final LogEntryNode node : entryNodes) {
            int lineIndex = (node.getLineIndex()) % getRowCount();
            if (lineIndex == 0) {
                lineIndex = getRowCount();
            }
            Integer y = Math.min(getPanelHeight() - EntryNodeMaster.getRowHeight(isTopPage()), EntryNodeMaster.getRowHeight(isTopPage()) * (lineIndex));
            // TODO
            // top
            // vs
            // generic
            // separate!
            ImageButton entryNodeButton = new ImageButton((node.getButtonImagePath())) {

                @Override
                public void handleClick() {
                    if (entryNode == null) {
                        setCachedTopPageIndex(getCurrentIndex());
                    }
                    if (node.getLinkedAnimation() != null) {
                        for (ANIM anim : node.getLinkedAnimations()) {
                            PhaseAnimation animation = (PhaseAnimation) anim;
                            // DC_Game.game.getAnimationManager()
                            // .getAnimation(key);
                            animation.setPhaseFilter(node.getAnimPhasesToPlay());
                            if (animation != null) {
                                animation.setReplay(true);
                                animation.start();
                                animation.setAutoFinish(false);
                            }
                        }
                        Coordinates bufferedOffset = game.getAnimationManager().updatePoints();
                        game.getManager().refreshGUI();
                        game.getBattleField().getGrid().setNextOffsetCoordinate(bufferedOffset);
                    }
                    setNodeView(node);
                }

                @Override
                protected void playClickSound() {
                    DC_SoundMaster.playStandardSound(STD_SOUNDS.DIS__OPEN_MENU);
                }
            };
            pos = "pos " + 0 + " " + (y);
            add(entryNodeButton, pos);
            entryNodeButton.activateMouseListener();
            setComponentZOrder(entryNodeButton, i);
            i++;
        }
    }
    setComponentZOrder(returnButton, i);
    i++;
    // setComponentZOrder(toggleButton, i);
    // i++;
    setComponentZOrder(forwardButton, i);
    i++;
    setComponentZOrder(backButton, i);
    i++;
    setComponentZOrder(getCurrentComponent(), i);
}
Also used : ImageButton(main.swing.components.ImageButton) PhaseAnimation(eidolons.system.graphics.PhaseAnimation) CustomButton(eidolons.swing.components.buttons.CustomButton) Coordinates(main.game.bf.Coordinates) LogEntryNode(main.system.text.LogEntryNode) ANIM(main.system.graphics.ANIM)

Example 24 with Coordinates

use of main.game.bf.Coordinates in project Eidolons by IDemiurge.

the class AnimMultiplicator method applyTemplateAngles.

private void applyTemplateAngles(Set<Coordinates> coordinates) {
    int max = template.getNumberOfEmitters(getActive());
    // 1 for ray, but we know coordinates precisely
    List<EmitterActor> list = new ArrayList<>();
    for (EmitterActor e : emitterList) {
        int angle = 0;
        for (Coordinates coordinate : coordinates) {
            if (e.isGenerated()) {
                continue;
            }
            EmitterActor actor = multiplicateEmitter(angle, coordinate, e);
            angle += 360 / max;
            list.add(actor);
        }
    }
    list.forEach(a -> emitterList.add(a));
}
Also used : Coordinates(main.game.bf.Coordinates) EmitterActor(eidolons.libgdx.anims.particles.EmitterActor)

Example 25 with Coordinates

use of main.game.bf.Coordinates in project Eidolons by IDemiurge.

the class AnimMultiplicator method filterCoordinates.

private Collection<Coordinates> filterCoordinates(SPELL_ANIMS template, Set<Coordinates> coordinates) {
    if (template != null) {
        FACING_DIRECTION facing = getActive().getOwnerObj().getFacing();
        List<Coordinates> filtered = new ArrayList<>(coordinates);
        Coordinates farthest = CoordinatesMaster.getFarmostCoordinateInDirection(facing.getDirection(), new ArrayList<>(coordinates), null);
        switch(template) {
            // template.getNumberOfEmitters(getActive())
            case RAY:
                anim.setForcedDestinationForAll(farthest);
                return Arrays.asList(farthest);
            case BLAST:
                break;
            case WAVE:
            case SPRAY:
                {
                    boolean xOrY = !facing.isVertical();
                    filtered.removeIf(c -> farthest.getXorY(xOrY) != c.getXorY(xOrY));
                    while (filtered.size() < template.getNumberOfEmitters(getActive())) {
                        List<Coordinates> list = new ArrayList<>(coordinates);
                        list.removeAll(filtered);
                        list.removeIf(c -> farthest.getXorY(!xOrY) == c.getXorY(!xOrY));
                        Coordinates c = CoordinatesMaster.getFarmostCoordinateInDirection(facing.getDirection(), list, null);
                        if (c != null)
                            filtered.add(c);
                    }
                    if (ListMaster.isNotEmpty(filtered))
                        return filtered;
                    else
                        return coordinates;
                }
            case RING:
                break;
            case NOVA:
                break;
        }
    }
    return coordinates;
}
Also used : LogMaster(main.system.auxiliary.log.LogMaster) java.util(java.util) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) ListMaster(main.system.auxiliary.data.ListMaster) SpellAnim(eidolons.libgdx.anims.std.SpellAnim) SPELL_ANIMS(eidolons.libgdx.anims.std.SpellAnim.SPELL_ANIMS) FACING_DIRECTION(main.game.bf.Coordinates.FACING_DIRECTION) Action(com.badlogic.gdx.scenes.scene2d.Action) MoveByAction(com.badlogic.gdx.scenes.scene2d.actions.MoveByAction) EmitterPools(eidolons.libgdx.anims.particles.EmitterPools) GridMaster(eidolons.libgdx.bf.GridMaster) G_PARAMS(main.content.values.parameters.G_PARAMS) GridMaster.getCenteredPos(eidolons.libgdx.bf.GridMaster.getCenteredPos) SequenceAction(com.badlogic.gdx.scenes.scene2d.actions.SequenceAction) EmitterActor(eidolons.libgdx.anims.particles.EmitterActor) Entity(main.entity.Entity) Ref(main.entity.Ref) Vector2(com.badlogic.gdx.math.Vector2) Coordinates(main.game.bf.Coordinates) CoordinatesMaster(eidolons.game.battlecraft.logic.battlefield.CoordinatesMaster) ZONE_ANIM_MODS(eidolons.libgdx.anims.std.SpellAnim.ZONE_ANIM_MODS) GeometryMaster(main.system.auxiliary.secondary.GeometryMaster) FACING_DIRECTION(main.game.bf.Coordinates.FACING_DIRECTION) Coordinates(main.game.bf.Coordinates)

Aggregations

Coordinates (main.game.bf.Coordinates)226 Unit (eidolons.entity.obj.unit.Unit)49 ObjType (main.entity.type.ObjType)30 ArrayList (java.util.ArrayList)29 Obj (main.entity.obj.Obj)28 DC_Obj (eidolons.entity.obj.DC_Obj)22 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)21 FACING_DIRECTION (main.game.bf.Coordinates.FACING_DIRECTION)21 DIRECTION (main.game.bf.Coordinates.DIRECTION)20 Ref (main.entity.Ref)15 MapBlock (eidolons.game.battlecraft.logic.dungeon.location.building.MapBlock)13 DC_Cell (eidolons.entity.obj.DC_Cell)12 Action (eidolons.game.battlecraft.ai.elements.actions.Action)11 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)9 BufferedImage (java.awt.image.BufferedImage)8 DequeImpl (main.system.datatypes.DequeImpl)8 Vector2 (com.badlogic.gdx.math.Vector2)7 DC_UnitAction (eidolons.entity.active.DC_UnitAction)7 ZCoordinates (main.game.bf.ZCoordinates)6 ObjAtCoordinate (main.entity.type.ObjAtCoordinate)5