use of main.elements.targeting.AutoTargeting in project Eidolons by IDemiurge.
the class ZoneEffect method initTargeting.
public void initTargeting() {
Conditions conditions = new Conditions();
int spell_radius = radius.getInt(ref);
// if (spell_radius == 0) {
// spell_radius = ref.getObj(KEYS.ACTIVE.name()).getIntParam(G_PARAMS.RADIUS);
// }
NumericCondition condition = ConditionMaster.getDistanceFilterCondition(KEYS.TARGET.name(), spell_radius);
conditions.add(condition);
if (// just on same cell
spell_radius == 0)
condition.setStrict(false);
// TODO really???
conditions.add(ConditionMaster.getNotDeadCondition());
if (notSelf) {
conditions.add(new NotCondition(ConditionMaster.getSelfFilterCondition()));
}
if (// TODO target filtering - targeting
allyOrEnemyOnly != null) // modifiers?
{
conditions.add(allyOrEnemyOnly ? ConditionMaster.getAllyCondition() : ConditionMaster.getEnemyCondition());
}
// legacy?
// if (allyOrEnemyOnly==null)
// conditions.add(ConditionMaster.getEnemyCondition());
// else if (!allyOrEnemyOnly) {
// conditions.add(allyOrEnemyOnly? ConditionMaster.getAllyCondition() :
// ConditionMaster.getEnemyCondition());
// }
// if (effects.getSpell() != null)
// if (effects.getSpell().checkBool(STD_BOOLS.APPLY_THRU))
this.targeting = new AutoTargeting(conditions, C_OBJ_TYPE.BF);
if (targeting == null) {
this.targeting = new AutoTargeting(conditions, C_OBJ_TYPE.BF_OBJ);
}
setFilteringConditions(conditions);
}
use of main.elements.targeting.AutoTargeting in project Eidolons by IDemiurge.
the class HeroObjectModifyingEffect method getObjectsToModify.
protected List<Obj> getObjectsToModify() {
if (objName != null) {
return getObjectsByName(objName);
} else {
// TODO simple condition format - prop,
Ref REF = ref.getCopy();
// value"
initFilterConditions();
Unit hero = (Unit) ref.getSourceObj();
if (type != null) {
List<Integer> list;
try {
list = getIdList(hero);
} catch (Exception e) {
LogMaster.log(1, "Group obj effect failed to getOrCreate targets: " + this);
return new ArrayList<>();
}
List<Obj> objList = new ArrayList<>();
for (Integer id : list) {
objList.add(game.getObjectById(id));
}
return objList;
}
new AutoTargeting(conditions).select(REF);
return REF.getGroup().getObjects();
}
}
use of main.elements.targeting.AutoTargeting in project Eidolons by IDemiurge.
the class AuraEffect method applyThis.
/*
*
* so what really happens?
*
* maybe it's OK if it's not Spirit?
*
* There aren't really non-ValueMod effect variants, are there?
* "Damage Aura"? Property Aura, e.g. demonic! :)
*/
public boolean applyThis() {
if (!on) {
return true;
}
if (game.isSimulation()) {
return false;
}
if (continuous) {
AutoTargeting targeting = new AutoTargeting(new DistanceCondition(radius.toString()));
targeting.getConditions().add(ConditionMaster.getAliveCondition(KEYS.MATCH));
if (onlyEnemiesOrAllies != null) {
if (onlyEnemiesOrAllies) {
targeting.getConditions().add(ConditionMaster.getEnemyCondition());
} else {
targeting.getConditions().add(ConditionMaster.getAllyCondition());
}
}
// remove aura-bearer from targets list
targeting.getConditions().add(new NotCondition(new RefCondition(KEYS.MATCH, KEYS.SOURCE)));
AddBuffEffect buffEffect = new AddBuffEffect(getBuffType(), effect, true);
Effects auraEffects = new Effects(new ConditionalEffect(ConditionMaster.getAliveCondition(KEYS.SOURCE), new CustomTargetEffect(targeting, buffEffect)));
auraEffect = new AddBuffEffect(auraEffects);
// auraEffect.setTransient(false);
boolean results = auraEffect.apply(ref);
if (results) {
if (!notSelf) {
Effect copy = effect.getCopy();
copy.apply(Ref.getSelfTargetingRefCopy(ref.getSourceObj()));
}
}
return results;
}
// preCheck?
if (!initialized) {
init();
}
return trigger.apply(ref);
}
use of main.elements.targeting.AutoTargeting in project Eidolons by IDemiurge.
the class DualAttackMaster method createDual.
private static DC_UnitAction createDual(DC_UnitAction main, DC_UnitAction offhand) {
Costs costs = getDualCosts(main, offhand);
// cooldown!
ActiveAbility activateAttacks = new ActiveAbility(main.getTargeting(), new Effects(new ActivateEffect(main.getName(), true), new ActivateEffect(offhand.getName(), true)));
Ability setCooldown = new ActiveAbility(new AutoTargeting(new PropCondition(G_PROPS.ACTION_TAGS, "Dual", false)), new ModifyValueEffect(PARAMS.C_COOLDOWN, MOD.SET, getCooldown(main.getOwnerObj())));
Abilities abilities = new Abilities();
abilities.add(activateAttacks);
abilities.add(setCooldown);
ObjType newType = new ObjType("Dual: " + main.getName() + " and " + offhand.getName(), DataManager.getType("Dual Attack", DC_TYPE.ACTIONS));
for (Cost cost : costs.getCosts()) {
PARAMETER p = cost.getCostParam();
if (p == null)
continue;
newType.setParam(p, cost.getPayment().getAmountFormula().toString());
}
DC_UnitAction dual = new DC_UnitAction(newType, main.getOwner(), main.getGame(), new Ref(main.getOwnerObj()));
dual.setAbilities(abilities);
dual.setCosts(costs);
dual.setTargeting(main.getTargeting());
dual.getTargeter().setTargetingInitialized(true);
dual.setConstructed(true);
return dual;
}
Aggregations