forked from oyachai/HearthSim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BoardState.java
807 lines (686 loc) · 18.8 KB
/
BoardState.java
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
package com.hearthsim.util;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import com.hearthsim.card.Card;
import com.hearthsim.card.Deck;
import com.hearthsim.card.minion.Hero;
import com.hearthsim.card.minion.Minion;
import com.hearthsim.exception.HSInvalidPlayerIndexException;
public class BoardState implements DeepCopyable {
LinkedList<Minion> p0_minions_;
LinkedList<Minion> p1_minions_;
LinkedList<Card> p0_hand_;
LinkedList<Card> p1_hand_;
Hero p0_hero_;
Hero p1_hero_;
int p0_mana_;
int p1_mana_;
int p0_maxMana_;
int p1_maxMana_;
int p0_deckPos_;
int p1_deckPos_;
byte p0_fatigueDamage_;
byte p1_fatigueDamage_;
byte p0_spellDamage_;
byte p1_spellDamage_;
public BoardState() {
this(new Hero("hero0", (byte)30), new Hero("hero1", (byte)30));
}
public BoardState(Hero p0_hero, Hero p1_hero) {
p0_minions_ = new LinkedList<Minion>();
p1_minions_ = new LinkedList<Minion>();
p0_hand_ = new LinkedList<Card>();
p1_hand_ = new LinkedList<Card>();
p0_mana_ = 0;
p1_mana_ = 0;
p0_maxMana_ = 0;
p1_maxMana_ = 0;
p0_deckPos_ = 0;
p1_deckPos_ = 0;
p0_fatigueDamage_ = 1;
p1_fatigueDamage_ = 1;
p0_hero_ = p0_hero;
p1_hero_ = p1_hero;
}
public LinkedList<Minion> getMinions(int playerIndex) throws HSInvalidPlayerIndexException {
if (playerIndex == 0)
return p0_minions_;
else if (playerIndex == 1)
return p1_minions_;
else
throw new HSInvalidPlayerIndexException();
}
public LinkedList<Minion> getMinions_p0() {
return p0_minions_;
}
public LinkedList<Minion> getMinions_p1() {
return p1_minions_;
}
public LinkedList<Card> getCards_hand_p0() {
return p0_hand_;
}
public LinkedList<Card> getCards_hand_p1() {
return p1_hand_;
}
public Minion getMinion(int playerIndex, int index) throws HSInvalidPlayerIndexException {
if (playerIndex == 0)
return p0_minions_.get(index);
else if (playerIndex == 1)
return p1_minions_.get(index);
else
throw new HSInvalidPlayerIndexException();
}
public Minion getMinion_p0(int index) {
return p0_minions_.get(index);
}
public Minion getMinion_p1(int index) {
return p1_minions_.get(index);
}
public Card getCard_hand_p0(int index) {
return p0_hand_.get(index);
}
public Card getCard_hand_p1(int index) {
return p1_hand_.get(index);
}
public void setMinions_p0(LinkedList<Minion> minions) {
p0_minions_ = minions;
}
public void setMinions_p1(LinkedList<Minion> minions) {
p1_minions_ = minions;
}
public void setCards_hand_p0(LinkedList<Card> cards) {
p0_hand_ = cards;
}
public void setCards_hand_p1(LinkedList<Card> cards) {
p1_hand_ = cards;
}
public void setMinion_p0(Minion card, int index) {
p0_minions_.set(index, card);
}
public void setMinion_p1(Minion card, int index) {
p1_minions_.set(index, card);
}
public void setCard_hand(Card card, int index) {
p0_hand_.set(index, card);
}
public Iterator<Minion> getIterator_p0() {
return p0_minions_.iterator();
}
public Iterator<Minion> getIterator_p1() {
return p1_minions_.iterator();
}
public Iterator<Card> getIterator_hand() {
return p0_hand_.iterator();
}
public void placeMinion_p0(Minion card, int position) {
card.isInHand(false);
p0_minions_.add(position, card);
}
public void placeMinion_p1(Minion card, int position) {
card.isInHand(false);
p1_minions_.add(position, card);
}
public void placeMinion_p0(Minion card) {
card.isInHand(false);
p0_minions_.add(card);
}
public void placeMinion_p1(Minion card) {
card.isInHand(false);
p1_minions_.add(card);
}
public void placeCard_hand(int playerIndex, Card card) throws HSInvalidPlayerIndexException {
card.isInHand(true);
if (playerIndex == 0)
p0_hand_.add(card);
else if (playerIndex == 1)
p1_hand_.add(card);
else
throw new HSInvalidPlayerIndexException();
}
public void placeCard_hand_p0(Card card) {
card.isInHand(true);
p0_hand_.add(card);
}
public void placeCard_hand_p1(Card card) {
card.isInHand(true);
p1_hand_.add(card);
}
public void removeCard_hand(int index) {
p0_hand_.remove(index);
}
public int getNumMinions_p0() {
return p0_minions_.size();
}
public int getNumMinions_p1() {
return p1_minions_.size();
}
public int getNumCards_hand() {
return p0_hand_.size();
}
public int getNumCards_hand_p0() {
return p0_hand_.size();
}
public int getNumCards_hand_p1() {
return p1_hand_.size();
}
public Hero getHero(int playerIndex) throws HSInvalidPlayerIndexException {
if (playerIndex == 0)
return p0_hero_;
else if (playerIndex == 1)
return p1_hero_;
else
throw new HSInvalidPlayerIndexException();
}
public Hero getHero_p0() {
return p0_hero_;
}
public Hero getHero_p1() {
return p1_hero_;
}
public void setHero_p0(Hero hero) {
p0_hero_ = hero;
}
public void setHero_p1(Hero hero) {
p1_hero_ = hero;
}
public int getMana(int playerIndex) throws HSInvalidPlayerIndexException {
if (playerIndex == 0)
return p0_mana_;
else if (playerIndex == 1)
return p1_mana_;
else
throw new HSInvalidPlayerIndexException();
}
public void setMana(int playerIndex, int mana) throws HSInvalidPlayerIndexException {
if (playerIndex == 0)
p0_mana_ = mana;
else if (playerIndex == 1)
p1_mana_ = mana;
else
throw new HSInvalidPlayerIndexException();
}
public int getMana_p0() {
return p0_mana_;
}
public void setMana_p0(int mana) {
p0_mana_ = mana;
}
public int getMana_p1() {
return p1_mana_;
}
public void setMana_p1(int mana) {
p1_mana_ = mana;
}
public int getMaxMana_p0() {
return p0_maxMana_;
}
public void setMaxMana_p0(int mana) {
p0_maxMana_ = mana;
}
public int getMaxMana_p1() {
return p1_maxMana_;
}
public void setMaxMana_p1(int mana) {
p1_maxMana_ = mana;
}
public void addMaxMana_p0(int mana) {
p0_maxMana_ += mana;
}
public void addMaxMana_p1(int mana) {
p1_maxMana_ += mana;
}
/**
* Index of the next card in deck
*
* Returns the index of the next card to draw from the deck.
* @return
*/
public int getDeckPos(int playerIndex) throws HSInvalidPlayerIndexException {
if (playerIndex == 0)
return p0_deckPos_;
else if (playerIndex == 1)
return p1_deckPos_;
else
throw new HSInvalidPlayerIndexException();
}
public void setDeckPos(int playerIndex, int position) throws HSInvalidPlayerIndexException {
if (playerIndex == 0)
p0_deckPos_ = position;
else if (playerIndex == 1)
p1_deckPos_ = position;
else
throw new HSInvalidPlayerIndexException();
}
/**
* Index of the next card in deck
*
* Returns the index of the next card to draw from the deck.
* @return
*/
public int getDeckPos_p0() {
return p0_deckPos_;
}
public void setDeckPos_p0(int position) {
p0_deckPos_ = position;
}
/**
* Index of the next card in deck
*
* Returns the index of the next card to draw from the deck.
* @return
*/
public int getDeckPos_p1() {
return p1_deckPos_;
}
public void setDeckPos_p1(int position) {
p1_deckPos_ = position;
}
/**
* Get the fatigue damage
*
* Returns the fatigue damage taken when a card draw fails next.
* @return
*/
public byte getFatigueDamage(int playerIndex) throws HSInvalidPlayerIndexException {
if (playerIndex == 0)
return p0_fatigueDamage_;
else if (playerIndex == 1)
return p1_fatigueDamage_;
else
throw new HSInvalidPlayerIndexException();
}
public void setFatigueDamage(int playerIndex, byte damage) throws HSInvalidPlayerIndexException {
if (playerIndex == 0)
p0_fatigueDamage_ = damage;
else if (playerIndex == 1)
p1_fatigueDamage_ = damage;
else
throw new HSInvalidPlayerIndexException();
}
/**
* Get the fatigue damage for player 0
*
* Returns the fatigue damage taken when a card draw fails next.
* @return
*/
public byte getFatigueDamage_p0() {
return p0_fatigueDamage_;
}
public void setFatigueDamage_p0(byte damage) {
p0_fatigueDamage_ = damage;
}
/**
* Get the fatigue damage for player 1
*
* Returns the fatigue damage taken when a card draw fails next.
* @return
*/
public byte getFatigueDamage_p1() {
return p1_fatigueDamage_;
}
public void setFatigueDamage_p1(byte damage) {
p1_fatigueDamage_ = damage;
}
/**
* Get the spell damage
*
* Returns the additional spell damage provided by buffs
* @return
*/
public byte getSpellDamage(int playerIndex) throws HSInvalidPlayerIndexException {
if (playerIndex == 0)
return p0_spellDamage_;
else if (playerIndex == 1)
return p1_spellDamage_;
else
throw new HSInvalidPlayerIndexException();
}
/**
* Set the spell damage
*
* Returns the additional spell damage provided by buffs
* @return
*/
public void setSpellDamage(int playerIndex, byte damage) throws HSInvalidPlayerIndexException {
if (playerIndex == 0)
p0_spellDamage_ = damage;
else if (playerIndex == 1)
p1_spellDamage_ = damage;
else
throw new HSInvalidPlayerIndexException();
}
public Minion removeMinion(int playerIndex, int index) throws HSInvalidPlayerIndexException {
Minion minion = null;
try {
if (playerIndex == 0)
minion = p0_minions_.remove(index);
else if (playerIndex == 1)
minion = p1_minions_.remove(index);
else
throw new HSInvalidPlayerIndexException();
} catch (IndexOutOfBoundsException e) {
}
return minion;
}
public Minion removeMinion_p0(int index) {
Minion minion = null;
try {
minion = p0_minions_.remove(index);
} catch (IndexOutOfBoundsException e) {
}
return minion;
}
public Minion removeMinion_p1(int index) {
Minion minion = null;
try {
minion = p1_minions_.remove(index);
} catch (IndexOutOfBoundsException e) {
}
return minion;
}
public boolean isAlive_p0() {
return p0_hero_.getHealth() > 0;
}
public boolean isAlive_p1() {
return p1_hero_.getHealth() > 0;
}
public ArrayList<Integer> getAttackableMinions_p1() {
ArrayList<Integer> toRet = new ArrayList<Integer>();
boolean hasTaunt = false;
for (final Minion minion : p1_minions_) {
hasTaunt = hasTaunt || minion.getTaunt();
}
if (!hasTaunt) {
toRet.add((Integer)0);
int counter = 1;
for (final Minion minion : p1_minions_) {
toRet.add((Integer)counter);
counter++;
}
return toRet;
} else {
int counter = 1;
for (final Minion minion : p1_minions_) {
if (minion.getTaunt())
toRet.add((Integer)counter);
counter++;
}
return toRet;
}
}
public void resetMana() {
p0_mana_ = p0_maxMana_;
p1_mana_ = p1_maxMana_;
}
public void endTurn(Deck deck) {
p0_hero_.endTurn(0, 0, this, deck);
p1_hero_.endTurn(0, 0, this, deck);
for (int index = 0; index < p0_minions_.size(); ++index) {
Minion targetMinion = p0_minions_.get(index);
try {
targetMinion.endTurn(0, index + 1, this, deck);
} catch (HSInvalidPlayerIndexException e) {
e.printStackTrace();
}
}
for (int index = 0; index < p1_minions_.size(); ++index) {
Minion targetMinion = p1_minions_.get(index);
try {
targetMinion.endTurn(1, index + 1, this, deck);
} catch (HSInvalidPlayerIndexException e) {
e.printStackTrace();
}
}
Iterator<Minion> iter = p0_minions_.iterator();
while (iter.hasNext()) {
Minion targetMinion = iter.next();
if (targetMinion.getHealth() <= 0)
iter.remove();
}
iter = p1_minions_.iterator();
while (iter.hasNext()) {
Minion targetMinion = iter.next();
if (targetMinion.getHealth() <= 0)
iter.remove();
}
}
public void startTurn(Deck deck) {
this.resetHand();
this.resetMinions();
for (int index = 0; index < p0_minions_.size(); ++index) {
Minion targetMinion = p0_minions_.get(index);
try {
targetMinion.startTurn(0, index + 1, this, deck);
} catch (HSInvalidPlayerIndexException e) {
e.printStackTrace();
}
}
for (int index = 0; index < p1_minions_.size(); ++index) {
Minion targetMinion = p1_minions_.get(index);
try {
targetMinion.startTurn(1, index + 1, this, deck);
} catch (HSInvalidPlayerIndexException e) {
e.printStackTrace();
}
}
Iterator<Minion> iter = p0_minions_.iterator();
while (iter.hasNext()) {
Minion targetMinion = iter.next();
if (targetMinion.getHealth() <= 0)
iter.remove();
}
iter = p1_minions_.iterator();
while (iter.hasNext()) {
Minion targetMinion = iter.next();
if (targetMinion.getHealth() <= 0)
iter.remove();
}
}
public boolean equals(Object other)
{
if (other == null)
{
return false;
}
if (this.getClass() != other.getClass())
{
return false;
}
if (p0_mana_ != ((BoardState)other).p0_mana_)
return false;
if (p1_mana_ != ((BoardState)other).p1_mana_)
return false;
if (p0_maxMana_ != ((BoardState)other).p0_maxMana_)
return false;
if (p1_maxMana_ != ((BoardState)other).p1_maxMana_)
return false;
if (!p0_hero_.equals(((BoardState)other).p0_hero_)) {
return false;
}
if (!p1_hero_.equals(((BoardState)other).p1_hero_)) {
return false;
}
if (p0_deckPos_ != ((BoardState)other).p0_deckPos_)
return false;
if (p1_deckPos_ != ((BoardState)other).p1_deckPos_)
return false;
if (p0_fatigueDamage_ != ((BoardState)other).p0_fatigueDamage_)
return false;
if (p1_fatigueDamage_ != ((BoardState)other).p1_fatigueDamage_)
return false;
if (p0_spellDamage_ != ((BoardState)other).p0_spellDamage_)
return false;
if (p1_spellDamage_ != ((BoardState)other).p1_spellDamage_)
return false;
if (p0_minions_.size() != ((BoardState)other).p0_minions_.size())
return false;
if (p1_minions_.size() != ((BoardState)other).p1_minions_.size())
return false;
if (p0_hand_.size() != ((BoardState)other).p0_hand_.size())
return false;
for (int i = 0; i < p0_minions_.size(); ++i) {
if (!p0_minions_.get(i).equals(((BoardState)other).p0_minions_.get(i))) {
return false;
}
}
for (int i = 0; i < p1_minions_.size(); ++i) {
if (!p1_minions_.get(i).equals(((BoardState)other).p1_minions_.get(i))) {
return false;
}
}
for (int i = 0; i < p0_hand_.size(); ++i) {
if (!p0_hand_.get(i).equals(((BoardState)other).p0_hand_.get(i))) {
return false;
}
}
for (int i = 0; i < p1_hand_.size(); ++i) {
if (!p1_hand_.get(i).equals(((BoardState)other).p1_hand_.get(i))) {
return false;
}
}
// More logic here to be discuss below...
return true;
}
@Override
public int hashCode() {
int hs = p0_hand_.size();
if (hs < 0) hs = 0;
int res = hs + p0_minions_.size() * 10 + p1_minions_.size() * 100;
res += (p0_mana_ <= 0 ? 0 : (p0_mana_ - 1) * 1000);
res += ((p0_hero_.getHealth() + p1_hero_.getHealth()) % 100) * 10000;
int th = 0;
if (hs > 0) {
Card cc = p0_hand_.get(0);
try {
Minion mm = (Minion)cc;
th += ((cc.hasBeenUsed() ? 1 : 0) + mm.getAttack() + mm.getHealth() + cc.getMana());
} catch (ClassCastException e) {
th += ((cc.hasBeenUsed() ? 1 : 0) + cc.getMana());
}
}
if (hs > 1) {
Card cc = p0_hand_.get(1);
try {
Minion mm = (Minion)cc;
th += ((cc.hasBeenUsed() ? 1 : 0) + mm.getAttack() + mm.getHealth() + cc.getMana());
} catch (ClassCastException e) {
th += ((cc.hasBeenUsed() ? 1 : 0) + cc.getMana());
}
}
res += (th % 10) * 1000000;
int mh0 = 0;
if (p0_minions_.size() > 0) {
mh0 += (p0_minions_.get(0).getHealth());
}
if (p0_minions_.size() > 1) {
mh0 += (p0_minions_.get(1).getHealth());
}
res += (mh0 % 100) * 10000000;
int mh1 = 0;
if (p1_minions_.size() > 0) {
mh1 += p1_minions_.get(0).getHealth();
}
if (p1_minions_.size() > 1) {
mh1 += p1_minions_.get(1).getHealth();
}
res += (mh1 % 20) * 100000000;
return res;
}
/**
* Reset all minions to clear their has_attacked state.
*
* Call this function at the beginning of each turn
*
*/
public void resetMinions() {
for (Minion minion : p0_minions_) {
minion.hasAttacked(false);
minion.hasBeenUsed(false);
}
for (Minion minion : p1_minions_) {
minion.hasAttacked(false);
minion.hasBeenUsed(false);
}
}
/**
* Reset the has_been_used state of the cards in hand
*/
public void resetHand() {
for(Card card : p0_hand_) {
card.hasBeenUsed(false);
}
}
public BoardState flipPlayers() {
BoardState newState = (BoardState)this.deepCopy();
LinkedList<Minion> p0_minions = newState.getMinions_p0();
LinkedList<Minion> p1_minions = newState.getMinions_p1();
int p0_mana = newState.getMana_p0();
int p1_mana = newState.getMana_p1();
int p0_maxMana = newState.getMaxMana_p0();
int p1_maxMana = newState.getMaxMana_p1();
newState.p0_hero_ = p1_hero_;
newState.p1_hero_ = p0_hero_;
newState.setMinions_p0(p1_minions);
newState.setMinions_p1(p0_minions);
newState.setMana_p0(p1_mana);
newState.setMana_p1(p0_mana);
newState.setMaxMana_p0(p1_maxMana);
newState.setMaxMana_p1(p0_maxMana);
newState.p0_hand_ = p1_hand_;
newState.p1_hand_ = p0_hand_;
newState.p0_deckPos_ = p1_deckPos_;
newState.p1_deckPos_ = p0_deckPos_;
newState.p0_fatigueDamage_ = p1_fatigueDamage_;
newState.p1_fatigueDamage_ = p0_fatigueDamage_;
newState.p0_spellDamage_ = p1_spellDamage_;
newState.p1_spellDamage_ = p0_spellDamage_;
return newState;
}
public Object deepCopy() {
BoardState newBoard = new BoardState();
for (final Minion card: p0_minions_) {
Minion tc = (Minion)card.deepCopy();
newBoard.placeMinion_p0(tc);
}
for (final Minion card: p1_minions_) {
Minion tc = (Minion)card.deepCopy();
newBoard.placeMinion_p1(tc);
}
for (final Card card: p0_hand_) {
Card tc = (Card)card.deepCopy();
newBoard.placeCard_hand_p0(tc);
}
for (final Card card: p1_hand_) {
Card tc = (Card)card.deepCopy();
newBoard.placeCard_hand_p1(tc);
}
newBoard.setHero_p0((Hero)this.p0_hero_.deepCopy());
newBoard.setHero_p1((Hero)this.p1_hero_.deepCopy());
newBoard.p0_deckPos_ = this.p0_deckPos_;
newBoard.p1_deckPos_ = this.p1_deckPos_;
newBoard.p0_fatigueDamage_ = this.p0_fatigueDamage_;
newBoard.p1_fatigueDamage_ = this.p1_fatigueDamage_;
newBoard.p0_mana_ = this.p0_mana_;
newBoard.p1_mana_ = this.p1_mana_;
newBoard.p0_maxMana_ = this.p0_maxMana_;
newBoard.p1_maxMana_ = this.p1_maxMana_;
newBoard.p0_spellDamage_ = this.p0_spellDamage_;
newBoard.p1_spellDamage_ = this.p1_spellDamage_;
return newBoard;
}
public String toString() {
String toRet = "{";
toRet = toRet + "\"p0_minions\": " + p0_minions_ + ", ";
toRet = toRet + "\"p1_minions\": " + p1_minions_ + ", ";
toRet = toRet + "\"p0_hand\": " + p0_hand_ + ", ";
toRet = toRet + "\"p0_hero\": " + p0_hero_ + ", ";
toRet = toRet + "\"p1_hero\": " + p1_hero_ + ", ";
toRet = toRet + "\"p0_mana\": " + p0_mana_ + ", ";
toRet = toRet + "\"p1_mana\": " + p1_mana_ + ", ";
toRet = toRet + "\"p0_maxMana\": " + p0_maxMana_ + ", ";
toRet = toRet + "\"p1_maxMana\": " + p1_maxMana_ + "";
toRet = toRet + "}";
return toRet;
}
}