use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class ThrowEffect method applyThis.
@Override
public boolean applyThis() {
if (stormOfMissiles) {
fromHand = true;
DC_WeaponObj weapon = (DC_WeaponObj) ref.getObj(KEYS.WEAPON);
boolean result = throwWeapon(weapon);
weapon = (DC_WeaponObj) ref.getObj(KEYS.OFFHAND);
if (weapon != null) {
offhand = true;
result = throwWeapon(weapon);
}
Unit hero = (Unit) ref.getObj(KEYS.SOURCE);
fromHand = false;
for (DC_QuickItemObj q : hero.getQuickItems()) {
weapon = q.getWrappedWeapon();
if (weapon != null) {
result &= throwWeapon(weapon);
}
}
return result;
}
DC_WeaponObj weapon = (DC_WeaponObj) ref.getObj(KEYS.WEAPON);
try {
if (offhand || ref.getObj(KEYS.ACTIVE).checkProperty(G_PROPS.ACTION_TAGS, "" + ActionEnums.ACTION_TAGS.OFF_HAND)) {
weapon = (DC_WeaponObj) ref.getObj(KEYS.OFFHAND);
offhand = true;
}
// offhand mods?
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
return throwWeapon(weapon);
}
use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class ModeEffect method addDispelOnHitTrigger.
private void addDispelOnHitTrigger() {
Effects effects = new Effects(new RemoveBuffEffect(addBuffEffect.getBuffTypeName()));
if (!mode.equals(STD_MODES.ALERT)) {
effects.add(InterruptRule.getEffect());
} else {
effects.add(AlertRule.getInterruptEffect());
}
if (mode.equals(STD_MODES.CHANNELING)) {
effects.add(new EffectImpl() {
@Override
public boolean applyThis() {
ChannelingRule.channelingInterrupted((Unit) getRef().getSourceObj());
return true;
}
});
}
// TODO
STANDARD_EVENT_TYPE event_type = STANDARD_EVENT_TYPE.UNIT_IS_DEALT_TOUGHNESS_DAMAGE;
Condition conditions = (mode.equals(STD_MODES.ALERT)) ? InterruptRule.getConditionsAlert() : InterruptRule.getConditions();
addBuffEffect.addEffect(new DelayedEffect(event_type, effects, conditions));
}
use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class ModeEffect method applyExplorationVersion.
private boolean applyExplorationVersion() {
/*
start restoring <?> over time
set mode all the same, just allow breaking it?
while in Mode, restore...
isModeDisablesActions
alert - ?
divination?
*/
Unit unit = (Unit) getRef().getSourceObj();
unit.getGame().getDungeonMaster().getExplorationMaster().getTimeMaster().unitActivatesMode(unit);
unit.getGame().getStateManager().reset(unit);
return false;
}
use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class DealDamageEffect method applyThis.
@Override
public boolean applyThis() {
if (ref.getTargetObj() == null) {
return false;
}
if (!(ref.getTargetObj() instanceof Unit)) {
// TODO if cell, apply damage to corpses?
return true;
}
if (checkDamageMod(DAMAGE_MODIFIER.QUIET)) {
getRef().setQuiet(true);
} else {
getRef().setQuiet(false);
}
Unit targetObj = (Unit) ref.getTargetObj();
int amount = formula.getAppendedByModifier(ref.getValue(KEYS.FORMULA)).getInt(ref);
DC_ActiveObj active = (DC_ActiveObj) ref.getActive();
boolean spell = active instanceof DC_SpellObj;
initDamageType();
if (!checkDamageMod(DAMAGE_MODIFIER.UNBLOCKABLE)) {
amount = ArmorMaster.getShieldReducedAmountForDealDamageEffect(this, targetObj, amount, active);
}
LogMaster.log(LogMaster.COMBAT_DEBUG, "Effect is dealing damage: " + amount + " to " + ref.getTargetObj().toString());
saveDamageModsToRef();
ref.setValue(KEYS.DAMAGE_TYPE, damage_type.getName());
int damage = DamageDealer.dealDamage(getDamageObject(amount));
return true;
}
use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class ActivateEffect method applyThis.
@Override
public boolean applyThis() {
Unit source = (Unit) ref.getObj(sourceKey);
Unit target = (Unit) ref.getObj(key);
DC_ActiveObj active;
if (!spell) {
active = source.getAction(name);
} else {
active = source.getSpell(name);
}
if (free) {
active.setFree(free);
}
try {
active.activatedOn(Ref.getSelfTargetingRefCopy(target));
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
} finally {
active.setFree(false);
}
return true;
}
Aggregations