Search in sources :

Example 11 with DC_ActiveObj

use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.

the class DC_SoundMaster method bindEvents.

public static void bindEvents() {
    GuiEventManager.bind(GuiEventType.ANIMATION_STARTED, p -> {
        Anim anim = (Anim) p.get();
        DC_ActiveObj activeObj = (DC_ActiveObj) anim.getActive();
        try {
            // TODO ON SEPARATE THREAD!!!!
            playAnimStartSound(activeObj, anim.getPart());
        } catch (Exception e) {
        // main.system.ExceptionMaster.printStackTrace(e);
        }
    });
    GuiEventManager.bind(GuiEventType.COMPOSITE_ANIMATION_STARTED, p -> {
        CompositeAnim anim = (CompositeAnim) p.get();
        DC_ActiveObj activeObj = (DC_ActiveObj) anim.getActive();
        try {
            playActionStartSound(activeObj);
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    });
}
Also used : DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) CompositeAnim(eidolons.libgdx.anims.CompositeAnim) Anim(eidolons.libgdx.anims.Anim) CompositeAnim(eidolons.libgdx.anims.CompositeAnim)

Example 12 with DC_ActiveObj

use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.

the class RollMaster method roll.

/**
 * @return true if {failure} formula rolls more, false otherwise
 */
public static boolean roll(ROLL_TYPES roll_type, String success, String fail, Ref ref, String logAppendix, String rollSource, Boolean logged) {
    Obj source = ref.getSourceObj();
    Obj target = ref.getTargetObj();
    // if (roll == null)
    roll = new Roll(roll_type, success, fail, 0);
    if (StringMaster.isEmpty(fail)) {
        fail = initStdFail(roll_type);
    }
    Formula failFormula = new Formula(fail);
    if (source != null) {
        failFormula.applyFactor(getFailFactor(roll_type));
    }
    Boolean result;
    int max1 = failFormula.getInt(ref);
    if (StringMaster.isEmpty(success)) {
        success = initStdSuccess(roll_type);
    }
    Formula successFormula = new Formula(success);
    successFormula.applyFactor(getSuccessFactor(roll_type));
    int max2 = successFormula.getInt(ref);
    int min1 = MathMaster.applyMod(max1, DEFAULT_MIN_ROLL_PERC);
    int min2 = MathMaster.applyMod(max2, DEFAULT_MIN_ROLL_PERC);
    if (min1 >= max2) {
        return true;
    }
    if (min2 >= max1) {
        return false;
    }
    // per die?
    rolledValue = RandomWizard.getRandomIntBetween(min1, max1);
    rolledValue2 = RandomWizard.getRandomIntBetween(min2, max2);
    roll.setRolledValue(rolledValue);
    roll.setRolledValue2(rolledValue2);
    result = rolledValue > rolledValue2;
    if (target == null) {
        target = ref.getEvent().getRef().getTargetObj();
    }
    // TODO display roll formulas if FULL_INFO is on!
    if (rollSource == null) {
        rollSource = rolledValue + " out of " + max1;
    } else {
        rollSource += StringMaster.wrapInParenthesis(rolledValue + " out of " + max1);
    }
    String rollTarget = rolledValue2 + " out of " + max2;
    logString = target.getName() + ((result) ? " fails" : " wins") + " a " + roll_type.getName() + " roll with " + rollTarget + " vs " + source.getName() + "'s " + rollSource;
    if (logAppendix != null) {
        if (isAppendixAdded(logAppendix, result)) {
            logString = logString + logAppendix.replace(getSuccessAppendixIdentifier(), "");
        }
    }
    if (logged == null) {
        logged = checkRollLogged(roll_type, result);
    }
    if (logged) {
        ref.getGame().getLogManager().log(logString);
    }
    ref.getGame().getLogManager();
    ref.getGame().getLogManager();
    if (!ref.isAnimationDisabled()) {
        PhaseAnimation anim = null;
        if (ref.getActive() != null) {
            // else ?
            anim = ((DC_ActiveObj) ref.getActive()).getAnimation();
        }
        if (anim != null) {
            anim.addPhaseArgs(PHASE_TYPE.ROLL, roll);
        }
    }
    roll.setResult(result);
    roll.setLogAppendix(logAppendix);
    roll.setRollSource(rollSource);
    roll.setRollTarget(rollTarget);
    return result;
}
Also used : Formula(main.system.math.Formula) PhaseAnimation(eidolons.system.graphics.PhaseAnimation) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Obj(main.entity.obj.Obj)

Example 13 with DC_ActiveObj

use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.

the class AnimationConstructor method getBuffAnim.

public BuffAnim getBuffAnim(BuffObj buff) {
    BuffAnim anim = new BuffAnim(buff);
    DC_ActiveObj active = null;
    if (buff.getActive() instanceof DC_ActiveObj) {
        active = (DC_ActiveObj) buff.getActive();
    }
    initAnim(anim.getData(), active, anim.getPart(), anim);
    if (!isValid(anim)) {
        return null;
    }
    return anim;
}
Also used : DC_ActiveObj(eidolons.entity.active.DC_ActiveObj)

Example 14 with DC_ActiveObj

use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.

the class FloatingTextMaster method createFloatingText.

public void createFloatingText(TEXT_CASES CASE, String arg, Entity entity) {
    FloatingText text;
    try {
        text = getFloatingText(entity, CASE, arg);
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
        return;
    }
    if (entity instanceof BattleFieldObject) {
        Vector2 v = GridMaster.getCenteredPos(((BattleFieldObject) entity).getCoordinates());
        text.setPosition(v);
    } else {
        if (entity instanceof DC_ActiveObj) {
            Vector2 v = GridMaster.getCenteredPos(((DC_ActiveObj) entity).getOwnerObj().getCoordinates());
            text.setPosition(v);
        }
    }
    GuiEventManager.trigger(GuiEventType.ADD_FLOATING_TEXT, text);
}
Also used : BattleFieldObject(eidolons.entity.obj.BattleFieldObject) Vector2(com.badlogic.gdx.math.Vector2) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj)

Example 15 with DC_ActiveObj

use of eidolons.entity.active.DC_ActiveObj in project Eidolons by IDemiurge.

the class ActivesConstructor method getSingleTargeting.

public static Targeting getSingleTargeting(DC_ActiveObj obj) {
    List<ActiveObj> actives = obj.getActives();
    if (actives == null) {
        return null;
    }
    if (actives.size() < 1) {
        return null;
    }
    if (actives.get(0) == null) {
        return null;
    }
    Targeting targeting;
    try {
        targeting = ((AbilityObj) actives.get(0)).getType().getAbilities().getTargeting();
    } catch (Exception e) {
        targeting = getDefaultSingleTargeting(obj);
    }
    return targeting;
}
Also used : DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) ActiveObj(main.entity.obj.ActiveObj) FixedTargeting(main.elements.targeting.FixedTargeting) TemplateAutoTargeting(eidolons.ability.targeting.TemplateAutoTargeting) TemplateSelectiveTargeting(eidolons.ability.targeting.TemplateSelectiveTargeting) Targeting(main.elements.targeting.Targeting) MultiTargeting(main.elements.targeting.MultiTargeting) SelectiveTargeting(main.elements.targeting.SelectiveTargeting)

Aggregations

DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)73 Unit (eidolons.entity.obj.unit.Unit)22 ArrayList (java.util.ArrayList)17 Obj (main.entity.obj.Obj)15 DC_UnitAction (eidolons.entity.active.DC_UnitAction)12 DC_Obj (eidolons.entity.obj.DC_Obj)12 Ref (main.entity.Ref)9 Action (eidolons.game.battlecraft.ai.elements.actions.Action)8 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)7 ActiveObj (main.entity.obj.ActiveObj)7 Effect (main.ability.effects.Effect)5 SelectiveTargeting (main.elements.targeting.SelectiveTargeting)5 Targeting (main.elements.targeting.Targeting)5 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)4 DC_SpellObj (eidolons.entity.active.DC_SpellObj)4 ActionPath (eidolons.game.battlecraft.ai.tools.path.ActionPath)4 FixedTargeting (main.elements.targeting.FixedTargeting)4 Coordinates (main.game.bf.Coordinates)4 RollEffect (eidolons.ability.effects.oneshot.mechanic.RollEffect)3 ActionSequence (eidolons.game.battlecraft.ai.elements.actions.sequence.ActionSequence)3