mirror of
https://github.com/correl/mage.git
synced 2024-11-16 03:00:12 +00:00
* Warren Weirding - Fixed that created tokens got haste ability wrongly permanent instead only util end of turn.
This commit is contained in:
parent
6724019a60
commit
ad6898ca54
3 changed files with 34 additions and 10 deletions
|
@ -30,10 +30,12 @@ package mage.sets.modernmasters;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
import mage.abilities.effects.ContinuousEffect;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.CreateTokenTargetEffect;
|
import mage.abilities.effects.common.CreateTokenTargetEffect;
|
||||||
import mage.abilities.effects.common.continious.GainAbilitySourceEffect;
|
import mage.abilities.effects.common.continious.GainAbilitySourceEffect;
|
||||||
|
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
|
||||||
import mage.abilities.keyword.HasteAbility;
|
import mage.abilities.keyword.HasteAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
|
@ -85,7 +87,7 @@ public class WarrenWeirding extends CardImpl<WarrenWeirding> {
|
||||||
|
|
||||||
class WarrenWeirdingEffect extends OneShotEffect<WarrenWeirdingEffect> {
|
class WarrenWeirdingEffect extends OneShotEffect<WarrenWeirdingEffect> {
|
||||||
|
|
||||||
private static final FilterCreaturePermanent filterGoblin = new FilterCreaturePermanent("creature an opponent controls");
|
private static final FilterCreaturePermanent filterGoblin = new FilterCreaturePermanent();
|
||||||
static {
|
static {
|
||||||
filterGoblin.add(new SubtypePredicate("Goblin"));
|
filterGoblin.add(new SubtypePredicate("Goblin"));
|
||||||
}
|
}
|
||||||
|
@ -116,9 +118,19 @@ class WarrenWeirdingEffect extends OneShotEffect<WarrenWeirdingEffect> {
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
permanent.sacrifice(source.getSourceId(), game);
|
permanent.sacrifice(source.getSourceId(), game);
|
||||||
if (filterGoblin.match(permanent, game)) {
|
if (filterGoblin.match(permanent, game)) {
|
||||||
Effect effect = new CreateTokenTargetEffect(new WarrenWeirdingBlackGoblinRogueToken(), 2);
|
for (int i = 0; i < 2; i++) {
|
||||||
|
Token token = new WarrenWeirdingBlackGoblinRogueToken();
|
||||||
|
Effect effect = new CreateTokenTargetEffect(token);
|
||||||
effect.setTargetPointer(new FixedTarget(player.getId()));
|
effect.setTargetPointer(new FixedTarget(player.getId()));
|
||||||
effect.apply(game, source);
|
if (effect.apply(game, source)) {
|
||||||
|
Permanent tokenPermanent = game.getPermanent(token.getLastAddedToken());
|
||||||
|
if (tokenPermanent != null) {
|
||||||
|
ContinuousEffect hasteEffect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
|
||||||
|
hasteEffect.setTargetPointer(new FixedTarget(tokenPermanent.getId()));
|
||||||
|
game.addEffect(hasteEffect, source);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -142,8 +154,5 @@ class WarrenWeirdingBlackGoblinRogueToken extends Token {
|
||||||
subtype.add("Rogue");
|
subtype.add("Rogue");
|
||||||
power.setValue(1);
|
power.setValue(1);
|
||||||
toughness.setValue(1);
|
toughness.setValue(1);
|
||||||
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.EndOfTurn));
|
|
||||||
ability.setRuleVisible(false);
|
|
||||||
this.addAbility(ability);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,17 @@
|
||||||
package mage.abilities.effects.common;
|
package mage.abilities.effects.common;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.Mode;
|
import mage.abilities.Mode;
|
||||||
import mage.abilities.dynamicvalue.DynamicValue;
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.token.Token;
|
import mage.game.permanent.token.Token;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Loki
|
* @author Loki
|
||||||
|
@ -55,9 +59,20 @@ public class CreateTokenTargetEffect extends OneShotEffect<CreateTokenTargetEffe
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
int value = amount.calculate(game, source);
|
int value = amount.calculate(game, source);
|
||||||
token.putOntoBattlefield(value, game, source.getSourceId(), targetPointer.getFirst(game, source), tapped, attacking);
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
if (controller != null) {
|
||||||
|
if (value < 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if(token.putOntoBattlefield(value, game, source.getSourceId(), targetPointer.getFirst(game, source), tapped, attacking)) {
|
||||||
|
game.informPlayers(new StringBuilder(controller.getName())
|
||||||
|
.append(" puts ").append(CardUtil.numberToText(value,"a")).append(" ").append(token.getName())
|
||||||
|
.append(value == 1?" token":" tokens").append(" onto the Battlefield").toString());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getText(Mode mode) {
|
public String getText(Mode mode) {
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class Token extends MageObjectImpl<Token> {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Token(String name, String description, ObjectColor color, List<String> subtype, int power, int toughness, Abilities abilities) {
|
public Token(String name, String description, ObjectColor color, List<String> subtype, int power, int toughness, Abilities<Ability> abilities) {
|
||||||
this(name, description);
|
this(name, description);
|
||||||
this.cardType.add(CardType.CREATURE);
|
this.cardType.add(CardType.CREATURE);
|
||||||
this.color = color.copy();
|
this.color = color.copy();
|
||||||
|
|
Loading…
Reference in a new issue