1
0
mirror of https://github.com/exane/not-gwent-online synced 2025-11-08 09:08:40 +00:00

more shenanigans

This commit is contained in:
exane
2015-06-19 17:15:26 +02:00
parent 21a92f69f3
commit 0cdce4b543
10 changed files with 95 additions and 29 deletions

View File

@@ -57,15 +57,19 @@ var Battle = (function(){
r.start = function(){
this.p1.setLeadercard();
this.p2.setLeadercard();
this.p1.draw(5);
this.p2.draw(5);
this.p1.draw(10);
this.p2.draw(10);
this.p1.hand.add(Card("harpy"));
this.p2.hand.add(Card("harpy"));
/*
this.p1.hand.add(Card("dun_banner_medic"));
this.p2.hand.add(Card("dun_banner_medic"));
this.p1.hand.add(Card("isengrim_faoiltiarnah"));
this.p2.hand.add(Card("isengrim_faoiltiarnah"));
this.p2.hand.add(Card("isengrim_faoiltiarnah"));*/
this.p1.addToDiscard([Card("kaedweni_siege_expert")]);
this.p2.addToDiscard([Card("kaedweni_siege_expert")]);
/*this.p1.addToDiscard([Card("kaedweni_siege_expert")]);
this.p2.addToDiscard([Card("kaedweni_siege_expert")]);*/
/*
this.p1.hand.add(Card("decoy"));
this.p1.hand.add(Card("impenetrable_fog"));

View File

@@ -88,6 +88,14 @@ Battleside = (function(){
self.playCard(card);
})
this.receive("agile:field", function(data) {
var fieldType = data.field;
self.runEvent("agile:setField", null, [fieldType]);
self.runEvent("NextTurn", null, [self.foe]);
})
this.receive("cancel:agile", function(){
self.off("agile:setField");
})
this.on("Turn" + this.getID(), this.onTurnStart, this);
@@ -269,7 +277,7 @@ Battleside = (function(){
obj = _.extend({}, obj);
this.checkAbilities(card, obj);
if(obj._canclePlacement) return 0;
if(obj._cancelPlacement) return 0;
var field = obj.targetSide.field[card.getType()];
field.add(card);
@@ -295,6 +303,7 @@ Battleside = (function(){
r.checkAbilities = function(card, obj, __flag){
var self = this;
obj.targetSide = this;
if(obj.disabled) return;
var ability = Array.isArray(__flag) || card.getAbility();
if(Array.isArray(ability) && ability.length){
@@ -309,6 +318,12 @@ Battleside = (function(){
}
if(ability && !Array.isArray(ability)){
if(ability.onBeforePlace) {
ability.onBeforePlace.apply(this, [card]);
}
if(ability.cancelPlacement) {
obj._cancelPlacement = true;
}
if(ability.waitResponse){
obj._waitResponse = true;
}
@@ -316,7 +331,7 @@ Battleside = (function(){
obj.targetSide = this.foe;
}
if(ability.replaceWith){
obj._canclePlacement = true;
obj._cancelPlacement = true;
this.on("Decoy:replaceWith", function(replaceCard){
if(replaceCard.getType() == Card.TYPE.LEADER ||

View File

@@ -32,6 +32,7 @@ var Card = (function(){
r._boost = null;
r._forcedPower = null;
r._disabled = null;
r._changedType = null;
Card.__id = 0;
Card.TYPE = {
CLOSE_COMBAT: 0,
@@ -95,7 +96,10 @@ var Card = (function(){
return this._data.musterType || null;
}
r.getType = function(){
return this._data.type;
return typeof this._changedType === "undefined" ? this._data.type : this._changedType;
}
r.changeType = function(type) {
this._changedType = type;
}
r.getKey = function(){
return this._key;
@@ -124,6 +128,7 @@ var Card = (function(){
}
r.resetBoost = function() {
this._changedType = null;
this._boost = 0;
}