jleclanche / fireplace

A Hearthstone simulator in Python
https://hearthsim.info
GNU Affero General Public License v3.0
673 stars 150 forks source link

[Test]Wild growth mana used issue. #467

Closed tonyyyye closed 10 months ago

tonyyyye commented 6 years ago

After playing wildgrowth1, a test of this is written.

  assert game.player1.used_mana == 2 + 1

Is it right?

jleclanche commented 6 years ago

Yes, "used mana" really means "how many of the crystals you have are empty"

tonyyyye commented 6 years ago

This is what i concerned about:

def test_darnassus_aspirant():
        game = prepare_game()
        assert game.current_player.mana == 10
        assert game.current_player.max_mana == 10
        aspirant = game.current_player.give("AT_038")
        aspirant.play()
        assert game.current_player.mana == 8 #   ‘E    AssertionError: assert 7 == 8‘
        assert game.current_player.max_mana == 10
        assert game.current_player.used_mana == 2 #   ‘E    assert 3 == 2‘

        aspirant.destroy()
        assert game.current_player.mana == 8  #   E    AssertionError: assert 6 == 8
        assert game.current_player.max_mana == 9
        assert game.current_player.used_mana == 2 #  E    AssertionError: assert 3 == 2

since the GainEmptyMana is composed of GainMana and SpendMana which changes used_mana, the asserts fail. We need another attribute to convey the meaning of 'the actual SPENT mana'.

This may also relate to 0-cost forbidden cards, I guess.