mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
Can block any number of creatures - fixed that it can be broken with some of "can block an additional creature" effects
This commit is contained in:
parent
db9bdc05c2
commit
49c28458ec
6 changed files with 24 additions and 24 deletions
|
|
@ -114,7 +114,7 @@ class CamouflageEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
// (This temporarily manipulates Blocking values to "test" how many blockers the creature has still left to assign)
|
||||
List<Permanent> spentBlockers = new ArrayList<>();
|
||||
for (Permanent possibleBlocker : list) {
|
||||
if (possibleBlocker.getMaxBlocks() != 0 && possibleBlocker.getBlocking() >= possibleBlocker.getMaxBlocks()) {
|
||||
if (possibleBlocker.getMaxBlocks() > 0 && possibleBlocker.getBlocking() >= possibleBlocker.getMaxBlocks()) {
|
||||
spentBlockers.add(possibleBlocker);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
|
@ -9,28 +8,22 @@ import mage.abilities.costs.mana.ManaCostsImpl;
|
|||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.PreventCombatDamageToSourceEffect;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author NinthWorld
|
||||
*/
|
||||
public final class ChirrutImwe extends CardImpl {
|
||||
|
||||
public ChirrutImwe(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}{W}{U}");
|
||||
|
||||
|
||||
this.supertype.add(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.MONK);
|
||||
|
|
@ -39,7 +32,7 @@ public final class ChirrutImwe extends CardImpl {
|
|||
|
||||
// Chirrut Imwe can block up to two additional creatures.
|
||||
this.addAbility(new SimpleStaticAbility(new ChirrutImweEffect()));
|
||||
|
||||
|
||||
// {1}{W}: Prevent all combat damage that would be dealt to Chirrut Imwe until end of turn.
|
||||
Effect effect = new PreventCombatDamageToSourceEffect(Duration.EndOfTurn);
|
||||
effect.setText("Prevent all combat damage that would be dealt to {this} until end of turn");
|
||||
|
|
@ -57,29 +50,29 @@ public final class ChirrutImwe extends CardImpl {
|
|||
}
|
||||
|
||||
class ChirrutImweEffect extends ContinuousEffectImpl {
|
||||
|
||||
|
||||
public ChirrutImweEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||
staticText = "{this} can block up to two additional creatures";
|
||||
}
|
||||
|
||||
|
||||
private ChirrutImweEffect(final ChirrutImweEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ChirrutImweEffect copy() {
|
||||
return new ChirrutImweEffect(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
Permanent perm = game.getPermanent(source.getSourceId());
|
||||
if(perm != null) {
|
||||
switch(layer) {
|
||||
if (perm != null) {
|
||||
switch (layer) {
|
||||
case RulesEffects:
|
||||
// maxBlocks = 0 equals to "can block any number of creatures"
|
||||
if(perm.getMaxBlocks() > 0) {
|
||||
if (perm.getMaxBlocks() > 0) {
|
||||
perm.setMaxBlocks(perm.getMaxBlocks() + 2);
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -2049,7 +2049,8 @@ public class TestPlayer implements Player {
|
|||
int numBlocked = blocked.size();
|
||||
|
||||
// Can't block any more creatures
|
||||
if (++numBlocked > blocker.getMaxBlocks()) {
|
||||
// maxBlocks = 0 equals to "can block any number of creatures"
|
||||
if (blocker.getMaxBlocks() > 0 && ++numBlocked > blocker.getMaxBlocks()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,9 @@ public class CanBlockAdditionalCreatureAllEffect extends ContinuousEffectImpl {
|
|||
if (permanent != null) {
|
||||
// maxBlocks = 0 equals to "can block any number of creatures"
|
||||
if (amount > 0) {
|
||||
permanent.setMaxBlocks(permanent.getMaxBlocks() + amount);
|
||||
if (permanent.getMaxBlocks() > 0) {
|
||||
permanent.setMaxBlocks(permanent.getMaxBlocks() + amount);
|
||||
}
|
||||
} else {
|
||||
permanent.setMaxBlocks(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,9 @@ public class CanBlockAdditionalCreatureEffect extends ContinuousEffectImpl {
|
|||
if (permanent != null) {
|
||||
// maxBlocks = 0 equals to "can block any number of creatures"
|
||||
if (amount > 0) {
|
||||
permanent.setMaxBlocks(permanent.getMaxBlocks() + amount);
|
||||
if (permanent.getMaxBlocks() > 0) {
|
||||
permanent.setMaxBlocks(permanent.getMaxBlocks() + amount);
|
||||
}
|
||||
} else {
|
||||
permanent.setMaxBlocks(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,9 @@ public class CanBlockAdditionalCreatureTargetEffect extends ContinuousEffectImpl
|
|||
|
||||
// maxBlocks = 0 equals to "can block any number of creatures"
|
||||
if (amount > 0) {
|
||||
target.setMaxBlocks(target.getMaxBlocks() + amount);
|
||||
if (target.getMaxBlocks() > 0) {
|
||||
target.setMaxBlocks(target.getMaxBlocks() + amount);
|
||||
}
|
||||
} else {
|
||||
target.setMaxBlocks(0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue