It is currently 16 Apr 2024, 21:49
   
Text Size

Card Contributions

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

Re: Card Contributions

Postby PalladiaMors » 01 Nov 2014, 03:18

I had a glance at the current MtG rulebook and figured that currently "snow" is a supertype, like "basic". I tried to put that to use doing Gargantuan Gorilla. It doesn't crash, but it's not getting trample when I sac a snow Forest. Could someone please explain what I did wrong? Besides me misunderstanding that rule, I'm a bit unsure about whether I can place an "if" inside another "if"?

Code: Select all
[
    new MagicAtYourUpkeepTrigger() {
        @Override
        public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer upkeepPlayer) {
            return new MagicEvent(
                permanent,
                new MagicMayChoice("Sacrifice a Forest?"),
                this,
                "PN may\$ sacrifice a Forest. If PN doesn't, sacrifice SN and it deals 7 damage to you."
                + " If a snow Forest is sacrificed this way, SN gains trample until end of turn."
            );
        }

        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            final MagicEvent sac = new MagicSacrificePermanentEvent(event.getPermanent(),event.getPlayer(),MagicTargetChoice.SACRIFICE_FOREST);
            if (event.isYes() && sac.isSatisfied()) {
                game.addEvent(sac);
                if (sac.getPermanent().hasType(MagicType.Snow)) {
                game.doAction(new MagicGainAbilityAction(event.getPermanent(),MagicAbility.Trample));
                }
            } else {
                game.doAction(new MagicSacrificeAction(event.getPermanent()));
                game.doAction(new MagicDealDamageAction(event.getSource(),event.getPlayer(),7));
            }
        }
    },
    new MagicPermanentActivation(
        new MagicActivationHints(MagicTiming.Removal),
        "Damage"
    ) {

        @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.NEG_TARGET_CREATURE,
                new MagicDamageTargetPicker(source.getPower()),
                this,
                "SN deals damage equal to its power to target creature. " +
                "That creature deals damage equal to its power to SN."
            );
        }

        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            event.processTargetPermanent(game, {
                game.doAction(new MagicDealDamageAction(
                    new MagicDamage(
                        event.getPermanent(),
                        it,
                        event.getPermanent().getPower()
                    )
                ));
                game.doAction(new MagicDealDamageAction(
                    new MagicDamage(
                        it,
                        event.getPermanent(),
                        it.getPower()
                    )
                ));
            });
        }
    }
]
edit: another random thing: game.doAction(new MagicGainAbilityAction(event.getPermanent(),MagicAbility.ProtectionFromArtifacts)) doesn't work. How should I write it?
PalladiaMors
 
Posts: 343
Joined: 12 Jul 2014, 17:40
Has thanked: 36 times
Been thanked: 22 times

Re: Card Contributions

Postby melvin » 01 Nov 2014, 08:04

Nested if is alright, the issue is the event has yet to be resolved. The game stores events in a queue and process them one by one. So addEvent puts the sacrifice event on the event queue, it will be processed after the current event finish executing.

This means we need to check the permanent sacrificed in the sacrifice event itself, which the regular MagicSacrificePermanentEvent doesn't do. So we need to create our own one, which would look something like this

Code: Select all
final MagicEvent sac = new MagicEvent(
  event.getPermanent(),
  event.getPlayer(),
  MagicTargetChoice.SACRIFICE_FOREST,
  MagicSacrificeTargetPicker.create(),
  {
    final MagicGame G, final MagicEvent E ->
    E.processTargetPermanent(G, {
        game.doAction(new MagicSacrificeAction(it));
        if (it.hasType(MagicType.Snow)) {
          game.doAction(new MagicGainAbilityAction(E.getPermanent(),MagicAbility.Trample));
        }
    }
  }
);
game.doAction(new MagicGainAbilityAction(event.getPermanent(),MagicAbility.ProtectionFromArtifacts)) doesn't work. How should I write it?
There isn't a defined ProtectionFromArtifacts, you can use the following at the top level outside of the "[" "]"
Code: Select all
def ProtectionFromArtifacts = MagicAbility.getAbilityList("protection from artifacts);
later use
Code: Select all
game.doAction(new MagicGainAbilityAction(event.getPermanent(),ProtectionFromArtifacts))
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 » 01 Nov 2014, 14:08

Even with all the nursing, I didn't manage to get the card to work - got lost in the syntax. This isn't the first time I've hit a barrier with these "event inside an event" cards, I tried to do the ability "target creature gains protection from the color of your choice", which requires an extra event because it seems you can't both choose a target and a color in the same event. I used Oona, Queen of the Fae for reference, but in the end failed as well. I think this type of card really increases the complexity and starts hitting my limitations, I think I'm gonna leave these tougher ones for Shawnie and stick to the simpler stuff.

By the way, I'm seriously considering submitting the remaining "can't untap more than one" cards in Stoic Angel style, unless somebody objects. This has a small issue because multiple instances of the card in play shouldn't allow the player to untap multiple permanents, but most of those are artifacts/enchantments and there's little reason to have more than one in play at the same time anyway. I think doing those cards in this manner would cover most of their usage and they could be improved later?
PalladiaMors
 
Posts: 343
Joined: 12 Jul 2014, 17:40
Has thanked: 36 times
Been thanked: 22 times

Re: Card Contributions

Postby ShawnieBoy » 01 Nov 2014, 17:03

PalladiaMors wrote:Even with all the nursing, I didn't manage to get the card to work - got lost in the syntax. This isn't the first time I've hit a barrier with these "event inside an event" cards, I tried to do the ability "target creature gains protection from the color of your choice", which requires an extra event because it seems you can't both choose a target and a color in the same event. I used Oona, Queen of the Fae for reference, but in the end failed as well. I think this type of card really increases the complexity and starts hitting my limitations, I think I'm gonna leave these tougher ones for Shawnie and stick to the simpler stuff.

By the way, I'm seriously considering submitting the remaining "can't untap more than one" cards in Stoic Angel style, unless somebody objects. This has a small issue because multiple instances of the card in play shouldn't allow the player to untap multiple permanents, but most of those are artifacts/enchantments and there's little reason to have more than one in play at the same time anyway. I think doing those cards in this manner would cover most of their usage and they could be improved later?
I've not been so productive/active the past month, (grr, work) hopefully this month will be better...

As for Stoic Angel et al, personally I'd say no. But I know Melvin is normally in the other camp on this one :) For one, it would stop bug reports when something is actually working 'as intended', and opens a whole can of worms with the current implementation of Planeswalkers and combat (There's cards that trigger when a planeswalker is attacked, or rely on one being attacked), and multiple blockers in combat (Banding for all blockers - nearly).

As there's already parts away from the Magic 'standard' I'd personally try and keep everything else as close to real Magic as possible. Instead of having cards that 'almost' work, better to have those problems as ongoing issues, and have cards that actually work perfectly :)

But that's personal choice I guess.
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 » 01 Nov 2014, 18:18

This is an interesting topic. Let's look at what the other Magic apps have done in this regard: for instance, Forge lists nearly 100% of the cards as implemented, but a HUGE amount of those cards have small bugs. That's actually what got me off Forge at first when I started playing again, and made me look for a different app - well that and the fact I didn't like their interface.

In the other hand, Magarena has opted to ensure that nearly every card that gets implemented is working as close to perfection as possible. I see this as kind of a different design philosophy (pardon me if this is nonsense) - while Forge has opted to get the cards in and then sort out the bugs later, you guys have chosen to get everything in as close to perfection as possible from the start. I obviously can see why you'd do this, but I also know that there will be people who will download Magarena, try to put together their favourite deck, see that there's some card that they need that's missing and give up on it and look for a different app.

I dunno, I don't really have a stance on this and in the end it's up to you guys, who have put an enormous amount of time in this. But yeah, even more than cards, I'd like to see more players around in the forums!
PalladiaMors
 
Posts: 343
Joined: 12 Jul 2014, 17:40
Has thanked: 36 times
Been thanked: 22 times

Re: Card Contributions

Postby Lodici » 01 Nov 2014, 18:58

You might be interested in this recent discussion on the mailing list.

I think you have to be honest with people. I think incomplete cards should be flagged accordingly so that the player can make an informed choice as to whether to use that card. I would add a optional property to the script, say "limitations" which the scripter can use to describe the reason(s) why the card might not work as expected and which can be displayed in the card explorer/deck editor when selected.

PalladiaMors wrote:...But yeah, even more than cards, I'd like to see more players around in the forums!
Absolutely agree.
User avatar
Lodici
Programmer
 
Posts: 399
Joined: 13 Oct 2013, 09:44
Has thanked: 29 times
Been thanked: 71 times

Re: Card Contributions

Postby melvin » 02 Nov 2014, 00:38

My principle is if the difference can be expressed as a rules modification and it is in the spirit of the card, then yes. For the reveal case cited in the mailing list discussions, we modify rule 701.13 Reveal to say "reveal does nothing". Incidentally, reveal is now a supported mechanic, in the sense that it works correctly rules wise. But the AI doesn't know how to use it for its advantage, thus hand revealing cards are still out to keep the player and AI balanced.

The other reason in favor of reveal is because I had a hunch going forward we are going to figure out how to implement it eventually and it was the only mechanic missing for tutor effects. Tutoring was regularly requested and doable (at that point in the time) except for the lack of reveal.

I draw the line on having card specific differences because that is hard to explain and difficult to remember. This explains why we have an incomplete card scripts folder.
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 » 02 Nov 2014, 01:54

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 » 02 Nov 2014, 02:05

I'll study it later and try to see if I can figure out what I haven't yet. By the way, I can't open the link that Lodici posted, the page just keeps loading forever and never opens on my Internet Explorer 11.
PalladiaMors
 
Posts: 343
Joined: 12 Jul 2014, 17:40
Has thanked: 36 times
Been thanked: 22 times

Re: Card Contributions

Postby melvin » 14 Nov 2014, 00:38

@PalladiaMors: Feedback on Sage of Fables and Oona's Blackguard

Source: https://github.com/magarena/magarena/co ... nt-8563725
ShawnieBoy wrote:Not entirely sure about the coding of this one. It's an 'enters the battlefield with', not 'when enters the battlefield put'

Only from the work I had to do regarding Evolve - with this, it would be triggering evoke, not counting the additional counter. Also effects that trigger on the addition of a counter would end up triggering again.
You can make changes by using github. Log-in to github.com, on
https://github.com/magarena/magarena/bl ... les.groovy click on the Edit button (shown with a pen icon) next to "History"

same for
https://github.com/magarena/magarena/bl ... ard.groovy
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 » 14 Nov 2014, 02:46

Nice, I'll be using that from now on. Unfortunately I can't open Magarena right now to figure out if I can find a fix for this issue. I think I recall Stag Beetle as a card that enters the battlefield with counters, so maybe something similar can be done here, but this is a different situation, with another permanent entering the battlefield getting the counter. If it's not fixable, please remove the cards.

Edit: I think I've managed to submit a fix. Also added the reveal action to the groovy cards there were missing it.
PalladiaMors
 
Posts: 343
Joined: 12 Jul 2014, 17:40
Has thanked: 36 times
Been thanked: 22 times

Re: Card Contributions

Postby ShawnieBoy » 15 Nov 2014, 01:58

Oops, yes - thank @melvin, I sometimes forget that just commenting on a commit doesn't get seen by many people >.<

The replacement effects should fix the problem, it allows them to resolve before the game updates to see what's happened.
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 Feb 2015, 00:29

Hey guys, I've noticed that ShawnieBoy hasn't showed up in the forums for a while and that card coding has slowed down a bit in the last few months. What's going on? Is Shawnie OK?

I'm thinking about having another look at what cards might be leftover that I have a shot at being capable of coding, but back when I stopped it was getting harder to find those. If someone can give me some tips about what simple cards are still waiting to be done, I'd appreciate it, that would cut the time it takes to locate them!
PalladiaMors
 
Posts: 343
Joined: 12 Jul 2014, 17:40
Has thanked: 36 times
Been thanked: 22 times

Re: Card Contributions

Postby mike » 22 Feb 2015, 00:40

I guess you already know about https://www.firemind.ch/editions

If you have an idea for an improvement there that would make your search easier I'll be happy to add that.
User avatar
mike
Programmer
 
Posts: 128
Joined: 05 Jul 2013, 17:00
Has thanked: 0 time
Been thanked: 29 times

Re: Card Contributions

Postby PalladiaMors » 22 Feb 2015, 01:26

I didn't know about that link, actually. The practical problem I have with both that and the requests in the status page is that they don't take into account the cards that are unsupported by the current code. I'd love to go ahead and put together each top requested card, but most of those can't be done yet (the ones that were possible, I probably tried to do already). It would be very useful if people were still requesting cards through the forum, particularly if they could take into account that list of unsupported cards that I had put together in the 50% topic.

It would help me if I could filter the not implementable cards out, but I don't know if that's viable and I believe those are going to change in the future as the code is expanded, so such a filter would have limited use.
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: 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