added leychessbeta files

This commit is contained in:
tilera 2017-08-08 23:37:48 +02:00
parent dda3af9297
commit 2d34b9fc0f
6 changed files with 1297 additions and 1 deletions

View File

@ -1196,6 +1196,17 @@ exports.games = (function () {
"fairy-set-view.js",
"wild-tamerlane-view.js"
]
var modelScripts_lcb = [
"base-model.js",
"grid-geo-model.js",
"leychessbeta-model.js"
]
var config_view_js_lcb = [
"base-view.js",
"grid-board-view.js",
"fairy-set-view.js",
"leychessbeta-view.js"
]
return [
{
"name": "classic-chess",
@ -5937,7 +5948,160 @@ exports.games = (function () {
}
},
"viewScripts": config_view_js_wtamerlane
}
},
{
"name": "leychessbeta-chess",
"modelScripts": modelScripts_lcb,
"config": {
"status": true,
"model": {
"title-en": "LeyChessBeta",
"summary": "16*16 Chess with Fairy Pieces",
"rules": {
"en": "leychessbeta-rules.html"
},
"module": "chessbase",
"plazza": "true",
"thumbnail": "leychessbeta-thumbnail.png",
"released": 1402412178,
"credits": {
"en": "leychessbeta-credits.html"
},
"gameOptions": config_model_gameOptions,
"obsolete": false,
"js": modelScripts_lcb,
"description": {
"en": "leychessbeta-description.html"
},
"levels": config_model_levels_15
},
"view": {
"title-en": "Chessbase view",
"visuals": {
"600x600": [
"res/visuals/leychessbeta-600x600-3d.jpg",
"res/visuals/leychessbeta-600x600-2d.jpg"
]
},
"xdView": true,
"css": config_view_css,
"preferredRatio": 1,
"useShowMoves": true,
"useNotation": true,
"module": "chessbase",
"defaultOptions": config_view_defaultOptions,
"skins": [
{
"name": "skin3d",
"title": "3D Classic",
"3d": true,
"preload": [
"smoothedfilegeo|0|/res/ring-target.js",
"image|/res/images/cancel.png",
"image|/res/images/wikipedia.png",
"image|/res/pieces/wikipedia-fairy-emperor-sprites.png",
"image|/res/musketeer/wikipedia-fairy-musketeer-all-sprites.png",
"smoothedfilegeo|0|/res/fairy/pawn/pawn.js",
"image|/res/fairy/pawn/pawn-diffusemap.jpg",
"image|/res/fairy/pawn/pawn-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/knight/knight.js",
"image|/res/fairy/knight/knight-diffusemap.jpg",
"image|/res/fairy/knight/knight-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/bishop/bishop.js",
"image|/res/fairy/bishop/bishop-diffusemap.jpg",
"image|/res/fairy/bishop/bishop-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/queen/queen.js",
"image|/res/fairy/queen/queen-diffusemap.jpg",
"image|/res/fairy/queen/queen-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/king/king.js",
"image|/res/fairy/king/king-diffusemap.jpg",
"image|/res/fairy/king/king-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/rook/rook.js",
"image|/res/fairy/rook/rook-diffusemap.jpg",
"image|/res/fairy/rook/rook-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/cannon2/cannon2.js",
"image|/res/fairy/cannon2/cannon2-diffusemap.jpg",
"image|/res/fairy/cannon2/cannon2-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/elephant/elephant.js",
"image|/res/fairy/elephant/elephant-diffusemap.jpg",
"image|/res/fairy/elephant/elephant-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/admiral/admiral.js",
"image|/res/fairy/admiral/admiral-diffusemap.jpg",
"image|/res/fairy/admiral/admiral-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/camel/camel.js",
"image|/res/fairy/camel/camel-diffusemap.jpg",
"image|/res/fairy/camel/camel-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/lion/lion.js",
"image|/res/fairy/lion/lion-diffusemap.jpg",
"image|/res/fairy/lion/lion-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/eagle/eagle.js",
"image|/res/fairy/eagle/eagle-diffusemap.jpg",
"image|/res/fairy/eagle/eagle-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/unicorn/unicorn.js",
"image|/res/fairy/unicorn/unicorn-diffusemap.jpg",
"image|/res/fairy/unicorn/unicorn-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/lighthouse/lighthouse.js",
"image|/res/fairy/lighthouse/lighthouse-diffusemap.jpg",
"image|/res/fairy/lighthouse/lighthouse-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/amazon/amazon.js",
"image|/res/fairy/amazon/amazon-diffusemap.jpg",
"image|/res/fairy/amazon/amazon-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/cardinal/cardinal.js",
"image|/res/fairy/cardinal/cardinal-diffusemap.jpg",
"image|/res/fairy/cardinal/cardinal-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/marshall/marshall.js",
"image|/res/fairy/marshall/marshall-diffusemap.jpg",
"image|/res/fairy/marshall/marshall-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/dragon/dragon.js",
"image|/res/fairy/dragon/dragon-diffusemap.jpg",
"image|/res/fairy/dragon/dragon-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/crowned-rook/crowned-rook.js",
"image|/res/fairy/crowned-rook/crowned-rook-diffusemap.jpg",
"image|/res/fairy/crowned-rook/crowned-rook-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/corporal/corporal.js",
"image|/res/fairy/corporal/corporal-diffusemap.jpg",
"image|/res/fairy/corporal/corporal-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/prince/prince.js",
"image|/res/fairy/prince/prince-diffusemap.jpg",
"image|/res/fairy/prince/prince-normalmap.jpg",
"image|/res/fairy/star/star-diffusemap.jpg",
"image|/res/fairy/star/star-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/bow/bow.js",
"image|/res/fairy/bow/bow-diffusemap.jpg",
"image|/res/fairy/bow/bow-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/rhino/rhino.js",
"image|/res/fairy/rhino/rhino-diffusemap.jpg",
"image|/res/fairy/rhino/rhino-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/bull/bull.js",
"image|/res/fairy/bull/bull-diffusemap.jpg",
"image|/res/fairy/bull/bull-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/antelope/antelope.js",
"image|/res/fairy/antelope/antelope-diffusemap.jpg",
"image|/res/fairy/antelope/antelope-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/machine/machine.js",
"image|/res/fairy/machine/machine-diffusemap.jpg",
"image|/res/fairy/machine/machine-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/buffalo/buffalo.js",
"image|/res/fairy/buffalo/buffalo-diffusemap.jpg",
"image|/res/fairy/buffalo/buffalo-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/ship/ship.js",
"image|/res/fairy/ship/ship-diffusemap.jpg",
"image|/res/fairy/ship/ship-normalmap.jpg",
],
"world": config_view_skins_world,
"camera": config_view_skins_camera
},
config_view_skins_9
],
"animateSelfMoves": false,
"switchable": true,
"sounds": config_view_sounds,
"js": config_view_js_lcb,
"useAutoComplete": true
}
},
"viewScripts": config_view_js_lcb
}

View File

@ -0,0 +1,13 @@
<h1>Credits</h1>
<pre>
LeyChessBeta is based on Terachess.
The view.js is taked from Terachess.
Inventor: tilera
Developer: tilera
Inventor of Terachess: Jean-Louis Cazaux
Developer of Terachess: jcfrog
Developer of Jocly: Michel Gutierrez
Piece Graphic Designer:
Michel Gutierrez
jcfrog
</pre>

View File

@ -0,0 +1 @@
<p>LeyChessBeta is a 16*16 Chess Variant with Fairy Pieces based on Terachess</p>

View File

@ -0,0 +1,591 @@
/*
* Copyright(c) 2013-2014 - jocly.com
*
* You are allowed to use and modify this source code as long as it is exclusively for use in the Jocly API.
*
* Original authors: Jocly team
*
*/
(function() {
var firstRow=0;
var lastRow=15;
var firstCol=0;
var lastCol=15;
var geometry = Model.Game.cbBoardGeometryGrid(16,16);
// graphs
Model.Game.cbCorporalGraph = function(geometry,side,confine) {
var $this=this;
var graph={};
for(var pos=0;pos<geometry.boardSize;pos++) {
if(confine && !(pos in confine)){
graph[pos]=[];
continue;
}
var directions=[];
var pos1=geometry.Graph(pos,[0,side]);
if(pos1!=null && (!confine || (pos1 in confine))) {
var direction=[pos1 | $this.cbConstants.FLAG_MOVE];
var pos2=geometry.Graph(pos1,[0,side]);
if(pos2!=null && (!confine || (pos2 in confine)))
direction.push(pos2 | $this.cbConstants.FLAG_MOVE);
directions.push($this.cbTypedArray(direction));
}
[-1,1].forEach(function(dc) {
var pos2=geometry.Graph(pos,[dc,side]);
if(pos2!=null && (!confine || (pos2 in confine)))
directions.push($this.cbTypedArray([pos2 | $this.cbConstants.FLAG_MOVE | $this.cbConstants.FLAG_CAPTURE]));
});
graph[pos]=directions;
}
return graph;
}
Model.Game.cbPrinceGraph = function(geometry,side,confine) {
var $this=this;
var graph={};
for(var pos=0;pos<geometry.boardSize;pos++) {
if(confine && !(pos in confine)){
graph[pos]=[];
continue;
}
graph[pos]=[];
var forward=[]; // hold the pos line in front of the piece
var pos1=geometry.Graph(pos,[0,side]);
if(pos1!=null && (!confine || (pos1 in confine))) {
forward.push(pos1 | $this.cbConstants.FLAG_MOVE | $this.cbConstants.FLAG_CAPTURE); // capture and move allowed at first forward position
pos1=geometry.Graph(pos1,[0,side]);
if(pos1!=null && (!confine || (pos1 in confine)))
forward.push(pos1 | $this.cbConstants.FLAG_MOVE); // move to second forward only, no capture
graph[pos].push($this.cbTypedArray(forward));
}
}
return $this.cbMergeGraphs(geometry,
$this.cbShortRangeGraph(geometry,[[-1,-1],[-1,1],[-1,0],[1,0],[1,-1],[1,1],[0,-side]]), // direction other than forward
graph // forward direction
);
}
Model.Game.cbEagleGraph = function(geometry){
var $this=this;
var flags = $this.cbConstants.FLAG_MOVE | $this.cbConstants.FLAG_CAPTURE;
var graph={};
for(var pos=0;pos<geometry.boardSize;pos++) {
graph[pos]=[];
[[-1,-1],[-1,1],[1,-1],[1,1]].forEach(function(delta) { // loop on all 4 diagonals
var pos1=geometry.Graph(pos,delta);
if(pos1!=null) {
for(var dir=0;dir<2;dir++) { // dir=0 for row, dir=1 for column
var nbMax = (dir==0) ? lastRow : lastCol;
var away=[] // hold the sliding line
for(var n=1;n<nbMax;n++) {
var delta2=[];
delta2[dir]=delta[dir]*n;
delta2[1-dir]=0; // delta2 is now only about moving orthogonally, away from the piece
var pos2=geometry.Graph(pos1,delta2);
if(pos2!=null) {
if(n==1) // possible to slide at least 1 cell, make sure the diagonal cell is not occupied, but cannot move to this cell
away.push(pos1 | $this.cbConstants.FLAG_STOP);
away.push(pos2 | flags);
}
}
if(away.length>0)
graph[pos].push($this.cbTypedArray(away));
}
}
});
}
return $this.cbMergeGraphs(geometry,
$this.cbShortRangeGraph(geometry,[[-1,-1],[-1,1],[1,-1],[1,1]]),
graph
);
}
Model.Game.cbShipGraph = function(geometry){
var $this=this;
var flags = $this.cbConstants.FLAG_MOVE | $this.cbConstants.FLAG_CAPTURE;
var graph={};
for(var pos=0;pos<geometry.boardSize;pos++) {
graph[pos]=[];
[[-1,-1],[-1,1],[1,-1],[1,1]].forEach(function(delta) { // loop on all 4 diagonals
var pos1=geometry.Graph(pos,delta);
if(pos1!=null) {
for(var dir=1;dir<2;dir++) { // dir=0 for row, dir=1 for column
var nbMax = (dir==0) ? lastRow : lastCol;
var away=[] // hold the sliding line
for(var n=1;n<nbMax;n++) {
var delta2=[];
delta2[dir]=delta[dir]*n;
delta2[1-dir]=0; // delta2 is now only about moving orthogonally, away from the piece
var pos2=geometry.Graph(pos1,delta2);
if(pos2!=null) {
if(n==1) // possible to slide at least 1 cell, make sure the diagonal cell is not occupied, but cannot move to this cell
away.push(pos1 | $this.cbConstants.FLAG_STOP);
away.push(pos2 | flags);
}
}
if(away.length>0)
graph[pos].push($this.cbTypedArray(away));
}
}
});
}
return $this.cbMergeGraphs(geometry,
$this.cbShortRangeGraph(geometry,[[-1,-1],[-1,1],[1,-1],[1,1]]),
graph
);
}
Model.Game.cbRhinoGraph = function(geometry,confine){
var $this=this;
var flags = $this.cbConstants.FLAG_MOVE | $this.cbConstants.FLAG_CAPTURE;
var graph={};
for(var pos=0;pos<geometry.boardSize;pos++) {
if(confine && !(pos in confine)){
graph[pos]=[];
continue;
}
var directions=[];
[[1,2],[2,1],[1,-2],[2,-1],[-1,2],[-2,1],[-1,-2],[-2,-1]].forEach(function(delta) { // loop on all 8 diagonals
var movedir = [Math.sign(delta[0]),Math.sign(delta[1])];
var pos1=geometry.Graph(pos,delta);
if(pos1!=null && (!confine || (pos1 in confine))) {
var direction=[pos1 | $this.cbConstants.FLAG_MOVE | $this.cbConstants.FLAG_CAPTURE | $this.cbConstants.FLAG_STOP];
//directions.push($this.cbTypedArray(direction));
var nbMax = Math.max(lastRow , lastCol) - 1;
var away=[] // hold the sliding line
for(var n=1;n<nbMax;n++) {
var delta2=[movedir[0]*n,movedir[1]*n];
var pos2=geometry.Graph(pos1,delta2);
if(pos2!=null && (!confine || (pos2 in confine))) {
if(n==1) // possible to slide at least 1 cell, make sure the diagonal cell is not occupied, but cannot move to this cell
away.push(pos1 | $this.cbConstants.FLAG_STOP);
away.push(pos2 | flags | $this.cbConstants.FLAG_STOP);
}
}
if(away.length>0)
directions.push($this.cbTypedArray(away));
}
});
graph[pos]=directions;
}
return $this.cbMergeGraphs(geometry,
$this.cbShortRangeGraph(geometry,[[1,2],[2,1],[1,-2],[2,-1],[-1,2],[-2,1],[-1,-2],[-2,-1]]),
graph
);
}
var confine = {};
for(var pos=0;pos<geometry.boardSize;pos++) {
confine[pos]=1;
}
Model.Game.cbDefine = function() {
return {
geometry: geometry,
pieceTypes: {
0: {
name : 'ipawnw',
abbrev : '',
fenAbbrev: 'P',
aspect : 'fr-pawn',
graph : this.cbInitialPawnGraph(geometry,1,confine),
value : 0.5,
initial: [{s:1,p:48},{s:1,p:49},{s:1,p:50},{s:1,p:51},{s:1,p:52},{s:1,p:53},{s:1,p:54},{s:1,p:55},{s:1,p:56},{s:1,p:57},{s:1,p:58},{s:1,p:59},{s:1,p:60},{s:1,p:61},{s:1,p:62},{s:1,p:63}],
epCatch : false,
epTarget : false,
},
1: {
name : 'ipawnb',
abbrev : '',
fenAbbrev: 'P',
aspect : 'fr-pawn',
graph : this.cbInitialPawnGraph(geometry,-1,confine),
value : 0.5,
initial: [{s:-1,p:192},{s:-1,p:193},{s:-1,p:194},{s:-1,p:195},{s:-1,p:196},{s:-1,p:197},{s:-1,p:198},{s:-1,p:199},{s:-1,p:200},{s:-1,p:201},{s:-1,p:202},{s:-1,p:203},{s:-1,p:204},{s:-1,p:205},{s:-1,p:206},{s:-1,p:207}],
epCatch : false,
epTarget : false,
},
2: {
name : 'corporalw',
abbrev : 'O',
aspect : 'fr-corporal',
graph : this.cbCorporalGraph(geometry,1,confine),
value : 0.8,
initial: [{s:1,p:16},{s:1,p:17},{s:1,p:18},{s:1,p:19},{s:1,p:20},{s:1,p:27},{s:1,p:28},{s:1,p:29},{s:1,p:30},{s:1,p:31}],
epCatch : false,
epTarget : false,
},
3: {
name : 'corporalb',
abbrev : 'O',
aspect : 'fr-corporal',
graph : this.cbCorporalGraph(geometry,-1,confine),
value : 0.8,
initial: [{s:-1,p:224},{s:-1,p:225},{s:-1,p:226},{s:-1,p:227},{s:-1,p:228},{s:-1,p:235},{s:-1,p:236},{s:-1,p:237},{s:-1,p:238},{s:-1,p:239}],
epCatch : false,
epTarget : false,
},
4: {
name : 'princew',
abbrev : 'I',
aspect : 'fr-admiral',
graph : this.cbPrinceGraph(geometry,1,confine),
value : 2.2,
initial: [{s:1,p:38},{s:1,p:41}],
epTarget : false,
},
5: {
name : 'princeb',
abbrev : 'I',
aspect : 'fr-admiral',
graph : this.cbPrinceGraph(geometry,-1,confine),
value : 2.2,
initial: [{s:-1,p:214},{s:-1,p:217}],
epTarget : false,
},
6: {
name : 'rook',
abbrev : 'R',
aspect : 'fr-rook',
graph : this.cbRookGraph(geometry,confine),
value : 5,
initial: [{s:1,p:34},{s:1,p:45},{s:-1,p:210},{s:-1,p:221}],
},
7: {
name : 'bishop',
abbrev : 'B',
aspect : 'fr-bishop',
graph : this.cbBishopGraph(geometry,confine),
value : 3.4,
initial: [{s:1,p:36},{s:1,p:43},{s:-1,p:212},{s:-1,p:219}],
},
8: {
name : 'knight',
abbrev : 'N',
aspect : 'fr-knight',
graph : this.cbKnightGraph(geometry,confine),
value : 2,
initial: [{s:1,p:35},{s:1,p:44},{s:-1,p:211},{s:-1,p:220}],
},
9: {
name : 'queen',
abbrev : 'Q',
aspect : 'fr-queen',
graph : this.cbQueenGraph(geometry,confine),
value : 8.3,
initial: [{s:1,p:39},{s:-1,p:215}],
},
10: {
name : 'king',
abbrev : 'K',
aspect : 'fr-king',
graph : this.cbKingGraph(geometry,confine),
isKing : true,
initial: [{s:1,p:40},{s:-1,p:216}],
},
11: {
name : 'star',
abbrev : 'S',
aspect : 'fr-star',
graph : this.cbLongRangeGraph(geometry,[[0,-1],[0,1],[-1,0],[1,0],[1,1],[1,-1],[-1,-1],[-1,1]],null,this.cbConstants.FLAG_MOVE | this.cbConstants.FLAG_SCREEN_CAPTURE),
value : 8.2,
initial: [{s:1,p:7},{s:-1,p:247}],
},
12: {
name : 'bow',
abbrev : 'W',
aspect : 'fr-bow',
graph : this.cbLongRangeGraph(geometry,[[-1,-1],[1,1],[-1,1],[1,-1]],null,this.cbConstants.FLAG_MOVE | this.cbConstants.FLAG_SCREEN_CAPTURE),
value : 3.3,
initial: [{s:1,p:2},{s:1,p:13},{s:-1,p:242},{s:-1,p:253}],
},
13: {
name : 'rhino',
abbrev : 'U',
aspect : 'fr-rhino',
graph : this.cbRhinoGraph(geometry,confine),
value : 6.1,
initial: [{s:1,p:6},{s:-1,p:246}],
},
14: {
name : 'bull',
abbrev : 'T',
aspect : 'fr-bull',
graph : this.cbShortRangeGraph(geometry,[
[2,3],[3,2],[2,-3],[3,-2],[-2,3],[-3,2],[-2,-3],[-3,-2]
],confine),
value : 1.7,
initial: [{s:1,p:3},{s:1,p:12},{s:-1,p:243},{s:-1,p:252}],
},
15: {
name : 'antelope',
abbrev : 'G',
aspect : 'fr-antelope',
graph : this.cbShortRangeGraph(geometry,[
[2,2],[3,3],[2,-2],[3,-3],[-2,2],[-3,3],[-2,-2],[-3,-3],
[2,0],[3,0],[-2,0],[-3,0],[0,2],[0,3],[0,-2],[0,-3]
],
confine),
value : 3.7,
initial: [{s:1,p:0},{s:1,p:15},{s:-1,p:240},{s:-1,p:255}],
},
16: {
name : 'lion',
abbrev : 'L',
aspect : 'fr-lion',
graph : this.cbShortRangeGraph(geometry,[
[-1,-1],[-1,1],[1,-1],[1,1],[1,0],[0,1],[-1,0],[0,-1],
[-2,0],[-2,-1],[-2,-2],[-1,-2],[0,-2],
[1,-2],[2,-2],[2,-1],[2,0],[2,1],
[2,2],[1,2],[0,2],[-1,2],[-2,2],[-2,1]
], confine),
value : 6,
initial: [{s:1,p:23},{s:-1,p:231}],
},
17: {
name : 'elephant',
abbrev : 'E',
aspect : 'fr-elephant',
graph : this.cbShortRangeGraph(geometry,[[-1,-1],[-1,1],[1,-1],[1,1],[-2,-2],[-2,2],[2,-2],[2,2]],confine),
value : 2,
initial: [{s:1,p:32},{s:1,p:47},{s:-1,p:208},{s:-1,p:223}],
},
18: {
name : 'cannon',
abbrev : 'Z',
aspect : 'fr-cannon2',
graph : this.cbXQCannonGraph(geometry),
value : 5,
initial: [{s:1,p:4},{s:1,p:11},{s:-1,p:244},{s:-1,p:251}],
},
19: {
name : 'machine',
abbrev : 'D',
aspect : 'fr-machine',
graph : this.cbShortRangeGraph(geometry,[[-1,0],[-2,0],[1,0],[2,0],[0,1],[0,2],[0,-1],[0,-2]],confine),
value : 2.2,
initial: [{s:1,p:33},{s:1,p:46},{s:-1,p:209},{s:-1,p:222}],
},
20: {
name : 'buffalo',
abbrev : 'F',
aspect : 'fr-buffalo',
graph : this.cbShortRangeGraph(geometry,[
[1,2],[1,3],[2,1],[2,3],[3,1],[3,2],
[1,-2],[1,-3],[2,-1],[2,-3],[3,-1],[3,-2],
[-1,-2],[-1,-3],[-2,-1],[-2,-3],[-3,-1],[-3,-2],
[-1,2],[-1,3],[-2,1],[-2,3],[-3,1],[-3,2]
],confine),
value : 5.4,
initial: [{s:1,p:5},{s:-1,p:245}],
},
21: {
name : 'ship',
abbrev : 'X',
aspect : 'fr-ship',
graph : this.cbShipGraph(geometry),
value : 4.4,
initial: [{s:1,p:37},{s:1,p:42},{s:-1,p:213},{s:-1,p:218}],
},
22: {
name : 'eagle',
abbrev : 'H',
aspect : 'fr-eagle',
graph : this.cbEagleGraph(geometry),
value : 8.4,
initial: [{s:1,p:24},{s:-1,p:232}],
},
23: {
name : 'camel',
abbrev : 'J',
aspect : 'fr-camel',
graph : this.cbShortRangeGraph(geometry,[[-3,-1],[-3,1],[3,-1],[3,1],[1,3],[1,-3],[-1,3],[-1,-3]]),
value : 2,
initial: [{s:1,p:1},{s:1,p:14},{s:-1,p:241},{s:-1,p:254}],
},
24: {
name : 'amazon',
abbrev : 'A',
aspect : 'fr-amazon',
graph : this.cbMergeGraphs(geometry,
this.cbKnightGraph(geometry,confine),
this.cbQueenGraph(geometry,confine)),
value : 10.2,
initial: [{s:1,p:8},{s:-1,p:248}],
},
25: {
name : 'marshall',
abbrev : 'M',
aspect : 'fr-marshall',
graph : this.cbMergeGraphs(geometry,
this.cbKnightGraph(geometry,confine),
this.cbRookGraph(geometry,confine)),
value : 6.9,
initial: [{s:1,p:9},{s:-1,p:249}],
},
26: {
name : 'cardinal',
abbrev : 'C',
aspect : 'fr-cardinal',
graph : this.cbMergeGraphs(geometry,
this.cbKnightGraph(geometry,confine),
this.cbBishopGraph(geometry,confine)),
value : 5.3,
initial: [{s:1,p:10},{s:-1,p:250}],
},
27: {
name: 'unicorn',
aspect: 'fr-unicorn',
graph: this.cbMergeGraphs(geometry,
this.cbShortRangeGraph(geometry,[
[-2,-2],[-2,0],[-2,2],[0,2],[2,2],[2,0],[2,-2],[0,-2],
[-3,-3],[-3,0],[-3,3],[0,3],[3,3],[3,0],[3,-3],[0,-3]]),
this.cbKingGraph(geometry),
this.cbKnightGraph(geometry),
this.cbLongRangeGraph(geometry,[[2,-1],[2,1],[-2,-1],[-2,1],[-1,2],[-1,-2],[1,2],[1,-2]]),
this.cbShortRangeGraph(geometry,[[-3,-1],[-3,1],[3,-1],[3,1],[1,3],[1,-3],[-1,3],[-1,-3]])
),
value: 13,
abbrev: 'Pa',
initial: [{s:1,p:26},{s:-1,p:234}],
},
28: {
name: 'dragon',
aspect: 'fr-dragon',
graph: this.cbMergeGraphs(geometry,
this.cbQueenGraph(geometry),
this.cbEagleGraph(geometry)),
value: 14,
abbrev: 'Dr',
initial: [{s:1,p:25},{s:-1,p:233}],
},
29: {
name: 'lighthouse',
aspect: 'fr-lighthouse',
graph: this.cbMergeGraphs(geometry,
this.cbQueenGraph(geometry),
this.cbXQCannonGraph(geometry),
this.cbLongRangeGraph(geometry,[[1,-1],[-1,-1],[-1,1],[1,1]],null,this.cbConstants.FLAG_MOVE | this.cbConstants.FLAG_SCREEN_CAPTURE)),
value: 12,
abbrev: 'LH',
initial: [{s:1,p:21},{s:-1,p:229}],
},
30: {
name: 'emperor',
aspect: 'fr-crowned-rook',
graph: this.cbMergeGraphs(geometry,
this.cbQueenGraph(geometry),
this.cbXQCannonGraph(geometry),
this.cbLongRangeGraph(geometry,[[1,-1],[-1,-1],[-1,1],[1,1]],null,this.cbConstants.FLAG_MOVE | this.cbConstants.FLAG_SCREEN_CAPTURE),
this.cbEagleGraph(geometry),
this.cbShortRangeGraph(geometry,[
[-2,-2],[-2,0],[-2,2],[0,2],[2,2],[2,0],[2,-2],[0,-2],
[-3,-3],[-3,0],[-3,3],[0,3],[3,3],[3,0],[3,-3],[0,-3]]),
this.cbKnightGraph(geometry),
this.cbLongRangeGraph(geometry,[[2,-1],[2,1],[-2,-1],[-2,1],[-1,2],[-1,-2],[1,2],[1,-2]]),
this.cbShortRangeGraph(geometry,[[-3,-1],[-3,1],[3,-1],[3,1],[1,3],[1,-3],[-1,3],[-1,-3]]),
this.cbRhinoGraph(geometry,confine),
this.cbShortRangeGraph(geometry,[
[1,2],[1,3],[2,1],[2,3],[3,1],[3,2],
[1,-2],[1,-3],[2,-1],[2,-3],[3,-1],[3,-2],
[-1,-2],[-1,-3],[-2,-1],[-2,-3],[-3,-1],[-3,-2],
[-1,2],[-1,3],[-2,1],[-2,3],[-3,1],[-3,2]
],confine),
this.cbLongRangeGraph(geometry,
[
[-2,-2],[2,2],[-2,2],[2,-2],
[-2,0],[2,0],[0,2],[0,-2]
],
confine)),
value: 20,
abbrev: 'EM',
},
31: {
name : 'buffaloriderqueen',
abbrev : 'Brq',
aspect : 'fr-prince',
graph : this.cbMergeGraphs(geometry,
this.cbQueenGraph(geometry,confine),
this.cbShortRangeGraph(geometry,[
[1,2],[1,3],[2,1],[2,3],[3,1],[3,2],
[1,-2],[1,-3],[2,-1],[2,-3],[3,-1],[3,-2],
[-1,-2],[-1,-3],[-2,-1],[-2,-3],[-3,-1],[-3,-2],
[-1,2],[-1,3],[-2,1],[-2,3],[-3,1],[-3,2]
],confine)),
value : 14,
initial: [{s:1,p:22},{s:-1,p:230}],
},
},
promote: function(aGame,piece,move) {
if(piece.t==0 && geometry.R(move.t)==15)
return [24,22,20,16,15,13,11];
else if(piece.t==1 && geometry.R(move.t)==0)
return [24,22,20,16,15,13,11];
else if(piece.t==4 && geometry.R(move.t)==15)
return [30];
else if(piece.t==5 && geometry.R(move.t)==0)
return [30];
else if(piece.t==2 && geometry.R(move.t)==15)
return [27,28,29,31];
else if(piece.t==3 && geometry.R(move.t)==0)
return [27,28,29,31];
return [];
},
};
}
var SuperModelBoardGenerateMoves=Model.Board.GenerateMoves;
Model.Board.GenerateMoves = function(aGame) {
var $this = this;
SuperModelBoardGenerateMoves.apply(this,arguments); // call regular GenerateMoves method
}
var SuperModelBoardApplyMove=Model.Board.ApplyMove;
Model.Board.ApplyMove = function(aGame,move) {
// console.log("ApplyMove entrance",aGame,move);
var $this = this;
SuperModelBoardApplyMove.apply(this,arguments); // call regular GenerateMoves method
}
})();

View File

@ -0,0 +1,269 @@
<h1 style="font-size:300%;">LeyChessBeta Rules</h1>
<h1>Setup</h1>
<img src="res/rules/leychessbeta/leychessbeta-600x600-2d.jpg" alt="Your Browser suck:(" style="width:320px;height:320px;">
<h1>Pieces</h1>
<h2>King</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-king.png'>
</p>
<p class='piece-details'>Exactly as in usual Chess.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/king.png'>
</p>
<h2>Queen</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-queen.png'>
</p>
<p class='piece-details'>Exactly as in usual Chess.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/queen.png'>
</p>
<h2>Bishop</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-bishop.png'>
</p>
<p class='piece-details'>Exactly as in usual Chess.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/bishop.png'>
</p>
<h2>Knight</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-knight.png'>
</p>
<p class='piece-details'>Moves as in usual Chess.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/knight.png'>
</p>
<h2>Rook</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-rook.png'>
</p>
<p class='piece-details'>Exactly as in usual Chess.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/rook.png'>
</p>
<h2>Pawn</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-pawn.png'>
</p>
<p class='piece-details'>The Pawn is almost similar to usual Chess. There is a difference: it can advance one or two square from ANY position on the board. However, its capturing move is unchanged: one square diagonally forward. As a consequence, the en-passant capture is possible every time the opposite Pawn or Corporal or Prince has advanced two squares.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/pawn.png'>
</p>
<h2>Corporal</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-corporal.png'>
</p>
<p class='piece-details'>An extended Pawn. He can advance one or two square from any position on the board and its capturing move is one square diagonally forward. The improvement is that the Corporal can also advance 1 step diagonally forward. (So, with or without capturing). The Corporal can take en-passant every time an opposite Pawn or Corporal or Prince has advanced two squares.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/corporal.png'>
</p>
<h2>Prince</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-admiral.png'>
</p>
<p class='piece-details'>This piece is simply a non-royal King combined with a Pawn. It can be found in Metamachy and has been inspired by medieval games like the Courier chess , an old chess variant, played in Germany, where it is called "Man". It moves one square in an arbitrary direction, like the King, but without being hindered by check. Here, like the Pawn, he can move without capturing to the second square straight ahead. When the Prince reaches the last row it promotes to an Emperor.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/leychess/lcb/prince.png' style="width:50%;height:50%;">
</p>
<h2>Elephant</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-elephant.png'>
</p>
<p class='piece-details'>As in Shako.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/elephant.png'>
</p>
<h2>Machine</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-machine.png'>
</p>
<p class='piece-details'>It is an orthogonal counterpart of the Elephant as it moves 1 or 2 cases orthogonally, jumping over the first case if it is occupied. Then, it combines the moves of old Dabbaba and Wazir found in ancient Muslim Chess variants.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/machine.png'>
</p>
<h2>Lion</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-lion.png'>
</p>
<p class='piece-details'>As in Metamachy, inspired (although with some simplification) by Chu Shogi, the most popular variant of the Japanese Chess. Here the Lion may move as a King (a single step move in any direction), or it may jump to a position two squares away, jumping in any orthogonal or diagonal direction, or alternatively jumping as a Knight in usual Chess. (Then this Lion has the same range but is more restricted than the Lion in Chu Shogi which can move two times in a turn). </p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/lion.png'>
</p>
<h2>Eagle</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-eagle.png'>
</p>
<p class='piece-details'>As in Metamachy, moves one square diagonally and then, goes away of an indefinite number of cases vertically or horizontally. It is authorized to go only one square diagonal. It can not jump and the unobstructed path must start with the diagonal movement. This piece is almost as powerful as the Queen and is inspired by the Giraffe from Tamerlane's Chess and the Aanca from Alfonso X's Grande Acedrex.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/eagle.png'>
</p>
<h2>Ship</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-ship.png'>
</p>
<p class='piece-details'>Originally invented for Tamerlane 2000, it moves one square diagonally and then, goes away of an indefinite number of cases vertically, never horizontally. It can move one square diagonally only. It can not jump and must begin its move with the diagonal step. The Ship is more limited than the Eagle (which can move horizontally). Nevertheless its move power is comparable to the Rook and the Bishop.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/ship.png'>
</p>
<h2>Camel</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-camel.png'>
</p>
<p class='piece-details'>As in Metamachy, a well known piece from medieval Muslim great Chess like Tamerlane's Chess. It jumps to the opposite case of a 2x4 rectangle, like an extended Knight. No matter what intermediate cases contain. Note that it always stays on the same color of square.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/camel.png'>
</p>
<h2>Cannon</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-cannon.png'>
</p>
<p class='piece-details'>As in Xiangqi, in Shako and in Metamachy. (Also known as Pao by problemists).</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/cannon.png'>
</p>
<h2>Bow</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-bow.png'>
</p>
<p class='piece-details'>It is the diagonal counterpart of the Chinese Cannon. It moves like a Bishop and needs an intermediate piece between itself and its victim to capture it. The Bow jumps the intermediate and takes the victim on its square. The intermediate is left unaffected. (Also known as Vao by problemists).</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/bow.png'>
</p>
<h2>Buffalo</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-buffalo.png'>
</p>
<p class='piece-details'>Combines the leaps of the Knight (3x2), the Camel (4x2) and the Bull (see Terachess) (4x3).</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/buffalo.png'>
</p>
<h2>Chancellor</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-marshall.png'>
</p>
<p class='piece-details'>It combines the move of Rook and Knight. It can be found in many, many chess variants since Carrera, Bird, Capablanca and many others like Grand Chess or Gothic Chess. (under many other names: Champion, Guard, Empress, Concubine, Chancellor, etc. The later is sometimes preferred, however it is confusing since Capablanca used it once for R+N and once for B+N. It is an Elephant in Seirawan Chess).</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/marshall.png'>
</p>
<h2>Cardinal</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-cardinal.png'>
</p>
<p class='piece-details'>It combines the move of Bishop and Knight. It can be found in many, many chess variants since Carrera, Bird, Capablanca, Modern and many others like Grand Chess or Gothic Chess. (under many other names: Centaur, Minister, Equerry, Janus, Archbishop, Princess, Chancellor, etc. It is a Hawk in Seirawan Chess). </p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/cardinal.png'>
</p>
<h2>Commander</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-amazon.png'>
</p>
<p class='piece-details'>It combines the move of Queen and Knight. It was used in the Turkish-Indian Grand Chess (as a Giraffe). </p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/amazon.png'>
</p>
<h2>Bull</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-bull.png'>
</p>
<p class='piece-details'>Jumps to the opposite case of a 3x4 rectangle, like an extended Knight. No matter what intermediate cases contain. Note that it always changes the same color of its square. The same move is found in Janggi, Korean Chess, for the Elephant. Under the name of Zebra, it is also a fairy piece used by problemists for compositions.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/bull.png'>
</p>
<h2>Antelope</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-antelope.png'>
</p>
<p class='piece-details'>Jumps 2 or 3 step orthogonally or diagonally. No matter what intermediate squares contain. This is an original piece, exclusive to this game.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/antelope.png'>
</p>
<h2>Rhinoceros</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-rhino.png'>
</p>
<p class='piece-details'>Jumps as a Knight then slides diagonally away. This piece is inspired by the Unicorn of mediaeval Grande Acedrex. </p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/rhino.png'>
</p>
<h2>Star</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-star.png'>
</p>
<p class='piece-details'>It moves like a Queen and needs an intermediate piece between itself and its victim to capture it. The Star jumps the intermediate and takes the victim on its square. The intermediate is left unaffected. Like the Queen is Bishop + Rook, the Star is Cannon + Bow.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/star.png'>
</p>
<h2>Lighthouse</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-lighthouse.png'>
</p>
<p class='piece-details'>It combines the Star and the Queen.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/leychess/lcb/lighthouse.png' style="width:25%;height:25%;">
</p>
<h2>Unicorn</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-unicorn.png'>
</p>
<p class='piece-details'>The Unicorn combines the Camel, Lion and Antelope and additionaly it can jump infinite times like a Knight in the same direction(like the Knightrider).</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/leychess/lcb/unicorn.png' style="width:25%;height:25%;">
</p>
<h2>Buffaloriderqueen</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-prince.png'>
</p>
<p class='piece-details'>The Buffaloriderqueen combines the Queen, Knightrider move(Infinite times like a Knight in the same direction) and the Buffalo.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/leychess/lcb/brq.png' style="width:25%;height:25%;">
</p>
<h2>Dragon</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-dragon.png'>
</p>
<p class='piece-details'>The Dragon combines the Queen and the Eagle.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/leychess/lcb/dragon.png' style="width:25%;height:25%;">
</p>
<h2>Emperor</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-emperor.png'>
</p>
<p class='piece-details'>The Emperor combines the Dragon, Buffaloriderqueen, Unicorn, Rhinoceros and Lighthouse. That means, that every Piece is included in the Emperor. You can only get the Emperor, when you promote a Prince.</p>
<div style='clear:both'></div>
<h1>Promotion</h1>
<h2>Pawn</h2>
<img alt='Restart your Browser' src='res/rules/graphs/leychess/lcb/pawnpromo.png'>
<h2>Corporal</h2>
<img alt='Restart your Browser' src='res/rules/graphs/leychess/lcb/corpopromo.png'>
<h2>Prince</h2>
<img alt='Restart your Browser' src='res/rules/graphs/leychess/lcb/princepromo.png'>

View File

@ -0,0 +1,258 @@
/*
*
*
*
* authors: jerome choain
*
*/
(function() {
function createTexturedPatternCanvas(W,H,texture,clipW,clipH,mask,borderFact){
// borderFact is the percentage (/100) of the mask transition overlay border : ex 30% => .3
var cv = document.createElement('canvas');
cv.width=W;
cv.height=H;
var ctx=cv.getContext('2d');
var maskW=mask.width;
var maskH=mask.height;
var textW=texture.width;
var textH=texture.height;
var tmp = document.createElement('canvas');
ctx.globalCompositeOperation='or';
var y=0;
for (var i=0; y<=(H+clipH/2);i++){
var x=0;
for (var j=0; x<=(W+clipW/2);j++){
tmp.width=clipW; tmp.height=clipH;
ctxTmp=tmp.getContext('2d');
ctxTmp.globalCompositeOperation='xor';
ctxTmp.drawImage(texture, Math.random()*(textW-clipW),Math.random()*(textH-clipH),clipW,clipH,0,0,clipW,clipH);
ctxTmp.drawImage(mask,0,0,clipW,clipH);
ctx.drawImage(tmp,x-clipW/2,y-clipH/2,clipW,clipH);
x+=clipW-borderFact*clipW;
}
y+=clipH-borderFact*clipH;
}
return cv;
}
// Reducing the promo frame which was overflowing the board screen
View.Game.cbPromoSize = 1100;
// extending fairy pieces with some musketeer new pieces
View.Game.cbFairyTerachessPieceStyle3D = $.extend(true,{},View.Game.cbFairyPieceStyle3D,{
});
View.Game.cbDefineView = function() {
var terachessBoardDelta = {
notationMode: "out",
//notationDebug: true,
}
terachessBoardDelta3d = $.extend(true,{},terachessBoardDelta,
{
/*'colorFill' : {
".": "#575b36", // "rgba(180,213,80,.3)",
"#": "#474b36", // "black" cells
" ": "rgba(0,0,0,0)",
},*/
'colorFill' : {
"#": "rgba(204,40,0,1)",
".": "rgba(180,180,0,1)",
},
'texturesImg' : {
'crackles': '/res/images/crackles.jpg',
'tiler': '/res/images/tileralpha.png',
},
'3D':true,
'margins' : {x:.47,y:.47},
'extraChannels':[
'bump'
],
paintCell: function(spec,ctx,images,channel,cellType,xCenter,yCenter,cx,cy) {
var tW=images['crackles'].width;
var tH=images['crackles'].height;
var tClipCx=200;
var tClipCy=200;
ctx.fillStyle="#000000";
ctx.fillRect(xCenter-cx/2,yCenter-cy/2,cx,cy);
if(channel=="bump"){
return;
}
cx=.98*cx;
cy=.98*cy;
ctx.save();
ctx.strokeStyle = "rgba(0,0,0,1)";
ctx.lineWidth = 50;
if (channel=='diffuse')
ctx.fillStyle=spec.colorFill[cellType];
else
ctx.fillStyle=0xffffff;
ctx.fillRect(xCenter-cx/2,yCenter-cy/2,cx,cy);
ctx.globalCompositeOperation = 'multiply';
ctx.drawImage(images['crackles'],
Math.random()*(tW-tClipCx),Math.random()*(tH-tClipCy),tClipCx,tClipCy,
xCenter-cx/2,yCenter-cy/2,cx,cy);
ctx.restore();
},
paintBackground: function(spec,ctx,images,channel,bWidth,bHeight) {
ctx.save();
ctx.fillStyle="#ffffff";
if (channel=='diffuse')
ctx.fillStyle="#BA784A";
//ctx.fillStyle="#cc6600";
var cSize = this.cbCSize(spec);
ctx.fillRect(-bWidth/2,-bHeight/2,bWidth,bHeight);
var textureCanvas=createTexturedPatternCanvas(1200,800,images['crackles'],200,200,images['tiler'],.3);
ctx.globalCompositeOperation='multiply';
ctx.drawImage(textureCanvas,-bWidth/2,-bHeight/2,bWidth,bHeight);
ctx.restore();
},
}
);
terachessBoardDelta2d = $.extend(true,{},terachessBoardDelta,
{
'colorFill' : {
".": "#ffffc0", // "white" cells
"#": "#8F976D", // "black" cells
" ": "rgba(0,0,0,0)",
},
'texturesImg' : {}, // to avoid default wood texture
'margins' : {x:.47,y:.47},
/*'colorFill' : {
".": "rgba(224,50,0,1)",
"#": "rgba(220,220,0,1)",
},*/
}
);
var terachessBoard3d = $.extend(true,{},this.cbGridBoardClassic3DMargin,terachessBoardDelta3d);
var terachessBoard2d = $.extend(true,{},this.cbGridBoardClassic2DMargin,terachessBoardDelta2d);
return {
coords: {
"2d": this.cbGridBoard.coordsFn.call(this,terachessBoard2d),
"3d": this.cbGridBoard.coordsFn.call(this,terachessBoard3d),
},
boardLayout: [
".#.#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.#.",
],
board: {
"2d": {
draw: this.cbDrawBoardFn(terachessBoard2d),
},
"3d": {
display: this.cbDisplayBoardFn(terachessBoard3d),
},
},
clicker: {
"2d": {
width: 700,
height: 700,
},
"3d": {
scale: [0.45,0.45,0.45],
},
},
pieces: this.cbFairyPieceStyle({
"default": {
"2d": {
width: 650,
height: 650,
},
"3d": {
scale: [0.3,0.3,0.3],
display: this.cbDisplayPieceFn(this.cbFairyTerachessPieceStyle3D)
},
},
"fr-amazon" :{
"3d": {
scale: [0.36,0.36,0.36],
}
},
"fr-star" :{
"3d":{scale:[0.36,0.36,0.36]},
},
"fr-rhino" :{
"3d":{scale:[0.24,0.24,0.24]},
},
"fr-bull" :{
"3d":{scale:[0.21,0.21,0.21]},
},
"fr-antelope" :{
"3d":{scale:[0.24,0.24,0.24]},
},
}),
};
}
/* Make the jumps */
View.Board.cbMoveMidZ = function(aGame,aMove,zFrom,zTo) {
var geo=aGame.cbVar.geometry;
var dx=Math.abs(geo.C(aMove.t)-geo.C(aMove.f));
var dy=Math.abs(geo.R(aMove.t)-geo.R(aMove.f));
if(("_N_E_D_L_J_T_F_G_S_".indexOf("_"+aMove.a+"_")>=0) && (aGame.g.distGraph[aMove.f][aMove.t]>1))
return Math.max(zFrom,zTo)+2000;
else if(("_A_C_M_".indexOf("_"+aMove.a+"_")>=0) && dx!=dy && dx!=0 && dy!=0)
return Math.max(zFrom,zTo)+2000;
else if(("_Z_W_".indexOf("_"+aMove.a+"_")>=0) && aMove.c != null)
return Math.max(zFrom,zTo)+2000;
else
return (zFrom+zTo)/2;
}
/*
* View.Board.xdDisplay overriding to prevent displaying black xtra pieces before setup
*/
var SuperViewBoardxdDisplay = View.Board.xdDisplay;
View.Board.xdDisplay = function(xdv, aGame) {
var size = 1060;
SuperViewBoardxdDisplay.apply(this,arguments);
}
/*
* View.Game.xdInit overriding to create initial setup gadgets
*/
var SuperViewGameXdInit = View.Game.xdInit;
View.Game.xdInit = function(xdv) {
var size = 1060;
var $this=this;
SuperViewGameXdInit.apply(this,arguments);
}
})();