mirror of
https://github.com/exane/not-gwent-online
synced 2024-11-23 19:36:53 +00:00
more shenanigans
This commit is contained in:
parent
21a92f69f3
commit
0cdce4b543
@ -1,7 +1,19 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
||||||
"agile": {
|
"agile": {
|
||||||
|
cancelPlacement: true,
|
||||||
|
onBeforePlace: function(card) {
|
||||||
|
var self = this;
|
||||||
|
this.send("played:agile", {cardID: card.getID()}, true);
|
||||||
|
this.on("agile:setField", function(type) {
|
||||||
|
self.off("agile:setField");
|
||||||
|
card.changeType(type)
|
||||||
|
self.placeCard(card, {
|
||||||
|
disabled: true
|
||||||
|
});
|
||||||
|
self.hand.remove(card);
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"medic": {
|
"medic": {
|
||||||
waitResponse: true,
|
waitResponse: true,
|
||||||
|
@ -353,8 +353,7 @@ module.exports = {
|
|||||||
"mahakaman_defender": {
|
"mahakaman_defender": {
|
||||||
name: "Mahakaman Defender",
|
name: "Mahakaman Defender",
|
||||||
power: 5,
|
power: 5,
|
||||||
ability: "muster",
|
ability: null,
|
||||||
musterType: "defender",
|
|
||||||
img: "defender2",
|
img: "defender2",
|
||||||
faction: "Scoia'tael",
|
faction: "Scoia'tael",
|
||||||
type: 0
|
type: 0
|
||||||
|
@ -99,9 +99,9 @@ module.exports = {
|
|||||||
"grave_hag",
|
"grave_hag",
|
||||||
//"vampire_katakan",
|
//"vampire_katakan",
|
||||||
"crone_whispess",
|
"crone_whispess",
|
||||||
|
"crone_brewess",
|
||||||
|
"crone_brewess",
|
||||||
"crone_whispess",
|
"crone_whispess",
|
||||||
"crone_brewess",
|
|
||||||
"crone_brewess",
|
|
||||||
"crone_weavess",
|
"crone_weavess",
|
||||||
"crone_weavess",
|
"crone_weavess",
|
||||||
"arachas_behemoth",
|
"arachas_behemoth",
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
"shortid": "^2.2.2",
|
"shortid": "^2.2.2",
|
||||||
"serve-static": "1.8.0",
|
"serve-static": "1.8.0",
|
||||||
"minimist": "1.1.0",
|
"minimist": "1.1.0",
|
||||||
|
"underscore": "^1.8.3",
|
||||||
"socketcluster-client": "2.2.x"
|
"socketcluster-client": "2.2.x"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -21,7 +22,6 @@
|
|||||||
"handlebars": "^3.0.3",
|
"handlebars": "^3.0.3",
|
||||||
"jquery": "^2.1.4",
|
"jquery": "^2.1.4",
|
||||||
"promise": "^7.0.1",
|
"promise": "^7.0.1",
|
||||||
"underscore": "^1.8.3",
|
|
||||||
"vinyl-source-stream": "^1.1.0"
|
"vinyl-source-stream": "^1.1.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -106,11 +106,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 mid-line"></div>
|
<div class="col-xs-12 mid-line"></div>
|
||||||
<div class="col-xs-12 battleside battleside-player player">
|
<div class="col-xs-12 battleside battleside-player player">
|
||||||
<div class="col-xs-12 field">
|
<div class="col-xs-12 field{{#if agile}} active{{/if}}">
|
||||||
<div class="col-xs-1 large-field-counter">0</div>
|
<div class="col-xs-1 large-field-counter">0</div>
|
||||||
<div class="col-xs-11 field-close"></div>
|
<div class="col-xs-11 field-close"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 field">
|
<div class="col-xs-12 field{{#if agile}} active{{/if}}">
|
||||||
<div class="col-xs-1 large-field-counter">0</div>
|
<div class="col-xs-1 large-field-counter">0</div>
|
||||||
<div class="col-xs-11 field-range"></div>
|
<div class="col-xs-11 field-range"></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -220,6 +220,7 @@ var BattleView = Backbone.View.extend({
|
|||||||
this.listenTo(user, "change:waiting", this.render);
|
this.listenTo(user, "change:waiting", this.render);
|
||||||
this.listenTo(user, "change:passing", this.render);
|
this.listenTo(user, "change:passing", this.render);
|
||||||
this.listenTo(user, "change:openDiscard", this.render);
|
this.listenTo(user, "change:openDiscard", this.render);
|
||||||
|
this.listenTo(user, "change:setAgile", this.render);
|
||||||
|
|
||||||
this.$hand = this.$el.find(".field-hand");
|
this.$hand = this.$el.find(".field-hand");
|
||||||
this.$preview = this.$el.find(".card-preview");
|
this.$preview = this.$el.find(".card-preview");
|
||||||
@ -242,7 +243,7 @@ var BattleView = Backbone.View.extend({
|
|||||||
"mouseover .card": "onMouseover",
|
"mouseover .card": "onMouseover",
|
||||||
"mouseleave .card": "onMouseleave",
|
"mouseleave .card": "onMouseleave",
|
||||||
"click .field-hand": "onClick",
|
"click .field-hand": "onClick",
|
||||||
"click .battleside.player": "onClickDecoy",
|
"click .battleside.player": "onClickFieldCard",
|
||||||
"click .button-pass": "onPassing",
|
"click .button-pass": "onPassing",
|
||||||
"click .field-discard": "openDiscard",
|
"click .field-discard": "openDiscard",
|
||||||
"click .field-leader": "clickLeader"
|
"click .field-leader": "clickLeader"
|
||||||
@ -262,6 +263,14 @@ var BattleView = Backbone.View.extend({
|
|||||||
var id = $card.data("id");
|
var id = $card.data("id");
|
||||||
var key = $card.data("key");
|
var key = $card.data("key");
|
||||||
|
|
||||||
|
if(!!this.user.get("setAgile")){
|
||||||
|
if(id === this.user.get("setAgile")){
|
||||||
|
this.user.set("setAgile", false);
|
||||||
|
this.app.send("cancel:agile");
|
||||||
|
this.render();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(!!this.user.get("waitForDecoy")){
|
if(!!this.user.get("waitForDecoy")){
|
||||||
if(id === this.user.get("waitForDecoy")){
|
if(id === this.user.get("waitForDecoy")){
|
||||||
this.user.set("waitForDecoy", false);
|
this.user.set("waitForDecoy", false);
|
||||||
@ -281,15 +290,25 @@ var BattleView = Backbone.View.extend({
|
|||||||
this.render();
|
this.render();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onClickDecoy: function(e){
|
onClickFieldCard: function(e){
|
||||||
if(!this.user.get("waitForDecoy")) return;
|
if(this.user.get("waitForDecoy")){
|
||||||
console.log("replacement card found: ");
|
var $card = $(e.target).closest(".card");
|
||||||
var $card = $(e.target).closest(".card");
|
var _id = $card.data("id");
|
||||||
var _id = $card.data("id");
|
this.app.send("decoy:replaceWith", {
|
||||||
this.app.send("decoy:replaceWith", {
|
cardID: _id
|
||||||
cardID: _id
|
})
|
||||||
})
|
this.user.set("waitForDecoy", false);
|
||||||
this.user.set("waitForDecoy", false);
|
}
|
||||||
|
if(this.user.get("setAgile")) {
|
||||||
|
var $field = $(e.target).closest(".field.active").find(".field-close, .field-range");
|
||||||
|
|
||||||
|
console.log($field);
|
||||||
|
var target = $field.hasClass("field-close") ? 0 : 1;
|
||||||
|
this.app.send("agile:field", {
|
||||||
|
field: target
|
||||||
|
});
|
||||||
|
this.user.set("setAgile", false);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onMouseover: function(e){
|
onMouseover: function(e){
|
||||||
var target = $(e.target).closest(".card");
|
var target = $(e.target).closest(".card");
|
||||||
@ -316,8 +335,8 @@ var BattleView = Backbone.View.extend({
|
|||||||
render: function(){
|
render: function(){
|
||||||
var self = this;
|
var self = this;
|
||||||
this.$el.html(this.template({
|
this.$el.html(this.template({
|
||||||
cards: self.handCards/*,
|
cards: self.handCards,
|
||||||
preview: self.user.get("showPreview")*/
|
agile: self.user.get("setAgile")
|
||||||
}));
|
}));
|
||||||
if(!(this.otherSide && this.yourSide)) return;
|
if(!(this.otherSide && this.yourSide)) return;
|
||||||
this.otherSide.render();
|
this.otherSide.render();
|
||||||
@ -332,7 +351,10 @@ var BattleView = Backbone.View.extend({
|
|||||||
var modal = new MedicModal({model: this.user});
|
var modal = new MedicModal({model: this.user});
|
||||||
this.$el.prepend(modal.render().el);
|
this.$el.prepend(modal.render().el);
|
||||||
}
|
}
|
||||||
|
if(this.user.get("setAgile")){
|
||||||
|
var id = this.user.get("setAgile");
|
||||||
|
this.$el.find("[data-id='" + id + "']").addClass("activeCard");
|
||||||
|
}
|
||||||
if(this.user.get("waitForDecoy")){
|
if(this.user.get("waitForDecoy")){
|
||||||
var id = this.user.get("waitForDecoy");
|
var id = this.user.get("waitForDecoy");
|
||||||
this.$el.find("[data-id='" + id + "']").addClass("activeCard");
|
this.$el.find("[data-id='" + id + "']").addClass("activeCard");
|
||||||
@ -482,6 +504,10 @@ var User = Backbone.Model.extend({
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
|
app.receive("played:agile", function(data){
|
||||||
|
console.log("played agile");
|
||||||
|
self.set("setAgile", data.cardID);
|
||||||
|
})
|
||||||
|
|
||||||
app.on("createRoom", this.createRoom, this);
|
app.on("createRoom", this.createRoom, this);
|
||||||
app.on("joinRoom", this.joinRoom, this);
|
app.on("joinRoom", this.joinRoom, this);
|
||||||
|
@ -20,6 +20,11 @@ $game-height: 800px;
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
box-shadow: 0px 0px 15px #ffbb0b;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.field:hover, .field-single:hover {
|
.field:hover, .field-single:hover {
|
||||||
|
@ -57,15 +57,19 @@ var Battle = (function(){
|
|||||||
r.start = function(){
|
r.start = function(){
|
||||||
this.p1.setLeadercard();
|
this.p1.setLeadercard();
|
||||||
this.p2.setLeadercard();
|
this.p2.setLeadercard();
|
||||||
this.p1.draw(5);
|
this.p1.draw(10);
|
||||||
this.p2.draw(5);
|
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.p1.hand.add(Card("dun_banner_medic"));
|
||||||
this.p2.hand.add(Card("dun_banner_medic"));
|
this.p2.hand.add(Card("dun_banner_medic"));
|
||||||
this.p1.hand.add(Card("isengrim_faoiltiarnah"));
|
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.p1.addToDiscard([Card("kaedweni_siege_expert")]);
|
||||||
this.p2.addToDiscard([Card("kaedweni_siege_expert")]);
|
this.p2.addToDiscard([Card("kaedweni_siege_expert")]);*/
|
||||||
/*
|
/*
|
||||||
this.p1.hand.add(Card("decoy"));
|
this.p1.hand.add(Card("decoy"));
|
||||||
this.p1.hand.add(Card("impenetrable_fog"));
|
this.p1.hand.add(Card("impenetrable_fog"));
|
||||||
|
@ -88,6 +88,14 @@ Battleside = (function(){
|
|||||||
|
|
||||||
self.playCard(card);
|
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);
|
this.on("Turn" + this.getID(), this.onTurnStart, this);
|
||||||
@ -269,7 +277,7 @@ Battleside = (function(){
|
|||||||
obj = _.extend({}, obj);
|
obj = _.extend({}, obj);
|
||||||
|
|
||||||
this.checkAbilities(card, obj);
|
this.checkAbilities(card, obj);
|
||||||
if(obj._canclePlacement) return 0;
|
if(obj._cancelPlacement) return 0;
|
||||||
|
|
||||||
var field = obj.targetSide.field[card.getType()];
|
var field = obj.targetSide.field[card.getType()];
|
||||||
field.add(card);
|
field.add(card);
|
||||||
@ -295,6 +303,7 @@ Battleside = (function(){
|
|||||||
r.checkAbilities = function(card, obj, __flag){
|
r.checkAbilities = function(card, obj, __flag){
|
||||||
var self = this;
|
var self = this;
|
||||||
obj.targetSide = this;
|
obj.targetSide = this;
|
||||||
|
if(obj.disabled) return;
|
||||||
var ability = Array.isArray(__flag) || card.getAbility();
|
var ability = Array.isArray(__flag) || card.getAbility();
|
||||||
|
|
||||||
if(Array.isArray(ability) && ability.length){
|
if(Array.isArray(ability) && ability.length){
|
||||||
@ -309,6 +318,12 @@ Battleside = (function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(ability && !Array.isArray(ability)){
|
if(ability && !Array.isArray(ability)){
|
||||||
|
if(ability.onBeforePlace) {
|
||||||
|
ability.onBeforePlace.apply(this, [card]);
|
||||||
|
}
|
||||||
|
if(ability.cancelPlacement) {
|
||||||
|
obj._cancelPlacement = true;
|
||||||
|
}
|
||||||
if(ability.waitResponse){
|
if(ability.waitResponse){
|
||||||
obj._waitResponse = true;
|
obj._waitResponse = true;
|
||||||
}
|
}
|
||||||
@ -316,7 +331,7 @@ Battleside = (function(){
|
|||||||
obj.targetSide = this.foe;
|
obj.targetSide = this.foe;
|
||||||
}
|
}
|
||||||
if(ability.replaceWith){
|
if(ability.replaceWith){
|
||||||
obj._canclePlacement = true;
|
obj._cancelPlacement = true;
|
||||||
|
|
||||||
this.on("Decoy:replaceWith", function(replaceCard){
|
this.on("Decoy:replaceWith", function(replaceCard){
|
||||||
if(replaceCard.getType() == Card.TYPE.LEADER ||
|
if(replaceCard.getType() == Card.TYPE.LEADER ||
|
||||||
|
@ -32,6 +32,7 @@ var Card = (function(){
|
|||||||
r._boost = null;
|
r._boost = null;
|
||||||
r._forcedPower = null;
|
r._forcedPower = null;
|
||||||
r._disabled = null;
|
r._disabled = null;
|
||||||
|
r._changedType = null;
|
||||||
Card.__id = 0;
|
Card.__id = 0;
|
||||||
Card.TYPE = {
|
Card.TYPE = {
|
||||||
CLOSE_COMBAT: 0,
|
CLOSE_COMBAT: 0,
|
||||||
@ -95,7 +96,10 @@ var Card = (function(){
|
|||||||
return this._data.musterType || null;
|
return this._data.musterType || null;
|
||||||
}
|
}
|
||||||
r.getType = function(){
|
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(){
|
r.getKey = function(){
|
||||||
return this._key;
|
return this._key;
|
||||||
@ -124,6 +128,7 @@ var Card = (function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
r.resetBoost = function() {
|
r.resetBoost = function() {
|
||||||
|
this._changedType = null;
|
||||||
this._boost = 0;
|
this._boost = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user