1
0
mirror of https://github.com/exane/not-gwent-online synced 2024-11-23 19:36:53 +00:00

add scorch ability

This commit is contained in:
exane 2015-06-26 13:17:28 +02:00
parent e81620fece
commit d8d0962a5f
5 changed files with 94 additions and 3 deletions

View File

@ -231,9 +231,17 @@ module.exports = {
description: "Decoy: Swap with a card on the battlefield to return it to your hand.",
replaceWith: true
},
"scorch_card": {
name: "scorch",
description: "Scorch: Discard after playing. Kills the strongest card(s) in the battlefield.",
scorch: true,
removeImmediately: true,
nextTurn: true
},
"scorch": {
name: "scorch",
description: "Scorch: Discard after playing. Kills the strongest card(s) in the battlefield."
description: "Scorch: Discard after playing. Kills the strongest card(s) in the battlefield.",
scorch: true
},
"commanders_horn": {
name: "commanders_horn",

View File

@ -252,6 +252,14 @@ module.exports = {
faction: null,
type: 4
},
"scorch": {
name: "Scorch",
power: -1,
ability: "scorch_card",
img: "scorch",
faction: null,
type: 4
},
"commanders_horn": {
name: "Commander's Horn",
power: -1,
@ -311,6 +319,14 @@ module.exports = {
faction: null,
type: 0
},
"villentretenmerth": {
name: "Villentretenmerth ",
power: 7,
ability: "scorch",
img: "villentretenmerth",
faction: null,
type: 0
},
"francesca_pureblood_elf": {
name: "Francesca, Pureblood Elf",

View File

@ -64,6 +64,15 @@ var Battle = (function(){
this.p1.draw(10);
this.p2.draw(10);
this.p1.placeCard("ves");
this.p2.placeCard("ves");
this.p1.placeCard("yarpen_zigrin");
this.p2.placeCard("yarpen_zigrin");
this.p1.hand.add(Card("scorch"));
this.p2.hand.add(Card("scorch"));
this.p1.hand.add(Card("villentretenmerth"));
this.p2.hand.add(Card("villentretenmerth"));
/* this.p1.hand.add(Card("impenetrable_fog"));
this.p2.hand.add(Card("impenetrable_fog"));

View File

@ -301,6 +301,11 @@ Battleside = (function(){
this.checkAbilities(card, obj);
if(obj._cancelPlacement && !obj.forceField) return 0;
if(obj._nextTurn && !obj.forceField) {
this.update();
this.runEvent("NextTurn", null, [this.foe]);
return 0;
}
var field = obj.forceField || null;
@ -424,6 +429,16 @@ Battleside = (function(){
if(ability.cancelPlacement && !obj.forcePlace){
obj._cancelPlacement = true;
}
if(ability.nextTurn) {
obj._nextTurn = ability.nextTurn;
}
if(ability.scorch) {
this.scorch(card);
}
if(ability.removeImmediately) {
this.hand.remove(card);
this.addToDiscard(card);
}
if(ability.waitResponse && !obj.forcePlace){
obj._waitResponse = true;
}
@ -531,6 +546,17 @@ Battleside = (function(){
//this.update();
}
r.scorch = function(card) {
var side = this.foe;
var field = side.field[Card.TYPE.CLOSE_COMBAT];
var cards = field.getHighestCards();
var removeCards = field.removeCard(cards);
side.addToDiscard(removeCards);/*
this.hand.remove(card);
this.addToDiscard(card);*/
}
r.clearMainFields = function(){
var cards1 = this.field[Card.TYPE.CLOSE_COMBAT].removeAll();
var cards2 = this.field[Card.TYPE.RANGED].removeAll();
@ -543,8 +569,11 @@ Battleside = (function(){
r.addToDiscard = function(cards){
var self = this;
cards.forEach(function(card){
self._discard.push(card);
if(!Array.isArray(cards)) {
cards = [cards];
}
cards.forEach(function(_card){
self._discard.push(_card);
});
}

View File

@ -105,6 +105,20 @@ var Field = (function(){
return tmp;
}
r.removeCard = function(cards) {
var res = [];
var _cards = this.get();
if(!Array.isArray(cards)) {
cards = [cards];
}
var self = this;
cards.forEach(function(card) {
res.push(_cards.splice(self.getPosition(card), 1)[0]);
})
return res;
}
r.getInfo = function() {
var self = this;
return {
@ -124,6 +138,21 @@ var Field = (function(){
this._hornCard = card;
}
r.getHighestCards = function() {
var res = [];
var highest = 0;
this.get().forEach(function(card) {
highest = card.getPower() > highest ? card.getPower() : highest;
})
this.get().forEach(function(card) {
if(card.getPower() === highest) res.push(card);
});
return res;
}
return Field;
})();