mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Merge pull request #2224 from Dilnu/master
Improve Counter and Zone code
This commit is contained in:
commit
9e20efa444
275 changed files with 411 additions and 601 deletions
|
@ -246,14 +246,14 @@ public class CardView extends SimpleCardView {
|
|||
if (card instanceof Permanent) {
|
||||
this.mageObjectType = MageObjectType.PERMANENT;
|
||||
Permanent permanent = (Permanent) card;
|
||||
this.loyalty = Integer.toString(permanent.getCounters().getCount(CounterType.LOYALTY));
|
||||
this.loyalty = Integer.toString(permanent.getCounters(game).getCount(CounterType.LOYALTY));
|
||||
this.pairedCard = permanent.getPairedCard() != null ? permanent.getPairedCard().getSourceId() : null;
|
||||
if (!permanent.getControllerId().equals(permanent.getOwnerId())) {
|
||||
controlledByOwner = false;
|
||||
}
|
||||
if (game != null && permanent.getCounters() != null && !permanent.getCounters().isEmpty()) {
|
||||
if (game != null && permanent.getCounters(game) != null && !permanent.getCounters(game).isEmpty()) {
|
||||
counters = new ArrayList<>();
|
||||
for (Counter counter : permanent.getCounters().values()) {
|
||||
for (Counter counter : permanent.getCounters(game).values()) {
|
||||
counters.add(new CounterView(counter));
|
||||
}
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ public class CardView extends SimpleCardView {
|
|||
this.mageObjectType = MageObjectType.PERMANENT;
|
||||
this.power = Integer.toString(object.getPower().getValue());
|
||||
this.toughness = Integer.toString(object.getToughness().getValue());
|
||||
this.loyalty = Integer.toString(((Permanent) object).getCounters().getCount(CounterType.LOYALTY));
|
||||
this.loyalty = Integer.toString(((Permanent) object).getCounters((Game)null).getCount(CounterType.LOYALTY));
|
||||
} else {
|
||||
this.power = object.getPower().toString();
|
||||
this.toughness = object.getToughness().toString();
|
||||
|
|
|
@ -64,8 +64,8 @@ public class ArtificialScoringSystem {
|
|||
|
||||
public static int getVariablePermanentScore(final Game game, final Permanent permanent) {
|
||||
|
||||
int score = permanent.getCounters().getCount(CounterType.CHARGE) * 30;
|
||||
score += permanent.getCounters().getCount(CounterType.LEVEL) * 30;
|
||||
int score = permanent.getCounters(game).getCount(CounterType.CHARGE) * 30;
|
||||
score += permanent.getCounters(game).getCount(CounterType.LEVEL) * 30;
|
||||
score -= permanent.getDamage() * 2;
|
||||
if (!canTap(permanent)) {
|
||||
score += getTappedScore(permanent);
|
||||
|
|
|
@ -30,7 +30,7 @@ public class LevelUpOptimizer extends BaseTreeOptimizer {
|
|||
if (permanent != null && permanent instanceof PermanentCard) {
|
||||
PermanentCard leveler = (PermanentCard) permanent;
|
||||
// check already existing Level counters and compare to maximum that make sense
|
||||
if (permanent.getCounters().getCount(CounterType.LEVEL) >= leveler.getMaxLevelCounters()) {
|
||||
if (permanent.getCounters(game).getCount(CounterType.LEVEL) >= leveler.getMaxLevelCounters()) {
|
||||
removeAbility(ability);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public class CombatSimulator implements Serializable {
|
|||
}
|
||||
else {
|
||||
Permanent permanent = game.getPermanent(defenderId);
|
||||
simCombat.planeswalkerLoyalty.put(defenderId, permanent.getCounters().getCount(CounterType.LOYALTY));
|
||||
simCombat.planeswalkerLoyalty.put(defenderId, permanent.getCounters(game).getCount(CounterType.LOYALTY));
|
||||
}
|
||||
}
|
||||
return simCombat;
|
||||
|
|
|
@ -111,7 +111,7 @@ public class GameStateEvaluator {
|
|||
if (!(ability instanceof ManaAbility) && ability.canActivate(ability.getControllerId(), game))
|
||||
value += ability.getEffects().size();
|
||||
}
|
||||
for (Counter counter: permanent.getCounters().values()) {
|
||||
for (Counter counter: permanent.getCounters(game).values()) {
|
||||
if (!(counter instanceof BoostCounter)) {
|
||||
value += counter.getCount();
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ class AvenEffect extends ContinuousEffectImpl {
|
|||
@Override
|
||||
public boolean isInactive(Ability source, Game game) {
|
||||
Permanent creature = game.getPermanent(this.targetPointer.getFirst(game, source));
|
||||
if (creature != null && creature.getCounters().getCount(CounterType.FEATHER) < 1) {
|
||||
if (creature != null && creature.getCounters(game).getCount(CounterType.FEATHER) < 1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -160,7 +160,7 @@ class AvenEffect2 extends ContinuousEffectImpl {
|
|||
@Override
|
||||
public boolean isInactive(Ability source, Game game) {
|
||||
Permanent creature = game.getPermanent(this.targetPointer.getFirst(game, source));
|
||||
if (creature != null && creature.getCounters().getCount(CounterType.FEATHER) < 1) {
|
||||
if (creature != null && creature.getCounters(game).getCount(CounterType.FEATHER) < 1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -104,7 +104,7 @@ class MindFuneralEffect extends OneShotEffect {
|
|||
cards.add(card);
|
||||
}
|
||||
opponent.revealCards("Mind Funeral", cards, game);
|
||||
opponent.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
opponent.moveCards(cards, Zone.GRAVEYARD, source, game);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ class MakeshiftMannequinGainAbilityEffect extends ContinuousEffectImpl {
|
|||
@Override
|
||||
public boolean isInactive(Ability source, Game game) {
|
||||
Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
|
||||
return permanent == null || permanent.getCounters().getCount(CounterType.MANNEQUIN) < 1;
|
||||
return permanent == null || permanent.getCounters(game).getCount(CounterType.MANNEQUIN) < 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -117,7 +117,7 @@ class DescentIntoMadnessEffect extends OneShotEffect {
|
|||
sourcePermanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
|
||||
}
|
||||
if (sourcePermanent != null && controller != null) {
|
||||
int count = sourcePermanent.getCounters().getCount(CounterType.DESPAIR);
|
||||
int count = sourcePermanent.getCounters(game).getCount(CounterType.DESPAIR);
|
||||
if (count > 0) {
|
||||
// select the permanents and hand cards in turn order
|
||||
LinkedList<UUID> selectedObjects = new LinkedList<>();
|
||||
|
|
|
@ -94,7 +94,7 @@ class HeraldOfWarCostReductionEffect extends CostModificationEffectImpl {
|
|||
SpellAbility spellAbility = (SpellAbility) abilityToModify;
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (sourcePermanent != null) {
|
||||
int amount = sourcePermanent.getCounters().getCount(CounterType.P1P1);
|
||||
int amount = sourcePermanent.getCounters(game).getCount(CounterType.P1P1);
|
||||
if (amount > 0) {
|
||||
CardUtil.adjustCost(spellAbility, amount);
|
||||
return true;
|
||||
|
|
|
@ -91,7 +91,7 @@ class OtherworldAtlasDrawEffect extends OneShotEffect {
|
|||
Player sourcePlayer = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
int amount = permanent.getCounters().getCount(CounterType.CHARGE);
|
||||
int amount = permanent.getCounters(game).getCount(CounterType.CHARGE);
|
||||
if (amount > 0) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(sourcePlayer.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
|
|
|
@ -93,7 +93,7 @@ class BaneOfBalaGedEffect extends OneShotEffect {
|
|||
if (defendingPlayer != null) {
|
||||
Target target = new TargetControlledPermanent(2);
|
||||
defendingPlayer.chooseTarget(outcome, target, source, game);
|
||||
defendingPlayer.moveCards(new CardsImpl(target.getTargets()), null, Zone.EXILED, source, game);
|
||||
defendingPlayer.moveCards(new CardsImpl(target.getTargets()), Zone.EXILED, source, game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -107,7 +107,7 @@ class BlightHerderEffect extends OneShotEffect {
|
|||
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
|
||||
if (controller.chooseTarget(outcome, target, source, game)) {
|
||||
Cards cardsToGraveyard = new CardsImpl(target.getTargets());
|
||||
controller.moveCards(cardsToGraveyard, null, Zone.GRAVEYARD, source, game);
|
||||
controller.moveCards(cardsToGraveyard, Zone.GRAVEYARD, source, game);
|
||||
return new CreateTokenEffect(new EldraziScionToken(), 3).apply(game, source);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -192,7 +192,7 @@ class KioraRevealEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
}
|
||||
controller.moveCards(cards, null, Zone.GRAVEYARD, source, game);
|
||||
controller.moveCards(cards, Zone.GRAVEYARD, source, game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -108,7 +108,7 @@ class UlamogsDespoilerEffect extends OneShotEffect {
|
|||
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
|
||||
if (controller.chooseTarget(outcome, target, source, game)) {
|
||||
Cards cardsToGraveyard = new CardsImpl(target.getTargets());
|
||||
controller.moveCards(cardsToGraveyard, null, Zone.GRAVEYARD, source, game);
|
||||
controller.moveCards(cardsToGraveyard, Zone.GRAVEYARD, source, game);
|
||||
return new AddCountersSourceEffect(CounterType.P1P1.createInstance(4)).apply(game, source);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ class UlamogsNullifierEffect extends OneShotEffect {
|
|||
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
|
||||
if (controller.chooseTarget(outcome, target, source, game)) {
|
||||
Cards cardsToGraveyard = new CardsImpl(target.getTargets());
|
||||
controller.moveCards(cardsToGraveyard, null, Zone.GRAVEYARD, source, game);
|
||||
controller.moveCards(cardsToGraveyard, Zone.GRAVEYARD, source, game);
|
||||
game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ class UndergrowthChampionPreventionEffect extends PreventionEffectImpl {
|
|||
}
|
||||
}
|
||||
|
||||
if(removeCounter && permanent.getCounters().containsKey(CounterType.P1P1)) {
|
||||
if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) {
|
||||
preventDamageAction(event, source, game);
|
||||
StringBuilder sb = new StringBuilder(permanent.getName()).append(": ");
|
||||
permanent.removeCounters(CounterType.P1P1.createInstance(), game);
|
||||
|
|
|
@ -91,8 +91,8 @@ class SwayOfTheStarsEffect extends OneShotEffect {
|
|||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
player.moveCards(player.getHand(), Zone.HAND, Zone.LIBRARY, source, game);
|
||||
player.moveCards(player.getGraveyard(), Zone.GRAVEYARD, Zone.LIBRARY, source, game);
|
||||
player.moveCards(player.getHand(), Zone.LIBRARY, source, game);
|
||||
player.moveCards(player.getGraveyard(), Zone.LIBRARY, source, game);
|
||||
FilterPermanent filter = new FilterPermanent();
|
||||
filter.add(new OwnerIdPredicate(playerId));
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, controller.getId(), source.getSourceId(), game)) {
|
||||
|
|
|
@ -93,7 +93,7 @@ class AstralCornucopiaManaAbility extends ManaAbility {
|
|||
netMana.clear();
|
||||
Permanent sourcePermanent = game.getPermanent(getSourceId());
|
||||
if (sourcePermanent != null) {
|
||||
int counters = sourcePermanent.getCounters().getCount(CounterType.CHARGE.getName());
|
||||
int counters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE.getName());
|
||||
if (counters > 0) {
|
||||
netMana.add(new Mana(0, 0, 0, 0, 0, 0, counters, 0));
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ class AstralCornucopiaManaEffect extends ManaEffect {
|
|||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (choice.getChoice() != null) {
|
||||
String color = choice.getChoice();
|
||||
int counters = sourcePermanent.getCounters().getCount(CounterType.CHARGE.getName());
|
||||
int counters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE.getName());
|
||||
switch (color) {
|
||||
case "Red":
|
||||
computedMana.setRed(counters);
|
||||
|
|
|
@ -113,7 +113,7 @@ class SatyrWayfinderEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
}
|
||||
controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
controller.moveCards(cards, Zone.GRAVEYARD, source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -119,8 +119,8 @@ class GiftsUngivenEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
|
||||
player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
player.moveCards(cardsToKeep, Zone.LIBRARY, Zone.HAND, source, game);
|
||||
player.moveCards(cards, Zone.GRAVEYARD, source, game);
|
||||
player.moveCards(cardsToKeep, Zone.HAND, source, game);
|
||||
}
|
||||
player.shuffleLibrary(source, game);
|
||||
return true;
|
||||
|
|
|
@ -188,7 +188,7 @@ class HankyuCountersSourceCost extends CostImpl {
|
|||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Permanent equipment = game.getPermanent(this.effectGivingEquipmentId);
|
||||
if (equipment != null ) {
|
||||
this.removedCounters = equipment.getCounters().getCount(CounterType.AIM);
|
||||
this.removedCounters = equipment.getCounters(game).getCount(CounterType.AIM);
|
||||
if (this.removedCounters > 0) {
|
||||
equipment.removeCounters("aim", this.removedCounters, game);
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ class InameDeathAspectEffect extends SearchEffect {
|
|||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null && player.searchLibrary(target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
player.moveCards(new CardsImpl(target.getTargets()), Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
player.moveCards(new CardsImpl(target.getTargets()), Zone.GRAVEYARD, source, game);
|
||||
}
|
||||
player.shuffleLibrary(source, game);
|
||||
return true;
|
||||
|
|
|
@ -112,7 +112,7 @@ class PiousKitsuneEffect extends OneShotEffect {
|
|||
if (game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game) > 0) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
int life = permanent.getCounters().getCount(CounterType.DEVOTION);
|
||||
int life = permanent.getCounters(game).getCount(CounterType.DEVOTION);
|
||||
if (life > 0) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
|
|
|
@ -131,7 +131,7 @@ class DarkDepthsAbility extends StateTriggeredAbility {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent permanent = game.getPermanent(getSourceId());
|
||||
return permanent != null && permanent.getCounters().getCount(CounterType.ICE) == 0;
|
||||
return permanent != null && permanent.getCounters(game).getCount(CounterType.ICE) == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -128,7 +128,7 @@ class HibernationsEndEffect extends OneShotEffect {
|
|||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
if (sourcePermanent != null && player != null) {
|
||||
int newConvertedCost = sourcePermanent.getCounters().getCount("age");
|
||||
int newConvertedCost = sourcePermanent.getCounters(game).getCount("age");
|
||||
FilterCard filter = new FilterCard("creature card with converted mana cost " + newConvertedCost);
|
||||
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, newConvertedCost));
|
||||
filter.add(new CardTypePredicate(CardType.CREATURE));
|
||||
|
|
|
@ -117,7 +117,7 @@ class AnimarCostReductionEffect extends CostModificationEffectImpl {
|
|||
Ability spellAbility = (SpellAbility) abilityToModify;
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (sourcePermanent != null && spellAbility != null) {
|
||||
int amount = sourcePermanent.getCounters().getCount(CounterType.P1P1);
|
||||
int amount = sourcePermanent.getCounters(game).getCount(CounterType.P1P1);
|
||||
if (amount > 0) {
|
||||
CardUtil.reduceCost(spellAbility, amount);
|
||||
return true;
|
||||
|
|
|
@ -89,7 +89,7 @@ class BuriedAliveEffect extends SearchEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller.searchLibrary(target, game)) {
|
||||
controller.moveCards(new CardsImpl(target.getTargets()), Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
controller.moveCards(new CardsImpl(target.getTargets()), Zone.GRAVEYARD, source, game);
|
||||
}
|
||||
controller.shuffleLibrary(source, game);
|
||||
return true;
|
||||
|
|
|
@ -124,7 +124,7 @@ class DesecratorHagEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
return you.moveCards(cards, null, Zone.HAND, source, game);
|
||||
return you.moveCards(cards, Zone.HAND, source, game);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -123,7 +123,7 @@ class VishKalBloodArbiterCost extends CostImpl {
|
|||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Permanent permanent = game.getPermanent(sourceId);
|
||||
if (permanent != null) {
|
||||
this.amount = permanent.getCounters().getCount(name);
|
||||
this.amount = permanent.getCounters(game).getCount(name);
|
||||
permanent.removeCounters(name, amount, game);
|
||||
this.paid = true;
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ class FosterEffect extends OneShotEffect {
|
|||
controller.moveCards(cardFound, Zone.HAND, source, game);
|
||||
cards.remove(cardFound);
|
||||
}
|
||||
controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
controller.moveCards(cards, Zone.GRAVEYARD, source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ public class MarathWillOfTheWild extends CardImpl {
|
|||
if (ability instanceof SimpleActivatedAbility && ability.getModes().size() == 3) {
|
||||
Permanent sourcePermanent = game.getPermanent(ability.getSourceId());
|
||||
if (sourcePermanent != null) {
|
||||
int amount = sourcePermanent.getCounters().getCount(CounterType.P1P1);
|
||||
int amount = sourcePermanent.getCounters(game).getCount(CounterType.P1P1);
|
||||
if (amount > 0) {
|
||||
for (VariableCost cost: ability.getManaCostsToPay().getVariableCosts()) {
|
||||
if (cost instanceof VariableManaCost) {
|
||||
|
@ -192,7 +192,7 @@ class MarathWillOfTheWildRemoveCountersCost extends CostImpl {
|
|||
@Override
|
||||
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
|
||||
Permanent permanent = game.getPermanent(sourceId);
|
||||
if (permanent != null && permanent.getCounters().getCount(CounterType.P1P1) > 0) {
|
||||
if (permanent != null && permanent.getCounters(game).getCount(CounterType.P1P1) > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -202,7 +202,7 @@ class MarathWillOfTheWildRemoveCountersCost extends CostImpl {
|
|||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
int amount = new ManacostVariableValue().calculate(game, ability, null);
|
||||
Permanent permanent = game.getPermanent(sourceId);
|
||||
if (permanent != null && permanent.getCounters().getCount(CounterType.P1P1) >= amount) {
|
||||
if (permanent != null && permanent.getCounters(game).getCount(CounterType.P1P1) >= amount) {
|
||||
permanent.removeCounters(CounterType.P1P1.getName(), amount, game);
|
||||
this.paid = true;
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ class PhantomNantukoPreventionEffect extends PreventionEffectImpl {
|
|||
}
|
||||
}
|
||||
|
||||
if(removeCounter && permanent.getCounters().containsKey(CounterType.P1P1)) {
|
||||
if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) {
|
||||
StringBuilder sb = new StringBuilder(permanent.getName()).append(": ");
|
||||
permanent.removeCounters(CounterType.P1P1.createInstance(), game);
|
||||
sb.append("Removed a +1/+1 counter ");
|
||||
|
|
|
@ -101,7 +101,7 @@ class PlagueBoilerEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (controller != null && sourcePermanent != null) {
|
||||
if (!sourcePermanent.getCounters().containsKey(CounterType.PLAGUE) || controller.chooseUse(outcome, "Put a plague counter on? (No removes one)", source, game)) {
|
||||
if (!sourcePermanent.getCounters(game).containsKey(CounterType.PLAGUE) || controller.chooseUse(outcome, "Put a plague counter on? (No removes one)", source, game)) {
|
||||
return new AddCountersSourceEffect(CounterType.PLAGUE.createInstance(), true).apply(game, source);
|
||||
} else {
|
||||
return new RemoveCounterSourceEffect(CounterType.PLAGUE.createInstance()).apply(game, source);
|
||||
|
@ -135,7 +135,7 @@ class PlagueBoilerTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getTargetId().equals(this.getSourceId()) && event.getData().equals(CounterType.PLAGUE.getName())) {
|
||||
Permanent sourcePermanent = game.getPermanent(this.getSourceId());
|
||||
if (sourcePermanent != null && sourcePermanent.getCounters().getCount(CounterType.PLAGUE) >= 3) {
|
||||
if (sourcePermanent != null && sourcePermanent.getCounters(game).getCount(CounterType.PLAGUE) >= 3) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ class StrategicPlanningEffect extends OneShotEffect {
|
|||
cards.remove(card);
|
||||
}
|
||||
}
|
||||
controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
controller.moveCards(cards, Zone.GRAVEYARD, source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -90,8 +90,8 @@ class AEtherSnapEffect extends OneShotEffect {
|
|||
for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterPermanent(), controller.getId(), source.getSourceId(), game)) {
|
||||
if (permanent instanceof PermanentToken) {
|
||||
controller.moveCardToExileWithInfo(permanent, null, "", source.getSourceId(), game, Zone.BATTLEFIELD, true);
|
||||
} else if (!permanent.getCounters().isEmpty()) {
|
||||
Counters counters = permanent.getCounters().copy();
|
||||
} else if (!permanent.getCounters(game).isEmpty()) {
|
||||
Counters counters = permanent.getCounters(game).copy();
|
||||
for (Counter counter : counters.values()) {
|
||||
permanent.removeCounters(counter, game);
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ class GraveSifterEffect extends OneShotEffect {
|
|||
filter.add(new SubtypePredicate(typeChoice.getChoice()));
|
||||
Target target = new TargetCardInYourGraveyard(0, Integer.MAX_VALUE, filter);
|
||||
player.chooseTarget(outcome, target, source, game);
|
||||
player.moveCards(new CardsImpl(target.getTargets()), null, Zone.HAND, source, game);
|
||||
player.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ class StitcherGeralfEffect extends OneShotEffect {
|
|||
cards.addAll(player.getLibrary().getTopCards(game, 3));
|
||||
}
|
||||
}
|
||||
controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
controller.moveCards(cards, Zone.GRAVEYARD, source, game);
|
||||
TargetCard target = new TargetCard(0,2,Zone.GRAVEYARD, new FilterCreatureCard("creature cards to exile"));
|
||||
controller.chooseTarget(outcome, cards, target, source, game);
|
||||
int power = 0;
|
||||
|
|
|
@ -106,7 +106,7 @@ class BloodsporeThrinaxEntersBattlefieldEffect extends ReplacementEffectImpl {
|
|||
Permanent sourceCreature = game.getPermanent(source.getSourceId());
|
||||
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (sourceCreature != null && creature != null) {
|
||||
int amount = sourceCreature.getCounters().getCount(CounterType.P1P1);
|
||||
int amount = sourceCreature.getCounters(game).getCount(CounterType.P1P1);
|
||||
if (amount > 0) {
|
||||
creature.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ class ThiefOfBloodEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
int countersRemoved = 0;
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
|
||||
Counters counters = permanent.getCounters().copy();
|
||||
Counters counters = permanent.getCounters(game).copy();
|
||||
for (Counter counter : counters.values()) {
|
||||
permanent.removeCounters(counter.getName(), counter.getCount(), game);
|
||||
countersRemoved += counter.getCount();
|
||||
|
|
|
@ -140,7 +140,7 @@ class GwafaHazidProfiteerEffect2 extends RestrictionEffect {
|
|||
|
||||
@Override
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
return permanent.getCounters().containsKey(CounterType.BRIBERY);
|
||||
return permanent.getCounters(game).containsKey(CounterType.BRIBERY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -104,7 +104,7 @@ class TeleminPerformanceEffect extends OneShotEffect {
|
|||
}
|
||||
if (!cards.isEmpty()) {
|
||||
opponent.revealCards("Telemin Performance", cards, game);
|
||||
opponent.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
opponent.moveCards(cards, Zone.GRAVEYARD, source, game);
|
||||
}
|
||||
if (creature != null) {
|
||||
return creature.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId());
|
||||
|
|
|
@ -148,7 +148,7 @@ class JarOfEyeballsCost extends CostImpl {
|
|||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Permanent permanent = game.getPermanent(ability.getSourceId());
|
||||
if (permanent != null) {
|
||||
this.removedCounters = permanent.getCounters().getCount(CounterType.EYEBALL);
|
||||
this.removedCounters = permanent.getCounters(game).getCount(CounterType.EYEBALL);
|
||||
if (this.removedCounters > 0) {
|
||||
permanent.removeCounters(CounterType.EYEBALL.createInstance(this.removedCounters), game);
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ class TrackersInstinctsEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
}
|
||||
controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
controller.moveCards(cards, Zone.GRAVEYARD, source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ class AEtherVialEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
int count = permanent.getCounters().getCount(CounterType.CHARGE);
|
||||
int count = permanent.getCounters(game).getCount(CounterType.CHARGE);
|
||||
|
||||
FilterCreatureCard filter = new FilterCreatureCard("creature card with converted mana cost equal to " + count);
|
||||
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, count));
|
||||
|
|
|
@ -109,8 +109,8 @@ class ChromescaleDrakeEffect extends OneShotEffect {
|
|||
cards.remove(card);
|
||||
}
|
||||
}
|
||||
controller.moveCards(cardsToHand, Zone.LIBRARY, Zone.HAND, source, game);
|
||||
controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
controller.moveCards(cardsToHand, Zone.HAND, source, game);
|
||||
controller.moveCards(cards, Zone.GRAVEYARD, source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ class DarksteelReactorStateTriggeredAbility extends StateTriggeredAbility {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent permanent = game.getPermanent(this.getSourceId());
|
||||
if(permanent != null && permanent.getCounters().getCount(CounterType.CHARGE) >= 20){
|
||||
if(permanent != null && permanent.getCounters(game).getCount(CounterType.CHARGE) >= 20){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -125,7 +125,7 @@ class BoundEffect extends OneShotEffect {
|
|||
TargetCardInYourGraveyard targetCard = new TargetCardInYourGraveyard(0, colors,
|
||||
new FilterCard("up to " + colors + " card" + (colors > 1 ? "s" : "") + " from your graveyard"));
|
||||
controller.chooseTarget(outcome, targetCard, source, game);
|
||||
controller.moveCards(new CardsImpl(targetCard.getTargets()), null, Zone.HAND, source, game);
|
||||
controller.moveCards(new CardsImpl(targetCard.getTargets()), Zone.HAND, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ class CytoplastRootKinEffect extends OneShotEffect {
|
|||
if (sourcePermanent != null
|
||||
&& targetPermanent != null
|
||||
&& !sourcePermanent.getId().equals(targetPermanent.getId())
|
||||
&& targetPermanent.getCounters().getCount(CounterType.P1P1) > 0) {
|
||||
&& targetPermanent.getCounters(game).getCount(CounterType.P1P1) > 0) {
|
||||
targetPermanent.removeCounters(CounterType.P1P1.createInstance(), game);
|
||||
sourcePermanent.addCounters(CounterType.P1P1.createInstance(), game);
|
||||
return true;
|
||||
|
|
|
@ -136,7 +136,7 @@ class MomirVigSimicVisionaryEffect extends OneShotEffect {
|
|||
cards.remove(card);
|
||||
}
|
||||
}
|
||||
controller.moveCards(cardsToHand, null, Zone.HAND, source, game);
|
||||
controller.moveCards(cardsToHand, Zone.HAND, source, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ class RiseEffect extends OneShotEffect {
|
|||
if (permanent != null) {
|
||||
cardsToHand.add(permanent);
|
||||
}
|
||||
controller.moveCards(cardsToHand, null, Zone.HAND, source, game);
|
||||
controller.moveCards(cardsToHand, Zone.HAND, source, game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -89,7 +89,7 @@ class BredForTheHuntTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (((DamagedEvent) event).isCombatDamage()) {
|
||||
Permanent creature = game.getPermanent(event.getSourceId());
|
||||
if (creature != null && creature.getControllerId().equals(getControllerId()) && creature.getCounters().getCount(CounterType.P1P1) > 0) {
|
||||
if (creature != null && creature.getControllerId().equals(getControllerId()) && creature.getCounters(game).getCount(CounterType.P1P1) > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ class TakeEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Permanent creature = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (creature != null) {
|
||||
int numberCounters = creature.getCounters().getCount(CounterType.P1P1);
|
||||
int numberCounters = creature.getCounters(game).getCount(CounterType.P1P1);
|
||||
if (numberCounters > 0) {
|
||||
creature.removeCounters(CounterType.P1P1.getName(), numberCounters, game);
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
|
|
|
@ -119,7 +119,7 @@ class MirkoVoskMindDrinkerEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
player.revealCards("by " + sourceObject.getName() + " from " + player.getName(), cards, game);
|
||||
player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
player.moveCards(cards, Zone.GRAVEYARD, source, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ class VorelOfTheHullCladeEffect extends OneShotEffect {
|
|||
if (target == null) {
|
||||
return false;
|
||||
}
|
||||
for (Counter counter : target.getCounters().values()) {
|
||||
for (Counter counter : target.getCounters(game).values()) {
|
||||
Counter newCounter = new Counter(counter.getName(), counter.getCount());
|
||||
target.addCounters(newCounter, game);
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ class CountersOnControlledCount implements DynamicValue {
|
|||
Permanent enchantment = game.getPermanent(sourceAbility.getSourceId());
|
||||
for (Permanent permanent : game.getState().getBattlefield().getAllActivePermanents(filter, sourceAbility.getControllerId(), game)) {
|
||||
if (!permanent.getId().equals(enchantment.getAttachedTo())) {
|
||||
count += permanent.getCounters().getCount(CounterType.P1P1);
|
||||
count += permanent.getCounters(game).getCount(CounterType.P1P1);
|
||||
}
|
||||
}
|
||||
return count;
|
||||
|
|
|
@ -111,7 +111,7 @@ class GurmagDrownerEffect extends OneShotEffect {
|
|||
cards.remove(card);
|
||||
}
|
||||
}
|
||||
controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
controller.moveCards(cards, Zone.GRAVEYARD, source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ class MythRealizedSetPTEffect extends ContinuousEffectImpl {
|
|||
if (controller != null) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null && new MageObjectReference(source.getSourceObject(game), game).refersTo(permanent, game)) {
|
||||
int amount = permanent.getCounters().getCount(CounterType.LORE);
|
||||
int amount = permanent.getCounters(game).getCount(CounterType.LORE);
|
||||
permanent.getPower().setValue(amount);
|
||||
permanent.getToughness().setValue(amount);
|
||||
return true;
|
||||
|
|
|
@ -105,7 +105,7 @@ class ProfanerOfTheDeadReturnEffect extends OneShotEffect {
|
|||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||
cardsToHand.add(permanent);
|
||||
}
|
||||
controller.moveCards(cardsToHand, null, Zone.HAND, source, game);
|
||||
controller.moveCards(cardsToHand, Zone.HAND, source, game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -104,7 +104,7 @@ class ServantOfTheScaleEffect extends OneShotEffect {
|
|||
if (sourcePermanent != null && controller != null &&
|
||||
(sourcePermanent.getZoneChangeCounter(game) == source.getSourceObjectZoneChangeCounter() // Token
|
||||
|| sourcePermanent.getZoneChangeCounter(game) + 1 == source.getSourceObjectZoneChangeCounter())) { // PermanentCard
|
||||
int amount = sourcePermanent.getCounters().getCount(CounterType.P1P1);
|
||||
int amount = sourcePermanent.getCounters(game).getCount(CounterType.P1P1);
|
||||
if (amount > 0) {
|
||||
Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(amount));
|
||||
effect.setTargetPointer(targetPointer);
|
||||
|
|
|
@ -139,7 +139,7 @@ class IdentityThiefEffect extends OneShotEffect {
|
|||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
if (controller != null && permanent != null && sourcePermanent != null) {
|
||||
Permanent permanentReset = permanent.copy();
|
||||
permanentReset.getCounters().clear();
|
||||
permanentReset.getCounters(game).clear();
|
||||
permanentReset.getPower().resetToBaseValue();
|
||||
permanentReset.getToughness().resetToBaseValue();
|
||||
CopyEffect copyEffect = new CopyEffect(Duration.EndOfTurn, permanentReset, source.getSourceId());
|
||||
|
|
|
@ -96,7 +96,7 @@ class NoosegrafMobEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null && permanent != null && permanent.getCounters().getCount(CounterType.P1P1) > 0) {
|
||||
if (controller != null && permanent != null && permanent.getCounters(game).getCount(CounterType.P1P1) > 0) {
|
||||
permanent.removeCounters(CounterType.P1P1.createInstance(), game);
|
||||
Effect effect = new CreateTokenEffect(new ZombieToken());
|
||||
return effect.apply(game, source);
|
||||
|
|
|
@ -103,7 +103,7 @@ class ReturnToHandAllNamedPermanentsEffect extends OneShotEffect {
|
|||
for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
|
||||
cardsToHand.add(perm);
|
||||
}
|
||||
controller.moveCards(cardsToHand, null, Zone.HAND, source, game);
|
||||
controller.moveCards(cardsToHand, Zone.HAND, source, game);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -98,7 +98,7 @@ class GilderBairnEffect extends OneShotEffect {
|
|||
if (target == null) {
|
||||
return false;
|
||||
}
|
||||
for (Counter counter : target.getCounters().values()) {
|
||||
for (Counter counter : target.getCounters(game).values()) {
|
||||
Counter newCounter = new Counter(counter.getName(), counter.getCount());
|
||||
target.addCounters(newCounter, game);
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ class NecroskitterTriggeredAbility extends TriggeredAbilityImpl {
|
|||
if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) {
|
||||
Permanent permanent = zEvent.getTarget();
|
||||
if (permanent != null
|
||||
&& permanent.getCounters().containsKey(CounterType.M1M1)
|
||||
&& permanent.getCounters(game).containsKey(CounterType.M1M1)
|
||||
&& game.getOpponents(controllerId).contains(permanent.getControllerId())) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId(), game.getState().getZoneChangeCounter(event.getTargetId())));
|
||||
|
|
|
@ -104,7 +104,7 @@ class SpikeCannibalEffect extends OneShotEffect {
|
|||
if (sourcePermanent != null) {
|
||||
for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
|
||||
if (creature != sourcePermanent) {
|
||||
int numberCounters = creature.getCounters().getCount(CounterType.P1P1);
|
||||
int numberCounters = creature.getCounters(game).getCount(CounterType.P1P1);
|
||||
if (numberCounters > 0) {
|
||||
creature.removeCounters(CounterType.P1P1.getName(), numberCounters, game);
|
||||
countersRemoved += numberCounters;
|
||||
|
|
|
@ -111,7 +111,7 @@ class MoveCounterFromTargetToTargetEffect extends OneShotEffect {
|
|||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (sourceObject != null && controller != null) {
|
||||
Permanent fromPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (fromPermanent != null && fromPermanent.getCounters().getCount(CounterType.P1P1) > 0) {
|
||||
if (fromPermanent != null && fromPermanent.getCounters(game).getCount(CounterType.P1P1) > 0) {
|
||||
Permanent toPermanent = game.getPermanent(source.getTargets().get(1).getFirstTarget());
|
||||
if (toPermanent != null) {
|
||||
fromPermanent.removeCounters(CounterType.P1P1.createInstance(), game);
|
||||
|
|
|
@ -150,7 +150,7 @@ class RenownedWeaponsmithEffect extends OneShotEffect {
|
|||
Cards revealed = new CardsImpl();
|
||||
revealed.add(card);
|
||||
controller.revealCards(sourceObject.getIdName(), revealed, game);
|
||||
controller.moveCards(revealed, null, Zone.HAND, source, game);
|
||||
controller.moveCards(revealed, Zone.HAND, source, game);
|
||||
}
|
||||
}
|
||||
controller.shuffleLibrary(source, game);
|
||||
|
|
|
@ -110,7 +110,7 @@ class SuddenReclamationEffect extends OneShotEffect {
|
|||
cardsToHand.add(card);
|
||||
}
|
||||
}
|
||||
controller.moveCards(cardsToHand, null, Zone.HAND, source, game);
|
||||
controller.moveCards(cardsToHand, Zone.HAND, source, game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -99,7 +99,7 @@ class EngineeredExplosivesEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
MageObject engineeredExplosives = game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
|
||||
if(engineeredExplosives != null && engineeredExplosives instanceof Permanent){
|
||||
int count = ((Permanent)engineeredExplosives).getCounters().getCount(CounterType.CHARGE);
|
||||
int count = ((Permanent)engineeredExplosives).getCounters(game).getCount(CounterType.CHARGE);
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||
if(permanent.getConvertedManaCost() == count){
|
||||
permanent.destroy(source.getSourceId(), game, false);
|
||||
|
|
|
@ -96,7 +96,7 @@ class RecallEffect extends OneShotEffect {
|
|||
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(cardsDiscarded.size(), new FilterCard());
|
||||
target.setNotTarget(true);
|
||||
target.choose(Outcome.ReturnToHand, controller.getId(), source.getSourceId(), game);
|
||||
controller.moveCards(new CardsImpl(target.getTargets()), null, Zone.HAND, source, game);
|
||||
controller.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -89,7 +89,7 @@ class WindsOfChangeEffect extends OneShotEffect {
|
|||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
permanentsCount.put(playerId, player.getHand().size());
|
||||
player.moveCards(player.getHand(), Zone.HAND, Zone.LIBRARY, source, game);
|
||||
player.moveCards(player.getHand(), Zone.LIBRARY, source, game);
|
||||
player.shuffleLibrary(source, game);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ class AvianAddCountersSourceEffect extends AddCountersSourceEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
//record how many counters
|
||||
Counters permCounters = game.getPermanent(source.getSourceId()).getCounters();
|
||||
Counters permCounters = game.getPermanent(source.getSourceId()).getCounters(game);
|
||||
int countersWas = permCounters.getCount(CounterType.P1P0);
|
||||
if (countersWas < 4){
|
||||
super.apply(game, source);
|
||||
|
|
|
@ -97,7 +97,7 @@ class CoalitionRelicEffect extends OneShotEffect {
|
|||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (sourcePermanent != null && player != null) {
|
||||
int chargeCounters = sourcePermanent.getCounters().getCount(CounterType.CHARGE);
|
||||
int chargeCounters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE);
|
||||
sourcePermanent.removeCounters(CounterType.CHARGE.createInstance(chargeCounters), game);
|
||||
Mana mana = new Mana();
|
||||
ChoiceColor choice = new ChoiceColor();
|
||||
|
|
|
@ -138,7 +138,7 @@ public class DustOfMoments extends CardImpl {
|
|||
if (permFilter.match(card, game)) {
|
||||
final String counterName = counter.getName();
|
||||
if (shouldRemoveCounters()) {
|
||||
final Counter existingCounterOfSameType = card.getCounters().get(counterName);
|
||||
final Counter existingCounterOfSameType = card.getCounters(game).get(counterName);
|
||||
final int countersToRemove = Math.min(existingCounterOfSameType.getCount(), counter.getCount());
|
||||
final Counter modifiedCounter = new Counter(counterName, countersToRemove);
|
||||
card.removeCounters(modifiedCounter, game);
|
||||
|
|
|
@ -104,7 +104,7 @@ class LostAuramancersAbility extends PutIntoGraveFromBattlefieldSourceTriggeredA
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (super.checkTrigger(event, game)) {
|
||||
Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
|
||||
if (!permanent.getCounters().containsKey(CounterType.TIME) || permanent.getCounters().getCount(CounterType.TIME) == 0) {
|
||||
if (!permanent.getCounters(game).containsKey(CounterType.TIME) || permanent.getCounters(game).getCount(CounterType.TIME) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ class BalustradeSpyEffect extends OneShotEffect {
|
|||
}
|
||||
if (!cards.isEmpty()) {
|
||||
controller.revealCards(sourceObject.getName(), cards, game);
|
||||
controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
controller.moveCards(cards, Zone.GRAVEYARD, source, game);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -45,7 +45,6 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
/**
|
||||
|
@ -114,7 +113,7 @@ class MoveCounterFromTargetToTargetEffect extends OneShotEffect {
|
|||
if (fromPermanent == null || toPermanent == null || !fromPermanent.getControllerId().equals(toPermanent.getControllerId())) {
|
||||
return false;
|
||||
}
|
||||
int amountCounters = fromPermanent.getCounters().getCount(CounterType.P1P1);
|
||||
int amountCounters = fromPermanent.getCounters(game).getCount(CounterType.P1P1);
|
||||
if (amountCounters > 0) {
|
||||
int amountToMove = controller.getAmount(0, amountCounters, "How many counters do you want to move?", game);
|
||||
if (amountToMove > 0) {
|
||||
|
|
|
@ -121,8 +121,8 @@ class BorborygmosEnragedEffect extends OneShotEffect {
|
|||
cards.remove(card);
|
||||
}
|
||||
}
|
||||
controller.moveCards(landCards, Zone.LIBRARY, Zone.HAND, source, game);
|
||||
controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
controller.moveCards(landCards, Zone.HAND, source, game);
|
||||
controller.moveCards(cards, Zone.GRAVEYARD, source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ class CoercedConfessionMillEffect extends OneShotEffect {
|
|||
++foundCreatures;
|
||||
}
|
||||
}
|
||||
player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
player.moveCards(cards, Zone.GRAVEYARD, source, game);
|
||||
if (foundCreatures > 0) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
|
|
|
@ -116,7 +116,7 @@ class ConsumingAberrationEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
player.revealCards("Consuming Aberrtion", cards, game);
|
||||
player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
player.moveCards(cards, Zone.GRAVEYARD, source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ class DimirCharmEffect extends OneShotEffect {
|
|||
card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
|
||||
cards.remove(card);
|
||||
}
|
||||
controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
controller.moveCards(cards, Zone.GRAVEYARD, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ class MindGrindEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
player.revealCards("by " + sourceCard.getName() + " from " + player.getName(), cards, game);
|
||||
player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
player.moveCards(cards, Zone.GRAVEYARD, source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ class MoveCounterFromSourceToTargetEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (sourcePermanent != null && sourcePermanent.getCounters().getCount(CounterType.P1P1) > 0) {
|
||||
if (sourcePermanent != null && sourcePermanent.getCounters(game).getCount(CounterType.P1P1) > 0) {
|
||||
Permanent targetPermanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (targetPermanent != null) {
|
||||
sourcePermanent.removeCounters(CounterType.P1P1.createInstance(), game);
|
||||
|
|
|
@ -117,7 +117,7 @@ class UndercityInformerEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
player.revealCards("Undercity Informer", cards, game);
|
||||
player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
player.moveCards(cards, Zone.GRAVEYARD, source, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ class DemonicConsultationEffect extends OneShotEffect {
|
|||
controller.moveCards(cardToHand, Zone.HAND, source, game);
|
||||
controller.revealCards(sourceObject.getIdName(), cardsToReaveal, game);
|
||||
cardsToReaveal.remove(cardToHand);
|
||||
controller.moveCards(cardsToReaveal, null, Zone.EXILED, source, game);
|
||||
controller.moveCards(cardsToReaveal, Zone.EXILED, source, game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -100,7 +100,7 @@ class EssenceOfTheWildEffect extends ReplacementEffectImpl {
|
|||
Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
if (sourceObject != null) {
|
||||
Permanent permanentReset = sourceObject.copy();
|
||||
permanentReset.getCounters().clear();
|
||||
permanentReset.getCounters(game).clear();
|
||||
permanentReset.getPower().resetToBaseValue();
|
||||
permanentReset.getToughness().resetToBaseValue();
|
||||
game.addEffect(new CopyEffect(Duration.Custom, permanentReset, event.getTargetId()), source);
|
||||
|
|
|
@ -112,7 +112,7 @@ class GarrukRelentlessTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getTargetId().equals(sourceId)) {
|
||||
Permanent permanent = game.getPermanent(sourceId);
|
||||
if (permanent != null && !permanent.isTransformed() && permanent.getCounters().getCount(CounterType.LOYALTY) <= 2) {
|
||||
if (permanent != null && !permanent.isTransformed() && permanent.getCounters(game).getCount(CounterType.LOYALTY) <= 2) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ class GutterGrimeCounters implements DynamicValue {
|
|||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
Permanent p = game.getPermanent(sourceId);
|
||||
if (p != null) {
|
||||
return p.getCounters().getCount(CounterType.SLIME);
|
||||
return p.getCounters(game).getCount(CounterType.SLIME);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -96,8 +96,8 @@ class LudevicsTestSubjectEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Permanent p = game.getPermanent(source.getSourceId());
|
||||
if (p != null) {
|
||||
if (p.getCounters().getCount(CounterType.HATCHLING) >= 5) {
|
||||
p.removeCounters(CounterType.HATCHLING.getName(), p.getCounters().getCount(CounterType.HATCHLING), game);
|
||||
if (p.getCounters(game).getCount(CounterType.HATCHLING) >= 5) {
|
||||
p.removeCounters(CounterType.HATCHLING.getName(), p.getCounters(game).getCount(CounterType.HATCHLING), game);
|
||||
TransformSourceEffect effect = new TransformSourceEffect(true);
|
||||
return effect.apply(game, source);
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ class MirrorMadPhantasmEffect extends OneShotEffect {
|
|||
cards.add(card);
|
||||
}
|
||||
player.revealCards("Mirror-Mad Phantasm", cards, game);
|
||||
player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
player.moveCards(cards, Zone.GRAVEYARD, source, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,8 +101,8 @@ class MulchEffect extends OneShotEffect {
|
|||
otherCards.add(card);
|
||||
}
|
||||
}
|
||||
controller.moveCards(landCards, Zone.LIBRARY, Zone.HAND, source, game);
|
||||
controller.moveCards(otherCards, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
controller.moveCards(landCards, Zone.HAND, source, game);
|
||||
controller.moveCards(otherCards, Zone.GRAVEYARD, source, game);
|
||||
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -120,7 +120,7 @@ class TrepanationBladeDiscardEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
}
|
||||
player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
|
||||
player.moveCards(cards, Zone.GRAVEYARD, source, game);
|
||||
if (!cards.isEmpty()) {
|
||||
player.revealCards(equipment.getName(), cards, game);
|
||||
game.getState().setValue(source.getSourceId().toString() + "_TrepanationBlade", cards.size());
|
||||
|
|
|
@ -101,7 +101,7 @@ class HubrisReturnEffect extends OneShotEffect {
|
|||
if (creature != null) {
|
||||
Cards cardsToHand = new CardsImpl(creature.getAttachments());
|
||||
cardsToHand.add(creature);
|
||||
controller.moveCards(cardsToHand, null, Zone.HAND, source, game);
|
||||
controller.moveCards(cardsToHand, Zone.HAND, source, game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -104,7 +104,7 @@ class SageOfHoursCost extends CostImpl {
|
|||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Permanent permanent = game.getPermanent(ability.getSourceId());
|
||||
if (permanent != null) {
|
||||
this.removedCounters = permanent.getCounters().getCount(CounterType.P1P1);
|
||||
this.removedCounters = permanent.getCounters(game).getCount(CounterType.P1P1);
|
||||
if (this.removedCounters > 0) {
|
||||
permanent.removeCounters(CounterType.P1P1.createInstance(this.removedCounters), game);
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ class ScourgeOfFleetsEffect extends OneShotEffect {
|
|||
for (Permanent permanent : game.getBattlefield().getActivePermanents(creatureFilter, source.getControllerId(), source.getSourceId(), game)) {
|
||||
cardsToHand.add(permanent);
|
||||
}
|
||||
controller.moveCards(cardsToHand, null, Zone.HAND, source, game);
|
||||
controller.moveCards(cardsToHand, Zone.HAND, source, game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -93,7 +93,7 @@ class SolidarityOfHeroesEffect extends OneShotEffect {
|
|||
for (UUID targetId: getTargetPointer().getTargets(game, source)) {
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null) {
|
||||
int existingCounters = permanent.getCounters().getCount(CounterType.P1P1);
|
||||
int existingCounters = permanent.getCounters(game).getCount(CounterType.P1P1);
|
||||
if (existingCounters > 0) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(existingCounters), game);
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ class PhantomCentaurPreventionEffect extends PreventionEffectImpl {
|
|||
}
|
||||
}
|
||||
|
||||
if(removeCounter && permanent.getCounters().containsKey(CounterType.P1P1)) {
|
||||
if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) {
|
||||
StringBuilder sb = new StringBuilder(permanent.getName()).append(": ");
|
||||
permanent.removeCounters(CounterType.P1P1.createInstance(), game);
|
||||
sb.append("Removed a +1/+1 counter ");
|
||||
|
|
|
@ -127,7 +127,7 @@ class PhantomFlockPreventionEffect extends PreventionEffectImpl {
|
|||
}
|
||||
}
|
||||
|
||||
if(removeCounter && permanent.getCounters().containsKey(CounterType.P1P1)) {
|
||||
if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) {
|
||||
StringBuilder sb = new StringBuilder(permanent.getName()).append(": ");
|
||||
permanent.removeCounters(CounterType.P1P1.createInstance(), game);
|
||||
sb.append("Removed a +1/+1 counter ");
|
||||
|
|
|
@ -131,7 +131,7 @@ class PhantomNishobaPreventionEffect extends PreventionEffectImpl {
|
|||
}
|
||||
}
|
||||
|
||||
if(removeCounter && permanent.getCounters().containsKey(CounterType.P1P1)) {
|
||||
if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) {
|
||||
StringBuilder sb = new StringBuilder(permanent.getName()).append(": ");
|
||||
permanent.removeCounters(CounterType.P1P1.createInstance(), game);
|
||||
sb.append("Removed a +1/+1 counter ");
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue