Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

THB - Theros Beyond Death Set Card Implementation Tracking #6087

Closed
theelk801 opened this issue Dec 12, 2019 · 6 comments
Closed

THB - Theros Beyond Death Set Card Implementation Tracking #6087

theelk801 opened this issue Dec 12, 2019 · 6 comments
Labels

Comments

@theelk801
Copy link
Contributor

@theelk801 theelk801 commented Dec 12, 2019

Mark cards you're working on in the second post of this issue.
If you can't check things off, leave a comment instead.
Once the card is committed, check off the card here to show that it's finished.
Don't worry about adding new spoilers to this list, it's generated by a script.

All Sets

Unimplemented Cards

None!

Implemented Cards

Click to expand
@theelk801

This comment has been minimized.

Copy link
Contributor Author

@theelk801 theelk801 commented Dec 12, 2019

Set is done

@jmharmon

This comment has been minimized.

Copy link
Contributor

@jmharmon jmharmon commented Dec 12, 2019

The cards that were leaked, I have some done already. Is it okay to add those?

@theelk801

This comment has been minimized.

Copy link
Contributor Author

@theelk801 theelk801 commented Dec 12, 2019

Yeah, I guess so. I wanted to wait on them but it probably doesn't matter.

@jmharmon

This comment has been minimized.

Copy link
Contributor

@jmharmon jmharmon commented Dec 14, 2019

Eidolon of Philosophy
Leonin of the Lost Pride
Memory Drain
Nyxborn Courser

@JayDi85 JayDi85 pinned this issue Dec 14, 2019
@theelk801 theelk801 changed the title THB - Theros: Beyond Death Set Card Implementation Tracking THB - Theros Beyond Death Set Card Implementation Tracking Dec 17, 2019
@LevelX2

This comment has been minimized.

Copy link
Contributor

@LevelX2 LevelX2 commented Jan 12, 2020

That's what I done so far.
But it does not work, because the Lion has to be an enchantment while entering.
That does not seem to work with the existing code.

And I have no more time today. So see what you can do. :-)

package mage.cards.b;

import java.util.ArrayList;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.DependencyType;
import mage.constants.Duration;
import mage.constants.Layer;
import static mage.constants.Layer.AbilityAddingRemovingEffects_6;
import static mage.constants.Layer.TypeChangingEffects_4;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.common.TargetControlledCreaturePermanent;

/**
 *
 * @author LevelX2
 */
public final class BronzehideLion extends CardImpl {

    public BronzehideLion(UUID ownerId, CardSetInfo setInfo) {
        super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}{W}");

        this.subtype.add(SubType.CAT);
        this.power = new MageInt(3);
        this.toughness = new MageInt(3);

        // {G}{W}: Bronzehide Lion gains indestructible until end of turn.
        this.addAbility(new SimpleActivatedAbility(
                new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn),
                new ManaCostsImpl("{G}{W}")));

        // When Bronzehide Lion dies, return it to the battlefield.
        // It's an Aura enchantment with enchant creature you control and
        // "{G}{W}: Enchanted creature gains indestructible until end of turn," and it loses all other abilities.
        this.addAbility(new DiesTriggeredAbility(new BronzehideLionReturnEffect()));
    }

    private BronzehideLion(final BronzehideLion card) {
        super(card);
    }

    @Override
    public BronzehideLion copy() {
        return new BronzehideLion(this);
    }
}

class BronzehideLionReturnEffect extends OneShotEffect {

    BronzehideLionReturnEffect() {
        super(Outcome.PutCardInPlay);
        this.staticText = "return it to the battlefield. "
                + "It's an Aura enchantment with enchant creature you control and "
                + "\"{G}{W}: Enchanted creature gains indestructible until end of turn,\" and it loses all other abilities.";
    }

    private BronzehideLionReturnEffect(final BronzehideLionReturnEffect effect) {
        super(effect);
    }

    @Override
    public BronzehideLionReturnEffect copy() {
        return new BronzehideLionReturnEffect(this);
    }

    @Override
    public boolean apply(Game game, Ability source) {
        Player controller = game.getPlayer(source.getControllerId());
        if (controller == null || !(game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD)) {
            return false;
        }

        Card card = game.getCard(source.getSourceId());
        if (card != null) {
            TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent();
            target.setNotTarget(true);
            if (controller.choose(outcome, target, source.getSourceId(), game)
                    && game.getPermanent(target.getFirstTarget()) != null) {
                game.getState().setValue("attachTo:" + source.getSourceId(), target.getFirstTarget());
            }
            game.addEffect(new BronzehideLionContinuousEffect(game.getState().getZoneChangeCounter(source.getSourceId()) + 1), source);
            controller.moveCards(card, Zone.BATTLEFIELD, source, game);

            return true;
        }
        return false;
    }
}

class BronzehideLionContinuousEffect extends ContinuousEffectImpl {

    private final Ability activatedAbility;
    private int zoneChangeCounter;

    BronzehideLionContinuousEffect(int zoneChangeCounter) {
        super(Duration.Custom, Outcome.Neutral);
        this.zoneChangeCounter = zoneChangeCounter;
        dependencyTypes.add(DependencyType.AuraAddingRemoving);
        this.activatedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(IndestructibleAbility.getInstance(),
                AttachmentType.AURA, Duration.EndOfTurn), new ManaCostsImpl("{G}{W}"));
    }

    BronzehideLionContinuousEffect(final BronzehideLionContinuousEffect ability) {
        super(ability);
        this.activatedAbility = ability.activatedAbility.copy();
        this.zoneChangeCounter = ability.zoneChangeCounter;
    }

    @Override
    public boolean apply(Game game, Ability source) {
        return false;
    }

    @Override
    public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
        MageObject sourceObject = game.getPermanent(source.getSourceId());
        if (sourceObject == null) {
            sourceObject = game.getPermanentEntering(source.getSourceId());
        }
        if (sourceObject != null) {
            if (sourceObject instanceof Permanent) {
                Permanent lion = (Permanent) sourceObject;
                switch (layer) {
                    case TypeChangingEffects_4:
                        lion.getCardType().clear();
                        lion.addCardType(CardType.ENCHANTMENT);
                        lion.getSubtype(game).clear();
                        lion.getSubtype(game).add(SubType.AURA);
                        break;
                    case AbilityAddingRemovingEffects_6:
                        ArrayList<Ability> toRemove = new ArrayList<>();
                        for (Ability ability : lion.getAbilities(game)) {
                            if (!lion.getSpellAbility().equals(ability)) {
                                toRemove.add(ability);
                            }
                        }
                        lion.getAbilities(game).removeAll(toRemove);

                        lion.getSpellAbility().getTargets().clear();
                        lion.getSpellAbility().getEffects().clear();
                        TargetPermanent auraTarget = new TargetControlledCreaturePermanent();
                        lion.getSpellAbility().addTarget(auraTarget);
                        lion.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
                        lion.addAbility(new EnchantAbility(auraTarget.getTargetName()));

                        // add the activated ability
                        lion.addAbility(activatedAbility);

                }
            }
            return true;
        }
        if (game.getState().getZoneChangeCounter(source.getSourceId()) > zoneChangeCounter) {
            discard();
        }
        return false;
    }

    @Override
    public boolean hasLayer(Layer layer) {
        return layer == Layer.TypeChangingEffects_4 || layer == Layer.AbilityAddingRemovingEffects_6;
    }

    @Override
    public BronzehideLionContinuousEffect copy() {
        return new BronzehideLionContinuousEffect(this);
    }
}
@theelk801

This comment has been minimized.

Copy link
Contributor Author

@theelk801 theelk801 commented Jan 12, 2020

Thanks to everyone who contributed.

@theelk801 theelk801 closed this Jan 12, 2020
@theelk801 theelk801 unpinned this issue Jan 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.