Search in sources :

Example 1 with MoveEffect

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();
}
Also used : SelfMoveEffect(eidolons.ability.effects.oneshot.move.SelfMoveEffect) SelfMoveEffect(eidolons.ability.effects.oneshot.move.SelfMoveEffect) MoveEffect(eidolons.ability.effects.oneshot.move.MoveEffect)

Example 2 with MoveEffect

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?
}
Also used : Formula(main.system.math.Formula) Ref(main.entity.Ref) DIRECTION(main.game.bf.Coordinates.DIRECTION) MoveEffect(eidolons.ability.effects.oneshot.move.MoveEffect)

Aggregations

MoveEffect (eidolons.ability.effects.oneshot.move.MoveEffect)2 SelfMoveEffect (eidolons.ability.effects.oneshot.move.SelfMoveEffect)1 Ref (main.entity.Ref)1 DIRECTION (main.game.bf.Coordinates.DIRECTION)1 Formula (main.system.math.Formula)1