1
0
Fork 0

archieve futher cards && fix lostorage implementation

This commit is contained in:
WEBXOSS 2017-02-27 01:06:09 +08:00
parent e21fa4f2ea
commit 54e4fece9e
7 changed files with 7152 additions and 7136 deletions

View file

@ -38,6 +38,7 @@ function Card (game,player,zone,pid,side) {
this.costBlue = info.costBlue; this.costBlue = info.costBlue;
this.costGreen = info.costGreen; this.costGreen = info.costGreen;
this.costColorless = info.costColorless; this.costColorless = info.costColorless;
this.costCoin = info.costCoin;
this.costAsyn = info.costAsyn; this.costAsyn = info.costAsyn;
this.costChange = info.costChange; this.costChange = info.costChange;
this.costChangeAsyn = info.costChangeAsyn; this.costChangeAsyn = info.costChangeAsyn;
@ -96,6 +97,9 @@ function Card (game,player,zone,pid,side) {
} }
// Lostorage // Lostorage
this.coin = info.coin || 0;
this.bet = info.bet || 0;
this.bettedCost = info.bettedCost || null;
this.rise = info.rise; this.rise = info.rise;
this.acce = !!info.acce; this.acce = !!info.acce;
this.acceingCard = null; this.acceingCard = null;
@ -971,6 +975,9 @@ Card.prototype.moveTo = function (zone,arg) {
},this); },this);
} else if (lrigChangeEvent) { } else if (lrigChangeEvent) {
// card.player.onLrigChange.trigger(lrigChangeEvent); // card.player.onLrigChange.trigger(lrigChangeEvent);
if (card.coin) {
card.player.gainCoins(card.coin)
}
var oldLrig = lrigChangeEvent.oldLrig; var oldLrig = lrigChangeEvent.oldLrig;
if (oldLrig) oldLrig.onLeaveField2.trigger(); if (oldLrig) oldLrig.onLeaveField2.trigger();
card.onEnterField.trigger(enterFieldEvent); card.onEnterField.trigger(enterFieldEvent);

File diff suppressed because it is too large Load diff

View file

@ -25,6 +25,7 @@ function Effect (effectManager,cfg) {
this.costColorless = cfg.costColorless; this.costColorless = cfg.costColorless;
this.costDown = cfg.costDown; this.costDown = cfg.costDown;
this.costExceed = cfg.costExceed; this.costExceed = cfg.costExceed;
this.costCoin = cfg.costCoin;
this.costCondition = cfg.costCondition; this.costCondition = cfg.costCondition;
this.costAsyn = cfg.costAsyn; this.costAsyn = cfg.costAsyn;
this.costChange = cfg.costChange; this.costChange = cfg.costChange;

View file

@ -936,7 +936,7 @@ Game.prototype.handleBlockEndAsyn = function () {
return this.banishNonPositiveAsyn(); return this.banishNonPositiveAsyn();
}).callback(this,function () { }).callback(this,function () {
// 废弃【魅饰】和SIGNI下方的卡 // 废弃【魅饰】和SIGNI下方的卡
this.trashCards.forEach(function (card) { this.trashingCards.forEach(function (card) {
card.acceingCard = null; card.acceingCard = null;
},this); },this);
this.trashCards(this.trashingCharms,{ isCharm: true }); this.trashCards(this.trashingCharms,{ isCharm: true });

View file

@ -164,12 +164,6 @@ function Player (game,io,mainDeck,lrigDeck) {
// }); // });
// }; // };
Player.prototype.getCards = function () {
return this.game.cards.filter(function (card) {
return card.player === this;
},this);
};
// 玩家设置lrig // 玩家设置lrig
// (从LRIG卡组里选择等级0的卡片,背面表示放置到LRIG区) // (从LRIG卡组里选择等级0的卡片,背面表示放置到LRIG区)
Player.prototype.setupLrigAsyn = function () { Player.prototype.setupLrigAsyn = function () {
@ -660,14 +654,14 @@ Player.prototype.handleArtsAsyn = function (card,ignoreCost) {
if (this.coin < card.bet) return; if (this.coin < card.bet) return;
var bettedCost = Object.create(costObj); var bettedCost = Object.create(costObj);
if (card.bettedCost) { if (card.bettedCost) {
bettedCost = this.getChainedCostObj(card.bettedCost); bettedCost = card.getChainedCostObj(card.bettedCost);
} }
bettedCost.costCoin += card.bet; bettedCost.costCoin = card.bet;
if (!this.enoughCost(costObj)) { if (!this.enoughCost(costObj)) {
// 必须 bet // 必须 bet
return costObj = bettedCost; return costObj = bettedCost;
} }
return this.player.confirmAsyn('BET').callback(this,function (answer) { return this.confirmAsyn('BET').callback(this,function (answer) {
if (!answer) return; if (!answer) return;
costObj = bettedCost; costObj = bettedCost;
}) })
@ -871,7 +865,7 @@ Player.prototype.canUseActionEffect = function (effect,arg) {
// 玩家使用起动效果 // 玩家使用起动效果
Player.prototype.useActionEffectAsyn = function () { Player.prototype.useActionEffectAsyn = function () {
var effects = []; var effects = [];
var cards = this.getCards(); var cards = concat(this.lrig,this.signis,this.trashZone.cards,this.hands,this.enerZone.cards);
cards.forEach(function (card) { cards.forEach(function (card) {
card.actionEffects.forEach(function (effect) { card.actionEffects.forEach(function (effect) {
if (effect.spellCutIn) return; if (effect.spellCutIn) return;
@ -1415,7 +1409,7 @@ Player.prototype.needEner = function (obj) {
if (obj.costChange) { if (obj.costChange) {
obj = obj.costChange(); obj = obj.costChange();
} }
var costs = [obj.costColorless,obj.costWhite,obj.costBlack,obj.costRed,obj.costBlue,obj.costGreen,costCoin]; var costs = [obj.costColorless,obj.costWhite,obj.costBlack,obj.costRed,obj.costBlue,obj.costGreen];
return costs.some(function (cost) { return costs.some(function (cost) {
return cost > 0; return cost > 0;
}); });
@ -1458,6 +1452,7 @@ Player.prototype.needCost = function (obj) {
if (obj.costChange) { if (obj.costChange) {
obj = obj.costChange(); obj = obj.costChange();
} }
if (obj.costCoin) return true;
if (obj.costDown && obj.source) return true; if (obj.costDown && obj.source) return true;
if (obj.costAsyn && obj.source) return true; if (obj.costAsyn && obj.source) return true;
if (obj.costExceed && obj.source) return true; if (obj.costExceed && obj.source) return true;
@ -1695,8 +1690,7 @@ Player.prototype.enoughCost = function (obj) {
if (obj.costChange) { if (obj.costChange) {
obj = obj.costChange(); obj = obj.costChange();
} }
if (obj.costCoin && obj.costCoin >= this.coin) return false; if (obj.costCoin && obj.costCoin > this.coin) return false;
if (!this.enoughEner(obj)) return false;
if (obj.costDown && obj.source && !obj.source.isUp) return false; if (obj.costDown && obj.source && !obj.source.isUp) return false;
if (obj.costCondition && obj.source) { if (obj.costCondition && obj.source) {
if (!obj.costCondition.call(obj.source)) return false; if (!obj.costCondition.call(obj.source)) return false;
@ -1704,6 +1698,7 @@ Player.prototype.enoughCost = function (obj) {
if (obj.costExceed && obj.source) { if (obj.costExceed && obj.source) {
if (!this.enoughExceed(obj)) return false; if (!this.enoughExceed(obj)) return false;
} }
if (!this.enoughEner(obj)) return false;
return true; return true;
}; };
@ -1855,7 +1850,7 @@ Player.prototype.payCostAsyn = function (obj,cancelable) {
// Coin // Coin
if (obj.costCoin) { if (obj.costCoin) {
this.loseCoins(obj.costCoin); this.loseCoins(obj.costCoin);
costArg.bet = costCoin; costArg.bet = obj.costCoin;
} }
// 其它 // 其它
if (obj.costAsyn) { if (obj.costAsyn) {

7112
archive.js Normal file

File diff suppressed because it is too large Load diff

@ -1 +1 @@
Subproject commit f45004945ee94c59d5c40da60ff771010ef637b5 Subproject commit 566fce66059388cf29f0f9f630af18400348de97