use of main.ability.effects.Effect in project Eidolons by IDemiurge.
the class DC_HeroSlotItem method applySpecialEffects.
public void applySpecialEffects(SPECIAL_EFFECTS_CASE case_type, DC_UnitModel target, Ref REF) {
if (specialEffects == null) {
return;
}
if (specialEffects.get(case_type) == null) {
return;
}
Ref ref = Ref.getCopy(REF);
ref.setTarget(target.getId());
ref.setSource(getOwnerObj().getId());
Effect effect = specialEffects.get(case_type);
effect.apply(ref);
}
use of main.ability.effects.Effect in project Eidolons by IDemiurge.
the class HeroObjectModifyingEffect method applyThis.
/**
* Modstring format: valueName(value);valueName2(value2);... Use [mod],
* [set], [remove] to change the default ADD function of modstring
*/
public boolean applyThis() {
if (ref.getTargetObj().isDead() || ref.getSourceObj().isDead()) {
removeEffects();
return false;
}
if (game.isSimulation()) {
if (!checkApplyInSimulation()) {
return true;
}
}
// what if the group has changed? perhaps there should be a map...
if (prop) {
if (propMap == null) {
propMap = new RandomWizard<PROPERTY>().constructStringWeightMap(modString, PROPERTY.class);
} else {
LogMaster.log(1, "prop map " + propMap.toString());
}
} else if (// TODO support PROPERTY?
map == null) {
map = new RandomWizard<PARAMETER>().constructStringWeightMap(modString, PARAMETER.class);
} else {
LogMaster.log(0, "map " + map.toString());
}
List<? extends Obj> list = getObjectsToModify();
LogMaster.log(0, "list " + list.toString());
LogMaster.log(0, "effects " + effects.toString());
for (Obj obj : list) {
if (obj == null) {
continue;
}
if (obj.isDead()) {
// TODO clean up for owner is dead!
continue;
}
Effect effect = effects.get(obj);
if (effect != null) {
// if (isPermanent() && isApplied())
// continue;
effect.applyThis();
applied = true;
continue;
}
Ref REF = ref.getCopy();
REF.setTarget(obj.getId());
// map = new MapMaster<PARAMETER, String>().constructVarMap(
// modString, PARAMETER.class);
Effects modEffects = new Effects();
if (map != null) {
EffectFinder.initParamModEffects(modEffects, map, ref);
} else if (propMap != null) {
EffectFinder.initPropModEffects(modEffects, propMap, ref);
}
applied = true;
for (Effect e : modEffects.getEffects()) {
e.resetOriginalFormula();
e.appendFormulaByMod(getFormula().toString());
}
if (buff) {
AddBuffEffect buffEffect = new AddBuffEffect(buffName, modEffects);
// TODO LAYER?
buffEffect.setForcedLayer(getModEffectLayer());
modEffects.setForcedLayer(getModEffectLayer());
if (isPermanent()) {
buffEffect.setDuration(ContentManager.INFINITE_VALUE);
}
if (!game.isSimulation()) {
effects.put(obj, buffEffect);
}
buffEffect.apply(REF);
} else {
if (!game.isSimulation()) {
effects.put(obj, modEffects);
}
modEffects.apply(REF);
}
}
return true;
}
use of main.ability.effects.Effect in project Eidolons by IDemiurge.
the class DC_BuffRule method initEffects.
@Override
public void initEffects() {
Effect[] array = effectCache.get(target);
if (array != null) {
effects = array[level];
if (effects != null) {
return;
}
}
Conditions conditions = null;
Effect effect = getEffect();
effect.setForceStaticParse(false);
effect.setForcedLayer(Effect.BUFF_RULE);
effects = new AddBuffEffect(conditions, getBuffTypeName(), effect);
effects.setIrresistible(true);
effects.setForcedLayer(Effect.BUFF_RULE);
}
use of main.ability.effects.Effect in project Eidolons by IDemiurge.
the class BuffObj method initTimeEffect.
private void initTimeEffect() {
// for (String sub : StringMaster.openContainer(getProperty(G_PROPS.PASSIVES))) {
// timeAbility = AbilityConstructor.newAbility(sub, this, true);
// }
timeEffects = new ArrayList<>();
if (effect instanceof Effects) {
for (Effect sub : new ArrayList<>(((Effects) effect).getEffects())) {
if (sub instanceof PeriodicEffect) {
timeEffects.add((PeriodicEffect) sub);
((Effects) effect).remove(sub);
}
}
}
}
use of main.ability.effects.Effect in project Eidolons by IDemiurge.
the class ActivesConstructor method wrapEffects.
public static Effect wrapEffects(EFFECTS_WRAP wrap, Effect effects, Entity entity) {
Formula radius = new Formula(entity.getParam(G_PARAMS.RADIUS));
Boolean allyOrEnemyOnly = null;
if (entity.checkBool(GenericEnums.STD_BOOLS.NO_FRIENDLY_FIRE)) {
allyOrEnemyOnly = false;
}
if (entity.checkBool(GenericEnums.STD_BOOLS.NO_ENEMY_FIRE)) {
allyOrEnemyOnly = true;
}
boolean notSelf = entity.checkBool(GenericEnums.STD_BOOLS.NO_SELF_FIRE);
switch(wrap) {
case CHAIN:
break;
case CUSTOM_ZONE_CROSS:
break;
case CUSTOM_ZONE_STAR:
// };
break;
case ZONE:
effects = new Effects(new ZoneEffect(effects, radius, allyOrEnemyOnly, notSelf));
break;
case SINGLE_BUFF:
Effects buffEffects = new Effects();
if (effects instanceof Effects) {
for (Effect effect : (Effects) effects) {
if (effect instanceof AddBuffEffect) {
buffEffects.add(((AddBuffEffect) effect).getEffect());
} else {
buffEffects.add(effect);
}
}
} else {
buffEffects.add(effects);
}
String buffName = entity.getProperty(PROPS.BUFF_NAME);
if (buffName == null) {
}
effects = new AddBuffEffect(buffName, buffEffects);
break;
default:
break;
}
return effects;
}
Aggregations