use of main.elements.conditions.Conditions in project Eidolons by IDemiurge.
the class FilterMaster method getPlayerControlledUnits.
public static Set<Obj> getPlayerControlledUnits(Player player) {
Conditions c = new Conditions();
Ref ref;
if (player == Player.NEUTRAL) {
c.add(new OwnershipCondition("MATCH", true));
c.add(ConditionMaster.getBFObjTypesCondition());
ref = new Ref(player.getGame());
} else {
c.add(new OwnershipCondition("MATCH", "SOURCE"));
c.add(ConditionMaster.getBFObjTypesCondition());
ref = player.getHeroObj().getRef();
}
// spells too?
Filter<Obj> filter = new Filter<>(ref, c);
Set<Obj> set = filter.getObjects();
return set;
}
use of main.elements.conditions.Conditions 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.conditions.Conditions in project Eidolons by IDemiurge.
the class ObjectiveMaster method addTrigger.
private static void addTrigger(EVENT_TEMPLATE ET, String eventData, SCRIPT_CONDITION_TEMPLATE CT, String conditionData, ACTION_TEMPLATE AT, String actionData) {
STANDARD_EVENT_TYPE eventType = null;
Conditions conditions = null;
Abilities abilities = null;
addTrigger(eventType, conditions, abilities);
}
use of main.elements.conditions.Conditions in project Eidolons by IDemiurge.
the class ActivesConstructor method addTargetingMods.
public static void addTargetingMods(Targeting targeting, DC_ActiveObj obj) {
Conditions c = new Conditions();
String property = obj.getProperty(PROPS.TARGETING_MODIFIERS);
if (obj.getActionGroup() == ActionEnums.ACTION_TYPE_GROUPS.MOVE) {
// SPELL_TAGS.TELEPORT
if (!obj.checkProperty(G_PROPS.ACTION_TAGS, ActionEnums.ACTION_TAGS.FLYING.toString())) {
if (!obj.checkProperty(PROPS.TARGETING_MODIFIERS, AbilityEnums.TARGETING_MODIFIERS.CLEAR_SHOT.toString())) {
property += AbilityEnums.TARGETING_MODIFIERS.CLEAR_SHOT.toString();
}
if (!obj.checkProperty(PROPS.TARGETING_MODIFIERS, AbilityEnums.TARGETING_MODIFIERS.SPACE.toString())) {
property += AbilityEnums.TARGETING_MODIFIERS.SPACE.toString();
}
}
}
if (StringMaster.isEmpty(property)) {
return;
}
for (String mod : StringMaster.open(property)) {
Condition targetingModConditions;
TARGETING_MODIFIERS MOD = new EnumMaster<TARGETING_MODIFIERS>().retrieveEnumConst(TARGETING_MODIFIERS.class, mod);
if (MOD == null) {
targetingModConditions = ConditionMaster.toConditions(mod);
} else {
targetingModConditions = DC_ConditionMaster.getTargetingModConditions(MOD);
}
if (targetingModConditions != null) {
if (!c.contains(targetingModConditions)) // if (ConditionMaster.contains(c,
// targetingModConditions.getClass())) //you sure?
{
c.add(targetingModConditions);
}
}
}
if (targeting instanceof TemplateSelectiveTargeting) {
TemplateSelectiveTargeting tst = (TemplateSelectiveTargeting) targeting;
if (tst.getTemplate() == SELECTIVE_TARGETING_TEMPLATES.GRAVE_CELL) {
// TODO
if (tst.getConditions() != null) {
try {
((GraveCondition) tst.getConditions().get(0)).getConditions().add(c);
} catch (Exception e) {
main.system.auxiliary.log.LogMaster.log(1, tst.getConditions().get(0) + " in " + obj);
main.system.ExceptionMaster.printStackTrace(e);
}
}
}
}
if (!c.isEmpty()) {
targeting.getFilter().addCondition(c);
}
targeting.setModsAdded(true);
}
use of main.elements.conditions.Conditions in project Eidolons by IDemiurge.
the class TrampleRule method initConditions.
@Override
public void initConditions() {
conditions = new Conditions(// make sure the *source* is correct ref!
new StdPassiveCondition(UnitEnums.STANDARD_PASSIVES.TRAMPLE, KEYS.EVENT_SOURCE), new AttackCondition(false), new NumericCondition("{source_total_weight}+{Strength}*2", "{event_target_bludgeoning_resistance}/100*{event_target_total_weight}*2+{event_target_Strength}*6"), // reflex roll?
new RollCondition(GenericEnums.ROLL_TYPES.REFLEX));
conditions.setFastFailOnCheck(true);
}
Aggregations