Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions assets/js/app.deck.js
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,31 @@
}
return true;
};
var validate_bloody_mummers = function() {
var plots = deck.get_cards(null, { type_code: 'plot' });
var re = new RegExp(Translator.trans('card.traits.kingdom') + '\\.');
var rhett = true;
plots.forEach(function(plot) {
if (re.test(plot.traits)) {
rhett = false;
}
})
return rhett;
};
var validate_many_faced_god = function() {
var characters = deck.get_cards(null, { type_code: 'character' });
var traitlessCharacterCount = 0;
for (i = 0, n = characters.length; i < n; i++) {
if (! characters[i].traits) {
traitlessCharacterCount += characters[i].indeck;
}
if (3 <= traitlessCharacterCount) {
return true;
}
}
return 3 <= traitlessCharacterCount;
};

switch(agenda.code) {
case '01027':
if(deck.get_nb_cards(deck.get_cards(null, {type_code: {$in: ['character', 'attachment', 'location', 'event']}, faction_code: 'neutral'})) > 15) {
Expand Down Expand Up @@ -1259,8 +1284,6 @@
return false;
}
break;
case '17150':
return validate_redesigned_the_free_folk();
case '13099':
return validate_the_white_book();
case '13118':
Expand All @@ -1271,6 +1294,12 @@
return validate_dark_wings_dark_words();
case '17149':
return validate_redesigned_sea_of_blood();
case '17150':
return validate_redesigned_the_free_folk();
case '20051':
return validate_bloody_mummers();
case '20052':
return validate_many_faced_god();
}
return true;
};
Expand Down
42 changes: 42 additions & 0 deletions src/Services/DeckValidationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ protected function validateAgenda(SlotCollectionInterface $slots, CardInterface
return $this->validateRedesignedSeaOfBlood($slots);
case '17150':
return $this->validateRedesignedFreeFolk($slots);
case '20051':
return $this->validateBloodyMummers($slots);
case '20052':
return $this->validateManyFacedGod($slots);
default:
return true;
}
Expand Down Expand Up @@ -529,4 +533,42 @@ protected function validateDarkWingsDarkWords(SlotCollectionInterface $slots): b
}
return true;
}

/**
* @param SlotCollectionInterface $slots
* @return bool
*/
protected function validateBloodyMummers(SlotCollectionInterface $slots): bool
{
$plotSlots = $slots->getPlotDeck();
$trait = $this->translator->trans('card.traits.kingdom');
/* @var SlotInterface $slot */
foreach ($plotSlots as $slot) {
if (preg_match("/$trait\\./", $slot->getCard()->getTraits())) {
return false;
}
}
return true;
}

/**
* @param SlotCollectionInterface $slots
* @return bool
*/
protected function validateManyFacedGod(SlotCollectionInterface $slots): bool
{
$characterSlots = $slots->getDrawDeck()->filterByType('character');
$traitlessCharactersCount = 0;
/* @var SlotInterface $slot */
foreach ($characterSlots as $slot) {
if (! $slot->getCard()->getTraits()) {
$traitlessCharactersCount += $slot->getQuantity();
}
if (3 <= $traitlessCharactersCount) {
return true;
}
}

return 3 <= $traitlessCharactersCount;
}
}
1 change: 1 addition & 0 deletions translations/messages.de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ card:
scheme: Komplott
banner: Banner
maester: Maester
kingdom: Königreich
kingsguard: Königsgarde
wildling: Wildling
reviews:
Expand Down
1 change: 1 addition & 0 deletions translations/messages.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ card:
scheme: Scheme
banner: Banner
maester: Maester
kingdom: Kingdom
kingsguard: Kingsguard
wildling: Wildling
reviews:
Expand Down
1 change: 1 addition & 0 deletions translations/messages.es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ card:
scheme: Conspiración
banner: Estandarte
maester: Maestre
kingdom: Reino
kingsguard: Guardia Real
wildling: Salvaje
reviews:
Expand Down