Mod Customization

Suggestion about new game mode (campaign, EDH, etc...)
Locked
Szei
Posts: 218
Joined: Sat Nov 15, 2008 8:14 pm
Location: USA

Mod Customization

Post by Szei »

I was wondering how easy it would be to implement a feature that allows the mod.txt file to include starting cards for players. What I mean is the ability to set players with certain cards on the field or in hand at the beginning of the game as in test mode. This feature would most certainly be useful for mods and based on the present test mode capabilities, it seems as though this feature wouldn't be too much of a stretch to add?

My other two requests aren't as critical to the mods I've been considering (not the current mod I'm working on, but new ones I'm going to make after I've finished the first) but would definitely be useful.

1. No deckout lose condition.
2. Basic restrictions on card play* <-- For example, "can't play certain card if another card of the same name is in play", "can't play certain card if no ____ cards in play", "can't play certain card if 2 of that card is already in play", etc. The most important card restriction for the mods I've been thinking about is the first example I gave.

*These restrictions might already be possible with Wagic in its current form, but I'm not sure. I'm guessing there might be some way to have a card check if a type of card is on the field as it comes into play and if not, the card can be triggered to sacrifice itself. Is this possible?
Image
wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: Mod Customization

Post by wololo »

Szei wrote:I was wondering how easy it would be to implement a feature that allows the mod.txt file to include starting cards for players. What I mean is the ability to set players with certain cards on the field or in hand at the beginning of the game as in test mode. This feature would most certainly be useful for mods and based on the present test mode capabilities, it seems as though this feature wouldn't be too much of a stretch to add?
I think that is already somehow possible although I never tested it.

something like:

Code: Select all

[INIT]
mode=mtg
[PLAYERS]
life:20
hand:Forest,Plains,Mountain
auto=shuffle
auto=@each my draw:draw:1
would have both players start with a Forest, a Plains and a Mountain in their hand. However I'm not entirely sure of the impact this would have on the deck construction.
Other solutions can be considered depending on what exactly you want to achieve.
This new system of rules was created mostly after I read about your project to create a mod, and as I said, I am willing to help as much as I can here
1. No deckout lose condition.
2. Basic restrictions on card play* <-- For example, "can't play certain card if another card of the same name is in play", "can't play certain card if no ____ cards in play", "can't play certain card if 2 of that card is already in play", etc. The most important card restriction for the mods I've been thinking about is the first example I gave.

*These restrictions might already be possible with Wagic in its current form, but I'm not sure. I'm guessing there might be some way to have a card check if a type of card is on the field as it comes into play and if not, the card can be triggered to sacrifice itself. Is this possible?
1) I can probably add the first one somehow (it is not already implemented but the test suite does it so it's just a matter of generalizing the functionality)

2) You can code cards that somehow simulate this behavior (As long as I am in play, if such card is on the stack, then move it back to the player's hand <-- never tested that actually), but it probably won't be satisfying for your needs:
text=as long as Szei is in play, you can't cast elf spells
name=Szei
auto=@movedTo(elf|myStack):moveTo(myHand) all(elf|myStack)

That's a bit weird (it doesn't prevent you from casting the spell, but it returns the card to your hand as soon as it goes to the stack) AND I'm not sure it would work (it is possible that the spell manages to resolve anyways because of a bug... which might be solved by adding && fizzle all(elf|myStack)) but other workarounds can be imagined...

It's not necessary to code that in all cards either, it can be a general rule in mtg.txt:
auto=aslongas(goblin) @movedTo(elf|myStack):moveTo(myHand) all(elf|myStack) >2
<-- as long as more than 2 goblins are in play, elf spells can't be cast

Again, I have tried none of those and it could be that they don't work because of some bugs/limitations in the parser...
Szei
Posts: 218
Joined: Sat Nov 15, 2008 8:14 pm
Location: USA

Re: Mod Customization

Post by Szei »

wololo wrote:
Szei wrote:I was wondering how easy it would be to implement a feature that allows the mod.txt file to include starting cards for players. What I mean is the ability to set players with certain cards on the field or in hand at the beginning of the game as in test mode. This feature would most certainly be useful for mods and based on the present test mode capabilities, it seems as though this feature wouldn't be too much of a stretch to add?
I think that is already somehow possible although I never tested it.

something like:

Code: Select all

[INIT]
mode=mtg
[PLAYERS]
life:20
hand:Forest,Plains,Mountain
auto=shuffle
auto=@each my draw:draw:1
would have both players start with a Forest, a Plains and a Mountain in their hand.
I certainly can see a use for this; however, it's not quite what I had in mind. One of the mods I am planning is less of a one vs. one game with two players on equal footing, but more of a 'survival' game. I wanted to make the cpu start with an enchantment that generates 'monster' tokens each turn which the player then has to fend off (the AI can upgrade this enchantment as the game progresses to produce stronger creatures). The player in turn would start off with a 'worker' card which can build walls, towers, resource generators (lumber mills), an upgrade center, mercenary building, repair units (to repair* towers, walls, buildings) aura statues, etc.

*not quite sure how 'repairing' works, but something like 'target creature you control gains +0/+## until end of turn or, if this is implemented in Wagic, prevent ## damage that would be dealt to target creature this turn.
wololo wrote:
Szei wrote: 1. No deckout lose condition.
2. Basic restrictions on card play* <-- For example, "can't play certain card if another card of the same name is in play", "can't play certain card if no ____ cards in play", "can't play certain card if 2 of that card is already in play", etc. The most important card restriction for the mods I've been thinking about is the first example I gave.

*These restrictions might already be possible with Wagic in its current form, but I'm not sure. I'm guessing there might be some way to have a card check if a type of card is on the field as it comes into play and if not, the card can be triggered to sacrifice itself. Is this possible?
1) I can probably add the first one somehow (it is not already implemented but the test suite does it so it's just a matter of generalizing the functionality)
This would be great. There isn't a rush because having deckout loss isn't game breaking per se. However, this would be very useful for nearly all customs when/if you do implement it (I would surely use this in my current mod, and my planned mods would benefit from such a feature too). The only custom game-type in which deckout loss makes sense would be a mod based around milling. Otherwise... it is somewhat strange to, for example, be engaged in an 'intense' battle only to have the game end prematurely because one player runs out of cards...
wololo wrote: 2) You can code cards that somehow simulate this behavior (As long as I am in play, if such card is on the stack, then move it back to the player's hand <-- never tested that actually), but it probably won't be satisfying for your needs:
text=as long as Szei is in play, you can't cast elf spells
name=Szei
auto=@movedTo(elf|myStack):moveTo(myHand) all(elf|myStack)

That's a bit weird (it doesn't prevent you from casting the spell, but it returns the card to your hand as soon as it goes to the stack) AND I'm not sure it would work (it is possible that the spell manages to resolve anyways because of a bug... which might be solved by adding && fizzle all(elf|myStack)) but other workarounds can be imagined...

It's not necessary to code that in all cards either, it can be a general rule in mtg.txt:
auto=aslongas(goblin) @movedTo(elf|myStack):moveTo(myHand) all(elf|myStack) >2
<-- as long as more than 2 goblins are in play, elf spells can't be cast

Again, I have tried none of those and it could be that they don't work because of some bugs/limitations in the parser...
Thanks for the code. I'll try that when I start working on the custom that will use this (after I finish my current mod). The reason I wanted to know so far in advance whether this would be possible is because now that I've finished all the abstract work for my current mod and am just coding now, when I'm away from the computer I plan the mods I will make after the present one.
Image
wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: Mod Customization

Post by wololo »

Szei wrote:
wololo wrote:
Szei wrote:I was wondering how easy it would be to implement a feature that allows the mod.txt file to include starting cards for players. What I mean is the ability to set players with certain cards on the field or in hand at the beginning of the game as in test mode. This feature would most certainly be useful for mods and based on the present test mode capabilities, it seems as though this feature wouldn't be too much of a stretch to add?
I think that is already somehow possible although I never tested it.

something like:

Code: Select all

[INIT]
mode=mtg
[PLAYERS]
life:20
hand:Forest,Plains,Mountain
auto=shuffle
auto=@each my draw:draw:1
would have both players start with a Forest, a Plains and a Mountain in their hand.
I certainly can see a use for this; however, it's not quite what I had in mind. One of the mods I am planning is less of a one vs. one game with two players on equal footing, but more of a 'survival' game. I wanted to make the cpu start with an enchantment that generates 'monster' tokens each turn which the player then has to fend off (the AI can upgrade this enchantment as the game progresses to produce stronger creatures). The player in turn would start off with a 'worker' card which can build walls, towers, resource generators (lumber mills), an upgrade center, mercenary building, repair units (to repair* towers, walls, buildings) aura statues, etc.
Ok then, how about:

Code: Select all

[INIT]
mode=mtg
[PLAYERS]
life:20
auto=shuffle
auto=draw:7
auto=@each my draw:draw:1
[PLAYER1]
inplay:Worker
[PLAYER2]
inplay:Monster Generator
Again, this should work, however I am not sure about all the side effects (I haven't tested the Rules mechanism a lot...)
Szei
Posts: 218
Joined: Sat Nov 15, 2008 8:14 pm
Location: USA

Re: Mod Customization

Post by Szei »

Okay, I tested this out and it doesn't work.

Code: Select all

[INIT]
mode=Custom
[PLAYERS]
life:50
auto=shuffle
auto=draw:7
auto=@each my draw:draw:1
[PLAYER1]
hand:921980
I've checked many times with different cards and even tried replacing 'hand' with 'graveyard', 'battlefield', and 'inplay' but I get the same error message every time. "Please check your deck (not enough cards?)"

If I also add
[PLAYER2]
hand:(id for card in ai deck)

or

[PLAYERS]
hand:(id for card in both decks)

I get the same message except also with a "Game Length:4784832 seconds Credits per minute: 0" beneath it.
Image
wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: Mod Customization

Post by wololo »

yeah, so, I had the opportunity to test that, and what the code does is:
if anything is put in one of the zones of a player from the Rules text, his/her deck gets erased AND replaced with the overrides described in there.

I'm not sure I can find an easy workaround to that right now, it's not really a bug, it's just the way it's supposed to work now. (And I had forgotten about it when I suggested this solution...)
Locked