1#![allow(unused_variables)]
2use super::abilities::Abilities;
3use super::damage_calc::type_effectiveness_modifier;
4use super::generate_instructions::{apply_boost_instruction, immune_to_status};
5use super::state::Terrain;
6use crate::choices::{Choice, Choices, Effect, MoveCategory, MoveTarget, Secondary, StatBoosts};
7use crate::define_enum_with_from_str;
8use crate::engine::generate_instructions::add_remove_status_instructions;
9use crate::instruction::{
10 ChangeItemInstruction, ChangeStatusInstruction, DamageInstruction, DisableMoveInstruction,
11 HealInstruction, Instruction, StateInstructions,
12};
13use crate::pokemon::PokemonName;
14use crate::state::{
15 Pokemon, PokemonBoostableStat, PokemonStatus, PokemonType, Side, SideReference, State,
16};
17use std::cmp;
18
19#[cfg(feature = "gen4")]
20use super::state::PokemonVolatileStatus;
21
22define_enum_with_from_str! {
23 #[repr(u8)]
24 #[derive(Debug, PartialEq, Clone, Copy)]
25 Items {
26 NONE,
27 UNKNOWNITEM,
28 ABSORBBULB,
29 ADRENALINEORB,
30 ADAMANTORB,
31 ADAMANTCRYSTAL,
32 AIRBALLOON,
33 ASSAULTVEST,
34 BABIRIBERRY,
35 BLACKBELT,
36 BLACKSLUDGE,
37 BLACKGLASSES,
38 BLANKPLATE,
39 BOOSTERENERGY,
40 CELLBATTERY,
41 CHARCOAL,
42 CHARTIBERRY,
43 CHILANBERRY,
44 CHOICEBAND,
45 CHOICESPECS,
46 CHOICESCARF,
47 CHOPLEBERRY,
48 COBABERRY,
49 COLBURBERRY,
50 COVERTCLOAK,
51 CUSTAPBERRY,
52 DRAGONFANG,
53 DRAGONSCALE,
54 DREADPLATE,
55 EARTHPLATE,
56 ELECTRICSEED,
57 EXPERTBELT,
58 EVIOLITE,
59 FAIRYFEATHER,
60 FISTPLATE,
61 FLAMEORB,
62 GRASSYSEED,
63 HABANBERRY,
64 KASIBBERRY,
65 KEBIABERRY,
66 LEFTOVERS,
67 LIFEORB,
68 LUSTROUSORB,
69 LUSTROUSGLOBE,
70 METALCOAT,
71 MISTYSEED,
72 MUSCLEBAND,
73 MYSTICWATER,
74 NEVERMELTICE,
75 PINKBOW,
76 POLKADOTBOW,
77 OCCABERRY,
78 ODDINCENSE,
79 PASSHOBERRY,
80 PAYAPABERRY,
81 POISONBARB,
82 POWERHERB,
83 PSYCHICSEED,
84 PUNCHINGGLOVE,
85 RINDOBERRY,
86 ROSELIBERRY,
87 ROCKYHELMET,
88 SEAINCENSE,
89 SHARPBEAK,
90 SPELLTAG,
91 MIRACLESEED,
92 SHELLBELL,
93 SHUCABERRY,
94 SILKSCARF,
95 SILVERPOWDER,
96 SKYPLATE,
97 SOFTSAND,
98 SOULDEW,
99 GRISEOUSORB,
100 GRISEOUSCORE,
101 TANGABERRY,
102 THROATSPRAY,
103 THICKCLUB,
104 TOXICORB,
105 TOXICPLATE,
106 TWISTEDSPOON,
107 HARDSTONE,
108 METALPOWDER,
109 WACANBERRY,
110 WAVEINCENSE,
111 MAGNET,
112 WEAKNESSPOLICY,
113 WISEGLASSES,
114 BLUNDERPOLICY,
115 HEAVYDUTYBOOTS,
116 CLEARAMULET,
117 PROTECTIVEPADS,
118 SHEDSHELL,
119 YACHEBERRY,
120 STONEPLATE,
121 INSECTPLATE,
122 SPOOKYPLATE,
123 IRONBALL,
124 IRONPLATE,
125 FLAMEPLATE,
126 SPLASHPLATE,
127 MEADOWPLATE,
128 ZAPPLATE,
129 MINDPLATE,
130 ICICLEPLATE,
131 DRACOPLATE,
132 PIXIEPLATE,
133 LIGHTBALL,
134 FOCUSSASH,
135 CHESTOBERRY,
136 LUMBERRY,
137 SITRUSBERRY,
138 PETAYABERRY,
139 SALACBERRY,
140 LIECHIBERRY,
141 NORMALGEM,
142 BUGGEM,
143 ELECTRICGEM,
144 FIGHTINGGEM,
145 GHOSTGEM,
146 PSYCHICGEM,
147 FLYINGGEM,
148 STEELGEM,
149 ICEGEM,
150 POISONGEM,
151 FIREGEM,
152 DRAGONGEM,
153 GROUNDGEM,
154 WATERGEM,
155 DARKGEM,
156 ROCKGEM,
157 GRASSGEM,
158 FAIRYGEM,
159 BUGMEMORY,
160 FIGHTINGMEMORY,
161 GHOSTMEMORY,
162 PSYCHICMEMORY,
163 FLYINGMEMORY,
164 STEELMEMORY,
165 ICEMEMORY,
166 POISONMEMORY,
167 FIREMEMORY,
168 DRAGONMEMORY,
169 GROUNDMEMORY,
170 WATERMEMORY,
171 DARKMEMORY,
172 ROCKMEMORY,
173 GRASSMEMORY,
174 FAIRYMEMORY,
175 ELECTRICMEMORY,
176 WELLSPRINGMASK,
177 HEARTHFLAMEMASK,
178 CORNERSTONEMASK,
179 WIDELENS,
180 LOADEDDICE,
181 RUSTEDSWORD,
182 RUSTEDSHIELD,
183 WHITEHERB,
184
185 VENUSAURITE,
187 CHARIZARDITEX,
188 CHARIZARDITEY,
189 BLASTOISINITE,
190 BEEDRILLITE,
191 PIDGEOTITE,
192 ALAKAZITE,
193 SLOWBRONITE,
194 GENGARITE,
195 KANGASKHANITE,
196 PINSIRITE,
197 GYARADOSITE,
198 AERODACTYLITE,
199 MEWTWONITEX,
200 MEWTWONITEY,
201 AMPHAROSITE,
202 STEELIXITE,
203 SCIZORITE,
204 HERACRONITE,
205 HOUNDOOMINITE,
206 TYRANITARITE,
207 SCEPTILITE,
208 BLAZIKENITE,
209 SWAMPERTITE,
210 GARDEVOIRITE,
211 SABLENITE,
212 MAWILITE,
213 AGGRONITE,
214 MEDICHAMITE,
215 MANECTITE,
216 SHARPEDONITE,
217 CAMERUPTITE,
218 ALTARIANITE,
219 BANETTITE,
220 ABSOLITE,
221 GLALITITE,
222 SALAMENCITE,
223 METAGROSSITE,
224 LATIASITE,
225 LATIOSITE,
226 LOPUNNITE,
227 GARCHOMPITE,
228 LUCARIONITE,
229 ABOMASITE,
230 GALLADITE,
231 AUDINITE,
232 DIANCITE,
233 },
234 default = UNKNOWNITEM
235}
236
237pub fn get_choice_move_disable_instructions(
238 pkmn: &Pokemon,
239 side_ref: &SideReference,
240 move_name: &Choices,
241) -> Vec<Instruction> {
242 let mut moves_to_disable = vec![];
243 let mut iter = pkmn.moves.into_iter();
244 while let Some(p) = iter.next() {
245 if &p.id != move_name && p.disabled == false {
246 moves_to_disable.push(Instruction::DisableMove(DisableMoveInstruction {
247 side_ref: *side_ref,
248 move_index: iter.pokemon_move_index,
249 }));
250 }
251 }
252 moves_to_disable
253}
254
255fn damage_reduction_berry(
256 defending_pkmn: &mut Pokemon,
257 attacking_side_ref: &SideReference,
258 choice: &mut Choice,
259 berry: Items,
260 pkmn_type: &PokemonType,
261 instructions: &mut StateInstructions,
262) {
263 if &choice.move_type == pkmn_type
264 && type_effectiveness_modifier(pkmn_type, &defending_pkmn) > 1.0
265 {
266 instructions
267 .instruction_list
268 .push(Instruction::ChangeItem(ChangeItemInstruction {
269 side_ref: attacking_side_ref.get_other_side(),
270 current_item: berry,
271 new_item: Items::NONE,
272 }));
273 defending_pkmn.item = Items::NONE;
274 choice.base_power /= 2.0;
275 }
276}
277
278fn power_up_gem(
282 attacking_side_ref: &SideReference,
283 attacking_pkmn: &mut Pokemon,
284 choice: &mut Choice,
285 gem_type: PokemonType,
286 instructions: &mut StateInstructions,
287) {
288 if &choice.move_type == &gem_type {
289 #[cfg(feature = "gen5")]
290 {
291 choice.base_power *= 1.5;
292 }
293 #[cfg(not(feature = "gen5"))]
294 {
295 choice.base_power *= 1.3;
296 }
297
298 instructions
299 .instruction_list
300 .push(Instruction::ChangeItem(ChangeItemInstruction {
301 side_ref: *attacking_side_ref,
302 current_item: attacking_pkmn.item,
303 new_item: Items::NONE,
304 }));
305 attacking_pkmn.item = Items::NONE;
306 }
307}
308
309fn lum_berry(
317 side_ref: &SideReference,
318 attacking_side: &mut Side,
319 instructions: &mut StateInstructions,
320) {
321 let active_index = attacking_side.active_index;
322 let active_pkmn = attacking_side.get_active();
323 instructions
324 .instruction_list
325 .push(Instruction::ChangeStatus(ChangeStatusInstruction {
326 side_ref: *side_ref,
327 pokemon_index: active_index,
328 new_status: PokemonStatus::NONE,
329 old_status: active_pkmn.status,
330 }));
331 active_pkmn.status = PokemonStatus::NONE;
332 instructions
333 .instruction_list
334 .push(Instruction::ChangeItem(ChangeItemInstruction {
335 side_ref: *side_ref,
336 current_item: Items::LUMBERRY,
337 new_item: Items::NONE,
338 }));
339 active_pkmn.item = Items::NONE;
340}
341
342fn sitrus_berry(
343 side_ref: &SideReference,
344 attacking_side: &mut Side,
345 instructions: &mut StateInstructions,
346) {
347 let active_pkmn = attacking_side.get_active();
348 let heal_amount = cmp::min(active_pkmn.maxhp / 4, active_pkmn.maxhp - active_pkmn.hp);
349 instructions
350 .instruction_list
351 .push(Instruction::Heal(HealInstruction {
352 side_ref: *side_ref,
353 heal_amount: heal_amount,
354 }));
355 active_pkmn.hp += heal_amount;
356 instructions
357 .instruction_list
358 .push(Instruction::ChangeItem(ChangeItemInstruction {
359 side_ref: *side_ref,
360 current_item: Items::SITRUSBERRY,
361 new_item: Items::NONE,
362 }));
363 active_pkmn.item = Items::NONE;
364}
365
366fn chesto_berry(
367 side_ref: &SideReference,
368 attacking_side: &mut Side,
369 instructions: &mut StateInstructions,
370) {
371 let active_index = attacking_side.active_index;
372 let active_pkmn = attacking_side.get_active();
373 instructions
374 .instruction_list
375 .push(Instruction::ChangeItem(ChangeItemInstruction {
376 side_ref: *side_ref,
377 current_item: Items::CHESTOBERRY,
378 new_item: Items::NONE,
379 }));
380 active_pkmn.item = Items::NONE;
381 add_remove_status_instructions(instructions, active_index, *side_ref, attacking_side);
382}
383
384fn boost_berry(
385 side_ref: &SideReference,
386 state: &mut State,
387 stat: PokemonBoostableStat,
388 instructions: &mut StateInstructions,
389) {
390 apply_boost_instruction(
391 state.get_side(side_ref),
392 &stat,
393 &1,
394 side_ref,
395 side_ref,
396 instructions,
397 );
398 let attacker = state.get_side(side_ref).get_active();
399 instructions
400 .instruction_list
401 .push(Instruction::ChangeItem(ChangeItemInstruction {
402 side_ref: *side_ref,
403 current_item: attacker.item,
404 new_item: Items::NONE,
405 }));
406 attacker.item = Items::NONE;
407}
408
409pub fn item_before_move(
410 state: &mut State,
411 choice: &mut Choice,
412 side_ref: &SideReference,
413 instructions: &mut StateInstructions,
414) {
415 let (attacking_side, defending_side) = state.get_both_sides(side_ref);
416 let active_pkmn = attacking_side.get_active();
417 let defending_pkmn = defending_side.get_active();
418 match defending_pkmn.item {
419 Items::CHOPLEBERRY => damage_reduction_berry(
420 defending_pkmn,
421 side_ref,
422 choice,
423 Items::CHOPLEBERRY,
424 &PokemonType::FIGHTING,
425 instructions,
426 ),
427 Items::BABIRIBERRY => damage_reduction_berry(
428 defending_pkmn,
429 side_ref,
430 choice,
431 Items::BABIRIBERRY,
432 &PokemonType::STEEL,
433 instructions,
434 ),
435 Items::CHARTIBERRY => damage_reduction_berry(
436 defending_pkmn,
437 side_ref,
438 choice,
439 Items::CHARTIBERRY,
440 &PokemonType::ROCK,
441 instructions,
442 ),
443 Items::CHILANBERRY => {
444 if &choice.move_type == &PokemonType::NORMAL {
446 instructions.instruction_list.push(Instruction::ChangeItem(
447 ChangeItemInstruction {
448 side_ref: side_ref.get_other_side(),
449 current_item: Items::CHILANBERRY,
450 new_item: Items::NONE,
451 },
452 ));
453 defending_pkmn.item = Items::NONE;
454 choice.base_power /= 2.0;
455 }
456 }
457 Items::COBABERRY => damage_reduction_berry(
458 defending_pkmn,
459 side_ref,
460 choice,
461 Items::COBABERRY,
462 &PokemonType::FLYING,
463 instructions,
464 ),
465 Items::COLBURBERRY => damage_reduction_berry(
466 defending_pkmn,
467 side_ref,
468 choice,
469 Items::COLBURBERRY,
470 &PokemonType::DARK,
471 instructions,
472 ),
473 Items::HABANBERRY => damage_reduction_berry(
474 defending_pkmn,
475 side_ref,
476 choice,
477 Items::HABANBERRY,
478 &PokemonType::DRAGON,
479 instructions,
480 ),
481 Items::KASIBBERRY => damage_reduction_berry(
482 defending_pkmn,
483 side_ref,
484 choice,
485 Items::KASIBBERRY,
486 &PokemonType::GHOST,
487 instructions,
488 ),
489 Items::KEBIABERRY => damage_reduction_berry(
490 defending_pkmn,
491 side_ref,
492 choice,
493 Items::KEBIABERRY,
494 &PokemonType::POISON,
495 instructions,
496 ),
497 Items::OCCABERRY => damage_reduction_berry(
498 defending_pkmn,
499 side_ref,
500 choice,
501 Items::OCCABERRY,
502 &PokemonType::FIRE,
503 instructions,
504 ),
505 Items::PASSHOBERRY => damage_reduction_berry(
506 defending_pkmn,
507 side_ref,
508 choice,
509 Items::PASSHOBERRY,
510 &PokemonType::WATER,
511 instructions,
512 ),
513 Items::PAYAPABERRY => damage_reduction_berry(
514 defending_pkmn,
515 side_ref,
516 choice,
517 Items::PAYAPABERRY,
518 &PokemonType::PSYCHIC,
519 instructions,
520 ),
521 Items::RINDOBERRY => damage_reduction_berry(
522 defending_pkmn,
523 side_ref,
524 choice,
525 Items::RINDOBERRY,
526 &PokemonType::GRASS,
527 instructions,
528 ),
529 Items::ROSELIBERRY => damage_reduction_berry(
530 defending_pkmn,
531 side_ref,
532 choice,
533 Items::ROSELIBERRY,
534 &PokemonType::FAIRY,
535 instructions,
536 ),
537 Items::SHUCABERRY => damage_reduction_berry(
538 defending_pkmn,
539 side_ref,
540 choice,
541 Items::SHUCABERRY,
542 &PokemonType::GROUND,
543 instructions,
544 ),
545 Items::TANGABERRY => damage_reduction_berry(
546 defending_pkmn,
547 side_ref,
548 choice,
549 Items::TANGABERRY,
550 &PokemonType::BUG,
551 instructions,
552 ),
553 Items::WACANBERRY => damage_reduction_berry(
554 defending_pkmn,
555 side_ref,
556 choice,
557 Items::WACANBERRY,
558 &PokemonType::ELECTRIC,
559 instructions,
560 ),
561 Items::YACHEBERRY => damage_reduction_berry(
562 defending_pkmn,
563 side_ref,
564 choice,
565 Items::YACHEBERRY,
566 &PokemonType::ICE,
567 instructions,
568 ),
569 _ => {}
570 }
571 match active_pkmn.item {
572 Items::NORMALGEM => power_up_gem(
573 side_ref,
574 active_pkmn,
575 choice,
576 PokemonType::NORMAL,
577 instructions,
578 ),
579 Items::BUGGEM => power_up_gem(
580 side_ref,
581 active_pkmn,
582 choice,
583 PokemonType::BUG,
584 instructions,
585 ),
586 Items::ELECTRICGEM => power_up_gem(
587 side_ref,
588 active_pkmn,
589 choice,
590 PokemonType::ELECTRIC,
591 instructions,
592 ),
593 Items::FIGHTINGGEM => power_up_gem(
594 side_ref,
595 active_pkmn,
596 choice,
597 PokemonType::FIGHTING,
598 instructions,
599 ),
600 Items::GHOSTGEM => power_up_gem(
601 side_ref,
602 active_pkmn,
603 choice,
604 PokemonType::GHOST,
605 instructions,
606 ),
607 Items::PSYCHICGEM => power_up_gem(
608 side_ref,
609 active_pkmn,
610 choice,
611 PokemonType::PSYCHIC,
612 instructions,
613 ),
614 Items::FLYINGGEM => power_up_gem(
615 side_ref,
616 active_pkmn,
617 choice,
618 PokemonType::FLYING,
619 instructions,
620 ),
621 Items::STEELGEM => power_up_gem(
622 side_ref,
623 active_pkmn,
624 choice,
625 PokemonType::STEEL,
626 instructions,
627 ),
628 Items::ICEGEM => power_up_gem(
629 side_ref,
630 active_pkmn,
631 choice,
632 PokemonType::ICE,
633 instructions,
634 ),
635 Items::POISONGEM => power_up_gem(
636 side_ref,
637 active_pkmn,
638 choice,
639 PokemonType::POISON,
640 instructions,
641 ),
642 Items::FIREGEM => power_up_gem(
643 side_ref,
644 active_pkmn,
645 choice,
646 PokemonType::FIRE,
647 instructions,
648 ),
649 Items::DRAGONGEM => power_up_gem(
650 side_ref,
651 active_pkmn,
652 choice,
653 PokemonType::DRAGON,
654 instructions,
655 ),
656 Items::GROUNDGEM => power_up_gem(
657 side_ref,
658 active_pkmn,
659 choice,
660 PokemonType::GROUND,
661 instructions,
662 ),
663 Items::WATERGEM => power_up_gem(
664 side_ref,
665 active_pkmn,
666 choice,
667 PokemonType::WATER,
668 instructions,
669 ),
670 Items::DARKGEM => power_up_gem(
671 side_ref,
672 active_pkmn,
673 choice,
674 PokemonType::DARK,
675 instructions,
676 ),
677 Items::ROCKGEM => power_up_gem(
678 side_ref,
679 active_pkmn,
680 choice,
681 PokemonType::ROCK,
682 instructions,
683 ),
684 Items::GRASSGEM => power_up_gem(
685 side_ref,
686 active_pkmn,
687 choice,
688 PokemonType::GRASS,
689 instructions,
690 ),
691 Items::FAIRYGEM => power_up_gem(
692 side_ref,
693 active_pkmn,
694 choice,
695 PokemonType::FAIRY,
696 instructions,
697 ),
698 Items::LUMBERRY if active_pkmn.status != PokemonStatus::NONE => {
699 lum_berry(side_ref, attacking_side, instructions)
700 }
701 Items::SITRUSBERRY
702 if active_pkmn.ability == Abilities::GLUTTONY
703 && active_pkmn.hp <= active_pkmn.maxhp / 2 =>
704 {
705 sitrus_berry(side_ref, attacking_side, instructions)
706 }
707 Items::SITRUSBERRY if active_pkmn.hp <= active_pkmn.maxhp / 4 => {
708 sitrus_berry(side_ref, attacking_side, instructions)
709 }
710 Items::CHESTOBERRY if active_pkmn.status == PokemonStatus::SLEEP => {
711 chesto_berry(side_ref, attacking_side, instructions)
712 }
713 Items::PETAYABERRY if active_pkmn.hp <= active_pkmn.maxhp / 4 => boost_berry(
714 side_ref,
715 state,
716 PokemonBoostableStat::SpecialAttack,
717 instructions,
718 ),
719 Items::LIECHIBERRY if active_pkmn.hp <= active_pkmn.maxhp / 4 => {
720 boost_berry(side_ref, state, PokemonBoostableStat::Attack, instructions)
721 }
722 Items::SALACBERRY if active_pkmn.hp <= active_pkmn.maxhp / 4 => {
723 boost_berry(side_ref, state, PokemonBoostableStat::Speed, instructions)
724 }
725 Items::CHOICESPECS | Items::CHOICEBAND | Items::CHOICESCARF => {
726 let ins = get_choice_move_disable_instructions(active_pkmn, side_ref, &choice.move_id);
727 for i in ins {
728 state.apply_one_instruction(&i);
729 instructions.instruction_list.push(i);
730 }
731 }
732 Items::PROTECTIVEPADS => {
733 choice.flags.contact = false;
734 }
735 _ => {}
736 }
737}
738
739pub fn item_on_switch_in(
740 state: &mut State,
741 side_ref: &SideReference,
742 instructions: &mut StateInstructions,
743) {
744 let active_terrain = state.get_terrain();
745 let switching_in_side = state.get_side(side_ref);
746 let switching_in_pkmn = switching_in_side.get_active_immutable();
747 match switching_in_pkmn.item {
748 Items::ELECTRICSEED => {
749 if active_terrain == Terrain::ELECTRICTERRAIN {
750 if apply_boost_instruction(
751 switching_in_side,
752 &PokemonBoostableStat::Defense,
753 &1,
754 side_ref,
755 side_ref,
756 instructions,
757 ) {
758 state.get_side(side_ref).get_active().item = Items::NONE;
759 instructions.instruction_list.push(Instruction::ChangeItem(
760 ChangeItemInstruction {
761 side_ref: side_ref.clone(),
762 current_item: Items::ELECTRICSEED,
763 new_item: Items::NONE,
764 },
765 ));
766 }
767 }
768 }
769 Items::GRASSYSEED => {
770 if active_terrain == Terrain::GRASSYTERRAIN {
771 if apply_boost_instruction(
772 switching_in_side,
773 &PokemonBoostableStat::Defense,
774 &1,
775 side_ref,
776 side_ref,
777 instructions,
778 ) {
779 state.get_side(side_ref).get_active().item = Items::NONE;
780 instructions.instruction_list.push(Instruction::ChangeItem(
781 ChangeItemInstruction {
782 side_ref: side_ref.clone(),
783 current_item: Items::GRASSYSEED,
784 new_item: Items::NONE,
785 },
786 ));
787 }
788 }
789 }
790 Items::MISTYSEED => {
791 if active_terrain == Terrain::MISTYTERRAIN {
792 if apply_boost_instruction(
793 switching_in_side,
794 &PokemonBoostableStat::SpecialDefense,
795 &1,
796 side_ref,
797 side_ref,
798 instructions,
799 ) {
800 state.get_side(side_ref).get_active().item = Items::NONE;
801 instructions.instruction_list.push(Instruction::ChangeItem(
802 ChangeItemInstruction {
803 side_ref: side_ref.clone(),
804 current_item: Items::MISTYSEED,
805 new_item: Items::NONE,
806 },
807 ));
808 }
809 }
810 }
811 Items::PSYCHICSEED => {
812 if active_terrain == Terrain::PSYCHICTERRAIN {
813 if apply_boost_instruction(
814 switching_in_side,
815 &PokemonBoostableStat::SpecialDefense,
816 &1,
817 side_ref,
818 side_ref,
819 instructions,
820 ) {
821 state.get_side(side_ref).get_active().item = Items::NONE;
822 instructions.instruction_list.push(Instruction::ChangeItem(
823 ChangeItemInstruction {
824 side_ref: side_ref.clone(),
825 current_item: Items::PSYCHICSEED,
826 new_item: Items::NONE,
827 },
828 ));
829 }
830 }
831 }
832 _ => {}
833 }
834}
835
836pub fn item_end_of_turn(
837 state: &mut State,
838 side_ref: &SideReference,
839 instructions: &mut StateInstructions,
840) {
841 let attacking_side = state.get_side(side_ref);
842 let active_pkmn = attacking_side.get_active();
843 match active_pkmn.item {
844 Items::LUMBERRY if active_pkmn.status != PokemonStatus::NONE => {
845 lum_berry(side_ref, attacking_side, instructions)
846 }
847 Items::SITRUSBERRY if active_pkmn.hp <= active_pkmn.maxhp / 2 => {
848 sitrus_berry(side_ref, attacking_side, instructions)
849 }
850 Items::CHESTOBERRY if active_pkmn.status == PokemonStatus::SLEEP => {
851 chesto_berry(side_ref, attacking_side, instructions)
852 }
853 Items::BLACKSLUDGE => {
854 if active_pkmn.has_type(&PokemonType::POISON) {
855 if active_pkmn.hp < active_pkmn.maxhp {
856 let heal_amount =
857 cmp::min(active_pkmn.maxhp / 16, active_pkmn.maxhp - active_pkmn.hp);
858 let ins = Instruction::Heal(HealInstruction {
859 side_ref: side_ref.clone(),
860 heal_amount: heal_amount,
861 });
862 active_pkmn.hp += heal_amount;
863 instructions.instruction_list.push(ins);
864 }
865 } else {
866 let damage_amount =
867 cmp::min(active_pkmn.maxhp / 16, active_pkmn.maxhp - active_pkmn.hp);
868 let ins = Instruction::Damage(DamageInstruction {
869 side_ref: side_ref.clone(),
870 damage_amount: damage_amount,
871 });
872 active_pkmn.hp -= damage_amount;
873 instructions.instruction_list.push(ins);
874 }
875 }
876 Items::FLAMEORB => {
877 if !immune_to_status(state, &MoveTarget::User, side_ref, &PokemonStatus::BURN) {
878 let side = state.get_side(side_ref);
879 let ins = Instruction::ChangeStatus(ChangeStatusInstruction {
880 side_ref: side_ref.clone(),
881 pokemon_index: side.active_index,
882 new_status: PokemonStatus::BURN,
883 old_status: PokemonStatus::NONE,
884 });
885 side.get_active().status = PokemonStatus::BURN;
886 instructions.instruction_list.push(ins);
887 }
888 }
889 Items::LEFTOVERS => {
890 let attacker = state.get_side(side_ref).get_active();
891 if attacker.hp < attacker.maxhp {
892 let heal_amount = cmp::min(attacker.maxhp / 16, attacker.maxhp - attacker.hp);
893 let ins = Instruction::Heal(HealInstruction {
894 side_ref: side_ref.clone(),
895 heal_amount: heal_amount,
896 });
897 attacker.hp += heal_amount;
898 instructions.instruction_list.push(ins);
899 }
900 }
901 Items::TOXICORB => {
902 if !immune_to_status(state, &MoveTarget::User, side_ref, &PokemonStatus::TOXIC) {
903 let side = state.get_side(side_ref);
904 let ins = Instruction::ChangeStatus(ChangeStatusInstruction {
905 side_ref: side_ref.clone(),
906 pokemon_index: side.active_index,
907 new_status: PokemonStatus::TOXIC,
908 old_status: PokemonStatus::NONE,
909 });
910 side.get_active().status = PokemonStatus::TOXIC;
911 instructions.instruction_list.push(ins);
912 }
913 }
914 _ => {}
915 }
916}
917
918pub fn item_modify_attack_against(
919 state: &State,
920 attacking_choice: &mut Choice,
921 attacking_side_ref: &SideReference,
922) {
923 let (attacking_side, defending_side) = state.get_both_sides_immutable(attacking_side_ref);
924 match defending_side.get_active_immutable().item {
925 Items::ABSORBBULB => {
926 if attacking_choice.move_type == PokemonType::WATER {
927 attacking_choice.add_or_create_secondaries(Secondary {
928 chance: 100.0,
929 effect: Effect::Boost(StatBoosts {
930 attack: 0,
931 defense: 0,
932 special_attack: 1,
933 special_defense: 0,
934 speed: 0,
935 accuracy: 0,
936 }),
937 target: MoveTarget::Opponent,
938 });
939 attacking_choice.add_or_create_secondaries(Secondary {
940 chance: 100.0,
941 effect: Effect::RemoveItem,
942 target: MoveTarget::Opponent,
943 });
944 }
945 }
946 Items::AIRBALLOON => {
947 if attacking_choice.move_type == PokemonType::GROUND
948 && attacking_choice.move_id != Choices::THOUSANDARROWS
949 {
950 attacking_choice.base_power = 0.0;
951 } else if attacking_choice.target == MoveTarget::Opponent
952 && attacking_choice.category != MoveCategory::Status
953 {
954 attacking_choice.add_or_create_secondaries(Secondary {
955 chance: 100.0,
956 effect: Effect::RemoveItem,
957 target: MoveTarget::Opponent,
958 });
959 }
960 }
961 Items::ASSAULTVEST => {
962 if attacking_choice.targets_special_defense() {
963 attacking_choice.base_power /= 1.5;
964 }
965 }
966 Items::METALPOWDER if attacking_side.get_active_immutable().id == PokemonName::DITTO => {
967 attacking_choice.base_power /= 1.5;
968 }
969 Items::CELLBATTERY => {
970 if attacking_choice.move_type == PokemonType::ELECTRIC {
971 attacking_choice.add_or_create_secondaries(Secondary {
972 chance: 100.0,
973 effect: Effect::Boost(StatBoosts {
974 attack: 1,
975 defense: 0,
976 special_attack: 0,
977 special_defense: 0,
978 speed: 0,
979 accuracy: 0,
980 }),
981 target: MoveTarget::Opponent,
982 });
983 attacking_choice.add_or_create_secondaries(Secondary {
984 chance: 100.0,
985 effect: Effect::RemoveItem,
986 target: MoveTarget::Opponent,
987 });
988 }
989 }
990 Items::EVIOLITE => {
991 attacking_choice.base_power /= 1.5;
992 }
993 Items::ROCKYHELMET => {
994 if attacking_choice.flags.contact {
995 attacking_choice.add_or_create_secondaries(Secondary {
996 chance: 100.0,
997 effect: Effect::Heal(-0.166),
998 target: MoveTarget::User,
999 })
1000 }
1001 }
1002 Items::WEAKNESSPOLICY => {
1003 if attacking_choice.category != MoveCategory::Status
1004 && type_effectiveness_modifier(
1005 &attacking_choice.move_type,
1006 &defending_side.get_active_immutable(),
1007 ) > 1.0
1008 {
1009 attacking_choice.add_or_create_secondaries(Secondary {
1010 chance: 100.0,
1011 effect: Effect::Boost(StatBoosts {
1012 attack: 2,
1013 defense: 0,
1014 special_attack: 2,
1015 special_defense: 0,
1016 speed: 0,
1017 accuracy: 0,
1018 }),
1019 target: MoveTarget::Opponent,
1020 });
1021 attacking_choice.add_or_create_secondaries(Secondary {
1022 chance: 100.0,
1023 effect: Effect::RemoveItem,
1024 target: MoveTarget::Opponent,
1025 });
1026 }
1027 }
1028 Items::SOULDEW => {
1029 if defending_side.get_active_immutable().id == PokemonName::LATIOS
1030 || defending_side.get_active_immutable().id == PokemonName::LATIAS
1031 {
1032 #[cfg(any(feature = "gen3", feature = "gen4", feature = "gen5", feature = "gen6"))]
1033 if attacking_choice.category == MoveCategory::Special {
1034 attacking_choice.base_power /= 1.5;
1035 }
1036 }
1037 }
1038 _ => {}
1039 }
1040}
1041
1042pub fn item_modify_attack_being_used(
1043 state: &State,
1044 attacking_choice: &mut Choice,
1045 attacking_side_ref: &SideReference,
1046) {
1047 let (attacking_side, defending_side) = state.get_both_sides_immutable(attacking_side_ref);
1048 match attacking_side.get_active_immutable().item {
1049 Items::WELLSPRINGMASK => match attacking_side.get_active_immutable().id {
1050 PokemonName::OGERPONWELLSPRING | PokemonName::OGERPONWELLSPRINGTERA => {
1051 attacking_choice.base_power *= 1.2;
1052 }
1053 _ => {}
1054 },
1055 Items::HEARTHFLAMEMASK => match attacking_side.get_active_immutable().id {
1056 PokemonName::OGERPONHEARTHFLAME | PokemonName::OGERPONHEARTHFLAMETERA => {
1057 attacking_choice.base_power *= 1.2;
1058 }
1059 _ => {}
1060 },
1061 Items::CORNERSTONEMASK => match attacking_side.get_active_immutable().id {
1062 PokemonName::OGERPONCORNERSTONE | PokemonName::OGERPONCORNERSTONETERA => {
1063 attacking_choice.base_power *= 1.2;
1064 }
1065 _ => {}
1066 },
1067 #[cfg(feature = "gen3")]
1068 Items::BLACKBELT => {
1069 if attacking_choice.move_type == PokemonType::FIGHTING {
1070 attacking_choice.base_power *= 1.1;
1071 }
1072 }
1073 #[cfg(any(
1074 feature = "gen4",
1075 feature = "gen5",
1076 feature = "gen6",
1077 feature = "gen7",
1078 feature = "gen8",
1079 feature = "gen9"
1080 ))]
1081 Items::BLACKBELT => {
1082 if attacking_choice.move_type == PokemonType::FIGHTING {
1083 attacking_choice.base_power *= 1.2;
1084 }
1085 }
1086 #[cfg(feature = "gen3")]
1087 Items::BLACKGLASSES => {
1088 if attacking_choice.move_type == PokemonType::DARK {
1089 attacking_choice.base_power *= 1.1;
1090 }
1091 }
1092 #[cfg(any(
1093 feature = "gen4",
1094 feature = "gen5",
1095 feature = "gen6",
1096 feature = "gen7",
1097 feature = "gen8",
1098 feature = "gen9"
1099 ))]
1100 Items::BLACKGLASSES => {
1101 if attacking_choice.move_type == PokemonType::DARK {
1102 attacking_choice.base_power *= 1.2;
1103 }
1104 }
1105 #[cfg(feature = "gen3")]
1106 Items::CHARCOAL => {
1107 if attacking_choice.move_type == PokemonType::FIRE {
1108 attacking_choice.base_power *= 1.1;
1109 }
1110 }
1111 #[cfg(any(
1112 feature = "gen4",
1113 feature = "gen5",
1114 feature = "gen6",
1115 feature = "gen7",
1116 feature = "gen8",
1117 feature = "gen9"
1118 ))]
1119 Items::CHARCOAL => {
1120 if attacking_choice.move_type == PokemonType::FIRE {
1121 attacking_choice.base_power *= 1.2;
1122 }
1123 }
1124 Items::CHOICEBAND => {
1125 if attacking_choice.category == MoveCategory::Physical {
1126 attacking_choice.base_power *= 1.5;
1127 }
1128 }
1129 Items::CHOICESPECS => {
1130 if attacking_choice.category == MoveCategory::Special {
1131 attacking_choice.base_power *= 1.5;
1132 }
1133 }
1134 #[cfg(feature = "gen3")]
1135 Items::DRAGONFANG | Items::DRAGONSCALE => {
1136 if attacking_choice.move_type == PokemonType::DRAGON {
1137 attacking_choice.base_power *= 1.1;
1138 }
1139 }
1140 #[cfg(any(
1141 feature = "gen4",
1142 feature = "gen5",
1143 feature = "gen6",
1144 feature = "gen7",
1145 feature = "gen8",
1146 feature = "gen9"
1147 ))]
1148 Items::DRAGONFANG | Items::DRAGONSCALE => {
1149 if attacking_choice.move_type == PokemonType::DRAGON {
1150 attacking_choice.base_power *= 1.2;
1151 }
1152 }
1153 Items::EXPERTBELT => {
1154 if type_effectiveness_modifier(
1155 &attacking_choice.move_type,
1156 &defending_side.get_active_immutable(),
1157 ) > 1.0
1158 {
1159 attacking_choice.base_power *= 1.2;
1160 }
1161 }
1162 Items::FAIRYFEATHER => {
1163 if attacking_choice.move_type == PokemonType::FAIRY {
1164 attacking_choice.base_power *= 1.2;
1165 }
1166 }
1167 Items::LIFEORB => {
1168 if attacking_choice.category != MoveCategory::Status {
1169 attacking_choice.base_power *= 1.3;
1170
1171 #[cfg(feature = "gen4")]
1172 if !defending_side
1173 .volatile_statuses
1174 .contains(&PokemonVolatileStatus::SUBSTITUTE)
1175 && attacking_side.get_active_immutable().ability != Abilities::MAGICGUARD
1176 {
1177 attacking_choice.add_or_create_secondaries(Secondary {
1178 chance: 100.0,
1179 effect: Effect::Heal(-0.1),
1180 target: MoveTarget::User,
1181 });
1182 }
1183
1184 #[cfg(not(feature = "gen4"))]
1185 if attacking_side.get_active_immutable().ability != Abilities::MAGICGUARD {
1186 attacking_choice.add_or_create_secondaries(Secondary {
1187 chance: 100.0,
1188 effect: Effect::Heal(-0.1),
1189 target: MoveTarget::User,
1190 });
1191 }
1192 }
1193 }
1194 #[cfg(feature = "gen3")]
1195 Items::METALCOAT => {
1196 if attacking_choice.move_type == PokemonType::STEEL {
1197 attacking_choice.base_power *= 1.1;
1198 }
1199 }
1200 #[cfg(any(
1201 feature = "gen4",
1202 feature = "gen5",
1203 feature = "gen6",
1204 feature = "gen7",
1205 feature = "gen8",
1206 feature = "gen9"
1207 ))]
1208 Items::METALCOAT => {
1209 if attacking_choice.move_type == PokemonType::STEEL {
1210 attacking_choice.base_power *= 1.2;
1211 }
1212 }
1213 Items::MUSCLEBAND => {
1214 if attacking_choice.category == MoveCategory::Physical {
1215 attacking_choice.base_power *= 1.1;
1216 }
1217 }
1218 #[cfg(feature = "gen3")]
1219 Items::MYSTICWATER => {
1220 if attacking_choice.move_type == PokemonType::WATER {
1221 attacking_choice.base_power *= 1.1;
1222 }
1223 }
1224 #[cfg(any(
1225 feature = "gen4",
1226 feature = "gen5",
1227 feature = "gen6",
1228 feature = "gen7",
1229 feature = "gen8",
1230 feature = "gen9"
1231 ))]
1232 Items::MYSTICWATER => {
1233 if attacking_choice.move_type == PokemonType::WATER {
1234 attacking_choice.base_power *= 1.2;
1235 }
1236 }
1237 #[cfg(feature = "gen3")]
1238 Items::NEVERMELTICE => {
1239 if attacking_choice.move_type == PokemonType::ICE {
1240 attacking_choice.base_power *= 1.1;
1241 }
1242 }
1243 #[cfg(any(
1244 feature = "gen4",
1245 feature = "gen5",
1246 feature = "gen6",
1247 feature = "gen7",
1248 feature = "gen8",
1249 feature = "gen9"
1250 ))]
1251 Items::NEVERMELTICE => {
1252 if attacking_choice.move_type == PokemonType::ICE {
1253 attacking_choice.base_power *= 1.2;
1254 }
1255 }
1256 Items::PINKBOW | Items::POLKADOTBOW => {
1257 if attacking_choice.move_type == PokemonType::NORMAL {
1258 attacking_choice.base_power *= 1.1;
1259 }
1260 }
1261 Items::ODDINCENSE => {
1262 if attacking_choice.move_type == PokemonType::PSYCHIC {
1263 attacking_choice.base_power *= 1.2;
1264 }
1265 }
1266 #[cfg(feature = "gen3")]
1267 Items::POISONBARB => {
1268 if attacking_choice.move_type == PokemonType::POISON {
1269 attacking_choice.base_power *= 1.1;
1270 }
1271 }
1272 #[cfg(any(
1273 feature = "gen4",
1274 feature = "gen5",
1275 feature = "gen6",
1276 feature = "gen7",
1277 feature = "gen8",
1278 feature = "gen9"
1279 ))]
1280 Items::POISONBARB => {
1281 if attacking_choice.move_type == PokemonType::POISON {
1282 attacking_choice.base_power *= 1.2;
1283 }
1284 }
1285 Items::PUNCHINGGLOVE => {
1286 if attacking_choice.flags.punch {
1287 attacking_choice.base_power *= 1.1;
1288 attacking_choice.flags.contact = false
1289 }
1290 }
1291 Items::SEAINCENSE => {
1292 if attacking_choice.move_type == PokemonType::WATER {
1293 attacking_choice.base_power *= 1.2;
1294 }
1295 }
1296 #[cfg(feature = "gen3")]
1297 Items::SHARPBEAK => {
1298 if attacking_choice.move_type == PokemonType::FLYING {
1299 attacking_choice.base_power *= 1.1;
1300 }
1301 }
1302 #[cfg(any(
1303 feature = "gen4",
1304 feature = "gen5",
1305 feature = "gen6",
1306 feature = "gen7",
1307 feature = "gen8",
1308 feature = "gen9"
1309 ))]
1310 Items::SHARPBEAK => {
1311 if attacking_choice.move_type == PokemonType::FLYING {
1312 attacking_choice.base_power *= 1.2;
1313 }
1314 }
1315 Items::SHELLBELL => {
1316 attacking_choice.drain = Some(0.125);
1317 }
1318 Items::SILKSCARF => {
1319 if attacking_choice.move_type == PokemonType::NORMAL {
1320 attacking_choice.base_power *= 1.2;
1321 }
1322 }
1323 #[cfg(feature = "gen3")]
1324 Items::SILVERPOWDER => {
1325 if attacking_choice.move_type == PokemonType::BUG {
1326 attacking_choice.base_power *= 1.1;
1327 }
1328 }
1329 #[cfg(any(
1330 feature = "gen4",
1331 feature = "gen5",
1332 feature = "gen6",
1333 feature = "gen7",
1334 feature = "gen8",
1335 feature = "gen9"
1336 ))]
1337 Items::SILVERPOWDER => {
1338 if attacking_choice.move_type == PokemonType::BUG {
1339 attacking_choice.base_power *= 1.2;
1340 }
1341 }
1342 #[cfg(feature = "gen3")]
1343 Items::SOFTSAND => {
1344 if attacking_choice.move_type == PokemonType::GROUND {
1345 attacking_choice.base_power *= 1.1;
1346 }
1347 }
1348 #[cfg(any(
1349 feature = "gen4",
1350 feature = "gen5",
1351 feature = "gen6",
1352 feature = "gen7",
1353 feature = "gen8",
1354 feature = "gen9"
1355 ))]
1356 Items::SOFTSAND => {
1357 if attacking_choice.move_type == PokemonType::GROUND {
1358 attacking_choice.base_power *= 1.2;
1359 }
1360 }
1361 #[cfg(feature = "gen3")]
1362 Items::SPELLTAG => {
1363 if attacking_choice.move_type == PokemonType::GHOST {
1364 attacking_choice.base_power *= 1.1;
1365 }
1366 }
1367 #[cfg(any(
1368 feature = "gen4",
1369 feature = "gen5",
1370 feature = "gen6",
1371 feature = "gen7",
1372 feature = "gen8",
1373 feature = "gen9"
1374 ))]
1375 Items::SPELLTAG => {
1376 if attacking_choice.move_type == PokemonType::GHOST {
1377 attacking_choice.base_power *= 1.2;
1378 }
1379 }
1380 #[cfg(feature = "gen3")]
1381 Items::MIRACLESEED => {
1382 if attacking_choice.move_type == PokemonType::GRASS {
1383 attacking_choice.base_power *= 1.1;
1384 }
1385 }
1386 #[cfg(any(
1387 feature = "gen4",
1388 feature = "gen5",
1389 feature = "gen6",
1390 feature = "gen7",
1391 feature = "gen8",
1392 feature = "gen9"
1393 ))]
1394 Items::MIRACLESEED => {
1395 if attacking_choice.move_type == PokemonType::GRASS {
1396 attacking_choice.base_power *= 1.2;
1397 }
1398 }
1399 Items::SOULDEW => {
1400 if attacking_side.get_active_immutable().id == PokemonName::LATIOS
1401 || attacking_side.get_active_immutable().id == PokemonName::LATIAS
1402 {
1403 #[cfg(any(feature = "gen3", feature = "gen4", feature = "gen5", feature = "gen6"))]
1404 if attacking_choice.category == MoveCategory::Special {
1405 attacking_choice.base_power *= 1.5;
1406 }
1407
1408 #[cfg(not(any(
1409 feature = "gen3",
1410 feature = "gen4",
1411 feature = "gen5",
1412 feature = "gen6"
1413 )))]
1414 if attacking_choice.move_type == PokemonType::DRAGON
1415 || attacking_choice.move_type == PokemonType::PSYCHIC
1416 {
1417 attacking_choice.base_power *= 1.2;
1418 }
1419 }
1420 }
1421 Items::GRISEOUSORB | Items::GRISEOUSCORE => {
1422 if [PokemonName::GIRATINAORIGIN, PokemonName::GIRATINA]
1423 .contains(&attacking_side.get_active_immutable().id)
1424 {
1425 if attacking_choice.move_type == PokemonType::DRAGON
1426 || attacking_choice.move_type == PokemonType::GHOST
1427 {
1428 attacking_choice.base_power *= 1.2;
1429 }
1430 }
1431 }
1432 Items::LUSTROUSORB | Items::LUSTROUSGLOBE => {
1433 if [PokemonName::PALKIAORIGIN, PokemonName::PALKIA]
1434 .contains(&attacking_side.get_active_immutable().id)
1435 {
1436 if attacking_choice.move_type == PokemonType::DRAGON
1437 || attacking_choice.move_type == PokemonType::WATER
1438 {
1439 attacking_choice.base_power *= 1.2;
1440 }
1441 }
1442 }
1443 Items::ADAMANTORB | Items::ADAMANTCRYSTAL => {
1444 if [PokemonName::DIALGAORIGIN, PokemonName::DIALGA]
1445 .contains(&attacking_side.get_active_immutable().id)
1446 {
1447 if attacking_choice.move_type == PokemonType::DRAGON
1448 || attacking_choice.move_type == PokemonType::STEEL
1449 {
1450 attacking_choice.base_power *= 1.2;
1451 }
1452 }
1453 }
1454 Items::THROATSPRAY => {
1455 if attacking_choice.flags.sound {
1456 attacking_choice.add_or_create_secondaries(Secondary {
1457 chance: 100.0,
1458 effect: Effect::Boost(StatBoosts {
1459 attack: 0,
1460 defense: 0,
1461 special_attack: 1,
1462 special_defense: 0,
1463 speed: 0,
1464 accuracy: 0,
1465 }),
1466 target: MoveTarget::User,
1467 });
1468 attacking_choice.add_or_create_secondaries(Secondary {
1469 chance: 100.0,
1470 effect: Effect::RemoveItem,
1471 target: MoveTarget::User,
1472 });
1473 }
1474 }
1475 Items::THICKCLUB => match attacking_side.get_active_immutable().id {
1476 PokemonName::CUBONE
1477 | PokemonName::MAROWAK
1478 | PokemonName::MAROWAKALOLA
1479 | PokemonName::MAROWAKALOLATOTEM => {
1480 attacking_choice.base_power *= 2.0;
1481 }
1482 _ => {}
1483 },
1484 #[cfg(feature = "gen3")]
1485 Items::TWISTEDSPOON => {
1486 if attacking_choice.move_type == PokemonType::PSYCHIC {
1487 attacking_choice.base_power *= 1.1;
1488 }
1489 }
1490 #[cfg(any(
1491 feature = "gen4",
1492 feature = "gen5",
1493 feature = "gen6",
1494 feature = "gen7",
1495 feature = "gen8",
1496 feature = "gen9"
1497 ))]
1498 Items::TWISTEDSPOON => {
1499 if attacking_choice.move_type == PokemonType::PSYCHIC {
1500 attacking_choice.base_power *= 1.2;
1501 }
1502 }
1503 #[cfg(feature = "gen3")]
1504 Items::HARDSTONE => {
1505 if attacking_choice.move_type == PokemonType::ROCK {
1506 attacking_choice.base_power *= 1.1;
1507 }
1508 }
1509 #[cfg(any(
1510 feature = "gen4",
1511 feature = "gen5",
1512 feature = "gen6",
1513 feature = "gen7",
1514 feature = "gen8",
1515 feature = "gen9"
1516 ))]
1517 Items::HARDSTONE => {
1518 if attacking_choice.move_type == PokemonType::ROCK {
1519 attacking_choice.base_power *= 1.2;
1520 }
1521 }
1522 Items::WAVEINCENSE => {
1523 if attacking_choice.move_type == PokemonType::WATER {
1524 attacking_choice.base_power *= 1.2;
1525 }
1526 }
1527 #[cfg(feature = "gen3")]
1528 Items::MAGNET => {
1529 if attacking_choice.move_type == PokemonType::ELECTRIC {
1530 attacking_choice.base_power *= 1.1;
1531 }
1532 }
1533 #[cfg(any(
1534 feature = "gen4",
1535 feature = "gen5",
1536 feature = "gen6",
1537 feature = "gen7",
1538 feature = "gen8",
1539 feature = "gen9"
1540 ))]
1541 Items::MAGNET => {
1542 if attacking_choice.move_type == PokemonType::ELECTRIC {
1543 attacking_choice.base_power *= 1.2;
1544 }
1545 }
1546 Items::WISEGLASSES => {
1547 if attacking_choice.category == MoveCategory::Special {
1548 attacking_choice.base_power *= 1.1;
1549 }
1550 }
1551 Items::FISTPLATE => {
1552 if attacking_choice.move_id == Choices::JUDGMENT {
1553 attacking_choice.move_type = PokemonType::FIGHTING;
1554 }
1555 if attacking_choice.move_type == PokemonType::FIGHTING {
1556 attacking_choice.base_power *= 1.2;
1557 }
1558 }
1559 Items::SKYPLATE => {
1560 if attacking_choice.move_id == Choices::JUDGMENT {
1561 attacking_choice.move_type = PokemonType::FLYING;
1562 }
1563 if attacking_choice.move_type == PokemonType::FLYING {
1564 attacking_choice.base_power *= 1.2;
1565 }
1566 }
1567 Items::TOXICPLATE => {
1568 if attacking_choice.move_id == Choices::JUDGMENT {
1569 attacking_choice.move_type = PokemonType::POISON;
1570 }
1571 if attacking_choice.move_type == PokemonType::POISON {
1572 attacking_choice.base_power *= 1.2;
1573 }
1574 }
1575 Items::EARTHPLATE => {
1576 if attacking_choice.move_id == Choices::JUDGMENT {
1577 attacking_choice.move_type = PokemonType::GROUND;
1578 }
1579 if attacking_choice.move_type == PokemonType::GROUND {
1580 attacking_choice.base_power *= 1.2;
1581 }
1582 }
1583 Items::STONEPLATE => {
1584 if attacking_choice.move_id == Choices::JUDGMENT {
1585 attacking_choice.move_type = PokemonType::ROCK;
1586 }
1587 if attacking_choice.move_type == PokemonType::ROCK {
1588 attacking_choice.base_power *= 1.2;
1589 }
1590 }
1591 Items::INSECTPLATE => {
1592 if attacking_choice.move_id == Choices::JUDGMENT {
1593 attacking_choice.move_type = PokemonType::BUG;
1594 }
1595 if attacking_choice.move_type == PokemonType::BUG {
1596 attacking_choice.base_power *= 1.2;
1597 }
1598 }
1599 Items::SPOOKYPLATE => {
1600 if attacking_choice.move_id == Choices::JUDGMENT {
1601 attacking_choice.move_type = PokemonType::GHOST;
1602 }
1603 if attacking_choice.move_type == PokemonType::GHOST {
1604 attacking_choice.base_power *= 1.2;
1605 }
1606 }
1607 Items::IRONPLATE => {
1608 if attacking_choice.move_id == Choices::JUDGMENT {
1609 attacking_choice.move_type = PokemonType::STEEL;
1610 }
1611 if attacking_choice.move_type == PokemonType::STEEL {
1612 attacking_choice.base_power *= 1.2;
1613 }
1614 }
1615 Items::FLAMEPLATE => {
1616 if attacking_choice.move_id == Choices::JUDGMENT {
1617 attacking_choice.move_type = PokemonType::FIRE;
1618 }
1619 if attacking_choice.move_type == PokemonType::FIRE {
1620 attacking_choice.base_power *= 1.2;
1621 }
1622 }
1623 Items::SPLASHPLATE => {
1624 if attacking_choice.move_id == Choices::JUDGMENT {
1625 attacking_choice.move_type = PokemonType::WATER;
1626 }
1627 if attacking_choice.move_type == PokemonType::WATER {
1628 attacking_choice.base_power *= 1.2;
1629 }
1630 }
1631 Items::MEADOWPLATE => {
1632 if attacking_choice.move_id == Choices::JUDGMENT {
1633 attacking_choice.move_type = PokemonType::GRASS;
1634 }
1635 if attacking_choice.move_type == PokemonType::GRASS {
1636 attacking_choice.base_power *= 1.2;
1637 }
1638 }
1639 Items::ZAPPLATE => {
1640 if attacking_choice.move_id == Choices::JUDGMENT {
1641 attacking_choice.move_type = PokemonType::ELECTRIC;
1642 }
1643 if attacking_choice.move_type == PokemonType::ELECTRIC {
1644 attacking_choice.base_power *= 1.2;
1645 }
1646 }
1647 Items::MINDPLATE => {
1648 if attacking_choice.move_id == Choices::JUDGMENT {
1649 attacking_choice.move_type = PokemonType::PSYCHIC;
1650 }
1651 if attacking_choice.move_type == PokemonType::PSYCHIC {
1652 attacking_choice.base_power *= 1.2;
1653 }
1654 }
1655 Items::ICICLEPLATE => {
1656 if attacking_choice.move_id == Choices::JUDGMENT {
1657 attacking_choice.move_type = PokemonType::ICE;
1658 }
1659 if attacking_choice.move_type == PokemonType::ICE {
1660 attacking_choice.base_power *= 1.2;
1661 }
1662 }
1663 Items::DRACOPLATE => {
1664 if attacking_choice.move_id == Choices::JUDGMENT {
1665 attacking_choice.move_type = PokemonType::DRAGON;
1666 }
1667 if attacking_choice.move_type == PokemonType::DRAGON {
1668 attacking_choice.base_power *= 1.2;
1669 }
1670 }
1671 Items::DREADPLATE => {
1672 if attacking_choice.move_id == Choices::JUDGMENT {
1673 attacking_choice.move_type = PokemonType::DARK;
1674 }
1675 if attacking_choice.move_type == PokemonType::DARK {
1676 attacking_choice.base_power *= 1.2;
1677 }
1678 }
1679 Items::PIXIEPLATE => {
1680 if attacking_choice.move_id == Choices::JUDGMENT {
1681 attacking_choice.move_type = PokemonType::FAIRY;
1682 }
1683 if attacking_choice.move_type == PokemonType::FAIRY {
1684 attacking_choice.base_power *= 1.2;
1685 }
1686 }
1687 Items::LIGHTBALL => {
1688 if attacking_side
1689 .get_active_immutable()
1690 .id
1691 .is_pikachu_variant()
1692 {
1693 attacking_choice.base_power *= 2.0;
1694 }
1695 }
1696 _ => {}
1697 }
1698}