mirror of
https://github.com/correl/mage.git
synced 2025-01-11 19:13:02 +00:00
Merge origin/master
This commit is contained in:
commit
5a551d631b
4 changed files with 69 additions and 66 deletions
|
@ -135,7 +135,7 @@ class GarrukApexPredatorEffect3 extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent creature = (Permanent) game.getLastKnownInformation(source.getFirstTarget(), Zone.BATTLEFIELD);
|
||||
Permanent creature = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
|
||||
if (player != null && creature != null) {
|
||||
player.gainLife(creature.getToughness().getValue(), game);
|
||||
return true;
|
||||
|
|
|
@ -126,7 +126,8 @@ class MaralenOfTheMornsongEffect2 extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
UUID activePlayerId = game.getActivePlayerId();
|
||||
Player player = game.getPlayer(activePlayerId);
|
||||
if (player != null) {
|
||||
player.loseLife(3, game);
|
||||
TargetCardInLibrary target = new TargetCardInLibrary();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,7 +138,9 @@ public class PermanentCard extends PermanentImpl {
|
|||
Card originalCard = game.getCard(this.getId());
|
||||
if (isFaceDown()) {
|
||||
setFaceDown(false);
|
||||
originalCard.setFaceDown(false); //TODO: Do this in a better way
|
||||
if (originalCard != null) {
|
||||
originalCard.setFaceDown(false); //TODO: Do this in a better way
|
||||
}
|
||||
}
|
||||
ZoneChangeEvent event = new ZoneChangeEvent(this, sourceId, controllerId, fromZone, toZone, appliedEffects);
|
||||
if (!game.replaceEvent(event)) {
|
||||
|
@ -146,7 +148,9 @@ public class PermanentCard extends PermanentImpl {
|
|||
game.rememberLKI(objectId, Zone.BATTLEFIELD, this);
|
||||
if (owner != null) {
|
||||
this.setControllerId(ownerId); // neccessary for e.g. abilities in graveyard or hand to not have a controller != owner
|
||||
originalCard.updateZoneChangeCounter();
|
||||
if (originalCard != null) {
|
||||
originalCard.updateZoneChangeCounter();
|
||||
}
|
||||
switch (event.getToZone()) {
|
||||
case GRAVEYARD:
|
||||
owner.putInGraveyard(card, game, !flag);
|
||||
|
|
Loading…
Reference in a new issue