X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FFanorona.js;fp=client%2Fsrc%2Fvariants%2FFanorona.js;h=4593e6bb00954cd4d701f46b7edac8f5b12339cb;hp=399116353e9a940dde808678dd1d61701c9f62be;hb=ded43c88fad60fd8f9bb46aabd67f3f2092f65f3;hpb=1943de6b9d55716dac4ef8b5672bed803d8d43f9 diff --git a/client/src/variants/Fanorona.js b/client/src/variants/Fanorona.js index 39911635..4593e6bb 100644 --- a/client/src/variants/Fanorona.js +++ b/client/src/variants/Fanorona.js @@ -80,13 +80,14 @@ export class FanoronaRules extends ChessRules { return "Fanorona/" + b; } - getPPpath(m) { + getPPpath(m, orientation) { // m.vanish.length >= 2, first capture gives direction const ref = (Math.abs(m.vanish[1].x - m.start.x) == 1 ? m.start : m.end); const step = [m.vanish[1].x - ref.x, m.vanish[1].y - ref.y]; + const multStep = (orientation == 'w' ? 1 : -1); const normalizedStep = [ - step[0] / Math.abs(step[0]), - step[1] / Math.abs(step[1]) + multStep * step[0] / Math.abs(step[0]), + multStep * step[1] / Math.abs(step[1]) ]; return ( "Fanorona/arrow_" +