use of main.elements.targeting.FixedTargeting in project Eidolons by IDemiurge.
the class ObjectiveMaster method initObjectiveTrigger.
public static void initObjectiveTrigger(OBJECTIVE_TYPE type, String data, Location mission) {
Dungeon dungeon = mission.getBossLevel();
objectiveData = data;
STANDARD_EVENT_TYPE eventType = null;
Conditions conditions = new Conditions();
Abilities abilities = new Abilities();
abilities.add(new ActiveAbility(new FixedTargeting(), new EndGameEffect(true)));
Ref ref = new Ref();
Integer id = null;
String name;
switch(type) {
case BOSS:
eventType = STANDARD_EVENT_TYPE.UNIT_HAS_BEEN_KILLED;
Coordinates c = DC_ObjInitializer.getCoordinatesFromObjString(objectiveData);
// new Coordinates(s);
name = DC_ObjInitializer.getNameFromObjString(objectiveData);
// conditions.add(new ObjComparison(KEY, KEYS.TARGET.toString()));
break;
case CAPTURE_HOLD:
// "As long as
break;
case SURVIVE_TIME:
break;
case ESCAPE:
// eventType = STANDARD_EVENT_TYPE.UNIT_GONE_THRU_ENTRANCE;
break;
case ITEM:
break;
}
// some objectives will be initialized on a condition, e.g. capture-hold
addTrigger(eventType, conditions, abilities);
}
use of main.elements.targeting.FixedTargeting in project Eidolons by IDemiurge.
the class BlockEffect method applyThis.
@Override
public boolean applyThis() {
// effect interrupt
String OBJ_REF = null;
switch(BLOCK_TYPE) {
case ATTACK:
event_type = Event.STANDARD_EVENT_TYPE.UNIT_IS_BEING_ATTACKED;
conditions.add(new RefCondition(KEYS.EVENT_TARGET, KEYS.SOURCE, false));
break;
case HOSTILE_ACTION:
event_type = Event.STANDARD_EVENT_TYPE.HOSTILE_ACTION;
conditions.add(new RefCondition(KEYS.EVENT_TARGET, KEYS.SOURCE, false));
break;
case DAMAGE:
event_type = Event.STANDARD_EVENT_TYPE.UNIT_IS_BEING_DEALT_TOUGHNESS_DAMAGE;
break;
case DAMAGE_FROM_SOURCE:
break;
case DAMAGE_TYPE:
break;
case HOSTILE_SPELLS:
event_type = Event.STANDARD_EVENT_TYPE.SPELL_BEING_RESOLVED;
conditions.add(new RefCondition(KEYS.EVENT_TARGET, KEYS.TARGET, false));
OBJ_REF = Ref.KEYS.SPELL.name();
break;
case SPELLS_FROM_SOURCE:
break;
default:
break;
}
effects = new Effects(new InterruptEffect(OBJ_REF));
ActiveAbility abilities = new ActiveAbility(new FixedTargeting(KEYS.SOURCE), effects);
abilities.setRef(ref);
new AddTriggerEffect(event_type, conditions, abilities).apply(ref);
return true;
}
use of main.elements.targeting.FixedTargeting in project Eidolons by IDemiurge.
the class DamageInversionEffect method applyThis.
@Override
public boolean applyThis() {
// endurance damage; modify endurance only? above base?
Targeting targeting = new FixedTargeting(KEYS.SOURCE);
Effects effects = new Effects();
if (restoreEndurance) {
ModifyValueEffect effect = new ModifyValueEffect(PARAMS.C_ENDURANCE, code, formula.toString());
if (!restoreEnduranceAboveBase) {
effect.setMaxParam(PARAMS.ENDURANCE);
}
effects.add(effect);
}
if (restoreToughness) {
ModifyValueEffect effect = new ModifyValueEffect(PARAMS.C_TOUGHNESS, code, formula.toString());
if (!restoreToughnessAboveBase) {
effect.setMaxParam(PARAMS.TOUGHNESS);
}
effects.add(effect);
}
ActiveAbility ability = new ActiveAbility(targeting, effects);
new AddTriggerEffect(event_type, conditions, ability).apply(ref);
return true;
}
use of main.elements.targeting.FixedTargeting in project Eidolons by IDemiurge.
the class PriorityManagerImpl method getZoneSpellPriority.
@Override
public int getZoneSpellPriority(Action action, boolean damage) {
int base_priority = 0;
DC_ActiveObj active = action.getActive();
Targeting targeting = active.getTargeting();
if (targeting instanceof FixedTargeting || targeting instanceof SelectiveTargeting) {
targeting = TargetingMaster.getZoneEffect(active);
}
// Set<Obj> objects = targeting.getFilter().getObjects(action.getRef());
Ref REF = action.getRef().getCopy();
targeting.select(REF);
List<Obj> objects = (REF.getGroup() != null) ? REF.getGroup().getObjects() : new ArrayList<>(targeting.getFilter().getObjects(action.getRef()));
for (Obj obj : objects) {
// TODO
if (obj instanceof Unit) {
if (obj.isNeutral() || obj.isDead()) {
continue;
}
Unit target = (Unit) obj;
int p = (damage) ? getDamagePriority(active, target, false) : getParamModSpellPriority(action);
Boolean less_or_more_for_health = null;
if (p == 200) {
// ?
less_or_more_for_health = null;
}
p = getUnitPriority(target, less_or_more_for_health) * p / 100;
boolean ally = target.isOwnedBy(getUnit().getOwner());
if (ally) {
if (action.getSource().checkAiMod(AI_MODIFIERS.CRUEL)) {
p /= 2;
}
if (action.getSource().checkAiMod(AI_MODIFIERS.MERCIFUL)) {
p *= 2;
}
base_priority -= p;
} else {
if (action.getSource().checkAiMod(AI_MODIFIERS.TRUE_BRUTE)) {
p *= 2;
}
base_priority += p;
base_priority += base_priority / 6;
}
}
}
return base_priority;
}
Aggregations