Search in sources :

Example 41 with Unit

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

the class PartyHelper method addCreepParty.

public static void addCreepParty(Wave wave) {
    DC_Game game = wave.getGame();
    Unit leader = wave.getLeader();
    String name = wave.getName();
    List<Unit> units = wave.getUnits();
    ObjType newType = new ObjType(game);
    wave.setParty(addCreepParty(leader, name, units, newType));
}
Also used : ObjType(main.entity.type.ObjType) DC_Game(eidolons.game.core.game.DC_Game) Unit(eidolons.entity.obj.unit.Unit)

Example 42 with Unit

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

the class PartyHelper method getPrincipleConditions.

public static Conditions getPrincipleConditions(Party party) {
    Conditions principlesConditions = new Conditions();
    for (Unit m : party.getMembers()) {
        String principles = m.getProperty(G_PROPS.PRINCIPLES);
        Condition principlesCondition = new PrinciplesCondition(principles, "{MATCH_" + G_PROPS.PRINCIPLES + "}", true);
        principlesConditions.add(principlesCondition);
    }
    return principlesConditions;
}
Also used : PrinciplesCondition(main.elements.conditions.PrinciplesCondition) Condition(main.elements.conditions.Condition) Unit(eidolons.entity.obj.unit.Unit) PrinciplesCondition(main.elements.conditions.PrinciplesCondition) Conditions(main.elements.conditions.Conditions)

Example 43 with Unit

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

the class EngagedRule method disengaged.

public void disengaged(DC_ActiveObj action) {
    // disengager.getGame().fireEvent(new
    // Event(STANDARD_EVENT_TYPE.DISENGAGED, disengager.getRef()));
    Unit disengaged = action.getOwnerObj();
    for (Unit unit : action.getGame().getUnits()) {
        if (unit.getEngagementTarget() == disengaged) {
            checkAoO(action, unit);
            if (PositionMaster.getDistance(unit, disengaged) >= 1) {
                unit.setEngagementTarget(null);
            }
        }
    }
    disengaged.setEngagementTarget(null);
}
Also used : Unit(eidolons.entity.obj.unit.Unit)

Example 44 with Unit

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

the class EngagedRule method checkDisengagingActionCancelled.

public boolean checkDisengagingActionCancelled(DC_ActiveObj action) {
    if (action.getRef().getTargetObj() == action.getOwnerObj().getEngagementTarget()) {
        return false;
    }
    Unit unit = action.getOwnerObj();
    boolean prompt = !unit.isAiControlled() && action.getActionGroup() != ActionEnums.ACTION_TYPE_GROUPS.MODE && action.getActionGroup() != ActionEnums.ACTION_TYPE_GROUPS.ATTACK;
    if (prompt) {
        if (action.getRef().getTargetObj() == null || action.getRef().getTargetObj() == unit) {
            // self-targeting or misc instants shouldn't bother
            if (action.checkProperty(G_PROPS.SPELL_TAGS, SpellEnums.SPELL_TAGS.INSTANT.toString())) {
                prompt = false;
            } else if (action.checkProperty(G_PROPS.ACTION_TAGS, ActionEnums.ACTION_TAGS.INSTANT.toString())) {
                prompt = false;
            }
        // auto-disengage if moved away! (blink)
        // spells TODO
        }
    }
    if (!prompt) {
        return false;
    }
    return !promptDisengage(action);
}
Also used : Unit(eidolons.entity.obj.unit.Unit)

Example 45 with Unit

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

the class PerceptionRule method actionComplete.

public void actionComplete(ActiveObj activeObj) {
    Unit unit = (Unit) activeObj.getOwnerObj();
    PERCEPTION_STATUS status;
    int actionNoise = activeObj.getIntParam(PARAMS.NOISE, false) + activeObj.getOwnerObj().getIntParam(PARAMS.NOISE, false);
    for (Unit source : getUnits(activeObj)) {
    // status = getPerceptionStatus(source, activeObj, actionNoise);
    // map of statuses would be nice...
    // statusMap.getOrCreate(source).put(unit, status);
    // checkResetPlayerPerceptionStatus(status, source, unit);
    // personal independent detection?
    }
// GroupAI instead!!! Let it know where to look...
// perceived(source, unit); // creeps' KNOW ... -> stop wandering
// around!
// this status
}
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