2015-06-13 19:36:02 +00:00
|
|
|
module.exports = {
|
|
|
|
|
|
|
|
"agile": {
|
2015-06-19 15:15:26 +00:00
|
|
|
cancelPlacement: true,
|
2015-06-19 19:53:48 +00:00
|
|
|
onBeforePlace: function(card){
|
2015-06-19 15:15:26 +00:00
|
|
|
var self = this;
|
|
|
|
this.send("played:agile", {cardID: card.getID()}, true);
|
2015-06-19 19:53:48 +00:00
|
|
|
this.on("agile:setField", function(type){
|
2015-06-19 15:15:26 +00:00
|
|
|
self.off("agile:setField");
|
|
|
|
card.changeType(type)
|
|
|
|
self.placeCard(card, {
|
|
|
|
disabled: true
|
|
|
|
});
|
|
|
|
self.hand.remove(card);
|
|
|
|
})
|
|
|
|
}
|
2015-06-13 19:36:02 +00:00
|
|
|
},
|
|
|
|
"medic": {
|
2015-06-19 12:14:37 +00:00
|
|
|
waitResponse: true,
|
2015-06-19 19:53:48 +00:00
|
|
|
onAfterPlace: function(card){
|
2015-06-19 12:14:37 +00:00
|
|
|
var discard = this.getDiscard();
|
|
|
|
|
|
|
|
discard = this.filter(discard, {
|
|
|
|
"ability": "hero",
|
|
|
|
"type": card.constructor.TYPE.SPECIAL
|
|
|
|
})
|
2015-06-13 19:36:02 +00:00
|
|
|
|
2015-06-19 12:14:37 +00:00
|
|
|
this.send("played:medic", {
|
|
|
|
cards: JSON.stringify(discard)
|
|
|
|
}, true);
|
|
|
|
}
|
2015-06-13 19:36:02 +00:00
|
|
|
},
|
|
|
|
"morale_boost": {
|
2015-06-19 19:53:48 +00:00
|
|
|
onEachCardPlace: function(card){
|
2015-06-14 18:50:53 +00:00
|
|
|
var field = this.field[card.getType()];
|
2015-06-19 19:53:48 +00:00
|
|
|
var id = card.getID();
|
|
|
|
if(!field.isOnField(card)){
|
|
|
|
field.get().forEach(function(_card){
|
|
|
|
if(_card.getID() == id) return;
|
|
|
|
if(_card.getType() != card.getType()) return;
|
|
|
|
_card.setBoost(id, 0);
|
|
|
|
})
|
|
|
|
this.off("EachCardPlace", card.getUidEvents("EachCardPlace"));
|
|
|
|
return;
|
|
|
|
}
|
2015-06-13 19:36:02 +00:00
|
|
|
|
2015-06-19 19:53:48 +00:00
|
|
|
field.get().forEach(function(_card){
|
|
|
|
if(_card.getID() == id) return;
|
|
|
|
if(_card.getType() != card.getType()) return;
|
|
|
|
_card.setBoost(id, 1);
|
2015-06-13 19:36:02 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"muster": {
|
2015-06-19 12:14:37 +00:00
|
|
|
name: "muster",
|
2015-06-13 19:36:02 +00:00
|
|
|
onAfterPlace: function(card){
|
2015-06-19 12:14:37 +00:00
|
|
|
var musterType = card.getMusterType();
|
2015-06-13 19:36:02 +00:00
|
|
|
var self = this;
|
|
|
|
|
2015-06-19 12:14:37 +00:00
|
|
|
var cardsDeck = this.deck.find("musterType", musterType);
|
|
|
|
var cardsHand = this.hand.find("musterType", musterType);
|
|
|
|
|
2015-06-19 19:53:48 +00:00
|
|
|
cardsDeck.forEach(function(_card){
|
2015-06-20 11:08:28 +00:00
|
|
|
if(_card.getID() === card.getID()) return;
|
2015-06-14 18:50:53 +00:00
|
|
|
self.deck.removeFromDeck(_card);
|
2015-06-19 12:14:37 +00:00
|
|
|
self.placeCard(_card, {
|
|
|
|
suppress: "muster"
|
|
|
|
});
|
|
|
|
})
|
2015-06-19 19:53:48 +00:00
|
|
|
cardsHand.forEach(function(_card){
|
2015-06-20 11:08:28 +00:00
|
|
|
if(_card.getID() === card.getID()) return;
|
2015-06-19 12:14:37 +00:00
|
|
|
self.hand.remove(_card);
|
|
|
|
self.placeCard(_card, {
|
|
|
|
suppress: "muster"
|
|
|
|
});
|
2015-06-13 19:36:02 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"tight_bond": {
|
|
|
|
onAfterPlace: function(card){
|
2015-06-14 18:50:53 +00:00
|
|
|
var field = this.field[card.getType()];
|
|
|
|
var cards = field.get();
|
2015-06-13 19:36:02 +00:00
|
|
|
var lastInsert = cards.length;
|
|
|
|
|
|
|
|
if(lastInsert < 2) return;
|
|
|
|
|
|
|
|
if(cards[lastInsert - 2].getName() == cards[lastInsert - 1].getName()){
|
2015-06-20 11:08:28 +00:00
|
|
|
cards[lastInsert - 2].setBoost(cards[lastInsert - 2].getID(), +cards[lastInsert - 2].getPower());
|
|
|
|
cards[lastInsert - 1].setBoost(cards[lastInsert - 1].getID(), +cards[lastInsert - 1].getPower());
|
2015-06-13 19:36:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"spy": {
|
|
|
|
changeSide: true,
|
|
|
|
onAfterPlace: function(card){
|
2015-06-14 18:50:53 +00:00
|
|
|
this.draw(2);
|
2015-06-13 19:36:02 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"weather_fog": {
|
2015-06-19 19:53:48 +00:00
|
|
|
onEachTurn: function(card){
|
2015-06-13 19:36:02 +00:00
|
|
|
var targetRow = card.constructor.TYPE.RANGED;
|
|
|
|
var forcedPower = 1;
|
2015-06-14 18:50:53 +00:00
|
|
|
var field1 = this.field[targetRow].get();
|
|
|
|
var field2 = this.foe.field[targetRow].get();
|
2015-06-13 19:36:02 +00:00
|
|
|
|
|
|
|
var field = field1.concat(field2);
|
|
|
|
|
2015-06-19 19:53:48 +00:00
|
|
|
field.forEach(function(_card){
|
2015-06-13 19:36:02 +00:00
|
|
|
if(_card.getRawAbility() == "hero") return;
|
|
|
|
_card.setForcedPower(forcedPower);
|
|
|
|
});
|
2015-06-14 18:50:53 +00:00
|
|
|
},
|
2015-06-19 19:53:48 +00:00
|
|
|
onEachCardPlace: function(card){
|
2015-06-14 18:50:53 +00:00
|
|
|
var targetRow = card.constructor.TYPE.RANGED;
|
|
|
|
var forcedPower = 1;
|
|
|
|
var field1 = this.field[targetRow].get();
|
|
|
|
var field2 = this.foe.field[targetRow].get();
|
|
|
|
|
|
|
|
var field = field1.concat(field2);
|
2015-06-13 19:36:02 +00:00
|
|
|
|
2015-06-19 19:53:48 +00:00
|
|
|
field.forEach(function(_card){
|
2015-06-14 18:50:53 +00:00
|
|
|
if(_card.getRawAbility() == "hero") return;
|
|
|
|
_card.setForcedPower(forcedPower);
|
|
|
|
});
|
2015-06-13 19:36:02 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"weather_rain": {
|
2015-06-19 19:53:48 +00:00
|
|
|
onEachTurn: function(card){
|
2015-06-13 19:36:02 +00:00
|
|
|
var targetRow = card.constructor.TYPE.SIEGE;
|
|
|
|
var forcedPower = 1;
|
2015-06-14 18:50:53 +00:00
|
|
|
var field1 = this.field[targetRow].get();
|
|
|
|
var field2 = this.foe.field[targetRow].get();
|
2015-06-13 19:36:02 +00:00
|
|
|
|
|
|
|
var field = field1.concat(field2);
|
|
|
|
|
2015-06-19 19:53:48 +00:00
|
|
|
field.forEach(function(_card){
|
2015-06-13 19:36:02 +00:00
|
|
|
if(_card.getRawAbility() == "hero") return;
|
|
|
|
_card.setForcedPower(forcedPower);
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"weather_frost": {
|
2015-06-19 19:53:48 +00:00
|
|
|
onEachTurn: function(card){
|
2015-06-13 19:36:02 +00:00
|
|
|
var targetRow = card.constructor.TYPE.CLOSE_COMBAT;
|
|
|
|
var forcedPower = 1;
|
2015-06-14 18:50:53 +00:00
|
|
|
var field1 = this.field[targetRow].get();
|
|
|
|
var field2 = this.foe.field[targetRow].get();
|
2015-06-13 19:36:02 +00:00
|
|
|
|
|
|
|
var field = field1.concat(field2);
|
|
|
|
|
2015-06-19 19:53:48 +00:00
|
|
|
field.forEach(function(_card){
|
2015-06-13 19:36:02 +00:00
|
|
|
if(_card.getRawAbility() == "hero") return;
|
|
|
|
_card.setForcedPower(forcedPower);
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"clear_weather": {
|
2015-06-19 19:53:48 +00:00
|
|
|
onAfterPlace: function(card){
|
2015-06-13 19:36:02 +00:00
|
|
|
var targetRow = card.constructor.TYPE.WEATHER;
|
2015-06-14 18:50:53 +00:00
|
|
|
var field = this.field[targetRow].get();
|
2015-06-13 19:36:02 +00:00
|
|
|
|
|
|
|
//todo: remove weather cards
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"decoy": {
|
|
|
|
replaceWith: true
|
2015-06-18 13:06:13 +00:00
|
|
|
},
|
|
|
|
"foltest_leader1": {
|
2015-06-19 19:53:48 +00:00
|
|
|
onActivate: function(){
|
2015-06-18 13:06:13 +00:00
|
|
|
var cards = this.deck.find("key", "impenetrable_fog")
|
|
|
|
if(!cards.length) return;
|
|
|
|
var card = this.deck.removeFromDeck(cards[0]);
|
|
|
|
this.placeCard(card);
|
|
|
|
}
|
2015-06-19 12:14:37 +00:00
|
|
|
},
|
2015-06-19 19:59:33 +00:00
|
|
|
"francesca_leader1": {
|
|
|
|
onActivate: function(){
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"francesca_leader2": {
|
|
|
|
onActivate: function(){
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"francesca_leader3": {
|
|
|
|
onActivate: function(){
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"francesca_leader4": {
|
|
|
|
onActivate: function(){
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"eredin_leader1": {
|
|
|
|
onActivate: function(){
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"eredin_leader2": {
|
|
|
|
onActivate: function(){
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"eredin_leader3": {
|
|
|
|
onActivate: function(){
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"eredin_leader4": {
|
|
|
|
onActivate: function(){
|
|
|
|
}
|
|
|
|
},
|
2015-06-19 19:53:48 +00:00
|
|
|
"hero": {}
|
2015-06-13 19:36:02 +00:00
|
|
|
}
|