oyachai / HearthSim

Generic Hearthstone game simulator
MIT License
316 stars 59 forks source link

FifoMinions #37

Closed Kallin closed 10 years ago

Kallin commented 10 years ago

What's the idea with the allMinionsFifoList. It looks to only be used by 'handleDeadMinons'. Is there a reason you couldn't just loop through each player's minions?

Ragowit commented 10 years ago

One example is if several minions have deathrattle and they all die at the same time. The order of how deathrattle is executed is based upon the order of when the minions were played. So you can't just loop through each player's minions. You need to go through a list of all minions that are ordered by when they were played (FIFO) so you trigger the deathrattles in correct order.

Kallin commented 10 years ago

Ah cool, I didn't know that was a rule of deathrattle, thanks :)

oyachai commented 10 years ago

Yep, that's the reason. Also, this reminds me... the FIFO list should be used for other effects that happen simultaneously as well, e.g., end-of-turn effects and others. As it stands now, it is only used for deathrattles.

Kallin commented 10 years ago

Cool, that might even come in handy knowing when I play sometimes :P I'm taking a look at the identitylinkedlist code again to see if I can remove that class so that's why I'm investigating.