Skip to content

Commit

Permalink
Temporary Truce (SoH 119) implemented. Fixes fafranco82#287
Browse files Browse the repository at this point in the history
  • Loading branch information
fafranco82 committed Oct 7, 2019
1 parent 5b822f7 commit 5364f69
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
18 changes: 18 additions & 0 deletions src/AppBundle/Helper/DeckValidationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ public function canIncludeCard(SlotCollectionProviderInterface $deck, $card) {
}
}

// Temporary Truce (SoH #119) special case
if($deck->getSlots()->getSlotByCode('11119') != NULL) {
return true;
}

return false;
}

Expand Down Expand Up @@ -194,6 +199,19 @@ public function checkPlots(SlotCollectionProviderInterface $deck)
return false;

return true;
//Temporary Truce (SoH 119)
case '11119':
if(some($deck->getSlots()->getDrawDeck()->getSlots(), function($slot) {
return $slot->getCard()->getFaction()->getCode() == 'gray';
}))
return false;

if(some($deck->getSlots()->getCharacterDeck()->getSlots(), function($slot) {
return $slot->getCard()->getName() !== 'Rey' && $slot->getCard()->getName() !== 'Kylo Ren';
}))
return false;

return true;
default:
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@
</div>
</div>
<div class="row">
{{#if (deck.get_plot_points)}}
{{#with (cards "type_code" "plot")}}
<div class="col-sm-3">
<div>
{{#with (cards "type_code" "plot")}}
<h5><span class="icon icon-plot"></span> {{this.0.type_name}} ({{nb_cards this}})</h5>
<div class="plot-deck-list">
{{#each this}}
Expand All @@ -67,10 +66,9 @@
</div>
{{/each}}
</div>
{{/with}}
</div>
</div>
{{/if}}
{{/with}}
<div class="col-sm-9">
<div>
{{#with (deck.get_character_row_data)}}
Expand Down
12 changes: 12 additions & 0 deletions src/AppBundle/Resources/public/js/app.deck.js
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,13 @@ var plotChecks = {
indeck: {cards: {$gt: 1}}
});
return factions.length == 1 && cards.length == 0;
},
//Temporarty Truce (SoH 119)
'11119': function() {
var greys = deck.get_draw_deck().filter(card => card.faction_code=='gray');
var nonReylo = deck.get_cards(null, {type_code: 'character', name: {$nin: ['Rey', 'Kylo Ren']}});

return greys.length+nonReylo.length == 0;
}
};

Expand Down Expand Up @@ -730,6 +737,11 @@ deck.can_include_card = function can_include_card(card) {
return true;
}

// Temporary Truce (SoH #119) special case
if(deck.is_included('11119')) {
return true;
}

// if none above => no
return false;
}
Expand Down

0 comments on commit 5364f69

Please sign in to comment.