It is currently 16 Nov 2025, 17:47
   
Text Size

Card Contributions

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

Re: Card Contributions

Postby melvin » 16 Sep 2014, 00:57

PalladiaMors wrote: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?
There is not enough information to diagnose the issue, please do post the crash log/message. There can be a large number of reasons why the program would crash, the crash log is specifically designed to contain information showing the exact reason.
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 » 16 Sep 2014, 01:46

Crash log

CRASH REPORT FOR MAGARENA THREAD Thread[AWT-EventQueue-0,6,main]
CREATED ON 2014/09/15 22:43:43
MAGARENA VERSION 1.54, JRE 1.7.0_67, OS Windows 7_6.1 x86
================================
Used Memory: 75M
Free Memory: 172M
Total Memory: 247M
Max Memory: 494M
================================
-Xms256m
-Xmx512m
-Xverify:none


Turn : 1 Phase : Mulligan Step : Begin Player : PalladiaMors Score : 0
0] Player : PalladiaMors Life : 20 Delayed : Total=0
1] Player : Mini Max Life : 20 Delayed : Total=0
Stack : 0
Score = 0

Exception from controller.runGame: java.util.concurrent.ExecutionException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
C:\Magarena\Magarena\scripts\Override.groovy: 3: class Override is not an annotation in @Override
@ line 3, column 9.
@Override
^

C:\Magarena\Magarena\scripts\Override.groovy: 12: class Override is not an annotation in @Override
@ line 12, column 9.
@Override
^

2 errors

java.lang.RuntimeException: java.util.concurrent.ExecutionException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
C:\Magarena\Magarena\scripts\Override.groovy: 3: class Override is not an annotation in @Override
@ line 3, column 9.
@Override
^

C:\Magarena\Magarena\scripts\Override.groovy: 12: class Override is not an annotation in @Override
@ line 12, column 9.
@Override
^

2 errors

at magic.ui.screen.DuelGameScreen$1.done(DuelGameScreen.java:47)
at javax.swing.SwingWorker$5.run(Unknown Source)
at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(Unknown Source)
at sun.swing.AccumulativeRunnable.run(Unknown Source)
at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(Unknown Source)
at javax.swing.Timer.fireActionPerformed(Unknown Source)
at javax.swing.Timer$DoPostEvent.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.util.concurrent.ExecutionException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
C:\Magarena\Magarena\scripts\Override.groovy: 3: class Override is not an annotation in @Override
@ line 3, column 9.
@Override
^

C:\Magarena\Magarena\scripts\Override.groovy: 12: class Override is not an annotation in @Override
@ line 12, column 9.
@Override
^

2 errors

at java.util.concurrent.FutureTask.report(Unknown Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
at javax.swing.SwingWorker.get(Unknown Source)
at magic.ui.screen.DuelGameScreen$1.done(DuelGameScreen.java:41)
... 20 more
Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
C:\Magarena\Magarena\scripts\Override.groovy: 3: class Override is not an annotation in @Override
@ line 3, column 9.
@Override
^

C:\Magarena\Magarena\scripts\Override.groovy: 12: class Override is not an annotation in @Override
@ line 12, column 9.
@Override
^

2 errors

at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:309)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1067)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:583)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:561)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:538)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:286)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:259)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:674)
at groovy.lang.GroovyShell.parse(GroovyShell.java:686)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:568)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:617)
at magic.data.CardDefinitions.addCardSpecificGroovyCode(CardDefinitions.java:140)
at magic.data.CardProperty$30.setProperty(CardProperty.java:185)
at magic.model.MagicCardDefinition.loadAbilities(MagicCardDefinition.java:179)
at magic.model.MagicCard.<init>(MagicCard.java:98)
at magic.model.MagicCard.<init>(MagicCard.java:86)
at magic.model.MagicPlayer.createHandAndLibrary(MagicPlayer.java:389)
at magic.model.MagicDuel.nextGame(MagicDuel.java:181)
at magic.ui.screen.DuelGameScreen$1.doInBackground(DuelGameScreen.java:36)
at magic.ui.screen.DuelGameScreen$1.doInBackground(DuelGameScreen.java:31)
at javax.swing.SwingWorker$1.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at javax.swing.SwingWorker.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Card

Code: Select all
name=Override
image=http://mtgimage.com/card/override.jpg
value=2.500
rarity=C
type=Instant
cost={2}{U}
timing=counter
requires_groovy_code
oracle=Counter target spell unless its controller pays {1} for each artifact you control.
Code: Select all
[
    new MagicSpellCardEvent() {
        @Override
        public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
            return new MagicEvent(
                cardOnStack,
                MagicTargetChoice.NEG_TARGET_SPELL,
                this,
                "Counter target spell\$ unless its controller pays {1} for each artifact PN controls."
            );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            event.processTargetCardOnStack(game, {
                final int amount = event.getPlayer().getNrOfPermanents(MagicType.Artifact);
                game.addEvent(new MagicCounterUnlessEvent(event.getSource(),it,MagicManaCost.create("{"+amount+"}")));
            });
        }
    }
]
PalladiaMors
 
Posts: 343
Joined: 12 Jul 2014, 17:40
Has thanked: 36 times
Been thanked: 22 times

Re: Card Contributions

Postby melvin » 16 Sep 2014, 03:39

Thanks! Just replace the @Override lines in Override.groovy with @java.lang.Override and it will be fine. Each annotation is a class, and the scripting engine was wrongly treating the current groovy file as an annotation class as it is named Override.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 » 24 Sep 2014, 00:00

I've just submitted Azorius Ploy and then noticed that I misinterpreted the card, thinking it was single-targeted. In fact it's potentially multi-targeted and therefore shouldn't be implementable at this point. Please delete the script and sorry for the mistake.
PalladiaMors
 
Posts: 343
Joined: 12 Jul 2014, 17:40
Has thanked: 36 times
Been thanked: 22 times

Re: Card Contributions

Postby melvin » 24 Sep 2014, 00:51

Good catch. Great job on the submissions, the quality is getting better and better. Btw, could share a bit on how you find new cards to 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 PalladiaMors » 24 Sep 2014, 01:53

The first thing that really helped was that post in the 50% topic where I made an effort to understand what couldn't be done with the current code. If it wasn't for that, I'd probably keep trying to do cards that would be impossible for me and failing, which would probably have been frustrating and made me give up. Knowing what I shouldn't even try makes me waste a lot less time with mistakes. When I'm in doubt about whether something is possible or not, I come here and ask about it - you and Shawnie have been very helpful with that.

Sometimes when I find something that works I use the search button to look for cards with similar text and add everything I know how. Sometimes I look specifically for good cards that aren't available yet and I believe that can be done. I've also been making an effort to work more on the sets that have a lower percentage of cards implemented - I was happy this weekend when I managed to do about half a dozen cards from Future Sight and brought the set above the 40% mark.
PalladiaMors
 
Posts: 343
Joined: 12 Jul 2014, 17:40
Has thanked: 36 times
Been thanked: 22 times

Re: Card Contributions

Postby PalladiaMors » 24 Sep 2014, 16:20

I tried to submit Novijen Sages but there was some problem in Firemind and it didn't get pushed. I ended up accidentally submitting three instances of the card and hopefully not making too much of a mess for Mike to cleanup. Anyway, since it got bugged, I thought that maybe I'd post the code here. This one is just a simple matter of separating the removal of multiple counters in the cost.

Code: Select all
name=Novijen Sages
image=http://mtgimage.com/card/novijen%20sages.jpg
value=2.500
rarity=R
type=Creature
subtype=Human,Advisor,Mutant
cost={4}{U}{U}
pt=0/0
ability=Graft 4;\
        {1}, Remove a +1/+1 counter from a creature you control, remove a +1/+1 counter from a creature you control: Draw a card.
timing=main
oracle=Graft 4. {1}, Remove two +1/+1 counters from among creatures you control: Draw a card.
Edit: Pretty sure Firemind is no longer accepting scripts without groovy code. Here's another one, using a groovy I just submitted for another card:

Code: Select all
name=Phantom Whelp
image=http://mtgimage.com/card/phantom%20whelp.jpg
value=2.500
rarity=C
type=Creature
subtype=Illusion,Hound
cost={1}{U}
pt=2/2
timing=main
requires_groovy_code=Windscouter
oracle=When Phantom Whelp attacks or blocks, return it to its owner's hand at end of combat.
Code: Select all
name=Mire Blight
image=http://mtgimage.com/card/mire%20blight.jpg
value=2.500
rarity=C
type=Enchantment
subtype=Aura
cost={B}
timing=aura
enchant=can't block,neg creature
requires_groovy_code=Mortal Wound
oracle=Enchant creature. When enchanted creature is dealt damage, destroy it.
Code: Select all
name=Frozen Solid
image=http://mtgimage.com/card/frozen%20solid.jpg
value=2.500
rarity=C
type=Enchantment
subtype=Aura
cost={1}{U}{U}
ability=Enchanted creature doesn't untap during its controller's untap step.
timing=aura
enchant=can't attack or block,neg creature
requires_groovy_code=Mortal Wound
oracle=Enchant creature. Enchanted creature doesn't untap during its controller's untap step. When enchanted creature is dealt damage, destroy it.
PalladiaMors
 
Posts: 343
Joined: 12 Jul 2014, 17:40
Has thanked: 36 times
Been thanked: 22 times

Re: Card Contributions

Postby melvin » 25 Sep 2014, 05:07

PalladiaMors wrote:This one is just a simple matter of separating the removal of multiple counters in the cost.
Actually it is more complex, because checking of costs is done individually. If there is a single creature with one +1/+1 counter on it, each part of "remove a +1/+1" counter is satisfied individually, but since there is only one +1/+1 counter, the second remove can't be paid.

The rest are great, added in https://code.google.com/p/magarena/sour ... 9840fcd1e6
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 » 25 Sep 2014, 19:04

Insectile Aberration for Delver of Secrets. Firemind is running a test on the card which I've no idea if it's going to pass since it's not a stand-alone card.
Code: Select all
name=Insectile Aberration
image=http://mtgimage.com/card/insectile%20aberration.jpg
value=2.500
rarity=C
type=Creature
subtype=Human,Insect
color=u
pt=3/2
ability=Flying
transform=Delver of Secrets
timing=main
hidden
oracle=Flying
PalladiaMors
 
Posts: 343
Joined: 12 Jul 2014, 17:40
Has thanked: 36 times
Been thanked: 22 times

Re: Card Contributions

Postby ShawnieBoy » 25 Sep 2014, 19:17

PalladiaMors wrote:Insectile Aberration for Delver of Secrets. Firemind is running a test on the card which I've no idea if it's going to pass since it's not a stand-alone card.
Code: Select all
name=Insectile Aberration
image=http://mtgimage.com/card/insectile%20aberration.jpg
value=2.500
rarity=C
type=Creature
subtype=Human,Insect
color=u
pt=3/2
ability=Flying
transform=Delver of Secrets
timing=main
hidden
oracle=Flying
It's been submitted ok through Firemind, however Delver of Secrets has an optional reveal to trigger the transform. You always get to look and have an option to reveal it, regardless of its type. If it's revealed and is an instant or sorcery then transform.
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 Sep 2014, 19:49

I thought about that, but since revealing currently doesn't work anyway and there's already a ton of cards that use that mechanic and were implemented such as Garruk, Caller of Beasts, I thought it might be OK to add it? I think the main reason for revealing in these cards is to ensure that the player isn't cheating - it's done in order to verify the card is what he claims it is. That's unnecessary in Magarena since the check will be performed automatically. There's the minor matter of losing the information about what the card is, but since the AI can't currently store that information...

Edit: I see what you're saying, though: I should've done it as a MagicMayChoice, because the player could have a reason to not want the card to transform, for example. My bad. Hopefully that's not too much work to fix?

edit2: Fixed version of Delver

Code: Select all
[
    new MagicAtYourUpkeepTrigger() {
        @Override
        public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer upkeepPlayer) {
            return new MagicEvent(
                permanent,
                new MagicMayChoice("Reveal the top card of your library?"),
                this,
                "Look at the top card of PN's library. You may\$ reveal that card. If an instant or sorcery card is revealed this way, transform SN."
            );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            for (final MagicCard card : event.getPlayer().getLibrary().getCardsFromTop(1)) {
                game.doAction(new MagicRemoveCardAction(
                    card,
                    MagicLocationType.OwnersLibrary
                ));
                game.doAction(new MagicMoveCardAction(
                    card,
                    MagicLocationType.OwnersLibrary,
                      MagicLocationType.TopOfOwnersLibrary
                ));
            if (event.isYes() && card.hasType(MagicType.Instant) || card.hasType(MagicType.Sorcery)) {
            game.doAction(new MagicTransformAction(event.getPermanent()));
            }
            }
        }
    }
]
I know this is a bit borderline, with revealing being a core mechanic in the card, but it *is* one of the most requested cards in Firemind...
PalladiaMors
 
Posts: 343
Joined: 12 Jul 2014, 17:40
Has thanked: 36 times
Been thanked: 22 times

Re: Card Contributions

Postby PalladiaMors » 27 Oct 2014, 17:09

I've submitted Goblin Caves and Goblin Shrine but now I've noticed that the Oracle text checks if the enchanted land is a basic mountain, rather than checking if it has the mountain subtype. I don't know if that's fixable, I think it could check the card's name instead of subtype but I don't know if that would work with cards that get transformed into mountains. If it's not easily fixable, please ignore the submissions.
PalladiaMors
 
Posts: 343
Joined: 12 Jul 2014, 17:40
Has thanked: 36 times
Been thanked: 22 times

Re: Card Contributions

Postby ShawnieBoy » 27 Oct 2014, 18:21

PalladiaMors wrote:I've submitted Goblin Caves and Goblin Shrine but now I've noticed that the Oracle text checks if the enchanted land is a basic mountain, rather than checking if it has the mountain subtype. I don't know if that's fixable, I think it could check the card's name instead of subtype but I don't know if that would work with cards that get transformed into mountains. If it's not easily fixable, please ignore the submissions.
Should be fine, basic is a card type.
Code: Select all
hasType(MagicType.Basic) && hasSubType(MagicSubType.Mountain)
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 » 27 Oct 2014, 19:33

Ah, cool, I actually didn't know that - maybe it opens the path to some other cards, I'll check later. Also, I'm a bit unsure about the way I did Leviathan. Now that I'm thinking a bit more I believe its attack ability should be possible to activate at any time during a turn, it shouldn't just trigger at the beginning of combat (and it should be possible to activate it multiple times, also). Yeah, taking a second look that one is just plain wrong... Probably needs to get trashed. I did think my way was clunky but somehow I got optimistic while doing it and thought it was pretty much equivalent, lol.

It would be useful to have a way to edit scripts after submitting them, I've lost count of the amount of times I've noticed some kind of mistake after submitting a card. Melvin later sorts them out - and the ones I don't notice as well - but that's more unnecessary work for him.

Edit: Hmm, actually, I hadn't seen the very last part of Leviathan's oracle. I think that might mean the script's OK. Only issue is that I think it should trigger during the declare attackers step instead of beginning of combat.
PalladiaMors
 
Posts: 343
Joined: 12 Jul 2014, 17:40
Has thanked: 36 times
Been thanked: 22 times

Re: Card Contributions

Postby ShawnieBoy » 27 Oct 2014, 21:51

PalladiaMors wrote:Ah, cool, I actually didn't know that - maybe it opens the path to some other cards, I'll check later. Also, I'm a bit unsure about the way I did Leviathan. Now that I'm thinking a bit more I believe its attack ability should be possible to activate at any time during a turn, it shouldn't just trigger at the beginning of combat (and it should be possible to activate it multiple times, also). Yeah, taking a second look that one is just plain wrong... Probably needs to get trashed. I did think my way was clunky but somehow I got optimistic while doing it and thought it was pretty much equivalent, lol.

It would be useful to have a way to edit scripts after submitting them, I've lost count of the amount of times I've noticed some kind of mistake after submitting a card. Melvin later sorts them out - and the ones I don't notice as well - but that's more unnecessary work for him.

Edit: Hmm, actually, I hadn't seen the very last part of Leviathan's oracle. I think that might mean the script's OK. Only issue is that I think it should trigger during the declare attackers step instead of beginning of combat.
Magarena can't currently do "can't attack unless <payment>", "can't attack unless <condition>" is fine.

The reason being is that attackers are declared, and then are checked to see if there are any restrictions on them (must attack, can only attack if x other attack, can only attack if {2} is paid etc) if the restriction stands (eg. payment can't be paid), the attack is then illegal, and for illegal actions they rewind back to before the illegal action is made.

In Magarena, illegal actions can't be made at all. And there is no gap between declaring an attacker and putting in any possible triggers, compounded with the fact that you can not only undo the declare attackers step, but individually un-declare and re-declare ('toggling' a declared attacker) if you change your mind before you pass priority.
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 13 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 13 users online :: 0 registered, 0 hidden and 13 guests (based on users active over the past 10 minutes)
Most users ever online was 9824 on 10 Nov 2025, 04:33

Users browsing this forum: No registered users and 13 guests

Login Form