Cardtopia is an advanced card collection and battle game inside of Minecraft. All interaction is done within the Minecraft chat, as this datapack is aimed as an in-chat minigame for servers. If you're a server owner wanting to add this datapack to your server, read more about setup below.
About Cardtopia
In Cardtopia, players can collect cards from different card packs they buy with coins. Coins are earned through battles and other random events. Players can wager 10 cards in a battle against another player, with complex strategies having to be used to win.
Setting it up
Setting up Cardtopia is rather easy, however, as a server owner, you must read the TOS and notes for a better experience.
Download the file below
Open the ZIP and copy the entire folder called 'Cardtopia'
Paste the folder inside the datapacks folder of your Minecraft world
Re-open the Minecraft world or type /reload in the chat
Cardtopia needs to place some command blocks, and summon some things for everything to work, these all need to be within one chunk, so stand in the middle of a chunk and type /function setup
Once all command blocks have been placed and entities have been summoned, do not destroy anything it made, since that will break the entire game!
From this point, everything will be done automatically for you
Battles and Cards
Cards can be obtained by opening card packs. You can buy card packs from all sorts of collections, like Food or Household. Every card pack can contain 1 of 5 cards. Big collections like Food have multiple card packs, that all belong to that same collection. There's Food 1, Food 2, etc. that all have 5 Food cards in them to collect. The card you get from a card pack is completely random, so luck is involved. To counteract the luck, players can win cards in battles, and trade cards with eachother.
Battles can be fought when you have at least 10 cards. To start a battle with a specific player, stand close to that player and run the battle command. When you finish choosing 10 cards to wager, and 3 from those 10 to put in active slots, the game will search for the nearest also-playing player. The player who finishes selecting their cards first, gets to fight first. You can choose to Attack / Defend / Swap / Special. The attack move deals damage to the opponent card you choose. If the opponent card you attack is defending, your card's ATT - opponent card's DEF = damage done to opponent's card. When you defend, you protect yourself from next round's attacks. You can also swap an active slot with a card from your wager. Lastly, every player has a special meter that fills up during battle. If it is full, players can use a card's special attack to deal a mortal blow to a card, or heal their own slots. Every card has its own stats, including a unique special attack. Every active slot has a set maximum HP, which is the sum of every wager card's HP stat. If an active slot reaches 0 health, it dies, and the card that is in it is sent to Hold. Players can choose to skip a round to take any card from Hold. If all active slots are dead, you lose, and your opponent wins. The winner of the battle takes all 20 wagered cards.
For Servers: Permissions and Commands
In Cardtopia, players have to click selections in chat, that execute certain triggers. These triggers are coded to only be use-able when they need to be, so typing them out instead of clicking a chat option will only result in an error. This said, players will need permission to execute the /trigger command, but this is a default permission.
To convert Card ID's to card names for the card game, one invisible armor stand will also be spawned next to all the command blocks. Since you ran the setup command in the middle of a chunk, all command blocks and the armor stand will be in the same chunk, allowing that chunk to be force-load-added. This means that chunk will always be loaded, to make sure the command blocks and armor stand are 'visible' to every player, wherever in the world they are.
Server Usage TOS
If you use my datapack on your server, certain rules must be followed. If any of the below stated rules are broken, your server may be at risk of getting banned.
Selling Cardtopia Orbs for real money is not allowed, I do not condone pay to win servers, so my datapack shall not be used that way either.
List of Cards (By Collection)
Food I
Pancake - 1 HP, 1 DEF, 1 ATT, Special: Maple Syrup (Heals every slot with 5 HP)
Borgir - 3 HP, 2 DEF, 1 ATT, Special: Aroma (Takes 2 HP from every opponent slot for your own slots)
Ketchup - 4 HP, 2 DEF, 2 ATT, Special: Squirt (Deals your in-game saturation as damage)
Fries - 2 HP, 1 DEF, 3 ATT, Special: Chips Innit (Sets HP of all your slots to HP of target slot)
Steak - 3 HP, 2 DEF, 2 ATT, Special: Season (Resets your opponent's special meter)
FAQ
Q: How did you target the opponent in your code?
A: When starting a battle, the game always searches for the nearest player that is also battling. Since this is a datapack, you can probably find a way to break this system. I just target @p[distance=0.1..], to make sure it's not selecting yourself, add a bit of distance.
Q: How rare are certain cards and how do card packs work?
A: Card packs can contain 1 of 5 cards, there is a 20% chance to get any of them. There are bonusses for cards that belong to the same collection. Collection is not the same as pack, there are the packs 'Food I' and 'Food II', but cards from either packs fall under the same 'Food' collection, so they have bonusses on each other.
Q: Why can I not charge real money for card packs?
A: This is indeed a rule you agree to when using my datapack. I do not like pay 2 win servers, or pay 2 win in any video game. I despise it, and so I want to keep it out of my projects.
Q: Will this datapack lag my server?
A: No. Some datapacks of mine will, since they run commands every tick using functions, which heavily slows the game down. But this datapack does not.
Q: Can I download and modify your datapack?
A: (This answer goes for any project I make, unless stated otherwise!) Yes! Please feel free to download, play and even modify my code. If you can figure it out, that is... Publishing modifications is also allowed, but clear credit must be given to this page and my YouTube channel.
Q: How long did it take you to make this?
A: Too long, for version 1.0, about 1.5 months of almost daily 30-minute coding sessions. That comes out to about 22 hours of coding for only 1.0.
Q: I have a card idea, and want it in the game, how do I do that?
A: You could either modify the game and add it yourself, but that will be hard since my code is very unreadable, or you could nicely ask me to add it. Comment on any of my YouTube videos, since I read all of those, stating your card idea. If possible, even provide stats and a special move! You will be credited in the datapack's credits!
List of Scoreboard Objectives
s1 (Stores active slot 1 in battle)
s2 (Stores active slot 2 in battle)
s3 (Stores active slot 3 in battle)
w1 (Stores wager slot 1 in battle)
w2 (Stores wager slot 2 in battle)
w3 (Stores wager slot 3 in battle)
w4 (Stores wager slot 4 in battle)
w5 (Stores wager slot 5 in battle)
w6 (Stores wager slot 6 in battle)
w7 (Stores wager slot 7 in battle)
w8 (Stores wager slot 8 in battle)
w9 (Stores wager slot 9 in battle)
w10 (Stores wager slot 10 in battle)
wava (For wager selection, 1 if card is owned)
bturn (For battle, 1 if your turn, 0 if opponent's)
s1h (Slot 1 health)
s2h (Slot 2 health)
s3h (Slot 3 health)
wprog (Stores wager selection progress)
btimer (Countdown between overview and first round)
c1 (Trigger, selection for Take from hold / Strategise)
c2 (Trigger, selection for Attack / Defend / Swap / Special)
1 (Amount of cards of ID 1 owned)
slcard (Trigger, wager selection input)
ss (Trigger, slot selection input)
odone (Whether opponent is done selecting)
owait (Whether you're waiting for your opponent)
c3 (Trigger, opponent card attack selection)
c4 (Trigger, opponent card special selection)
s1a (Action that slot 1 is about to perform)
s2a (Action that slot 2 is about to perform)
s3a (Action that slot 3 is about to perform)
c5 (Wager swap selection)
temp (Temporary variable for swapping)
dmgc (Calculating damage)
tothp (Total HP from all wagered cards combined)
cids (Used to match card ID with card name)
h1 (Stores hold slot 1)
h2 (Stores hold slot 2)
h3 (Stores hold slot 3)
hw (Which hold slot is open next)
c6 (Carl's cards first selection)
c7 (Card pack selection)
r1 (Slot 1 for refunds)
r2 (Slot 2 for refunds)
r3 (Slot 3 for refunds)
r4 (Slot 4 for refunds)
r5 (Slot 5 for refunds)
r6 (Slot 6 for refunds)
r7 (Slot 7 for refunds)
r8 (Slot 8 for refunds)
r9 (Slot 9 for refunds)
r10 (Slot 10 for refunds)
rd (Stores refund storing progress)
2 (Amount of cards of ID 2 owned)
3 (Amount of cards of ID 3 owned)
4 (Amount of cards of ID 4 owned)
5 (Amount of cards of ID 5 owned)
6 (Amount of cards of ID 6 owned)
7 (Amount of cards of ID 7 owned)
8 (Amount of cards of ID 8 owned)
9 (Amount of cards of ID 9 owned)
10 (Amount of cards of ID 10 owned)
11 (Amount of cards of ID 11 owned)
12 (Amount of cards of ID 12 owned)
13 (Amount of cards of ID 13 owned)
14 (Amount of cards of ID 14 owned)
15 (Amount of cards of ID 15 owned)
16 (Amount of cards of ID 16 owned)
17 (Amount of cards of ID 17 owned)
18 (Amount of cards of ID 18 owned)
19 (Amount of cards of ID 19 owned)
20 (Amount of cards of ID 20 owned)
21 (Amount of cards of ID 21 owned)
22 (Amount of cards of ID 22 owned)
23 (Amount of cards of ID 23 owned)
24 (Amount of cards of ID 24 owned)
25 (Amount of cards of ID 25 owned)
26 (Amount of cards of ID 26 owned)
27 (Amount of cards of ID 27 owned)
28 (Amount of cards of ID 28 owned)
29 (Amount of cards of ID 29 owned)
30 (Amount of cards of ID 30 owned)
31 (Amount of cards of ID 31 owned)
32 (Amount of cards of ID 32 owned)
33 (Amount of cards of ID 33 owned)
34 (Amount of cards of ID 34 owned)
35 (Amount of cards of ID 35 owned)
36 (Amount of cards of ID 36 owned)
37 (Amount of cards of ID 37 owned)
38 (Amount of cards of ID 38 owned)
39 (Amount of cards of ID 39 owned)
40 (Amount of cards of ID 40 owned)
c8 (Take from hold option)
wempty (Stores which wager slot is empty for hold taking)
setup (Whether Cardtopia has been set up)