/
test_main.py
executable file
·5626 lines (4647 loc) · 148 KB
/
test_main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python
from utils import *
def test_cheat_destroy_deck():
game = prepare_game()
game.player1.discard_hand()
game.player2.discard_hand()
game.player1.give(DESTROY_DECK).play(target=game.player2.hero)
assert not game.player2.deck
game.end_turn()
assert not game.player2.hand
assert game.player2.hero.health == 29
game.player2.give(DESTROY_DECK).play(target=game.player1.hero)
assert not game.player1.deck
def test_chromaggus():
game = prepare_game()
chromaggus = game.player1.give("BRM_031")
chromaggus.play()
game.end_turn(); game.end_turn()
game.player1.discard_hand()
arcint = game.player1.give("CS2_023")
assert len(game.player1.hand) == 1
arcint.play()
assert len(game.player1.hand) == 4
assert game.player1.hand[0] == game.player1.hand[1]
assert game.player1.hand[2] == game.player1.hand[3]
def test_chromaggus_naturalize():
game = prepare_game()
chromaggus = game.player1.give("BRM_031")
chromaggus.play()
game.end_turn()
game.player1.discard_hand()
naturalize = game.player2.give("EX1_161")
naturalize.play(target=chromaggus)
assert len(game.player1.hand) == 4
assert game.player1.hand[0] == game.player1.hand[1]
assert game.player1.hand[2] == game.player1.hand[3]
def test_cobalt_guardian():
game = prepare_game()
cobalt = game.player1.give("GVG_062")
cobalt.play()
assert not cobalt.divine_shield
game.player1.give(TARGET_DUMMY).play()
assert cobalt.divine_shield
game.player1.give(TARGET_DUMMY).play()
assert cobalt.divine_shield
def test_cogmaster():
game = prepare_game()
cogmaster = game.current_player.give("GVG_013")
cogmaster.play()
assert cogmaster.atk == 1
dummy = game.current_player.give(TARGET_DUMMY)
dummy.play()
assert cogmaster.atk == 3
humility = game.current_player.give("EX1_360")
humility.play(target=cogmaster)
assert cogmaster.atk == 3
dummy.destroy()
assert cogmaster.atk == 1
game.end_turn(); game.end_turn()
game.end_turn(); game.end_turn()
game.end_turn(); game.end_turn()
game.current_player.give(TARGET_DUMMY).play()
assert cogmaster.atk == 3
blessedchamp = game.current_player.give("EX1_355")
blessedchamp.play(target=cogmaster)
cogmaster.atk == 6
def test_cogmasters_wrench():
game = prepare_game()
wrench = game.current_player.summon("GVG_024")
assert wrench.atk == game.current_player.hero.atk == 1
game.end_turn(); game.end_turn()
dummy = game.current_player.give(TARGET_DUMMY)
dummy.play()
assert wrench.atk == game.current_player.hero.atk == 3
dummy.destroy()
assert wrench.atk == game.current_player.hero.atk == 1
def test_cult_master():
game = prepare_game()
wisp1 = game.current_player.give(WISP)
wisp1.play()
wisp2 = game.current_player.give(WISP)
wisp2.play()
cultmaster = game.current_player.give("EX1_595")
cultmaster.play()
assert len(game.current_player.hand) == 4
game.current_player.give(MOONFIRE).play(target=wisp1)
assert len(game.current_player.hand) == 4 + 1
# Make sure cult master doesn't draw off itself
game.current_player.give(MOONFIRE).play(target=cultmaster)
game.current_player.give(MOONFIRE).play(target=cultmaster)
assert len(game.current_player.hand) == 4 + 1
game.current_player.give(MOONFIRE).play(target=wisp2)
assert len(game.current_player.hand) == 4 + 1
def test_cult_master_board_clear():
game = prepare_game()
game.player1.discard_hand()
for i in range(4):
game.player1.give(WISP).play()
cultmaster = game.player1.give("EX1_595")
cultmaster.play()
game.player1.give(MOONFIRE).play(target=cultmaster)
assert len(game.player1.field) == 5
# Whirlwind the board
game.player1.give("EX1_400").play()
assert len(game.player1.hand) == 0
def test_dark_bargain():
game = prepare_game()
for i in range(3):
game.player2.summon(WISP)
assert len(game.player2.field) == 3
assert len(game.player1.hand) == 4
bargain = game.player1.give("AT_025")
bargain.play()
assert len(game.player2.field) == 1
assert len(game.player1.hand) == 2
def test_divine_spirit():
game = prepare_game()
wisp = game.current_player.give(WISP)
assert wisp.health == 1
wisp.play()
game.end_turn()
game.current_player.give("CS2_236").play(target=wisp)
assert wisp.health == 1 * 2
game.end_turn()
game.current_player.give("CS2_236").play(target=wisp)
assert wisp.health == 1 * 2 * 2
game.end_turn()
equality = game.current_player.give("EX1_619")
equality.play()
assert wisp.health == 1
game.current_player.give("CS2_236").play(target=wisp)
assert wisp.health == 1 * 2
game.end_turn()
def test_savagery():
game = prepare_game(DRUID, DRUID)
watcher = game.player1.give("EX1_045")
watcher.play()
assert watcher.health == 5
savagery = game.player1.give("EX1_578")
savagery.play(watcher)
assert watcher.health == 5
game.player1.hero.power.use()
savagery2 = game.player1.give("EX1_578")
savagery2.play(watcher)
assert watcher.health == 5 - 1
game.end_turn(); game.end_turn()
# Play a kobold
game.current_player.give(KOBOLD_GEOMANCER).play()
savagery3 = game.player1.give("EX1_578")
savagery3.play(watcher)
assert watcher.health == 5 - 1 - 1
def test_earth_shock():
game = prepare_game()
crusader = game.current_player.give("EX1_020")
crusader.play()
assert crusader.divine_shield
game.end_turn()
earthshock = game.current_player.give("EX1_245")
earthshock.play(target=crusader)
assert crusader.dead
def test_eaglehorn_bow():
game = prepare_game()
bow = game.player1.give("EX1_536")
icebarrier = game.player1.give("EX1_289")
wisp = game.player2.give(WISP)
bow.play()
assert bow.durability == 2
game.end_turn()
wisp.play()
game.end_turn()
icebarrier.play()
assert bow.durability == 2
game.end_turn()
assert game.current_player.opponent.secrets
wisp.attack(target=game.player1.hero)
assert not game.current_player.opponent.secrets
assert game.player1.hero.health == 30
assert game.player1.hero.armor == 7
assert bow.buffs
assert bow.durability == 3
def test_echoing_ooze():
game = prepare_game()
ooze = game.player1.give("FP1_003")
ooze.play()
assert len(game.player1.field) == 1
game.end_turn()
assert len(game.player1.field) == 2
assert game.player1.field[0] is ooze
assert game.player1.field[1].id == ooze.id
assert game.player1.field[1].atk == ooze.atk
assert game.player1.field[1].health == ooze.health
def test_echo_of_medivh():
game = prepare_game()
game.player1.give(WISP).play()
game.player1.give(WISP).play()
game.player1.give(TARGET_DUMMY).play()
game.player1.give(GOLDSHIRE_FOOTMAN).play()
game.end_turn()
game.player2.give(SPELLBENDERT).play()
game.end_turn()
game.player1.discard_hand()
echo = game.player1.give("GVG_005")
echo.play()
assert game.player1.hand == [WISP, WISP, TARGET_DUMMY, GOLDSHIRE_FOOTMAN]
assert len(game.player1.field) == 4
def test_equality():
game = prepare_game()
equality = game.current_player.give("EX1_619")
# summon a bunch of big dudes
game.current_player.summon("CS2_186")
game.current_player.summon("CS2_186")
game.current_player.opponent.summon("CS2_186")
game.current_player.opponent.summon("CS2_186")
# And a violet teacher too, why not
game.current_player.summon("NEW1_026")
pyro = game.current_player.give("NEW1_020")
pyro.play()
assert len(game.board) == 6
equality.play()
assert not game.board
def test_elite_tauren_chieftain():
game = prepare_game()
game.player1.discard_hand()
game.player2.discard_hand()
assert len(game.player1.hand) == 0
assert len(game.player2.hand) == 0
tauren = game.player1.give("PRO_001")
tauren.play()
assert len(game.player1.hand) == 1
assert len(game.player2.hand) == 1
chords = ("PRO_001a", "PRO_001b", "PRO_001c")
assert game.player1.hand[0] in chords
assert game.player2.hand[0] in chords
def test_deadly_poison():
game = prepare_game(ROGUE, ROGUE)
poison = game.current_player.give("CS2_074")
assert not poison.is_playable()
game.current_player.hero.power.use()
assert game.current_player.weapon.atk == 1
assert game.current_player.hero.atk == 1
assert poison.is_playable()
poison.play()
assert game.current_player.weapon.atk == 3
assert game.current_player.hero.atk == 3
def test_demonfire():
game = prepare_game()
wisp = game.player1.give(WISP)
wisp.play()
game.player1.give("EX1_596").play(target=wisp)
assert wisp.dead
imp = game.player1.give("CS2_059")
imp.play()
game.player1.give("EX1_596").play(target=imp)
assert imp.atk == 0 + 2
assert imp.health == 1 + 2
assert imp.buffs
game.end_turn()
imp2 = game.player2.give("CS2_059")
imp2.play()
game.end_turn()
game.player1.give("EX1_596").play(target=imp2)
assert imp2.dead
def test_demonfuse():
game = prepare_game()
game.player2.max_mana = 9
demonfuse = game.player1.give("AT_024")
wisp = game.player2.summon(WISP)
imp1 = game.player1.give("EX1_319")
imp1.play()
imp2 = game.player2.summon("EX1_319")
assert len(demonfuse.targets) == 2
demonfuse.play(target=imp1)
assert imp1.atk == 3 + 3
assert imp1.health == 2 + 3
assert imp1.buffs
assert game.player2.max_mana == 10
def test_duplicate():
game = prepare_game()
game.player1.discard_hand()
duplicate = game.player1.give("FP1_018")
duplicate.play()
wisp = game.player1.give(WISP)
wisp.play()
game.end_turn()
game.player2.give(MOONFIRE).play(target=wisp)
assert len(game.player1.hand) == 2
assert game.player1.hand[0] == game.player1.hand[1] == WISP
def test_deathwing():
game = prepare_game()
game.player1.give(WISP).play()
game.player1.give(WISP).play()
game.player1.give(WISP).play()
deathwing = game.player1.give("NEW1_030")
deathwing.play()
assert not game.current_player.hand
assert len(game.board) == 1
assert not deathwing.dead
def test_power_word_shield():
game = prepare_game()
wisp = game.current_player.give(WISP)
wisp.play()
assert wisp.health == 1
assert len(game.current_player.hand) == 4
pwshield = game.current_player.give("CS2_004")
pwshield.play(target=wisp)
assert wisp.health == 3
assert len(game.current_player.hand) == 5
wisp.silence()
assert wisp.health == 1
def test_preparation():
game = prepare_game()
game.player1.discard_hand()
prep1 = game.player1.give("EX1_145")
prep2 = game.player1.give("EX1_145")
prep3 = game.player1.give("EX1_145")
pwshield = game.player1.give("CS2_004")
fireball = game.player1.give("CS2_029")
fireball2 = game.player2.give("CS2_029")
footman = game.player1.give(GOLDSHIRE_FOOTMAN)
footman2 = game.player2.give(GOLDSHIRE_FOOTMAN)
assert prep1.cost == prep2.cost == prep3.cost == 0
assert pwshield.cost == 1
assert fireball.cost == fireball2.cost == 4
assert footman.cost == footman2.cost == 1
game.end_turn(); game.end_turn()
assert game.player1.used_mana == 0
prep1.play()
assert game.player1.used_mana == 0
assert prep2.cost == prep3.cost == 0
assert pwshield.cost == 0
assert fireball.cost == 4 - 3
assert fireball2.cost == 4
assert footman.cost == footman2.cost == 1
prep2.play()
assert game.player1.used_mana == 0
assert prep2.cost == prep3.cost == 0
assert pwshield.cost == 0
assert fireball.cost == 4 - 3
assert fireball2.cost == 4
assert footman.cost == footman2.cost == 1
fireball.play(target=game.player2.hero)
assert game.player1.used_mana == 1
assert pwshield.cost == 1
assert fireball2.cost == 4
assert footman.cost == footman2.cost == 1
prep3.play()
assert pwshield.cost == 0
assert footman.cost == footman2.cost == 1
game.end_turn()
assert pwshield.cost == 1
assert footman.cost == footman2.cost == 1
def test_kill_command():
game = prepare_game(HUNTER, HUNTER)
kc = game.current_player.give("EX1_539")
kc.play(target=game.current_player.opponent.hero)
assert game.current_player.opponent.hero.health == 27
game.end_turn(); game.end_turn()
# play a timber wolf before this time
game.current_player.give("DS1_175").play()
kc = game.current_player.give("EX1_539")
kc.play(target=game.current_player.opponent.hero)
assert game.current_player.opponent.hero.health == 22
def test_abusive_sergeant():
game = prepare_game()
wisp = game.player1.give(WISP)
wisp.play()
assert wisp.atk == 1
game.player1.give("CS2_188").play(target=wisp)
assert wisp.atk == 3
game.end_turn()
assert wisp.atk == 1
def test_animal_companion():
game = prepare_game()
companion = game.player1.give("NEW1_031")
companion.play()
assert len(game.player1.field) == 1
assert game.player1.field[0].id in ("NEW1_032", "NEW1_033", "NEW1_034")
def test_angry_chicken():
game = prepare_game()
chicken = game.player1.give("EX1_009")
chicken.play()
stormwind = game.player1.give("CS2_222")
stormwind.play()
assert chicken.enrage
assert not chicken.enraged
assert chicken.atk == chicken.health == 2
game.player1.give(MOONFIRE).play(target=chicken)
assert chicken.enraged
assert chicken.atk == 1 + 1 + 5
assert chicken.health == 1
stormwind.destroy()
assert chicken.atk == chicken.health == 1
assert not chicken.enraged
def test_anima_golem():
game = prepare_game()
anima = game.player1.give("GVG_077")
anima.play()
wisp1 = game.player1.summon(WISP)
wisp2 = game.player2.summon(WISP)
game.end_turn(); game.end_turn()
assert not anima.dead
wisp1.destroy()
game.end_turn()
assert anima.dead
assert not wisp2.dead
game.end_turn()
def test_ancestors_call():
game = prepare_game()
game.player1.discard_hand()
game.player2.discard_hand()
novice = game.player1.give("EX1_015")
wisp = game.player2.give(WISP)
call = game.current_player.give("GVG_029")
call.play()
assert novice in game.player1.field
assert wisp in game.player2.field
assert not game.player1.hand
assert not game.player2.hand
def test_ancestral_healing():
game = prepare_empty_game()
watcher = game.current_player.give("EX1_045")
watcher.play()
assert not watcher.taunt
assert watcher.health == 5
watcher.set_current_health(1)
assert watcher.health == 1
game.current_player.give("CS2_041").play(watcher)
assert watcher.taunt
assert watcher.health == 5
def test_ancestral_spirit():
game = prepare_game()
ancestral = game.player1.give("CS2_038")
wisp = game.player1.give(WISP)
wisp.play()
assert not wisp.has_deathrattle
ancestral.play(target=wisp)
assert wisp.has_deathrattle
wisp.destroy()
assert len(game.board) == 1
assert game.player1.field[0].id == WISP
def test_ancient_of_lore():
game = prepare_game()
game.current_player.discard_hand()
# damage the hero with 6 moonfires
for i in range(6):
game.player1.give(MOONFIRE).play(target=game.player1.hero)
assert game.current_player.hero.health == 30 - 6
ancient1 = game.current_player.give("NEW1_008")
assert len(game.current_player.hand) == 1
assert ancient1.cost == 7
# Play to draw 2 cards
ancient1.play(choose="NEW1_008a")
assert len(game.current_player.hand) == 2
assert game.current_player.hero.health == 30 - 6
game.end_turn(); game.end_turn()
game.current_player.discard_hand()
ancient2 = game.current_player.give("NEW1_008")
# Play to heal hero by 5
ancient2.play(target=game.current_player.hero, choose="NEW1_008b")
assert not game.current_player.hand
assert game.current_player.hero.health == 30 - 6 + 5
def test_ancient_watcher():
game = prepare_game()
watcher = game.player1.give("EX1_045")
watcher.play()
game.end_turn(); game.end_turn()
assert not watcher.can_attack()
game.player1.give(SILENCE).play(target=watcher)
assert watcher.can_attack()
def test_anubar_ambusher():
game = prepare_empty_game()
ambusher = game.player1.summon("FP1_026")
wisp = game.player1.summon(WISP)
assert wisp in game.player1.field
ambusher.destroy()
assert len(game.player1.field) == 0
assert wisp in game.player1.hand
def test_alarmobot():
game = prepare_game()
bot = game.current_player.give("EX1_006")
game.end_turn(); game.end_turn()
game.end_turn(); game.end_turn()
bot.play()
game.current_player.discard_hand()
wisp = game.current_player.give(WISP)
for i in range(9):
game.current_player.give(MOONFIRE)
assert len(game.current_player.hand) == 10
assert bot.zone == Zone.PLAY
assert wisp.zone == Zone.HAND
game.end_turn(); game.end_turn()
assert bot.zone == Zone.HAND
assert wisp.zone == Zone.PLAY
assert len(game.current_player.field) == 1
assert len(game.current_player.hand) == 10
# bot should not trigger if hand has no minions
bot.play()
game.current_player.give(MOONFIRE)
assert len(game.current_player.hand) == 10
game.end_turn(); game.end_turn()
assert len(game.current_player.hand) == 10
assert bot.zone == Zone.PLAY
assert len(game.current_player.field) == 2
def test_alexstrasza():
game = prepare_game()
alex1 = game.player1.give("EX1_561")
assert game.player1.hero.health == 30
assert game.player2.hero.health == 30
alex1.play(target=game.player1.hero)
assert game.player1.hero.health == 15
assert game.player1.hero.max_health == 30
assert game.player2.hero.health == 30
game.end_turn(); game.end_turn()
alex2 = game.player1.give("EX1_561")
assert game.player2.hero.health == 30
alex2.play(target=game.player2.hero)
assert game.player2.hero.health == 15
def test_alexstrasza_ragnaros():
game = prepare_game()
majordomo = game.player1.give("BRM_027")
majordomo.play()
majordomo.destroy()
assert game.player1.hero.id == "BRM_027h"
assert game.player1.hero.health == 8
assert game.player1.hero.max_health == 8
game.end_turn(); game.end_turn()
alex = game.player1.give("EX1_561")
alex.play(target=game.player1.hero)
assert game.player1.hero.buffs
assert game.player1.hero.health == 15
assert game.player1.hero.max_health == 15
def test_avenging_wrath():
game = prepare_game()
game.current_player.give("EX1_384").play()
assert game.current_player.opponent.hero.health == 30 - 8
game.end_turn()
# Summon Malygos and test that spellpower only increases dmg by 5
game.current_player.summon("EX1_563")
game.current_player.give("EX1_384").play()
assert game.current_player.opponent.hero.health == 30 - (8 + 5)
def test_doomhammer():
game = prepare_game()
doomhammer = game.player1.give("EX1_567")
assert doomhammer.windfury
assert not game.player1.hero.atk
assert not game.player1.hero.windfury
doomhammer.play()
assert doomhammer.windfury
assert game.player1.hero.atk == 2
assert game.player1.hero.windfury
assert game.player1.weapon.durability == 8
game.player1.hero.attack(target=game.player2.hero)
assert game.player1.hero.can_attack()
game.player1.hero.attack(target=game.player2.hero)
assert not game.player1.hero.can_attack()
assert game.player1.weapon.durability == 6
def test_dragon_egg():
game = prepare_game(PRIEST, PRIEST)
egg = game.player1.give("BRM_022")
egg.play()
assert len(game.player1.field) == 1
game.player1.give(MOONFIRE).play(target=egg)
assert len(game.player1.field) == 2
assert len(game.player1.field.filter(id="BRM_022t")) == 1
assert egg.health == 1
game.player1.hero.power.use(target=egg)
assert egg.health == 2
assert len(game.player1.field) == 2
for i in range(2):
game.player1.give(MOONFIRE).play(target=egg)
assert egg.dead
assert len(game.player1.field) == 3
assert len(game.player1.field.filter(id="BRM_022t")) == 3
def test_dr_boom():
game = prepare_game()
boom = game.player1.give("GVG_110")
assert len(game.player1.field) == 0
boom.play()
assert len(game.player1.field) == 3
assert len(game.player1.field.filter(id="GVG_110t")) == 2
# Whirlwind the board
game.player1.give("EX1_400").play()
assert (30 - 2) >= game.player2.hero.health >= (30 - 8)
def test_raging_worgen():
game = prepare_game()
worgen = game.current_player.summon("EX1_412")
assert worgen.health == 3
game.current_player.give(MOONFIRE).play(target=worgen)
assert worgen.health == 2
assert worgen.atk == 4
assert worgen.windfury
game.current_player.give(CIRCLE_OF_HEALING).play()
assert worgen.atk == 3
assert not worgen.windfury
def test_amani_berserker():
game = prepare_game()
amani1 = game.player1.give("EX1_393")
amani1.play()
game.end_turn()
amani2 = game.player2.give("EX1_393")
amani2.play()
game.end_turn()
assert amani1.atk == amani2.atk == 2
amani1.attack(amani2)
# check both minions are still alive, that the enrage didn't trigger too early
assert amani1.zone == amani2.zone == Zone.PLAY
assert amani1 in game.player1.field
assert amani2 in game.player2.field
assert amani1.damage == amani2.damage == 2
assert amani1.atk == amani2.atk == 2 + 3
game.player1.give(CIRCLE_OF_HEALING).play()
assert amani1.atk == amani2.atk == 2
assert amani1.health == amani2.health == 3
game.player1.give(MOONFIRE).play(target=amani1)
assert amani1.atk == 2 + 3
def test_secretkeeper():
game = prepare_game()
secretkeeper = game.player1.give("EX1_080")
secretkeeper.play()
assert secretkeeper.atk == 1
assert secretkeeper.health == 2
icebarrier = game.current_player.give("EX1_289")
icebarrier.play()
assert secretkeeper.atk == 2
assert secretkeeper.health == 3
game.current_player.give(THE_COIN).play()
game.current_player.give(WISP).play()
assert secretkeeper.atk == 2
assert secretkeeper.health == 3
def test_shield_slam():
game = prepare_game(WARRIOR, WARRIOR)
wisp = game.player2.summon(WISP)
assert game.player1.hero.armor == 0
shieldslam1 = game.player1.give("EX1_410")
shieldslam1.play(target=wisp)
assert not wisp.dead
game.player1.give(HAND_OF_PROTECTION).play(target=wisp)
assert wisp.divine_shield
shieldslam2 = game.player1.give("EX1_410")
shieldslam2.play(target=wisp)
assert not wisp.divine_shield
game.player1.hero.power.use()
assert game.player1.hero.armor == 2
shieldslam3 = game.player1.give("EX1_410")
shieldslam3.play(target=wisp)
assert wisp.dead
def test_siege_engine():
game = prepare_game(WARRIOR, WARRIOR)
engine = game.player1.give("GVG_086")
engine.play()
assert engine.atk == 5
game.player1.hero.power.use()
assert game.player1.hero.armor == 2
assert engine.atk == 6
game.end_turn()
game.player2.hero.power.use()
assert engine.atk == 6
game.end_turn()
# Shield Block
game.player1.give("EX1_606").play()
assert game.player1.hero.armor == 7
assert engine.atk == 7
def test_siltfin_spiritwalker():
game = prepare_game()
game.player1.discard_hand()
siltfin = game.player1.give("GVG_040")
siltfin.play()
murloc = game.player1.give("CS2_168")
murloc.play()
game.player1.give(MOONFIRE).play(target=murloc)
assert len(game.player1.hand) == 1
def test_skycapn_kragg():
game = prepare_game()
kragg = game.player1.give("AT_070")
wisp = game.player1.give(WISP)
wisp.play()
assert kragg.cost == 7
game.end_turn()
pirate = game.player2.give("CS2_146")
pirate.play()
assert kragg.cost == 7
game.end_turn()
game.player1.give("CS2_146").play()
assert kragg.cost == 7 - 1
game.player1.field[-1].destroy()
assert kragg.cost == 7
game.end_turn(); game.end_turn()
game.player1.summon("CS2_146")
assert kragg.cost == 7 - 1
assert game.player1.mana == 10
kragg.play()
assert game.player1.mana == 10 - 6
def test_solemn_vigil():
game = prepare_game()
game.player1.discard_hand()
vigil = game.player1.give("BRM_001")
assert vigil.cost == 5
game.player1.summon(WISP).destroy()
assert vigil.cost == 4
game.player2.summon(WISP).destroy()
assert vigil.cost == 3
wisp1 = game.player1.summon(WISP)
game.player1.give(MOONFIRE).play(target=wisp1)
assert vigil.cost == 2
wisp2 = game.player1.summon(WISP)
game.player1.give(MOONFIRE).play(target=wisp2)
assert vigil.cost == 1
game.player1.summon(WISP).destroy()
assert vigil.cost == 0
game.player1.summon(WISP).destroy()
assert vigil.cost == 0
vigil.play()
assert len(game.player1.hand) == 2
assert game.player1.used_mana == 0
def test_sorcerers_apprentice():
game = prepare_game()
apprentice1 = game.player1.give("EX1_608")
fireball1 = game.player1.give("CS2_029")
assert fireball1.cost == 4
apprentice1.play()
assert fireball1.cost == 3
apprentice2 = game.player1.summon("EX1_608")
assert fireball1.cost == 2
apprentice1.destroy()
assert fireball1.cost == 3
game.end_turn()
fireball2 = game.player2.give("CS2_029")
assert fireball2.cost == 4
game.end_turn()
assert fireball1.cost == 3
def test_southsea_deckhand():
game = prepare_game(ROGUE, ROGUE)
deckhand = game.current_player.give("CS2_146")
deckhand.play()
assert not deckhand.charge
# Play rogue hero power (gives a weapon)
game.current_player.hero.power.use()
assert deckhand.charge
game.end_turn(); game.end_turn()
assert deckhand.charge
axe = game.current_player.give("CS2_106")
axe.play()
assert deckhand.charge
axe.destroy()
assert not deckhand.charge
game.end_turn(); game.end_turn()
# play charge
game.current_player.give("CS2_103").play(target=deckhand)
assert deckhand.charge
game.end_turn(); game.end_turn()
assert deckhand.charge
game.current_player.hero.power.use()
assert deckhand.charge
game.current_player.weapon.destroy()
# No longer have weapon, but still have the charge buff from earlier
assert deckhand.charge
def test_spellbender():
game = prepare_game()
spellbender = game.player1.give("tt_010")
spellbender.play()
goldshire = game.player1.give(GOLDSHIRE_FOOTMAN)
goldshire.play()
game.end_turn()
assert game.player1.hero.health == 30
game.player2.give(MOONFIRE).play(target=game.player1.hero)
assert game.player1.hero.health == 29
assert spellbender in game.player1.secrets
assert goldshire.health == 2
assert len(game.player1.field) == 1
game.player2.give(MOONFIRE).play(target=goldshire)
assert spellbender not in game.player1.secrets
assert goldshire.health == 2
assert len(game.player1.field) == 2
target = game.player1.field[1]
assert target.id == "tt_010a"
assert target.max_health == 3
assert target.health == 2
def test_spiteful_smith():
game = prepare_game()
assert not game.current_player.hero.atk
smith = game.current_player.summon("CS2_221")
assert smith.health == 6
assert not game.current_player.hero.atk
axe = game.current_player.give("CS2_106")
axe.play()
assert axe.atk == 3
assert game.current_player.hero.atk == 3
assert not game.current_player.opponent.hero.atk
game.current_player.give(MOONFIRE).play(target=smith)
assert smith.health == 5
assert axe.atk == 5
assert axe.buffs
assert game.current_player.hero.atk == 5
assert not game.current_player.opponent.hero.atk
game.current_player.give(CIRCLE_OF_HEALING).play()
assert axe.atk == 3
assert game.current_player.hero.atk == 3
game.current_player.give(MOONFIRE).play(target=smith)
assert smith.health == 5
assert axe.atk == 5
assert game.current_player.hero.atk == 5
def test_sword_of_justice():
game = prepare_game(PALADIN, PALADIN)
sword = game.current_player.give("EX1_366")
sword.play()
assert sword.durability == 5
wisp = game.current_player.give(WISP)
wisp.play()
assert wisp.atk == 2
assert wisp.health == 2
assert wisp.buffs
assert sword.durability == 4
game.end_turn()
game.current_player.give(WISP).play()
assert sword.durability == 4
game.end_turn()
game.current_player.hero.power.use()
assert sword.durability == 3
game.current_player.give(WISP).play()
game.current_player.give(WISP).play()
game.current_player.give(WISP).play()
assert not game.current_player.weapon
wisp2 = game.current_player.give(WISP)
wisp2.play()
assert wisp2.health == 1
assert wisp2.atk == 1
assert not wisp2.buffs
def test_emperor_thaurissan():
game = prepare_game()
thaurissan = game.player1.give("BRM_028")
fireball = game.player1.give("CS2_029")
wisp = game.player1.give(WISP)
footman = game.player1.give(GOLDSHIRE_FOOTMAN)
deathwing = game.player1.give("NEW1_030")
thaurissan.play()
assert fireball.cost == 4
assert wisp.cost == 0
assert footman.cost == 1
assert deathwing.cost == 10
game.end_turn()