Search in sources :

Example 36 with Entity

use of main.entity.Entity in project Eidolons by IDemiurge.

the class SituationAnalyzer method getRangedDangerFactor.

public int getRangedDangerFactor(Unit unit) {
    int factor = 0;
    for (Entity e : Analyzer.getVisibleEnemies(unit.getAI())) {
        Unit enemy = (Unit) e;
        try {
            int rangedThreat = getThreatAnalyzer().getRangedThreat(unit, enemy);
            factor += rangedThreat;
            LogMaster.log(LOG_CHANNEL.AI_DEBUG, "Ranged threat " + rangedThreat + " from " + enemy.getName());
        } catch (Exception ex) {
            main.system.ExceptionMaster.printStackTrace(ex);
        }
    }
    int mod = getConstInt(AiConst.DANGER_RANGED_BASE) - ParamPriorityAnalyzer.getUnitLifeFactor(unit);
    LogMaster.log(LOG_CHANNEL.AI_DEBUG, "Ranged threat mod " + mod + " for " + unit.getName());
    if (mod != 0) {
        factor = factor * mod / 100;
    }
    LogMaster.log(LOG_CHANNEL.AI_DEBUG, "Ranged threat factor " + factor + " for " + unit.getName());
    return factor;
}
Also used : Entity(main.entity.Entity) Unit(eidolons.entity.obj.unit.Unit)

Example 37 with Entity

use of main.entity.Entity in project Eidolons by IDemiurge.

the class TestScriptExecutor method doHighlight.

private void doHighlight(Ref ref, String[] args) {
    // GuiEventManager.trigger(GuiEventType.HIGHLIGHT_OFF);
    String nameOrKey = args[0];
    ObjType type = DataManager.getType(nameOrKey);
    Entity entity = null;
    if (type != null) {
        DC_TYPE TYPE = (DC_TYPE) type.getOBJ_TYPE_ENUM();
        entity = findEntity(nameOrKey, ref, TYPE);
    } else {
        entity = ref.getObj(nameOrKey);
    }
// GuiEventManager.trigger(GuiEventType.HIGHLIGHT, entity);
}
Also used : Entity(main.entity.Entity) DC_TYPE(main.content.DC_TYPE) ObjType(main.entity.type.ObjType)

Example 38 with Entity

use of main.entity.Entity in project Eidolons by IDemiurge.

the class DC_ActionManager method resetActions.

@Override
public void resetActions(Entity entity) {
    if (!(entity instanceof Unit)) {
        return;
    }
    Unit unit = (Unit) entity;
    DequeImpl<ActiveObj> actives;
    // #1: reset prop with ids if nothing is changed
    // if (ListMaster.isNotEmpty(actives) && entity.isActivesReady()) {
    // entity.setProperty(ACTIVES, StringMaster
    // .constructContainer(StringMaster.convertToIdList(actives)));
    // return;
    // }
    actives = new DequeImpl<>();
    // #2: reset the list if prop has been modified (via Add/Remove effects
    // ++ items). They should set ActivesReady to false for that.
    // or upon init
    unit.setActionMap(new HashMap<>());
    // if (!unit.isStandardActionsAdded())
    if (!unit.isBfObj()) {
        actives.addAll(getStandardActions(unit));
    }
    String activesProp = entity.getProperty(ACTIVES);
    for (String typeName : StringMaster.open(activesProp)) {
        ObjType type = DataManager.getType(typeName, DC_TYPE.ACTIONS);
        DC_UnitAction action;
        if (type == null) {
            try {
                action = (DC_UnitAction) game.getObjectById(Integer.valueOf(typeName));
            } catch (Exception e) {
                continue;
            }
        } else {
            action = getOrCreateAction(typeName, entity);
        }
        // idList.add(action.getId() + "");
        actives.add(action);
    }
    // list = new DequeImpl<>(items);
    actives.removeIf(activeObj -> !isActionAvailable(activeObj, ExplorationMaster.isExplorationOn()));
    try {
        addSpecialActions(unit, actives);
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
    }
    if (ExplorationMaster.isExplorationOn())
        try {
            actives.removeIf(activeObj -> unit.getGame().getDungeonMaster().getExplorationMaster().getActionHandler().isActivationDisabledByExploration((DC_ActiveObj) activeObj));
            List<DC_ActiveObj> actions = unit.getGame().getDungeonMaster().getExplorationMaster().getActionHandler().getExplorationActions(unit);
            actives.addAll(actions);
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    unit.setActives(new ArrayList<>(actives));
    if (!unit.isBfObj()) {
        addHiddenActions(unit, unit.getActives());
    }
    try {
        constructActionMaps(unit);
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
    }
    // entity.setProperty(ACTIVES, StringMaster
    // .constructContainer(StringMaster.convertToIdList(actives)));
    entity.setActivesReady(true);
    for (ActiveObj a : actives) {
        if (activesProp.contains(a.getName())) {
            activesProp += a.getName() + ";";
        }
    }
    entity.setProperty(ACTIVES, activesProp);
}
Also used : DC_WeaponObj(eidolons.entity.item.DC_WeaponObj) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj) Active(main.entity.obj.Active) Trap(eidolons.game.module.dungeoncrawl.objects.Trap) ActionManager(main.game.logic.generic.ActionManager) Entrance(eidolons.game.module.dungeoncrawl.dungeon.Entrance) ActionEnums(main.content.enums.entity.ActionEnums) Ref(main.entity.Ref) VariableManager(main.data.ability.construct.VariableManager) ExtraAttacksRule(eidolons.game.battlecraft.rules.combat.attack.extra_attack.ExtraAttacksRule) ACTION_TYPE(main.content.enums.entity.ActionEnums.ACTION_TYPE) Player(main.game.logic.battle.player.Player) Weaver(main.system.threading.Weaver) DC_TYPE(main.content.DC_TYPE) GenericEnums(main.content.enums.GenericEnums) DungeonLevelMaster(eidolons.game.module.dungeoncrawl.dungeon.DungeonLevelMaster) ItemEnums(main.content.enums.entity.ItemEnums) ContentManager(main.content.ContentManager) DC_Game(eidolons.game.core.game.DC_Game) ExplorationMaster(eidolons.game.module.dungeoncrawl.explore.ExplorationMaster) ActionType(main.entity.type.ActionType) PARAMETER(main.content.values.parameters.PARAMETER) UnitAnalyzer(eidolons.game.battlecraft.rules.UnitAnalyzer) DualAttackMaster(eidolons.game.battlecraft.rules.combat.attack.dual.DualAttackMaster) java.util(java.util) ActiveObj(main.entity.obj.ActiveObj) MicroGame(main.game.core.game.MicroGame) DequeImpl(main.system.datatypes.DequeImpl) PARAMS(eidolons.content.PARAMS) StringMaster(main.system.auxiliary.StringMaster) DC_FeatObj(eidolons.entity.obj.attach.DC_FeatObj) STD_ACTION_MODES(main.content.CONTENT_CONSTS2.STD_ACTION_MODES) FleeRule(eidolons.game.battlecraft.rules.mechanics.FleeRule) FEATURE(eidolons.game.battlecraft.rules.RuleMaster.FEATURE) G_PROPS(main.content.values.properties.G_PROPS) ActionGenerator(eidolons.ability.ActionGenerator) LogMaster(main.system.auxiliary.log.LogMaster) ObjType(main.entity.type.ObjType) ListMaster(main.system.auxiliary.data.ListMaster) PROPS(eidolons.content.PROPS) Obj(main.entity.obj.Obj) KEYS(main.entity.Ref.KEYS) TrapMaster(eidolons.game.module.dungeoncrawl.objects.TrapMaster) Entity(main.entity.Entity) ACTION_TYPE_GROUPS(main.content.enums.entity.ActionEnums.ACTION_TYPE_GROUPS) DataManager(main.data.DataManager) RuleMaster(eidolons.game.battlecraft.rules.RuleMaster) Unit(eidolons.entity.obj.unit.Unit) UnitEnums(main.content.enums.entity.UnitEnums) EnumMaster(main.system.auxiliary.EnumMaster) ActiveObj(main.entity.obj.ActiveObj) ObjType(main.entity.type.ObjType) Unit(eidolons.entity.obj.unit.Unit)

Example 39 with Entity

use of main.entity.Entity in project Eidolons by IDemiurge.

the class CharacterCreator method typeSelected.

public static void typeSelected(final Entity type) {
    if (type != null) {
        DC_Game.game.getValueHelper().setEntity(type);
    }
    if (Launcher.getView() == VIEWS.T3) {
        HC_Master.getT3View().selected(type);
        return;
    }
    DC_PagedInfoPanel firstPanel = getHeroPanel().getMiddlePanel().getUpperPanel();
    Entity entity = firstPanel.getEntity();
    firstPanel.setEntity(type);
    firstPanel.refresh();
    try {
        getHeroPanel().getMiddlePanel().getArc().getUpperIcon().setIcon(new ImageIcon(type.getImage()));
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
    }
    DC_PagedInfoPanel secondPanel = getHeroPanel().getMiddlePanel().getLowerPanel();
    if (secondPanel != null) {
        secondPanel.setEntity(entity);
        secondPanel.refresh();
        try {
            getHeroPanel().getMiddlePanel().getArc().getLowerIcon().setIcon(new ImageIcon(entity.getImage()));
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    }
}
Also used : DC_PagedInfoPanel(eidolons.swing.components.panels.page.info.DC_PagedInfoPanel) Entity(main.entity.Entity)

Example 40 with Entity

use of main.entity.Entity in project Eidolons by IDemiurge.

the class HeroManager method stepBack.

// for HC
public void stepBack(Unit hero) {
    if (!game.isSimulation()) {
        return;
    }
    Stack<ObjType> stack = typeStacks.get(hero);
    if (stack == null) {
        return;
    }
    Entity type = stack.pop();
    applyChangedType(true, hero, type);
    CharacterCreator.setSelectedHeroType(hero.getType());
    if (CharacterCreator.getPanel().isPrincipleView()) {
        CharacterCreator.getPanel().getPrincipleViewComp().reset();
    }
}
Also used : Entity(main.entity.Entity) ObjType(main.entity.type.ObjType)

Aggregations

Entity (main.entity.Entity)41 ObjType (main.entity.type.ObjType)11 Unit (eidolons.entity.obj.unit.Unit)7 PARAMETER (main.content.values.parameters.PARAMETER)5 Obj (main.entity.obj.Obj)5 OBJ_TYPE (main.content.OBJ_TYPE)4 Ref (main.entity.Ref)4 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)3 DC_PagedInfoPanel (eidolons.swing.components.panels.page.info.DC_PagedInfoPanel)3 ArrayList (java.util.ArrayList)3 DC_TYPE (main.content.DC_TYPE)3 ITEM_SLOT (main.content.enums.entity.ItemEnums.ITEM_SLOT)3 DC_SpellObj (eidolons.entity.active.DC_SpellObj)2 DC_WeaponObj (eidolons.entity.item.DC_WeaponObj)2 LinkedList (java.util.LinkedList)2 ActiveObj (main.entity.obj.ActiveObj)2 ArcaneEntity (main.logic.ArcaneEntity)2 AtlasRegion (com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion)1 Vector2 (com.badlogic.gdx.math.Vector2)1 ActionGenerator (eidolons.ability.ActionGenerator)1