LackeyCCG

LackeyCCG Forum => Plugins & Plugin Creation Forum => Topic started by: DKpaladinMDL on July 23, 2015, 12:54:14 PM

Title: Help with TRANSFERCARD to random position in deck
Post by: DKpaladinMDL on July 23, 2015, 12:54:14 PM
Hello,

I have been working on a Hearthstone plugin for playtesting custom cards. I recently made a Lich class that employs the Scheme mechanic from MTG while also having various cards that say "shuffle this card/some other card into your deck." It's very important that deck order remains the same and so the new card must be placed at some random position in the deck rather than just putting it on top of the deck and shuffling it.

To make this work, I tried making a zone called the "Shufflezone" where you put cards you want to shuffle into your deck. Then there's the "shuffle into deck button", which takes the top card of that zone and sends it to a random position in the Deck zone.

It almost works, however, instead of sending it to a random position number from 1 to n+1 where n is the deck size, it sends it to a random position where n is the hand size. Even though it's going off of the hand size for some reason, it still is sending it into the deck correctly. I am currently very confused as to why this is happening, so any help is appreciated. I thought that it might be in some way related to how I am defining the deck gamezone/deckzone, but I'm not sure. Here is my plugininfo.txt (with the shuffle into deck action bolded for convenience):

<plugin>
<pluginversion>2.0</pluginversion>

<pluginname>HearthstoneMod</pluginname>

<plugin>
<deckzone>
     <label>Deck</label>
     <gamezonetoloadto>Deck</gamezonetoloadto>
     <shuffle>yes</shuffle>
</deckzone>

<gamezone>
     <label>Hand</label>
     <visibletoowner>yes</visibletoowner>
     <gamezonetoloadto>Deck</gamezonetoloadto>
     <visibletoothers>no</visibletoothers>
</gamezone>

<gamezone>
     <label>Deck</label>
     <visibletoowner>no</visibletoowner>
     <gamezonetoloadto>Hand</gamezonetoloadto>
     <visibletoothers>no</visibletoothers>
</gamezone>

<gamezone>
     <label>Graveyard</label>
     <visibletoowner>yes</visibletoowner>
     <gamezonetoloadto>Graveyard</gamezonetoloadto>
     <visibletoothers>yes</visibletoothers>
</gamezone>

<gamezone>
     <label>Shufflezone</label>
     <visibletoowner>yes</visibletoowner>
     <gamezonetoloadto>Shufflezone</gamezonetoloadto>
     <visibletoothers>no</visibletoothers>
</gamezone>

<playerstat><label>Health</label><initialvalue>30</initialvalue></playerstat>
<playerstat><label>Mana</label><initialvalue>0</initialvalue></playerstat>

<generalfunction><label>Draw a card</label><kind>DRAWCARD</kind><includeasbutton>yes</includeasbutton></generalfunction>
<generalfunction><label>Shuffle into deck</label><kind>TRANSFERCARD</kind><sourceowner>performer</sourceowner><sourcegamezone>Shufflezone</sourcegamezone><sourceposition>top</sourceposition><destinationowner>performer</destinationowner><destinationgamezone>Deck</destinationgamezone><destinationposition>random</destinationposition><includeasbutton>yes</includeasbutton></generalfunction>
<generalfunction><label>Flip a coin</label><kind>FLIPCOIN</kind><includeasbutton>yes</includeasbutton></generalfunction>
<generalfunction><label>Spawn a card</label><kind>SPAWNCARD CARDNAME</kind><includeasbutton>yes</includeasbutton></generalfunction>
<generalfunction><label>Roll a D6</label><kind>RollD6</kind><includeasbutton>yes</includeasbutton></generalfunction>
<generalfunction><label>Roll a D4</label><kind>RollD4</kind><includeasbutton>yes</includeasbutton></generalfunction>

<cardfunction><label>Edit Note</label><kind>EDITNOTE</kind><includeasbutton>yes</includeasbutton></cardfunction>
<cardfunction><label>Flip Card</label><kind>TURNOVER</kind><includeasbutton>yes</includeasbutton></cardfunction>
<cardfunction><label>Take Control</label><kind>CHANGEOWNER</kind><includeasbutton>yes</includeasbutton></cardfunction>
<cardfunction><label>Add Damage counter</label><kind>ADDCOUNTER</kind><color>red</color><includeasbutton>yes</includeasbutton><PositionX>0</PositionX><PositionY>.04</PositionY></cardfunction>
<cardfunction><label>Remove Damage counter</label><kind>REMOVECOUNTER</kind><color>red</color><includeasbutton>yes</includeasbutton><PositionX>0</PositionX><PositionY>.04</PositionY></cardfunction>
<cardfunction><label>Add Silence counter</label><kind>ADDCOUNTER</kind><color>indigo</color><includeasbutton>yes</includeasbutton><PositionX>.5</PositionX><PositionY>.04</PositionY></cardfunction>
<cardfunction><label>Remove Silence counter</label><kind>REMOVECOUNTER</kind><color>indigo</color><includeasbutton>yes</includeasbutton><PositionX>.5</PositionX><PositionY>.04</PositionY></cardfunction>
<cardfunction><label>Add Health counter</label><kind>ADDCOUNTER</kind><color>green</color><includeasbutton>yes</includeasbutton><PositionX>1</PositionX><PositionY>.04</PositionY></cardfunction>
<cardfunction><label>Remove Health counter</label><kind>REMOVECOUNTER</kind><color>green</color><includeasbutton>yes</includeasbutton><PositionX>1</PositionX><PositionY>.04</PositionY></cardfunction>   
<cardfunction><label>Clear Card</label><kind>CLEARCARD</kind><includeasbutton>yes</includeasbutton></cardfunction>

<definition><kind>ISALLOWINGMULTIPLECARDBACKS</kind></definition>
<definition><kind>BACKVISIBILITY</kind><value>BACKVISIBILITYHIDEBACKINZONES</value></definition>
</plugin>

Title: Re: Help with TRANSFERCARD to random position in deck
Post by: AuraDragon on July 23, 2015, 02:50:45 PM
Seems like a bug.

I tinkered with your plugininfo and it stopped behaving incorrectly when I randomly put cards from my hand into a new shared zone...
Title: Re: Help with TRANSFERCARD to random position in deck
Post by: DKpaladinMDL on July 31, 2015, 08:20:50 AM
Should I post in the bug report section then?
Title: Re: Help with TRANSFERCARD to random position in deck
Post by: AuraDragon on July 31, 2015, 02:05:42 PM
Sure thing.  I don't know how often Trevor updates Lackey but posting in that area has the highest chance of getting it fixed.
Title: Re: Help with TRANSFERCARD to random position in deck
Post by: Trevor on July 31, 2015, 09:37:56 PM
I've been really busy with my baby. I'll continue to code more when I have more time.
Title: Re: Help with TRANSFERCARD to random position in deck
Post by: AuraDragon on August 01, 2015, 12:01:37 AM
Omg!  :o  You're a father?  Since when?  And Congratulations!
Title: Re: Help with TRANSFERCARD to random position in deck
Post by: Trevor on August 01, 2015, 10:25:28 AM
Quote from: Snoogy on August 01, 2015, 12:01:37 AM
Omg!  :o  You're a father?  Since when?  And Congratulations!
Since 6/6/14