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

tight bond fix

This commit is contained in:
exane 2015-07-01 10:40:57 +02:00
parent 214ee521f0
commit 344f9cc29a
4 changed files with 55 additions and 20 deletions

View File

@ -88,18 +88,7 @@ module.exports = {
"tight_bond": {
name: "tight_bond",
description: "Tight Bond: Place next to a card with the name same to double the strength of both cards.",
onAfterPlace: function(card){
var field = this.field[card.getType()];
var cards = field.get();
var lastInsert = cards.length;
if(lastInsert < 2) return;
if(cards[lastInsert - 2].getName() == cards[lastInsert - 1].getName()){
cards[lastInsert - 2].setBoost(cards[lastInsert - 2].getID(), +cards[lastInsert - 2].getPower());
cards[lastInsert - 1].setBoost(cards[lastInsert - 1].getID(), +cards[lastInsert - 1].getPower());
}
}
tightBond: true
},
"spy": {
name: "spy",

View File

@ -61,10 +61,18 @@ var Battle = (function(){
this.p1.draw(10);
this.p2.draw(10);
/*this.p1.hand.add(this.p1.createCard("scorch"));
this.p2.hand.add(this.p2.createCard("scorch"));
this.p1.hand.add(this.p1.createCard("vernon_roche"));
this.p2.hand.add(this.p2.createCard("vernon_roche"));*/
/*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"));
this.p2.hand.add(this.p2.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.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"));
this.p2.hand.add(this.p2.createCard("blue_stripes_commando"));
this.p1.hand.add(this.p1.createCard("dandelion"));
this.p2.hand.add(this.p2.createCard("dandelion"));*/
/*this.p1.placeCard("ves");

View File

@ -446,6 +446,25 @@ Battleside = (function(){
})
}
r.setTightBond = function(card) {
var field = this.field[card.getType()];
var pos = field.getPosition(card);
var cards = field.get();
if(pos < 0) return;
if(pos >= 1 && cards[pos-1].getName() === cards[pos].getName()) {
cards[pos].setBoost(cards[pos].getID()+"|left", "tight_bond");
} else {
cards[pos].setBoost(cards[pos].getID()+"|left", 0);
}
if(pos < cards.length-1 && cards[pos+1].getName() === cards[pos].getName()) {
cards[pos].setBoost(cards[pos].getID()+"|right", "tight_bond");
} else {
cards[pos].setBoost(cards[pos].getID()+"|right", 0);
}
}
r.checkAbilities = function(card, obj, __flag){
var self = this;
obj.targetSide = this;
@ -459,11 +478,12 @@ Battleside = (function(){
ability = ability[0];
}
if(ability && ability.name === obj.suppress){
/*if(ability && ability.name === obj.suppress){
//this.update();
}
}*/
if(ability && !Array.isArray(ability)){
if(ability.onBeforePlace){
ability.onBeforePlace.apply(this, [card]);
}
@ -480,6 +500,12 @@ Battleside = (function(){
if(ability.nextTurn){
obj._nextTurn = ability.nextTurn;
}
if(ability.tightBond){
//this.setTightBond(card);
ability.onAfterPlace = this.setTightBond;
ability.onEachCardPlace = this.setTightBond;
//ability.onWeatherChange = this.setTightBond;
}
if(ability.scorch){
this.scorch(card);
}
@ -536,6 +562,7 @@ Battleside = (function(){
}
//this.update();
}
}

View File

@ -139,11 +139,22 @@ var Card = (function(){
r.getBoost = function(){
var res = 0;
var doubles = 0;
for(var key in this._boost) {
if(key === "commanders_horn" || key === "commanders_horn_card") continue;
if(key === "commanders_horn" || key === "commanders_horn_card") continue
if(this._boost[key] === "tight_bond"){
doubles++;
continue;
}
res += this._boost[key];
}
if(doubles){ //tight bond
for(var i = 0; i < doubles; i++) {
res += res + this.getBasePower();
}
}
if(this._boost["commanders_horn"] || this._boost["commanders_horn_card"]){
res += res + this.getBasePower();
}