Search in sources :

Example 21 with Unit

use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.

the class PartyInfoPanel method init.

public void init(MacroParty party) {
    clearChildren();
    clearListeners();
    this.party = party;
    TablePanel main = new TablePanel();
    this.columnDefaults(0).width(getMainWidth());
    this.columnDefaults(0).minWidth(getMainWidth());
    for (Unit sub : party.getMembers()) {
        PartyMemberComponent component = new PartyMemberComponent(sub);
        main.add(component).maxWidth(getMainWidth());
        main.row();
    }
    setSize((getMainWidth()), 128 * party.getMembers().size());
    // ;
    add(main);
    setX(0);
}
Also used : Unit(eidolons.entity.obj.unit.Unit) TablePanel(eidolons.libgdx.gui.panels.TablePanel)

Example 22 with Unit

use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.

the class FearsomeEffect method applyThis.

@Override
public boolean applyThis() {
    super.applyThis();
    Formula buffer = new Formula(formula.toString());
    formula = formula.getAppendedByFactor(-0.5);
    try {
        for (Unit unit : ((DC_Game) game).getUnits()) {
            if (!friendlyFire) {
                if (unit.getOwner().equals(ref.getSourceObj().getOwner())) {
                    continue;
                }
            }
            if (!unit.checkInSightForUnit((Unit) ref.getSourceObj())) {
                continue;
            }
            ref.setTarget(unit.getId());
            super.applyThis();
        }
    } catch (Exception ignored) {
    } finally {
        formula = buffer;
    }
    return true;
}
Also used : Formula(main.system.math.Formula) DC_Game(eidolons.game.core.game.DC_Game) Unit(eidolons.entity.obj.unit.Unit)

Example 23 with Unit

use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.

the class CampEffect method applyThis.

@Override
public boolean applyThis() {
    /*
        restore fully, dispel all timed buffs, apply bonus
         */
    List<Unit> allies = getGame().getMetaMaster().getPartyManager().getParty().getMembers();
    if (allies.isEmpty())
        getGame().getMetaMaster().getPartyManager().getParty().addMember(getGame().getMetaMaster().getPartyManager().getParty().getLeader());
    // mystery fix
    for (Unit sub : new LinkedList<>(allies)) {
        DC_HeroItemObj item = sub.getItemFromInventory("Food");
        if (item != null) {
            sub.removeFromInventory(item);
            continue;
        }
        DC_QuickItemObj qitem = sub.getQuickItem("Food");
        if (item != null) {
            sub.removeQuickItem(qitem);
            continue;
        }
        allies.remove(sub);
        continue;
    // remove
    }
    if (allies.isEmpty()) {
        FloatingTextMaster.getInstance().createFloatingText(TEXT_CASES.REQUIREMENT, "You need food supplies to camp!", ref.getSourceObj());
        return false;
    }
    Effects restorationEffects = new Effects();
    restorationEffects.add(new ModifyValueEffect(PARAMS.C_ENDURANCE, MOD.SET_TO_PERCENTAGE, "125", true));
    restorationEffects.add(new ModifyValueEffect(PARAMS.C_FOCUS, MOD.SET_TO_PERCENTAGE, "70", true));
    restorationEffects.add(new ModifyValueEffect(PARAMS.C_ESSENCE, MOD.SET_TO_PERCENTAGE, "100", true));
    restorationEffects.add(new ModifyValueEffect(PARAMS.C_STAMINA, MOD.SET_TO_PERCENTAGE, "125", true));
    restorationEffects.add(new ModifyValueEffect(PARAMS.C_TOUGHNESS, MOD.SET_TO_PERCENTAGE, "100", true));
    for (Unit sub : allies) {
        Ref REF = sub.getRef().getTargetingRef(sub);
        restorationEffects.apply(REF);
    }
    float time = 20;
    getGame().getDungeonMaster().getExplorationMaster().getTimeMaster().playerRests(time);
    // applyRested();
    for (Unit sub : allies) {
    }
    return true;
}
Also used : Ref(main.entity.Ref) DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj) Effects(main.ability.effects.Effects) Unit(eidolons.entity.obj.unit.Unit) LinkedList(java.util.LinkedList)

Example 24 with Unit

use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.

the class RestEffect method applyThis.

@Override
public boolean applyThis() {
    // whole party!
    /*
        add regen and wait()
        interrupt?
         remove buff?
         or rely on reset() ?

         block actions
         add shader
         */
    List<Unit> allies = getGame().getMetaMaster().getPartyManager().getParty().getMembers();
    for (Unit sub : allies) {
        Ref REF = sub.getRef().getTargetingRef(sub);
        new ModeEffect(STD_MODES.SLEEPING).apply(REF);
    }
    float time = 120;
    // (Boolean) WaitMaster.waitForInput(WAIT_OPERATIONS.WAIT_COMPLETE);
    Boolean result = getGame().getDungeonMaster().getExplorationMaster().getTimeMaster().playerRests(time);
    if (result) {
        // applyRested();
        for (Unit sub : allies) {
            sub.removeBuff("Sleeping");
            Ref REF = sub.getRef().getTargetingRef(sub);
            getRestedBuffEffect().apply(REF);
            new ModifyValueEffect(PARAMS.C_MORALE, MOD.MODIFY_BY_PERCENT, "15").apply(REF);
        }
    }
    return true;
}
Also used : Ref(main.entity.Ref) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) Unit(eidolons.entity.obj.unit.Unit) ModeEffect(eidolons.ability.effects.oneshot.mechanic.ModeEffect)

Example 25 with Unit

use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.

the class ThrowEffect method throwWeapon.

private boolean throwWeapon(DC_WeaponObj weapon) {
    ref.setID(KEYS.WEAPON, weapon.getId());
    ref.setValue(KEYS.DAMAGE_TYPE, weapon.getDamageType().getName());
    setWeapon(weapon);
    setOffhand(offhand);
    boolean result = super.applyThis();
    if (fromHand) {
        Unit hero = (Unit) ref.getSourceObj();
        if (offhand) {
            hero.setSecondWeapon(null);
        } else {
            hero.setWeapon(null);
            if (hero.getOffhandWeapon() != null) {
                if (!hero.getOffhandWeapon().isRanged()) {
                    if (hero.getOffhandWeapon().isWeapon()) {
                        hero.setWeapon(hero.getOffhandWeapon());
                        hero.setSecondWeapon(null);
                    }
                }
            }
        }
    }
    weapon.getGame().getDroppedItemManager().itemFalls(ref.getTargetObj().getCoordinates(), weapon);
    getActiveObj().getRef().setID(offhand ? KEYS.OFFHAND : KEYS.WEAPON, null);
    return result;
}
Also used : Unit(eidolons.entity.obj.unit.Unit)

Aggregations

Unit (eidolons.entity.obj.unit.Unit)258 Coordinates (main.game.bf.Coordinates)53 Ref (main.entity.Ref)33 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)30 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)26 DC_Obj (eidolons.entity.obj.DC_Obj)26 ArrayList (java.util.ArrayList)26 Obj (main.entity.obj.Obj)26 ObjType (main.entity.type.ObjType)23 DC_SpellObj (eidolons.entity.active.DC_SpellObj)13 DC_Cell (eidolons.entity.obj.DC_Cell)11 Event (main.game.logic.event.Event)11 DC_UnitAction (eidolons.entity.active.DC_UnitAction)10 List (java.util.List)10 DC_Game (eidolons.game.core.game.DC_Game)9 Action (eidolons.game.battlecraft.ai.elements.actions.Action)8 DequeImpl (main.system.datatypes.DequeImpl)8 OUTLINE_TYPE (main.content.enums.rules.VisionEnums.OUTLINE_TYPE)7 Entity (main.entity.Entity)7 DIRECTION (main.game.bf.Coordinates.DIRECTION)7