AutomaticCoding
New Member
- Joined
- Dec 20, 2011
- Messages
- 1,091
I haven't programmed for your other bots in quite awhile (Twoish years), but, if memory recalls, it used a tick-based system where you'd have your main logic in one huge function that'd be called every X units, due to Hearthstone's turn based gameplay (Rather than Diablo's or World of Warcraft's real-time), this would obviously be (In my opinion, feel free to correct me) a foolish approach to take for such a game, and, the API would be more event driven.
How I see, it should have multiple events you can register, such as "drawCard", which, notifies you of the card you just drew, "startOfTurn", which, is invoked right after drawCard at the start of your turn, "action", whenever a card activates (Secret, Deathrattle, Enrages, etc...), "hitpointsUpdate", "mulligan", "mana(In/De)crease", etc..., then, all the events return a boolean "self", if true, they were invoked due to something that you did, if false, something your opponent did.
Then, you should also have a bunch of blocking functions for queuing moves, such as something like this which is able to track cards throughout their movement on the board (So, the API can queue playing a card, and, then buffing it, for example)
Etc...
Seems like the logical setup to me, however, I assume the API has the majority already coded, so, I'm just wondering how it'll work.
How I see, it should have multiple events you can register, such as "drawCard", which, notifies you of the card you just drew, "startOfTurn", which, is invoked right after drawCard at the start of your turn, "action", whenever a card activates (Secret, Deathrattle, Enrages, etc...), "hitpointsUpdate", "mulligan", "mana(In/De)crease", etc..., then, all the events return a boolean "self", if true, they were invoked due to something that you did, if false, something your opponent did.
Then, you should also have a bunch of blocking functions for queuing moves, such as something like this which is able to track cards throughout their movement on the board (So, the API can queue playing a card, and, then buffing it, for example)
Code:
game.invokeMoves([Hand[0].play(), Hand[1].ApplyBuff(Hand[0])]); //Blocks until both the first index card in hand has been played, and then until the second (now first) index card has been played, and, used it's target move to buff the first index card (Obviously you wouldn't use arrays like this, etc..., but, you get the point, the objects can reference the cards no matter where they are on the field (hand or board)
print(game.getBoard()); //Should now have Hand[0] on board, buffed with Hand[1], as the above function blocks until completion
Etc...
Seems like the logical setup to me, however, I assume the API has the majority already coded, so, I'm just wondering how it'll work.
Last edited: