mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38: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.
|
// Returns the matching section for "special"/supplementary core types.
|
||||||
public static DeckSection matchingSection(PaperCard card){
|
public static DeckSection matchingSection(PaperCard card){
|
||||||
CardType t = card.getRules().getType();
|
if (DeckSection.Conspiracy.validate(card))
|
||||||
if (t.isConspiracy())
|
|
||||||
return Conspiracy;
|
return Conspiracy;
|
||||||
if (t.isScheme())
|
if (DeckSection.Schemes.validate(card))
|
||||||
return Schemes;
|
return Schemes;
|
||||||
if (t.isVanguard())
|
if (DeckSection.Avatar.validate(card))
|
||||||
return Avatar;
|
return Avatar;
|
||||||
if (t.isPlane() || t.isPhenomenon() | t.isDungeon())
|
if (DeckSection.Planes.validate(card))
|
||||||
return Planes;
|
return Planes;
|
||||||
|
if (DeckSection.Commander.validate(card))
|
||||||
|
return Commander;
|
||||||
return Main; // default
|
return Main; // default
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user