Search in sources :

Example 1 with EntityGuid

use of com.ixale.starparse.domain.EntityGuid in project StarParse by Ixale.

the class Parser method processEventHotsWithRefresh.

private void processEventHotsWithRefresh(final Event e, final long abilityGuid, final EntityGuid[] refreshers, @SuppressWarnings("SameParameterValue") final int defaultDuration) {
    final ActorState targetState = getActorState(e.getTarget());
    if (isAbilityEqual(e, abilityGuid)) {
        if (isEffectAbilityActivate(e)) {
            // lets wait who's the target ...
            pendingHealAbility = e.getAbility();
            return;
        }
        if ((isEffectEqual(e, abilityGuid) && isActionApply(e)) || (pendingHealAbility != null && isAbilityEqual(e, pendingHealAbility.getGuid()))) {
            if (isEffectEqual(e, abilityGuid)) {
                // explicit gain = 1 stack
                if (logger.isDebugEnabled() && targetState.hotStacks != 0) {
                    logger.debug("Unexpected hot stack " + targetState.hotStacks + " since " + new Date(targetState.hotSince) + " at " + e);
                }
                targetState.hotStacks = 1;
            } else {
                // we got our target!
                // implicit stack increase
                targetState.hotStacks = 2;
            }
            targetState.hotEffect = e.getAbility();
            targetState.hotSince = targetState.hotLast = e.getTimestamp();
            targetState.hotDuration = (hotAverage == 0 ? defaultDuration : hotAverage);
            pendingHealAbility = null;
            return;
        }
        if (isActionRemove(e)) {
            // clear
            if (targetState.hotSince != null) {
                updateHotDurationAverage((int) (e.getTimestamp() - targetState.hotSince), defaultDuration);
            }
            targetState.hotStacks = 0;
            targetState.hotEffect = null;
            targetState.hotSince = null;
            targetState.hotDuration = 0;
            return;
        }
        return;
    }
    for (final EntityGuid refresher : refreshers) {
        if (isAbilityEqual(e, refresher.getGuid())) {
            if (isEffectAbilityActivate(e)) {
                // lets wait who's the target ...
                pendingHealAbility = e.getAbility();
                return;
            }
            if (pendingHealAbility != null && isAbilityEqual(e, pendingHealAbility.getGuid())) {
                // we got our target!
                if (targetState.hotStacks == 2) {
                    // implicit stack prolong
                    targetState.hotSince = targetState.hotLast = e.getTimestamp();
                }
                pendingHealAbility = null;
            }
            break;
        }
    }
}
Also used : EntityGuid(com.ixale.starparse.domain.EntityGuid) Date(java.util.Date)

Aggregations

EntityGuid (com.ixale.starparse.domain.EntityGuid)1 Date (java.util.Date)1