1
0
mirror of https://github.com/exane/not-gwent-online synced 2024-12-23 21:03:14 +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": {
name: "scorch",
description: "Scorch: Kills the strongest card(s) in the battlefield.",
scorch: true
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.",
scorchMelee: true
},
"commanders_horn": {
name: "commanders_horn",
@ -334,6 +334,7 @@ module.exports = {
"emreis_leader4": {
name: "Emhyr vas Emreis the Relentless",
description: "Draw a card from your opponent's discard pile.",
waitResponse: true,
onActivate: function(card){
var discard = this.foe.getDiscard();

View File

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

View File

@ -61,6 +61,16 @@ 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(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.p2.hand.add(this.p2.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()){
this.p2.removeRuby();
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 {
loser: this.p2,
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()){
this.p1.removeRuby();
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 {
loser: this.p1,
isTie: false

View File

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