mirror of
https://github.com/webxoss/webxoss-core.git
synced 2024-11-20 06:49:53 +01:00
💫 implement wisdom
This commit is contained in:
parent
12bcb75031
commit
8b55954a66
5 changed files with 20 additions and 3 deletions
1
Card.js
1
Card.js
|
@ -266,6 +266,7 @@ Card.prototype.setupConstEffects = function () {
|
||||||
once: once,
|
once: once,
|
||||||
destroyTimming: destroyTimming,
|
destroyTimming: destroyTimming,
|
||||||
cross: !!eff.cross,
|
cross: !!eff.cross,
|
||||||
|
wisdom: eff.wisdom,
|
||||||
fixed: !!eff.fixed,
|
fixed: !!eff.fixed,
|
||||||
condition: eff.condition,
|
condition: eff.condition,
|
||||||
action: action,
|
action: action,
|
||||||
|
|
|
@ -116594,7 +116594,6 @@ var CardInfo = {
|
||||||
"【常】英知=10:このシグニが正面にアタックする場合、このシグニは正面に加えてその隣のシグニゾーン1つにアタックしてもよい。",
|
"【常】英知=10:このシグニが正面にアタックする場合、このシグニは正面に加えてその隣のシグニゾーン1つにアタックしてもよい。",
|
||||||
],
|
],
|
||||||
constEffects: [{
|
constEffects: [{
|
||||||
// TODO: ...
|
|
||||||
wisdom: 7,
|
wisdom: 7,
|
||||||
auto: 'onAttack',
|
auto: 'onAttack',
|
||||||
effect: {
|
effect: {
|
||||||
|
|
|
@ -62,6 +62,7 @@ ConstEffect.prototype.compute = function () {
|
||||||
if (this.fixed && this.computed) return;
|
if (this.fixed && this.computed) return;
|
||||||
this.clear();
|
this.clear();
|
||||||
if (this.cross && !this.source.crossed) return;
|
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)) {
|
if (!this.condition || this.condition.call(this.source)) {
|
||||||
var control = {
|
var control = {
|
||||||
reregister: false
|
reregister: false
|
||||||
|
|
|
@ -31,6 +31,7 @@ function Effect (effectManager,cfg) {
|
||||||
this.costChange = cfg.costChange;
|
this.costChange = cfg.costChange;
|
||||||
this.condition = cfg.condition;
|
this.condition = cfg.condition;
|
||||||
this.actionAsyn = cfg.actionAsyn;
|
this.actionAsyn = cfg.actionAsyn;
|
||||||
|
this.wisdom = cfg.wisdom || 0;
|
||||||
|
|
||||||
this.disabled = false; // 失去能力时设置为 true .
|
this.disabled = false; // 失去能力时设置为 true .
|
||||||
}
|
}
|
||||||
|
@ -66,10 +67,14 @@ Effect.prototype.triggerAndHandleAsyn = function (event) {
|
||||||
Effect.prototype.checkCondition = function () {
|
Effect.prototype.checkCondition = function () {
|
||||||
// "结束这个回合",如<终结之洞>
|
// "结束这个回合",如<终结之洞>
|
||||||
var game = this.effectManager.game;
|
var game = this.effectManager.game;
|
||||||
if (game.getData(game,'endThisTurn')) return;
|
if (game.getData(game,'endThisTurn')) return false;
|
||||||
// "1回合1次"
|
// "1回合1次"
|
||||||
if (this.once && inArr(this.proto,this.effectManager.triggeredEffects)) {
|
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) { // 排除迸发
|
if (!this.isBurst && this.triggerZone) { // 排除迸发
|
||||||
|
|
11
Player.js
11
Player.js
|
@ -848,6 +848,8 @@ Player.prototype.canUseActionEffect = function (effect,arg) {
|
||||||
if (!arg.onAttack && effect.onAttack) return false;
|
if (!arg.onAttack && effect.onAttack) return false;
|
||||||
// cross
|
// cross
|
||||||
if (effect.cross && !effect.source.crossed) return false;
|
if (effect.cross && !effect.source.crossed) return false;
|
||||||
|
// wisdom
|
||||||
|
if (effect.wisdom && !(effect.source.player.getWisdom() >= effect.wisdom)) return false;
|
||||||
// once
|
// once
|
||||||
if (effect.once && inArr(effect,this.usedActionEffects)) return false;
|
if (effect.once && inArr(effect,this.usedActionEffects)) return false;
|
||||||
// condition
|
// 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;
|
global.Player = Player;
|
Loading…
Reference in a new issue