Search in sources :

Example 6 with PhaseAnimation

use of eidolons.system.graphics.PhaseAnimation in project Eidolons by IDemiurge.

the class DC_PagedLogPanel method back.

protected void back() {
    if (!nodeStack.isEmpty()) {
        entryNode = nodeStack.pop();
    }
    boolean refreshAll = false;
    if (entryNode != null) {
        if (entryNode.getLinkedAnimation() != null) {
            for (ANIM anim : entryNode.getLinkedAnimations()) {
                PhaseAnimation animation = (PhaseAnimation) anim;
                animation.setAutoFinish(true);
                if (!animation.isPaused()) {
                    if (animation.stopAndRemove()) {
                        refreshAll = true;
                    }
                }
            }
        }
    }
    if (nodeStack.isEmpty()) {
        entryNode = null;
        nodeViewMode = false;
        currentIndex = getCachedTopPageIndex();
    } else {
        currentIndex = entryNode.getPageIndex();
    }
    // if null?
    if (refreshAll) {
        game.getManager().refresh(false);
    } else {
        refresh();
    }
}
Also used : PhaseAnimation(eidolons.system.graphics.PhaseAnimation) ANIM(main.system.graphics.ANIM)

Example 7 with PhaseAnimation

use of eidolons.system.graphics.PhaseAnimation in project Eidolons by IDemiurge.

the class ArmorMaster method getArmorBlockDamage.

private int getArmorBlockDamage(boolean shield, boolean spell, boolean canCritOrBlock, boolean average, Integer damage, Unit attacked, Unit attacker, boolean offhand, DAMAGE_TYPE dmg_type, DC_ActiveObj action) {
    /*
         * if blocks, apply armor's resistance values too
		 */
    if (action == null) {
        return 0;
    }
    if (!offhand) {
        offhand = action.isOffhand();
    }
    DC_ArmorObj armorObj = attacked.getArmor();
    if (armorObj == null) {
        return 0;
    }
    if (dmg_type == null) {
        dmg_type = action.getDamageType();
    }
    if (simulation) {
        average = true;
        canCritOrBlock = true;
    }
    int blockedPercentage = getBlockPercentage(shield, spell, canCritOrBlock, average, armorObj, offhand, attacker, attacked, action);
    // action.getGame().getLogManager().newLogEntryNode(type, args)
    // TODO ??? damage =
    // getReducedDamageForArmorResistances(blockedPercentage, armorObj,
    // damage, dmg_type);
    int maxBlockValue = damage * blockedPercentage / 100;
    int blocked = Math.min(getArmorValue(armorObj, dmg_type), maxBlockValue);
    // blocked = MathMaster.applyMod(amount, mod);
    // blocked -= penetration;
    String name = "[No Weapon]";
    if (spell) {
        name = action.getName();
    } else if (attacker.getActiveWeapon(offhand) != null) {
        name = attacker.getActiveWeapon(offhand).getName();
    }
    if (!simulation) {
        action.getRef().setID(KEYS.BLOCK, armorObj.getId());
        String entry = armorObj.getName() + " takes " + blockedPercentage + "% of " + action.getName() + StringMaster.wrapInParenthesis(name) + " absorbing " + blocked + " " + dmg_type.getName() + " damage";
        if (blockedPercentage == 0 || blocked == 0) {
            entry = attacker.getNameIfKnown() + " penetrates " + armorObj.getName() + " with " + name + (action.getName().equals("Attack") ? "" : StringMaster.wrapInParenthesis(action.getName())) + "!";
        } else {
            DC_SoundMaster.playAttackImpactSound(attacker.getActiveWeapon(offhand), attacker, attacked, damage, blocked);
            int durabilityLost = reduceDurability(blocked, armorObj, spell, dmg_type, attacker.getActiveWeapon(offhand), damage);
            if (CoreEngine.isPhaseAnimsOn())
                if (!simulation) {
                    if (!shield) {
                        PhaseAnimation animation = action.getGame().getAnimationManager().getAnimation(Attack.getAnimationKey(action));
                        animation.addPhase(new AnimPhase(PHASE_TYPE.REDUCTION_ARMOR, blockedPercentage, blocked, durabilityLost, damage, dmg_type, armorObj));
                    }
                }
        }
        if (!simulation) {
            action.getGame().getLogManager().log(LOG.GAME_INFO, entry, ENTRY_TYPE.DAMAGE);
        }
    }
    return blocked;
}
Also used : AnimPhase(main.system.graphics.AnimPhase) PhaseAnimation(eidolons.system.graphics.PhaseAnimation) DC_ArmorObj(eidolons.entity.item.DC_ArmorObj)

Aggregations

PhaseAnimation (eidolons.system.graphics.PhaseAnimation)7 AnimPhase (main.system.graphics.AnimPhase)3 ANIM (main.system.graphics.ANIM)2 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)1 DC_ArmorObj (eidolons.entity.item.DC_ArmorObj)1 DC_WeaponObj (eidolons.entity.item.DC_WeaponObj)1 CustomButton (eidolons.swing.components.buttons.CustomButton)1 MouseItem (eidolons.system.graphics.AnimationManager.MouseItem)1 Obj (main.entity.obj.Obj)1 Coordinates (main.game.bf.Coordinates)1 ImageButton (main.swing.components.ImageButton)1 DequeImpl (main.system.datatypes.DequeImpl)1 Formula (main.system.math.Formula)1 LogEntryNode (main.system.text.LogEntryNode)1