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

change scorch ability

This commit is contained in:
exane 2015-07-01 11:38:31 +02:00
parent 344f9cc29a
commit f9a2278b64
4 changed files with 112 additions and 22 deletions

View File

@ -230,8 +230,8 @@ module.exports = {
}, },
"scorch": { "scorch": {
name: "scorch", name: "scorch",
description: "Scorch: Kills the strongest card(s) in the battlefield.", description: "Scorch: Destroy your enemy's strongest close combat unit(s) if the combined strength of all of his or her combat unit(s) is 10 or more.",
scorch: true scorchMelee: true
}, },
"commanders_horn": { "commanders_horn": {
name: "commanders_horn", name: "commanders_horn",
@ -334,6 +334,7 @@ module.exports = {
"emreis_leader4": { "emreis_leader4": {
name: "Emhyr vas Emreis the Relentless", name: "Emhyr vas Emreis the Relentless",
description: "Draw a card from your opponent's discard pile.", description: "Draw a card from your opponent's discard pile.",
waitResponse: true,
onActivate: function(card){ onActivate: function(card){
var discard = this.foe.getDiscard(); var discard = this.foe.getDiscard();

View File

@ -130,8 +130,8 @@ module.exports = {
"decoy", "decoy",
"decoy", "decoy",
"biting_frost", "biting_frost",
"biting_frost",
"torrential_rain", "torrential_rain",
"clear_weather",
"clear_weather" "clear_weather"
] ]
}, },

View File

@ -61,6 +61,16 @@ var Battle = (function(){
this.p1.draw(10); this.p1.draw(10);
this.p2.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(this.p1.createCard("scorch"));
this.p2.hand.add(this.p2.createCard("scorch"));
this.p1.hand.add(this.p1.createCard("villentretenmerth"));
this.p2.hand.add(this.p2.createCard("villentretenmerth"));*/
/*this.p1.hand.add(this.p1.createCard("blue_stripes_commando")); /*this.p1.hand.add(this.p1.createCard("blue_stripes_commando"));
this.p2.hand.add(this.p2.createCard("blue_stripes_commando")); this.p2.hand.add(this.p2.createCard("blue_stripes_commando"));
this.p1.hand.add(this.p1.createCard("blue_stripes_commando")); this.p1.hand.add(this.p1.createCard("blue_stripes_commando"));
@ -324,7 +334,7 @@ var Battle = (function(){
if(this.p1.deck.getFaction() === Deck.FACTION.NILFGAARDIAN_EMPIRE && this.p1.deck.getFaction() !== this.p2.deck.getFaction()){ if(this.p1.deck.getFaction() === Deck.FACTION.NILFGAARDIAN_EMPIRE && this.p1.deck.getFaction() !== this.p2.deck.getFaction()){
this.p2.removeRuby(); this.p2.removeRuby();
console.log(this.p1.getName() + " wins the tie! (nilfgaardian ability)"); console.log(this.p1.getName() + " wins the tie! (nilfgaardian ability)");
self.sendNotification(this.p1.getName() + " wins the tie! (nilfgaardian ability)"); this.sendNotification(this.p1.getName() + " wins the tie! (nilfgaardian ability)");
return { return {
loser: this.p2, loser: this.p2,
isTie: false isTie: false
@ -333,7 +343,7 @@ var Battle = (function(){
if(this.p2.deck.getFaction() === Deck.FACTION.NILFGAARDIAN_EMPIRE && this.p1.deck.getFaction() !== this.p2.deck.getFaction()){ if(this.p2.deck.getFaction() === Deck.FACTION.NILFGAARDIAN_EMPIRE && this.p1.deck.getFaction() !== this.p2.deck.getFaction()){
this.p1.removeRuby(); this.p1.removeRuby();
console.log(this.p2.getName() + " wins the tie! (nilfgaardian ability)"); console.log(this.p2.getName() + " wins the tie! (nilfgaardian ability)");
self.sendNotification(this.p2.getName() + " wins the tie! (nilfgaardian ability)"); this.sendNotification(this.p2.getName() + " wins the tie! (nilfgaardian ability)");
return { return {
loser: this.p1, loser: this.p1,
isTie: false isTie: false

View File

@ -58,6 +58,11 @@ Battleside = (function(){
leaderCard.setDisabled(true); leaderCard.setDisabled(true);
self.battle.sendNotification(self.getName() + " activated " + leaderCard.getName() + "! (leadercard)"); self.battle.sendNotification(self.getName() + " activated " + leaderCard.getName() + "! (leadercard)");
self.update(); self.update();
if(ability.waitResponse) {
return;
}
//self.runEvent("NextTurn", null, [self.foe]);
self.endTurn();
}) })
this.receive("play:cardFromHand", function(data){ this.receive("play:cardFromHand", function(data){
if(self._isWaiting) return; if(self._isWaiting) return;
@ -81,11 +86,14 @@ Battleside = (function(){
self.update(); self.update();
self.battle.sendNotification(self.getName() + " passed!"); self.battle.sendNotification(self.getName() + " passed!");
self.runEvent("NextTurn", null, [self.foe]); //self.runEvent("NextTurn", null, [self.foe]);
self.endTurn();
}) })
this.receive("medic:chooseCardFromDiscard", function(data){ this.receive("medic:chooseCardFromDiscard", function(data){
if(!data){ if(!data){
self.runEvent("NextTurn", null, [self.foe]); //self.runEvent("NextTurn", null, [self.foe]);
self.endTurn();
return; return;
} }
var cardID = data.cardID; var cardID = data.cardID;
@ -98,6 +106,7 @@ Battleside = (function(){
}) })
this.receive("emreis_leader4:chooseCardFromDiscard", function(data){ this.receive("emreis_leader4:chooseCardFromDiscard", function(data){
if(!data){ if(!data){
self.endTurn();
//self.runEvent("NextTurn", null, [self.foe]); //self.runEvent("NextTurn", null, [self.foe]);
return; return;
} }
@ -108,12 +117,17 @@ Battleside = (function(){
self.foe.removeFromDiscard(card); self.foe.removeFromDiscard(card);
self.placeCard(card); self.placeCard(card);
self.endTurn();
// self.runEvent("NextTurn", null, [self.foe]);
}) })
this.receive("agile:field", function(data){ this.receive("agile:field", function(data){
var fieldType = data.field; var fieldType = data.field;
if(!(fieldType in [0, 1])) throw new Error("set field agile: false fieldtype " + fieldType); if(!(fieldType in [0, 1])) throw new Error("set field agile: false fieldtype " + fieldType);
self.runEvent("agile:setField", null, [fieldType]); self.runEvent("agile:setField", null, [fieldType]);
self.runEvent("NextTurn", null, [self.foe]);
self.endTurn();
//self.runEvent("NextTurn", null, [self.foe]);
}) })
this.receive("cancel:agile", function(){ this.receive("cancel:agile", function(){
self.off("agile:setField"); self.off("agile:setField");
@ -122,7 +136,9 @@ Battleside = (function(){
var fieldType = data.field; var fieldType = data.field;
if(!(fieldType in [0, 1, 2])) throw new Error("set field horn: false fieldtype " + fieldType); if(!(fieldType in [0, 1, 2])) throw new Error("set field horn: false fieldtype " + fieldType);
self.runEvent("horn:setField", null, [fieldType]); self.runEvent("horn:setField", null, [fieldType]);
self.runEvent("NextTurn", null, [self.foe]);
self.endTurn();
//self.runEvent("NextTurn", null, [self.foe]);
}) })
this.receive("cancel:horn", function(){ this.receive("cancel:horn", function(){
self.off("horn:setField"); self.off("horn:setField");
@ -188,16 +204,9 @@ Battleside = (function(){
} }
r.getRandomCardOnField = function(){ r.getRandomCardOnField = function(){
var close, range, siege; var allCards = this.getFieldCards();
close = this.field[Card.TYPE.CLOSE_COMBAT].get();
range = this.field[Card.TYPE.RANGED].get();
siege = this.field[Card.TYPE.SIEGE].get();
var allCards = close.concat(range.concat(siege));
var rnd = (Math.random() * allCards.length) | 0; var rnd = (Math.random() * allCards.length) | 0;
//if(allCards[rnd].getType === 4) return null;
return allCards[rnd]; return allCards[rnd];
} }
@ -210,6 +219,16 @@ Battleside = (function(){
return -1; return -1;
} }
r.getFieldCards = function() {
var close, range, siege;
close = this.field[Card.TYPE.CLOSE_COMBAT].get();
range = this.field[Card.TYPE.RANGED].get();
siege = this.field[Card.TYPE.SIEGE].get();
return close.concat(range.concat(siege));
}
r.setPassing = function(b){ r.setPassing = function(b){
this._passing = b; this._passing = b;
this.send("set:passing", {passing: this._passing}, true); this.send("set:passing", {passing: this._passing}, true);
@ -325,6 +344,13 @@ Battleside = (function(){
this.update(); this.update();
//this.runEvent("NextTurn", null, [this.foe]);
this.endTurn();
}
r.endTurn = function() {
this.update();
this.runEvent("NextTurn", null, [this.foe]); this.runEvent("NextTurn", null, [this.foe]);
} }
@ -344,7 +370,8 @@ Battleside = (function(){
} }
if(obj._nextTurn && !obj.forceField){ if(obj._nextTurn && !obj.forceField){
this.update(); this.update();
this.runEvent("NextTurn", null, [this.foe]); //this.runEvent("NextTurn", null, [this.foe]);
this.endTurn();
return 0; return 0;
} }
@ -509,6 +536,9 @@ Battleside = (function(){
if(ability.scorch){ if(ability.scorch){
this.scorch(card); this.scorch(card);
} }
if(ability.scorchMelee){
this.scorchMelee(card);
}
if(ability.removeImmediately){ if(ability.removeImmediately){
this.hand.remove(card); this.hand.remove(card);
this.addToDiscard(card); this.addToDiscard(card);
@ -544,7 +574,8 @@ Battleside = (function(){
self.hand.remove(card); self.hand.remove(card);
self.update(); self.update();
self.runEvent("NextTurn", null, [self.foe]); //self.runEvent("NextTurn", null, [self.foe]);
self.endTurn();
self.battle.sendNotification(self.getName() + " played Decoy!"); self.battle.sendNotification(self.getName() + " played Decoy!");
}) })
} }
@ -635,15 +666,21 @@ Battleside = (function(){
this.runEvent("WeatherChange"); this.runEvent("WeatherChange");
} }
r.scorch = function(card){ r.scorchMelee = function(card) {
var side = this.foe; var side = this.foe;
var field = side.field[Card.TYPE.CLOSE_COMBAT]; var field = side.field[Card.TYPE.CLOSE_COMBAT];
this.battle.sendNotification(this.getName() + " played " + card.getName());
if(field.getScore() < 10) {
this.battle.sendNotification("Scorch: Score is under 10! Nothing happens.");
return;
}
var cards = field.getHighestCards(true); var cards = field.getHighestCards(true);
var removeCards = field.removeCard(cards); var removeCards = field.removeCard(cards);
this.battle.sendNotification(this.getName() + " played " + card.getName());
var txt = "Scorch destroyed:"; var txt = "Scorch destroyed:";
for (var i = 0; i < removeCards.length; i++) { for (var i = 0; i < removeCards.length; i++) {
var c = removeCards[i]; var c = removeCards[i];
@ -655,6 +692,48 @@ Battleside = (function(){
side.addToDiscard(removeCards); side.addToDiscard(removeCards);
} }
r.scorch = function(card){/*
var side = this.foe;
var field = side.field[Card.TYPE.CLOSE_COMBAT];
var cards = field.getHighestCards(true);
var removeCards = field.removeCard(cards);*/
var cards = this.getFieldCards();
cards = cards.concat(this.foe.getFieldCards());
var noHeroes = true;
var res = [];
var highest = 0;
var self = this;
this.battle.sendNotification(this.getName() + " played " + card.getName());
cards.forEach(function(card){
if(noHeroes && card.hasAbility("hero")) return;
highest = card.getPower() > highest ? card.getPower() : highest;
})
cards.forEach(function(card){
if(noHeroes && card.hasAbility("hero")) return;
if(card.getPower() === highest) res.push(card);
});
res.forEach(function(card) {
var side = self;
if(self.foe.field[card.getType()].isOnField(card)) {
side = self.foe;
}
var removed = side.field[card.getType()].removeCard(card);
side.addToDiscard(removed);
})
var txt = "Scorch destroyed:";
for (var i = 0; i < res.length; i++) {
var c = res[i];
txt += "\n" + c.getName();
}
this.battle.sendNotification(txt);
}
r.clearMainFields = function(){ r.clearMainFields = function(){
var rndCard = null; var rndCard = null;
if(this.deck.getFaction() === Deck.FACTION.MONSTERS){ if(this.deck.getFaction() === Deck.FACTION.MONSTERS){