-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.js
67 lines (61 loc) · 2.1 KB
/
setup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
var turns = [];
var findCard = function(cards,cardNumber){
return cards.find(function(card) {
return card.id == cardNumber - 1;
});
}
var roundTracker = function(){
var roundCard = $('span#card-id').text()+'';
$('#last-played-card').text(roundCard);
$('#current-card-number').show();
$('#ccard div.message-header').text('Combat Card');
turns.push(roundCard);
var msg = 'turn '+(turns.length)+', card #'+roundCard;
if( findCard(cards,roundCard).star ) msg += ', advancing track';
console.log( msg );
if (phase == 1) console.log( turns );
$('#turn-info').text('Turn '+turns.length);
$('.centered-cardmeta').attr(
'title',
'Last 5 cards (non-combat): '+turns.slice(-6).reverse().join(', '));
var decklist = '';
for(var card of deck){
decklist += (card.id + 1) + ' ';
}
console.log(decklist);
}
// turn tracker
$('#playcombatcard').click(function(){
var combatCardNumber = discards.battle[discards.battle.length-1].id + 1;
$('#ccard div.message-header').text('Combat Card #'+combatCardNumber);
});
$('#playcard').click( roundTracker );
$('#checklastcard').click( function(){
$('#last-played-card').text($('span#card-id').text()+'');
$('#ccard div.message-header').text('Combat Card');
$('#checklastcard').hide();
$('#showpresentcard').show();
});
$('#showpresentcard').hide();
$('#showpresentcard').click( function(){
if ( ! discards.main.length ){ return false; }
var card = discards.main[discards.main.length - 1];
renderNormal(card,phase);
renderCombat(card);
renderIsCombat(false);
renderCardPhase(phase);
$('#last-played-card').text($('span#card-id').text()+'');
$('#ccard div.message-header').text('Combat Card');
$('#checklastcard').removeAttr('disabled').show();
$('#showpresentcard').hide();
});
// reset
$('#reset').click(function(){
turns.length = 0; $('#tracker').attr('title','');
$('#current-card-number').hide();
$('span#card-id').text('');
$('#showpresentcard').hide();
$('#checklastcard').show().attr('disabled','disabled');
});
$('#current-card-number').hide().append('<span id="last-played-card"></span>');
$('span#card-id').hide();