Search in sources :

Example 6 with DC_Player

use of eidolons.game.battlecraft.logic.battle.universal.DC_Player in project Eidolons by IDemiurge.

the class WorldGenerator method generateFactions.

private static void generateFactions() {
    for (String sub : StringMaster.openContainer(world.getProperty(MACRO_PROPS.FACTIONS))) {
        boolean me = world.checkProperty(MACRO_PROPS.PLAYER_FACTION, sub);
        ObjType type = DataManager.getType(sub, MACRO_OBJ_TYPES.FACTIONS);
        FLAG_COLOR color = new EnumMaster<FLAG_COLOR>().retrieveEnumConst(FLAG_COLOR.class, type.getProperty(PROPS.FLAG_COLOR));
        if (color == null)
            color = FLAG_COLOR.BROWN;
        DC_Player player = new DC_Player(sub, color, type.getProperty(G_PROPS.EMBLEM), type.getProperty(G_PROPS.IMAGE), me ? ALLEGIENCE.ALLY : ALLEGIENCE.ENEMY);
        Faction faction = new Faction(type, player);
        game.addFaction(faction);
        if (me)
            game.setPlayerFaction(faction);
    }
}
Also used : ObjType(main.entity.type.ObjType) FLAG_COLOR(main.system.graphics.ColorManager.FLAG_COLOR) DC_Player(eidolons.game.battlecraft.logic.battle.universal.DC_Player) Faction(eidolons.game.module.adventure.faction.Faction)

Example 7 with DC_Player

use of eidolons.game.battlecraft.logic.battle.universal.DC_Player in project Eidolons by IDemiurge.

the class VisionMaster method resetVisibilityStatuses.

public void resetVisibilityStatuses() {
    Chronos.mark("VISIBILITY REFRESH");
    ClearShotCondition.clearCache();
    getGammaMaster().clearCache();
    getIlluminationMaster().clearCache();
    getSightMaster().clearCaches();
    visionController.reset();
    if (getActiveUnit() == null) {
        LogMaster.log(1, "***********null active activeUnit for visibility!");
        return;
    }
    // resetForActiveUnit();
    getGame().getRules().getIlluminationRule().resetIllumination();
    getGame().getRules().getIlluminationRule().applyLightEmission();
    visionRule.fullReset(getGame().getMaster().getUnitsArray());
    getActiveUnit().setUnitVisionStatus(UNIT_VISION.IN_PLAIN_SIGHT);
    getActiveUnit().setVisibilityLevel(VISIBILITY_LEVEL.CLEAR_SIGHT);
    resetLastKnownCoordinates();
    // }
    for (Object sub : getGame().getDungeonMaster().getPlayerManager().getPlayers()) {
        DC_Player player = (DC_Player) sub;
        resetPlayerVision(player);
    }
    triggerGuiEvents();
    firstResetDone = true;
    gammaMaster.setDirty(false);
    // try{    getVisionController().logAll();}catch(Exception e){main.system.ExceptionMaster.printStackTrace( e);}
    // getVisionController().log(getActiveUnit(), visibleList.toArray(new DC_Obj[visibleList.size()]));
    Chronos.logTimeElapsedForMark("VISIBILITY REFRESH", true);
}
Also used : BattleFieldObject(eidolons.entity.obj.BattleFieldObject) DC_Player(eidolons.game.battlecraft.logic.battle.universal.DC_Player)

Example 8 with DC_Player

use of eidolons.game.battlecraft.logic.battle.universal.DC_Player in project Eidolons by IDemiurge.

the class DebugMaster method summon.

private void summon(Boolean me, DC_TYPE units, Ref ref) {
    Player player = Player.NEUTRAL;
    if (me != null) {
        player = game.getPlayer(me);
        if (!me) {
            if (ALT_AI_PLAYER) {
                if (altAiPlayer == null) {
                    altAiPlayer = new DC_Player("", null, false);
                }
                player = altAiPlayer;
            }
        }
    }
    /*
         * alt mode: >> random >> preset >> last
		 */
    ref.setPlayer(player);
    String typeName;
    if (arg instanceof Unit) {
        Obj obj = arg;
        typeName = (obj.getType().getName());
    }
    if (altMode) {
        typeName = lastType;
    // RandomWizard.getRandomType(units).getName();
    } else {
        typeName = ListChooser.chooseType(units);
    }
    if (!DataManager.isTypeName(typeName)) {
        typeName = DialogMaster.inputText("Then enter it yourself...");
    }
    if (typeName == null) {
        return;
    }
    if (!DataManager.isTypeName(typeName)) {
        ObjType foundType = DataManager.findType(typeName, units);
        if (foundType == null) {
            return;
        }
        typeName = foundType.getName();
    }
    if (arg instanceof Obj) {
        Obj obj = arg;
        ref.setTarget(game.getCellByCoordinate(obj.getCoordinates()).getId());
    } else if (!new SelectiveTargeting(new Conditions(ConditionMaster.getTYPECondition(DC_TYPE.TERRAIN))).select(ref)) {
        return;
    }
    lastType = typeName;
    SummonEffect effect = (me == null) ? new CreateObjectEffect(typeName, true) : new SummonEffect(typeName);
    if (units == DC_TYPE.UNITS) {
        if (checkAddXp()) {
            Formula xp = new Formula("" + (DC_Formulas.getTotalXpForLevel(DataManager.getType(typeName, DC_TYPE.UNITS).getIntParam(PARAMS.LEVEL) + DialogMaster.inputInt()) - DC_Formulas.getTotalXpForLevel(DataManager.getType(typeName, DC_TYPE.UNITS).getIntParam(PARAMS.LEVEL))));
            effect = new SummonEffect(typeName, xp);
        }
    }
    effect.setOwner(player);
    effect.apply(ref);
    if (player.isAi()) {
        game.getAiManager().getCustomUnitGroup((Unit) effect.getUnit()).add(effect.getUnit());
    }
    game.getManager().refreshAll();
}
Also used : SelectiveTargeting(main.elements.targeting.SelectiveTargeting) SummonEffect(eidolons.ability.effects.oneshot.unit.SummonEffect) CreateObjectEffect(eidolons.ability.effects.oneshot.unit.CreateObjectEffect) Formula(main.system.math.Formula) DC_Player(eidolons.game.battlecraft.logic.battle.universal.DC_Player) Player(main.game.logic.battle.player.Player) ObjType(main.entity.type.ObjType) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj) DC_SpellObj(eidolons.entity.active.DC_SpellObj) DC_Obj(eidolons.entity.obj.DC_Obj) ActiveObj(main.entity.obj.ActiveObj) Obj(main.entity.obj.Obj) DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj) Unit(eidolons.entity.obj.unit.Unit) DC_Player(eidolons.game.battlecraft.logic.battle.universal.DC_Player) Conditions(main.elements.conditions.Conditions)

Aggregations

DC_Player (eidolons.game.battlecraft.logic.battle.universal.DC_Player)8 ObjType (main.entity.type.ObjType)4 Unit (eidolons.entity.obj.unit.Unit)3 ArrayList (java.util.ArrayList)3 DC_SpellObj (eidolons.entity.active.DC_SpellObj)2 DC_QuickItemObj (eidolons.entity.item.DC_QuickItemObj)2 Obj (main.entity.obj.Obj)2 Coordinates (main.game.bf.Coordinates)2 CreateObjectEffect (eidolons.ability.effects.oneshot.unit.CreateObjectEffect)1 SummonEffect (eidolons.ability.effects.oneshot.unit.SummonEffect)1 Party (eidolons.client.cc.logic.party.Party)1 DC_IdManager (eidolons.entity.DC_IdManager)1 DC_ArmorObj (eidolons.entity.item.DC_ArmorObj)1 DC_HeroItemObj (eidolons.entity.item.DC_HeroItemObj)1 DC_JewelryObj (eidolons.entity.item.DC_JewelryObj)1 DC_WeaponObj (eidolons.entity.item.DC_WeaponObj)1 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)1 DC_Obj (eidolons.entity.obj.DC_Obj)1 DC_BuffObj (eidolons.entity.obj.attach.DC_BuffObj)1 DC_FeatObj (eidolons.entity.obj.attach.DC_FeatObj)1