mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
- Remove keyword "CARDNAME can't attack if defending player controls an untapped"
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
package forge.game.combat;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Lists;
|
||||
import forge.card.CardType;
|
||||
import forge.card.MagicColor;
|
||||
@@ -854,51 +853,6 @@ public class CombatUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
Player defendingPlayer = null;
|
||||
if (defender instanceof Card) {
|
||||
defendingPlayer = ((Card) defender).getController();
|
||||
} else {
|
||||
defendingPlayer = (Player) defender;
|
||||
}
|
||||
|
||||
// CARDNAME can't attack if defending player controls an untapped
|
||||
// creature with power ...
|
||||
final int[] powerLimit = { 0 };
|
||||
String cantAttackKw = null;
|
||||
|
||||
for( String kw : c.getKeyword()) {
|
||||
if (kw.startsWith("CARDNAME can't attack if defending player controls an untapped creature with power")) {
|
||||
cantAttackKw = kw;
|
||||
}
|
||||
}
|
||||
|
||||
// The keyword
|
||||
// "CARDNAME can't attack if defending player controls an untapped creature with power"
|
||||
// ... is present
|
||||
if (cantAttackKw != null) {
|
||||
final String[] asSeparateWords = cantAttackKw.trim().split(" ");
|
||||
|
||||
if (asSeparateWords.length >= 15) {
|
||||
if (StringUtils.isNumeric(asSeparateWords[12])) {
|
||||
powerLimit[0] = Integer.parseInt((asSeparateWords[12]).trim());
|
||||
|
||||
List<Card> list = defendingPlayer.getCreaturesInPlay();
|
||||
list = CardLists.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card ct) {
|
||||
return (ct.isUntapped()
|
||||
&& ((ct.getNetAttack() >= powerLimit[0] && asSeparateWords[14].contains("greater"))
|
||||
|| (ct.getNetAttack() <= powerLimit[0] && asSeparateWords[14].contains("less"))));
|
||||
}
|
||||
});
|
||||
if (!list.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // hasKeyword = CARDNAME can't attack if defending player controls an
|
||||
// untapped creature with power ...
|
||||
|
||||
for (String keyword : c.getKeyword()) {
|
||||
if (keyword.equals("CARDNAME can't attack.") || keyword.equals("CARDNAME can't attack or block.")) {
|
||||
return false;
|
||||
|
||||
@@ -13,7 +13,6 @@ import forge.card.mana.ManaCostShard;
|
||||
import forge.game.Game;
|
||||
import forge.game.ability.AbilityUtils;
|
||||
import forge.game.card.Card;
|
||||
import forge.game.card.CardFactoryUtil;
|
||||
import forge.game.card.CardLists;
|
||||
import forge.game.card.CardPredicates;
|
||||
import forge.game.player.Player;
|
||||
|
||||
@@ -58,14 +58,22 @@ public class StaticAbilityCantAttackBlock {
|
||||
return false;
|
||||
}
|
||||
|
||||
final Player defender = target instanceof Card ? ((Card) target).getController() : (Player) target;
|
||||
|
||||
if (params.containsKey("UnlessDefenderControls")) {
|
||||
String type = params.get("UnlessDefenderControls");
|
||||
Player defender = target instanceof Card ? ((Card) target).getController() : (Player) target;
|
||||
List<Card> list = defender.getCardsIn(ZoneType.Battlefield);
|
||||
if (Iterables.any(list, CardPredicates.restriction(type.split(","), hostCard.getController(), hostCard))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (params.containsKey("IfDefenderControls")) {
|
||||
String type = params.get("IfDefenderControls");
|
||||
List<Card> list = defender.getCardsIn(ZoneType.Battlefield);
|
||||
if (!Iterables.any(list, CardPredicates.restriction(type.split(","), hostCard.getController(), hostCard))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2,9 +2,8 @@ Name:Branded Brawlers
|
||||
ManaCost:R
|
||||
Types:Creature Human Soldier
|
||||
PT:2/2
|
||||
S:Mode$ Continuous | Affected$ Card.Self | AddHiddenKeyword$ CARDNAME can't attack. | CheckSVar$ X | SVarCompare$ GE1 | Description$ CARDNAME can't attack if defending player controls an untapped land.
|
||||
S:Mode$ CantAttack | ValidCard$ Card.Self | IfDefenderControls$ Land.untapped | Description$ CARDNAME can't attack if defending player controls an untapped land.
|
||||
S:Mode$ Continuous | Affected$ Card.Self | AddHiddenKeyword$ CARDNAME can't block. | CheckSVar$ Y | SVarCompare$ GE1 | Description$ CARDNAME can't block if you control an untapped land.
|
||||
SVar:X:Count$Valid Land.YouDontCtrl+untapped
|
||||
SVar:Y:Count$Valid Land.YouCtrl+untapped
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/branded_brawlers.jpg
|
||||
Oracle:Branded Brawlers can't attack if defending player controls an untapped land.\nBranded Brawlers can't block if you control an untapped land.
|
||||
@@ -3,7 +3,7 @@ ManaCost:2 R R
|
||||
Types:Creature Goblin Mutant
|
||||
PT:5/3
|
||||
K:Trample
|
||||
K:CARDNAME can't attack if defending player controls an untapped creature with power 3 or greater.
|
||||
S:Mode$ CantAttack | ValidCard$ Card.Self | IfDefenderControls$ Creature.untapped+powerGE3 | Description$ CARDNAME can't attack if defending player controls an untapped creature with power 3 or greater.
|
||||
K:CantBlock Creature.powerGE3:creatures with power 3 or greater
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/goblin_mutant.jpg
|
||||
Oracle:Trample\nGoblin Mutant can't attack if defending player controls an untapped creature with power 3 or greater.\nGoblin Mutant can't block creatures with power 3 or greater.
|
||||
@@ -2,6 +2,6 @@ Name:Mogg Jailer
|
||||
ManaCost:1 R
|
||||
Types:Creature Goblin
|
||||
PT:2/2
|
||||
K:CARDNAME can't attack if defending player controls an untapped creature with power 2 or less.
|
||||
S:Mode$ CantAttack | ValidCard$ Card.Self | IfDefenderControls$ Creature.untapped+powerLE2 | Description$ CARDNAME can't attack if defending player controls an untapped creature with power 2 or less.
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/mogg_jailer.jpg
|
||||
Oracle:Mogg Jailer can't attack if defending player controls an untapped creature with power 2 or less.
|
||||
@@ -3,7 +3,7 @@ ManaCost:3 R R
|
||||
Types:Creature Orgg
|
||||
PT:6/6
|
||||
K:Trample
|
||||
K:CARDNAME can't attack if defending player controls an untapped creature with power 3 or greater.
|
||||
S:Mode$ CantAttack | ValidCard$ Card.Self | IfDefenderControls$ Creature.untapped+powerGE3 | Description$ CARDNAME can't attack if defending player controls an untapped creature with power 3 or greater.
|
||||
K:CantBlock Creature.powerGE3:creatures with power 3 or greater
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/orgg.jpg
|
||||
Oracle:Trample\nOrgg can't attack if defending player controls an untapped creature with power 3 or greater.\nOrgg can't block creatures with power 3 or greater.
|
||||
@@ -2,9 +2,8 @@ Name:Veteran Brawlers
|
||||
ManaCost:1 R
|
||||
Types:Creature Human Soldier
|
||||
PT:4/4
|
||||
S:Mode$ Continuous | Affected$ Card.Self | AddHiddenKeyword$ CARDNAME can't attack. | CheckSVar$ X | SVarCompare$ GE1 | Description$ CARDNAME can't attack if defending player controls an untapped land.
|
||||
S:Mode$ CantAttack | ValidCard$ Card.Self | IfDefenderControls$ Land.untapped | Description$ CARDNAME can't attack if defending player controls an untapped land.
|
||||
S:Mode$ Continuous | Affected$ Card.Self | AddHiddenKeyword$ CARDNAME can't block. | CheckSVar$ Y | SVarCompare$ GE1 | Description$ CARDNAME can't block if you control an untapped land.
|
||||
SVar:X:Count$Valid Land.YouDontCtrl+untapped
|
||||
SVar:Y:Count$Valid Land.YouCtrl+untapped
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/veteran_brawlers.jpg
|
||||
Oracle:Veteran Brawlers can't attack if defending player controls an untapped land.\nVeteran Brawlers can't block if you control an untapped land.
|
||||
Reference in New Issue
Block a user