mirror of
https://github.com/magefree/mage.git
synced 2025-12-28 14:32:06 -08:00
* Fixed a (probably recently unintentionally added) problem with activated abilities of tokens.
This commit is contained in:
parent
87a8d6d1ec
commit
34298e78f5
5 changed files with 85 additions and 16 deletions
|
|
@ -95,11 +95,9 @@ public class CreateTokenEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int value = amount.calculate(game, source, this);
|
||||
Token tokenCopy = token.copy();
|
||||
tokenCopy.getAbilities().newId(); // neccessary if token has ability like DevourAbility()
|
||||
tokenCopy.putOntoBattlefield(value, game, source.getSourceId(), source.getControllerId(), tapped, attacking);
|
||||
this.lastAddedTokenId = tokenCopy.getLastAddedToken();
|
||||
this.lastAddedTokenIds = tokenCopy.getLastAddedTokenIds();
|
||||
token.putOntoBattlefield(value, game, source.getSourceId(), source.getControllerId(), tapped, attacking);
|
||||
this.lastAddedTokenId = token.getLastAddedToken();
|
||||
this.lastAddedTokenIds = token.getLastAddedTokenIds();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import mage.game.Game;
|
|||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.Target;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -89,10 +90,17 @@ public class RegenerateTargetEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Regenerate target ");
|
||||
if ( mode != null ) {
|
||||
sb.append(mode.getTargets().get(0).getTargetName());
|
||||
sb.append("Regenerate ");
|
||||
Target target = mode.getTargets().get(0);
|
||||
if (target != null) {
|
||||
if (!target.getTargetName().toLowerCase().startsWith("another")) {
|
||||
sb.append("target ");
|
||||
}
|
||||
sb.append(target.getTargetName());
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,14 +29,13 @@
|
|||
package mage.game.permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.mana.ManaCost;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.game.permanent.token.Token;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -48,8 +47,10 @@ public class PermanentToken extends PermanentImpl {
|
|||
public PermanentToken(Token token, UUID controllerId, String expansionSetCode, Game game) {
|
||||
super(controllerId, controllerId, token.getName());
|
||||
this.expansionSetCode = expansionSetCode;
|
||||
this.token = token;
|
||||
this.copyFromToken(this.token, game, false); // needed to have e.g. subtypes for entersTheBattlefield replacement effects
|
||||
this.token = token.copy();
|
||||
this.token.getAbilities().newId(); // neccessary if token has ability like DevourAbility()
|
||||
this.token.getAbilities().setSourceId(objectId);
|
||||
this.copyFromToken(this.token, game, false); // needed to have at this time (e.g. for subtypes for entersTheBattlefield replacement effects)
|
||||
}
|
||||
|
||||
public PermanentToken(final PermanentToken permanent) {
|
||||
|
|
@ -60,8 +61,7 @@ public class PermanentToken extends PermanentImpl {
|
|||
|
||||
@Override
|
||||
public void reset(Game game) {
|
||||
Token tokenCopy = token.copy();
|
||||
copyFromToken(tokenCopy, game, true);
|
||||
copyFromToken(token, game, true);
|
||||
super.reset(game);
|
||||
}
|
||||
|
||||
|
|
@ -71,6 +71,7 @@ public class PermanentToken extends PermanentImpl {
|
|||
if (reset) {
|
||||
this.abilities.addAll(token.getAbilities());
|
||||
} else {
|
||||
// first time -> create ContinuousEffects only once
|
||||
for (Ability ability : token.getAbilities()) {
|
||||
this.addAbility(ability, game);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue