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
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue