This commit is contained in:
BetaSteward 2010-09-01 03:01:43 +00:00
parent df642c2bd5
commit 3fa0e8b8f4
544 changed files with 13327 additions and 3074 deletions

View file

@ -29,6 +29,7 @@
package mage.abilities.effects.common;
import mage.Constants.Outcome;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.counters.Counter;
import mage.game.Game;
@ -38,7 +39,7 @@ import mage.game.permanent.Permanent;
*
* @author BetaSteward_at_googlemail.com
*/
public class AddCountersSourceEffect extends OneShotEffect {
public class AddCountersSourceEffect extends OneShotEffect<AddCountersSourceEffect> {
private int amount;
private String name;
@ -49,9 +50,15 @@ public class AddCountersSourceEffect extends OneShotEffect {
this.amount = amount;
}
public AddCountersSourceEffect(final AddCountersSourceEffect effect) {
super(effect);
this.amount = effect.amount;
this.name = effect.name;
}
@Override
public boolean apply(Game game) {
Permanent permanent = game.getPermanent(this.source.getSourceId());
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
Counter counter = new Counter(name);
counter.add(amount);
@ -61,7 +68,7 @@ public class AddCountersSourceEffect extends OneShotEffect {
}
@Override
public String getText() {
public String getText(Ability source) {
if (amount > 1) {
StringBuilder sb = new StringBuilder();
sb.append("put ").append(Integer.toString(amount)).append(" ").append(name).append("counters on {this}");
@ -71,5 +78,10 @@ public class AddCountersSourceEffect extends OneShotEffect {
return "put a " + name + " counter on {this}";
}
@Override
public AddCountersSourceEffect copy() {
return new AddCountersSourceEffect(this);
}
}