public static int parseEnum(String tag) { try { int value = Integer.parseInt(tag); return value; } catch (Exception e) { } return Step.valueOf(tag).getIntValue(); } }
public static int parseEnum(String tag) { try { int value = Integer.parseInt(tag); return value; } catch (Exception e) { } return PlayState.valueOf(tag).getIntValue(); } }
public static int parseEnum(String tag) { try { int value = Integer.parseInt(tag); return value; } catch (Exception e) { } return Mulligan.valueOf(tag).getIntValue(); } }
public static int parseEnum(String tag) { try { int value = Integer.parseInt(tag); return value; } catch (Exception e) { } return GameTag.valueOf(tag).getIntValue(); }
private static Map<Integer, Class> buildTags() { Map<Integer, Class> tags = new HashMap<>(); tags.put(GameTag.CARDTYPE.getIntValue(), CardType.class); tags.put(GameTag.CLASS.getIntValue(), CardClass.class); tags.put(GameTag.FACTION.getIntValue(), Faction.class); tags.put(GameTag.PLAYSTATE.getIntValue(), PlayState.class); tags.put(GameTag.RARITY.getIntValue(), Rarity.class); tags.put(GameTag.MULLIGAN_STATE.getIntValue(), Mulligan.class); tags.put(GameTag.NEXT_STEP.getIntValue(), Step.class); tags.put(GameTag.STATE.getIntValue(), State.class); tags.put(GameTag.STEP.getIntValue(), Step.class); tags.put(GameTag.ZONE.getIntValue(), Zone.class); return tags; }
public static int parseEnum(String tag) { try { int value = Integer.parseInt(tag); return value; } catch (Exception e) { } return State.valueOf(tag).getIntValue(); } }
public static int parseEnum(String tag) { try { int value = Integer.parseInt(tag); return value; } catch (Exception e) { } return OptionType.valueOf(tag).getIntValue(); } }
public static int parseEnum(String tag) { try { int value = Integer.parseInt(tag); return value; } catch (Exception e) { } return ChoiceType.valueOf(tag).getIntValue(); }
public static int parseEnum(String tag) { try { int value = Integer.parseInt(tag); return value; } catch (Exception e) { } return CardType.valueOf(tag).getIntValue(); }
public static int parseEnum(String tag) { try { int value = Integer.parseInt(tag); return value; } catch (Exception e) { } return PlayReq.valueOf(tag).getIntValue(); }
public static int parseEnum(String tag) { try { int value = Integer.parseInt(tag); return value; } catch (Exception e) { } return Faction.valueOf(tag).getIntValue(); } }
public static int parseEnum(String tag) { try { int value = Integer.parseInt(tag); return value; } catch (Exception e) { } return Zone.valueOf(tag).getIntValue(); } }
public static int parseEnum(String tag) { try { int value = Integer.parseInt(tag); return value; } catch (Exception e) { } return CardClass.valueOf(tag).getIntValue(); }
public static int parseEnum(String tag) { try { int value = Integer.parseInt(tag); return value; } catch (Exception e) { } return PowSubType.valueOf(tag).getIntValue(); } }
public static int parseEnum(String tag) { try { int value = Integer.parseInt(tag); return value; } catch (Exception e) { } return Rarity.valueOf(tag).getIntValue(); } }
public static int parseEnum(String tag) { try { int value = Integer.parseInt(tag); return value; } catch (Exception e) { } int returnValue = -1; try { returnValue = MetaDataType.valueOf(tag).getIntValue(); } catch (Exception e) { log.error("Unkown MetaDataType: " + tag, e); } return returnValue; }
public static GameTag fromInt(final int value) { return Arrays.asList(GameTag.values()).stream().filter(t -> (t.intValue == value)).findFirst().get(); }
public static PlayReq fromInt(final int value) { return Arrays.asList(PlayReq.values()).stream().filter(t -> (t.intValue == value)).findFirst().get(); } }
private int getTag(List<Tag> tags, GameTag tag) { return tags.stream() .filter(t -> t.getName() == tag.getIntValue()) .findFirst() .map(Tag::getValue) .orElse(-1); }
public void read(TagChange data) { // Start turn if (data.getEntity() == 1 && data.getName() == GameTag.TURN.getIntValue()) { events.turnStart(data.getValue()); } // PREDAMAGE is how much damage should be applied. This includes damage // taken from the armor, while DAMAGE doesn't include armor loss if (data.getName() == GameTag.PREDAMAGE.getIntValue()) { if (data.getValue() > 0 && data.getEntity() != 1) { BaseEntity entity = helper.getEntity(data.getEntity()); events.damageTaken(entity, data.getValue()); } } // Some things still happen after the PLAYSTATE change to WON/LOST/TIED, // so we need to use this // Only raise a single gameEnd event if (data.getName() == GameTag.GOLD_REWARD_STATE.getIntValue() && data.getEntity() == 2) { events.gameEnd(); } } }