mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
Merge branch 'master' of https://github.com/tre3qwerty/mage
This commit is contained in:
commit
d4be72e396
118 changed files with 9073 additions and 2043 deletions
|
|
@ -315,7 +315,8 @@ public abstract class AbilityImpl implements Ability {
|
|||
VariableManaCost variableManaCost = handleManaXCosts(game, noMana, controller);
|
||||
String announceString = handleOtherXCosts(game, controller);
|
||||
// For effects from cards like Void Winnower x costs have to be set
|
||||
if (game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.CAST_SPELL_LATE, getId(), getSourceId(), getControllerId()), this)) {
|
||||
if (this.getAbilityType().equals(AbilityType.SPELL)
|
||||
&& game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.CAST_SPELL_LATE, getId(), getSourceId(), getControllerId()), this)) {
|
||||
return false;
|
||||
}
|
||||
for (Mode mode : this.getModes().getSelectedModes()) {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ import mage.game.events.ZoneChangeEvent;
|
|||
public class LeavesBattlefieldTriggeredAbility extends ZoneChangeTriggeredAbility {
|
||||
|
||||
public LeavesBattlefieldTriggeredAbility(Effect effect, boolean optional) {
|
||||
super(Zone.BATTLEFIELD, null, effect, "When {this} leaves the battlefield, ", optional);
|
||||
super(Zone.ALL, Zone.BATTLEFIELD, null, effect, "When {this} leaves the battlefield, ", optional);
|
||||
}
|
||||
|
||||
public LeavesBattlefieldTriggeredAbility(LeavesBattlefieldTriggeredAbility ability) {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ import mage.game.Game;
|
|||
public class MultipliedValue implements DynamicValue {
|
||||
|
||||
private final DynamicValue value;
|
||||
private final int multplier;
|
||||
private final int multplier; // should be renamed to multiplier but don't want to break your stuff
|
||||
|
||||
public MultipliedValue(DynamicValue value, int multiplier) {
|
||||
this.value = value.copy();
|
||||
|
|
|
|||
|
|
@ -50,8 +50,9 @@ public class BlockedCreatureCount implements DynamicValue {
|
|||
this(message, false);
|
||||
}
|
||||
|
||||
public BlockedCreatureCount(String message, boolean beyondTheFist) {
|
||||
public BlockedCreatureCount(String message, boolean beyondTheFirst) {
|
||||
this.message = message;
|
||||
//this.beyondTheFirst = beyondTheFirst; this was never set in the original, so not setting here just in case ??
|
||||
}
|
||||
|
||||
public BlockedCreatureCount(final BlockedCreatureCount dynamicValue) {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@
|
|||
*/
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -45,8 +47,10 @@ import mage.game.permanent.Permanent;
|
|||
*/
|
||||
public class DontUntapInControllersNextUntapStepTargetEffect extends ContinuousRuleModifyingEffectImpl {
|
||||
|
||||
private int validForTurnNum;
|
||||
private UUID onlyIfControlledByPlayer;
|
||||
private String targetName;
|
||||
// holds the info what target was already handled in Untap of its controller
|
||||
private final Map<UUID, Boolean> handledTargetsDuringTurn = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Attention: This effect won't work with targets controlled by different
|
||||
|
|
@ -55,19 +59,30 @@ public class DontUntapInControllersNextUntapStepTargetEffect extends ContinuousR
|
|||
*
|
||||
*/
|
||||
public DontUntapInControllersNextUntapStepTargetEffect() {
|
||||
super(Duration.Custom, Outcome.Detriment, false, true);
|
||||
this("");
|
||||
}
|
||||
|
||||
public DontUntapInControllersNextUntapStepTargetEffect(String targetName) {
|
||||
this();
|
||||
this(targetName, null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param targetName used as target text for the generated rule text
|
||||
* @param onlyIfControlledByPlayer the effect only works if the permanent is
|
||||
* controlled by that controller, null = it works for all players
|
||||
*/
|
||||
public DontUntapInControllersNextUntapStepTargetEffect(String targetName, UUID onlyIfControlledByPlayer) {
|
||||
super(Duration.Custom, Outcome.Detriment, false, true);
|
||||
this.targetName = targetName;
|
||||
this.onlyIfControlledByPlayer = onlyIfControlledByPlayer;
|
||||
}
|
||||
|
||||
public DontUntapInControllersNextUntapStepTargetEffect(final DontUntapInControllersNextUntapStepTargetEffect effect) {
|
||||
super(effect);
|
||||
this.validForTurnNum = effect.validForTurnNum;
|
||||
this.targetName = effect.targetName;
|
||||
|
||||
this.handledTargetsDuringTurn.putAll(effect.handledTargetsDuringTurn);
|
||||
this.onlyIfControlledByPlayer = effect.onlyIfControlledByPlayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -97,42 +112,40 @@ public class DontUntapInControllersNextUntapStepTargetEffect extends ContinuousR
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
// the check for turn number is needed if multiple effects are added to prevent untap in next untap step of controller
|
||||
// if we don't check for turn number, every untap step of a turn only one effect would be used instead of correctly only one time
|
||||
// to skip the untap effect.
|
||||
|
||||
// Discard effect if it's related to a previous turn
|
||||
if (validForTurnNum > 0 && validForTurnNum < game.getTurnNum()) {
|
||||
discard();
|
||||
return false;
|
||||
}
|
||||
// remember the turn of the untap step the effect has to be applied
|
||||
// the check if a permanent untap pahse is already handled is needed if multiple effects are added to prevent untap in next untap step of controller
|
||||
// if we don't check it for every untap step of a turn only one effect would be consumed instead of all be valid for the next untap step
|
||||
if (GameEvent.EventType.UNTAP_STEP.equals(event.getType())) {
|
||||
UUID controllerId = null;
|
||||
boolean allHandled = true;
|
||||
for (UUID targetId : getTargetPointer().getTargets(game, source)) {
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null) {
|
||||
controllerId = permanent.getControllerId();
|
||||
if (game.getActivePlayerId().equals(permanent.getControllerId())
|
||||
|| (game.getActivePlayerId().equals(onlyIfControlledByPlayer))) { // if effect works only for specific player, all permanents have to be set to handled in that players untap step
|
||||
if (!handledTargetsDuringTurn.containsKey(targetId)) {
|
||||
// it's the untep step of the current controller and the effect was not handled for this target yet, so do it now
|
||||
handledTargetsDuringTurn.put(targetId, false);
|
||||
allHandled = false;
|
||||
} else if (!handledTargetsDuringTurn.get(targetId)) {
|
||||
// if it was already ready to be handled on an previous Untap step set it to done if not already so
|
||||
handledTargetsDuringTurn.put(targetId, true);
|
||||
}
|
||||
} else {
|
||||
allHandled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (controllerId == null) { // no more targets on the battlefield, effect can be discarded
|
||||
if (allHandled) {
|
||||
discard();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (game.getActivePlayerId().equals(controllerId)) {
|
||||
if (validForTurnNum == game.getTurnNum()) { // the turn has a second untap step but the effect is already related to the first untap step
|
||||
discard();
|
||||
return false;
|
||||
}
|
||||
validForTurnNum = game.getTurnNum();
|
||||
}
|
||||
}
|
||||
|
||||
if (game.getTurn().getStepType() == PhaseStep.UNTAP && event.getType() == EventType.UNTAP) {
|
||||
if (targetPointer.getTargets(game, source).contains(event.getTargetId())) {
|
||||
if (handledTargetsDuringTurn.containsKey(event.getTargetId())
|
||||
&& !handledTargetsDuringTurn.get(event.getTargetId())
|
||||
&& getTargetPointer().getTargets(game, source).contains(event.getTargetId())) {
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null && game.getActivePlayerId().equals(permanent.getControllerId())) {
|
||||
handledTargetsDuringTurn.put(event.getTargetId(), true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,146 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
* @author okuRaku
|
||||
*/
|
||||
public class DontUntapInOpponentsNextUntapStepAllEffect extends ContinuousRuleModifyingEffectImpl {
|
||||
|
||||
private int validForTurnNum;
|
||||
//private String targetName;
|
||||
TargetController targetController;
|
||||
FilterPermanent filter;
|
||||
|
||||
/**
|
||||
* Attention: This effect won't work with targets controlled by different
|
||||
* controllers If this is needed, the validForTurnNum has to be saved per
|
||||
* controller.
|
||||
*/
|
||||
public DontUntapInOpponentsNextUntapStepAllEffect(FilterPermanent filter) {
|
||||
super(Duration.Custom, Outcome.Detriment, false, true);
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
public DontUntapInOpponentsNextUntapStepAllEffect(final DontUntapInOpponentsNextUntapStepAllEffect effect) {
|
||||
super(effect);
|
||||
this.validForTurnNum = effect.validForTurnNum;
|
||||
this.targetController = effect.targetController;
|
||||
this.filter = effect.filter;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public DontUntapInOpponentsNextUntapStepAllEffect copy() {
|
||||
return new DontUntapInOpponentsNextUntapStepAllEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInfoMessage(Ability source, GameEvent event, Game game) {
|
||||
MageObject mageObject = game.getObject(source.getSourceId());
|
||||
Permanent permanentToUntap = game.getPermanent((event.getTargetId()));
|
||||
if (permanentToUntap != null && mageObject != null) {
|
||||
return permanentToUntap.getLogName() + " doesn't untap (" + mageObject.getLogName() + ")";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == EventType.UNTAP_STEP || event.getType() == EventType.UNTAP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
// the check for turn number is needed if multiple effects are added to prevent untap in next untap step of controller
|
||||
// if we don't check for turn number, every untap step of a turn only one effect would be used instead of correctly only one time
|
||||
// to skip the untap effect.
|
||||
|
||||
// Discard effect if it's related to a previous turn
|
||||
if (validForTurnNum > 0 && validForTurnNum < game.getTurnNum()) {
|
||||
discard();
|
||||
return false;
|
||||
}
|
||||
// remember the turn of the untap step the effect has to be applied
|
||||
if (GameEvent.EventType.UNTAP_STEP.equals(event.getType())) {
|
||||
if (game.getActivePlayerId().equals(getTargetPointer().getFirst(game, source))) {
|
||||
if (validForTurnNum == game.getTurnNum()) { // the turn has a second untap step but the effect is already related to the first untap step
|
||||
discard();
|
||||
return false;
|
||||
}
|
||||
validForTurnNum = game.getTurnNum();
|
||||
}
|
||||
}
|
||||
|
||||
if (game.getTurn().getStepType() == PhaseStep.UNTAP && event.getType() == EventType.UNTAP) {
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (!permanent.getControllerId().equals(getTargetPointer().getFirst(game, source))) {
|
||||
return false;
|
||||
}
|
||||
if (controller != null && !game.isOpponent(controller, permanent.getControllerId())) {
|
||||
return false;
|
||||
}
|
||||
if (game.getActivePlayerId().equals(permanent.getControllerId()) && // controller's untap step
|
||||
filter.match(permanent, source.getSourceId(), source.getControllerId(), game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (!staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
return filter.getMessage() + " target opponent controls don't untap during his or her next untap step.";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +1,16 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
|
|
@ -20,12 +20,11 @@
|
|||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -37,20 +36,25 @@ import mage.constants.Outcome;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author noxx
|
||||
*/
|
||||
public class LoseLifeDefendingPlayerEffect extends OneShotEffect {
|
||||
|
||||
protected DynamicValue amount;
|
||||
protected boolean attackerIsSource;
|
||||
|
||||
public LoseLifeDefendingPlayerEffect(int amount) {
|
||||
this(new StaticValue(amount));
|
||||
/**
|
||||
*
|
||||
* @param amount
|
||||
* @param attackerIsSource true if the source.getSourceId() contains the
|
||||
* attacker false if attacker has to be taken from targetPointer
|
||||
*/
|
||||
public LoseLifeDefendingPlayerEffect(int amount, boolean attackerIsSource) {
|
||||
this(new StaticValue(amount), attackerIsSource);
|
||||
}
|
||||
|
||||
public LoseLifeDefendingPlayerEffect(DynamicValue amount) {
|
||||
public LoseLifeDefendingPlayerEffect(DynamicValue amount, boolean attackerIsSource) {
|
||||
super(Outcome.Damage);
|
||||
this.amount = amount;
|
||||
}
|
||||
|
|
@ -58,6 +62,7 @@ public class LoseLifeDefendingPlayerEffect extends OneShotEffect {
|
|||
public LoseLifeDefendingPlayerEffect(final LoseLifeDefendingPlayerEffect effect) {
|
||||
super(effect);
|
||||
this.amount = effect.amount.copy();
|
||||
this.attackerIsSource = effect.attackerIsSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -67,21 +72,21 @@ public class LoseLifeDefendingPlayerEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for (UUID defenderId : game.getCombat().getDefenders()) {
|
||||
Player defender = game.getPlayer(defenderId);
|
||||
if (defender != null) {
|
||||
defender.loseLife(amount.calculate(game, source, this), game);
|
||||
}
|
||||
Player defender = null;
|
||||
if (attackerIsSource) {
|
||||
defender = game.getPlayer(game.getCombat().getDefenderId(source.getSourceId()));
|
||||
} else {
|
||||
defender = game.getPlayer(game.getCombat().getDefenderId(getTargetPointer().getFirst(game, source)));
|
||||
}
|
||||
if (defender != null) {
|
||||
defender.loseLife(amount.calculate(game, source, this), game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
StringBuilder sb = new StringBuilder("defending player loses ");
|
||||
sb.append(amount);
|
||||
sb.append(" life");
|
||||
return sb.toString();
|
||||
return "defending player loses " + amount + " life";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ class ClueArtifactToken extends Token {
|
|||
super("Clue", "colorless Clue artifact token onto the battlefield with \"{2}, Sacrifice this artifact: Draw a card.\"");
|
||||
this.setOriginalExpansionSetCode("SOI");
|
||||
this.cardType.add(CardType.ARTIFACT);
|
||||
this.subtype.add("Clue");
|
||||
|
||||
// {2}, Sacrifice this artifact: Draw a card.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), new GenericManaCost(2));
|
||||
|
|
|
|||
|
|
@ -35,22 +35,21 @@ import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
|||
import mage.constants.Duration;
|
||||
import mage.game.Game;
|
||||
import mage.game.combat.CombatGroup;
|
||||
import mage.game.events.GameEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
*/
|
||||
|
||||
public class RampageAbility extends BecomesBlockedTriggeredAbility {
|
||||
|
||||
private final String rule;
|
||||
|
||||
public RampageAbility(int amount) {
|
||||
super(null, false);
|
||||
rule = "rampage " + amount;
|
||||
rule = "rampage " + amount + "(Whenever this creature becomes blocked, it gets +"
|
||||
+ amount + "/+" + amount + " until end of turn for each creature blocking it beyond the first.)";
|
||||
RampageValue rv = new RampageValue(amount);
|
||||
this.addEffect(new BoostSourceEffect(rv, rv, Duration.EndOfTurn));
|
||||
this.addEffect(new BoostSourceEffect(rv, rv, Duration.EndOfTurn, true));
|
||||
}
|
||||
|
||||
public RampageAbility(final RampageAbility ability) {
|
||||
|
|
@ -69,7 +68,6 @@ public class RampageAbility extends BecomesBlockedTriggeredAbility {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class RampageValue implements DynamicValue {
|
||||
|
||||
private final int amount;
|
||||
|
|
@ -89,11 +87,10 @@ class RampageValue implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
int count = 0;
|
||||
for(CombatGroup combatGroup : game.getCombat().getGroups()) {
|
||||
if(combatGroup.getAttackers().contains(sourceAbility.getSourceId())) {
|
||||
int blockers = combatGroup.getBlockers().size();
|
||||
return blockers > 1 ? (blockers - 1) * amount : 0;
|
||||
for (CombatGroup combatGroup : game.getCombat().getGroups()) {
|
||||
if (combatGroup.getAttackers().contains(sourceAbility.getSourceId())) {
|
||||
int blockers = combatGroup.getBlockers().size();
|
||||
return blockers > 1 ? (blockers - 1) * amount : 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -101,6 +98,7 @@ class RampageValue implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "Rampage " + amount;
|
||||
return "rampage " + amount + "(Whenever this creature becomes blocked, it gets +"
|
||||
+ amount + "/+" + amount + " until end of turn for each creature blocking it beyond the first.)";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,4 +114,14 @@ public class FilterMana implements Serializable {
|
|||
public FilterMana copy() {
|
||||
return new FilterMana(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return (black ? "{B}" : "")
|
||||
+ (green ? "{G}" : "")
|
||||
+ (red ? "{R}" : "")
|
||||
+ (blue ? "{U}" : "")
|
||||
+ (white ? "{W}" : "");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,34 +1,34 @@
|
|||
package mage.game.permanent.token;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.constants.CardType;
|
||||
|
||||
public class AngelToken extends Token {
|
||||
|
||||
final static private List<String> tokenImageSets = new ArrayList<>();
|
||||
|
||||
static {
|
||||
tokenImageSets.addAll(Arrays.asList("AVR", "C14", "CFX", "GTC", "ISD", "M14", "ORI", "ZEN"));
|
||||
}
|
||||
|
||||
public AngelToken() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public AngelToken(String setCode) {
|
||||
super("Angel", "4/4 white Angel creature token with flying");
|
||||
availableImageSetCodes = tokenImageSets;
|
||||
setOriginalExpansionSetCode(setCode);
|
||||
|
||||
cardType.add(CardType.CREATURE);
|
||||
color.setWhite(true);
|
||||
subtype.add("Angel");
|
||||
power = new MageInt(4);
|
||||
toughness = new MageInt(4);
|
||||
addAbility(FlyingAbility.getInstance());
|
||||
}
|
||||
}
|
||||
package mage.game.permanent.token;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.constants.CardType;
|
||||
|
||||
public class AngelToken extends Token {
|
||||
|
||||
final static private List<String> tokenImageSets = new ArrayList<>();
|
||||
|
||||
static {
|
||||
tokenImageSets.addAll(Arrays.asList("AVR", "C14", "CFX", "GTC", "ISD", "M14", "ORI", "SOI", "ZEN"));
|
||||
}
|
||||
|
||||
public AngelToken() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public AngelToken(String setCode) {
|
||||
super("Angel", "4/4 white Angel creature token with flying");
|
||||
availableImageSetCodes = tokenImageSets;
|
||||
setOriginalExpansionSetCode(setCode);
|
||||
|
||||
cardType.add(CardType.CREATURE);
|
||||
color.setWhite(true);
|
||||
subtype.add("Angel");
|
||||
power = new MageInt(4);
|
||||
toughness = new MageInt(4);
|
||||
addAbility(FlyingAbility.getInstance());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,88 +1,88 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.game.permanent.token;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.constants.CardType;
|
||||
|
||||
/**
|
||||
* @author nantuko
|
||||
*/
|
||||
public class SpiritWhiteToken extends Token {
|
||||
|
||||
final static private List<String> tokenImageSets = new ArrayList<>();
|
||||
|
||||
static {
|
||||
tokenImageSets.addAll(Arrays.asList("AVR", "C14", "CNS", "DDC", "DDK", "FRF", "ISD", "KTK", "M15", "MM2", "SHM"));
|
||||
}
|
||||
|
||||
public SpiritWhiteToken() {
|
||||
this(null, 0);
|
||||
}
|
||||
|
||||
public SpiritWhiteToken(String setCode) {
|
||||
this(setCode, 0);
|
||||
}
|
||||
|
||||
public SpiritWhiteToken(String setCode, int tokenType) {
|
||||
super("Spirit", "1/1 white Spirit creature token with flying");
|
||||
availableImageSetCodes = tokenImageSets;
|
||||
setOriginalExpansionSetCode(setCode);
|
||||
if (tokenType > 0) {
|
||||
setTokenType(tokenType);
|
||||
}
|
||||
cardType.add(CardType.CREATURE);
|
||||
subtype.add("Spirit");
|
||||
color.setWhite(true);
|
||||
power = new MageInt(1);
|
||||
toughness = new MageInt(1);
|
||||
|
||||
addAbility(FlyingAbility.getInstance());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExpansionSetCodeForImage(String code) {
|
||||
super.setExpansionSetCodeForImage(code);
|
||||
if (getOriginalExpansionSetCode() != null && getOriginalExpansionSetCode().equals("AVR")) {
|
||||
setTokenType(1);
|
||||
}
|
||||
}
|
||||
|
||||
public SpiritWhiteToken(final SpiritWhiteToken token) {
|
||||
super(token);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpiritWhiteToken copy() {
|
||||
return new SpiritWhiteToken(this);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.game.permanent.token;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.constants.CardType;
|
||||
|
||||
/**
|
||||
* @author nantuko
|
||||
*/
|
||||
public class SpiritWhiteToken extends Token {
|
||||
|
||||
final static private List<String> tokenImageSets = new ArrayList<>();
|
||||
|
||||
static {
|
||||
tokenImageSets.addAll(Arrays.asList("AVR", "C14", "CNS", "DDC", "DDK", "FRF", "ISD", "KTK", "M15", "MM2", "SHM", "SOI"));
|
||||
}
|
||||
|
||||
public SpiritWhiteToken() {
|
||||
this(null, 0);
|
||||
}
|
||||
|
||||
public SpiritWhiteToken(String setCode) {
|
||||
this(setCode, 0);
|
||||
}
|
||||
|
||||
public SpiritWhiteToken(String setCode, int tokenType) {
|
||||
super("Spirit", "1/1 white Spirit creature token with flying");
|
||||
availableImageSetCodes = tokenImageSets;
|
||||
setOriginalExpansionSetCode(setCode);
|
||||
if (tokenType > 0) {
|
||||
setTokenType(tokenType);
|
||||
}
|
||||
cardType.add(CardType.CREATURE);
|
||||
subtype.add("Spirit");
|
||||
color.setWhite(true);
|
||||
power = new MageInt(1);
|
||||
toughness = new MageInt(1);
|
||||
|
||||
addAbility(FlyingAbility.getInstance());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExpansionSetCodeForImage(String code) {
|
||||
super.setExpansionSetCodeForImage(code);
|
||||
if (getOriginalExpansionSetCode() != null && getOriginalExpansionSetCode().equals("AVR")) {
|
||||
setTokenType(1);
|
||||
}
|
||||
}
|
||||
|
||||
public SpiritWhiteToken(final SpiritWhiteToken token) {
|
||||
super(token);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpiritWhiteToken copy() {
|
||||
return new SpiritWhiteToken(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import java.util.Set;
|
|||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.Mana;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbility;
|
||||
import mage.abilities.SpellAbility;
|
||||
|
|
@ -623,22 +624,50 @@ public class CardUtil {
|
|||
|
||||
for (String rule : card.getRules()) {
|
||||
rule = rule.replaceAll("(?i)<i.*?</i>", ""); // Ignoring reminder text in italic
|
||||
if (rule.matches(regexBlack)) {
|
||||
if (!mana.isBlack() && rule.matches(regexBlack)) {
|
||||
mana.setBlack(true);
|
||||
}
|
||||
if (rule.matches(regexBlue)) {
|
||||
if (!mana.isBlue() && rule.matches(regexBlue)) {
|
||||
mana.setBlue(true);
|
||||
}
|
||||
if (rule.matches(regexGreen)) {
|
||||
if (!mana.isGreen() && rule.matches(regexGreen)) {
|
||||
mana.setGreen(true);
|
||||
}
|
||||
if (rule.matches(regexRed)) {
|
||||
if (!mana.isRed() && rule.matches(regexRed)) {
|
||||
mana.setRed(true);
|
||||
}
|
||||
if (rule.matches(regexWhite)) {
|
||||
if (!mana.isWhite() && rule.matches(regexWhite)) {
|
||||
mana.setWhite(true);
|
||||
}
|
||||
}
|
||||
if (card.canTransform()) {
|
||||
Card secondCard = card.getSecondCardFace();
|
||||
ObjectColor color = secondCard.getColor(null);
|
||||
mana.setBlack(mana.isBlack() || color.isBlack());
|
||||
mana.setGreen(mana.isGreen() || color.isGreen());
|
||||
mana.setRed(mana.isRed() || color.isRed());
|
||||
mana.setBlue(mana.isBlue() || color.isBlue());
|
||||
mana.setWhite(mana.isWhite() || color.isWhite());
|
||||
for (String rule : secondCard.getRules()) {
|
||||
rule = rule.replaceAll("(?i)<i.*?</i>", ""); // Ignoring reminder text in italic
|
||||
if (!mana.isBlack() && rule.matches(regexBlack)) {
|
||||
mana.setBlack(true);
|
||||
}
|
||||
if (!mana.isBlue() && rule.matches(regexBlue)) {
|
||||
mana.setBlue(true);
|
||||
}
|
||||
if (!mana.isGreen() && rule.matches(regexGreen)) {
|
||||
mana.setGreen(true);
|
||||
}
|
||||
if (!mana.isRed() && rule.matches(regexRed)) {
|
||||
mana.setRed(true);
|
||||
}
|
||||
if (!mana.isWhite() && rule.matches(regexWhite)) {
|
||||
mana.setWhite(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return mana;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue