💫 implement wisdom

This commit is contained in:
WEBXOSS 2017-06-07 17:48:58 +08:00
parent 12bcb75031
commit 8b55954a66
5 changed files with 20 additions and 3 deletions

View file

@ -266,6 +266,7 @@ Card.prototype.setupConstEffects = function () {
once: once,
destroyTimming: destroyTimming,
cross: !!eff.cross,
wisdom: eff.wisdom,
fixed: !!eff.fixed,
condition: eff.condition,
action: action,

View file

@ -116594,7 +116594,6 @@ var CardInfo = {
"【常】英知=10:このシグニが正面にアタックする場合、このシグニは正面に加えてその隣のシグニゾーン1つにアタックしてもよい。",
],
constEffects: [{
// TODO: ...
wisdom: 7,
auto: 'onAttack',
effect: {

View file

@ -62,6 +62,7 @@ ConstEffect.prototype.compute = function () {
if (this.fixed && this.computed) return;
this.clear();
if (this.cross && !this.source.crossed) return;
if (this.wisdom && !(this.source.player.getWisdom() >= this.wisdom)) return;
if (!this.condition || this.condition.call(this.source)) {
var control = {
reregister: false

View file

@ -31,6 +31,7 @@ function Effect (effectManager,cfg) {
this.costChange = cfg.costChange;
this.condition = cfg.condition;
this.actionAsyn = cfg.actionAsyn;
this.wisdom = cfg.wisdom || 0;
this.disabled = false; // 失去能力时设置为 true .
}
@ -66,10 +67,14 @@ Effect.prototype.triggerAndHandleAsyn = function (event) {
Effect.prototype.checkCondition = function () {
// "结束这个回合",如<终结之洞>
var game = this.effectManager.game;
if (game.getData(game,'endThisTurn')) return;
if (game.getData(game,'endThisTurn')) return false;
// "1回合1次"
if (this.once && inArr(this.proto,this.effectManager.triggeredEffects)) {
return;
return false;
}
// wisdom
if (this.wisdom && !(this.source.player.getWisdom() > this.wisdom)) {
return false;
}
// 隐藏规则之"发动和解决的场所必须一致"
if (!this.isBurst && this.triggerZone) { // 排除迸发

View file

@ -848,6 +848,8 @@ Player.prototype.canUseActionEffect = function (effect,arg) {
if (!arg.onAttack && effect.onAttack) return false;
// cross
if (effect.cross && !effect.source.crossed) return false;
// wisdom
if (effect.wisdom && !(effect.source.player.getWisdom() >= effect.wisdom)) return false;
// once
if (effect.once && inArr(effect,this.usedActionEffects)) return false;
// condition
@ -2382,4 +2384,13 @@ Player.prototype.pickCardsFromDeckTopAsyn = function(count,filter,max) {
});
};
Player.prototype.getWisdom = function() {
let wisdom = 0;
this.signis.forEach(function (signi) {
if (!signi.hasClass('英知')) return;
wisdom += signi.level;
},this);
return wisdom;
};
global.Player = Player;