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