Adding new cards with Groovy
by ubeefx
Moderators: ubeefx, beholder, melvin, ShawnieBoy, Lodici, CCGHQ Admins
Re: Adding new cards with Groovy
by PalladiaMors » 03 Nov 2014, 01:16
Thanks. Also, the previous webpage had the 'hourly build' feature, which allowed me to look at the corrections you were doing to the cards I submitted, which I was using to attempt to improve my scripts - I think I'm almost starting to normalize correctly now. The current webpage only seems to allow seeing the latest change to the build, so I'm going to miss a lot of that information. I'm gonna miss that, it was a useful feature.melvin wrote:Add "new MagicPlayAbilityEvent(source)" to getCostEvent for activate at most once per turn.
Edit: never mind, I found out how to see the entire list. It's at https://github.com/magarena/magarena/commits/master
- PalladiaMors
- Posts: 343
- Joined: 12 Jul 2014, 17:40
- Has thanked: 36 times
- Been thanked: 22 times
Re: Adding new cards with Groovy
by PalladiaMors » 05 Nov 2014, 14:37
Would anybody object against doing the Browbeat card group in Argothian Wurm style, that is, giving the choice to the opponent only? I think this is less of a problem than the "can't untap more than" group, because it has to be really rare for a player to use one of these cards's disadvantage against himself. Doing them in that manner for the time being should cover >99% of the times the card is cast. But yeah, it's not straight up according to the rules.
- PalladiaMors
- Posts: 343
- Joined: 12 Jul 2014, 17:40
- Has thanked: 36 times
- Been thanked: 22 times
Re: Adding new cards with Groovy
by jerichopumpkin » 05 Nov 2014, 15:35
To me, it seems legit and it would mean more cards. However, I think you can "chain" events to let both AI and the player decide (obviously only if the first one has decided not to take the disadvantage, you prompt the other with the same choice, but the second time you resolve the effect if the answer is negative). Is this feasible? And by the way, who has the precedence in these cases? The opponent or the active player?PalladiaMors wrote:Would anybody object against doing the Browbeat card group in Argothian Wurm style, that is, giving the choice to the opponent only? I think this is less of a problem than the "can't untap more than" group, because it has to be really rare for a player to use one of these cards's disadvantage against himself. Doing them in that manner for the time being should cover >99% of the times the card is cast. But yeah, it's not straight up according to the rules.
- jerichopumpkin
- Posts: 212
- Joined: 12 Sep 2013, 11:21
- Has thanked: 19 times
- Been thanked: 13 times
Re: Adding new cards with Groovy
by PalladiaMors » 05 Nov 2014, 16:15
^ I haven't found a card like that yet, so I thought it might not be possible, but I wouldn't know for sure.
Also, I've just submitted a wrong Borderland Behemoth, since it counts the number of Giants in play instead of the number you control. I often do this while working so these mistakes happen a lot, it would be nice to have a way to edit the script when you figure there's an error after submitting a card.
Thinking a bit further, there's a lot of cards similar to Behemoth in Magarena with the text "gets +/- for each other X in play" that were coded with getNrOfPermanents -1, but I'm actually not too sure if that's adequate since sometimes creatures can have their subtype changed. I think the ones that count MagicType.Creature -1 are fine because I don't think there's a way to have a creature stop being a creature, but losing subtypes is definitely possible and then this way of doing the card will be wrong.
Edit: Also, forget the Browbeat thing, it looks like giving the target choice to one player and the may choice to the other one actually isn't as simple as I thought. If I can't even do the card wrong, better leave it alone, lol.
Also, I've just submitted a wrong Borderland Behemoth, since it counts the number of Giants in play instead of the number you control. I often do this while working so these mistakes happen a lot, it would be nice to have a way to edit the script when you figure there's an error after submitting a card.
Thinking a bit further, there's a lot of cards similar to Behemoth in Magarena with the text "gets +/- for each other X in play" that were coded with getNrOfPermanents -1, but I'm actually not too sure if that's adequate since sometimes creatures can have their subtype changed. I think the ones that count MagicType.Creature -1 are fine because I don't think there's a way to have a creature stop being a creature, but losing subtypes is definitely possible and then this way of doing the card will be wrong.
Edit: Also, forget the Browbeat thing, it looks like giving the target choice to one player and the may choice to the other one actually isn't as simple as I thought. If I can't even do the card wrong, better leave it alone, lol.
- PalladiaMors
- Posts: 343
- Joined: 12 Jul 2014, 17:40
- Has thanked: 36 times
- Been thanked: 22 times
Re: Adding new cards with Groovy
by mike » 05 Nov 2014, 17:11
Editing the submission is not a good idea because it is usually already pushed or in the process of being pushed. However, there is nothing preventing you from submitting a second script for an already pushed card.I often do this while working so these mistakes happen a lot, it would be nice to have a way to edit the script when you figure there's an error after submitting a card.
Also: on github you can edit the script files directly via the browser and create a pull request from there.
Re: Adding new cards with Groovy
by PalladiaMors » 05 Nov 2014, 17:47
Hmm, I understand. Submitting a second instance of the card I think might actually add to the confusion, knowing myself I might end up resubmitting 3-4 times, that's going to drive Melvin crazy. This particular case just requires changing source.getGame to source.getController, so it's simple - as long as doing the "other" with the -1 resource is ok. I was thinking about this and I guess the proper way to do these cards is to use targetfilterfactory.other - I remember seeing some cards like that previously.
- PalladiaMors
- Posts: 343
- Joined: 12 Jul 2014, 17:40
- Has thanked: 36 times
- Been thanked: 22 times
Re: Adding new cards with Groovy
by ShawnieBoy » 08 Nov 2014, 12:06
PalladiaMors wrote:Thinking a bit further, there's a lot of cards similar to Behemoth in Magarena with the text "gets +/- for each other X in play" that were coded with getNrOfPermanents -1, but I'm actually not too sure if that's adequate since sometimes creatures can have their subtype changed. I think the ones that count MagicType.Creature -1 are fine because I don't think there's a way to have a creature stop being a creature, but losing subtypes is definitely possible and then this way of doing the card will be wrong.
You're correct, counting the amount and removing one isn't the correct way of determining 'other' permanents. It's always assuming the the source permanent has that type/subtype (and we all know how they can change - Song of the Dryads is my new favourite, and a good card to assume will be enchanting a card you're working on that effects/relies on types/subtypes).PalladiaMors wrote:I was thinking about this and I guess the proper way to do these cards is to use targetfilterfactory.other - I remember seeing some cards like that previously.
Using an 'other' filter is the best way.
-
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
by melvin » 08 Nov 2014, 12:19
@PalladiaMors: You mentioned submitting Borderland Behemoth, it doesn't seem to have been processed by firemind. You can see the list of cards submitted via firemind at https://github.com/firemind/magarena-cs ... its/master
@mike: Perhaps the worker thread for submission got stuck again?
@mike: Perhaps the worker thread for submission got stuck again?
-
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
by PalladiaMors » 08 Nov 2014, 12:50
I and Jericho submitted about 20 on Wednesday, but this time they didn't get pushed (see http://www.firemind.ch/status). I left a message for Mike in https://www.firemind.ch/card_script_submissions/2679 . Do you want me to post them here?
Edit: They got pushed, thanks Mike. A couple of them, Reaper of Sheoldred & Blood Clock, seem to have been sent with only the groovy part and the script file was missing (although it was submitted), but that's pretty quick to do anyway.
Edit: They got pushed, thanks Mike. A couple of them, Reaper of Sheoldred & Blood Clock, seem to have been sent with only the groovy part and the script file was missing (although it was submitted), but that's pretty quick to do anyway.
Last edited by PalladiaMors on 10 Nov 2014, 15:46, edited 2 times in total.
- PalladiaMors
- Posts: 343
- Joined: 12 Jul 2014, 17:40
- Has thanked: 36 times
- Been thanked: 22 times
Re: Adding new cards with Groovy
by mike » 08 Nov 2014, 13:35
Sorry about that. Hosting provider had a power outage and apparently the checks for the push scripts aren't sufficent. I'll have a look at it shortly.
Re: Adding new cards with Groovy
by PalladiaMors » 10 Nov 2014, 14:37
No longer relevant.
Last edited by PalladiaMors on 25 Apr 2015, 00:21, edited 1 time in total.
- PalladiaMors
- Posts: 343
- Joined: 12 Jul 2014, 17:40
- Has thanked: 36 times
- Been thanked: 22 times
Re: Adding new cards with Groovy
by melvin » 15 Mar 2015, 06:19
Magarena/scripts/Roar_of_the_Kha.txt
- Code: Select all
name=Roar of the Kha
image=http://magiccards.info/scans/en/mi/18.jpg
value=2.500
rarity=U
type=Instant
cost={1}{W}
ability=Entwine {1}{W}
effect=Choose one — • Creatures you control get +1/+1 until end of turn. • Untap all creatures you control.
timing=pump
oracle=Choose one — • Creatures you control get +1/+1 until end of turn. • Untap all creatures you control. Entwine {1}{W}
-
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
by melvin » 15 Mar 2015, 06:37
Magarena/scripts/Abuna_s_Chant.txt
- Code: Select all
name=Abuna's Chant
image=http://magiccards.info/scans/en/5dn/1.jpg
value=2.500
rarity=C
type=Instant
cost={3}{W}
ability=Entwine {2}
effect=Choose one — • You gain 5 life. • Prevent the next 5 damage that would be dealt to target creature this turn.
timing=pump
oracle=Choose one — • You gain 5 life. • Prevent the next 5 damage that would be dealt to target creature this turn. Entwine {2}
-
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
by hong yie » 01 Apr 2015, 10:48
i'm trying to write a scrypt to make creature A copies creature B without calling
MagicCopyPermanentPicker.create(). Because this ability doesn't need to choose which one to be copied.
Cannot find matching method magic.model.action.MagicEnterAsCopyAction#<init>(magic.model.MagicPermanent, magic.model.MagicSource).
any solution for this?
thank's.
MagicCopyPermanentPicker.create(). Because this ability doesn't need to choose which one to be copied.
- Code: Select all
new MagicEvent(otherPermanent,this,
"RN enters the battlefield as a copy of SN.");
game.doAction(new MagicEnterAsCopyAction(event.getRefPermanent(), event.getSource()));
Cannot find matching method magic.model.action.MagicEnterAsCopyAction#<init>(magic.model.MagicPermanent, magic.model.MagicSource).
any solution for this?
thank's.
-
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
by melvin » 01 Apr 2015, 12:16
The first argument of MagicEnterAsCopyAction must be a MagicCardOnStack. Currently, the copying is limited to spells that resolve as permanents as it is modifying the way the permanent enters the battlefield. An existing permanent cannot copy another one.hong yie wrote:Cannot find matching method magic.model.action.MagicEnterAsCopyAction#<init>(magic.model.MagicPermanent, magic.model.MagicSource).
-
melvin - AI Programmer
- Posts: 1062
- Joined: 21 Mar 2010, 12:26
- Location: Singapore
- Has thanked: 36 times
- Been thanked: 459 times
Who is online
Users browsing this forum: No registered users and 60 guests