Merge branch 'master' into net_decks

This commit is contained in:
paul_snoops
2021-06-11 22:24:22 +01:00
338 changed files with 3112 additions and 1684 deletions

View File

@@ -1630,7 +1630,7 @@ public class ComputerUtilCard {
pumped.addChangedCardKeywords(kws, null, false, false, timestamp);
Set<CounterType> types = c.getCounters().keySet();
for(CounterType ct : types) {
pumped.addCounterFireNoEvents(ct, c.getCounters(ct), ai, true, null);
pumped.addCounterFireNoEvents(ct, c.getCounters(ct), ai, sa, true, null);
}
//Copies tap-state and extra keywords (auras, equipment, etc.)
if (c.isTapped()) {

View File

@@ -1175,7 +1175,7 @@ public abstract class GameState {
String[] allCounterStrings = counterString.split(",");
for (final String counterPair : allCounterStrings) {
String[] pair = counterPair.split("=", 2);
entity.addCounter(CounterType.getType(pair[0]), Integer.parseInt(pair[1]), null, false, false, null);
entity.addCounter(CounterType.getType(pair[0]), Integer.parseInt(pair[1]), null, null, false, false, null);
}
}

View File

@@ -217,7 +217,7 @@ public class SpecialCardAi {
Card animated = AnimateAi.becomeAnimated(sa.getHostCard(), sa.getSubAbility());
if (sa.getHostCard().canReceiveCounters(CounterEnumType.P1P1)) {
animated.addCounter(CounterEnumType.P1P1, 2, ai, false, null);
animated.addCounter(CounterEnumType.P1P1, 2, ai, sa.getSubAbility(), false, null);
}
boolean isOppEOT = ph.is(PhaseType.END_OF_TURN) && ph.getNextTurn() == ai;
boolean isValuableAttacker = ph.is(PhaseType.MAIN1, ai) && ComputerUtilCard.doesSpecifiedCreatureAttackAI(ai, animated);

View File

@@ -155,6 +155,8 @@ public class ForgeScript {
return sa.isAftermath();
} else if (property.equals("MorphUp")) {
return sa.isMorphUp();
} else if (property.equals("Modular")) {
return sa.hasParam("Modular");
} else if (property.equals("Equip")) {
return sa.hasParam("Equip");
} else if (property.equals("Boast")) {

View File

@@ -1235,7 +1235,7 @@ public class GameAction {
int loyal = c.getCounters(CounterEnumType.LOYALTY);
if (loyal < beeble) {
GameEntityCounterTable counterTable = new GameEntityCounterTable();
c.addCounter(CounterEnumType.LOYALTY, beeble - loyal, c.getController(), false, counterTable);
c.addCounter(CounterEnumType.LOYALTY, beeble - loyal, c.getController(), null, false, counterTable);
counterTable.triggerCountersPutAll(game);
} else if (loyal > beeble) {
c.subtractCounter(CounterEnumType.LOYALTY, loyal - beeble);

View File

@@ -300,7 +300,7 @@ public abstract class GameEntity extends GameObject implements IIdentifiable {
abstract public void setCounters(final Map<CounterType, Integer> allCounters);
abstract public boolean canReceiveCounters(final CounterType type);
abstract public int addCounter(final CounterType counterType, final int n, final Player source, final boolean applyMultiplier, final boolean fireEvents, GameEntityCounterTable table);
abstract public int addCounter(final CounterType counterType, final int n, final Player source, final SpellAbility cause, final boolean applyMultiplier, final boolean fireEvents, GameEntityCounterTable table);
abstract public void subtractCounter(final CounterType counterName, final int n);
abstract public void clearCounters();
@@ -308,8 +308,8 @@ public abstract class GameEntity extends GameObject implements IIdentifiable {
return canReceiveCounters(CounterType.get(type));
}
public int addCounter(final CounterEnumType counterType, final int n, final Player source, final boolean applyMultiplier, final boolean fireEvents, GameEntityCounterTable table) {
return addCounter(CounterType.get(counterType), n, source, applyMultiplier, fireEvents, table);
public int addCounter(final CounterEnumType counterType, final int n, final Player source, final SpellAbility cause, final boolean applyMultiplier, final boolean fireEvents, GameEntityCounterTable table) {
return addCounter(CounterType.get(counterType), n, source, cause, applyMultiplier, fireEvents, table);
}
public void subtractCounter(final CounterEnumType counterName, final int n) {
subtractCounter(CounterType.get(counterName), n);

View File

@@ -93,7 +93,7 @@ public class AmassEffect extends TokenEffectBase {
GameEntityCounterTable table = new GameEntityCounterTable();
for(final Card tgtCard : tgtCards) {
tgtCard.addCounter(CounterEnumType.P1P1, amount, activator, true, table);
tgtCard.addCounter(CounterEnumType.P1P1, amount, activator, sa, true, table);
game.updateLastStateForCard(tgtCard);
if (remember) {

View File

@@ -709,7 +709,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
if (sa.hasParam("WithCountersType")) {
CounterType cType = CounterType.getType(sa.getParam("WithCountersType"));
int cAmount = AbilityUtils.calculateAmount(hostCard, sa.getParamOrDefault("WithCountersAmount", "1"), sa);
movedCard.addCounter(cType, cAmount, player, true, counterTable);
movedCard.addCounter(cType, cAmount, player, sa, true, counterTable);
}
if (sa.hasParam("ExileFaceDown") || sa.hasParam("FaceDown")) {

View File

@@ -243,5 +243,4 @@ public class CharmEffect extends SpellAbilityEffect {
}
}

View File

@@ -1,5 +1,6 @@
package forge.game.ability.effects;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -62,6 +63,7 @@ public class ChooseCardNameEffect extends SpellAbilityEffect {
boolean randomChoice = sa.hasParam("AtRandom");
boolean chooseFromDefined = sa.hasParam("ChooseFromDefinedCards");
boolean chooseFromOneTimeList = sa.hasParam("ChooseFromOneTimeList");
if (!randomChoice) {
if (sa.hasParam("SelectPrompt")) {
@@ -100,7 +102,7 @@ public class ChooseCardNameEffect extends SpellAbilityEffect {
} else if (chooseFromDefined) {
CardCollection choices = AbilityUtils.getDefinedCards(host, sa.getParam("ChooseFromDefinedCards"), sa);
choices = CardLists.getValidCards(choices, valid, host.getController(), host, sa);
List<ICardFace> faces = Lists.newArrayList();
List<ICardFace> faces = new ArrayList<>();
// get Card
for (final Card c : choices) {
final CardRules rules = c.getRules();
@@ -114,6 +116,22 @@ public class ChooseCardNameEffect extends SpellAbilityEffect {
}
Collections.sort(faces);
chosen = p.getController().chooseCardName(sa, faces, message);
} else if (chooseFromOneTimeList) {
String [] names = sa.getParam("ChooseFromOneTimeList").split(",");
List<ICardFace> faces = new ArrayList<>();
for (String name : names) {
faces.add(StaticData.instance().getCommonCards().getFaceByName(name));
}
chosen = p.getController().chooseCardName(sa, faces, message);
// Remove chosen Name from List
StringBuilder sb = new StringBuilder();
for (String name : names) {
if (chosen.equals(name)) continue;
if (sb.length() > 0) sb.append(',');
sb.append(name);
}
sa.putParam("ChooseFromOneTimeList", sb.toString());
} else {
// use CardFace because you might name a alternate names
Predicate<ICardFace> cpp = Predicates.alwaysTrue();

View File

@@ -99,7 +99,7 @@ public class CopyPermanentEffect extends TokenEffectBase {
if (sa.hasParam("RandomCopied")) {
List<PaperCard> copysource = Lists.newArrayList(cards);
List<Card> choice = Lists.newArrayList();
final String num = sa.hasParam("RandomNum") ? sa.getParam("RandomNum") : "1";
final String num = sa.getParamOrDefault("RandomNum","1");
int ncopied = AbilityUtils.calculateAmount(host, num, sa);
while (ncopied > 0 && !copysource.isEmpty()) {
final PaperCard cp = Aggregates.random(copysource);

View File

@@ -163,7 +163,7 @@ public class CountersMoveEffect extends SpellAbilityEffect {
}
}
for (Map.Entry<CounterType, Integer> e : countersToAdd.entrySet()) {
dest.addCounter(e.getKey(), e.getValue(), player, true, table);
dest.addCounter(e.getKey(), e.getValue(), player, sa, true, table);
}
game.updateLastStateForCard(dest);
@@ -225,7 +225,7 @@ public class CountersMoveEffect extends SpellAbilityEffect {
if (cnum > 0) {
source.subtractCounter(cType, cnum);
cur.addCounter(cType, cnum, player, true, table);
cur.addCounter(cType, cnum, player, sa, true, table);
game.updateLastStateForCard(cur);
updateSource = true;
}
@@ -311,7 +311,7 @@ public class CountersMoveEffect extends SpellAbilityEffect {
}
for (Map.Entry<CounterType, Integer> e : countersToAdd.entrySet()) {
cur.addCounter(e.getKey(), e.getValue(), player, true, table);
cur.addCounter(e.getKey(), e.getValue(), player, sa, true, table);
}
game.updateLastStateForCard(cur);
}

View File

@@ -54,10 +54,10 @@ public class CountersMultiplyEffect extends SpellAbilityEffect {
continue;
}
if (counterType != null) {
gameCard.addCounter(counterType, gameCard.getCounters(counterType) * n, player, true, table);
gameCard.addCounter(counterType, gameCard.getCounters(counterType) * n, player, sa, true, table);
} else {
for (Map.Entry<CounterType, Integer> e : gameCard.getCounters().entrySet()) {
gameCard.addCounter(e.getKey(), e.getValue() * n, player, true, table);
gameCard.addCounter(e.getKey(), e.getValue() * n, player, sa, true, table);
}
}
game.updateLastStateForCard(gameCard);

View File

@@ -30,7 +30,7 @@ public class CountersNoteEffect extends SpellAbilityEffect {
if (mode.equals(MODE_STORE)) {
noteCounters(c, source);
} else if (mode.equals(MODE_LOAD)) {
loadCounters(c, source, p, table);
loadCounters(c, source, p, sa, table);
}
}
table.triggerCountersPutAll(game);
@@ -44,13 +44,13 @@ public class CountersNoteEffect extends SpellAbilityEffect {
}
}
private void loadCounters(Card notee, Card source, final Player p, GameEntityCounterTable table) {
private void loadCounters(Card notee, Card source, final Player p, final SpellAbility sa, GameEntityCounterTable table) {
for(Entry<String, String> svar : source.getSVars().entrySet()) {
String key = svar.getKey();
if (key.startsWith(NOTE_COUNTERS)) {
notee.addCounter(
CounterType.getType(key.substring(NOTE_COUNTERS.length())),
Integer.parseInt(svar.getValue()), p, false, table);
Integer.parseInt(svar.getValue()), p, sa, false, table);
}
// TODO Probably should "remove" the svars that were temporarily used
}

View File

@@ -48,7 +48,7 @@ public class CountersProliferateEffect extends SpellAbilityEffect {
GameEntityCounterTable table = new GameEntityCounterTable();
for (final GameEntity ge : result) {
for (final CounterType ct : ge.getCounters().keySet()) {
ge.addCounter(ct, 1, p, true, true, table);
ge.addCounter(ct, 1, p, sa, true, true, table);
}
if (ge instanceof Card) {
Card c = (Card) ge;

View File

@@ -71,7 +71,7 @@ public class CountersPutAllEffect extends SpellAbilityEffect {
if (etbcounter) {
tgtCard.addEtbCounter(CounterType.getType(type), counterAmount, placer);
} else {
tgtCard.addCounter(CounterType.getType(type), counterAmount, placer, inBattlefield, table);
tgtCard.addCounter(CounterType.getType(type), counterAmount, placer, sa, inBattlefield, table);
}
game.updateLastStateForCard(tgtCard);
}

View File

@@ -226,10 +226,10 @@ public class CountersPutEffect extends SpellAbilityEffect {
if (eachExistingCounter) {
for (CounterType ct : choices) {
if (obj instanceof Player) {
((Player) obj).addCounter(ct, counterAmount, placer, true, table);
((Player) obj).addCounter(ct, counterAmount, placer, sa, true, table);
}
if (obj instanceof Card) {
gameCard.addCounter(ct, counterAmount, placer, true, table);
gameCard.addCounter(ct, counterAmount, placer, sa, true, table);
}
}
continue;
@@ -253,7 +253,7 @@ public class CountersPutEffect extends SpellAbilityEffect {
for (Card c : AbilityUtils.getDefinedCards(card, sa.getParam("EachFromSource"), sa)) {
for (Entry<CounterType, Integer> cti : c.getCounters().entrySet()) {
if (gameCard != null && gameCard.canReceiveCounters(cti.getKey())) {
gameCard.addCounter(cti.getKey(), cti.getValue(), placer, true, table);
gameCard.addCounter(cti.getKey(), cti.getValue(), placer, sa, true, table);
}
}
}
@@ -338,7 +338,7 @@ public class CountersPutEffect extends SpellAbilityEffect {
if (etbcounter) {
gameCard.addEtbCounter(counterType, counterAmount, placer);
} else {
int addedAmount = gameCard.addCounter(counterType, counterAmount, placer, true, table);
int addedAmount = gameCard.addCounter(counterType, counterAmount, placer, sa, true, table);
if (addedAmount > 0) {
counterAdded = true;
}
@@ -372,7 +372,7 @@ public class CountersPutEffect extends SpellAbilityEffect {
if (etbcounter) {
gameCard.addEtbCounter(counterType, counterAmount, placer);
} else {
if (gameCard.addCounter(counterType, counterAmount, placer, false, table) > 0) {
if (gameCard.addCounter(counterType, counterAmount, placer, sa, false, table) > 0) {
counterAdded = true;
}
}
@@ -388,7 +388,7 @@ public class CountersPutEffect extends SpellAbilityEffect {
} else if (obj instanceof Player) {
// Add Counters to players!
Player pl = (Player) obj;
pl.addCounter(counterType, counterAmount, placer, true, table);
pl.addCounter(counterType, counterAmount, placer, sa, true, table);
}
}
}

View File

@@ -111,7 +111,7 @@ public class CountersPutOrRemoveEffect extends SpellAbilityEffect {
boolean apply = zone == null || zone.is(ZoneType.Battlefield) || zone.is(ZoneType.Stack);
tgtCard.addCounter(chosenType, counterAmount, pl, apply, table);
tgtCard.addCounter(chosenType, counterAmount, pl, sa, apply, table);
} else {
tgtCard.subtractCounter(chosenType, counterAmount);
}

View File

@@ -336,7 +336,7 @@ public class DigEffect extends SpellAbilityEffect {
} else if (destZone1.equals(ZoneType.Exile)) {
if (sa.hasParam("ExileWithCounter")) {
c.addCounter(CounterType.getType(sa.getParam("ExileWithCounter")),
1, player, true, counterTable);
1, player, sa, true, counterTable);
}
c.setExiledWith(effectHost);
c.setExiledBy(effectHost.getController());
@@ -408,7 +408,7 @@ public class DigEffect extends SpellAbilityEffect {
if (destZone2 == ZoneType.Exile) {
if (sa.hasParam("ExileWithCounter")) {
c.addCounter(CounterType.getType(sa.getParam("ExileWithCounter")),
1, player, true, counterTable);
1, player, sa, true, counterTable);
}
c.setExiledWith(effectHost);
c.setExiledBy(effectHost.getController());

View File

@@ -83,7 +83,7 @@ public class ExploreEffect extends SpellAbilityEffect {
// if the card is not more in the game anymore
// this might still return true but its no problem
if (game.getZoneOf(gamec).is(ZoneType.Battlefield) && gamec.equalsWithTimestamp(c)) {
c.addCounter(CounterEnumType.P1P1, 1, pl, true, table);
c.addCounter(CounterEnumType.P1P1, 1, pl, sa, true, table);
}
}

View File

@@ -35,6 +35,7 @@ import forge.game.zone.Zone;
import forge.game.zone.ZoneType;
import forge.item.PaperCard;
import forge.util.Aggregates;
import forge.util.CardTranslation;
import forge.util.Lang;
import forge.util.Localizer;
@@ -93,8 +94,7 @@ public class PlayEffect extends SpellAbilityEffect {
if (sa.hasParam("ShowCards")) {
showCards = new CardCollection(AbilityUtils.filterListByType(game.getCardsIn(zones), sa.getParam("ShowCards"), sa));
}
}
else if (sa.hasParam("AnySupportedCard")) {
} else if (sa.hasParam("AnySupportedCard")) {
final String valid = sa.getParam("AnySupportedCard");
List<PaperCard> cards = null;
if (valid.startsWith("Names:")){
@@ -139,8 +139,14 @@ public class PlayEffect extends SpellAbilityEffect {
else {
return;
}
}
else {
} else if (sa.hasParam("CopyFromChosenName")) {
String name = source.getChosenName();
if (name.trim().isEmpty()) return;
Card card = Card.fromPaperCard(StaticData.instance().getCommonCards().getUniqueByName(name), controller);
card.setToken(true);
tgtCards = new CardCollection();
tgtCards.add(card);
} else {
tgtCards = new CardCollection();
// filter only cards that didn't changed zones
for (Card c : getTargetCards(sa)) {
@@ -179,7 +185,16 @@ public class PlayEffect extends SpellAbilityEffect {
while (!tgtCards.isEmpty() && amount > 0) {
activator.getController().tempShowCards(showCards);
Card tgtCard = controller.getController().chooseSingleEntityForEffect(tgtCards, sa, Localizer.getInstance().getMessage("lblSelectCardToPlay"), optional, null);
Card tgtCard = null;
if (tgtCards.size() == 1 && amount == 1 && optional) {
tgtCard = tgtCards.get(0);
if (!controller.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantPlayCard", CardTranslation.getTranslatedName(tgtCard.getName())))) {
break;
}
} else {
tgtCard = controller.getController().chooseSingleEntityForEffect(tgtCards, sa, Localizer.getInstance().getMessage("lblSelectCardToPlay"), optional, null);
}
activator.getController().endTempShowCards();
if (tgtCard == null) {
break;

View File

@@ -55,7 +55,7 @@ public class SacrificeEffect extends SpellAbilityEffect {
}
} else if (sa.hasParam("CumulativeUpkeep")) {
GameEntityCounterTable table = new GameEntityCounterTable();
card.addCounter(CounterEnumType.AGE, 1, activator, true, table);
card.addCounter(CounterEnumType.AGE, 1, activator, sa, true, table);
table.triggerCountersPutAll(game);

View File

@@ -160,7 +160,7 @@ public class SetStateEffect extends SpellAbilityEffect {
}
game.fireEvent(new GameEventCardStatsChanged(gameCard));
if (sa.hasParam("Mega")) {
gameCard.addCounter(CounterEnumType.P1P1, 1, p, true, table);
gameCard.addCounter(CounterEnumType.P1P1, 1, p, sa, true, table);
}
if (remChanged) {
host.addRemembered(gameCard);

View File

@@ -1382,21 +1382,21 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
return true;
}
public final int addCounter(final CounterType counterType, final int n, final Player source, final boolean applyMultiplier, GameEntityCounterTable table) {
return addCounter(counterType, n, source, applyMultiplier, true, table);
public final int addCounter(final CounterType counterType, final int n, final Player source, final SpellAbility cause, final boolean applyMultiplier, GameEntityCounterTable table) {
return addCounter(counterType, n, source, cause, applyMultiplier, true, table);
}
public final int addCounterFireNoEvents(final CounterType counterType, final int n, final Player source, final boolean applyMultiplier, GameEntityCounterTable table) {
return addCounter(counterType, n, source, applyMultiplier, false, table);
public final int addCounterFireNoEvents(final CounterType counterType, final int n, final Player source, final SpellAbility cause, final boolean applyMultiplier, GameEntityCounterTable table) {
return addCounter(counterType, n, source, cause, applyMultiplier, false, table);
}
public final int addCounter(final CounterEnumType counterType, final int n, final Player source, final boolean applyMultiplier, GameEntityCounterTable table) {
return addCounter(counterType, n, source, applyMultiplier, true, table);
public final int addCounter(final CounterEnumType counterType, final int n, final Player source, final SpellAbility cause, final boolean applyMultiplier, GameEntityCounterTable table) {
return addCounter(counterType, n, source, cause, applyMultiplier, true, table);
}
public final int addCounterFireNoEvents(final CounterEnumType counterType, final int n, final Player source, final boolean applyMultiplier, GameEntityCounterTable table) {
return addCounter(counterType, n, source, applyMultiplier, false, table);
public final int addCounterFireNoEvents(final CounterEnumType counterType, final int n, final Player source, final SpellAbility cause, final boolean applyMultiplier, GameEntityCounterTable table) {
return addCounter(counterType, n, source, cause, applyMultiplier, false, table);
}
@Override
public int addCounter(final CounterType counterType, final int n, final Player source, final boolean applyMultiplier, final boolean fireEvents, GameEntityCounterTable table) {
public int addCounter(final CounterType counterType, final int n, final Player source, final SpellAbility cause, final boolean applyMultiplier, final boolean fireEvents, GameEntityCounterTable table) {
int addAmount = n;
if(addAmount <= 0 || !canReceiveCounters(counterType)) {
// As per rule 107.1b
@@ -1404,6 +1404,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
}
final Map<AbilityKey, Object> repParams = AbilityKey.mapFromAffected(this);
repParams.put(AbilityKey.Source, source);
repParams.put(AbilityKey.Cause, cause);
repParams.put(AbilityKey.CounterType, counterType);
repParams.put(AbilityKey.CounterNum, addAmount);
repParams.put(AbilityKey.EffectOnly, applyMultiplier);
@@ -5273,7 +5274,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|| source.hasKeyword(Keyword.WITHER) || source.hasKeyword(Keyword.INFECT));
if (wither) { // 120.3d
addCounter(CounterType.get(CounterEnumType.M1M1), damageIn, source.getController(), true, counterTable);
addCounter(CounterType.get(CounterEnumType.M1M1), damageIn, source.getController(), null, true, counterTable);
damageType = DamageType.M1M1Counters;
}
else { // 120.3e
@@ -6611,7 +6612,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
changed = true;
}
} else {
changed |= addCounter(ct, e.getValue(), e.getRowKey(), true, table) > 0;
changed |= addCounter(ct, e.getValue(), e.getRowKey(), null, true, table) > 0;
}
}
return changed;

View File

@@ -1398,7 +1398,7 @@ public class CardFactoryUtil {
inst.addTrigger(triggerDrawn);
} else if (keyword.startsWith("Modular")) {
final String abStr = "DB$ PutCounter | ValidTgts$ Artifact.Creature | " +
"TgtPrompt$ Select target artifact creature | CounterType$ P1P1 | CounterNum$ ModularX";
"TgtPrompt$ Select target artifact creature | CounterType$ P1P1 | CounterNum$ ModularX | Modular$ True";
String trigStr = "Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Battlefield | Destination$ Graveyard" +
" | OptionalDecider$ TriggeredCardController | TriggerController$ TriggeredCardController" +
@@ -3087,7 +3087,7 @@ public class CardFactoryUtil {
int counters = AbilityUtils.calculateAmount(c, k[1], this);
GameEntityCounterTable table = new GameEntityCounterTable();
c.addCounter(CounterEnumType.TIME, counters, getActivatingPlayer(), true, table);
c.addCounter(CounterEnumType.TIME, counters, getActivatingPlayer(), this, true, table);
table.triggerCountersPutAll(game);
String sb = TextUtil.concatWithSpace(getActivatingPlayer().toString(),"has suspended", c.getName(), "with", String.valueOf(counters),"time counters on it.");

View File

@@ -1086,7 +1086,7 @@ public class CardView extends GameEntityView {
}
public CardTypeView getType() {
if (isFaceDown() && !isInZone(EnumSet.of(ZoneType.Battlefield, ZoneType.Stack))) {
if (getState() != CardStateName.Original && isFaceDown() && !isInZone(EnumSet.of(ZoneType.Battlefield, ZoneType.Stack))) {
return CardType.EMPTY;
}
return get(TrackableProperty.Type);

View File

@@ -177,7 +177,7 @@ public class CostPutCounter extends CostPartWithList {
@Override
protected Card doPayment(SpellAbility ability, Card targetCard){
final Integer i = this.convertAmount();
targetCard.addCounter(this.getCounter(), i, ability.getActivatingPlayer(), ability.getRootAbility().isTrigger(), counterTable);
targetCard.addCounter(this.getCounter(), i, ability.getActivatingPlayer(), null, ability.getRootAbility().isTrigger(), counterTable);
return targetCard;
}

View File

@@ -33,5 +33,4 @@ public class Hexproof extends KeywordInstance<Hexproof> {
return false;
}
}

View File

@@ -293,7 +293,7 @@ public class PhaseHandler implements java.io.Serializable {
// all Saga get Lore counter at the begin of pre combat
for (Card c : playerTurn.getCardsIn(ZoneType.Battlefield)) {
if (c.getType().hasSubtype("Saga")) {
c.addCounter(CounterEnumType.LORE, 1, playerTurn, false, table);
c.addCounter(CounterEnumType.LORE, 1, playerTurn, null, false, table);
}
}
table.triggerCountersPutAll(game);

View File

@@ -867,12 +867,12 @@ public class Player extends GameEntity implements Comparable<Player> {
return true;
}
public final int addCounter(final CounterType counterType, final int n, final Player source, final boolean applyMultiplier, GameEntityCounterTable table) {
return addCounter(counterType, n, source, applyMultiplier, true, table);
public final int addCounter(final CounterType counterType, final int n, final Player source, final SpellAbility cause, final boolean applyMultiplier, GameEntityCounterTable table) {
return addCounter(counterType, n, source, cause, applyMultiplier, true, table);
}
@Override
public int addCounter(CounterType counterType, int n, final Player source, boolean applyMultiplier, boolean fireEvents, GameEntityCounterTable table) {
public int addCounter(CounterType counterType, int n, final Player source, final SpellAbility cause, boolean applyMultiplier, boolean fireEvents, GameEntityCounterTable table) {
int addAmount = n;
if (addAmount <= 0 || !canReceiveCounters(counterType)) {
// Can't add negative or 0 counters, bail out now
@@ -881,6 +881,7 @@ public class Player extends GameEntity implements Comparable<Player> {
final Map<AbilityKey, Object> repParams = AbilityKey.mapFromAffected(this);
repParams.put(AbilityKey.Source, source);
repParams.put(AbilityKey.Cause, cause);
repParams.put(AbilityKey.CounterType, counterType);
repParams.put(AbilityKey.CounterNum, addAmount);
repParams.put(AbilityKey.EffectOnly, applyMultiplier);
@@ -980,7 +981,7 @@ public class Player extends GameEntity implements Comparable<Player> {
}
public final void addPoisonCounters(final int num, final Card source, GameEntityCounterTable table) {
int oldPoison = getCounters(CounterEnumType.POISON);
addCounter(CounterEnumType.POISON, num, source.getController(), false, true, table);
addCounter(CounterEnumType.POISON, num, source.getController(), null, false, true, table);
if (oldPoison != getCounters(CounterEnumType.POISON)) {
game.fireEvent(new GameEventPlayerPoisoned(this, source, oldPoison, num));
@@ -1762,7 +1763,7 @@ public class Player extends GameEntity implements Comparable<Player> {
public final boolean playLand(final Card land, final boolean ignoreZoneAndTiming) {
// Dakkon Blackblade Avatar will use a similar effect
if (canPlayLand(land, ignoreZoneAndTiming)) {
this.playLandNoCheck(land);
playLandNoCheck(land);
return true;
}
@@ -1775,8 +1776,8 @@ public class Player extends GameEntity implements Comparable<Player> {
if (land.isFaceDown()) {
land.turnFaceUp(null);
}
final Card c = game.getAction().moveTo(getZone(ZoneType.Battlefield), land, null);
game.copyLastState();
final Card c = game.getAction().moveTo(getZone(ZoneType.Battlefield), land, null);
game.updateLastStateForCard(c);
// play a sound

View File

@@ -54,6 +54,10 @@ public class ReplaceAddCounter extends ReplacementEffect {
return false;
}
if (!matchesValidParam("ValidCause", runParams.get(AbilityKey.Cause))) {
return false;
}
if (hasParam("ValidCounterType")) {
String type = getParam("ValidCounterType");
if (CounterType.getType(type) != runParams.get(AbilityKey.CounterType)) {

View File

@@ -31,7 +31,6 @@ public class ReplaceProduceMana extends ReplacementEffect {
*/
@Override
public boolean canReplace(Map<AbilityKey, Object> runParams) {
if (!matchesValidParam("ValidCard", runParams.get(AbilityKey.Affected))) {
return false;
}

View File

@@ -765,6 +765,10 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
resetTriggeringObjects();
resetTriggerRemembered();
if (isActivatedAbility()) {
setXManaCostPaid(null);
}
// reset last state when finished resolving
setLastStateBattlefield(CardCollection.EMPTY);
setLastStateGraveyard(CardCollection.EMPTY);

View File

@@ -195,7 +195,6 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
* @return a boolean.
*/
public final boolean checkZoneRestrictions(final Card c, final SpellAbility sa) {
final Player activator = sa.getActivatingPlayer();
final Zone cardZone = c.getLastKnownZone();
Card cp = c;

View File

@@ -366,7 +366,6 @@ public class TargetRestrictions {
return this.saValidTargeting;
}
/**
* <p>
* canOnlyTgtOpponent.

View File

@@ -57,6 +57,9 @@ public class StaticAbilityCantBeCast {
}
public static boolean cantBeActivatedAbility(final SpellAbility spell, final Card card, final Player activator) {
if (spell.isTrigger()) {
return false;
}
final Game game = activator.getGame();
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
for (final StaticAbility stAb : ca.getStaticAbilities()) {
@@ -98,7 +101,6 @@ public class StaticAbilityCantBeCast {
* @return true, if successful
*/
public static boolean applyCantBeCastAbility(final StaticAbility stAb, final SpellAbility spell, final Card card, final Player activator) {
if (!stAb.matchesValidParam("ValidCard", card)) {
return false;
}
@@ -153,7 +155,6 @@ public class StaticAbilityCantBeCast {
* @return true, if successful
*/
public static boolean applyCantBeActivatedAbility(final StaticAbility stAb, final SpellAbility spellAbility, final Card card, final Player activator) {
if (!stAb.matchesValidParam("ValidCard", card)) {
return false;
}

View File

@@ -543,7 +543,6 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
}
private final void finishResolving(final SpellAbility sa, final boolean fizzle) {
// SpellAbility is removed from the stack here
// temporarily removed removing SA after resolution
final SpellAbilityStackInstance si = getInstanceFromSpellAbility(sa);

View File

@@ -218,7 +218,7 @@ public class GameSimulatorTest extends SimulationTestCase {
Game game = initAndCreateGame();
Player p = game.getPlayers().get(1);
Card sorin = addCard("Sorin, Solemn Visitor", p);
sorin.addCounter(CounterEnumType.LOYALTY, 5, p, false, null);
sorin.addCounter(CounterEnumType.LOYALTY, 5, p, null, false, null);
game.getPhaseHandler().devModeSet(PhaseType.MAIN2, p);
game.getAction().checkStateEffects(true);
@@ -262,7 +262,7 @@ public class GameSimulatorTest extends SimulationTestCase {
String bearCardName = "Runeclaw Bear";
addCard(bearCardName, p);
Card gideon = addCard("Gideon, Ally of Zendikar", p);
gideon.addCounter(CounterEnumType.LOYALTY, 4, p, false, null);
gideon.addCounter(CounterEnumType.LOYALTY, 4, p, null, false, null);
game.getPhaseHandler().devModeSet(PhaseType.MAIN2, p);
game.getAction().checkStateEffects(true);
@@ -385,7 +385,7 @@ public class GameSimulatorTest extends SimulationTestCase {
Game game = initAndCreateGame();
Player p = game.getPlayers().get(1);
Card sarkhan = addCard(sarkhanCardName, p);
sarkhan.addCounter(CounterEnumType.LOYALTY, 4, p, false, null);
sarkhan.addCounter(CounterEnumType.LOYALTY, 4, p, null, false, null);
game.getPhaseHandler().devModeSet(PhaseType.MAIN2, p);
game.getAction().checkStateEffects(true);
@@ -419,7 +419,7 @@ public class GameSimulatorTest extends SimulationTestCase {
addCard(ornithoperCardName, p);
addCard(bearCardName, p);
Card ajani = addCard(ajaniCardName, p);
ajani.addCounter(CounterEnumType.LOYALTY, 4, p, false, null);
ajani.addCounter(CounterEnumType.LOYALTY, 4, p, null, false, null);
game.getPhaseHandler().devModeSet(PhaseType.MAIN2, p);
game.getAction().checkStateEffects(true);
@@ -450,7 +450,7 @@ public class GameSimulatorTest extends SimulationTestCase {
SpellAbility boltSA = boltCard.getFirstSpellAbility();
Card ajani = addCard(ajaniCardName, p);
ajani.addCounter(CounterEnumType.LOYALTY, 8, p, false, null);
ajani.addCounter(CounterEnumType.LOYALTY, 8, p, null, false, null);
game.getPhaseHandler().devModeSet(PhaseType.MAIN2, p);
game.getAction().checkStateEffects(true);
@@ -499,7 +499,7 @@ public class GameSimulatorTest extends SimulationTestCase {
addCard("Swamp", p);
addCard("Swamp", p);
Card depths = addCard("Dark Depths", p);
depths.addCounter(CounterEnumType.ICE, 10, p, false, null);
depths.addCounter(CounterEnumType.ICE, 10, p, null, false, null);
Card thespian = addCard("Thespian's Stage", p);
game.getPhaseHandler().devModeSet(PhaseType.MAIN2, p);
game.getAction().checkStateEffects(true);
@@ -2176,7 +2176,7 @@ public class GameSimulatorTest extends SimulationTestCase {
Player p = game.getPlayers().get(0);
Card polukranos = addCard(polukranosCardName, p);
polukranos.addCounter(CounterEnumType.P1P1, 6, p, false, null);
polukranos.addCounter(CounterEnumType.P1P1, 6, p, null, false, null);
addCard(hydraCardName, p);
addCard(leylineCardName, p);
for (int i = 0; i < 2; ++i) {
@@ -2220,7 +2220,7 @@ public class GameSimulatorTest extends SimulationTestCase {
}
Card nishoba = addCard(nishobaName, p1);
nishoba.addCounter(CounterEnumType.P1P1, 7, p1, false, null);
nishoba.addCounter(CounterEnumType.P1P1, 7, p1, null, false, null);
addCard(capridorName, p1);
Card pridemate = addCard(pridemateName, p1);
Card indestructibility = addCard(indestructibilityName, p1);

View File

@@ -1,5 +1,5 @@
Name:Drake Stone
ManaCost:U
ManaCost:3 U B
Types:Planeswalker Stone
Loyalty:4
A:AB$ Draw | Cost$ AddCounter<1/LOYALTY> | Planeswalker$ True | NumCards$ 1 | SubAbility$ DBDiscard | SpellDescription$ Draw a card, then each player discards a card.

Some files were not shown because too many files have changed in this diff Show More