import { ChessRules, Move, PiPo } from "@/base_rules";
 import { randInt } from "@/utils/alea";
 
-export class TeleportRules extends ChessRules {
+export class Teleport1Rules extends ChessRules {
 
   hoverHighlight([x, y]) {
     // Testing move validity results in an infinite update loop.
 
   }
 
   postPlay(move) {
-    if (move.vaish.length > 0) {
+    if (move.vanish.length > 0) {
       // Standard method:
       if (move.appear[0].p == V.KING)
         this.kingPos[move.appear[0].c] = [move.appear[0].x, move.appear[0].y];
 
   updateCastleFlags(move) {
     // Standard method: TODO = find a better way... (not rewriting)
-    const c = color || V.GetOppCol(this.turn);
+    const c = move.vanish[0].c;
     const firstRank = (c == "w" ? V.size.x - 1 : 0);
     const oppCol = this.turn;
     const oppFirstRank = V.size.x - 1 - firstRank;
-    if (piece == V.KING && move.appear.length > 0)
+    if (move.vanish[0].p == V.KING && move.appear.length > 0)
       this.castleFlags[c] = [V.size.y, V.size.y];
     else if (
       move.start.x == firstRank &&