use of main.entity.obj.ActiveObj in project Eidolons by IDemiurge.
the class DC_AttackMaster method attack.
private Boolean attack(Attack attack, Ref ref, boolean free, boolean canCounter, Effect onHit, Effect onKill, boolean offhand, boolean counter) {
ENTRY_TYPE type = ENTRY_TYPE.ATTACK;
boolean extraAttack = true;
if (attack.getAction().isCounterMode()) {
type = ENTRY_TYPE.COUNTER_ATTACK;
} else if (attack.getAction().isInstantMode()) {
type = ENTRY_TYPE.INSTANT_ATTACK;
} else if (attack.getAction().isAttackOfOpportunityMode()) {
type = ENTRY_TYPE.ATTACK_OF_OPPORTUNITY;
} else {
extraAttack = false;
}
// LogEntryNode entry = game.getLogManager().newLogEntryNode(type,
// attack.getAttacker().getName(), attack.getAttackedUnit().getName(), attack.getAction());
Boolean result = null;
if (!extraAttack) {
Unit guard = (Unit) GuardRule.checkTargetChanged(attack.getAction());
if (guard != null) {
game.getLogManager().log(guard.getNameIfKnown() + " intercepts " + attack.toLogString());
ref.setTarget(guard.getId());
attack.setRef(ref);
attack.setAttacked(guard);
}
}
attack.setSneak(SneakRule.checkSneak(ref));
try {
main.system.auxiliary.log.LogMaster.log(1, attack.getAttacker() + " attacks " + attack.getAttacked() + " with " + attack.getAction());
result = attackNow(attack, ref, free, canCounter, onHit, onKill, offhand, counter);
boolean countered = false;
if (result == null) {
// first strike
main.system.auxiliary.log.LogMaster.log(1, "Counter attack with first strike against " + attack.getAction());
ActiveObj action = counterRule.tryCounter(attack, false);
if (action != null) {
AttackEffect effect = EffectMaster.getAttackEffect(action);
waitForAttackAnimation(effect.getAttack());
}
attackNow(attack, ref, free, false, onHit, onKill, offhand, counter);
countered = true;
result = true;
}
if ((!countered) || attack.getAttacker().hasDoubleCounter()) {
if (canCounter) {
if (!counter) {
counterRule.tryCounter(attack);
}
}
}
} catch (Exception e) {
result = false;
main.system.ExceptionMaster.printStackTrace(e);
} finally {
if (!extraAttack) {
game.getLogManager().doneLogEntryNode(ENTRY_TYPE.ACTION);
}
game.getLogManager().doneLogEntryNode(type);
}
return result;
}
use of main.entity.obj.ActiveObj in project Eidolons by IDemiurge.
the class EmitterController method setForActive.
public void setForActive() {
String presetPath = new FileChooser(PathFinder.getSfxPath()).launch("", "");
// ImageChooser ic = new ImageChooser();
// ic.setDefaultFileLocation(PathFinder.getSfxPath()+"images//");
// String imagePath = ic.
ActiveObj active = DC_Game.game.getManager().getActiveObj().getRef().getActive();
CompositeAnim anim = AnimMaster.getInstance().getConstructor().getOrCreate(active);
// ANIM_PART part = ANIM_PART.IMPACT;
anim.getMap().keySet().forEach(part -> {
// anim.getMap().get(part).getData().setValue();
List<EmitterActor> list = EmitterPools.getEmitters(presetPath);
anim.getMap().get(part).setEmitterList(list);
});
// impact?
}
use of main.entity.obj.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;
}
use of main.entity.obj.ActiveObj in project Eidolons by IDemiurge.
the class ActivesConstructor method setAnimForEffects.
public static void setAnimForEffects(DC_ActiveObj entity) {
List<ActiveObj> list = new ArrayList<>(entity.getActives());
for (Active active : list) {
for (Ability abil : ((AbilityObj) active).getAbilities().getAbils()) {
for (Effect effect : abil.getEffects().getEffects()) {
if (effect instanceof EffectImpl) {
EffectImpl effect2 = (EffectImpl) effect;
effect2.setAnimationActive(entity);
}
}
}
}
}
use of main.entity.obj.ActiveObj in project Eidolons by IDemiurge.
the class LogManager method logFastAction.
public void logFastAction(Obj payee, Ref ref) {
String text = " finishes ";
ActiveObj active = ref.getActive();
if (active.getOBJ_TYPE_ENUM() == DC_TYPE.SPELLS) {
text = " casts ";
if (StringMaster.compare(active.getProp("spell tags"), "channeling", false)) {
text = " channels ";
}
}
String string = payee.getNameIfKnown() + text + active.getName() + " rapidly, saving 1 Action point";
// logAlert(string);
log(LOG.GAME_INFO, StringMaster.MESSAGE_PREFIX_ALERT + string, ENTRY_TYPE.ACTION);
}
Aggregations