mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 21:02:08 -08:00
* Karona, False God - Fixed that the untap effect was applied continuous.
This commit is contained in:
parent
1deaf53b97
commit
b59616fda8
1 changed files with 60 additions and 62 deletions
|
|
@ -29,10 +29,14 @@ package mage.sets.scourge;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continious.BoostAllEffect;
|
||||
import mage.abilities.effects.common.continious.GainControlTargetEffect;
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.repository.CardRepository;
|
||||
|
|
@ -40,16 +44,16 @@ import mage.choices.Choice;
|
|||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -63,11 +67,6 @@ public class KaronaFalseGod extends CardImpl {
|
|||
this.supertype.add("Legendary");
|
||||
this.subtype.add("Avatar");
|
||||
|
||||
this.color.setGreen(true);
|
||||
this.color.setBlue(true);
|
||||
this.color.setWhite(true);
|
||||
this.color.setRed(true);
|
||||
this.color.setBlack(true);
|
||||
this.power = new MageInt(5);
|
||||
this.toughness = new MageInt(5);
|
||||
|
||||
|
|
@ -75,10 +74,10 @@ public class KaronaFalseGod extends CardImpl {
|
|||
this.addAbility(HasteAbility.getInstance());
|
||||
|
||||
// At the beginning of each player's upkeep, that player untaps Karona, False God and gains control of it.
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new KaronaFalseGodControlEffect(), TargetController.ANY, false));
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new KaronaFalseGodUntapGetControlEffect(), TargetController.ANY, false, true));
|
||||
|
||||
// Whenever Karona attacks, creatures of the creature type of your choice get +3/+3 until end of turn.
|
||||
this.addAbility(new AttacksTriggeredAbility(new KaronaFalseGodBoostEffect(), false, "Whenever {this} attacks, creatures of the creature type of your choice get +3/+3 until end of turn."));
|
||||
this.addAbility(new AttacksTriggeredAbility(new KaronaFalseGodEffect(), false));
|
||||
}
|
||||
|
||||
public KaronaFalseGod(final KaronaFalseGod card) {
|
||||
|
|
@ -91,78 +90,77 @@ public class KaronaFalseGod extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class KaronaFalseGodControlEffect extends ContinuousEffectImpl {
|
||||
|
||||
KaronaFalseGodControlEffect() {
|
||||
super(Duration.Custom, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
|
||||
this.staticText = "that player untaps {this} and gains control of it.";
|
||||
class KaronaFalseGodUntapGetControlEffect extends OneShotEffect {
|
||||
|
||||
public KaronaFalseGodUntapGetControlEffect() {
|
||||
super(Outcome.GainControl);
|
||||
this.staticText = "that player untaps Karona, False God and gains control of it";
|
||||
}
|
||||
|
||||
KaronaFalseGodControlEffect(final KaronaFalseGodControlEffect effect) {
|
||||
|
||||
public KaronaFalseGodUntapGetControlEffect(final KaronaFalseGodUntapGetControlEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public KaronaFalseGodControlEffect copy() {
|
||||
return new KaronaFalseGodControlEffect(this);
|
||||
public KaronaFalseGodUntapGetControlEffect copy() {
|
||||
return new KaronaFalseGodUntapGetControlEffect(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
Player player = game.getPlayer(game.getActivePlayerId());
|
||||
if (player != null && permanent != null) {
|
||||
permanent.untap(game);
|
||||
if (permanent.changeControllerId(player.getId(), game)) {
|
||||
return true;
|
||||
}
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (controller != null && sourceObject != null && sourceObject.equals(sourcePermanent)) {
|
||||
sourcePermanent.untap(game);
|
||||
ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, true, getTargetPointer().getFirst(game, source));
|
||||
effect.setTargetPointer(new FixedTarget(sourcePermanent.getId()));
|
||||
effect.setText("and gains control of it");
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class KaronaFalseGodBoostEffect extends ContinuousEffectImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
private String typeChosen = "";
|
||||
|
||||
KaronaFalseGodBoostEffect() {
|
||||
super(Duration.EndOfTurn, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.BoostCreature);
|
||||
staticText = "creatures of the creature type of your choice get +3/+3 until end of turn.";
|
||||
class KaronaFalseGodEffect extends OneShotEffect {
|
||||
|
||||
public KaronaFalseGodEffect() {
|
||||
super(Outcome.BoostCreature);
|
||||
this.staticText = "creatures of the creature type of your choice get +3/+3 until end of turn";
|
||||
}
|
||||
|
||||
KaronaFalseGodBoostEffect(final KaronaFalseGodBoostEffect effect) {
|
||||
|
||||
public KaronaFalseGodEffect(final KaronaFalseGodEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public KaronaFalseGodBoostEffect copy() {
|
||||
return new KaronaFalseGodBoostEffect(this);
|
||||
public KaronaFalseGodEffect copy() {
|
||||
return new KaronaFalseGodEffect(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
if (typeChosen.isEmpty()) {
|
||||
Choice typeChoice = new ChoiceImpl(true);
|
||||
typeChoice.setMessage("Choose creature type");
|
||||
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
|
||||
while (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
|
||||
if (!player.isInGame()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
typeChosen = typeChoice.getChoice();
|
||||
game.informPlayers(player.getName() + " has chosen " + typeChosen);
|
||||
}
|
||||
for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
|
||||
if (perm.hasSubtype(typeChosen)) {
|
||||
perm.addPower(3);
|
||||
perm.addToughness(3);
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (sourceObject != null && controller != null) {
|
||||
Choice typeChoice = new ChoiceImpl(true);
|
||||
typeChoice.setMessage("Choose creature type");
|
||||
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
|
||||
while (!controller.choose(Outcome.BoostCreature, typeChoice, game)) {
|
||||
if (!controller.isInGame()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
String typeChosen = typeChoice.getChoice();
|
||||
if (!typeChosen.isEmpty()) {
|
||||
game.informPlayers(controller.getName() + " has chosen " + typeChosen);
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
filter.add(new SubtypePredicate(typeChosen));
|
||||
game.addEffect(new BoostAllEffect(3,3,Duration.EndOfTurn, filter, false), source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue