implement virus

This commit is contained in:
WEBXOSS 2017-03-29 22:26:21 +08:00
parent fb615375a0
commit 09e42d6252
4 changed files with 42 additions and 22 deletions

View file

@ -1634,4 +1634,8 @@ Card.prototype.canGainAbility = function (source) {
return !canNotGainAbility;
};
Card.prototype.isInfected = function() {
return this.zone.virus;
};
global.Card = Card;

View file

@ -128943,11 +128943,12 @@ var CardInfo = {
constEffects: [{
auto: 'onBanish',
actionAsyn: function () {
// TODO...
var cards = this.player.opponent.getVirusCards();
if (cards.length < 2) return;
return this.player.selectSomeAsyn('TRASH',cards,2,2).callback(this,function (cards) {
this.game.trashCards(cards);
var zones = this.player.opponent.getInfectedZones();
if (zones.length < 2) return;
return this.player.selectSomeAsyn('TRASH',zones,2,2).callback(this,function (zones) {
zones.forEach(function (zone) {
zone.virus = false;
},this);
if (this.zone !== this.player.enerZone) return;
if (!this.canSummon()) return;
return this.summonAsyn();
@ -128968,9 +128969,11 @@ var CardInfo = {
],
startUpEffects: [{
actionAsyn: function () {
// TODO...
// Not optional
return this.decreasePowerAsyn(10000);
var cards = this.player.opponent.signis;
return this.player.selectTextAsyn(cards).callback(this,function (card) {
if (!card) return;
this.game.tillTurnEndAdd(this,card,'power',-10000);
});
},
}],
// ======================
@ -128989,7 +128992,6 @@ var CardInfo = {
actionAsyn: function () {
return this.player.selectOpponentSigniAsyn().callback(this,function (card) {
if (!card) return;
// TODO...
var value = card.isInfected() ? -8000 : -12000;
this.game.tillTurnEndAdd(this,card,'power',value);
});
@ -130133,14 +130135,10 @@ var CardInfo = {
actionEffects: [{
costDown: true,
actionAsyn: function () {
// TODO...
var cards = this.player.opponent.getInfectedCards();
return this.player.selectTargetOptionalAsyn(cards).callback(this,function (card) {
if (!card) return;
// TODO...
var virus = card.getVirus();
if (!virus) return;
virus.trash();
card.zone.virus = false;
this.game.tillTurnEndAdd(this,card,'power',-7000);
if (card.power <= 0) {
this.player.draw(1);
@ -131483,7 +131481,6 @@ var CardInfo = {
constEffects: [{
auto: 'onBanish',
actionAsyn: function () {
// TODO...
return this.player.infectZoneAsyn();
},
}],
@ -134406,7 +134403,6 @@ var CardInfo = {
"Until end of turn, 1 of your opponent's SIGNI gets 7000 power.",
],
costChange: function () {
// TODO...
var zones = this.player.opponent.getInfectedZones();
var count = zones.length*2;
var obj = Object.create(this);
@ -136107,7 +136103,7 @@ var CardInfo = {
source: this,
description: '2182-attached-1',
actionAsyn: function () {
this.player.opponent.getInfectedCards.forEach(function (card) {
this.player.opponent.getInfectedCards().forEach(function (card) {
this.game.tillTurnEndAdd(this,card,'power',-5000);
},this);
}
@ -136170,10 +136166,7 @@ var CardInfo = {
var cards = this.player.opponent.getInfectedCards();
return this.player.selectTargetOptionalAsyn(cards).callback(this,function (card) {
if (!card) return;
// TODO...
var virus = card.getVirus();
if (!virus) return;
virus.trash();
card.zone.virus = false;
this.game.tillTurnEndAdd(this,card,'power',-5000);
});
}
@ -136227,7 +136220,6 @@ var CardInfo = {
constEffects: [{
auto: 'onBanish',
actionAsyn: function () {
// TODO...
return this.player.infectZoneAsyn();
},
}],

View file

@ -2317,4 +2317,26 @@ Player.prototype.putCardToLifeCloth = function (arg) {
return card;
};
Player.prototype.getInfectedZones = function() {
return this.signiZones.filter(function (zone) {
return zone.virus;
},this);
};
Player.prototype.getInfectedCards = function() {
return this.signis.filter(function (signi) {
return signi.isInfected();
},this);
};
Player.prototype.infectZoneAsyn = function() {
var zones = this.opponent.signiZones.filter(function (zone) {
return !zone.virus;
},this);
return this.selectAsyn('TARGET',zones).callback(this,function (zone) {
if (!zone) return;
zone.virus = true;
});
};
global.Player = Player;

View file

@ -35,6 +35,7 @@ function Zone (game,player,name,args,pids) {
// 附加的属性
this.disabled = false; // <ワーム・ホール>
this.powerDown = false; // <黒幻蟲 サソリス>
this.virus = false;
}
Zone.prototype.getTopCards = function (n) {
@ -81,6 +82,7 @@ Zone.prototype.getStates = function () {
var states = [];
if (this.powerDown) states.push('powerDown');
if (this.disabled) states.push('disabled');
if (this.virus) states.push('infected');
return states;
};