mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Improved implementation of DeckSection Matching
Previous implementation was lacking to check for commander section, plus re-used the code of validators. This one is a refined and refactored implementation. Note: as default, the method will always return Main, as there is no possibility, in general, to say whether Sideboard should be preferred instead - without any other knowledge about the deck. Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
This commit is contained in:
@@ -31,15 +31,16 @@ public enum DeckSection {
|
||||
|
||||
// Returns the matching section for "special"/supplementary core types.
|
||||
public static DeckSection matchingSection(PaperCard card){
|
||||
CardType t = card.getRules().getType();
|
||||
if (t.isConspiracy())
|
||||
if (DeckSection.Conspiracy.validate(card))
|
||||
return Conspiracy;
|
||||
if (t.isScheme())
|
||||
if (DeckSection.Schemes.validate(card))
|
||||
return Schemes;
|
||||
if (t.isVanguard())
|
||||
if (DeckSection.Avatar.validate(card))
|
||||
return Avatar;
|
||||
if (t.isPlane() || t.isPhenomenon() | t.isDungeon())
|
||||
if (DeckSection.Planes.validate(card))
|
||||
return Planes;
|
||||
if (DeckSection.Commander.validate(card))
|
||||
return Commander;
|
||||
return Main; // default
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user