use of main.ability.effects.Effect 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.ability.effects.Effect in project Eidolons by IDemiurge.
the class WaitEffect method getAbility.
protected Ability getAbility(Ref ref) {
Effect effect = new Effects(new RemoveBuffEffect(getBuffName()));
Ability ability = new ActiveAbility(new FixedTargeting(KEYS.SOURCE), effect);
ability.setRef(ref);
return ability;
}
use of main.ability.effects.Effect in project Eidolons by IDemiurge.
the class BindingSpellEffect method applyThis.
@Override
public boolean applyThis() {
// TODO Auto-generated method stub
Effects effects = null;
if (!shareOrRedirect) {
effects = new Effects(new CustomTargetEffect(new FixedTargeting(KEYS.TARGET2), new DuplicateEffect(true)), new CustomTargetEffect(new FixedTargeting(KEYS.TARGET), new InterruptEffect()));
}
Effect EFFECT = new DuplicateSpellEffect(KEYS.TARGET.name(), false, true);
EFFECT.setTargetGroup(ref.getGroup());
effects = new Effects(EFFECT);
Event.STANDARD_EVENT_TYPE event_type = Event.STANDARD_EVENT_TYPE.SPELL_RESOLVED;
conditions.add(ConditionMaster.getPropCondition("EVENT_SPELL", G_PROPS.SPELL_TAGS, SpellEnums.SPELL_TAGS.MIND_AFFECTING.name()));
return false;
}
use of main.ability.effects.Effect in project Eidolons by IDemiurge.
the class BuffMaster method createBuff.
public BuffObj createBuff(BuffType type, Obj active, Player player, Ref ref, Effect effect, double duration, Condition retainCondition) {
ref = Ref.getCopy(ref);
if (type.getName().equals(BuffObj.DUMMY_BUFF_TYPE)) {
try {
String name = ref.getObj(KEYS.ACTIVE.name()).getName() + "'s buff";
String img = ref.getObj(KEYS.ACTIVE.name()).getProperty(G_PROPS.IMAGE);
type = new BuffType(type);
type.setProperty(G_PROPS.NAME, name);
type.setProperty(G_PROPS.IMAGE, img);
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
}
Obj basis = game.getObjectById(ref.getBasis());
if (basis == null) {
return null;
}
DC_BuffObj buff = (DC_BuffObj) basis.getBuff(type.getName());
if (buff != null) {
if (!type.checkBool(GenericEnums.STD_BOOLS.STACKING) && !active.checkBool(GenericEnums.STD_BOOLS.STACKING)) {
basis.removeBuff(type.getName());
// TODO duration or do nothing
} else {
if (buff.isMaxStacks()) {
return buff;
}
buff.modifyParameter(PARAMS.BUFF_STACKS, 1);
}
} else {
// preCheck cache
}
buff = new DC_BuffObj(type, player, getGame(), ref, effect, duration, retainCondition);
buff.setActive(active);
// be careful!
buff.applyEffect();
buffCreated(buff, basis);
if (type.checkBool(GenericEnums.STD_BOOLS.APPLY_THRU) || active.checkBool(GenericEnums.STD_BOOLS.APPLY_THRU)) {
buff.setAppliedThrough(true);
if (basis instanceof Unit) {
Ref REF = ref.getCopy();
Obj cell = game.getCellByCoordinate(basis.getCoordinates());
if (!cell.hasBuff(buff.getName())) {
REF.setBasis(cell.getId());
REF.setTarget(cell.getId());
// copy buff
Effect copy = effect.getCopy();
if (copy == null) {
LogMaster.error("APPLY THRU ERROR: " + effect + " HAS NO CONSTRUCT");
} else {
createBuff(type, active, player, REF, copy, duration, retainCondition).setAppliedThrough(true);
}
}
}
}
return buff;
}
use of main.ability.effects.Effect in project Eidolons by IDemiurge.
the class BuffMaster method addAttachment.
public void addAttachment(Attachment attachment, Obj basis) {
List<Attachment> list = getState().getAttachmentsMap().get(basis);
if (list == null) {
list = new ArrayList<>();
getState().getAttachmentsMap().put(basis, list);
}
if (attachment instanceof BuffObj) {
basis.addBuff((BuffObj) attachment);
}
getState().addAttachment(attachment);
list.add(attachment);
if (// e.g. auras
attachment.isTransient()) {
return;
}
for (Effect e : attachment.getEffects()) {
// e.apply(basis.getRef()); // how to add retain conditions?
// else
// if (!(e instanceof AttachmentEffect))
getState().addEffect(e);
}
}
Aggregations