Search in sources :

Example 1 with Player

use of main.game.logic.battle.player.Player in project Eidolons by IDemiurge.

the class OwnershipChangeEffect method applyThis.

@Override
public boolean applyThis() {
    if (!new Event(STANDARD_EVENT_TYPE.UNIT_OWNERSHIP_CHANGED, ref).fire()) {
        return false;
    }
    // + trigger rule flip image when ownership changes ;)
    Obj obj = ref.getTargetObj();
    Player newOwner = obj.getOriginalOwner();
    if (!neutral) {
        newOwner = // ref.getSourceObj().getOwner();
        ((MicroGame) ref.getGame()).getPlayer(!obj.getOwner().isMe());
    }
    obj.setOwner(newOwner);
    if (permanent) {
        obj.setOriginalOwner(newOwner);
    // obj.addProperty(G_PROPS.STATUS, STATUS.CHARMED.name());
    }
    if (berserker) {
    }
    LogMaster.log(LogMaster.CORE_DEBUG_1, ref.getTargetObj().getName() + "'s new owner: " + obj.getOwner());
    return true;
}
Also used : Player(main.game.logic.battle.player.Player) Obj(main.entity.obj.Obj) Event(main.game.logic.event.Event)

Example 2 with Player

use of main.game.logic.battle.player.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

Obj (main.entity.obj.Obj)2 Player (main.game.logic.battle.player.Player)2 CreateObjectEffect (eidolons.ability.effects.oneshot.unit.CreateObjectEffect)1 SummonEffect (eidolons.ability.effects.oneshot.unit.SummonEffect)1 DC_SpellObj (eidolons.entity.active.DC_SpellObj)1 DC_HeroItemObj (eidolons.entity.item.DC_HeroItemObj)1 DC_QuickItemObj (eidolons.entity.item.DC_QuickItemObj)1 DC_Obj (eidolons.entity.obj.DC_Obj)1 Unit (eidolons.entity.obj.unit.Unit)1 DC_Player (eidolons.game.battlecraft.logic.battle.universal.DC_Player)1 Conditions (main.elements.conditions.Conditions)1 SelectiveTargeting (main.elements.targeting.SelectiveTargeting)1 ActiveObj (main.entity.obj.ActiveObj)1 ObjType (main.entity.type.ObjType)1 Event (main.game.logic.event.Event)1 Formula (main.system.math.Formula)1