It is currently 16 Apr 2024, 20:01
   
Text Size

Card Contributions

Moderators: ubeefx, beholder, melvin, ShawnieBoy, Lodici, CCGHQ Admins

Re: Card Contributions

Postby muppet » 19 Mar 2015, 14:11

its done with this 353 * effect: Search your library for a card and put it into your hand. Then shuffle your library.
354 * effect: Search your library for up to <amount> <chosen>

1399 * effect: Search your library for <chosen> and put it onto the battlefield. Then shuffle your library.
1400 * effect: Put SN on top of its owner's library.


Which has no mention of timing as far as I can tell.
muppet
Tester
 
Posts: 590
Joined: 03 Aug 2011, 14:37
Has thanked: 33 times
Been thanked: 30 times

Re: Card Contributions

Postby ShawnieBoy » 19 Mar 2015, 20:22

muppet wrote:its done with this 353 * effect: Search your library for a card and put it into your hand. Then shuffle your library.
354 * effect: Search your library for up to <amount> <chosen>

1399 * effect: Search your library for <chosen> and put it onto the battlefield. Then shuffle your library.
1400 * effect: Put SN on top of its owner's library.


Which has no mention of timing as far as I can tell.
Most searches have a timing of Draw (which I'm personally not keen on, as it's the same as Main).

It's in the MagicRuleEventAction.java SearchLibraryToHand

Looking at the timings, it's unlikely to sacrificed in response to an effect from the opponent during combat, or any other phase other than Main.
User avatar
ShawnieBoy
Programmer
 
Posts: 601
Joined: 02 Apr 2012, 22:42
Location: UK
Has thanked: 80 times
Been thanked: 50 times

Re: Card Contributions

Postby PalladiaMors » 22 Mar 2015, 00:37

Hi, could I please have some help with this one? I've already tried to do "target creature gains protection from the color of your choice" a bunch of times, but I can never get it right. It loads, but crashes during gameplay. It requires an event chain, and I can't seem able to get any of those cards right - there's something about them that I'm just incapable of understanding. Any help appreciated, lots of cards have this ability, would be a nice addition to the pool. And I have to get this one off my chest! Oh, this one is Mother of Runes.

Code: Select all
def action = {
    final MagicGame game, final MagicEvent event ->
        event.processTargetPermanent(game, {
            game.doAction(new MagicGainAbilityAction(it,event.getChosenColor().getProtectionAbility()));
        });
    }

[
    new MagicPermanentActivation(
        new MagicActivationHints(MagicTiming.Pump),
        "Protection"
    ) {
        @Override
        public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
            return [new MagicTapEvent(source)];
        }
        @Override
        public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
            return new MagicEvent(
                source,
                MagicTargetChoice.TARGET_CREATURE_YOU_CONTROL,
                this,
                "Target creature you control\$ gains protection from the color of your choice until end of turn."
            );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            game.addEvent(new MagicEvent(
                event.getSource(),
                MagicColorChoice.ALL_INSTANCE,
                action,
                "Chosen color\$."
            ));
        }
    }
]
PalladiaMors
 
Posts: 343
Joined: 12 Jul 2014, 17:40
Has thanked: 36 times
Been thanked: 22 times

Re: Card Contributions

Postby ShawnieBoy » 22 Mar 2015, 01:36

PalladiaMors wrote:Hi, could I please have some help with this one? I've already tried to do "target creature gains protection from the color of your choice" a bunch of times, but I can never get it right. It loads, but crashes during gameplay. It requires an event chain, and I can't seem able to get any of those cards right - there's something about them that I'm just incapable of understanding. Any help appreciated, lots of cards have this ability, would be a nice addition to the pool. And I have to get this one off my chest! Oh, this one is Mother of Runes.

Code: Select all
def action = {
    final MagicGame game, final MagicEvent event ->
        event.processTargetPermanent(game, {
            game.doAction(new MagicGainAbilityAction(it,event.getChosenColor().getProtectionAbility()));
        });
    }

[
    new MagicPermanentActivation(
        new MagicActivationHints(MagicTiming.Pump),
        "Protection"
    ) {
        @Override
        public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
            return [new MagicTapEvent(source)];
        }
        @Override
        public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
            return new MagicEvent(
                source,
                MagicTargetChoice.TARGET_CREATURE_YOU_CONTROL,
                this,
                "Target creature you control\$ gains protection from the color of your choice until end of turn."
            );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            game.addEvent(new MagicEvent(
                event.getSource(),
                MagicColorChoice.ALL_INSTANCE,
                action,
                "Chosen color\$."
            ));
        }
    }
]
Yes, I've never had any luck with these either - Kinda doubly confounded as the choice only occurs during resolution, which is also a bit of a no-no in Magarena.

It's a bit beyond me, maybe @Melvin will be able to shed some light on this, but I feer it enters the 'multiple targets' group of effects. A target and a choice.
User avatar
ShawnieBoy
Programmer
 
Posts: 601
Joined: 02 Apr 2012, 22:42
Location: UK
Has thanked: 80 times
Been thanked: 50 times

Re: Card Contributions

Postby melvin » 22 Mar 2015, 10:11

@Pallidiamors: Your original had two bugs:
1. in the event with the target, the corresponding executeEvent should use processTargetPermanent

2. the chosen permanent in the first event, should be passed into the second event, so that the second event can retrieve it as getRefPermanent

Code: Select all
def action = {
    final MagicGame game, final MagicEvent event ->
    game.doAction(new MagicGainAbilityAction(
        event.getRefPermanent(),
        event.getChosenColor().getProtectionAbility()
    ));
}

[
    new MagicPermanentActivation(
        new MagicActivationHints(MagicTiming.Pump),
        "Protection"
    ) {
        @Override
        public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
            return [new MagicTapEvent(source)];
        }
        @Override
        public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
            return new MagicEvent(
                source,
                MagicTargetChoice.TARGET_CREATURE_YOU_CONTROL,
                this,
                "Target creature you control\$ gains protection from the color of your choice until end of turn."
            );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            event.processTargetPermanent(game, {
                game.addEvent(new MagicEvent(
                    event.getSource(),
                    event.getPlayer(),
                    MagicColorChoice.ALL_INSTANCE,
                    it,
                    action,
                    "Chosen color\$."
                ));
            });
        }
    }
]
User avatar
melvin
AI Programmer
 
Posts: 1062
Joined: 21 Mar 2010, 12:26
Location: Singapore
Has thanked: 36 times
Been thanked: 459 times

Re: Card Contributions

Postby melvin » 22 Mar 2015, 13:32

This looks like a fairly common ability, made it available in card script and added cards that can be implemented completely as card script.
User avatar
melvin
AI Programmer
 
Posts: 1062
Joined: 21 Mar 2010, 12:26
Location: Singapore
Has thanked: 36 times
Been thanked: 459 times

Re: Card Contributions

Postby muppet » 22 Mar 2015, 14:34

I found a card with a timing of draw which doesn't seem to be on the list in the timings table ?
muppet
Tester
 
Posts: 590
Joined: 03 Aug 2011, 14:37
Has thanked: 33 times
Been thanked: 30 times

Re: Card Contributions

Postby ShawnieBoy » 22 Mar 2015, 15:42

muppet wrote:I found a card with a timing of draw which doesn't seem to be on the list in the timings table ?
Main has it's aliases referenced at the bottom of the table: "Artifact", "Aura", "Draw", "Enchantment", "Equipment" and "Land" are all the same timing.
User avatar
ShawnieBoy
Programmer
 
Posts: 601
Joined: 02 Apr 2012, 22:42
Location: UK
Has thanked: 80 times
Been thanked: 50 times

Re: Card Contributions

Postby ShawnieBoy » 22 Mar 2015, 15:49

melvin wrote:@Pallidiamors: Your original had two bugs:
1. in the event with the target, the corresponding executeEvent should use processTargetPermanent

2. the chosen permanent in the first event, should be passed into the second event, so that the second event can retrieve it as getRefPermanent

Code: Select all
def action = {
    final MagicGame game, final MagicEvent event ->
    game.doAction(new MagicGainAbilityAction(
        event.getRefPermanent(),
        event.getChosenColor().getProtectionAbility()
    ));
}

[
    new MagicPermanentActivation(
        new MagicActivationHints(MagicTiming.Pump),
        "Protection"
    ) {
        @Override
        public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
            return [new MagicTapEvent(source)];
        }
        @Override
        public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
            return new MagicEvent(
                source,
                MagicTargetChoice.TARGET_CREATURE_YOU_CONTROL,
                this,
                "Target creature you control\$ gains protection from the color of your choice until end of turn."
            );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            event.processTargetPermanent(game, {
                game.addEvent(new MagicEvent(
                    event.getSource(),
                    event.getPlayer(),
                    MagicColorChoice.ALL_INSTANCE,
                    it,
                    action,
                    "Chosen color\$."
                ));
            });
        }
    }
]
Is the AI happy now with choices in resolution? I can remember a time when it wasn't working properly (I think it was in the design principles too)

I'm sure there must be other cards that could do with similar changes, though not off the top of my head.
User avatar
ShawnieBoy
Programmer
 
Posts: 601
Joined: 02 Apr 2012, 22:42
Location: UK
Has thanked: 80 times
Been thanked: 50 times

Re: Card Contributions

Postby muppet » 22 Mar 2015, 16:25

Ok sorry failed at reading as usual. The card in question is Ancestral Recall and you certainly don't want to play that only in main phase. For example the ai plays it when drawing 3 cards will cause it to discard which if it played it in opps end step it wouldn't.
muppet
Tester
 
Posts: 590
Joined: 03 Aug 2011, 14:37
Has thanked: 33 times
Been thanked: 30 times

Re: Card Contributions

Postby ShawnieBoy » 22 Mar 2015, 16:34

muppet wrote:Ok sorry failed at reading as usual. The card in question is Ancestral Recall and you certainly don't want to play that only in main phase. For example the ai plays it when drawing 3 cards will cause it to discard which if it played it in opps end step it wouldn't.
Yes, I've had this issue with instant cast Draw spells before (and activated abilities). I would prefer to remove Draw from main, sorcery draw cards can only be cast during those phases anyway.
User avatar
ShawnieBoy
Programmer
 
Posts: 601
Joined: 02 Apr 2012, 22:42
Location: UK
Has thanked: 80 times
Been thanked: 50 times

Re: Card Contributions

Postby ShawnieBoy » 23 Mar 2015, 05:19

Just noticed Apostle's Blessing and Razor Barrier in the submissions.

As they stand at the moment they've been converted into modal effects - however the choice isn't made until resolution. (Think of them as being 'gains protection from the colour of your choice, including artifacts')
User avatar
ShawnieBoy
Programmer
 
Posts: 601
Joined: 02 Apr 2012, 22:42
Location: UK
Has thanked: 80 times
Been thanked: 50 times

Re: Card Contributions

Postby PalladiaMors » 25 Mar 2015, 18:39

I'm trying to code the ability Kinship (script below is supposed to be Wolf-Skull Shaman). Unfortunately, the second event is broken: you can't choose either yes or no, the game doesn't crash or freeze, but it hangs (you can't get away from the choice). I'm trying to figure out ways around this, in particular I'm thinking about getting rid of the first may choice, since there's no reason the player wouldn't want to look at his top card. However, if there's a way to do the card strictly according to its wording, I guess it would be better. Any ideas greatly appreciated!

Code: Select all
def action = {
    final MagicGame game, final MagicEvent event ->
    if (event.isYes()) {
        game.doAction(new MagicRevealAction(event.getRefCard()));
        game.doAction(new MagicPlayTokenAction(event.getPlayer(),TokenCardDefinitions.get("2/2 green Wolf creature token")));
    }
}

[
    new MagicAtYourUpkeepTrigger() {
        @Override
        public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer upkeepPlayer) {
            return new MagicEvent(
                permanent,
                new MagicMayChoice(),
                this,
                "PN may\$ look at the top card of his of her library. If it shares a creature type with SN, you may reveal it."
            );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            if (event.isYes()) {
                for (final MagicCard card : event.getPlayer().getLibrary().getCardsFromTop(1)) {
                    game.doAction(new MagicLookAction(card, event.getPlayer(), "top card of your library"));
                        for (final MagicSubType subtype : MagicSubType.values()) {
                        if (card.hasSubType(subtype) == event.getPermanent().hasSubType(subtype)) {
                            game.addEvent(new MagicEvent(
                                event.getSource(),
                                event.getPlayer(),
                                new MagicMayChoice("Reveal the top card of your library?"),
                                card,
                                action,
                                "PN may\$ reveal the top card of his library. If you do, put a 2/2 green Wolf creature token onto the battlefield."
                           ));
                        }
                    }
                }
            }
        }
    }
]
Edit: it does work with only one may choice (maybe there's some issue with chaining may choices, or maybe I made some mistake). I actually think this is better, since the AI doesn't get the opportunity to mistakenly skip looking at the card.

Code: Select all
[
    new MagicAtYourUpkeepTrigger() {
        @Override
        public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer upkeepPlayer) {
            for (final MagicCard card : upkeepPlayer.getLibrary().getCardsFromTop(1)) {
                game.doAction(new MagicLookAction(card, upkeepPlayer, "top card of your library"));
                    for (final MagicSubType subtype : MagicSubType.values()) {
                    return card.hasSubType(subtype) == permanent.hasSubType(subtype) ?
                        new MagicEvent(
                            permanent,
                            new MagicMayChoice(),
                            card,
                            this,
                            "PN may\$ reveal the top card of PN's library. If you do, put a 2/2 green Wolf creature token onto the battlefield."
                        ):
                        MagicEvent.NONE;
                    }
                }
            }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            if (event.isYes()) {
                game.doAction(new MagicRevealAction(event.getRefCard()));
                game.doAction(new MagicPlayTokenAction(event.getPlayer(),TokenCardDefinitions.get("2/2 green Wolf creature token")));
            }
        }
    }
]
PalladiaMors
 
Posts: 343
Joined: 12 Jul 2014, 17:40
Has thanked: 36 times
Been thanked: 22 times

Re: Card Contributions

Postby PalladiaMors » 27 Mar 2015, 11:49

Submitted a small fix for Forsaken Wastes (last ability should trigger for either player, not just opponent).
PalladiaMors
 
Posts: 343
Joined: 12 Jul 2014, 17:40
Has thanked: 36 times
Been thanked: 22 times

Re: Card Contributions

Postby PalladiaMors » 01 Apr 2015, 18:57

I've started to work on the Urza's "untap up to X lands" cards (Frantic Search & co.). While I don't know how to code the "up to" part, I've noticed that you can select an already untapped land if you don't want to untap others (the cards don't mention that the lands must be tapped). Also, now that there's no more mana burn, I can't think of a possible reason not to untap either (before maybe you could consider something like Citadel of Pain). I think it's solid to do the cards this way, and these are popular cards that will enable a bunch of decks.
PalladiaMors
 
Posts: 343
Joined: 12 Jul 2014, 17:40
Has thanked: 36 times
Been thanked: 22 times

PreviousNext

Return to Magarena

Who is online

Users browsing this forum: Google [Bot] and 21 guests


Who is online

In total there are 22 users online :: 1 registered, 0 hidden and 21 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: Google [Bot] and 21 guests

Login Form