mirror of
https://github.com/exane/not-gwent-online
synced 2024-11-23 19:36:53 +00:00
add one leader ability (nilfgaardian)
This commit is contained in:
parent
ca3267aedb
commit
b33606e943
@ -458,6 +458,10 @@ let BattleView = Backbone.View.extend({
|
|||||||
let modal = new MedicModal({model: this.user});
|
let modal = new MedicModal({model: this.user});
|
||||||
this.$el.prepend(modal.render().el);
|
this.$el.prepend(modal.render().el);
|
||||||
}
|
}
|
||||||
|
if(this.user.get("emreis_leader4")){
|
||||||
|
let modal = new LeaderEmreis4Modal({model: this.user});
|
||||||
|
this.$el.prepend(modal.render().el);
|
||||||
|
}
|
||||||
if(this.user.get("setAgile")){
|
if(this.user.get("setAgile")){
|
||||||
let id = this.user.get("setAgile");
|
let id = this.user.get("setAgile");
|
||||||
this.$el.find("[data-id='" + id + "']").addClass("activeCard");
|
this.$el.find("[data-id='" + id + "']").addClass("activeCard");
|
||||||
@ -608,6 +612,24 @@ let MedicModal = Modal.extend({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let LeaderEmreis4Modal = Modal.extend({
|
||||||
|
template: require("../templates/modal.emreis_leader4.handlebars"),
|
||||||
|
events: {
|
||||||
|
"click .card": "onCardClick"
|
||||||
|
},
|
||||||
|
onCardClick: function(e){
|
||||||
|
let id = $(e.target).closest(".card").data().id;
|
||||||
|
this.model.get("app").send("emreis_leader4:chooseCardFromDiscard", {
|
||||||
|
cardID: id
|
||||||
|
})
|
||||||
|
this.model.set("emreis_leader4", false);
|
||||||
|
},
|
||||||
|
cancel: function(){
|
||||||
|
this.model.get("app").send("emreis_leader4:chooseCardFromDiscard")
|
||||||
|
this.model.set("emreis_leader4", false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
let ReDrawModal = Modal.extend({
|
let ReDrawModal = Modal.extend({
|
||||||
template: require("../templates/modal.redraw.handlebars"),
|
template: require("../templates/modal.redraw.handlebars"),
|
||||||
initialize: function(){
|
initialize: function(){
|
||||||
@ -708,12 +730,18 @@ let User = Backbone.Model.extend({
|
|||||||
|
|
||||||
app.receive("played:medic", function(data){
|
app.receive("played:medic", function(data){
|
||||||
let cards = JSON.parse(data.cards);
|
let cards = JSON.parse(data.cards);
|
||||||
//console.log("played medic");
|
|
||||||
self.set("medicDiscard", {
|
self.set("medicDiscard", {
|
||||||
cards: cards
|
cards: cards
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
|
app.receive("played:emreis_leader4", function(data){
|
||||||
|
let cards = JSON.parse(data.cards);
|
||||||
|
self.set("emreis_leader4", {
|
||||||
|
cards: cards
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
app.receive("played:agile", function(data){
|
app.receive("played:agile", function(data){
|
||||||
//console.log("played agile");
|
//console.log("played agile");
|
||||||
self.set("setAgile", data.cardID);
|
self.set("setAgile", data.cardID);
|
||||||
|
11
client/templates/modal.emreis_leader4.handlebars
Normal file
11
client/templates/modal.emreis_leader4.handlebars
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<div class="bbm-modal__topbar">
|
||||||
|
<h3 class="bbm-modal__title">Choose one card from your foes discard pile</h3>
|
||||||
|
</div>
|
||||||
|
<div class="bbm-modal__section">
|
||||||
|
{{#each emreis_leader4.cards as |val key|}}
|
||||||
|
{{>card val}}
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
<div class="bbm-modal__bottombar">
|
||||||
|
<div class="bbm-button bbm-close">close</div>
|
||||||
|
</div>
|
@ -1,5 +1,5 @@
|
|||||||
<div class="bbm-modal__topbar">
|
<div class="bbm-modal__topbar">
|
||||||
<h3 class="bbm-modal__title">Choose one card from your discard</h3>
|
<h3 class="bbm-modal__title">Choose one card from your discard pile</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="bbm-modal__section">
|
<div class="bbm-modal__section">
|
||||||
{{#each medicDiscard.cards as |val key|}}
|
{{#each medicDiscard.cards as |val key|}}
|
||||||
|
@ -54,7 +54,7 @@ Battleside = (function(){
|
|||||||
|
|
||||||
var ability = leaderCard.getAbility();
|
var ability = leaderCard.getAbility();
|
||||||
|
|
||||||
ability.onActivate.apply(self);
|
ability.onActivate.apply(self, [leaderCard]);
|
||||||
leaderCard.setDisabled(true);
|
leaderCard.setDisabled(true);
|
||||||
self.battle.sendNotification(self.getName() + " activated " + leaderCard.getName() + "! (leadercard)");
|
self.battle.sendNotification(self.getName() + " activated " + leaderCard.getName() + "! (leadercard)");
|
||||||
self.update();
|
self.update();
|
||||||
@ -96,6 +96,19 @@ Battleside = (function(){
|
|||||||
|
|
||||||
self.playCard(card);
|
self.playCard(card);
|
||||||
})
|
})
|
||||||
|
this.receive("emreis_leader4:chooseCardFromDiscard", function(data){
|
||||||
|
if(!data){
|
||||||
|
//self.runEvent("NextTurn", null, [self.foe]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var cardID = data.cardID;
|
||||||
|
var card = self.foe.getCardFromDiscard(cardID);
|
||||||
|
if(card === -1) throw new Error("emreis_leader4:chooseCardFromDiscard | unknown card: ", card);
|
||||||
|
|
||||||
|
self.foe.removeFromDiscard(card);
|
||||||
|
|
||||||
|
self.placeCard(card);
|
||||||
|
})
|
||||||
this.receive("agile:field", function(data){
|
this.receive("agile:field", function(data){
|
||||||
var fieldType = data.field;
|
var fieldType = data.field;
|
||||||
if(!(fieldType in [0, 1])) throw new Error("set field agile: false fieldtype " + fieldType);
|
if(!(fieldType in [0, 1])) throw new Error("set field agile: false fieldtype " + fieldType);
|
||||||
@ -413,8 +426,9 @@ Battleside = (function(){
|
|||||||
|
|
||||||
if(!field.isOnField(card)){
|
if(!field.isOnField(card)){
|
||||||
field.get().forEach(function(_card){
|
field.get().forEach(function(_card){
|
||||||
if(_card.getID() == id) return;
|
if(_card.getID() === id) return;
|
||||||
if(_card.getType() != card.getType()) return;
|
if(_card.getID() === card.getID()) return;
|
||||||
|
if(_card.getType() !== card.getType()) return;
|
||||||
if(_card.hasAbility("hero")) return;
|
if(_card.hasAbility("hero")) return;
|
||||||
_card.setBoost(id, 0);
|
_card.setBoost(id, 0);
|
||||||
})
|
})
|
||||||
@ -423,7 +437,8 @@ Battleside = (function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
field.get().forEach(function(_card){
|
field.get().forEach(function(_card){
|
||||||
if(_card.getID() == id) return;
|
if(_card.getID() === id) return;
|
||||||
|
if(_card.getID() === card.getID()) return;
|
||||||
if(_card.getType() != card.getType()) return;
|
if(_card.getType() != card.getType()) return;
|
||||||
if(_card.hasAbility("hero")) return;
|
if(_card.hasAbility("hero")) return;
|
||||||
_card.setBoost(id, 0);
|
_card.setBoost(id, 0);
|
||||||
@ -524,9 +539,18 @@ Battleside = (function(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
r.checkAbilityOnAfterPlace = function(card, obj){
|
r.checkAbilityOnAfterPlace = function(card, obj, __flag){
|
||||||
var ability = card.getAbility();
|
//var ability = card.getAbility();
|
||||||
if(ability){
|
var ability = Array.isArray(__flag) ? __flag : card.getAbility();
|
||||||
|
|
||||||
|
if(Array.isArray(ability) && ability.length){
|
||||||
|
var ret = ability.slice();
|
||||||
|
ret.splice(0, 1);
|
||||||
|
this.checkAbilityOnAfterPlace(card, obj, ret);
|
||||||
|
ability = ability[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ability && !Array.isArray(ability)){
|
||||||
if(ability.name && ability.name === obj.suppress){
|
if(ability.name && ability.name === obj.suppress){
|
||||||
//this.update();
|
//this.update();
|
||||||
return;
|
return;
|
||||||
@ -582,13 +606,12 @@ Battleside = (function(){
|
|||||||
_card.setForcedPower(forcedPower);
|
_card.setForcedPower(forcedPower);
|
||||||
});
|
});
|
||||||
this.runEvent("WeatherChange");
|
this.runEvent("WeatherChange");
|
||||||
//this.update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
r.scorch = function(card){
|
r.scorch = function(card){
|
||||||
var side = this.foe;
|
var side = this.foe;
|
||||||
var field = side.field[Card.TYPE.CLOSE_COMBAT];
|
var field = side.field[Card.TYPE.CLOSE_COMBAT];
|
||||||
var cards = field.getHighestCards();
|
var cards = field.getHighestCards(true);
|
||||||
var removeCards = field.removeCard(cards);
|
var removeCards = field.removeCard(cards);
|
||||||
|
|
||||||
|
|
||||||
@ -603,9 +626,6 @@ Battleside = (function(){
|
|||||||
this.battle.sendNotification(txt);
|
this.battle.sendNotification(txt);
|
||||||
|
|
||||||
side.addToDiscard(removeCards);
|
side.addToDiscard(removeCards);
|
||||||
/*
|
|
||||||
this.hand.remove(card);
|
|
||||||
this.addToDiscard(card);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
r.clearMainFields = function(){
|
r.clearMainFields = function(){
|
||||||
@ -745,6 +765,10 @@ Battleside = (function(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r.sendNotification = function(msg) {
|
||||||
|
this.battle.sendNotification(msg);
|
||||||
|
}
|
||||||
|
|
||||||
return Battleside;
|
return Battleside;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user