use of main.elements.conditions.Conditions in project Eidolons by IDemiurge.
the class ClassView method getAdditionalTypesData.
@Override
protected List<ObjType> getAdditionalTypesData() {
String group = vendorPanel.getSelectedTabName();
List<ObjType> list = getAdditionalTypesMap().get(group);
if (list != null) {
return list;
}
String types = StringMaster.joinStringList(DataManager.getTypeNamesGroup(getTYPE(), group), ";");
Filter<ObjType> filter = new Filter<>(hero.getRef(), new Conditions(new StringComparison("{Match_}" + G_PROPS.CLASS_GROUP, MULTICLASS, true), new OrConditions(new Conditions(// ,
new StringComparison(group, "{Match_}" + G_PROPS.BASE_TYPE, false)), new StringComparison("{Match_}" + PROPS.BASE_CLASSES_ONE, types, false), new StringComparison("{Match_}" + PROPS.BASE_CLASSES_TWO, types, false))), DC_TYPE.CLASSES);
list = new ArrayList<>(filter.getTypes());
getAdditionalTypesMap().put(vendorPanel.getSelectedTabName(), list);
return list;
}
use of main.elements.conditions.Conditions in project Eidolons by IDemiurge.
the class ReasonMaster method getReasonsCannotTarget.
public static List<FILTER_REASON> getReasonsCannotTarget(Action action, boolean useConditionResultCache, Boolean checkMiscOrOnly, FILTER_REASON searchedReason) {
Ref REF = action.getRef().getCopy();
REF.setMatch(action.getRef().getTarget());
Targeting targeting = action.getActive().getTargeting();
if (targeting == null) {
targeting = TargetingMaster.findTargeting(action.getActive());
}
if (targeting == null) {
return new ArrayList<>();
}
Conditions conditions = targeting.getFilter().getConditions();
// conditions.preCheck(REF);
List<FILTER_REASON> reasons = new ArrayList<>();
for (Condition c : conditions) {
FILTER_REASON reason = getReason(c);
if (searchedReason != null) {
if (reason != searchedReason) {
continue;
}
}
if (checkMiscOrOnly == null) {
if (reason != FILTER_REASON.OTHER) {
continue;
}
} else if (!checkMiscOrOnly) {
if (reason == FILTER_REASON.OTHER) {
continue;
}
}
boolean result = c.isTrue();
if (!useConditionResultCache) {
result = c.preCheck(REF);
} else {
// LogMaster.log(0, c + " uses cached result " + result);
}
if (!result) {
if (reason != null) {
reasons.add(reason);
}
}
}
return reasons;
}
use of main.elements.conditions.Conditions in project Eidolons by IDemiurge.
the class ArenaBattleConstructor method constructWaveSequence.
public Map<Wave, Integer> constructWaveSequence(ENCOUNTER_TYPE[] encounter_sequence) {
Integer round = getRoundNumber();
if (SkirmishMaster.isSkirmish()) {
return SkirmishMaster.constructWaveSequences(round);
}
Map<Wave, Integer> map = new XLinkedMap<>();
if (alt != null) {
alt = !alt;
} else {
alt = checkAltEncounter();
}
List<ObjType> waves = getWaveTypes(getDungeon().getType(), alt);
List<ObjType> waveBuffer = new ArrayList<>(waves);
for (ENCOUNTER_TYPE type : encounter_sequence) {
if (waveBuffer.isEmpty()) {
waveBuffer = DataManager.getTypesGroup(DC_TYPE.ENCOUNTERS, StringMaster.getWellFormattedString(type.toString()));
}
waves = new ArrayList<>(waveBuffer);
Conditions conditions = new Conditions(getEncounterTypeCondition(type));
List<ObjType> filteredWaves = new Filter<ObjType>(game, conditions).filter(waves);
if (!filteredWaves.isEmpty()) {
waves = filteredWaves;
} else {
continue;
}
ObjType waveType = getWaveType(waves, type);
waveType = new ObjType(waveType);
FACING_DIRECTION side = null;
// getMaster().getDungeonMaster().getPositioner().nextSide();
waveType.setProperty(PROPS.SPAWNING_SIDE, side.getName());
Coordinates c = pickSpawnCoordinateForWave(type, round, waveType);
Wave wave = new Wave(c, waveType, game, new Ref(game), game.getPlayer(false));
wave.initUnitMap();
map.put(wave, round);
if (Eidolons.DEV_MODE) {
game.getLogManager().logInfo(wave.toString() + " on round #" + round);
}
LogMaster.log(1, wave.toString() + " on round #" + round);
// TODO subtract from
round += getRoundsToFight(waveType, type);
// total pool
}
setIndex(getIndex() + 1);
return map;
}
use of main.elements.conditions.Conditions in project Eidolons by IDemiurge.
the class BindingDamageEffect method applyThis.
@Override
public boolean applyThis() {
// Can be initialized() just once
GroupImpl group = ref.getGroup();
Effects effects = new Effects();
STANDARD_EVENT_TYPE event_type;
if (shareOrRedirect) {
// TODO splitMode!
event_type = STANDARD_EVENT_TYPE.UNIT_IS_DEALT_TOUGHNESS_DAMAGE;
if (spellDmgOnly != null) {
if (spellDmgOnly) {
event_type = STANDARD_EVENT_TYPE.UNIT_HAS_BEEN_DEALT_SPELL_DAMAGE;
}
}
if (physicalDmgOnly != null) {
if (physicalDmgOnly) {
event_type = STANDARD_EVENT_TYPE.UNIT_HAS_BEEN_DEALT_PHYSICAL_DAMAGE;
}
}
} else {
effects.add(new AlteringEffect(false, formula.getNegative().toString()));
event_type = Event.STANDARD_EVENT_TYPE.UNIT_IS_BEING_DEALT_DAMAGE;
if (spellDmgOnly != null) {
if (spellDmgOnly) {
event_type = STANDARD_EVENT_TYPE.UNIT_IS_BEING_DEALT_SPELL_DAMAGE;
}
}
if (physicalDmgOnly != null) {
if (physicalDmgOnly) {
event_type = STANDARD_EVENT_TYPE.UNIT_IS_BEING_DEALT_PHYSICAL_DAMAGE;
}
}
}
Targeting targeting_other_units = new AutoTargeting(new Conditions(new GroupCondition(Ref.KEYS.MATCH.name(), group), // negative
new RefCondition(KEYS.EVENT_TARGET, KEYS.MATCH, true)));
effects.add(new CustomTargetEffect(targeting_other_units, new DealDamageEffect(getDamageFormula(), GenericEnums.DAMAGE_TYPE.PURE)));
/*
* ensure there is no deadlock
*/
conditions = new Conditions();
conditions.add(new NonTriggeredEventCondition());
KEYS OBJ_REF = Ref.KEYS.EVENT_TARGET;
conditions.add(new GroupCondition(OBJ_REF, group));
// has the group...
Ref REF = Ref.getCopy(ref);
// REF.setTarget(null); // ???
new AddTriggerEffect(event_type, conditions, OBJ_REF, effects).apply(REF);
return true;
}
use of main.elements.conditions.Conditions in project Eidolons by IDemiurge.
the class FilterMaster method newFilter.
public static void newFilter() {
Conditions conditions = new Conditions();
OBJ_TYPE TYPE = ArcaneVault.getSelectedOBJ_TYPE();
CONDITION_TEMPLATES[] templates = CONDITION_TEMPLATES.values();
while (true) {
// CHOOSE TYPE? OR USE SELECTED TAB!
int i = DialogMaster.optionChoice(templates, "choose filter template");
if (i == -1) {
break;
}
CONDITION_TEMPLATES template = CONDITION_TEMPLATES.values()[i];
String value = DialogMaster.inputText("Enter filter's value name");
if (StringMaster.isEmpty(value)) {
break;
}
VALUE val = ContentManager.findValue(value);
value = DialogMaster.inputText("Enter filtering value");
if (StringMaster.isEmpty(value)) {
break;
}
conditions.add(new ConditionMaster().getConditionFromTemplate(template, StringMaster.getValueRef(KEYS.MATCH, val), value));
}
if (conditions.isEmpty()) {
return;
}
if (TYPE == null) {
}
// Document node = XML_Converter.getDoc(XML_Converter.openXml("conditions")
// + XML_Converter.closeXml("conditions"));
// String conditionString = XML_Converter.getStringFromXML(node);
TypeFilter filter = new TypeFilter(conditions, TYPE);
// save!
filters.add(filter);
ArcaneVault.getMainBuilder().getTabBuilder().addFilter(filter);
}
Aggregations