Fixed way PopulateEffect copys token (did not work correct for Pack Rat token). PermanentToken copys now ManaCost if exist for a token like Pack Rat.

This commit is contained in:
LevelX2 2012-10-12 16:17:25 +02:00
parent 891e94b919
commit 634007d831
2 changed files with 9 additions and 2 deletions

View file

@ -31,7 +31,6 @@ import mage.Constants.Outcome;
import mage.Constants.TargetController;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.filter.FilterPermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.filter.predicate.permanent.TokenPredicate;
@ -44,6 +43,8 @@ import mage.target.Target;
import mage.target.TargetPermanent;
import mage.util.CardUtil;
/**
*
* @author LevelX2
@ -92,7 +93,8 @@ public class PopulateEffect extends OneShotEffect<PopulateEffect> {
player.choose(Outcome.Copy, target, source.getSourceId(), game);
Permanent tokenToCopy = game.getPermanent(target.getFirstTarget());
if (tokenToCopy != null && tokenToCopy instanceof PermanentToken) {
Token newToken = ((PermanentToken) tokenToCopy).getToken().copy();
Token newToken = new Token("","");
CardUtil.copyTo(newToken).from(tokenToCopy);
if (newToken != null ) {
game.informPlayers("Token selected for populate: " + newToken.getName());
return newToken.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());

View file

@ -35,6 +35,7 @@ import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.token.Token;
import java.util.UUID;
import mage.abilities.costs.mana.ManaCost;
/**
*
@ -69,6 +70,10 @@ public class PermanentToken extends PermanentImpl<PermanentToken> {
for (Ability ability: token.getAbilities()) {
this.addAbility(ability, game);
}
this.manaCost.clear();
for (ManaCost cost: token.getManaCost()) {
this.getManaCost().add(cost.copy());
}
this.cardType = token.getCardType();
this.color = token.getColor();
this.power = token.getPower();