use of main.elements.conditions.standard.OwnershipCondition in project Eidolons by IDemiurge.
the class WatchRule method updateWatchStatus.
public void updateWatchStatus(Unit watcher) {
List<DC_Obj> list = getWatchersMap().get(watcher);
boolean invalid = false;
if (list != null) {
if (!checkValidWatcher(watcher)) {
invalid = true;
removeWatcher(watcher);
} else {
for (DC_Obj watched : list) {
if (!checkValidWatchTarget(watched)) {
breakWatch(watcher, watched);
break;
} else if (!checkValidWatchPairTarget(watcher, watched)) {
breakWatch(watcher, watched);
break;
}
}
}
}
BuffObj buff = watcher.getBuff("Watching", false);
if (buff != null) {
watcher.getGame().getManager().buffRemoved(buff);
}
if (!invalid) {
if (watcher.getMode().equals(STD_MODES.ALERT)) {
Ref ref = watcher.getRef().getCopy();
try {
SpectrumEffect spectrumEffect = new SpectrumEffect(new OwnershipCondition(true, "match", "source"), new WatchActionEffect(true));
spectrumEffect.setRangeFormula(StringMaster.getValueRef(KEYS.SOURCE, PARAMS.SIGHT_RANGE));
// for now...
spectrumEffect.setApplyThrough(false);
spectrumEffect.apply(ref);
watcher.getBuff(STD_MODES.ALERT.getBuffName(), false).setOnDispelEffects(new RemoveBuffEffect("Watching ", false));
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
}
}
list = getWatchersMap().get(watcher);
if (ListMaster.isNotEmpty(list)) // TODO alert???
{
getWatchBuffEffect(watcher, list).apply(Ref.getSelfTargetingRefCopy(watcher));
}
}
use of main.elements.conditions.standard.OwnershipCondition in project Eidolons by IDemiurge.
the class DC_ConditionMaster method getSelectiveTargetingTemplateConditions.
public static Conditions getSelectiveTargetingTemplateConditions(SELECTIVE_TARGETING_TEMPLATES template) {
Conditions c = new Conditions();
if ((template.isDependentOnZ())) {
// source and match?
c.add(new ZLevelCondition(true));
}
switch(template) {
case ANY_ARMOR:
{
c.add(new ObjTypeComparison(DC_TYPE.ARMOR));
break;
}
case ANY_WEAPON:
{
c.add(new NotCondition(new PropCondition(G_PROPS.WEAPON_TYPE, ItemEnums.WEAPON_TYPE.NATURAL.toString())));
c.add(new OrConditions(new ObjTypeComparison(DC_TYPE.WEAPONS), new Conditions(new PropCondition(G_PROPS.STD_BOOLS, GenericEnums.STD_BOOLS.WRAPPED_ITEM), new ObjTypeComparison(DC_TYPE.ITEMS))));
break;
}
case ANY_ITEM:
{
c.add(new ObjTypeComparison(DC_TYPE.ITEMS));
break;
}
case ENEMY_ARMOR:
{
c.add(new ObjTypeComparison(DC_TYPE.ARMOR));
c.add(ConditionMaster.getEnemyCondition());
break;
}
case ENEMY_ITEM:
{
c.add(new ObjTypeComparison(DC_TYPE.ITEMS));
c.add(ConditionMaster.getEnemyCondition());
break;
}
case ENEMY_WEAPON:
{
c.add(new NotCondition(new PropCondition(G_PROPS.WEAPON_TYPE, ItemEnums.WEAPON_TYPE.NATURAL.toString())));
c.add(new OrConditions(new ObjTypeComparison(DC_TYPE.ITEMS), new ObjTypeComparison(DC_TYPE.WEAPONS)));
c.add(ConditionMaster.getEnemyCondition());
break;
}
case MY_ITEM:
{
c.add(new ObjTypeComparison(DC_TYPE.ITEMS));
break;
}
case MY_SPELLBOOK:
c.add(ConditionMaster.getTYPECondition(DC_TYPE.SPELLS));
c.add(new SpellCondition(SPELL_CHECK.ACTIVE));
c.add(new RefCondition(KEYS.MATCH_SOURCE, KEYS.SOURCE));
break;
case MY_ARMOR:
{
// c.add(new ObjTypeComparison(OBJ_TYPES.ARMOR));
c.add(new RefCondition(KEYS.ARMOR, KEYS.MATCH));
break;
}
case MY_WEAPON:
{
c.add(new NotCondition(new PropCondition(G_PROPS.WEAPON_TYPE, ItemEnums.WEAPON_TYPE.NATURAL.toString())));
c.add(new OrConditions(new ObjTypeComparison(DC_TYPE.WEAPONS), new Conditions(new PropCondition(G_PROPS.STD_BOOLS, GenericEnums.STD_BOOLS.WRAPPED_ITEM), new ObjTypeComparison(DC_TYPE.ITEMS))));
// c.add(new RefCondition(KEYS.WEAPON, KEYS.MATCH));
break;
}
case CELL:
{
c.add(ConditionMaster.getTYPECondition(DC_TYPE.TERRAIN));
c.add(getRangeCondition());
c.add(new CellCondition(true));
break;
}
case BLAST:
{
c.add(ConditionMaster.getUnit_Char_BfObj_TerrainTypeCondition());
c.add(getRangeCondition());
c.add(new FacingCondition(UnitEnums.FACING_SINGLE.IN_FRONT));
c.add(new NotCondition(ConditionMaster.getSelfFilterCondition()));
break;
}
case BLIND_SHOT:
case SHOT:
c.add(ConditionMaster.getUnit_Char_BfObjTypeCondition());
c.add(new NotCondition(ConditionMaster.getSelfFilterCondition()));
c.add(new FacingCondition(UnitEnums.FACING_SINGLE.IN_FRONT));
c.add(getRangeCondition());
c.add(new OrConditions(new StdPassiveCondition(UnitEnums.STANDARD_PASSIVES.DARKVISION), new NotCondition(new VisibilityCondition(UNIT_VISION.CONCEALED))));
//
c.add(getClearShotCondition(KEYS.MATCH.name()));
// ALL SHOT LIKE THIS!
break;
case PRECISE_SHOT:
c.add(new VisibilityCondition(UNIT_VISION.IN_PLAIN_SIGHT));
break;
case UNOBSTRUCTED_SHOT:
c.add(new NotCondition(ConditionMaster.getSelfFilterCondition()));
c.add(getRangeCondition());
break;
case RAY:
c.add(ConditionMaster.getDistanceFilterCondition(Ref.KEYS.SOURCE.name(), 1));
break;
case MOVE:
c.add(DC_ConditionMaster.getMoveFilterCondition());
break;
case BF_OBJ:
c.add(ConditionMaster.getTYPECondition(DC_TYPE.BF_OBJ));
break;
case ANY_ALLY:
c.add(ConditionMaster.getUnit_CharTypeCondition());
c.add(ConditionMaster.getOwnershipFilterCondition(Ref.KEYS.SOURCE.name(), true));
break;
case ANY_ENEMY:
c.add(ConditionMaster.getUnit_CharTypeCondition());
c.add(ConditionMaster.getOwnershipFilterCondition(Ref.KEYS.SOURCE.name(), false));
break;
case ANY_UNIT:
c.add(ConditionMaster.getUnit_CharTypeCondition());
break;
case KEY:
c.add(new OrConditions(new PropCondition(G_PROPS.BF_OBJECT_GROUP, BF_OBJECT_GROUP.LOCK.toString(), true), new PropCondition(G_PROPS.BF_OBJECT_GROUP, BF_OBJECT_GROUP.DOOR.toString(), true)));
case ATTACK:
c.add(new VisibilityCondition(UNIT_VISION.IN_SIGHT));
List<FACING_SINGLE> list = new ArrayList<>();
list.add(UnitEnums.FACING_SINGLE.IN_FRONT);
c.add(new OrConditions(new FacingCondition(UnitEnums.FACING_SINGLE.IN_FRONT), new Conditions(new FacingCondition(UnitEnums.FACING_SINGLE.IN_FRONT, UnitEnums.FACING_SINGLE.BEHIND), new StringComparison(StringMaster.getValueRef(KEYS.SOURCE, G_PROPS.STANDARD_PASSIVES), UnitEnums.STANDARD_PASSIVES.HIND_REACH + "", false)), new Conditions(new FacingCondition(UnitEnums.FACING_SINGLE.IN_FRONT, UnitEnums.FACING_SINGLE.TO_THE_SIDE), new StringComparison(StringMaster.getValueRef(KEYS.SOURCE, G_PROPS.STANDARD_PASSIVES), UnitEnums.STANDARD_PASSIVES.BROAD_REACH + "", false))));
c.add(ConditionMaster.getAttackConditions());
c.add(getClearShotCondition(KEYS.MATCH.name()));
// c.add(AirborneRule.getMeleeAttackCondition()); TODO
break;
case GRAVE_CELL:
c.add(new GraveCondition());
break;
case CLAIM:
{
c.add(new NotCondition(new StatusCheckCondition(UnitEnums.STATUS.CHANNELED)));
c.add(new NotCondition(new OwnershipCondition(KEYS.SOURCE, KEYS.MATCH)));
c.add(ConditionMaster.getTYPECondition(DC_TYPE.BF_OBJ));
c.add(ConditionMaster.getDistanceFilterCondition(Ref.KEYS.SOURCE.name(), "{ACTIVE_RANGE}"));
break;
}
case ENEMY_SPELLBOOK:
break;
default:
break;
}
return c;
}
use of main.elements.conditions.standard.OwnershipCondition in project Eidolons by IDemiurge.
the class AlertRule method getWakeUpConditions.
public static Condition getWakeUpConditions() {
// TODO will be checked with a ref from UNIT_ACTION_COMPLETE event!
Conditions conditions = new OrConditions();
// adjacent enemy condition - the problem is that it will then be
// impossible to be *alert* if there are enemies adjacent already... or
// is it a good design?
// action was targeting *source* - directly or as one of the targets -
// the problem is that it won't work for allies which could be exploited
// largely
// all in all, Alert Mode is probably not for *complicated situations*,
// it's for the simple ones when you just wait for the fight
// patiently...
// new PropCondition(prop, str2)
conditions.add(new Conditions(new NotCondition(new OwnershipCondition(KEYS.SOURCE, KEYS.EVENT_SOURCE)), new OrConditions(new RefCondition(KEYS.EVENT_TARGET, KEYS.SOURCE), new GroupCondition(KEYS.SOURCE.toString(), true))));
conditions.add(new ListSizeCondition(true, new Conditions(ConditionMaster.getAliveAndConsciousFilterCondition(), ConditionMaster.getEnemyCondition(), ConditionMaster.getAdjacentCondition()), "1"));
return conditions;
}
use of main.elements.conditions.standard.OwnershipCondition in project Eidolons by IDemiurge.
the class ConditionMaster method getClaimedBfObjConditions.
public static Conditions getClaimedBfObjConditions(String BF_OBJECT_TYPE) {
Conditions conditions = new Conditions();
conditions.add(ConditionMaster.getPropCondition("MATCH", G_PROPS.BF_OBJECT_TYPE, BF_OBJECT_TYPE));
conditions.add(ConditionMaster.getTYPECondition(DC_TYPE.BF_OBJ));
conditions.add(new OwnershipCondition(KEYS.MATCH, KEYS.SOURCE));
return conditions;
}
use of main.elements.conditions.standard.OwnershipCondition in project Eidolons by IDemiurge.
the class ClaimRule method initEffects.
@Override
public void initEffects() {
Conditions conditions = new Conditions();
conditions.add(new NumericCondition("0", CLAIM_COUNTERS));
Conditions conditions2 = new Conditions();
conditions2.add(new OwnershipCondition(KEYS.EVENT_TARGET.name(), true));
conditions2.add(nOfCounters);
RemoveBuffEffect removeBuffEffect = new RemoveBuffEffect(buffName);
Effect effect = new OwnershipChangeEffect(false);
AddBuffEffect addBuffEffect = new AddBuffEffect(new NumericCondition("{BASIS_CLAIM_COUNTERS}", "0"), buffName, effect);
effects = new IfElseEffect(removeBuffEffect, conditions, new ConditionalEffect(conditions2, addBuffEffect));
}
Aggregations