Search in sources :

Example 6 with DequeImpl

use of main.system.datatypes.DequeImpl in project Eidolons by IDemiurge.

the class SightMaster method getSpectrumCoordinates.

public DequeImpl<Coordinates> getSpectrumCoordinates(Integer range, Integer side_penalty, Integer back_bonus, BattleFieldObject source, boolean vision, FACING_DIRECTION facing, boolean extended) {
    DequeImpl<Coordinates> list = new DequeImpl<>();
    BattleFieldObject unit = null;
    Coordinates orig = source.getCoordinates();
    if (source instanceof BattleFieldObject) {
        unit = (BattleFieldObject) source;
    }
    if (facing == null) {
        if (unit != null) {
            facing = unit.getFacing();
        }
    }
    DIRECTION direction;
    if (facing == null) {
        facing = FacingMaster.getRandomFacing();
    }
    direction = facing.getDirection();
    if (range == null) {
        range = source.getIntParam(PARAMS.SIGHT_RANGE);
        if (extended) {
            range = MathMaster.applyModIfNotZero(range, source.getIntParam(PARAMS.SIGHT_RANGE_EXPANSION));
        }
    }
    if (side_penalty == null) {
        side_penalty = source.getIntParam(PARAMS.SIDE_SIGHT_PENALTY);
        if (extended) {
            side_penalty = MathMaster.applyModIfNotZero(side_penalty, source.getIntParam(PARAMS.SIGHT_RANGE_EXPANSION_SIDES));
        }
    }
    if (back_bonus == null) {
        back_bonus = source.getIntParam(PARAMS.BEHIND_SIGHT_BONUS);
        if (!extended)
            back_bonus--;
    // back_bonus = MathMaster.applyModIfNotZero(back_bonus, source
    // .getIntParam(PARAMS.SIGHT_RANGE_EXPANSION_BACKWARD));
    }
    addLine(orig.getAdjacentCoordinate(direction), range, list, direction, true);
    addSides(list, orig, direction, range - side_penalty, false);
    DIRECTION backDirection = DirectionMaster.flip(direction);
    Coordinates backCoordinate = orig.getAdjacentCoordinate(backDirection);
    if (back_bonus > 0) {
        if (backCoordinate != null) {
            addLine(backCoordinate, back_bonus, list, backDirection, true);
        // if (back_bonus > side_penalty)
        // addSides(list, backCoordinate, backDirection, back_bonus -
        // side_penalty, false);
        }
    }
    Collection<Coordinates> blocked = getBlockedList(list, source, facing);
    list.removeAll(blocked);
    list.add(source.getCoordinates());
    return list;
}
Also used : BattleFieldObject(eidolons.entity.obj.BattleFieldObject) Coordinates(main.game.bf.Coordinates) FACING_DIRECTION(main.game.bf.Coordinates.FACING_DIRECTION) DIRECTION(main.game.bf.Coordinates.DIRECTION) DequeImpl(main.system.datatypes.DequeImpl)

Example 7 with DequeImpl

use of main.system.datatypes.DequeImpl in project Eidolons by IDemiurge.

the class NewsWatcher method readConfig.

private static void readConfig() {
    List<String> list = StringMaster.openContainer(readFile(getKeywordsPath(), cyrillic), "#");
    NewsFilterer.setKeywords(list);
    list = StringMaster.openContainer(readFile(getWebsitesPath(), false), "\n");
    NewsReader.setWebsites(new DequeImpl(list));
    list = StringMaster.openContainer(readFile(getEmailsPath(), false), "\n");
    NewsAlerter.setEmails(list);
}
Also used : DequeImpl(main.system.datatypes.DequeImpl)

Example 8 with DequeImpl

use of main.system.datatypes.DequeImpl in project Eidolons by IDemiurge.

the class DeathMaster method killAllUnits.

public void killAllUnits(boolean removeBfObjects, boolean retainPlayerParty, boolean quiet) {
    DequeImpl<BattleFieldObject> list = new DequeImpl();
    List<BattleFieldObject> toRemove = new ArrayList<>();
    list.addAll(getGame().getUnits());
    if (removeBfObjects) {
        list.addAll(getGame().getStructures());
    }
    for (BattleFieldObject unit : list) {
        if (retainPlayerParty) {
            if (PartyHelper.getParty() != null) {
                if (PartyHelper.getParty().getMembers().contains(unit)) {
                    continue;
                }
            }
        // if (unit.isMine())
        // continue;
        }
        unit.kill(unit, false, quiet);
        toRemove.add(unit);
    }
    // if (remove)
    for (BattleFieldObject unit : toRemove) {
        getGame().remove(unit);
    }
// reset();
// refreshAll();
// WaitMaster.receiveInput(WAIT_OPERATIONS.ACTION_COMPLETE, true);
}
Also used : BattleFieldObject(eidolons.entity.obj.BattleFieldObject) ArrayList(java.util.ArrayList) DequeImpl(main.system.datatypes.DequeImpl)

Example 9 with DequeImpl

use of main.system.datatypes.DequeImpl in project Eidolons by IDemiurge.

the class BfMouseListener method checkAnimationClick.

public boolean checkAnimationClick(MouseEvent e) {
    point = e.getPoint();
    DequeImpl<PhaseAnimation> animations = new DequeImpl<>(gridComp.getGame().getAnimationManager().getAnimations());
    animations.addAll(gridComp.getGame().getAnimationManager().getTempAnims());
    if (SwingUtilities.isRightMouseButton(e)) {
        for (PhaseAnimation anim : animations) {
            if (checkToggleTooltip(anim, e)) {
                return true;
            }
            if (anim.contains(e.getPoint())) {
                if (e.getClickCount() > 1) {
                    if (anim.isPaused()) {
                        anim.resume();
                    } else {
                        anim.pause();
                    }
                    return true;
                }
                AnimPhase phase = anim.getPhase();
                if (phase != null) {
                    if (anim.subPhaseClosed()) {
                        DC_SoundMaster.playStandardSound(STD_SOUNDS.BACK);
                        return true;
                    }
                }
            }
        }
    }
    for (PhaseAnimation anim : animations) {
        if (anim.getMouseMap() != null) {
            for (Rectangle rect : anim.getMouseMap().keySet()) {
                if (rect.contains(point)) {
                    MouseItem item = anim.getMouseMap().get(rect);
                    return itemClicked(item, anim);
                }
            }
        }
    }
    return false;
}
Also used : AnimPhase(main.system.graphics.AnimPhase) PhaseAnimation(eidolons.system.graphics.PhaseAnimation) MouseItem(eidolons.system.graphics.AnimationManager.MouseItem) DequeImpl(main.system.datatypes.DequeImpl)

Example 10 with DequeImpl

use of main.system.datatypes.DequeImpl in project Eidolons by IDemiurge.

the class EditorParticleMaster method removeClosest.

public void removeClosest(int x, int y) {
    float minDistance = Float.MAX_VALUE;
    Actor actor = null;
    DequeImpl<Actor> list = new DequeImpl<>(particles.getEmitterMap().get(time));
    list.addAll(map.get(time));
    for (Actor sub : list) {
        if (sub instanceof EmitterActor) {
            float distance = new Vector2(x, y).dst(new Vector2(sub.getX(), sub.getY()));
            if (distance < minDistance) {
                minDistance = distance;
                actor = sub;
            }
        }
    // can we not attach click listeners to emtiterActors?!
    }
    removeEmitter((EmitterActor) actor, time);
}
Also used : Vector2(com.badlogic.gdx.math.Vector2) Actor(com.badlogic.gdx.scenes.scene2d.Actor) EmitterActor(eidolons.libgdx.anims.particles.EmitterActor) EmitterActor(eidolons.libgdx.anims.particles.EmitterActor) DequeImpl(main.system.datatypes.DequeImpl)

Aggregations

DequeImpl (main.system.datatypes.DequeImpl)16 Coordinates (main.game.bf.Coordinates)8 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)7 Unit (eidolons.entity.obj.unit.Unit)6 ArrayList (java.util.ArrayList)4 Obj (main.entity.obj.Obj)4 Vector2 (com.badlogic.gdx.math.Vector2)3 DC_Obj (eidolons.entity.obj.DC_Obj)3 DC_Game (eidolons.game.core.game.DC_Game)3 Entrance (eidolons.game.module.dungeoncrawl.dungeon.Entrance)3 Ref (main.entity.Ref)3 Gdx (com.badlogic.gdx.Gdx)2 Keys (com.badlogic.gdx.Input.Keys)2 Batch (com.badlogic.gdx.graphics.g2d.Batch)2 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)2 Group (com.badlogic.gdx.scenes.scene2d.Group)2 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)2 Image (com.badlogic.gdx.scenes.scene2d.ui.Image)2 Label (com.badlogic.gdx.scenes.scene2d.ui.Label)2 Align (com.badlogic.gdx.utils.Align)2