Skip to content

Commit

Permalink
Some minor changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
LevelX2 committed Mar 17, 2018
1 parent 711fa7d commit 442130b
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,13 @@ private boolean priorityPlay(Game game) {
pass(game);
return false;
case DECLARE_ATTACKERS:
if (!game.getActivePlayerId().equals(playerId)) {
printOutState(game);
if (actions.isEmpty()) {
logger.info("Sim Calculate declare attackers actions ----------------------------------------------------- ");
calculateActions(game);
}
act(game);
return true;
} else {
pass(game);
printOutState(game);
if (actions.isEmpty()) {
logger.info("Sim Calculate declare attackers actions ----------------------------------------------------- ");
calculateActions(game);
}
return false;
act(game);
return true;
case DECLARE_BLOCKERS:
printOutState(game);
if (actions.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
private static final Logger log = Logger.getLogger(ComputerPlayer.class);

protected int PASSIVITY_PENALTY = 5; // Penalty value for doing nothing if some actions are availble
protected boolean ALLOW_INTERRUPT = true; // change this for test / debugging purposes to false to switch off interrupts while debugging
protected boolean ALLOW_INTERRUPT = true; // change this for test to false / debugging purposes to false to switch off interrupts while debugging

private transient Map<Mana, Card> unplayable = new TreeMap<>();
private transient List<Card> playableNonInstant = new ArrayList<>();
Expand Down
4 changes: 2 additions & 2 deletions Mage.Sets/src/mage/cards/d/DivineVerdict.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
public class DivineVerdict extends CardImpl {

public DivineVerdict(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{W}");

super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{W}");

// Destroy target attacking or blocking creature.
this.getSpellAbility().addTarget(new TargetCreaturePermanent(new FilterAttackingOrBlockingCreature()));
this.getSpellAbility().addEffect(new DestroyTargetEffect());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void testSimpleCast() {
* first creature
*/
@Test
// TODO: find out why sometimes Produces error probably because of wrong mana usage of the AI - Not solved yet
// TODO: Find out why sometimes this produces an error - probably because of wrong mana usage of the AI - Not solved yet
public void testSimpleCast2() {
addCard(Zone.HAND, playerA, "Silvercoat Lion");
addCard(Zone.HAND, playerA, "Silvercoat Lion");
Expand All @@ -67,6 +67,8 @@ public void testSimpleCast2() {
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();

assertTappedCount("Plains", true, 2);
assertTappedCount("Mountain", true, 2);
assertPermanentCount(playerA, "Silvercoat Lion", 2);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,26 @@ public void testOrzhovCharm() {
assertGraveyardCount(playerB, "Silvercoat Lion", 1);
}

/**
* Cast Divine Verdict if the opponent attacks
*/
@Test
public void testCastSpellTargingAttacker() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);

// Destroy target attacking or blocking creature.
addCard(Zone.HAND, playerA, "Divine Verdict"); // INSTANT {3}{W}

addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");

attack(2, playerB, "Silvercoat Lion");

setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
execute();

assertLife(playerA, 20);

assertGraveyardCount(playerA, "Divine Verdict", 1);
assertGraveyardCount(playerB, "Silvercoat Lion", 1);
}
}
4 changes: 3 additions & 1 deletion Mage/src/main/java/mage/game/permanent/PermanentImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,9 @@ public boolean imprint(UUID imprintedCard, Game game) {
return false;
}
if (connectedCards.containsKey("imprint")) {
this.connectedCards.get("imprint").add(imprintedCard);
if (!this.connectedCards.get("imprint").contains(imprintedCard)) {
this.connectedCards.get("imprint").add(imprintedCard);
}
} else {
List<UUID> imprinted = new ArrayList<>();
imprinted.add(imprintedCard);
Expand Down

0 comments on commit 442130b

Please sign in to comment.