use of eidolons.ability.effects.oneshot.move.MoveEffect in project Eidolons by IDemiurge.
the class DC_MovementManager method getMovementDestinationCoordinate.
public static Coordinates getMovementDestinationCoordinate(DC_ActiveObj active) {
try {
MoveEffect effect = (MoveEffect) EffectFinder.getEffectsOfClass(active.getAbilities(), MoveEffect.class).get(0);
effect.setRef(active.getRef());
if (effect instanceof SelfMoveEffect) {
SelfMoveEffect selfMoveEffect = (SelfMoveEffect) effect;
// TODO
return selfMoveEffect.getCoordinates();
}
return effect.getRef().getTargetObj().getCoordinates();
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
return active.getOwnerObj().getCoordinates();
}
use of eidolons.ability.effects.oneshot.move.MoveEffect in project Eidolons by IDemiurge.
the class ForceRule method applyPush.
// TODO into PushEffect! With std knockdown on "landing" or damage!
public static void applyPush(int force, DC_ActiveObj attack, BattleFieldObject source, BattleFieldObject target) {
DIRECTION d = DirectionMaster.getRelativeDirection(source, target);
if (attack.isSpell()) {
d = DirectionMaster.getRelativeDirection(attack.getRef().getTargetObj(), target);
// cell
}
int distance = getPushDistance(MathMaster.applyModIfNotZero(force, attack.getFinalModParam(PARAMS.FORCE_PUSH_MOD)), target);
if (distance == 0) {
if (isTestMode()) {
distance = 1;
} else {
return;
}
}
if (d.isDiagonal()) {
distance = (int) Math.round(Math.sqrt(distance));
if (distance == 0) {
d = d.rotate90(RandomWizard.random());
distance = 1;
}
}
// int weight = target.getIntParam(PARAMS.TOTAL_WEIGHT);
// if (distance == 0)
// distance = RandomWizard.chance(force * 100 / weight) ? 1 : 0; // TODO
int x_displacement = BooleanMaster.isTrue(d.growX) ? distance : -distance;
int y_displacement = BooleanMaster.isTrue(d.growY) ? distance : -distance;
if (!d.isDiagonal()) {
if (d.isVertical()) {
x_displacement = 0;
} else {
y_displacement = 0;
}
}
Ref ref = attack.getRef().getCopy();
ref.setTarget(target.getId());
new MoveEffect("target", new Formula("" + x_displacement), new Formula("" + y_displacement)).apply(ref);
// roll dexterity against Fall Down
// TODO knock vs push - which is 'critical'?
// maybe just apply a modifier, then calculate if push/knock?
// sometimes it'll be better to be 'weak', eh?
}
Aggregations