mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Fixed AddCountersSourceEffect.
This commit is contained in:
parent
41bf33d107
commit
8ebbc3de48
1 changed files with 7 additions and 2 deletions
|
@ -42,6 +42,7 @@ public class AddCountersSourceEffect extends OneShotEffect<AddCountersSourceEffe
|
|||
|
||||
private int amount;
|
||||
private String name;
|
||||
private Counter counter;
|
||||
|
||||
public AddCountersSourceEffect(String name, int amount) {
|
||||
super(Outcome.Benefit);
|
||||
|
@ -52,7 +53,7 @@ public class AddCountersSourceEffect extends OneShotEffect<AddCountersSourceEffe
|
|||
public AddCountersSourceEffect(Counter counter) {
|
||||
super(Outcome.Benefit);
|
||||
this.name = counter.getName();
|
||||
this.amount = counter.getCount();
|
||||
this.counter = counter;
|
||||
}
|
||||
|
||||
public AddCountersSourceEffect(final AddCountersSourceEffect effect) {
|
||||
|
@ -65,7 +66,11 @@ public class AddCountersSourceEffect extends OneShotEffect<AddCountersSourceEffe
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
permanent.addCounters(name, amount);
|
||||
if (counter != null) {
|
||||
permanent.addCounters(counter);
|
||||
} else {
|
||||
permanent.addCounters(name, amount);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue