Basic fixes in Ultima, still unimplemented
authorBenjamin Auder <benjamin.auder@somewhere>
Wed, 12 Dec 2018 02:12:07 +0000 (03:12 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Wed, 12 Dec 2018 02:12:07 +0000 (03:12 +0100)
public/javascripts/variants/Ultima.js

index 9212afb..4612da1 100644 (file)
@@ -52,6 +52,7 @@ class UltimaRules extends ChessRules
 
        getPotentialMovesFrom([x,y])
        {
+               // TODO: pre-check: is thing on this square immobilized? If yes, return []
                switch (this.getPiece(x,y))
                {
                        case VariantRules.IMMOBILIZER:
@@ -121,6 +122,11 @@ class UltimaRules extends ChessRules
                return super.getPotentialQueenMoves(sq);
        }
 
+       getPotentialImmobilizerMoves(sq)
+       {
+               return super.getPotentialQueenMoves(sq);
+       }
+
        getPotentialKingMoves(sq)
        {
                const V = VariantRules;
@@ -223,7 +229,7 @@ class UltimaRules extends ChessRules
                        randIndex = _.random(1);
                        const rookPos = positions[randIndex];
                        positions.splice(randIndex, 1);
-                       const immobilizerPos = positions[2];
+                       const immobilizerPos = positions[0];
 
                        pieces[c][bishop1Pos] = 'b';
                        pieces[c][bishop2Pos] = 'b';