mirror of
https://github.com/webxoss/webxoss-core.git
synced 2025-01-31 01:39:09 +01:00
💩 add WX16 cards (before pid 2400)
This commit is contained in:
parent
2cc031f0a0
commit
334a5c0020
3 changed files with 1931 additions and 1401 deletions
56
Card.js
56
Card.js
|
@ -63,8 +63,8 @@ function Card (game,player,zone,pid,side) {
|
|||
this.beforeUseAsyn = info.beforeUseAsyn || null;
|
||||
// 生命迸发效果
|
||||
this.burstEffects = this.cookEffect(info.burstEffect,'burst');
|
||||
// 常时效果
|
||||
this.constEffects = info.constEffects || [];
|
||||
// 常时效果(因为内容会被修改,这里用 slice 创建不同的引用)
|
||||
this.constEffects = info.constEffects.slice() || [];
|
||||
// 出场效果
|
||||
this.startUpEffects = this.cookEffect(info.startUpEffects,'startup');
|
||||
// 起动效果
|
||||
|
@ -188,18 +188,43 @@ Card.abilityProps = [
|
|||
'trap',
|
||||
];
|
||||
|
||||
var mixins = {
|
||||
acce: {
|
||||
activatedInEnerZone: true,
|
||||
useCondition: function () {
|
||||
return this.player.signis.some(function (signi) {
|
||||
return signi.canBeAcced();
|
||||
},this);
|
||||
},
|
||||
actionAsyn: function () {
|
||||
var signis = this.player.signis.filter(function (signi) {
|
||||
return signi.canBeAcced();
|
||||
},this);
|
||||
return this.player.selectTargetOptionalAsyn(signis).callback(this,function (signi) {
|
||||
if (!signi) return;
|
||||
this.acceTo(signi);
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
Card.prototype.cookEffect = function (rawEffect,type,offset) {
|
||||
if (!offset) offset = 0;
|
||||
return concat(rawEffect || []).map(function (eff,idx) {
|
||||
var effect = Object.create(eff);
|
||||
effect.source = this;
|
||||
effect.description = [this.cid,type,idx+offset].join('-');
|
||||
if (eff.mixin) {
|
||||
var mixin = mixins[eff.mixin];
|
||||
for(var porp in mixin) {
|
||||
effect[prop] = mixin[prop];
|
||||
}
|
||||
}
|
||||
return effect;
|
||||
},this);
|
||||
};
|
||||
|
||||
Card.prototype.setupConstEffects = function () {
|
||||
this.constEffects.forEach(function (eff,idx) {
|
||||
this.constEffects.forEach(function (eff,idx,constEffects) {
|
||||
var createTimming,destroyTimming,once;
|
||||
if (eff.duringGame) {
|
||||
createTimming = null;
|
||||
|
@ -216,14 +241,22 @@ Card.prototype.setupConstEffects = function () {
|
|||
}
|
||||
var action = eff.action
|
||||
if (eff.auto) {
|
||||
action = function (set,add) {
|
||||
var effect = this.game.newEffect({
|
||||
source: this,
|
||||
description: this.cid+'-'+'const-'+idx,
|
||||
actionAsyn: eff.actionAsyn,
|
||||
});
|
||||
add(this,eff.auto,effect);
|
||||
};
|
||||
// 对于【自】效果,自动添加效果源和效果描述。
|
||||
// 暴露在 card.constEffects[i].effect 上,供<験英の応援 #ゴウカク#>之类的效果获取。
|
||||
var options = Object.create(eff.effect);
|
||||
if (!options.source) options.source = this;
|
||||
if (!options.description) options.description = this.cid+'-'+'const-'+idx;
|
||||
var effect = this.game.newEffect(options);
|
||||
constEffects[idx].effect = effect;
|
||||
if (isStr(eff.auto)) {
|
||||
action = function (set,add) {
|
||||
add(this,eff.auto,effect);
|
||||
};
|
||||
} else {
|
||||
action = function (set,add) {
|
||||
eff.auto.call(this,add,effect);
|
||||
};
|
||||
}
|
||||
}
|
||||
this.game.addConstEffect({
|
||||
source: this,
|
||||
|
@ -1683,6 +1716,7 @@ Card.prototype.handleTrapAsyn = function(event) {
|
|||
}).callback(this,function () {
|
||||
if (!this.trap) return;
|
||||
return this.game.blockAsyn(this,function () {
|
||||
this.player.onTrapTriggered.trigger();
|
||||
return this.trap.actionAsyn.call(this,event);
|
||||
})
|
||||
}).callback(this,function () {
|
||||
|
|
3236
CardInfo.js
3236
CardInfo.js
File diff suppressed because it is too large
Load diff
40
Player.js
40
Player.js
|
@ -78,6 +78,7 @@ function Player (game,io,mainDeck,lrigDeck) {
|
|||
this.onDoubleCrashed = new Timming(game);
|
||||
this.onDraw = new Timming(game);
|
||||
this.onRemoveVirus = new Timming(game);
|
||||
this.onTrapTriggered = new Timming(game);
|
||||
|
||||
// 附加属性
|
||||
this.skipGrowPhase = false;
|
||||
|
@ -2309,14 +2310,14 @@ Player.prototype.infectZoneAsyn = function() {
|
|||
});
|
||||
};
|
||||
|
||||
Player.prototype.setTrapFromDeckTopAsyn = function(count,max) {
|
||||
Player.prototype.setTrapFromDeckTopAsyn = function(count,max,forced) {
|
||||
if (!isNum(max)) max = 1;
|
||||
var cards = this.mainDeck.getTopCards(count);
|
||||
this.informCards(cards);
|
||||
var done = false;
|
||||
return Callback.loop(this,max,function () {
|
||||
if (done) return;
|
||||
return this.selectOptionalAsyn('TARGET',cards).callback(this,function (card) {
|
||||
return this.selectAsyn('TARGET',cards,!forced).callback(this,function (card) {
|
||||
if (!card) return done = true;
|
||||
removeFromArr(card,cards);
|
||||
return this.selectAsyn('TARGET',this.signiZones).callback(this,function (zone) {
|
||||
|
@ -2340,12 +2341,43 @@ Player.prototype.getTraps = function() {
|
|||
});
|
||||
};
|
||||
|
||||
Player.prototype.handleWisdomAuto = function(effect) {
|
||||
Player.prototype.handleEffectAsyn = function(effect) {
|
||||
if (!effect.checkCondition()) return Callback.immediately();
|
||||
var card = effect.source;
|
||||
card.beSelectedAsTarget();
|
||||
return card.player.opponent.showEffectsAsyn([effect]).callback(this,function () {
|
||||
return this.game.blockAsyn(card,function () {
|
||||
return effect.actionAsyn.call(effect.source);
|
||||
return effect.handleAsyn(false);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Player.prototype.addLifeCloth = function(count) {
|
||||
if (!isNum(count)) count = 1;
|
||||
var cards = this.mainDeck.getTopCards(count);
|
||||
return this.game.moveCards(cards,this.lifeClothZone);
|
||||
};
|
||||
|
||||
Player.prototype.pickCardsFromDeckTopAsyn = function(count,filter,max) {
|
||||
if (!isNum(max)) max = 1;
|
||||
var cards = this.mainDeck.getTopCards(count);
|
||||
if (!cards.length) return;
|
||||
var targets = cards.filter(filter);
|
||||
return Callback.immediately().callback(this,function () {
|
||||
if (!targets.length) return;
|
||||
return this.selectSomeAsyn('ADD_TO_HAND',targets,0,max,false,cards).callback(this,function (targets) {
|
||||
return this.opponent.showCardsAsyn(targets).callback(this,function () {
|
||||
this.game.moveCards(targets,this.handZone);
|
||||
cards = cards.filter(function (card) {
|
||||
return !inArr(card,targets);
|
||||
},this);
|
||||
});
|
||||
});
|
||||
}).callback(this,function () {
|
||||
var len = cards.length;
|
||||
if (!len) return;
|
||||
return this.selectSomeAsyn('SET_ORDER',cards,len,len,true).callback(this,function (cards) {
|
||||
this.mainDeck.moveCardsToBottom(cards);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue