It is currently 18 Jul 2025, 05:36
   
Text Size

Card Contributions

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

Re: Card Contributions

Postby PalladiaMors » 09 Sep 2014, 18:33

Continuing on my quest to increase the % of implemented cards from Alliances, this time I focused on Viscerid Drone. I'm have a problem with getting it to accept sacrificing a Snow-Covered Swamp. I saw that recently you guys expanded the code to recognize card names in some cases, so I thought that might do the trick, put it didn't work. Is there currently a way to get it to accept sacrificing a Snow-Covered Swamp?

Code: Select all
def choice = new MagicTargetChoice("a Swamp to sacrifice");

def choice2 = new MagicTargetChoice("a card named Snow-Covered Swamp to sacrifice");

def choice3 = MagicTargetChoice.Negative("target nonartifact creature");
[
    new MagicPermanentActivation(
        new MagicActivationHints(MagicTiming.Removal),
        "Nonartifact"
    ) {

        @Override
        public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
            return [
                new MagicTapEvent(source),
           new MagicSacrificePermanentEvent(source,MagicTargetChoice.SACRIFICE_CREATURE),
      new MagicSacrificePermanentEvent(source,choice)
            ];
        }

        @Override
        public MagicEvent getPermanentEvent(final MagicPermanent source, final MagicPayedCost payedCost) {
            return new MagicEvent(
                source,
                choice3,
                this,
                "Destroy target nonartifact creature\$. It can't be regenerated."
            );
        }

        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            event.processTargetPermanent(game, {
                 game.doAction(MagicChangeStateAction.Set(it,MagicPermanentState.CannotBeRegenerated));
                 game.doAction(new MagicDestroyAction(it));   
            });
        }
    },

    new MagicPermanentActivation(
        new MagicActivationHints(MagicTiming.Removal),
        "Any"
    ) {

        @Override
        public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
            return [
                new MagicTapEvent(source),
           new MagicSacrificePermanentEvent(source,MagicTargetChoice.SACRIFICE_CREATURE),
      new MagicSacrificePermanentEvent(source,choice2)
            ];
        }

        @Override
        public MagicEvent getPermanentEvent(final MagicPermanent source, final MagicPayedCost payedCost) {
            return new MagicEvent(
                source,
                MagicTargetChoice.TARGET_CREATURE,
                this,
                "Destroy target creature\$. It can't be regenerated."
            );
        }

        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            event.processTargetPermanent(game, {
                 game.doAction(MagicChangeStateAction.Set(it,MagicPermanentState.CannotBeRegenerated));
                 game.doAction(new MagicDestroyAction(it));   
            });
        }
    }
]
Also, concerning Wandering Mage's third ability. Is it currently possible to put a counter as an activation cost? I've seen cards that have removing counters as a cost with MagicRemoveCounterEvent. I tried to use MagicAddCounterEvent and MagicPutCounterEvent, but neither worked. Did I get the name wrong, or is that currently unavailable?
PalladiaMors
 
Posts: 343
Joined: 12 Jul 2014, 17:40
Has thanked: 36 times
Been thanked: 22 times

Re: Card Contributions

Postby ShawnieBoy » 09 Sep 2014, 22:07

PalladiaMors wrote:Continuing on my quest to increase the % of implemented cards from Alliances, this time I focused on Viscerid Drone. I'm have a problem with getting it to accept sacrificing a Snow-Covered Swamp. I saw that recently you guys expanded the code to recognize card names in some cases, so I thought that might do the trick, put it didn't work. Is there currently a way to get it to accept sacrificing a Snow-Covered Swamp?

Also, concerning Wandering Mage's third ability. Is it currently possible to put a counter as an activation cost? I've seen cards that have removing counters as a cost with MagicRemoveCounterEvent. I tried to use MagicAddCounterEvent and MagicPutCounterEvent, but neither worked. Did I get the name wrong, or is that currently unavailable?
The 'sacrifice a Snow-Covered Swamp' is no longer correct. Snow is now a supertype (read - Type in Magarena), so would be 'a snow Swamp'. (Other Swamp can become snow, and wouldn't be a Snow-Covered Swamp) - Have a look at Glacial Crevasses.

edit - Misread the 'putting counters on' question. Putting counters on another permanent as a cost would be a MagicAddCounterEvent, but would need a targetchoice.
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 » 09 Sep 2014, 23:17

new MagicTargetChoice("a snow Swamp to sacrifice") doesn't work. I tried to switch to Mountain instead, and then the card works fine. I think there's some kind of "filter" problem with Swamps in this case?

Edit: Trying to do Wandering Mage's third ability. Sorry to annoy you guys, but I can't get the MagicAddCounterEvent "structure" right. Tried MagicAddCounterEvent(source,target,counter type,amount) but it didn't work. What's the correct structure? Again I'm sorry, I just can't find any example of this in the costs.

Code: Select all
[
    new MagicPermanentActivation(
        new MagicActivationHints(MagicTiming.Pump),
        "Prevent"
    ) {

        @Override
        public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
            return [
                new MagicPayManaCostEvent(source,"{B}"),
      new MagicAddCounterEvent(source,MagicTargetChoice.TARGET_CREATURE_YOU_CONTROL,MagicCounterType.MinusOne,1)
            ];
        }

        @Override
        public MagicEvent getPermanentEvent(final MagicPermanent source, final MagicPayedCost payedCost) {
            return new MagicEvent(
                source,
                MagicTargetChoice.TARGET_PLAYER,
                this,
                "Prevent the next 2 damage that would be dealt to target player\$ this turn. "
            );
        }

        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            event.processTargetPlayer(game,{
                game.doAction(new MagicPreventDamageAction(it,2));
            });
        }
    }
]
PalladiaMors
 
Posts: 343
Joined: 12 Jul 2014, 17:40
Has thanked: 36 times
Been thanked: 22 times

Re: Card Contributions

Postby ShawnieBoy » 10 Sep 2014, 01:51

PalladiaMors wrote:new MagicTargetChoice("a snow Swamp to sacrifice") doesn't work. I tried to switch to Mountain instead, and then the card works fine. I think there's some kind of "filter" problem with Swamps in this case?

Edit: Trying to do Wandering Mage's third ability. Sorry to annoy you guys, but I can't get the MagicAddCounterEvent "structure" right. Tried MagicAddCounterEvent(source,target,counter type,amount) but it didn't work. What's the correct structure? Again I'm sorry, I just can't find any example of this in the costs.

Code: Select all
[
    new MagicPermanentActivation(
        new MagicActivationHints(MagicTiming.Pump),
        "Prevent"
    ) {

        @Override
        public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
            return [
                new MagicPayManaCostEvent(source,"{B}"),
      new MagicAddCounterEvent(source,MagicTargetChoice.TARGET_CREATURE_YOU_CONTROL,MagicCounterType.MinusOne,1)
            ];
        }

        @Override
        public MagicEvent getPermanentEvent(final MagicPermanent source, final MagicPayedCost payedCost) {
            return new MagicEvent(
                source,
                MagicTargetChoice.TARGET_PLAYER,
                this,
                "Prevent the next 2 damage that would be dealt to target player\$ this turn. "
            );
        }

        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            event.processTargetPlayer(game,{
                game.doAction(new MagicPreventDamageAction(it,2));
            });
        }
    }
]
Ah, yes - It looks like only 'snow Mountain you control' in in the target filters, will add the others (was sure there were there). Viscerid Drone will then be able to be purely scripted, no need for groovy. Separate the 'and' costs with commas.

MagicAddCounterEvent(MagicPermanent,MagicCounterType,int) - the problem I see is being able to define a choice result before the 'payment' occurs, as the event doesn't accept a choice. It's more of an EventAction, pseudo-event. Will look at adding an 'Put a <type> counter on a creature you control' costEvent to match the 'Remove' version.

No problem at all :D Glad to accept requests! - just wish I replied sooner >.<
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 » 10 Sep 2014, 03:18

ShawnieBoy, just to make sure there's no misunderstanding between us... English isn't my native language and maybe somehow I managed to say something I didn't mean to, but I 100% honestly didn't mean these questions as "requests".

Rest no longer relevant.
Last edited by PalladiaMors on 25 Apr 2015, 12:50, edited 2 times in total.
PalladiaMors
 
Posts: 343
Joined: 12 Jul 2014, 17:40
Has thanked: 36 times
Been thanked: 22 times

Re: Card Contributions

Postby ShawnieBoy » 10 Sep 2014, 05:20

PalladiaMors wrote:Shawn, mate, just to make sure there's no misunderstanding between us... English isn't my native language and maybe somehow I managed to say something I didn't mean to, but I 100% honestly didn't mean these questions as "requests", I was just trying to understand if those things were doable or not. If you place yourself in my shoes, you know, someone with zero technical knowledge of programming - my major was in History - it can be hard to tell if I'm making a mistake or trying to do something that can't be done by me.

And it can't be stressed enough: you guys ARE the greatest. Dumb or not I've been around the block and I guess by now my opinion on this might have some weight: I think Magarena is currently the biggest thing going on for the future of the online Magic community. If I can, in my clumsy way, help you guys with 0,0001% of the work without getting in the way, I will try my best to.

Hugs and hetero kisses.
:D
No need to worry, I shouldn't have used the word 'request' although I'm happy to accept those too. (See, your English is better than mine!) Your questions just raised things that can't be done, but can easily be made to be. So I did :)

I've only been contributing to this for about a year, so I know just how you feel! Stumbling through old-school scripting, to groovy, to diving bravely into the source code. Every contribution, no matter how small the submitter may feel it is, is always cherished and appreciated. That's why collaboration and open source just makes you feel all warm and fuzzy inside - hugs and kisses to all! :lol:
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 » 12 Sep 2014, 00:01

I think I might have gotten lucky today when I submitted Ramosian Rally, Orim's whatever and Lashknife. I defined and used the name PLAINS_CONDITION, thinking it wasn't previously coded. I playtested the cards and they seemed to work perfectly - the alternate cast is only available if you control a plains & control an untapped creature - so I thought I had done everything right. However, trying to use the same technique for other cards, I figured out that it seems I can't really define such cast conditions in the groovy - any name other than <landtype>_CONDITION will crash. And the land conditions consist simply in controlling a land of that specific type.

So I'm thinking I might actually not have "defined" anything, luckily used the name of an already existing condition without knowing it, and it only activates when there's an untapped creature because that's in the cost, it has nothing to do with my "definitions". Anyway, if this blabber is comprehensible, can anybody please confirm this?

Edit: Oh and I forgot a random damage.getTarget() in the middle of Putrid Warrior's groovy :shock:
PalladiaMors
 
Posts: 343
Joined: 12 Jul 2014, 17:40
Has thanked: 36 times
Been thanked: 22 times

Re: Card Contributions

Postby ShawnieBoy » 12 Sep 2014, 00:47

PalladiaMors wrote:I think I might have gotten lucky today when I submitted Ramosian Rally, Orim's whatever and Lashknife. I defined and used the name PLAINS_CONDITION, thinking it wasn't previously coded. I playtested the cards and they seemed to work perfectly - the alternate cast is only available if you control a plains & control an untapped creature - so I thought I had done everything right. However, trying to use the same technique for other cards, I figured out that it seems I can't really define such cast conditions in the groovy - any name other than <landtype>_CONDITION will crash. And the land conditions consist simply in controlling a land of that specific type.

So I'm thinking I might actually not have "defined" anything, luckily used the name of an already existing condition without knowing it, and it only activates when there's an untapped creature because that's in the cost, it has nothing to do with my "definitions". Anyway, if this blabber is comprehensible, can anybody please confirm this?

Edit: Oh and I forgot a random damage.getTarget() in the middle of Putrid Warrior's groovy :shock:
You are right, the <landtype>_CONDITIONs are already defined in MagicCondition for all basic lands.
Your definitions are all sound, although not really needed. (I would have thought that definitions in a groovy would take priority, if you named your condition SWAMP_YOU_CONTROL but kept the contents the same, that would test for you ;) - What you call something doesn't change what it is, to go all Zen on you)

In a similar way, the UNTAPPED_CREATURE_YOU_CONTROL target choice can be slimmed down. The definition of the filter already exists (MagicTargetFilterFactory.java is a bit of a monster, but the text parsing near the bottom is worth a look from line 2036+), and as the 'TARGET_CHOICES_IN_CAPITALS' are just a text replacement for:
Code: Select all
new MagicTargetChoice(<target choice text to be converted to a target filter>);
See MagicTargetChoiceYou can instead go straight for defining:
Code: Select all
def choice = new MagicTargetChoice("an untapped creature you control");
(Using choice prevents accidentally stumbling into a choice that already exists)

The text parsing then puts together a target filter for Untapped_Creature_You_Control :)

Really need to put some more work into the wiki... >.<
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 » 12 Sep 2014, 02:42

I followed Shawnie's suggestion and tested renaming the condition in Ramosian Rally's groovy (lol, should have thought about that!) to WHATEVER_CONDITION and then it straight up crashes. So what I think I learned from this is that activation conditions can't be defined in the groovy, they have to be defined in the main code.
PalladiaMors
 
Posts: 343
Joined: 12 Jul 2014, 17:40
Has thanked: 36 times
Been thanked: 22 times

Re: Card Contributions

Postby ShawnieBoy » 12 Sep 2014, 03:01

Code: Select all
def NICE_CONDITION = new MagicCondition() {
    @Override
    public boolean accept(final MagicSource source) {
        return source.getController().getNrOfPermanents(MagicType.Creature) >
            source.getController().getNrOfPermanents(MagicType.Land)
    }
}

[
    new MagicCardActivation(
        [NICE_CONDITION, MagicCondition.CARD_CONDITION],
        new MagicActivationHints(MagicTiming.Removal,true),
        "Pay Life"
    ) {
        @Override
        public Iterable<MagicEvent> getCostEvent(final MagicCard source) {
            return [
                new MagicPayLifeEvent(source, 4)             
            ];
        }
    }
]
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 » 12 Sep 2014, 03:30

Ah, I was typing MagicCondition.WHATEVER_CONDITION instead of WHATEVER_CONDITION straight away. Thanks, Shawnie!

Edit: Shawnie, when you have the time, could you please explain what's the name of the cost event that bounces something to it's owner's hand, as seen in Daze? I've looked hard for that but you guys were VERY throughout with doing those in pure script form, I can't find a single groovy case. I checked Daze's history but it seems to have been added already in script form. Thanks a bunch!
PalladiaMors
 
Posts: 343
Joined: 12 Jul 2014, 17:40
Has thanked: 36 times
Been thanked: 22 times

Re: Card Contributions

Postby ShawnieBoy » 12 Sep 2014, 18:21

PalladiaMors wrote:Shawnie, when you have the time, could you please explain what's the name of the cost event that bounces something to it's owner's hand, as seen in Daze? I've looked hard for that but you guys were VERY throughout with doing those in pure script form, I can't find a single groovy case. I checked Daze's history but it seems to have been added already in script form. Thanks a bunch!
Code: Select all
MagicBounceChosenPermanentEvent(MagicSource,MagicPlayer,MagicTargetChoice);
MagicBounceChosenPermanentEvent(MagicSource,MagicTargetChoice);
You'll find it in Curfew (and Blizzard Specter), as the caster/controller doesn't choose. Omitting the player effects the caster.
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 » 13 Sep 2014, 00:53

PalladiaMors wrote:I checked Daze's history but it seems to have been added already in script form.
You can find removed groovy script using the instructions @ viewtopic.php?f=82&t=3736&p=160439#p160439

No guarantee that they will still work with the current engine, but might be useful as an examples.
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 PalladiaMors » 13 Sep 2014, 20:28

^I've been using that since I saw that post, it's extremely useful!

I've submitted Breakthrough, which is a monster of a card, but noticed a couple issues.

a) The text of the MagicDiscardEvent says "choose a card from your hand". What it means is that the player should choose a card to discard. However, Breakthrough's text says the player should choose cards to keep in his hand (of course, choosing cards to keep and discarding the rest or choosing cards to discard and keeping the rest have the same result). In case a player isn't used to Magarena, he may be confused by this. My suggestion is that maybe the DiscardEvent's text could be changed to "choose a card to discard", in order to prevent such misunderstandings? I think it would be useful in general to clarify what the player is doing, not just for this specific card.

b) Breakthrough is the first card I've thought of so far that's significantly hurt by the fact that X can't be zero. It's used in Odyssey block with madness, flashback and threshold, more often than not it's cast with X=0. So I guess you guys have to figure out whether it's really implementable at this point, without X=0 I'd have to admit that the card won't be fully functional yet. I'd really like to be able to play Odyssey madness in Magarena, though...

Edit: Also, this one I think is kinda funny: I was trying to do the card Override and got a crash which I'm pretty sure is related to the card's name conflicting with the @Override code. Is there any way around this?
PalladiaMors
 
Posts: 343
Joined: 12 Jul 2014, 17:40
Has thanked: 36 times
Been thanked: 22 times

Re: Card Contributions

Postby ShawnieBoy » 15 Sep 2014, 22:18

a) Breakthrough could confuse if the card text and actions are 'opposite' each other, there's no real simply way of changing the text, as the 'card-chooser' used by the discard event is a general 'choose a card' which is used by any effect that needs it. Making things clearer is always a good thing though! It could be possible to use the 'chosen cards' to create a cardList, and discard cards not in that list to closer match the card.
b) I think the above is more of a 'is this fully functional' than the current problem with X not able to be 0. The card will still function, but not as optimised (Same as using a 0-point Blaze to kill an Phantom Beast)

As for the Override problem, I'm kinda stumped! I can only think of somehow changing the name, but not sure if it's the 'name=Override' property or the derived name from the filename or something is causing it. Hopefully there'll never be a card called 'FileUtils.deleteDirectory(C:)'
User avatar
ShawnieBoy
Programmer
 
Posts: 601
Joined: 02 Apr 2012, 22:42
Location: UK
Has thanked: 80 times
Been thanked: 50 times

PreviousNext

Return to Magarena

Who is online

Users browsing this forum: No registered users and 0 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 0 users online :: 0 registered, 0 hidden and 0 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 0 guests

Login Form