mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
[MOR] Fixed Shared Animosity incorrectly calculating creature count for boost effect. Closes #9428.
This commit is contained in:
parent
a29d5c70cb
commit
7e3b0f98e6
2 changed files with 76 additions and 2 deletions
|
@ -68,8 +68,9 @@ class SharedAnimosityEffect extends OneShotEffect {
|
|||
}
|
||||
FilterPermanent filter = new FilterAttackingCreature();
|
||||
filter.add(new SharesCreatureTypePredicate(permanent));
|
||||
filter.add(AnotherPredicate.instance);
|
||||
int count = game.getBattlefield().count(filter, source.getControllerId(), source, game);
|
||||
// Can't use AnotherPredicate since that compares against SharedAnimosity, not against the attacker.
|
||||
// The attacker will match with itself once for the count, so subtract 1 from the total to get the number of other creatures that fit the filter.
|
||||
int count = game.getBattlefield().count(filter, source.getControllerId(), source, game) - 1;
|
||||
if (count > 0) {
|
||||
game.addEffect(new BoostTargetEffect(
|
||||
count, 0, Duration.EndOfTurn
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
package org.mage.test.cards.single.mor;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* {@link mage.cards.s.SharedAnimosity Shared Animosity}
|
||||
* {2}{R}
|
||||
* Enchantment
|
||||
* Whenever a creature you control attacks, it gets +1/+0 until end of turn for each other attacking creature that shares a creature type with it.
|
||||
*
|
||||
* @author Alex-Vasile
|
||||
*/
|
||||
public class SharedAnimosityTest extends CardTestPlayerBase {
|
||||
|
||||
private static final String sharedAnimosity = "Shared Animosity";
|
||||
|
||||
/**
|
||||
* Reported bug: https://github.com/magefree/mage/issues/9428
|
||||
* "Shared Animosity Giving a +1/+0 to a single attacking creature,
|
||||
* Silvar, Devourer of the Free attacked alone and got the +1".
|
||||
*/
|
||||
@Test
|
||||
public void attackingAlone() {
|
||||
// 4/2
|
||||
String silvar = "Silvar, Devourer of the Free";
|
||||
addCard(Zone.BATTLEFIELD, playerA, sharedAnimosity);
|
||||
addCard(Zone.BATTLEFIELD, playerA, silvar);
|
||||
|
||||
attack(1, playerA, silvar);
|
||||
|
||||
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
assertPowerToughness(playerA, silvar, 4, 2); // Should not have gotten a boost
|
||||
assertLife(playerB, 20 - 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attack with 3 creatures.
|
||||
* One shares types with both of the others.
|
||||
* The other two only share a type with the 3rd, but not with each other.
|
||||
*/
|
||||
@Test
|
||||
public void attackingWithOthers() {
|
||||
// 4/2
|
||||
// Cat Nightmare
|
||||
String silvar = "Silvar, Devourer of the Free";
|
||||
// 2/2
|
||||
// Cat Soldier
|
||||
String ajanisPridemate = "Ajani's Pridemate";
|
||||
// 1/5
|
||||
// Gloom Pangolin
|
||||
String gloomPangolin = "Gloom Pangolin";
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, sharedAnimosity);
|
||||
addCard(Zone.BATTLEFIELD, playerA, ajanisPridemate);
|
||||
addCard(Zone.BATTLEFIELD, playerA, gloomPangolin);
|
||||
addCard(Zone.BATTLEFIELD, playerA, silvar);
|
||||
|
||||
attack(1, playerA, silvar);
|
||||
attack(1, playerA, ajanisPridemate);
|
||||
attack(1, playerA, gloomPangolin);
|
||||
|
||||
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
assertPowerToughness(playerA, silvar, 4+2, 2); // Shares with both the pridemate and the pangolin
|
||||
assertPowerToughness(playerA, ajanisPridemate, 2+1, 2); // Shares only with Silvar
|
||||
assertPowerToughness(playerA, gloomPangolin, 1+1, 5); // Shares only with Silvar
|
||||
assertLife(playerB, 20 - (4+2) - (2+1) - (1+1));
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue