It is currently 16 Apr 2024, 17:40
   
Text Size

Adding new cards with Groovy

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

Re: Adding new cards with Groovy

Postby hong yie » 01 Apr 2015, 12:30

How about when a token enter battlefield? Need a scrypt to make the token copy "essence of the wild". :)
User avatar
hong yie
Programmer
 
Posts: 216
Joined: 10 Mar 2013, 06:44
Location: Jakarta
Has thanked: 75 times
Been thanked: 9 times

Re: Adding new cards with Groovy

Postby melvin » 02 Apr 2015, 03:44

No, MagicEnterAsCopy only works on the card itself, not on other cards.
User avatar
melvin
AI Programmer
 
Posts: 1062
Joined: 21 Mar 2010, 12:26
Location: Singapore
Has thanked: 36 times
Been thanked: 459 times

Re: Adding new cards with Groovy

Postby hong yie » 02 Apr 2015, 04:16

melvin wrote:No, MagicEnterAsCopy only works on the card itself, not on other cards.
will be available someday? i hope... :)
User avatar
hong yie
Programmer
 
Posts: 216
Joined: 10 Mar 2013, 06:44
Location: Jakarta
Has thanked: 75 times
Been thanked: 9 times

Re: Adding new cards with Groovy

Postby melvin » 02 Apr 2015, 04:46

Anything can happen if someone decides to work on it. I would say this is more doable compared to mana pool or multiple targets.
User avatar
melvin
AI Programmer
 
Posts: 1062
Joined: 21 Mar 2010, 12:26
Location: Singapore
Has thanked: 36 times
Been thanked: 459 times

Re: Adding new cards with Groovy

Postby ShawnieBoy » 05 May 2015, 20:44

Ok, have a problem here, any extra eyes will help:

Working on Bloodfire Infusion and hit a problem with sacrificing the enchanted permanent as a cost. (Code below) - Everything looks fine, and from the player's side, is fine, but when it comes to the AI, it crashes. A proper crash to desktop with nothing written to the log.

I'm sure it's the cost, as there's no other cards currently doing it (The closest I found was Slow Motion, but that's an effect not a cost and the only other card that does do it, is Betrothed of Fire). I'm assuming it's finding possibilities where the source.getEnchantedPermanent() is null or somesuch, but unsure how to fix it.

Code: Select all
name=Bloodfire Infusion
image=http://magiccards.info/scans/en/ap/57.jpg
value=2.500
rarity=C
type=Enchantment
subtype=Aura
cost={2}{R}
timing=aura
enchant=power,pos creature you control
requires_groovy_code
oracle=Enchant creature you control\n{R}, Sacrifice enchanted creature: Bloodfire Infusion deals damage equal to the sacrificed creature's power to each creature.
Code: Select all
[
    new MagicPermanentActivation(
        new MagicActivationHints(MagicTiming.Removal),
        "Destroy"
    ) {
        @Override
        public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
            return [
                new MagicPayManaCostEvent(source, "{R}"),
                new MagicSacrificeEvent(source.getEnchantedPermanent())
            ];
        }

        @Override
        public MagicEvent getPermanentEvent(final MagicPermanent source, final MagicPayedCost payedCost) {
            return new MagicEvent(
                source,
                payedCost.getTarget(),
                this,
                "SN deals damage equal to RN's power to each creature."
            );
        }

        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            final MagicPlayer player = event.getPlayer();
            final int amount = event.getRefPermanent().getPower();
            game.logAppendMessage(player, "("+amount+")");
            CREATURE.filter(game) each {
                game.doAction(new DealDamageAction(event.getPermanent(), it, amount));
            }
        }
    }
]
Or there's a problem with the Aura going to the graveyard or being in the graveyard when the effect resolves.
User avatar
ShawnieBoy
Programmer
 
Posts: 601
Joined: 02 Apr 2012, 22:42
Location: UK
Has thanked: 80 times
Been thanked: 50 times

Re: Adding new cards with Groovy

Postby PalladiaMors » 05 May 2015, 22:35

I remember running into what I think is the same problem months ago when I tried to do Nature's Chosen (in that case it requires tapping the enchanted permanent as a cost rather than sacrificing). My brilliant solution on that case was... to give up doing the card! Obviously that doesn't help you, but I suspect there may be other cards with similar text. But it seemed to me that "recovering" the information about what's the enchanted permanent in the cost part of the script isn't supported. I didn't put that on the list thing because it seemed like there were too few cards like that, but maybe I was wrong. I think I also tried to do it by doing a custom permanent filter, but that didn't work either (I can't recall that too well anymore).

By the way, good job on the "X is the sacrificed creature's power/toughness" cards, looks like you hit gold there.
PalladiaMors
 
Posts: 343
Joined: 12 Jul 2014, 17:40
Has thanked: 36 times
Been thanked: 22 times

Re: Adding new cards with Groovy

Postby ShawnieBoy » 05 May 2015, 22:53

PalladiaMors wrote:By the way, good job on the "X is the sacrificed creature's power/toughness" cards, looks like you hit gold there.
Was a surprisingly rich vein :) - There's still a few there, Feed the Pack wasn't co-operating. I do enjoy discovering a whole bunch of overlooked cards, it all began with the Isochron Scepter issue and additional costs.

The reason I've not simply discarded this one is that I can't even get an error out of it, just a crash, but I expect this might me one of those 'can't yet be done'
User avatar
ShawnieBoy
Programmer
 
Posts: 601
Joined: 02 Apr 2012, 22:42
Location: UK
Has thanked: 80 times
Been thanked: 50 times

Previous

Return to Magarena

Who is online

Users browsing this forum: No registered users and 24 guests


Who is online

In total there are 24 users online :: 0 registered, 0 hidden and 24 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: No registered users and 24 guests

Login Form