forked from External/mage
Cyclopean Tomb - Update.
This commit is contained in:
parent
cebfadbf34
commit
ecc18072cf
177 changed files with 581 additions and 646 deletions
|
|
@ -1172,10 +1172,11 @@ public abstract class AbilityImpl implements Ability {
|
|||
public void setSourceObject(MageObject sourceObject, Game game) {
|
||||
if (sourceObject == null) {
|
||||
this.sourceObject = game.getObject(sourceId);
|
||||
this.sourceObjectZoneChangeCounter = game.getState().getZoneChangeCounter(sourceId);
|
||||
} else {
|
||||
this.sourceObject = sourceObject;
|
||||
this.sourceObjectZoneChangeCounter = this.sourceObject.getZoneChangeCounter(game);
|
||||
}
|
||||
this.sourceObjectZoneChangeCounter = game.getState().getZoneChangeCounter(sourceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ class TurnFaceUpEffect extends OneShotEffect {
|
|||
if (sourcePermanent != null) {
|
||||
if (sourcePermanent.turnFaceUp(game, source.getControllerId())) {
|
||||
if (megamorph) {
|
||||
sourcePermanent.addCounters(CounterType.P1P1.createInstance(), game);
|
||||
sourcePermanent.addCounters(CounterType.P1P1.createInstance(), source, game);
|
||||
}
|
||||
game.getState().setValue(source.getSourceId().toString() + "TurnFaceUpX", source.getManaCostsToPay().getX());
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public class PutCountersSourceCost 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.paid = permanent.addCounters(counter, game);;
|
||||
this.paid = permanent.addCounters(counter, null, game);;
|
||||
}
|
||||
return paid;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ public class AmplifyEffect extends ReplacementEffectImpl {
|
|||
Cards cards = new CardsImpl();
|
||||
cards.addAll(target.getTargets());
|
||||
int amountCounters = cards.size() * amplifyFactor.getFactor();
|
||||
sourceCreature.addCounters(CounterType.P1P1.createInstance(amountCounters), game);
|
||||
sourceCreature.addCounters(CounterType.P1P1.createInstance(amountCounters), source, game);
|
||||
controller.revealCards(sourceCreature.getIdName(), cards, game);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ public class DevourEffect extends ReplacementEffectImpl {
|
|||
} else {
|
||||
amountCounters = devouredCreatures * devourFactor.getFactor();
|
||||
}
|
||||
creature.addCounters(CounterType.P1P1.createInstance(amountCounters), game);
|
||||
creature.addCounters(CounterType.P1P1.createInstance(amountCounters), source, game);
|
||||
game.getState().setValue(creature.getId().toString() + "devoured", cardSubtypes);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public class EntersBattlefieldWithXCountersEffect extends OneShotEffect {
|
|||
if (amount > 0) {
|
||||
Counter counterToAdd = counter.copy();
|
||||
counterToAdd.add(amount - counter.getCount());
|
||||
permanent.addCounters(counterToAdd, game);
|
||||
permanent.addCounters(counterToAdd, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public class AddCountersAllEffect extends OneShotEffect {
|
|||
if (controller != null && sourceObject != null) {
|
||||
if (counter != null) {
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||
permanent.addCounters(counter.copy(), game);
|
||||
permanent.addCounters(counter.copy(), source, game);
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " puts " + counter.getCount() + " " + counter.getName().toLowerCase()
|
||||
+ " counter on " + permanent.getLogName());
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ public class AddCountersAttachedEffect extends OneShotEffect {
|
|||
if (attachedTo != null && counter != null) {
|
||||
Counter newCounter = counter.copy();
|
||||
newCounter.add(amount.calculate(game, source, this));
|
||||
attachedTo.addCounters(newCounter, game);
|
||||
attachedTo.addCounters(newCounter, source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ public class AddCountersSourceEffect extends OneShotEffect {
|
|||
countersToAdd--;
|
||||
}
|
||||
newCounter.add(countersToAdd);
|
||||
card.addCounters(newCounter, game);
|
||||
card.addCounters(newCounter, source, game);
|
||||
if (informPlayers && !game.isSimulation()) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
|
|
@ -128,7 +128,7 @@ public class AddCountersSourceEffect extends OneShotEffect {
|
|||
}
|
||||
newCounter.add(countersToAdd);
|
||||
int before = permanent.getCounters(game).getCount(newCounter.getName());
|
||||
permanent.addCounters(newCounter, game);
|
||||
permanent.addCounters(newCounter, source, game);
|
||||
if (informPlayers && !game.isSimulation()) {
|
||||
int amountAdded = permanent.getCounters(game).getCount(newCounter.getName()) - before;
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ public class AddCountersTargetEffect extends OneShotEffect {
|
|||
}
|
||||
newCounter.add(calculated);
|
||||
int before = permanent.getCounters(game).getCount(counter.getName());
|
||||
permanent.addCounters(newCounter, game);
|
||||
permanent.addCounters(newCounter, source, game);
|
||||
int numberAdded = permanent.getCounters(game).getCount(counter.getName()) - before;
|
||||
affectedTargets++;
|
||||
if (!game.isSimulation()) {
|
||||
|
|
@ -114,7 +114,7 @@ public class AddCountersTargetEffect extends OneShotEffect {
|
|||
+ counter.getCount() + " " + counter.getName().toLowerCase() + " counter on " + player.getLogName());
|
||||
}
|
||||
} else if (card != null) {
|
||||
card.addCounters(counter, game);
|
||||
card.addCounters(counter, source, game);
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(new StringBuilder("Added ").append(counter.getCount()).append(" ").append(counter.getName())
|
||||
.append(" counter to ").append(card.getName())
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class AddPlusOneCountersAttachedEffect extends OneShotEffect {
|
|||
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
||||
Permanent creature = game.getPermanent(enchantment.getAttachedTo());
|
||||
if (creature != null) {
|
||||
creature.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||
creature.addCounters(CounterType.P1P1.createInstance(amount), source, game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ package mage.abilities.effects.common.counter;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
|
@ -51,11 +50,11 @@ public class AddRemoveAllTimeSuspentCountersEffect extends OneShotEffect {
|
|||
private final boolean removeCounter;
|
||||
private final String actionStr;
|
||||
|
||||
public AddRemoveAllTimeSuspentCountersEffect(Counter counter, Filter<Card> filter, boolean removeCounter) {
|
||||
public AddRemoveAllTimeSuspentCountersEffect(Counter counter, Filter<Card> filter, boolean removeCounter) {
|
||||
super(Outcome.Benefit);
|
||||
this.counter = counter;
|
||||
this.filter = filter;
|
||||
this.removeCounter= removeCounter;
|
||||
this.removeCounter = removeCounter;
|
||||
actionStr = removeCounter ? " removes " : " puts ";
|
||||
setText();
|
||||
}
|
||||
|
|
@ -74,38 +73,39 @@ public class AddRemoveAllTimeSuspentCountersEffect extends OneShotEffect {
|
|||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (controller != null && sourceObject != null) {
|
||||
if (counter != null) {
|
||||
List<Card> permanents = new ArrayList<Card>(game.getBattlefield().getAllActivePermanents());
|
||||
execute(game, controller, sourceObject, permanents, removeCounter);
|
||||
List<Card> permanents = new ArrayList<>(game.getBattlefield().getAllActivePermanents());
|
||||
execute(game, controller, sourceObject, source, permanents, removeCounter);
|
||||
final List<Card> exiledCards = game.getExile().getAllCards(game);
|
||||
execute(game, controller, sourceObject, exiledCards, removeCounter);
|
||||
execute(game, controller, sourceObject, source, exiledCards, removeCounter);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void execute(final Game game, final Player controller, final MageObject sourceObject, final List<Card> cards, final boolean removeCounter) {
|
||||
for (Card card : cards) {
|
||||
if (filter.match(card, game)) {
|
||||
final String counterName = counter.getName();
|
||||
if (removeCounter) {
|
||||
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);
|
||||
} else {
|
||||
card.addCounters(counter, game);
|
||||
private void execute(final Game game, final Player controller, final MageObject sourceObject, Ability source, final List<Card> cards, final boolean removeCounter) {
|
||||
for (Card card : cards) {
|
||||
if (filter.match(card, game)) {
|
||||
final String counterName = counter.getName();
|
||||
if (removeCounter) {
|
||||
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);
|
||||
} else {
|
||||
card.addCounters(counter, source, game);
|
||||
}
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(new StringBuilder(sourceObject.getName()).append(": ")
|
||||
.append(controller.getLogName()).append(actionStr)
|
||||
.append(counter.getCount()).append(" ").append(counterName.toLowerCase())
|
||||
.append(" counter on ").append(card.getName()).toString());
|
||||
}
|
||||
}
|
||||
if (!game.isSimulation())
|
||||
game.informPlayers(new StringBuilder(sourceObject.getName()).append(": ")
|
||||
.append(controller.getLogName()).append(actionStr)
|
||||
.append(counter.getCount()).append(" ").append(counterName.toLowerCase())
|
||||
.append(" counter on ").append(card.getName()).toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setText() {
|
||||
private void setText() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
final String actionsStr2 = removeCounter ? "remove " : " put ";
|
||||
sb.append(actionsStr2);
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ public class DistributeCountersEffect extends OneShotEffect {
|
|||
for (UUID target : multiTarget.getTargets()) {
|
||||
Permanent permanent = game.getPermanent(target);
|
||||
if (permanent != null) {
|
||||
permanent.addCounters(counterType.createInstance(multiTarget.getTargetAmount(target)), game);
|
||||
permanent.addCounters(counterType.createInstance(multiTarget.getTargetAmount(target)), source, game);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ public class MoveCountersTargetsEffect extends OneShotEffect {
|
|||
Permanent addTargetCreature = game.getPermanent(targetPointer.getTargets(game, source).get(1));
|
||||
if (removeTargetCreature != null && addTargetCreature != null && removeTargetCreature.getCounters(game).getCount(counterType) >= amount) {
|
||||
removeTargetCreature.removeCounters(counterType.createInstance(amount), game);
|
||||
addTargetCreature.addCounters(counterType.createInstance(amount), game);
|
||||
addTargetCreature.addCounters(counterType.createInstance(amount), source, game);
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers("Moved " + amount + " " + counterType.getName() + " counter" + (amount > 1 ? "s" : "") + " from " + removeTargetCreature.getLogName() + " to " + addTargetCreature.getLogName());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ public class ProliferateEffect extends OneShotEffect {
|
|||
if (permanent.getCounters(game).size() == 1) {
|
||||
for (Counter counter : permanent.getCounters(game).values()) {
|
||||
Counter newCounter = new Counter(counter.getName());
|
||||
permanent.addCounters(newCounter, game);
|
||||
permanent.addCounters(newCounter, source, game);
|
||||
}
|
||||
} else {
|
||||
Choice choice = new ChoiceImpl(true);
|
||||
|
|
@ -93,7 +93,7 @@ public class ProliferateEffect extends OneShotEffect {
|
|||
for (Counter counter : permanent.getCounters(game).values()) {
|
||||
if (counter.getName().equals(choice.getChoice())) {
|
||||
Counter newCounter = new Counter(counter.getName());
|
||||
permanent.addCounters(newCounter, game);
|
||||
permanent.addCounters(newCounter, source, game);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class BloodthirstEffect extends OneShotEffect {
|
|||
if (watcher != null && watcher.conditionMet()) {
|
||||
Permanent permanent = game.getPermanentEntering(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ class EvolveEffect extends OneShotEffect {
|
|||
if (triggeringCreature != null) {
|
||||
Permanent sourceCreature = game.getPermanent(source.getSourceId());
|
||||
if (sourceCreature != null && EvolveAbility.isPowerOrThoughnessGreater(sourceCreature, triggeringCreature)) {
|
||||
sourceCreature.addCounters(CounterType.P1P1.createInstance(), game);
|
||||
sourceCreature.addCounters(CounterType.P1P1.createInstance(), source, game);
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.EVOLVED_CREATURE, sourceCreature.getId(), source.getSourceId(), source.getControllerId()));
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ class FabricateEffect extends OneShotEffect {
|
|||
"Create " + CardUtil.numberToText(value, "a") + " 1/1 token" + (value > 1 ? "s" : ""),
|
||||
source,
|
||||
game)) {
|
||||
((Card) sourceObject).addCounters(CounterType.P1P1.createInstance(value), game);
|
||||
((Card) sourceObject).addCounters(CounterType.P1P1.createInstance(value), source, game);
|
||||
}
|
||||
else {
|
||||
new ServoToken().putOntoBattlefield(value, game, source.getSourceId(), controller.getId());
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ class GraftDistributeCounterEffect extends OneShotEffect {
|
|||
Permanent targetCreature = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (targetCreature != null) {
|
||||
sourcePermanent.removeCounters(CounterType.P1P1.getName(), 1, game);
|
||||
targetCreature.addCounters(CounterType.P1P1.createInstance(1), game);
|
||||
targetCreature.addCounters(CounterType.P1P1.createInstance(1), source, game);
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers("Moved one +1/+1 counter from " + sourcePermanent.getLogName() + " to " + targetCreature.getLogName());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ class ModularDistributeCounterEffect extends OneShotEffect {
|
|||
if (sourcePermanent != null && targetArtifact != null && player != null) {
|
||||
int numberOfCounters = sourcePermanent.getCounters(game).getCount(CounterType.P1P1);
|
||||
if (numberOfCounters > 0) {
|
||||
targetArtifact.addCounters(CounterType.P1P1.createInstance(numberOfCounters), game);
|
||||
targetArtifact.addCounters(CounterType.P1P1.createInstance(numberOfCounters), source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ class SunburstEffect extends OneShotEffect {
|
|||
}
|
||||
if (counter != null) {
|
||||
|
||||
permanent.addCounters(counter, game);
|
||||
permanent.addCounters(counter, source, game);
|
||||
if (!game.isSimulation()) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@ class SuspendExileEffect extends OneShotEffect {
|
|||
if (suspend == Integer.MAX_VALUE) {
|
||||
suspend = source.getManaCostsToPay().getX();
|
||||
}
|
||||
card.addCounters(CounterType.TIME.createInstance(suspend), game);
|
||||
card.addCounters(CounterType.TIME.createInstance(suspend), source, game);
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(controller.getLogName() + " suspends (" + suspend + ") " + card.getLogName());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ class UnleashReplacementEffect extends ReplacementEffectImpl {
|
|||
if (!game.isSimulation()) {
|
||||
game.informPlayers(controller.getLogName() + " unleashes " + creature.getName());
|
||||
}
|
||||
creature.addCounters(CounterType.P1P1.createInstance(), game);
|
||||
creature.addCounters(CounterType.P1P1.createInstance(), source, game);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue