Merge remote-tracking branch 'remotes/core/master' into newBranch

This commit is contained in:
Anthony Calosa
2020-04-06 08:25:35 +08:00
9 changed files with 25 additions and 148 deletions

View File

@@ -150,19 +150,6 @@ public class CountersPutEffect extends SpellAbilityEffect {
CardCollection leastToughness = new CardCollection(Aggregates.listWithMin(creatsYouCtrl, CardPredicates.Accessors.fnGetDefense)); CardCollection leastToughness = new CardCollection(Aggregates.listWithMin(creatsYouCtrl, CardPredicates.Accessors.fnGetDefense));
tgtCards.addAll(pc.chooseCardsForEffect(leastToughness, sa, Localizer.getInstance().getMessage("lblChooseACreatureWithLeastToughness"), 1, 1, false)); tgtCards.addAll(pc.chooseCardsForEffect(leastToughness, sa, Localizer.getInstance().getMessage("lblChooseACreatureWithLeastToughness"), 1, 1, false));
tgtObjects.addAll(tgtCards); tgtObjects.addAll(tgtCards);
} else if (sa.hasParam("Choices")) {
ZoneType choiceZone = ZoneType.Battlefield;
if (sa.hasParam("ChoiceZone")) {
choiceZone = ZoneType.smartValueOf(sa.getParam("ChoiceZone"));
}
CardCollection choices = new CardCollection(game.getCardsIn(choiceZone));
int n = sa.hasParam("ChoiceAmount") ? Integer.parseInt(sa.getParam("ChoiceAmount")) : 1;
choices = CardLists.getValidCards(choices, sa.getParam("Choices"), activator, card);
String title = sa.hasParam("ChoiceTitle") ? sa.getParam("ChoiceTitle") : Localizer.getInstance().getMessage("lblChooseaCard") + " ";
tgtObjects.addAll(new CardCollection(pc.chooseCardsForEffect(choices, sa, title, n, n, !sa.hasParam("ChoiceOptional"))));
} else { } else {
tgtObjects.addAll(getDefinedOrTargeted(sa, "Defined")); tgtObjects.addAll(getDefinedOrTargeted(sa, "Defined"));
} }

View File

@@ -129,8 +129,6 @@ public class Card extends GameEntity implements Comparable<Card> {
private final Multimap<Long, Keyword> cantHaveKeywords = MultimapBuilder.hashKeys().enumSetValues(Keyword.class).build(); private final Multimap<Long, Keyword> cantHaveKeywords = MultimapBuilder.hashKeys().enumSetValues(Keyword.class).build();
private final Map<CounterType, Long> counterTypeTimestamps = Maps.newEnumMap(CounterType.class);
private final Map<Long, Integer> canBlockAdditional = Maps.newTreeMap(); private final Map<Long, Integer> canBlockAdditional = Maps.newTreeMap();
private final Set<Long> canBlockAny = Sets.newHashSet(); private final Set<Long> canBlockAny = Sets.newHashSet();
@@ -1307,44 +1305,12 @@ public class Card extends GameEntity implements Comparable<Card> {
getController().addCounterToPermThisTurn(counterType, addAmount); getController().addCounterToPermThisTurn(counterType, addAmount);
view.updateCounters(this); view.updateCounters(this);
} }
if (newValue <= 0) {
removeCounterTimestamp(counterType);
} else {
addCounterTimestamp(counterType);
}
if (table != null) { if (table != null) {
table.put(this, counterType, addAmount); table.put(this, counterType, addAmount);
} }
return addAmount; return addAmount;
} }
public boolean addCounterTimestamp(CounterType counterType) {
return addCounterTimestamp(counterType, true);
}
public boolean addCounterTimestamp(CounterType counterType, boolean updateView) {
if (!counterType.isKeywordCounter()) {
return false;
}
removeCounterTimestamp(counterType);
long timestamp = game.getNextTimestamp();
counterTypeTimestamps.put(counterType, timestamp);
addChangedCardKeywords(List.of(counterType.getKeyword().toString()), null, false, false, timestamp, updateView);
return true;
}
public boolean removeCounterTimestamp(CounterType counterType) {
return removeCounterTimestamp(counterType, true);
}
public boolean removeCounterTimestamp(CounterType counterType, boolean updateView) {
Long old = counterTypeTimestamps.remove(counterType);
if (old != null) {
removeChangedCardKeywords(old, updateView);
}
return old != null;
}
/** /**
* <p> * <p>
* addCountersAddedBy. * addCountersAddedBy.
@@ -1392,10 +1358,6 @@ public class Card extends GameEntity implements Comparable<Card> {
setCounters(counterName, newValue); setCounters(counterName, newValue);
view.updateCounters(this); view.updateCounters(this);
if (newValue <= 0) {
this.removeCounterTimestamp(counterName);
}
//fire card stats changed event if p/t bonuses or loyalty changed from subtracted counters //fire card stats changed event if p/t bonuses or loyalty changed from subtracted counters
if (powerBonusBefore != getPowerBonusFromCounters() || toughnessBonusBefore != getToughnessBonusFromCounters() || loyaltyBefore != getCurrentLoyalty()) { if (powerBonusBefore != getPowerBonusFromCounters() || toughnessBonusBefore != getToughnessBonusFromCounters() || loyaltyBefore != getCurrentLoyalty()) {
getGame().fireEvent(new GameEventCardStatsChanged(this)); getGame().fireEvent(new GameEventCardStatsChanged(this));
@@ -1418,23 +1380,8 @@ public class Card extends GameEntity implements Comparable<Card> {
@Override @Override
public final void setCounters(final Map<CounterType, Integer> allCounters) { public final void setCounters(final Map<CounterType, Integer> allCounters) {
boolean changed = false;
for (CounterType ct : counters.keySet()) {
if (removeCounterTimestamp(ct, false)) {
changed = true;
}
}
counters = allCounters; counters = allCounters;
view.updateCounters(this); view.updateCounters(this);
for (CounterType ct : counters.keySet()) {
if (addCounterTimestamp(ct, false)) {
changed = true;
}
}
if (changed) {
updateKeywords();
}
} }
@Override @Override
@@ -1442,16 +1389,6 @@ public class Card extends GameEntity implements Comparable<Card> {
if (counters.isEmpty()) { return; } if (counters.isEmpty()) { return; }
counters.clear(); counters.clear();
view.updateCounters(this); view.updateCounters(this);
boolean changed = false;
for (CounterType ct : counterTypeTimestamps.keySet()) {
if (removeCounterTimestamp(ct, false)) {
changed = true;
}
}
if (changed) {
updateKeywords();
}
} }
public final String getSVar(final String var) { public final String getSVar(final String var) {

View File

@@ -20,8 +20,6 @@ package forge.game.card;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import forge.game.keyword.Keyword;
/** /**
* The class Counters. * The class Counters.
* *
@@ -311,23 +309,7 @@ public enum CounterType {
EXPERIENCE("EXP"), EXPERIENCE("EXP"),
POISON("POISN"), POISON("POISN");
// Keyword Counters
FLYING("Flying"),
FIRST_STRIKE("First Strike"),
DOUBLE_STRIKE("Double Strike"),
DEATHTOUCH("Deathtouch"),
HEXPROOF("Hexproof"),
INDESTRUCTIBLE("Indestructible"),
LIFELINK("Lifelink"),
MENACE("Menace"),
REACH("Reach"),
TRAMPLE("Trample"),
VIGILANCE("Vigilance")
;
private String name, counterOnCardDisplayName; private String name, counterOnCardDisplayName;
private int red, green, blue; private int red, green, blue;
@@ -383,39 +365,6 @@ public enum CounterType {
return Enum.valueOf(CounterType.class, replacedName); return Enum.valueOf(CounterType.class, replacedName);
} }
public boolean isKeywordCounter() {
return this.getKeyword() != null;
}
public Keyword getKeyword() {
switch (this) {
case FLYING:
return Keyword.FLYING;
case FIRST_STRIKE:
return Keyword.FIRST_STRIKE;
case DOUBLE_STRIKE:
return Keyword.DOUBLE_STRIKE;
case DEATHTOUCH:
return Keyword.DEATHTOUCH;
case HEXPROOF:
return Keyword.HEXPROOF;
case INDESTRUCTIBLE:
return Keyword.INDESTRUCTIBLE;
case LIFELINK:
return Keyword.LIFELINK;
case MENACE:
return Keyword.MENACE;
case REACH:
return Keyword.REACH;
case TRAMPLE:
return Keyword.TRAMPLE;
case VIGILANCE:
return Keyword.VIGILANCE;
default:
return null;
}
}
public static final ImmutableList<CounterType> values = ImmutableList.copyOf(values()); public static final ImmutableList<CounterType> values = ImmutableList.copyOf(values());
} }

View File

@@ -1,9 +1,13 @@
Name:Dismantle Name:Dismantle
ManaCost:2 R ManaCost:2 R
Types:Sorcery Types:Sorcery
A:SP$ Destroy | Cost$ 2 R | ValidTgts$ Artifact | TgtPrompt$ Select target artifact | SubAbility$ DBChoice | SpellDescription$ Destroy target artifact. If that artifact had counters on it, put that many +1/+1 counters or charge counters on an artifact you control. A:SP$ Destroy | Cost$ 2 R | ValidTgts$ Artifact | TgtPrompt$ Select target artifact | RememberTargets$ True | SubAbility$ DBChoice | SpellDescription$ Destroy target artifact. If that artifact had counters on it, put that many +1/+1 counters or charge counters on an artifact you control.
SVar:DBChoice:DB$ GenericChoice | Choices$ DBPutP1P1,DBPutCharge | ConditionDefined$ Targeted | ConditionPresent$ Card.HasCounters | ConditionCompare$ GE1 | StackDescription$ put that many +1/+1 counters or charge counters on an artifact you control. SVar:DBChoice:DB$ GenericChoice | Choices$ DBP1P1,DBCharge | ConditionDefined$ Targeted | ConditionPresent$ Card.HasCounters | ConditionCompare$ GE1 | StackDescription$ put that many +1/+1 counters or charge counters on an artifact you control.
SVar:DBPutP1P1:DB$ PutCounter | Choices$ Artifact.YouCtrl | CounterType$ P1P1 | CounterNum$ X | References$ X | SpellDescription$ +1/+1 SVar:DBP1P1:DB$ ChooseCard | Choices$ Artifact.YouCtrl | Amount$ 1 | SpellDescription$ +1/+1 | SubAbility$ DBPutP1P1
SVar:DBPutCharge:DB$ PutCounter | Choices$ Artifact.YouCtrl | CounterType$ CHARGE | CounterNum$ X | References$ X | SpellDescription$ Charge SVar:DBPutP1P1:DB$ PutCounter | Defined$ ChosenCard | CounterType$ P1P1 | CounterNum$ X | References$ X | SubAbility$ DBCleanup
SVar:X:TargetedLKI$CardCounters.ALL SVar:DBCharge:DB$ ChooseCard | Choices$ Artifact.YouCtrl | Amount$ 1 | SpellDescription$ charge | SubAbility$ DBPutCharge
SVar:DBPutCharge:DB$ PutCounter | Defined$ ChosenCard | CounterType$ CHARGE | CounterNum$ X | References$ X | SpellDescription$ Charge | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:X:RememberedLKI$CardCounters.ALL
SVar:Picture:http://www.wizards.com/global/images/magic/general/dismantle.jpg
Oracle:Destroy target artifact. If that artifact had counters on it, put that many +1/+1 counters or charge counters on an artifact you control. Oracle:Destroy target artifact. If that artifact had counters on it, put that many +1/+1 counters or charge counters on an artifact you control.

View File

@@ -10,7 +10,9 @@ ALTERNATE
Name:Finality Name:Finality
ManaCost:4 B G ManaCost:4 B G
Types:Sorcery Types:Sorcery
A:SP$ PutCounter | Cost$ 4 B G | Choices$ Creature.YouCtrl | ChoiceOptional$ True | CounterType$ P1P1 | CounterNum$ 2 | SubAbility$ DBPumpAll | StackDescription$ SpellDescription | SpellDescription$ You may put two +1/+1 counters on a creature you control. Then all creatures get -4/-4 until end of turn. A:SP$ ChooseCard | Cost$ 4 B G | Defined$ You | Amount$ 1 | MinAmount$ 0 | Choices$ Creature.YouCtrl | SubAbility$ DBPutCounter | SpellDescription$ You may put two +1/+1 counters on a creature you control. Then all creatures get -4/-4 until end of turn.
SVar:DBPumpAll:DB$ PumpAll | ValidCards$ Creature | NumAtt$ -4 | NumDef$ -4 | IsCurse$ True SVar:DBPutCounter:DB$ PutCounter | Defined$ ChosenCard | CounterType$ P1P1 | CounterNum$ 2 | SubAbility$ DBPumpAll
SVar:DBPumpAll:DB$ PumpAll | ValidCards$ Creature | NumAtt$ -4 | NumDef$ -4 | IsCurse$ True | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearChosenCard$ True
DeckHas:Ability$Counters DeckHas:Ability$Counters
Oracle:You may put two +1/+1 counters on a creature you control. Then all creatures get -4/-4 until end of turn. Oracle:You may put two +1/+1 counters on a creature you control. Then all creatures get -4/-4 until end of turn.

View File

@@ -1,10 +1,12 @@
Name:Haphazard Bombardment Name:Haphazard Bombardment
ManaCost:5 R ManaCost:5 R
Types:Enchantment Types:Enchantment
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ DBPutCounter | TriggerDescription$ When CARDNAME enters the battlefield, choose four nonenchantment permanents you don't control and put an aim counter on each of them. T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigChoose | TriggerDescription$ When CARDNAME enters the battlefield, choose four nonenchantment permanents you don't control and put an aim counter on each of them.
SVar:DBPutCounter:DB$ PutCounter | Choices$ Permanent.YouDontCtrl+nonEnchantment | ChoiceAmount§ 4 | Defined$ ChosenCard | CounterType$ AIM | CounterNum$ 1 SVar:TrigChoose:DB$ ChooseCard | Defined$ You | Amount$ 4 | Choices$ Permanent.YouDontCtrl+nonEnchantment | SubAbility$ DBPutCounter | AILogic$ AtLeast1 | Mandatory$ True
SVar:DBPutCounter:DB$ PutCounter | Defined$ ChosenCard | CounterType$ AIM | CounterNum$ 1 | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearChosenCard$ True
T:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ You | TriggerZones$ Battlefield | IsPresent$ Permanent.YouDontCtrl+counters_GE1_AIM | PresentCompare$ GE2 | Execute$ TrigDestroy | TriggerDescription$ At the beginning of your end step, if two or more permanents you don't control have an aim counter on them, destroy one of those permanents at random. T:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ You | TriggerZones$ Battlefield | IsPresent$ Permanent.YouDontCtrl+counters_GE1_AIM | PresentCompare$ GE2 | Execute$ TrigDestroy | TriggerDescription$ At the beginning of your end step, if two or more permanents you don't control have an aim counter on them, destroy one of those permanents at random.
SVar:TrigDestroy:DB$ ChooseCard | Amount$ 1 | AtRandom$ True | Choices$ Permanent.YouDontCtrl+counters_GE1_AIM | SubAbility$ DBDestroy SVar:TrigDestroy:DB$ ChooseCard | Amount$ 1 | AtRandom$ True | Choices$ Permanent.YouDontCtrl+counters_GE1_AIM | SubAbility$ DBDestroy
SVar:DBDestroy:DB$ Destroy | Defined$ ChosenCard | SubAbility$ DBCleanup SVar:DBDestroy:DB$ Destroy | Defined$ ChosenCard | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearChosenCard$ True SVar:Picture:http://www.wizards.com/global/images/magic/general/haphazard_bombardment.jpg
Oracle:When Haphazard Bombardment enters the battlefield, choose four nonenchantment permanents you don't control and put an aim counter on each of them.\nAt the beginning of your end step, if two or more permanents you don't control have an aim counter on them, destroy one of those permanents at random. Oracle:When Haphazard Bombardment enters the battlefield, choose four nonenchantment permanents you don't control and put an aim counter on each of them.\nAt the beginning of your end step, if two or more permanents you don't control have an aim counter on them, destroy one of those permanents at random.

View File

@@ -1,6 +1,7 @@
Name:Settle the Score Name:Settle the Score
ManaCost:2 B B ManaCost:2 B B
Types:Sorcery Types:Sorcery
A:SP$ ChangeZone | Cost$ 2 B B | ValidTgts$ Creature | TgtPrompt$ Select target creature | Origin$ Battlefield | Destination$ Exile | SubAbility$ DBPutLoyalty | SpellDescription$ Exile target creature. Put two loyalty counters on a planeswalker you control. A:SP$ ChangeZone | Cost$ 2 B B | ValidTgts$ Creature | TgtPrompt$ Select target creature | Origin$ Battlefield | Destination$ Exile | SubAbility$ DBChoice | SpellDescription$ Exile target creature. Put two loyalty counters on a planeswalker you control.
SVar:DBPutLoyalty:DB$ PutCounter | Choices$ Planeswalker.YouCtrl | CounterType$ LOYALTY | CounterNum$ 2 SVar:DBChoice:DB$ ChooseCard | Choices$ Planeswalker.YouCtrl | Amount$ 1 | Mandatory$ True | SubAbility$ DBPutLoyalty
SVar:DBPutLoyalty:DB$ PutCounter | Defined$ ChosenCard | CounterType$ LOYALTY | CounterNum$ 2
Oracle:Exile target creature. Put two loyalty counters on a planeswalker you control. Oracle:Exile target creature. Put two loyalty counters on a planeswalker you control.

View File

@@ -1,8 +1,9 @@
Name:The Elderspell Name:The Elderspell
ManaCost:B B ManaCost:B B
Types:Sorcery Types:Sorcery
A:SP$ Destroy | Cost$ B B | ValidTgts$ Planeswalker | TgtPrompt$ Select target planeswalker | TargetMin$ 0 | TargetMax$ MaxTargets | References$ MaxTargets | SubAbility$ DBPutLoyalty | RememberDestroyed$ True | SpellDescription$ Destroy any number of target planeswalkers. Choose a planeswalker you control. Put two loyalty counters on it for each planeswalker destroyed this way. A:SP$ Destroy | Cost$ B B | ValidTgts$ Planeswalker | TgtPrompt$ Select target planeswalker | TargetMin$ 0 | TargetMax$ MaxTargets | References$ MaxTargets | SubAbility$ DBChooseCard | RememberDestroyed$ True | SpellDescription$ Destroy any number of target planeswalkers. Choose a planeswalker you control. Put two loyalty counters on it for each planeswalker destroyed this way.
SVar:DBPutLoyalty:DB$ PutCounter | Choices$ Planeswalker.YouCtrl | CounterType$ LOYALTY | CounterNum$ X | References$ X | SubAbility$ DBCleanup SVar:DBChooseCard:DB$ ChooseCard | Defined$ You | Amount$ 1 | Choices$ Planeswalker.YouCtrl | Mandatory$ True | SubAbility$ DBPutLoyalty
SVar:DBPutLoyalty:DB$ PutCounter | Defined$ ChosenCard | CounterType$ LOYALTY | CounterNum$ X | References$ X | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:MaxTargets:Count$Valid Planeswalker SVar:MaxTargets:Count$Valid Planeswalker
SVar:X:Count$RememberedSize/Twice SVar:X:Count$RememberedSize/Twice

View File

@@ -1,6 +0,0 @@
Name:Fully Grown
ManaCost:2 G
Types:Instant
A:SP$ Pump | Cost$ 2 G | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ +3 | NumDef$ +3 | SubAbility$ PutCounter | SpellDescription$ Target creature gets +3/+3 until end of turn. Put a trample counter on it.
SVar:PutCounter:DB$ PutCounter | Defined$ Targeted | CounterType$ TRAMPLE | CounterNum$ 1
Oracle:Target creature gets +3/+3 until end of turn. Put a trample counter on it.