- Update state-based actions (704_5r now fire remove counter triggers, Brother Yamazaki now work correctly with Humility)

This commit is contained in:
swordshine
2014-02-04 08:09:25 +00:00
parent 1d0b60427d
commit 21db65e9ab
2 changed files with 19 additions and 23 deletions

View File

@@ -685,7 +685,7 @@ public class GameAction {
}
/** */
public final void checkStaticAbilities() {
public final void checkStaticAbilities() { // TODO return checkagain in SBA
if (game.isGameOver()) {
return;
}
@@ -876,9 +876,8 @@ public class GameAction {
checkAgain = true;
}
boolean yamazaki = CardLists.filter(game.getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Brothers Yamazaki")).size() == 2;
for (Player p : game.getPlayers()) {
if (this.handleLegendRule(p, yamazaki)) {
if (this.handleLegendRule(p)) {
checkAgain = true;
}
@@ -1041,19 +1040,16 @@ public class GameAction {
*/
private boolean stateBasedAction704_5r(Card c) {
boolean checkAgain = false;
// +1/+1 counters should erase -1/-1 counters
if (c.getCounters(CounterType.P1P1) > 0 && c.getCounters(CounterType.M1M1) > 0) {
int plusOneCounters = c.getCounters(CounterType.P1P1);
int minusOneCounters = c.getCounters(CounterType.M1M1);
if (plusOneCounters >= minusOneCounters) c.getCounters().remove(CounterType.M1M1);
if (plusOneCounters <= minusOneCounters) c.getCounters().remove(CounterType.P1P1);
int diff = plusOneCounters - minusOneCounters;
if (diff != 0) {
CounterType ct = diff > 0 ? CounterType.P1P1 : CounterType.M1M1;
c.getCounters().put(ct, Math.abs(diff));
}
int plusOneCounters = c.getCounters(CounterType.P1P1);
int minusOneCounters = c.getCounters(CounterType.M1M1);
if (plusOneCounters > 0 && minusOneCounters > 0) {
int remove = Math.min(plusOneCounters, minusOneCounters);
// If a permanent has both a +1/+1 counter and a -1/-1 counter on it,
// N +1/+1 and N -1/-1 counters are removed from it, where N is the
// smaller of the number of +1/+1 and -1/-1 counters on it.
// This should fire remove counters trigger
c.subtractCounter(CounterType.P1P1, remove);
c.subtractCounter(CounterType.M1M1, remove);
checkAgain = true;
}
return checkAgain;
@@ -1186,16 +1182,15 @@ public class GameAction {
* destroyLegendaryCreatures.
* </p>
*/
private boolean handleLegendRule(Player p, boolean yama) {
private boolean handleLegendRule(Player p) {
final List<Card> a = CardLists.getType(p.getCardsIn(ZoneType.Battlefield), "Legendary");
if (a.isEmpty() || game.getStaticEffects().getGlobalRuleChange(GlobalRuleChange.noLegendRule)) {
return false;
}
boolean recheck = false;
if (yama) {
List<Card> yamazaki = CardLists.filter(a, CardPredicates.nameEquals("Brothers Yamazaki"));
a.removeAll(yamazaki);
}
List<Card> yamazaki = CardLists.getKeyword(a, "Legend rule doesn't apply to CARDNAME.");
a.removeAll(yamazaki);
Multimap<String, Card> uniqueLegends = ArrayListMultimap.create();
for (Card c : a) {

View File

@@ -2,8 +2,9 @@ Name:Brothers Yamazaki
ManaCost:2 R
Types:Legendary Creature Human Samurai
PT:2/1
Text:If there are exactly two permanents named CARDNAME on the battlefield, the "legend rule" doesn't apply to them.
K:Bushido 1
S:Mode$ Continuous | Affected$ Permanent.namedBrothers Yamazaki | CheckSVar$ X | SVarCompare$ EQ2 | AddHiddenKeyword$ Legend rule doesn't apply to CARDNAME. | Description$ If there are exactly two permanents named Brothers Yamazaki on the battlefield, the "legend rule" doesn't apply to them.
SVar:X:Count$Valid Permanent.namedBrothers Yamazaki
S:Mode$ Continuous | Affected$ Creature.Other+namedBrothers Yamazaki | AddPower$ 2 | AddToughness$ 2 | AddKeyword$ Haste | Description$ Each other creature named CARDNAME gets +2/+2 and has haste.
SVar:Picture:http://www.wizards.com/global/images/magic/general/brothers_yamazaki.jpg
Oracle:Bushido 1 (When this blocks or becomes blocked, it gets +1/+1 until end of turn.)\nIf there are exactly two permanents named Brothers Yamazaki on the battlefield, the "legend rule" doesn't apply to them.\nEach other creature named Brothers Yamazaki gets +2/+2 and has haste.