use of eidolons.ability.effects.oneshot.DealDamageEffect in project Eidolons by IDemiurge.
the class CollisionRule method collision.
public static Coordinates collision(Ref ref, DC_ActiveObj activeObj, Unit moveObj, Unit collideObj, boolean summon, int force) {
// ++ AoO!
// permit auto-retreat ? maybe some skill will make hidden unit
// *passable* ;)
Coordinates dest = collideObj.getCoordinates();
Coordinates final_coordinate = dest;
if (!canBeOn(moveObj, collideObj.getCoordinates())) {
// dest.getAdjacentCoordinate(direction);
Boolean above = PositionMaster.isAboveOr(moveObj, collideObj);
Boolean left = PositionMaster.isToTheLeftOr(moveObj, collideObj);
// TODO adjust in a loop in case there are multiple obstacles
// around!
int x = 0;
if (left != null) {
x = (left ? -1 : 1);
}
int y = 0;
if (above != null) {
y = (above ? -1 : 1);
}
final_coordinate = new Coordinates(dest.x + x, dest.y + y);
if (!canBeOn(moveObj, final_coordinate)) {
final_coordinate = adjustCoordinateRandomly(dest, moveObj);
}
// TODO ++ spare Action Points? Percentage or so...
// saved_ap =
// activeObj.getIntParam(PARAMS.AP_COST)*distance_factor*save_factor;
}
if (!moveObj.getOwner().equals(collideObj.getOwner())) {
// any action
Boolean incomerAlive = AttackOfOpportunityRule.collisionAoO(moveObj.getDummyAction(), collideObj);
if (!BooleanMaster.isFalse(incomerAlive)) {
InstantAttackRule.checkCollisionAttack(moveObj, activeObj, collideObj);
}
// if (incomerAlive == null) {
// if (!summon)
// AttackOfOpportunityRule.checkAttack(moveObj,
// collideObj.getAction("Move"));
// } else if (incomerAlive)
// if (!summon)
// AttackOfOpportunityRule.checkAttack(moveObj,
// collideObj.getAction("Move"));
}
// return false; TODO
if (moveObj.isDead()) {
return null;
}
if (collideObj.isDead()) {
return final_coordinate;
}
if (force != 0) {
new DealDamageEffect(ForceRule.getCollisionDamageFormula(moveObj, collideObj, force, true), GenericEnums.DAMAGE_TYPE.BLUDGEONING).apply(Ref.getSelfTargetingRefCopy(collideObj));
new DealDamageEffect(ForceRule.getCollisionDamageFormula(moveObj, collideObj, force, false), GenericEnums.DAMAGE_TYPE.BLUDGEONING).apply(Ref.getSelfTargetingRefCopy(moveObj));
}
if (!VisionManager.checkVisible(collideObj)) // if (moveObj.canAct())
{
// ROLL?
StealthRule.applySpotted(collideObj);
}
return final_coordinate;
}
use of eidolons.ability.effects.oneshot.DealDamageEffect in project Eidolons by IDemiurge.
the class DealDamageEffectTest method dealDamageObjectTest.
@Test
public void dealDamageObjectTest() {
assertTrue(source != null);
assertTrue(target != null);
int origToughness = target.getIntParam(PARAMS.C_TOUGHNESS);
int origEndurance = target.getIntParam(PARAMS.C_ENDURANCE);
DealDamageEffect eff = new DealDamageEffect(new Formula("50"), GenericEnums.DAMAGE_TYPE.BLUDGEONING.getName(), DAMAGE_MODIFIER.UNBLOCKABLE);
Damage dmg = DamageFactory.getDamageFromEffect(eff, 25);
dmg.getRef().setTarget(target.getId());
DamageDealer.dealDamage(dmg);
Integer newToughness = target.getIntParam(PARAMS.C_TOUGHNESS);
Integer newEndurance = target.getIntParam(PARAMS.C_ENDURANCE);
assertTrue(newToughness < origToughness);
assertTrue(newEndurance < origEndurance);
}
Aggregations