forked from mirrors/webxoss-core
show coin
This commit is contained in:
parent
f51799ac58
commit
b496bc0051
3 changed files with 6 additions and 9 deletions
2
Card.js
2
Card.js
|
@ -8,7 +8,7 @@ function Card (game,player,zone,pid,side) {
|
||||||
this.zone = zone;
|
this.zone = zone;
|
||||||
|
|
||||||
// 状态
|
// 状态
|
||||||
this.isFaceUp = false;
|
this.isFaceup = false;
|
||||||
this.isUp = true;
|
this.isUp = true;
|
||||||
|
|
||||||
// 注册
|
// 注册
|
||||||
|
|
11
Player.js
11
Player.js
|
@ -239,6 +239,7 @@ Player.prototype.setupLifeCloth = function () {
|
||||||
// OPEN!!
|
// OPEN!!
|
||||||
Player.prototype.open = function () {
|
Player.prototype.open = function () {
|
||||||
this.lrig.faceup();
|
this.lrig.faceup();
|
||||||
|
this.setCoin(this.coin); // output
|
||||||
};
|
};
|
||||||
|
|
||||||
// 玩家把lrig和所有signi竖置 (竖置阶段)
|
// 玩家把lrig和所有signi竖置 (竖置阶段)
|
||||||
|
@ -2235,21 +2236,17 @@ Player.prototype.setCrossPair = function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
Player.prototype.gainCoins = function(count) {
|
Player.prototype.gainCoins = function(count) {
|
||||||
this.coin += count;
|
this.setCoin(this.coin + count);
|
||||||
if (this.coin > 5) {
|
|
||||||
this.coin = 5;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Player.prototype.loseCoins = function(count) {
|
Player.prototype.loseCoins = function(count) {
|
||||||
this.coin -= count;
|
this.setCoin(this.coin - count);
|
||||||
if (this.coin < 0) this.coin = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Player.prototype.setCoin = function(count) {
|
Player.prototype.setCoin = function(count) {
|
||||||
var coin = this.coin;
|
var coin = this.coin;
|
||||||
this.coin = Math.max(0, Math.min(5, count));
|
this.coin = Math.max(0, Math.min(5, count));
|
||||||
if (coin !== this.coin) {
|
if (this.lrig.isFaceup) {
|
||||||
this.game.output({
|
this.game.output({
|
||||||
type: 'COIN_CHANGE',
|
type: 'COIN_CHANGE',
|
||||||
content: {
|
content: {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 62eec8e4dd5e18f2299fd92070402571edb04640
|
Subproject commit ff57f7b81016de1b56f6cec5ee15d302b63a8f73
|
Loading…
Reference in a new issue