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

fix forcedPower with basicPower 0

This commit is contained in:
exane 2015-06-19 18:48:40 +02:00
parent 0da37aa4b8
commit 30a1005d14

View File

@ -57,16 +57,16 @@ var Card = (function(){
r.getPower = function(){ r.getPower = function(){
if(this._data.power === -1) return 0; if(this._data.power === -1) return 0;
if(this._forcedPower > -1){ if(this._forcedPower > -1){
return this._forcedPower + this._boost; return (this._forcedPower > this._data.power ? this._data.power : this._forcedPower) + this._boost;
} }
return this._data.power + this._boost; return this._data.power + this._boost;
} }
r.getRawPower = function() { r.getRawPower = function(){
return this._data.power; return this._data.power;
} }
r.calculateBoost = function() { r.calculateBoost = function(){
this._boost = 0; this._boost = 0;
for (var key in this._boosts) { for(var key in this._boosts) {
var boost = this._boosts[key]; var boost = this._boosts[key];
this.boost(boost.getPower()); this.boost(boost.getPower());
} }
@ -78,9 +78,9 @@ var Card = (function(){
return this._data.ability; return this._data.ability;
} }
r.getAbility = function(){ r.getAbility = function(){
if(Array.isArray(this._data.ability)) { if(Array.isArray(this._data.ability)){
var res = []; var res = [];
this._data.ability.forEach(function(ability) { this._data.ability.forEach(function(ability){
res.push(AbilityData[ability]); res.push(AbilityData[ability]);
}) })
return res; return res;
@ -93,13 +93,13 @@ var Card = (function(){
r.getFaction = function(){ r.getFaction = function(){
return this._data.faction; return this._data.faction;
} }
r.getMusterType = function() { r.getMusterType = function(){
return this._data.musterType || null; return this._data.musterType || null;
} }
r.getType = function(){ r.getType = function(){
return this._changedType == null ? this._data.type : this._changedType; return this._changedType == null ? this._data.type : this._changedType;
} }
r.changeType = function(type) { r.changeType = function(type){
this._changedType = type; this._changedType = type;
} }
r.getKey = function(){ r.getKey = function(){
@ -115,11 +115,11 @@ var Card = (function(){
this._boost += nr; this._boost += nr;
} }
r.isDisabled = function() { r.isDisabled = function(){
return this._disabled; return this._disabled;
} }
r.setDisabled = function(b) { r.setDisabled = function(b){
this._disabled = b; this._disabled = b;
} }
@ -128,7 +128,7 @@ var Card = (function(){
return this._data[prop]; return this._data[prop];
} }
r.resetBoost = function() { r.resetBoost = function(){
this._changedType = null; this._changedType = null;
this._boost = 0; this._boost = 0;
} }