It is currently 05 Sep 2025, 00:29
   
Text Size

Making a card undrawable

Moderator: CCGHQ Admins

Making a card undrawable

Postby Dargenom » 10 Feb 2016, 23:04

Is there some snippet of code you can add to a card to make it so you can't draw it in your starting hand or at all? Thanks in advance! :)
Dargenom
 
Posts: 10
Joined: 17 Mar 2015, 23:45
Has thanked: 4 times
Been thanked: 1 time

Re: Making a card undrawable

Postby Xander9009 » 10 Feb 2016, 23:30

Why?
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: Making a card undrawable

Postby Dargenom » 10 Feb 2016, 23:41

Been working on a custom story mode of sorts ever since I realized you could have a deck start out at any life total. For the boss I was thinking the AI would start with lands already in play, so I put leyline-esque effects on a few lands that trigger from anywhere. But then if said lands were drawn in the starting hand they're suddenly at less than 7 cards right off the bat.
Dargenom
 
Posts: 10
Joined: 17 Mar 2015, 23:45
Has thanked: 4 times
Been thanked: 1 time

Re: Making a card undrawable

Postby Xander9009 » 10 Feb 2016, 23:43

There's no good way to prevent the player from drawing a card. Code can't run until the mulligan is complete, and by then the card will have already been drawn or not. However, it might be possible to make specific setups like how some vanilla encounters work. I'm not certain. RiiakShiNal might know. I'd look into any of the decks in the game that you play against (or as, in the case of the tutorial) and see if they have any useful info.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: Making a card undrawable

Postby Dargenom » 10 Feb 2016, 23:50

Ah, fair enough. Time to do some digging then. Thanks for the help!
Dargenom
 
Posts: 10
Joined: 17 Mar 2015, 23:45
Has thanked: 4 times
Been thanked: 1 time

Re: Making a card undrawable

Postby RiiakShiNal » 11 Feb 2016, 02:47

You can't make a card undrawable, but there is still something you can do. You said that you put leyline effects on the card(s), well before you have them enter the battlefield you can check their current zone and if that zone is ZONE_HAND then force that player to draw a card to replace the leyline-like card. It makes sure that any card (other than a true leyline) that is put on the battlefield doesn't cause the player to start with fewer cards in hand than normal.

That is the easiest (and probably the best) solution. There are other more complex solutions to do what you are asking, but I can't really say they are better.

Creating saved encounters really isn't an option at this point because no-one has analyzed the saved game files and there could be additional checks. Also creating a new campaign (to host any created encounters) could cause issues with the existing campaigns since there aren't any free campaign slots.
RiiakShiNal
Programmer
 
Posts: 2188
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Making a card undrawable

Postby Xander9009 » 11 Feb 2016, 03:24

RiiakShiNal wrote:You can't make a card undrawable, but there is still something you can do. You said that you put leyline effects on the card(s), well before you have them enter the battlefield you can check their current zone and if that zone is ZONE_HAND then force that player to draw a card to replace the leyline-like card. It makes sure that any card (other than a true leyline) that is put on the battlefield doesn't cause the player to start with fewer cards in hand than normal.

That is the easiest (and probably the best) solution. There are other more complex solutions to do what you are asking, but I can't really say they are better.

Creating saved encounters really isn't an option at this point because no-one has analyzed the saved game files and there could be additional checks. Also creating a new campaign (to host any created encounters) could cause issues with the existing campaigns since there aren't any free campaign slots.
While it would require having his campaign be a standalone that is plainly said to be incompatible with the official one, but couldn't he basically just replace the campaign decks and personalities with his own? He'd have a set number of decks to create, which might limit it a bit, unfortunately, but better than nothing, perhaps. (I mean replace the deck lists and images and stuff with identically named files.) Just a thought.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: Making a card undrawable

Postby RiiakShiNal » 11 Feb 2016, 11:32

Xander9009 wrote:While it would require having his campaign be a standalone that is plainly said to be incompatible with the official one, but couldn't he basically just replace the campaign decks and personalities with his own? He'd have a set number of decks to create, which might limit it a bit, unfortunately, but better than nothing, perhaps. (I mean replace the deck lists and images and stuff with identically named files.) Just a thought.
He could replace the official campaign, but even then we don't yet understand how the encounter saves are set up so the idea of having a "save" where the AI starts with certain cards already on the battlefield is still out unless someone examines the saves and figures out how they work.

The best idea is still to have the cards automatically put themselves on the battlefield and if they were in hand replace themselves by forcing the player to draw a card. Now there are a few ways to go about that.
  1. Simple check before placing itself on battlefield (in RTA) to see if it was in hand and have player draw a card if it was.
  2. Have the card check to see how many cards are in hand at the beginning of resolution, then at end of resolution force player to draw cards until it matches how many cards were in hand at the beginning.
  3. If you want to always ensure 7 cards in hand for the player using the deck then at end of resolution draw cards until 7 are in hand.
  4. Write a special manager which will set up the "saved" game by manipulating all cards in deck, hand, graveyard, etc... on turn 0 (or 1, I can't remember which the game uses for first turn off hand) then either terminates itself or turns itself off.

For simple solutions option 1 is probably best, if you want total control then option 4 will give the best control for the least coding (though there can still be a lot of code for checking different scenarios such as FFA[2, 3, or 4 players], 2HG, etc...).
RiiakShiNal
Programmer
 
Posts: 2188
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Making a card undrawable

Postby Dargenom » 12 Feb 2016, 19:59

Making it draw you a card to replace it from the hand is a good idea, can't believe I didn't think of that myself. Shouldn't be that hard to piece together from other card code either. Thanks for the help guys. ^^
Dargenom
 
Posts: 10
Joined: 17 Mar 2015, 23:45
Has thanked: 4 times
Been thanked: 1 time


Return to 2014

Who is online

Users browsing this forum: No registered users and 22 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 22 users online :: 0 registered, 0 hidden and 22 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 22 guests

Login Form