Couple of bug fixes

This commit is contained in:
marcin.sciesinski
2019-09-09 08:41:16 -07:00
parent 422e64b0e7
commit 71016b88b2
4 changed files with 35 additions and 5 deletions

View File

@@ -237,7 +237,8 @@
"amount": {
"type": "printedStrengthFromMemory",
"memory": "discardedCard"
}
},
"until": "start(regroup)"
}
}
]

View File

@@ -13,8 +13,8 @@ import com.gempukku.lotro.logic.effects.PlayoutDecisionEffect;
import com.gempukku.lotro.logic.timing.Effect;
import org.json.simple.JSONObject;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.TreeSet;
public class ChooseARace implements EffectAppenderProducer {
@Override
@@ -26,7 +26,7 @@ public class ChooseARace implements EffectAppenderProducer {
return new DelayedAppender() {
@Override
protected Effect createEffect(boolean cost, CostToEffectAction action, ActionContext actionContext) {
final Set<String> possibleRaces = new LinkedHashSet<String>();
final Set<String> possibleRaces = new TreeSet<>();
for (Race race : Race.values()) {
possibleRaces.add(race.getHumanReadable());
}

View File

@@ -265,8 +265,16 @@ public class FilterFactory {
return new FilterableSource() {
@Override
public Filterable getFilterable(ActionContext actionContext) {
final String value = (String) actionContext.getSource().getWhileInZoneData();
return Race.valueOf(value);
return new Filter() {
@Override
public boolean accepts(LotroGame game, PhysicalCard physicalCard) {
final String value = (String) actionContext.getSource().getWhileInZoneData();
if (value == null)
return false;
else
return Race.valueOf(value) == physicalCard.getBlueprint().getRace();
}
};
}
};
}

View File

@@ -518,4 +518,25 @@ public class NewCardsAtTest extends AbstractAtTest {
assertEquals(Zone.DISCARD, blackBreath.getZone());
assertEquals(Zone.ATTACHED, blackBreath2.getZone());
}
@Test
public void strengthBonus() throws DecisionResultInvalidException, CardNotFoundException {
initializeSimplestGame();
final PhysicalCardImpl grimbeorn = createCard(P1, "14_6");
final PhysicalCardImpl nazgulInHand = createCard(P1, "40_211");
final PhysicalCardImpl nazgul = createCard(P2, "40_211");
_game.getGameState().addCardToZone(_game, grimbeorn, Zone.FREE_CHARACTERS);
_game.getGameState().addCardToZone(_game, nazgul, Zone.SHADOW_CHARACTERS);
_game.getGameState().addCardToZone(_game, nazgulInHand, Zone.HAND);
skipMulligans();
playerDecided(P1, "");
playerDecided(P2, "");
playerDecided(P1, "0");
playerDecided(P1, "");
}
}