Custom Game Type - Development

All user created custom sets, custom game mode and modded official content.
Psyringe
Posts: 1163
Joined: Mon Aug 31, 2009 10:53 am

Re: Custom Game Type - Development

Post by Psyringe »

Szei wrote:I was wondering if it is possible to create cards that only give bonuses to creatures that match entire creature types. Say that I want a certain card to give +1/+0 to all creatures with the "Sword" creature type, but another card only give a +1/+0 bonus to creatures with the entire "Elf Sword" creature type. Would this be possible or would the second card give the bonus to any creature with "Sword" in its creature type (for example, "Orc Sword").
Both are possible, I think. Search for cards using the auto=lord rule for examples. (I'd give you the exact syntax but I'd have to check it first myself, I have little to no experience with card code).
wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: Custom Game Type - Development

Post by wololo »

Psyringe wrote:
Szei wrote:I was wondering if it is possible to create cards that only give bonuses to creatures that match entire creature types. Say that I want a certain card to give +1/+0 to all creatures with the "Sword" creature type, but another card only give a +1/+0 bonus to creatures with the entire "Elf Sword" creature type. Would this be possible or would the second card give the bonus to any creature with "Sword" in its creature type (for example, "Orc Sword").
Both are possible, I think. Search for cards using the auto=lord rule for examples. (I'd give you the exact syntax but I'd have to check it first myself, I have little to no experience with card code).
Unfortunately no.
actually, even creature[elf] doesn't work the way people expect, as it will act on all creatures and all elves.

This is a huge limitation and I have no idea right now on how to change that. It is not a technical problem, but a syntax problem, plus the fact that there is no hierarchy difference in wagic between "creature" and "elf", or in "elf" and "sword".

Right now:
Creature[elf] is equivalent to creature,elf.
And both mean: creature OR elf

the same would go for elf[sword] and elf,sword

Of course I would want elf[sword] to mean elf AND sword, but it is not as easy as I'd want right now.
Psyringe
Posts: 1163
Joined: Mon Aug 31, 2009 10:53 am

Re: Custom Game Type - Development

Post by Psyringe »

Oh - I apologize for confusing the issue, then.

I thought that if Terror works (and is given as an example on the card code page in the form of "creature[-black;-artifact]"), then we must have a form of limiting targets to cards that are nonblack AND nonartifact AND creatures. So I assumed that "creature[elf;sword]" (or similar) would target cards that are elf AND sword AND creature. We also have cards like Stonebrow, Krosan Hero, which has a lord effect that only affects creatures that are attacking AND have trample. Where did I go wrong?
wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: Custom Game Type - Development

Post by wololo »

Psyringe wrote:Oh - I apologize for confusing the issue, then.

I thought that if Terror works (and is given as an example on the card code page in the form of "creature[-black;-artifact]"), then we must have a form of limiting targets to cards that are nonblack AND nonartifact AND creatures. So I assumed that "creature[elf;sword]" (or similar) would target cards that are elf AND sword AND creature. We also have cards like Stonebrow, Krosan Hero, which has a lord effect that only affects creatures that are attacking AND have trample. Where did I go wrong?
This is where it goes tricky:
1) There are different logics if the symbols are types or other things. I still believe we can't code Stonebrow, Krosan Hero and I think I mentioned it already
2) the minus (-) symbol basically reverts the logic.

So, on top of my mind, here is how it works:
A[B;C] means A OR B OR C if A,B,C are types. It is equivalent to A,B,C
A[B;C] means A AND (B OR C) if A is a type, and B and C are other things (ability such as trample, attribute such as attacking, tapped,...)
A[-B;-C] means A AND NOT B AND NOT C
A[B;-C] means A and B AND not C

There are cases for which the behavior is mostly unknown, and that I never use myself.
Everything was really simple at first because I initially thought that "positive" values always involved "OR" and negative values always involved "AND". Which was really wrong...
Psyringe
Posts: 1163
Joined: Mon Aug 31, 2009 10:53 am

Re: Custom Game Type - Development

Post by Psyringe »

Ah, I see. The matter is obviously more complex than I thought. Sorry to Szei for providing false information. :(

Regarding Stonebrow: Check my last comment on issue159 on that. In my test stonebrow2.txt the card did/does appear to work correctly, but it's of course possible that I missed something. It also may be one of the "mostly unknown" cases you mentioned.

To get back to topic: @Szei - I think what this example shows (apart from me not checking my line of thinking thoroughly enough) is that it's sometimes really complicated to determine whether something works or doesn't work. I recommend to familiarize yourself with the testing suite, which is a very versatile tool for checking whether cards/commands work as desired. If you have questions about the test suite, just ask. :)
Szei
Posts: 218
Joined: Sat Nov 15, 2008 8:14 pm
Location: USA

Re: Custom Game Type - Development

Post by Szei »

Okay. Thanks for your clarifications. I downloaded the testing suite and am currently working out how to use it.

One thing though, how does a card like "Bad Moon" work then?

Code: Select all

[card]
text=Black creatures get +1/+1.
auto=lord(creature[black]) 1/1
id=1144
name=Bad Moon
rarity=R
mana={1}{B}
type=Enchantment
[/card]
Only black creatures get the bonus, not all creatures. I know that I'm probably missing something really obvious, but I did re-read your posts and I still don't know where I'm going wrong.

Also, I suppose I can still get my cards to work if I just do something like
creature[-bow;-lance;-axe;-orc;-human] <-- if I only want elves with swords to get the bonus?
Image
wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: Custom Game Type - Development

Post by wololo »

I told you it was complex :mrgreen:
black is not a type.
Therefore, creature[black] means creature AND black

if you put "elf" instead of black, the card wouldn't work the way you expect...
creature[elf] means creature OR elf
(this is a bug, but that's how it works right now...)
Szei
Posts: 218
Joined: Sat Nov 15, 2008 8:14 pm
Location: USA

Re: Custom Game Type - Development

Post by Szei »

Szei wrote:Also, I suppose I can still get my cards to work if I just do something like
creature[-bow;-lance;-axe;-orc;-human] <-- if I only want elves with swords to get the bonus?
My workaround appears to have been successful =D

Code: Select all

[card]
id=733000
name=Fighter
mana={W}{W}
type=Creature
subtype=Elf Sword Medium
power=1
toughness=1
text=Shroud
abilities=Shroud
rarity=C
[/card]
[card]
id=733001
name=Grunt
mana={W}
type=Creature
subtype=Orc Sword Heavy
power=1
toughness=1
text=Haste
abilities=Haste
rarity=C
[/card]
[card]
id=733002
name=Elf Sword
mana={R}
type=Enchantment
text=+1/+0
auto=lord(sword[-orc;-human]) 1/0
rarity=C
[/card]
[card]
id=733003
name=Neutral Sword
mana={R}
type=Enchantment
text=+1/+0
auto=lord(sword) 1/0
rarity=C
[/card]
[card]
id=733004
name=Orc Axe
mana={R}
type=Enchantment
text=+1/+0
auto=lord(axe[-elf;-human) 1/0
rarity=C
[/card]
NOTE: These are not real cards, but just made for testing purposes.

What should happen is that the Fighter (elf with sword and light armor) only receives bonuses from the 'Elf Sword' and the 'Neutral Sword'. The Grunt (orc with sword and heavy armor) should only receive bonuses from the 'Neutral Sword' since it is not an Elf. The Grunt also should not receive bonuses from the Orc Axe because, though an Orc, it does not wield an axe.

Therefore, the Fighter (elf) should end up a 3/1 (two +1/+0 bonuses, one each from the Elf Sword and the Neutral Sword) and the Grunt (orc) should end up a 2/1 (one +1/+0 bonus from the Neutral Sword).

Sure enough this is the case after running the following test. I also conducted 4 more tests with altered weapon specifications, unit specifications, or both and I received the desired results each time =)

Code: Select all

[INIT]
FIRSTMAIN
[PLAYER1]
hand:733002,733003,733004
inplay:733000,733001
manapool:{R}{R}{R}
[PLAYER2]
[DO]
733002
733003
733004
[ASSERT]
FIRSTMAIN
[PLAYER1]
inplay:733000,733001,733002,733004,733003
manapool:{0}
[END]
Thanks Psyringe and wololo! I couldn't have come up with this without both of your help.


EDIT: As for the Stonebrow issue, I wasn't able to test it personally because I don't have the latest revision, but based on wololo's description
wololo wrote:A[B;C] means A AND (B OR C) if A is a type, and B and C are other things (ability such as trample, attribute such as attacking, tapped,...)
and referring to Stonebrow's _card.dat entry

Code: Select all

auto=lord(creature[attacking,trample]|myBattlefield) 2/2
there appears to be a contradiction.
According to wololo, Stonebrow should give +2/+2 to anything that is a creature AND (is attacking OR has trample). But in your (Psyringe) results, you say that the attacking Grizzly Bears didn't get +2/+2. Also, the War Mammoth should have had +2/+2 before it attacked according to the coding, but I'm guessing that it didn't or you would have noticed that something was wrong. Am I missing something?
Image
wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: Custom Game Type - Development

Post by wololo »

Szei, how is the development of your mod going? As you know, we introduced in the SVN an easier way to deal with token.
I can probably send you an updated eboot if you need to test it.
I am also working on a way to create custom rules in a text file (to be able to choose players starting life, etc...). It will be very limited at first, but it should be alright.

Depending on the difficulty, I think we could also create a dedicated AI for your mods if it is fun enough to play...
Szei
Posts: 218
Joined: Sat Nov 15, 2008 8:14 pm
Location: USA

Re: Custom Game Type - Development

Post by Szei »

It's been going well. I've finished my preliminary set/cards design and have been making the _card.dat file. And yes, if it's not too much trouble, I would appreciate if I could test to see if the way I am coding the tokens in _card.dat is working properly. =) Glad to hear you're working on a custom rules file. I'm sure that we'll see many great mods in the future using this feature.

EDIT: I have a question about tokens. I noticed in your example on the previous page that the wasp was coded type=Artifact Creature. Can I still have a token that has a type and subtype? For example, type=Creature subtype=Orc
Image
Locked