Giter Club home page Giter Club logo

metastone's Introduction

MetaStone

What is it?

MetaStone is a simulator for the online collectible card game (CCG) Hearthstone® by Activison Blizzard written in Java. It strives to be a useful tool for card value analyzation, deck building and performance evaluation. There is also support for custom cards, allowing users to implement their own card inventions and testing them within the simulator engine. MetaStone tries to re-implement all game mechanics and rules from the original game as accurately as possible.

What is it not?

This is no Hearthstone replacement or clone. Please do not request better graphical effects, sounds or anything which makes it feel more like Hearthstone. There won't be any mode to battle against other human players. This is a tool meant for advanced players; if you just want to play Hearthstone, please play the real game.

How do I run it on Linux?

  • Go to Releases and download the latest release (metastone-X_Y_Z_jar.zip).
  • Extract the contents of the .zip file.
  • Open the Terminal (Ctrl+Alt+T on Ubuntu) and access ../MetaStone-X.Y.Z/bin.
  • Execute this command: ./MetaStone.
    • Executing sudo ./MetaStone will execute the file as Root ("Super User"), this is not necessary though.
    • You might need to make the file executable (On Ubuntu: Right Click the File -> Properties -> Permissions -> Allow executing file as program).

Can I contribute?

Sure! There is still a lot to do and anybody willing to contribute is welcome

What needs to be done?

  • UI improvements in general are welcome
  • We always need more unit tests! If you don't know what to test, take a look at http://hearthstone.gamepedia.com/Advanced_rulebook and just pick an example of card interaction from that wiki page
  • Code refactorings to make the code simpler and/or faster
  • There is a bug in the code and you know how to fix it? Great!
  • Better AI: at the moment the most advanced AI is 'Game State Value', however it is very subpar compared to human players. A more sophisticated AI would be a huge boon
  • Also consider having a look at the open issues
  • Anything else you would like to improve

How do I compile the code on my machine?

  • NOTE JDK 1.8 is required!
  • Clone the repo. See https://help.github.com/articles/cloning-a-repository/ for help.
  • Open a terminal / command prompt and nagivate to your to your git repo location
  • Run the application from the command line:
    • Linux/Mac OSX ./gradlew run
    • Windows gradlew.bat run
    • Note: this will download all dependecies, compile and assemble all modules and then run the app.
  • Download dependecies and compile:
    • Linux/Mac OSX ./gradlew compileJava
    • Windows gradlew.bat compileJava
    • Note: this will download all dependecies and compile all modules. Usefull when developing.
  • Get a list of all gradle tasks:
    • Linux/Mac OSX ./gradlew tasks --all
    • Windows gradlew.bat tasks --all

Building with an IDE

  • If you want to build from Eclipse, create the Eclipse project files:
    • Linux/Mac OSX ./gradlew eclipse
    • Windows gradlew.bat eclipse
    • The above gradle task will automatically generate the BuildConfig.java file.
    • Open Eclipse and choose File > Import > General > Existing projects into workspace
    • Select the Search for nested project checkbox on the Import Projects screen.
    • Change Eclipse > Window > Preferences > Java > Compiler > Compiler Complience Level to 1.8
    • Change Eclipse > Window > Preferences > Java > Compiler > Building > Circular dependencies from Error to Warning. There is a known bug with importing multi-module gradle projects into Eclipse. The IDE of choice for working with gradle projects is IntelliJ IDEA.
  • If you want to build from IntelliJ IDEA, create the IntelliJ project files:
    • Linux/Mac OSX ./gradlew idea
    • Windows gradlew.bat idea
    • The above gradle task will automatically generate the BuildConfig.java file.
    • Open IntelliJ and select File > Open then navigate to the project root dir.
  • Optionally (advanced option), you can choose to import the project into your respective IDE from the build.gradle files. When doing so, you must manually generate the BuildConfig.java file. Otherwise your IDE will complain about unresolved references to BuildConfig.java.
    • Linux/Mac OSX ./gradlew compileBuildConfig
    • Windows gradlew.bat compileBuildConfig

Project structure

  • MetaStone is made up of a handfull of source modules. Here's what the top level structure looks like:
metastone
 ├── app    // Application UI code and resources. Depends on 'game' and 'cards' modules.
 ├── game   // Game source code. Depends on 'shared' module.
 ├── shared // Shared code between 'app' and 'game' modules.
 └── cards  // Cards, decks and deckFormat data files.
  • Each module can be built separately. Their respective dependencies will get compiled and pulled in at build time. For example:
  • To produce a cards.jar file which contains all the cards, decks and deckFormat data files:
    • Linux/Mac OSX ./gradlew cards:assemble
    • Windows gradlew.bat cards:assemble
  • To build the game module and produce a game.jar file:
    • Linux/Mac OSX ./gradlew game:assemble
    • Windows gradlew.bat game:assemble
  • To produce a standalone distributable app binary:
    • Linux/Mac OSX ./gradlew app:assemble
    • Windows gradlew.bat app:assemble

How do I build my own cards?

This feature is in very early stages and there is no official support yet. There is no documentation at all. If you really want to start right now, here's how you can start:

  • You can build your own cards or modify existing cards without having to fork the project!
  • Card files are located in the metastone/cards directory. Use these as reference!
    • Linux/Mac OSX ~/metastone/cards
    • Windows C:\Users\[username]\Documents\metastone\cards
    • You can override the default metastone home dir by setting an environment varialble USER_HOME_METASTONE and specifying a new path.
    • You must launch the app at least once for card data files to be copied.
  • Any .json files you place in your metastone/cards folder will be parsed and treated like built-in cards.
  • To learn the cards format it is highly recommended that you copy an existing card, change the filename and the id attribute (<-- important!) and make small changes.
  • Restart MetaStone for new cards to be detected.
  • If you are building out official cards or fixing existing cards, you will need to fork the project then make your changes in your repo's metastone/cards/src/main/resources/cards dir. Then open a Pull Request into the project master branch with your changes.
  • Make sure to validate that the cards you added are well formed and can be parsed! Run the following command:
    • Linux/Mac OSX ./gradlew cards:test
    • Windows gradlew.bat cards:test
  • The card format is subject to change; cards you create now MAY NOT work in future versions
  • In the rare chance that your card files get messed up beyond repair, you can always force the app to overwrite your local card files with the versions distributed with the app in cards.jar.
    • Option 1: Delete the ~/metastone dir.
      • You WILL LOOSE all your changes, including ALL new files you may have added. DANGEROUS! MAKE A BACKUP!!
      • Linux/Mac OSX rm -rf ~/metastone
      • Windows rmdir /s C:\Users\[username]\Documents\metastone
      • Card data files will be copied in their prestine state after you restart the app.
    • Option 2: Edit the ~/metastone/metastone.properties file and update the cards.copied property.
      • delete the cards.copied property and save the file
      • New files you may have added will NOT be affected.
      • All card files that are distributed with the app will be overritten after you restart the app.

Running tests

  • The easiest way to run tests is from the command line.
    • Linux/Mac OSX ./gradlew game:test
    • Windows gradlew.bat game:test
  • You can also run tests from your favorite IDE. For example:
    • In IntelliJ right click on src/test folder in a given module and select Run All Tests
  • You can also run individual tests using the -Dtest.single=[TEST NAME] command line option.
    • From the command line
      • Linux/Mac OSX ./gradlew game:test -Dtest.single=SecretTest
      • Windows gradlew.bat game:test -Dtest.single=SecretTest
    • From your IDE
      • Right click on the individual test file and select Run Test
  • If you encounter test failures open the test report file build/reports/tests/index.html for details on the failures
  • Look here for list of existing game tests.

metastone's People

Contributors

akoscz avatar demilich1 avatar dhokas avatar doctorpangloss avatar farqd avatar ikhaliq15 avatar jmui avatar joe1chen avatar kairos4242 avatar mayuso avatar sohan avatar thesmartwon avatar thodl15 avatar webadict avatar wowsporkles avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

metastone's Issues

[Improvement] Arcane Missiles

The main issue with Arcane Missiles is that it shows -1 Health on anything it hits, even if it hits the target more than once. It can be quite confusing sometimes.

[Bug] Nefarian is not implemented correctly

While it is possible to specify receiving cards from a specific class in 'ReceiveRandomCollectibleCardSpell', it is not possible to specify your opponents class right now. This should be fixed (Nefarian just gives random spells from any class right now)

I added a wiki page!

I made a small wiki for basic card creation with some extra details that demilich1 has not incluced in his little article in What is metastone?

Some texts i inserted like the wisp didn't show up like it was supposed to. The fireball one is all nice and pretty while the wisp one is a smudder of text! I would appreciate if someone would fix this as my brain is a bit dumb to understand how to make it pretty. Also if anyone finds a grammar problem please change it to the thing it was supposed to be. I write way to fast to worry about grammar ;) GOTTA GO FAST!

Adding some tgt warrior cards

https://mega.nz/#fm/gVpByJhY.
I made a some TGT Warrior card.
PS. King's defender battlecry didn't working(when you try to equip a weapon, game is crashing).
PSS. Alexstrasza's champion also didn't working(when you try to summon this minion, game is crashing).

UI improvement possibly?

''UI improvements in general are welcome''

Does anyone know how to acces/change the graphical files? Personally i dont find Metastone's graphics so ''appealing'' to the eye and if you look at Minecraft's UI it has a pretty simplistic one with square buttons. Right now Metastone is covered in plain beige squares, and my point is:

Wouldn't it be better to use a more traditional color like say... Blue. Blue is also less known for being a colour that makes you think alot more (Its true, blue triggers your brain to think and Red triggers the aggresive side of your brain) about your actions. Maybe not a deep blue but maybe a very light blue color. I think that would make it alot more appealling and im willing to make it all myself if needed :D

And also ''Please do not request better graphical effects'' This is not a graphical effect.

Simulation performance issue

I just received a mail from a MetaStone user:

I've been away from Hearthstone since September and updated my local code today. To my surprise, I've noticed that some simulation mode matches now take an exceedingly long time. I initially feared deadlock, but simulations always complete. There are several new decks that appear to be consistent offenders, but the problem is not limited to decks with new cards. None of the decks I tested in September presented performance issues, but a few do now.

I implemented a batch simulation mode locally and roughly 1 out of every 15 simulations that I tested takes over 4 minutes. The slowest deck by far is rank_1_legend_na_reno_dreadsteed.json, which was introduced with League of Explorers, while one of the slowest pre-LoE deck is tsafys_top_100_legend_shammy.json. I initially suspected that my batch mode is incompatible with the latest code, but when I removed all of my local additions and ran a normal GUI simulation of rank_1_legend_na_reno_dreadsteed vs. tsafys_top_100_legend_shammy, I logged a 2 hr, 12 min run! Most of the time was spent following game 96/100.

Please let me know whether you're able to reproduce the issue at your end. This should give us a clue regarding what should be investigated next.

I also noticed a slowdown personally, but I am not able to pin point the issue right now. If anybody got an idea which code takes long to execute, please post here. I would be happy to optimize it; otherwise I will start profiling myself when time allows it. For me this is a rather serious issue, as MetaStone is nearly unusable when 100 games take 2 hours to simulate.

[Documentation] Create documentation for .json card format

Having all cards outside the code as .json files is great, as it potentially allows users to create their own cards. However this is next to impossible in pratice at the moment, as there is no documentation about the format at all.

There should be a documentation covering all spells, triggers, value providers etc with all valid arguments.

[Feedback] Regarding the AI and Secrets

Something that I've been noticing as I've been playing during Play Mode is that whenever I play a secret, the AI just kind of locks up in regards to attacking minions even when they have answers to the secret. They just kind of stop playing and attack face until the secret is gone, and it makes the AI feel much less like you're playing against someone who plays around various situations in which a secret could be played and much more like against a bot who knows what you've played and just doesn't want to play anything to counteract it.

A normal player would attack a 1-1 when they have four 1-1 minions against a Mage, but the AI doesn't do anything because of the possibility of Duplicate/Effigy. It just hits the face. If you have a taunt, they don't do anything at all unless they have the resources to get rid of the taunt and more. Usually this means you win because you get like 5 turns of nothing on the end of the other player.

I don't expect the AI to be top notch or anything of the sort, I just wanted to post some feedback on the AI that I feel really sticks out. If the AI was more fleshed out in regards to secrets, I would consider it to be pretty good for the simulator, even though it still has small issues here and there, of course.

[Bug] Tracking is not implemented correctly

The Hunter card 'Tracking' does not offer the player the choice which card to choose. Instead it pulls 3 random cards out of the card and gives the player a random one. We should change that to the proper implementation.

We may re-use the mulligan method of the AI to prompt for the selection.

[Bug] Deathrattle effects when multiple minions die

I just received a bug report from a user:

"Dark Cultist's deathrattle will still buff a minion even when those minions should have died at the same time. For example, if I Flamestrike a board with a Dark Cultist and a Dark Iron Dwarf, the Dark Iron Dwarf will survive."

I was able to verify this. When the Dark Cultist was summoned first, its Deathrattle will buff another minion. I wrote a unit test for this problem, which fails at the moment.

While this is certainly possible to fix, we should be very careful with that. My first naive "fix" broke a lot of other stuff.

[BUG] Dark Iron Skulker

I dont remember if this issue has previously been covered but the Dark Iron Skulker's battlecry doesn't work.

[Bug] Unearthed Raptor Bugged

Whenever you copy a Deathrattle effect with Unearthed Raptor, it will trigger it at the same time as copying it into the Raptor. It happened with Nerubian Egg and Raptors who copied a Nerubian Egg so I'm not sure if it happens for other effects but I would assume it does.

[Bug] Mirror Entity problem with Faceless

Difficult to point it towards a single thing so I'll just describe the below situation:
http://i.imgur.com/RoELLAu.png

So I had a Water Elemental on the field with Mirror Entity while he had nothing at the start of his turn. He plays a totem, Searing Totem, and everything went kind of fast but I would assume it was okay and nothing triggered as he'd used his hero power earlier in the game several times. Then, he plays Faceless Manipulator on my Water Elemental, and so Faceless Manipulator changes into Water Elemental. Somehow, Mirror Entity triggers during all of this but does not give me a second Water Elemental. It just disappears. I first thought it was a card that just killed it somehow but looking at his mana 5+2 = 7 and he only has 1 usable crystal left on turn 8, so I'm pretty sure he didn't play anything else.

[Improvement] Remaining cards counter in PlayMode

When playing a game in Play Mode, there is no way to know how many cards are left in your deck. We should add something to solve this, either a simple label or something more fancy like an actual stack of cards.

[BUG] Astral Communion

When you use it, it is supposed to give you 10 usable mana crystals. Currently, it gives you 10 unusable ones.

Generating JSON Cards

Hi demilich,

First of all, huge props to the work you did already! What I want to ask is not really an issue, but more a question. How did you generate all those cards in json with the correct effects and whatnot? I'm also trying to make a simulator, but this is the part where I'm struggling the most (the game works perfectly, as perfect as possible in software), but I can't seem to create the correct formats without doing this manually. Can you explain this a bit? Have been looking through the code a bit, and can't find a generator

League Of Explorers!

WE NEED LOE!!!!!!! Raises pitchforks! We shall burn demilich if he does not answer to our pleads!

bawhahawbabwhabwha!

LoE! LoE! LoE! LoE! bwahbwhabhwhabwbhawbahwb!

Gathers a stack of wooden sticks and light em on fire!

We want LoE!

[Improvement] Add 'Back' button to Deck Builder

There is currently no way to leave the deck editing screen in the deck builder without saving the current deck (or exiting the application). We should add a 'Back' button (with a confirmation popup) allowing the user to go back to the deck overview screen.

[Bug] Secretkeeper + Mysterious Challenger

Secretkeeper currently gains the bonuses from the secrets played via Mysterious Challenger, while it shouldn't as Secretkeeper specifically states that the secrets must be played in order to gain the bonuses.

[Bug] Betrayal applies damage as a spell

Betrayal applies spell damage equal to the chosen minion's attack (as well as adding Spell Power.) Instead, it should have the minion attack the adjacent minions, applying on-attack abilities such as Freeze, Poison, etc

King's Elekk seems to be broken?

Tried to use it just now, it revealed a Piloted Shredder, and instead gave me a Ram Wrangler, or it might have copied the one in my hand.
http://i.pomf.pl/vqibro.png

Tried it again, seems that it just draws 1 card rather than the card revealed. That's my guess, anyways.

Suggestion for deck builder

Do you think we could have an option to delete decks in there? Having to go to the directory of Metastone each time to delete a deck I didn't want to add to my list in the end is a bit tiring.

[Bug] Wild Pyromancer triggers too early

Received another bug report from a user, was also able to verify this:

"Wild Pyromancer's spell trigger is occurring before the spell resolves. For example, if I have a Wild Pyromancer and I Holy Nova an enemy board with a Haunted Creeper, the Haunted Creeper will first take 1 damage from the Pyromancer and then the 2 damage from Holy Nova, allowing the two Spectral Spiders to survive."

I also added a unit test for this, which is failing at the moment.

Release 0.9.9 ready for testing

Hi all,

I just uploaded binary versions of the 0.9.9 release to github. First, it will be available on github only to perform some more testing. After some days I will publish it on my website and enable the update notification in the program.

So, everybody is invited to download the release and test it. Please do report all bugs you find.

Special thanks to webadict for implementing all of the LoE cards!

[Bug] Lord Jaraxxus incorrect interactions

-Lord Jaraxxus activates Snipe, but has 15/15 HP after Hero replacement.
-Lord Jaraxxus activates Repentance, but has 15/15 HP after Hero replacement.
-Lord Jaraxxus activates Mirror Entity, but destroys the copied minion after summon.

Hungry Crab is acting wierd!

Whenever the AI plays a Hungry Crab with 2 or something like that murlocs, one of the murlocs dies (Like normal) but the Hungry Crab gains +6/+3 and i dont know why

Add option to build arbitrary decks

Add the moment all decks built in MetaStone must follow the standard Hearthstone construct rules:

Only 1 of each Legendary and 2 of each other card.

Several users requested the option to lift those restrictions to test arena decks or just build fun decks (30 Unstable Portals anyone?).

I don't like the idea of just removing the checks for all decks, at is very useful to have the same rules as in the actual game. However, we could add an opt-in checkbox when creating a new deck, maybe labeled 'Ignore deck-building rules' or something like that. The ideal implementation would also display a small icon or label next to each deck in the deck overview which does not obey the standard rules. This way, users could distinguish between fun and serious decks at one glance.

Chose one spells do not work with malygos

Living roots and wrath do not get additional spell power from malygos.
I've noticed that keeper of the grove works the same way (his 2 damage option is considered "DamageSpell" just like living roots and wrath).

[Improvement] Arttwork

Hey all,

I am in second year CompSci at ULB in belgium and our year project is acyually simulating hearthstone with socket programming and no singleplayer support, all of it in QT haha, I'm in charge of game programming and cards and already created a couple of unique cards with artwork. It was quite easy to add the images into a sample card collection if already done.

So i was thinking, framework support for the artwork files, which can all be found here: http://imgur.com/a/qLi7G#0 , could potentially be added already no?
To be seen would be:
[ ] Format they are saved in.
[ ] Reference to them via json files or other.
[ ] Any potential mismatch would have to be seen one by one

Cheerio mates :D

[Bug] Mal'Ganis

So the board is this:
http://i.pomf.pl/nniwvp.png

And as you can see, the Imps (gotten by Implosion) are 3/3, 5/5, and 7/7. I brought out Mal'Ganis via Voidcaller if that's any help, but what I think happened was when the imps were summoned they like gained 2/2 and then it went to 4/4 and then 6/6 for some reason. I don't know why but maybe there's something with Mal'Ganis and his coding.

I made Starcraft 2 cards!

https://mega.nz/#F!mZ83XKoL!rwrngR4aXlvShYjehc1SkQ
I made alot of custom cards using the new version and i just tought id let ya know that. Its around 60~ cards but some of them need some fixing. I was planning on making all zerg related cards beast but when i try to add ''RACE'':''BEAST'' and launch metastone it says error stuff. I was also wondering what program you use when editing the card files bc i use notepad and need something else bc notepad cx ._.

If you need some help im also willing to help! (Even tho im pretty limited by my brain in what i can do)

PS: The Zergling and Sentry cards arent working. (Sentry is based off Hogger and Zergling is Tidehunter) The sentry wont spawn the token_force_custom and the zergling wont spawn the token_zergling_custom (I name all the cards custom in the end bc idunno)

PSS: I copied all the Jarraxxus cards and renamed him arthas and made everything arthas-y like but when i played him i only got his weapon and the health. Not the hero power.

Fix this please :3

Me: Starts a match playing against Warlock.
5 minutes later
Me: Bwuahhaha! Die bot! I have made a board far superiour to yours! Deathwing, Ysera and NEFARIAN! Ends turn
Bot: Plays corruption
Me: Wait who did he use corruption on?!?!?!?
Bot: Ends turn
Me: Hmmmmm im 1 turn of lethal... just need to set it up one more damage next turn >:P... Uses Inner fire on ysera
Me: Ends turn
Ysera dies
Bot: Says to me through telekenetic powers ''BwahahahHA! Metastone does not show which card was corrupted so u didn't know which card i casted it on! It was your Ysera! hahahahahhahah!
Me: RAGE QUIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.