Source

Technical Machine / source / pokemon / active_pokemon.cpp

Full commit
  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
// Flags for the active Pokemon
// Copyright (C) 2012 David Stone
//
// This file is part of Technical Machine.
//
// Technical Machine is free software: you can redistribute it and / or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

#include "active_pokemon.hpp"

#include "pokemon.hpp"

#include "../ability.hpp"
#include "../damage.hpp"
#include "../rational.hpp"

#include "../move/move.hpp"

namespace technicalmachine {

PokemonCollection const & ActivePokemon::all_pokemon() const {
	return m_all_pokemon;
}
PokemonCollection & ActivePokemon::all_pokemon() {
	return m_all_pokemon;
}

Pokemon const & ActivePokemon::get_pokemon() const {
	return all_pokemon()();
}
Pokemon & ActivePokemon::get_pokemon() {
	return all_pokemon()();
}

ActivePokemon::operator Pokemon const & () const {
	return get_pokemon();
}

ActivePokemon::operator Pokemon & () {
	return get_pokemon();
}

MoveCollection const & ActivePokemon::all_moves() const {
	return get_pokemon().move;
}

MoveCollection & ActivePokemon::all_moves() {
	return get_pokemon().move;
}

void ActivePokemon::reset_end_of_turn() {
	damage_done_to_active = 0;
	enduring = false;
	flinched_this_turn = false;
	has_moved = false;
	me_first = false;
	loaf = !loaf;
	protecting = false;
}

void ActivePokemon::reset_switch() {
	// TODO: remove some of these when the foe switches, too
	if (!is_baton_passing()) {
		aqua_ring = false;
		confusion.reset();
		cursed = false;
		embargo.reset();
		focusing_energy = false;
		gastro_acid = false;
		ingrain_active = false;
		leech_seed = false;
		lock_on = false;
		magnet_rise.reset();
		perish_song.reset();
		power_trick = false;
		stage.reset();
		active_substitute.destroy();
	}
	attracted = false;
	charged = false;
	used_defense_curl = false;
	destiny_bond = false;
	encore.reset();
	flash_fire = false;
	flinched_this_turn = false;
	fully_trapped = false;
	heal_block.reset();
	identified = false;
	used_imprison = false;
	// Do I set to true or false? true makes it wrong when a fainted Pokemon is
	// replaced; false makes it wrong otherwise
	loaf = false;
	minimize = false;
	me_first = false;
	mud_sport = false;
	nightmares = false;
	partial_trap.reset();
	pass = false;
	rampage.reset();
	roosting = false;
	slow_start.reset();
	stockpile.reset();
	is_tormented = false;
	u_turning = false;
	water_sport = false;
	bide.reset();
	damage_done_to_active = 0;
	m_taunt.reset();
	toxic.reset();
	uproar.reset();
	// Whirlwind can hit Flying Pokemon, so it's possible to switch while
	// vanished. Therefore, we need to reset it.
	vanish.reset();
	yawn.reset();
	get_pokemon().reset_replacing();
	get_pokemon().move.for_each_regular_move([](Move & move) {
		move.reset();
	});
}

void ActivePokemon::reset_between_turns() {
	ch = false;
	fully_paralyzed = false;
	confusion.end_of_turn_reset();
	miss = false;
}

void ActivePokemon::clear_field() {
	clear_leech_seed();
	partial_trap.reset();
}

void ActivePokemon::update_before_move() {
	destiny_bond = false;
	lock_on = false;
	has_moved = true;
}

void ActivePokemon::clear_leech_seed() {
	leech_seed = false;
}

Ability const & ActivePokemon::ability() const {
	return get_pokemon().ability();
}

Ability & ActivePokemon::ability() {
	return get_pokemon().ability();
}

bool ActivePokemon::aqua_ring_is_active() const {
	return aqua_ring;
}

void ActivePokemon::activate_aqua_ring() {
	aqua_ring = true;
}

void ActivePokemon::attract() {
	attracted = true;
}

void ActivePokemon::awaken(bool const value) {
	awakening = value;
}

bool ActivePokemon::can_awaken() const {
	return status().can_awaken(ability());
}

Rational ActivePokemon::awaken_probability() const {
	return status().awaken_probability(ability(), awakening);
}

bool ActivePokemon::is_baton_passing() const {
	return pass;
}

void ActivePokemon::baton_pass() {
	pass = true;
}

bool ActivePokemon::cannot_be_koed() const {
	return enduring;
}

bool ActivePokemon::charge_boosted() const {
	return charged and move().type() == Type::Electric;
}

void ActivePokemon::charge() {
	charged = true;
}

bool ActivePokemon::can_confuse_with_chatter() const {
	return get_pokemon().can_confuse_with_chatter();
}

bool ActivePokemon::is_confused() const {
	return confusion.is_active();
}

void ActivePokemon::confuse() {
	if (!get_pokemon().ability().blocks_confusion())
		confusion.activate();
}

void ActivePokemon::handle_confusion() {
	confusion.do_turn(get_pokemon());
}

bool ActivePokemon::critical_hit() const {
	return ch;
}

void ActivePokemon::set_critical_hit(bool const value) {
	ch = value;
}

Rational ActivePokemon::critical_probability() const {
	constexpr unsigned ch_denominator = 16;
	return move().can_critical_hit() ?
		Rational(critical_hit() ? 1 : ch_denominator - 1, ch_denominator) :
		Rational(critical_hit() ? 0 : 1, 1);
}

void ActivePokemon::curse() {
	cursed = true;
}

bool ActivePokemon::is_cursed() const {
	return cursed;
}

void ActivePokemon::defense_curl() {
	used_defense_curl = true;
}

void ActivePokemon::use_destiny_bond() {
	destiny_bond = true;
}

bool ActivePokemon::defense_curled() const {
	return used_defense_curl;
}

void ActivePokemon::activate_embargo() {
	embargo.activate();
}

void ActivePokemon::decrement_embargo() {
	embargo.decrement();
}

bool ActivePokemon::is_encored() const {
	return encore.is_active();
}

void ActivePokemon::activate_encore() {
	encore.activate();
}

void ActivePokemon::increment_encore() {
	encore.increment();
}

void ActivePokemon::endure() {
	enduring = true;
}

bool ActivePokemon::is_fainted() const {
	return get_pokemon().is_fainted();
}

void ActivePokemon::faint() {
	get_pokemon().faint();
}

bool ActivePokemon::flash_fire_is_active() const {
	return flash_fire;
}

void ActivePokemon::activate_flash_fire() {
	flash_fire = true;
}

bool ActivePokemon::flinched() const {
	return flinched_this_turn;
}

void ActivePokemon::flinch() {
	flinched_this_turn = true;
}

void ActivePokemon::focus_energy() {
	focusing_energy = true;
}

void ActivePokemon::fully_trap() {
	fully_trapped = true;
}

void ActivePokemon::identify() {
	identified = true;
}

bool ActivePokemon::imprisoned() const {
	return used_imprison;
}

void ActivePokemon::imprison() {
	used_imprison = true;
}

PokemonCollection::index_type ActivePokemon::index() const {
	return all_pokemon().index();
}

bool ActivePokemon::ingrained() const {
	return ingrain_active;
}

void ActivePokemon::ingrain() {
	ingrain_active = true;
}

bool ActivePokemon::heal_block_is_active() const {
	return heal_block.is_active();
}

void ActivePokemon::activate_heal_block() {
	heal_block.activate();
}

void ActivePokemon::decrement_heal_block() {
	heal_block.decrement();
}

Item const & ActivePokemon::item() const {
	return get_pokemon().item();
}

Item & ActivePokemon::item() {
	return get_pokemon().item();
}

bool ActivePokemon::is_fully_paralyzed() const {
	return fully_paralyzed;
}

Gender const & ActivePokemon::gender() const {
	return get_pokemon().gender();
}

bool ActivePokemon::leech_seeded() const {
	return leech_seed;
}

void ActivePokemon::hit_with_leech_seed() {
	leech_seed = true;
}

unsigned ActivePokemon::level() const {
	return get_pokemon().level();
}

bool ActivePokemon::is_loafing() const {
	return ability().is_loafing(loaf);
}

void ActivePokemon::decrement_lock_in() {
	// Cannot be locked into Rampage and Uproar at the same time
	if (rampage.decrement())
		confuse();
	else
		uproar.increment();
}

bool ActivePokemon::locked_on() const {
	return lock_on;
}

void ActivePokemon::lock_on_to() {
	lock_on = true;
}

void ActivePokemon::lower_pp(Ability const & target) {
	if (move().is_regular() and !is_locked_in_to_bide())
		regular_move().pp.decrement(target);
}

bool ActivePokemon::magnet_rise_is_active() const {
	return magnet_rise.is_active();
}

void ActivePokemon::activate_magnet_rise() {
	magnet_rise.activate();
}

void ActivePokemon::decrement_magnet_rise() {
	magnet_rise.decrement();
}

bool ActivePokemon::me_first_is_active() const {
	return me_first;
}

bool ActivePokemon::minimized() const {
	return minimize;
}

bool ActivePokemon::missed() const {
	return miss;
}

void ActivePokemon::set_miss(bool const value) {
	miss = value;
}

void ActivePokemon::set_moved(bool const value) {
	has_moved = value;
}

bool ActivePokemon::moved() const {
	return has_moved;
}

bool ActivePokemon::moved_since_switch() const {
	return get_pokemon().move.moved_since_switch();
}

void ActivePokemon::activate_mud_sport() {
	mud_sport = true;
}

Species ActivePokemon::name() const {
	return get_pokemon().name();
}

Nature const & ActivePokemon::nature() const {
	return get_pokemon().nature();
}

bool ActivePokemon::nightmare() const {
	return nightmares;
}

void ActivePokemon::give_nightmares() {
	nightmares = true;
}

void ActivePokemon::partially_trap(bool const extended) {
	partial_trap.activate(extended);
}

void ActivePokemon::partial_trap_damage() {
	partial_trap.damage(get_pokemon());
}

void ActivePokemon::activate_perish_song() {
	perish_song.activate();
}

void ActivePokemon::perish_song_turn() {
	bool const faints_this_turn = perish_song.next_turn();
	if (faints_this_turn) {
		faint();
	}
}

bool ActivePokemon::can_be_phazed() const {
	return !ingrained() and !ability().blocks_phazing() and all_pokemon().size() > 1;
}

unsigned ActivePokemon::power_of_mass_based_moves() const {
	return get_pokemon().power_of_mass_based_moves();
}

bool ActivePokemon::power_trick_is_active() const {
	return power_trick;
}

void ActivePokemon::activate_power_trick() {
	power_trick = !power_trick;
}

void ActivePokemon::protect() {
	protecting = true;
}

void ActivePokemon::break_protect() {
	protecting = false;
}

void ActivePokemon::activate_rampage() {
	rampage.activate();
}

bool ActivePokemon::recharging() const {
	return recharge_lock_in;
}

bool ActivePokemon::recharge() {
	bool const return_value = recharging();
	recharge_lock_in = false;
	return return_value;
}

void ActivePokemon::use_recharge_move() {
	recharge_lock_in = true;
}

bool ActivePokemon::is_roosting() const {
	return roosting;
}

void ActivePokemon::roost() {
	roosting = true;
}

bool ActivePokemon::shed_skin_activated() const {
	return shedding_skin;
}

void ActivePokemon::shed_skin(bool const value) {
	shedding_skin = value;
}

Rational ActivePokemon::shed_skin_probability() const {
	if (!can_clear_status()) {
		return Rational(shed_skin_activated() ? 0 : 1, 1);
	}
	Rational const result(3, 10);
	return shed_skin_activated() ? result : complement(result);
}

void ActivePokemon::increase_sleep_counter() {
	status().increase_sleep_counter(ability(), awakening);
}

bool ActivePokemon::slow_start_is_active() const {
	return slow_start.is_active();
}

bool ActivePokemon::sport_is_active(Move const & foe_move) const {
	if (foe_move.type() == Type::Electric)
		return mud_sport;
	else if (foe_move.type() == Type::Fire)
		return water_sport;
	else
		return false;
}

Rational ActivePokemon::hp_ratio() const {
	return get_pokemon().current_hp();
}

int ActivePokemon::current_stage(Stat::Stats const stat_index) const {
	return stage[stat_index];
}

unsigned ActivePokemon::positive_stat_boosts() const {
	auto const positive_values = [](int const stage) { return static_cast<unsigned>(std::max(stage, 0)); };
	return stage.accumulate(positive_values);
}

void ActivePokemon::stat_boost(Stat::Stats const stat_index, int const n) {
	stage.boost(stat_index, n);
}

void ActivePokemon::stat_boost_physical(int n) {
	stage.boost_physical(n);
}

void ActivePokemon::stat_boost_special(int n) {
	stage.boost_special(n);
}

void ActivePokemon::stat_boost_regular(int n) {
	stage.boost_regular(n);
}

void ActivePokemon::stat_boost_defensive(int const n) {
	stage.boost_defensive(n);
}

void ActivePokemon::stat_boost_offensive(int const n) {
	stage.boost_offensive(n);
}

void ActivePokemon::reset_stats() {
	stage.reset();
}

void ActivePokemon::copy_stat_boosts(ActivePokemon const & other) {
	stage = other.stage;
}

void ActivePokemon::swap_defensive_stages(ActivePokemon & lhs, ActivePokemon & rhs) {
	Stage::swap_defensive(lhs.stage, rhs.stage);
}

void ActivePokemon::swap_offensive_stages(ActivePokemon & lhs, ActivePokemon & rhs) {
	Stage::swap_offensive(lhs.stage, rhs.stage);
}

void ActivePokemon::swap_stat_boosts(ActivePokemon & lhs, ActivePokemon & rhs) {
	using std::swap;
	swap(lhs.stage, rhs.stage);
}

Status const & ActivePokemon::status() const {
	return get_pokemon().status();
}

Status & ActivePokemon::status() {
	return get_pokemon().status();
}

bool ActivePokemon::can_clear_status() const {
	return ability().can_clear_status(status());
}

unsigned ActivePokemon::spit_up_power() const {
	return stockpile.spit_up_power();
}

void ActivePokemon::increment_stockpile() {
	bool const increased = stockpile.increment();
	if (increased)
		stat_boost_defensive(1);
}

int ActivePokemon::release_stockpile() {
	int const stages = stockpile.release();
	stat_boost_defensive(-stages);
	return stages;
}

bool ActivePokemon::is_switching_to_self () const {
	return all_pokemon().is_switching_to_self();
}

bool ActivePokemon::is_switching_to_self (Move const & switch_move) const {
	return all_pokemon().is_switching_to_self(switch_move);
}

bool ActivePokemon::has_switched() const {
	return moved() and move().is_switch();
}

bool ActivePokemon::switch_decision_required() const {
	return pass or u_turning or will_be_replaced();
}

void ActivePokemon::switch_pokemon() {
	get_pokemon().switch_out();
	all_pokemon().to_replacement();
}

void ActivePokemon::switch_in() {
	get_pokemon().switch_in();
}

void ActivePokemon::update_to_correct_switch() {
	get_pokemon().move.set_index(Move::from_replacement(all_pokemon().replacement()));
}

bool ActivePokemon::trapped() const {
	return fully_trapped or ingrained() or partial_trap;
}

bool ActivePokemon::tormented() const {
	return is_tormented;
}

void ActivePokemon::torment() {
	is_tormented = true;
}

void ActivePokemon::taunt() {
	m_taunt.activate();
}

bool ActivePokemon::is_taunted() const {
	return m_taunt.is_active();
}

void ActivePokemon::increment_taunt() {
	m_taunt.increment();
}

Rational ActivePokemon::toxic_ratio() const {
	return toxic.ratio_drained();
}

void ActivePokemon::increment_toxic() {
	toxic.increment();
}

TypeCollection const & ActivePokemon::type() const {
	return get_pokemon().type();
}

void ActivePokemon::u_turn() {
	u_turning = true;
}

void ActivePokemon::use_uproar() {
	uproar.increment();
}

bool ActivePokemon::vanish_doubles_power(Moves const move_name) const {
	return vanish.doubles_move_power(move_name);
}

void ActivePokemon::activate_water_sport() {
	water_sport = true;
}

bool ActivePokemon::decrement_yawn() {
	return yawn.decrement();
}

void ActivePokemon::hit_with_yawn() {
	yawn.activate();
}

bool ActivePokemon::bounce() {
	return vanish.bounce();
}
bool ActivePokemon::dig() {
	return vanish.dig();
}
bool ActivePokemon::dive() {
	return vanish.dive();
}
bool ActivePokemon::fly() {
	return vanish.fly();
}
bool ActivePokemon::shadow_force() {
	return vanish.shadow_force();
}

void ActivePokemon::use_bide(Pokemon & target) {
	if (!bide.is_active()) {
		bide.activate();
	}
	else {
		unsigned const bide_damage = bide.decrement();
		if (bide_damage != 0)
			target.apply_damage(bide_damage * 2);
	}
}

void ActivePokemon::use_substitute() {
	if (!get_pokemon().can_use_substitute())
		return;
	bool const created = active_substitute.create(stat(Stat::HP).max);
	if (created) {
		indirect_damage(stat(Stat::HP).max / 4);
	}
}

bool ActivePokemon::is_locked_in_to_bide() const {
	return bide.is_active();
}

unsigned ActivePokemon::damaged() const {
	return damage_done_to_active;
}

Rational ActivePokemon::random_damage_multiplier() const {
	return random_damage();
}

void ActivePokemon::direct_damage(unsigned damage) {
	damage = get_pokemon().apply_damage(damage);
	damage_done_to_active = damage;
	bide.add_damage(damage);
}

void ActivePokemon::indirect_damage(unsigned const damage) {
	get_pokemon().apply_damage(damage);
}

void ActivePokemon::register_damage(unsigned const damage) {
	damage_done_to_active = damage;
}

void ActivePokemon::increment_move_use_counter() {
	if (move().is_regular()) {
		regular_move().increment_use_counter();
	}
}

void ActivePokemon::update_chance_to_hit(ActivePokemon const & target, Weather const & weather, bool target_moved) {
	cached_chance_to_hit.update(*this, target, weather, target_moved);
}

ChanceToHit::value_type ActivePokemon::accuracy_probability() const {
	return miss ? cached_chance_to_hit.inverse() : cached_chance_to_hit();
}

bool ActivePokemon::can_miss() const {
	return cached_chance_to_hit.can_miss();
}

bool ActivePokemon::will_be_replaced() const {
	return get_pokemon().will_be_replaced();
}

void ActivePokemon::normalize_hp(bool fainted) {
	if (fainted) {
		faint();
	}
	else if (stat(Stat::HP).stat == 0) {
		stat(Stat::HP).stat = 1;
	}
}

ActivePokemon::hash_type ActivePokemon::hash() const {
	hash_type current_hash = 0;
	current_hash *= m_all_pokemon.max_hash();
	current_hash += m_all_pokemon.hash();
	current_hash *= active_substitute.max_hash();
	current_hash += active_substitute.hash();
	current_hash *= bide.max_hash();
	current_hash += bide.hash();
	current_hash *= confusion.max_hash();
	current_hash += confusion.hash();
	current_hash *= embargo.max_hash();
	current_hash += embargo.hash();
	current_hash *= encore.max_hash();
	current_hash += encore.hash();
	current_hash *= heal_block.max_hash();
	current_hash += heal_block.hash();
	current_hash *= magnet_rise.max_hash();
	current_hash += magnet_rise.hash();
	current_hash *= partial_trap.max_hash();
	current_hash += partial_trap.hash();
	current_hash *= perish_song.max_hash();
	current_hash += perish_song.hash();
	current_hash *= rampage.max_hash();
	current_hash += rampage.hash();
	current_hash *= slow_start.max_hash();
	current_hash += slow_start.hash();
	current_hash *= stage.max_hash();
	current_hash += stage.hash();
	current_hash *= stockpile.max_hash();
	current_hash += stockpile.hash();
	current_hash *= m_taunt.max_hash();
	current_hash += m_taunt.hash();
	current_hash *= toxic.max_hash();
	current_hash += toxic.hash();
	current_hash *= uproar.max_hash();
	current_hash += uproar.hash();
	current_hash *= vanish.max_hash();
	current_hash += vanish.hash();
	current_hash *= yawn.max_hash();
	current_hash += yawn.hash();
	current_hash *= 2;
	current_hash += aqua_ring;
	current_hash *= 2;
	current_hash += attracted;
	current_hash *= 2;
	current_hash += charged;
	current_hash *= 2;
	current_hash += cursed;
	current_hash *= 2;
	current_hash += used_defense_curl;
	current_hash *= 2;
	current_hash += destiny_bond;
	current_hash *= 2;
	current_hash += flash_fire;
	current_hash *= 2;
	current_hash += focusing_energy;
	current_hash *= 2;
	current_hash += fully_trapped;
	current_hash *= 2;
	current_hash += gastro_acid;
	current_hash *= 2;
	current_hash += identified;
	current_hash *= 2;
	current_hash += used_imprison;
	current_hash *= 2;
	current_hash += ingrain_active;
	current_hash *= 2;
	current_hash += leech_seed;
	current_hash *= 2;
	current_hash += loaf;
	current_hash *= 2;
	current_hash += lock_on;
	current_hash *= 2;
	current_hash += minimize;
	current_hash *= 2;
	current_hash += mud_sport;
	current_hash *= 2;
	current_hash += nightmares;
	current_hash *= 2;
	current_hash += power_trick;
	current_hash *= 2;
	current_hash += recharge_lock_in;
	current_hash *= 2;
	current_hash += is_tormented;
	current_hash *= 2;
	current_hash += water_sport;
	return current_hash;
}

ActivePokemon::hash_type ActivePokemon::max_hash() const {
	hash_type current_hash = m_all_pokemon.max_hash();
	current_hash *= active_substitute.max_hash();
	current_hash *= bide.max_hash();
	current_hash *= confusion.max_hash();
	current_hash *= embargo.max_hash();
	current_hash *= encore.max_hash();
	current_hash *= heal_block.max_hash();
	current_hash *= magnet_rise.max_hash();
	current_hash *= partial_trap.max_hash();
	current_hash *= perish_song.max_hash();
	current_hash *= rampage.max_hash();
	current_hash *= slow_start.max_hash();
	current_hash *= stage.max_hash();
	current_hash *= stockpile.max_hash();
	current_hash *= m_taunt.max_hash();
	current_hash *= toxic.max_hash();
	current_hash *= uproar.max_hash();
	current_hash *= vanish.max_hash();
	current_hash *= yawn.max_hash();
	current_hash *= 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2;
	return current_hash;
}

bool operator== (ActivePokemon const & lhs, ActivePokemon const & rhs) {
	return
			lhs.m_all_pokemon == rhs.m_all_pokemon and
			lhs.aqua_ring == rhs.aqua_ring and
			lhs.attracted == rhs.attracted and
			lhs.bide == rhs.bide and
			lhs.charged == rhs.charged and
			lhs.confusion == rhs.confusion and
			lhs.cursed == rhs.cursed and
			lhs.used_defense_curl == rhs.used_defense_curl and
			lhs.destiny_bond == rhs.destiny_bond and
			lhs.embargo == rhs.embargo and
			lhs.encore == rhs.encore and
			lhs.flash_fire == rhs.flash_fire and
			lhs.focusing_energy == rhs.focusing_energy and
			lhs.fully_trapped == rhs.fully_trapped and
			lhs.heal_block == rhs.heal_block and
			lhs.identified == rhs.identified and
			lhs.used_imprison == rhs.used_imprison and
			lhs.ingrain_active == rhs.ingrain_active and
			lhs.leech_seed == rhs.leech_seed and
			lhs.loaf == rhs.loaf and
			lhs.lock_on == rhs.lock_on and
			lhs.magnet_rise == rhs.magnet_rise and
			lhs.minimize == rhs.minimize and
			lhs.mud_sport == rhs.mud_sport and
			lhs.nightmares == rhs.nightmares and
			lhs.partial_trap == rhs.partial_trap and
			lhs.perish_song == rhs.perish_song and
			lhs.rampage == rhs.rampage and
			lhs.slow_start == rhs.slow_start and
			lhs.stage == rhs.stage and
			lhs.stockpile == rhs.stockpile and
			lhs.m_taunt == rhs.m_taunt and
			lhs.is_tormented == rhs.is_tormented and
			lhs.toxic == rhs.toxic and
			lhs.uproar == rhs.uproar and
			lhs.vanish == rhs.vanish and
			lhs.water_sport == rhs.water_sport and
			lhs.yawn == rhs.yawn;
}

bool operator!= (ActivePokemon const & lhs, ActivePokemon const & rhs) {
	return !(lhs == rhs);
}

}	// namespace technicalmachine