mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
* Midnight Oil - Fixed that also one remaning counter was removed it from it's own effect.
This commit is contained in:
parent
b428117252
commit
468eb46471
1 changed files with 16 additions and 10 deletions
|
@ -57,20 +57,26 @@ public class RemoveCounterSourceEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null && permanent.getCounters(game).getCount(counter.getName()) >= counter.getCount()) {
|
||||
permanent.removeCounters(counter.getName(), counter.getCount(), game);
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers("Removed " + counter.getCount() + " " + counter.getName() + " counter from " + permanent.getLogName());
|
||||
if (permanent != null) {
|
||||
int toRemove = Math.min(counter.getCount(), permanent.getCounters(game).getCount(counter.getName()));
|
||||
if (toRemove > 0) {
|
||||
permanent.removeCounters(counter.getName(), toRemove, game);
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers("Removed " + toRemove + " " + counter.getName() + " counter from " + permanent.getLogName());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Card card = game.getCard(source.getSourceId());
|
||||
if (card != null && card.getCounters(game).getCount(counter.getName()) >= counter.getCount()) {
|
||||
card.removeCounters(counter.getName(), counter.getCount(), game);
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers("Removed " + counter.getCount() + " " + counter.getName()
|
||||
+ " counter from " + card.getLogName()
|
||||
+ " (" + card.getCounters(game).getCount(counter.getName()) + " left)");
|
||||
if (card != null) {
|
||||
int toRemove = Math.min(counter.getCount(), card.getCounters(game).getCount(counter.getName()));
|
||||
if (toRemove > 0) {
|
||||
card.removeCounters(counter.getName(), toRemove, game);
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers("Removed " + toRemove + " " + counter.getName()
|
||||
+ " counter from " + card.getLogName()
|
||||
+ " (" + card.getCounters(game).getCount(counter.getName()) + " left)");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue