mirror of
https://github.com/exane/not-gwent-online
synced 2024-11-23 19:36:53 +00:00
Merge branch 'master' of https://github.com/exane/gwent-online
This commit is contained in:
commit
dbe76f7038
2
.gitignore
vendored
2
.gitignore
vendored
@ -10,4 +10,4 @@ test/spec
|
||||
/site/client/node_modules
|
||||
/site/public/assets/js/bundle.js
|
||||
/site/public/assets/css/app.css
|
||||
/site/server/composer.lock
|
||||
site/server/composer.lock
|
@ -22,7 +22,7 @@ module.exports = {
|
||||
|
||||
discard = this.filter(discard, {
|
||||
"ability": "hero",
|
||||
"type": card.constructor.TYPE.SPECIAL
|
||||
"type": [card.constructor.TYPE.SPECIAL, card.constructor.TYPE.WEATHER]
|
||||
})
|
||||
|
||||
this.send("played:medic", {
|
||||
|
@ -7,7 +7,7 @@ module.exports = {
|
||||
"poor_fucking_infantry",
|
||||
"yarpen_zigrin",
|
||||
"blue_stripes_commando",
|
||||
"sigismunt_dijkstra",
|
||||
"sigismund_dijkstra",
|
||||
"prince_stennis",
|
||||
"siegfried_of_denesle",
|
||||
"ves",
|
||||
|
@ -62,21 +62,25 @@ var Battle = (function(){
|
||||
this.p1.draw(10);
|
||||
this.p2.draw(10);
|
||||
/*this.p1.hand.add(Card("commanders_horn"));
|
||||
this.p2.hand.add(Card("commanders_horn"));*//*
|
||||
this.p1.hand.add(Card("ciaran_aep_easnillien"));
|
||||
this.p2.hand.add(Card("ciaran_aep_easnillien"));*//*
|
||||
*//*this.p1.hand.add(Card("decoy"));
|
||||
this.p2.hand.add(Card("decoy"));*//*
|
||||
this.p1.hand.add(Card("milva"));
|
||||
this.p2.hand.add(Card("milva"));
|
||||
this.p1.hand.add(Card("havekar_healer"));
|
||||
this.p2.hand.add(Card("havekar_healer"));
|
||||
this.p1.hand.add(Card("toruviel"));
|
||||
this.p2.hand.add(Card("toruviel"));
|
||||
this.p1.hand.add(Card("vrihedd_brigade_recruit"));
|
||||
this.p2.hand.add(Card("vrihedd_brigade_recruit"));
|
||||
this.p1.hand.add(Card("impenetrable_fog"));
|
||||
this.p2.hand.add(Card("impenetrable_fog"));*/
|
||||
this.p2.hand.add(Card("commanders_horn"));*/
|
||||
/*
|
||||
this.p1.hand.add(Card("ciaran_aep_easnillien"));
|
||||
this.p2.hand.add(Card("ciaran_aep_easnillien"));*/
|
||||
/*
|
||||
*/
|
||||
/*this.p1.hand.add(Card("decoy"));
|
||||
this.p2.hand.add(Card("decoy"));*/
|
||||
/*
|
||||
this.p1.hand.add(Card("milva"));
|
||||
this.p2.hand.add(Card("milva"));
|
||||
this.p1.hand.add(Card("havekar_healer"));
|
||||
this.p2.hand.add(Card("havekar_healer"));
|
||||
this.p1.hand.add(Card("toruviel"));
|
||||
this.p2.hand.add(Card("toruviel"));
|
||||
this.p1.hand.add(Card("vrihedd_brigade_recruit"));
|
||||
this.p2.hand.add(Card("vrihedd_brigade_recruit"));
|
||||
this.p1.hand.add(Card("impenetrable_fog"));
|
||||
this.p2.hand.add(Card("impenetrable_fog"));*/
|
||||
/*
|
||||
this.p1.hand.add(Card("commanders_horn"));
|
||||
this.p1.hand.add(Card("commanders_horn"));
|
||||
@ -87,19 +91,20 @@ var Battle = (function(){
|
||||
this.p1.hand.add(Card("torrential_rain"));
|
||||
this.p2.hand.add(Card("torrential_rain"));
|
||||
this.p1.hand.add(Card("clear_weather"));
|
||||
this.p2.hand.add(Card("clear_weather"));*//*
|
||||
this.p1.hand.add(Card("kaedweni_siege_expert"));
|
||||
this.p2.hand.add(Card("kaedweni_siege_expert"));
|
||||
this.p1.hand.add(Card("ballista"));
|
||||
this.p2.hand.add(Card("ballista"));
|
||||
this.p1.hand.add(Card("ballista"));
|
||||
this.p2.hand.add(Card("ballista"));
|
||||
this.p1.hand.add(Card("ballista"));
|
||||
this.p2.hand.add(Card("ballista"));
|
||||
this.p1.hand.add(Card("ballista"));
|
||||
this.p2.hand.add(Card("ballista"));
|
||||
this.p1.hand.add(Card("ballista"));
|
||||
this.p2.hand.add(Card("ballista"));*/
|
||||
this.p2.hand.add(Card("clear_weather"));*/
|
||||
/*
|
||||
this.p1.hand.add(Card("kaedweni_siege_expert"));
|
||||
this.p2.hand.add(Card("kaedweni_siege_expert"));
|
||||
this.p1.hand.add(Card("ballista"));
|
||||
this.p2.hand.add(Card("ballista"));
|
||||
this.p1.hand.add(Card("ballista"));
|
||||
this.p2.hand.add(Card("ballista"));
|
||||
this.p1.hand.add(Card("ballista"));
|
||||
this.p2.hand.add(Card("ballista"));
|
||||
this.p1.hand.add(Card("ballista"));
|
||||
this.p2.hand.add(Card("ballista"));
|
||||
this.p1.hand.add(Card("ballista"));
|
||||
this.p2.hand.add(Card("ballista"));*/
|
||||
|
||||
/*
|
||||
this.p1.hand.add(Card("dun_banner_medic"));
|
||||
@ -127,6 +132,8 @@ var Battle = (function(){
|
||||
r.switchTurn = function(side, __flag){
|
||||
__flag = typeof __flag == "undefined" ? 0 : 1;
|
||||
|
||||
/*side.foe.wait();*/
|
||||
|
||||
|
||||
if(!(side instanceof Battleside)){
|
||||
console.trace("side is not a battleside!");
|
||||
@ -140,7 +147,10 @@ var Battle = (function(){
|
||||
}
|
||||
|
||||
this.runEvent("EachTurn");
|
||||
|
||||
//setTimeout(function() {
|
||||
this.runEvent("Turn" + side.getID());
|
||||
//}.bind(this), 1000);
|
||||
console.log("current Turn: ", side.getName());
|
||||
|
||||
}
|
||||
@ -253,7 +263,7 @@ var Battle = (function(){
|
||||
delete this.events[event][uid];
|
||||
return;
|
||||
}
|
||||
for(var _uid in this.events[event]){
|
||||
for(var _uid in this.events[event]) {
|
||||
this.events[event][_uid] = null;
|
||||
delete this.events[event][_uid];
|
||||
}
|
||||
|
@ -143,6 +143,10 @@ Battleside = (function(){
|
||||
return this._passing;
|
||||
}
|
||||
|
||||
r.isWaiting = function() {
|
||||
return this._isWaiting;
|
||||
}
|
||||
|
||||
r.setUpWeatherFieldWith = function(p2){
|
||||
this.field[Card.TYPE.WEATHER] = p2.field[Card.TYPE.WEATHER] = Field(this);
|
||||
}
|
||||
@ -277,6 +281,8 @@ Battleside = (function(){
|
||||
|
||||
r.playCard = function(card){
|
||||
if(card === null || card === -1) return;
|
||||
if(this.isWaiting()) return;
|
||||
if(this.isPassing()) return;
|
||||
|
||||
if(!this.placeCard(card)) return;
|
||||
|
||||
@ -291,7 +297,7 @@ Battleside = (function(){
|
||||
r.placeCard = function(card, obj){
|
||||
obj = _.extend({}, obj);
|
||||
|
||||
if(typeof card === "string" ) {
|
||||
if(typeof card === "string"){
|
||||
card = Card(card);
|
||||
}
|
||||
|
||||
@ -331,13 +337,13 @@ Battleside = (function(){
|
||||
|
||||
r.setHorn = function(card, field){
|
||||
var self = this;
|
||||
field = typeof field === "undefined" ? null : field;
|
||||
field = typeof field === "undefined" ? null : field;
|
||||
|
||||
if(typeof card === "string"){
|
||||
card = Card(card);
|
||||
}
|
||||
|
||||
if(typeof field === "number") {
|
||||
if(typeof field === "number"){
|
||||
card.changeType(field);
|
||||
this.placeCard(card, {
|
||||
isHorn: field,
|
||||
@ -409,7 +415,7 @@ Battleside = (function(){
|
||||
if(ability.onBeforePlace){
|
||||
ability.onBeforePlace.apply(this, [card]);
|
||||
}
|
||||
if(ability.isCommandersHornCard && !obj.isHorn){
|
||||
if(ability.isCommandersHornCard && typeof obj.isHorn === "undefined"){
|
||||
this.setHorn(card);
|
||||
}
|
||||
if(ability.commandersHorn){
|
||||
@ -529,8 +535,9 @@ Battleside = (function(){
|
||||
var cards1 = this.field[Card.TYPE.CLOSE_COMBAT].removeAll();
|
||||
var cards2 = this.field[Card.TYPE.RANGED].removeAll();
|
||||
var cards3 = this.field[Card.TYPE.SIEGE].removeAll();
|
||||
var cards4 = this.field[Card.TYPE.WEATHER].removeAll();
|
||||
|
||||
var cards = cards1.concat(cards2.concat(cards3));
|
||||
var cards = cards1.concat(cards2.concat(cards3.concat(cards4)));
|
||||
this.addToDiscard(cards);
|
||||
}
|
||||
|
||||
@ -586,6 +593,18 @@ Battleside = (function(){
|
||||
res.push(card);
|
||||
}
|
||||
}
|
||||
else if(_.isArray(val)) {
|
||||
var _f = false;
|
||||
for(var i = 0; i < val.length; i++) {
|
||||
if(property === val[i]){
|
||||
_f = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!_f){
|
||||
res.push(card);
|
||||
}
|
||||
}
|
||||
else if(card.getProperty(prop) !== val){
|
||||
res.push(card);
|
||||
}
|
||||
|
2993
site/server/composer.lock
generated
2993
site/server/composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -5,20 +5,22 @@ var data = require("../../assets/data/abilities");
|
||||
|
||||
describe("filter", function(){
|
||||
var card, side, filter, cards;
|
||||
|
||||
beforeEach(function(){
|
||||
filter = Battleside.prototype.filter;
|
||||
cards = [];
|
||||
cards.push(Card("iorveth"));
|
||||
cards.push(Card("toruviel"));
|
||||
cards.push(Card("isengrim_faoiltiarnah"));
|
||||
cards.push(Card("decoy"));
|
||||
cards.push(Card("iorveth")); //hero
|
||||
cards.push(Card("toruviel")); //normal
|
||||
cards.push(Card("isengrim_faoiltiarnah")); //hero
|
||||
cards.push(Card("decoy")); //special
|
||||
cards.push(Card("impenetrable_fog")); //special
|
||||
})
|
||||
|
||||
it("it should filter heroes out", function(){
|
||||
var res = filter(cards, {
|
||||
"ability": "hero"
|
||||
})
|
||||
expect(res.length).toBe(2);
|
||||
expect(res.length).toBe(3);
|
||||
})
|
||||
|
||||
it("it should filter hero and special cards out", function(){
|
||||
@ -26,6 +28,21 @@ describe("filter", function(){
|
||||
"ability": "hero",
|
||||
"type": Card.TYPE.SPECIAL
|
||||
})
|
||||
expect(res.length).toBe(2);
|
||||
})
|
||||
|
||||
it("it should filter 2 types out", function(){
|
||||
var res = filter(cards, {
|
||||
"type": [Card.TYPE.SPECIAL, Card.TYPE.WEATHER]
|
||||
})
|
||||
expect(res.length).toBe(3);
|
||||
})
|
||||
|
||||
it("it should filter 2 types and hero out", function(){
|
||||
var res = filter(cards, {
|
||||
"ability": "hero",
|
||||
"type": [Card.TYPE.SPECIAL, Card.TYPE.WEATHER]
|
||||
})
|
||||
expect(res.length).toBe(1);
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user