use of main.ability.effects.Effect in project Eidolons by IDemiurge.
the class TargetingMaster method getZoneEffect.
public static Targeting getZoneEffect(DC_ActiveObj active) {
List<Effect> zoneEffects = EffectFinder.getEffectsOfClass(active, SpecialTargetingEffect.class);
if (!zoneEffects.isEmpty()) {
SpecialTargetingEffect zoneEffect = (SpecialTargetingEffect) zoneEffects.get(0);
zoneEffect.setRef(active.getRef());
zoneEffect.initTargeting();
return zoneEffect.getTargeting();
}
return active.getTargeting();
}
use of main.ability.effects.Effect in project Eidolons by IDemiurge.
the class DC_Obj method addSpecialEffect.
public void addSpecialEffect(SPECIAL_EFFECTS_CASE case_type, Effect effects) {
if (effects instanceof Effects) {
Effects effects_ = (Effects) effects;
for (Effect e : effects_.getEffects()) {
addSpecialEffect(case_type, e);
}
return;
}
if (effects instanceof AddSpecialEffects) {
AddSpecialEffects addSpecialEffects = (AddSpecialEffects) effects;
effects = addSpecialEffects.getEffects();
}
if (getSpecialEffects().get(case_type) != null) {
getSpecialEffects().put(case_type, new Effects(getSpecialEffects().get(case_type), effects));
} else {
getSpecialEffects().put(case_type, effects);
}
}
use of main.ability.effects.Effect in project Eidolons by IDemiurge.
the class DC_Obj method applySpecialEffects.
public void applySpecialEffects(SPECIAL_EFFECTS_CASE case_type, BattleFieldObject target, Ref REF) {
if (specialEffects == null) {
return;
}
if (specialEffects.get(case_type) == null) {
return;
}
Ref ref = Ref.getCopy(REF);
ref.setTarget(target.getId());
if (this instanceof Unit) {
ref.setSource(getId());
} else {
ref.setID(KEYS.THIS, getId());
}
Effect effect = specialEffects.get(case_type);
effect.apply(ref);
}
use of main.ability.effects.Effect in project Eidolons by IDemiurge.
the class DC_FeatObj method applyRank.
private void applyRank() {
Integer rank = getRank();
if (rank == 0) {
return;
}
Integer mod = rank * getRankFormulaMod();
for (AbilityObj p : getPassives()) {
// will affect AddParam effects?
for (Ability a : p.getAbilities()) {
for (Effect ef : a.getEffects()) {
try {
ef.resetOriginalFormula();
ef.appendFormulaByMod(100 + mod);
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
// some exceptions?
/*
* how widely will this be used?
* mostly on simple low-level skills...
* but also on auras I guess...
* the point is to make things flexible, deeply customizable, and viable for
* no-magic heroes...
*
* it's true that with the amount of Masteries/Skills I may not need this on lower
* levels, but at some point I will!
*
* how will the rank be saved into hero data?
* >> (var)
* >> special prop
* >> prop per rank #
*/
}
}
}
for (PARAMETER attr : ContentManager.getAttributes()) {
PARAMS param = (PARAMS) attr;
Integer value = getIntParam(param, true);
if (value <= 0) {
continue;
}
value += Math.round(value * mod / 100);
setParam(param, value);
}
// modifyHeroParameters();
for (PARAMETER param : DC_ContentManager.getFeatModifyingParams()) {
Integer value = getIntParam(param, true);
if (value == 0) {
continue;
}
value += Math.round(value * mod / 100);
setParam(param, value);
}
Integer sdMod = rank * getIntParam(PARAMS.RANK_SD_MOD);
setParam(PARAMS.SKILL_DIFFICULTY, getIntParam(PARAMS.SKILL_DIFFICULTY, true));
modifyParamByPercent(PARAMS.SKILL_DIFFICULTY, sdMod);
rankApplied = true;
}
use of main.ability.effects.Effect in project Eidolons by IDemiurge.
the class HeroManager method update.
public void update(Unit hero, boolean refresh) {
// hero.setItemsInitialized(false);
if (hero == null) {
return;
}
for (DC_HeroSlotItem item : hero.getSlotItems()) {
if (item != null) {
if (item.getAttachments() != null) {
item.getAttachments().clear();
for (BuffObj buff : item.getBuffs()) {
buff.kill();
}
}
}
}
hero.toBase();
if (game.isSimulation()) {
List<Attachment> attachments = hero.getAttachments();
List<Effect> secondLayerEffects = new ArrayList<>();
if (attachments != null) {
for (Attachment a : attachments) {
try {
for (Effect e : a.getEffects()) {
if (e.getLayer() != Effect.SECOND_LAYER) {
e.apply(Ref.getSelfTargetingRefCopy(hero));
} else {
secondLayerEffects.add(e);
}
}
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
}
}
for (Effect e : secondLayerEffects) {
e.apply(Ref.getSelfTargetingRefCopy(hero));
}
EffectFinder.applyAttachmentEffects(hero.getMainWeapon(), null);
EffectFinder.applyAttachmentEffects(hero.getOffhandWeapon(), null);
EffectFinder.applyAttachmentEffects(hero.getArmor(), null);
}
hero.afterEffects();
hero.setDirty(true);
if (!hero.getGame().isSimulation()) {
try {
hero.resetObjects();
hero.resetQuickSlotsNumber();
refreshInvWindow();
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
return;
}
if (refresh) {
refresh(hero);
}
}
Aggregations