- Win/lose skirmish triggers should be working now correctly.

This commit is contained in:
marcins78@gmail.com
2011-11-30 22:06:08 +00:00
parent a6cbc0fc3c
commit 1915def0ce
6 changed files with 83 additions and 5 deletions

View File

@@ -35,7 +35,11 @@ public class TriggerConditions {
}
public static boolean winsSkirmish(LotroGame game, EffectResult effectResult, Filterable... filters) {
return winsSkirmishInvolving(game, effectResult, Filters.and(filters), Filters.any);
if (effectResult.getType() == EffectResult.Type.CHARACTER_WON_SKIRMISH) {
CharacterWonSkirmishResult wonResult = (CharacterWonSkirmishResult) effectResult;
return Filters.and(filters).accepts(game.getGameState(), game.getModifiersQuerying(), wonResult.getWinner());
}
return false;
}
public static boolean winsSkirmishInvolving(LotroGame game, EffectResult effectResult, Filterable winnerFilter, Filterable involvingFilter) {
@@ -48,7 +52,11 @@ public class TriggerConditions {
}
public static boolean losesSkirmish(LotroGame game, EffectResult effectResult, Filterable... filters) {
return losesSkirmishInvolving(game, effectResult, Filters.and(filters), Filters.any);
if (effectResult.getType() == EffectResult.Type.CHARACTER_LOST_SKIRMISH) {
CharacterLostSkirmishResult wonResult = (CharacterLostSkirmishResult) effectResult;
return Filters.and(filters).accepts(game.getGameState(), game.getModifiersQuerying(), wonResult.getLoser());
}
return false;
}
public static boolean losesSkirmishInvolving(LotroGame game, EffectResult effectResult, Filterable loserFilter, Filterable involvingFilter) {

View File

@@ -29,7 +29,7 @@ import java.util.List;
*/
public class Card10_101 extends AbstractMinion {
public Card10_101() {
super(7, 14, 4, 6, Race.TROLL, Culture.SAURON, "Troll of Cirith Gorgol");
super(7, 14, 4, 6, Race.TROLL, Culture.SAURON, "Troll of Cirith Gorgor");
addKeyword(Keyword.DAMAGE, 1);
addKeyword(Keyword.FIERCE);
}

View File

@@ -4,6 +4,7 @@ import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
public class CharacterLostSkirmishResult extends EffectResult {
@@ -29,7 +30,7 @@ public class CharacterLostSkirmishResult extends EffectResult {
super(Type.CHARACTER_LOST_SKIRMISH);
_type = type;
_loser = loser;
_involving = involving;
_involving = new HashSet<PhysicalCard>(involving);
}
public Set<PhysicalCard> getInvolving() {

View File

@@ -4,6 +4,7 @@ import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
public class CharacterWonSkirmishResult extends EffectResult {
@@ -29,7 +30,7 @@ public class CharacterWonSkirmishResult extends EffectResult {
super(EffectResult.Type.CHARACTER_WON_SKIRMISH);
_type = type;
_winner = winner;
_involving = involving;
_involving = new HashSet<PhysicalCard>(involving);
}
public Set<PhysicalCard> getInvolving() {

View File

@@ -0,0 +1,67 @@
package com.gempukku.lotro.at;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.common.Zone;
import com.gempukku.lotro.game.PhysicalCardImpl;
import com.gempukku.lotro.logic.decisions.AwaitingDecision;
import com.gempukku.lotro.logic.decisions.AwaitingDecisionType;
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
import static junit.framework.Assert.assertEquals;
import org.junit.Test;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
public class TriggersAtTest extends AbstractAtTest {
@Test
public void fpCharWinsSkirmish() throws DecisionResultInvalidException {
Map<String, Collection<String>> extraCards = new HashMap<String, Collection<String>>();
initializeSimplestGame(extraCards);
PhysicalCardImpl gimli = new PhysicalCardImpl(100, "5_7", P1, _library.getLotroCardBlueprint("5_7"));
PhysicalCardImpl stoutAndStrong = new PhysicalCardImpl(101, "4_57", P1, _library.getLotroCardBlueprint("4_57"));
PhysicalCardImpl goblinRunner = new PhysicalCardImpl(102, "1_178", P2, _library.getLotroCardBlueprint("1_178"));
skipMulligans();
_game.getGameState().addCardToZone(_game, gimli, Zone.FREE_CHARACTERS);
_game.getGameState().addCardToZone(_game, stoutAndStrong, Zone.SUPPORT);
// End fellowship phase
assertEquals(Phase.FELLOWSHIP, _game.getGameState().getCurrentPhase());
playerDecided(P1, "");
_game.getGameState().addCardToZone(_game, goblinRunner, Zone.SHADOW_CHARACTERS);
// End shadow phase
assertEquals(Phase.SHADOW, _game.getGameState().getCurrentPhase());
playerDecided(P2, "");
// End maneuver phase
playerDecided(P1, "");
playerDecided(P2, "");
// End archery phase
playerDecided(P1, "");
playerDecided(P2, "");
// End assignment phase
playerDecided(P1, "");
playerDecided(P2, "");
// Assign
playerDecided(P1, gimli.getCardId() + " " + goblinRunner.getCardId());
// Start skirmish
playerDecided(P1, String.valueOf(gimli.getCardId()));
// End skirmish phase
playerDecided(P1, "");
playerDecided(P2, "");
AwaitingDecision chooseTriggersDecision = _userFeedback.getAwaitingDecision(P1);
assertEquals(AwaitingDecisionType.CARD_ACTION_CHOICE, chooseTriggersDecision.getDecisionType());
validateContents(new String[]{"" + gimli.getCardId(), "" + stoutAndStrong.getCardId()}, (String[]) chooseTriggersDecision.getDecisionParameters().get("cardId"));
}
}

View File

@@ -4,6 +4,7 @@
that character can be healed/wounded by the card at least once.
- "Narya" from Reflections now has a twilight cost of 0.
- Game history now includes also name of the format the game was played in, as well as your deck name you used in it.
- Win/lose skirmish triggers should be working now correctly.
<b>27 Nov. 2011</b>
- Characters should not die between turns.