poke_engine/
items.rs

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
224/*
225NormalGem, FlyingGem, etc.
226*/
227fn 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
255/*
256Regarding berries:
257    most berries (lum, sitrus, etc) activate right away when applicable, but there isn't
258    logic in this engine to implement that. Attempting to activate these berries before the user's
259    move AND at the end-of-turn should be accurate enough for a simulation. The item is
260    removed after this is triggered so only one will take effect
261*/
262fn 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    attacking_side: &mut Side,
315    stat: PokemonBoostableStat,
316    instructions: &mut StateInstructions,
317) {
318    if let Some(ins) = get_boost_instruction(&attacking_side, &stat, &1, side_ref, side_ref) {
319        match stat {
320            PokemonBoostableStat::Attack => attacking_side.attack_boost += 1,
321            PokemonBoostableStat::Defense => attacking_side.defense_boost += 1,
322            PokemonBoostableStat::SpecialAttack => attacking_side.special_attack_boost += 1,
323            PokemonBoostableStat::SpecialDefense => attacking_side.special_defense_boost += 1,
324            PokemonBoostableStat::Speed => attacking_side.speed_boost += 1,
325            PokemonBoostableStat::Accuracy => attacking_side.accuracy_boost += 1,
326            PokemonBoostableStat::Evasion => attacking_side.evasion_boost += 1,
327        }
328        instructions.instruction_list.push(ins);
329    }
330    let attacker = attacking_side.get_active();
331    instructions
332        .instruction_list
333        .push(Instruction::ChangeItem(ChangeItemInstruction {
334            side_ref: *side_ref,
335            current_item: attacker.item,
336            new_item: Items::NONE,
337        }));
338    attacking_side.get_active().item = Items::NONE;
339}
340
341pub fn item_before_move(
342    state: &mut State,
343    choice: &mut Choice,
344    side_ref: &SideReference,
345    instructions: &mut StateInstructions,
346) {
347    let (attacking_side, defending_side) = state.get_both_sides(side_ref);
348    let active_pkmn = attacking_side.get_active();
349    let defending_pkmn = defending_side.get_active();
350    match defending_pkmn.item {
351        Items::CHOPLEBERRY => damage_reduction_berry(
352            defending_pkmn,
353            side_ref,
354            choice,
355            Items::CHOPLEBERRY,
356            &PokemonType::FIGHTING,
357            instructions,
358        ),
359        Items::BABIRIBERRY => damage_reduction_berry(
360            defending_pkmn,
361            side_ref,
362            choice,
363            Items::BABIRIBERRY,
364            &PokemonType::STEEL,
365            instructions,
366        ),
367        Items::CHARTIBERRY => damage_reduction_berry(
368            defending_pkmn,
369            side_ref,
370            choice,
371            Items::CHARTIBERRY,
372            &PokemonType::ROCK,
373            instructions,
374        ),
375        Items::CHILANBERRY => {
376            // no type effectiveness check for chilan
377            if &choice.move_type == &PokemonType::NORMAL {
378                instructions.instruction_list.push(Instruction::ChangeItem(
379                    ChangeItemInstruction {
380                        side_ref: side_ref.get_other_side(),
381                        current_item: Items::CHILANBERRY,
382                        new_item: Items::NONE,
383                    },
384                ));
385                defending_pkmn.item = Items::NONE;
386                choice.base_power /= 2.0;
387            }
388        }
389        Items::COBABERRY => damage_reduction_berry(
390            defending_pkmn,
391            side_ref,
392            choice,
393            Items::COBABERRY,
394            &PokemonType::FLYING,
395            instructions,
396        ),
397        Items::COLBURBERRY => damage_reduction_berry(
398            defending_pkmn,
399            side_ref,
400            choice,
401            Items::COLBURBERRY,
402            &PokemonType::DARK,
403            instructions,
404        ),
405        Items::HABANBERRY => damage_reduction_berry(
406            defending_pkmn,
407            side_ref,
408            choice,
409            Items::HABANBERRY,
410            &PokemonType::DRAGON,
411            instructions,
412        ),
413        Items::KASIBBERRY => damage_reduction_berry(
414            defending_pkmn,
415            side_ref,
416            choice,
417            Items::KASIBBERRY,
418            &PokemonType::GHOST,
419            instructions,
420        ),
421        Items::KEBIABERRY => damage_reduction_berry(
422            defending_pkmn,
423            side_ref,
424            choice,
425            Items::KEBIABERRY,
426            &PokemonType::POISON,
427            instructions,
428        ),
429        Items::OCCABERRY => damage_reduction_berry(
430            defending_pkmn,
431            side_ref,
432            choice,
433            Items::OCCABERRY,
434            &PokemonType::FIRE,
435            instructions,
436        ),
437        Items::PASSHOBERRY => damage_reduction_berry(
438            defending_pkmn,
439            side_ref,
440            choice,
441            Items::PASSHOBERRY,
442            &PokemonType::WATER,
443            instructions,
444        ),
445        Items::PAYAPABERRY => damage_reduction_berry(
446            defending_pkmn,
447            side_ref,
448            choice,
449            Items::PAYAPABERRY,
450            &PokemonType::PSYCHIC,
451            instructions,
452        ),
453        Items::RINDOBERRY => damage_reduction_berry(
454            defending_pkmn,
455            side_ref,
456            choice,
457            Items::RINDOBERRY,
458            &PokemonType::GRASS,
459            instructions,
460        ),
461        Items::ROSELIBERRY => damage_reduction_berry(
462            defending_pkmn,
463            side_ref,
464            choice,
465            Items::ROSELIBERRY,
466            &PokemonType::FAIRY,
467            instructions,
468        ),
469        Items::SHUCABERRY => damage_reduction_berry(
470            defending_pkmn,
471            side_ref,
472            choice,
473            Items::SHUCABERRY,
474            &PokemonType::GROUND,
475            instructions,
476        ),
477        Items::TANGABERRY => damage_reduction_berry(
478            defending_pkmn,
479            side_ref,
480            choice,
481            Items::TANGABERRY,
482            &PokemonType::BUG,
483            instructions,
484        ),
485        Items::WACANBERRY => damage_reduction_berry(
486            defending_pkmn,
487            side_ref,
488            choice,
489            Items::WACANBERRY,
490            &PokemonType::ELECTRIC,
491            instructions,
492        ),
493        Items::YACHEBERRY => damage_reduction_berry(
494            defending_pkmn,
495            side_ref,
496            choice,
497            Items::YACHEBERRY,
498            &PokemonType::ICE,
499            instructions,
500        ),
501        _ => {}
502    }
503    match active_pkmn.item {
504        Items::NORMALGEM => power_up_gem(
505            side_ref,
506            active_pkmn,
507            choice,
508            PokemonType::NORMAL,
509            instructions,
510        ),
511        Items::BUGGEM => power_up_gem(
512            side_ref,
513            active_pkmn,
514            choice,
515            PokemonType::BUG,
516            instructions,
517        ),
518        Items::ELECTRICGEM => power_up_gem(
519            side_ref,
520            active_pkmn,
521            choice,
522            PokemonType::ELECTRIC,
523            instructions,
524        ),
525        Items::FIGHTINGGEM => power_up_gem(
526            side_ref,
527            active_pkmn,
528            choice,
529            PokemonType::FIGHTING,
530            instructions,
531        ),
532        Items::GHOSTGEM => power_up_gem(
533            side_ref,
534            active_pkmn,
535            choice,
536            PokemonType::GHOST,
537            instructions,
538        ),
539        Items::PSYCHICGEM => power_up_gem(
540            side_ref,
541            active_pkmn,
542            choice,
543            PokemonType::PSYCHIC,
544            instructions,
545        ),
546        Items::FLYINGGEM => power_up_gem(
547            side_ref,
548            active_pkmn,
549            choice,
550            PokemonType::FLYING,
551            instructions,
552        ),
553        Items::STEELGEM => power_up_gem(
554            side_ref,
555            active_pkmn,
556            choice,
557            PokemonType::STEEL,
558            instructions,
559        ),
560        Items::ICEGEM => power_up_gem(
561            side_ref,
562            active_pkmn,
563            choice,
564            PokemonType::ICE,
565            instructions,
566        ),
567        Items::POISONGEM => power_up_gem(
568            side_ref,
569            active_pkmn,
570            choice,
571            PokemonType::POISON,
572            instructions,
573        ),
574        Items::FIREGEM => power_up_gem(
575            side_ref,
576            active_pkmn,
577            choice,
578            PokemonType::FIRE,
579            instructions,
580        ),
581        Items::DRAGONGEM => power_up_gem(
582            side_ref,
583            active_pkmn,
584            choice,
585            PokemonType::DRAGON,
586            instructions,
587        ),
588        Items::GROUNDGEM => power_up_gem(
589            side_ref,
590            active_pkmn,
591            choice,
592            PokemonType::GROUND,
593            instructions,
594        ),
595        Items::WATERGEM => power_up_gem(
596            side_ref,
597            active_pkmn,
598            choice,
599            PokemonType::WATER,
600            instructions,
601        ),
602        Items::DARKGEM => power_up_gem(
603            side_ref,
604            active_pkmn,
605            choice,
606            PokemonType::DARK,
607            instructions,
608        ),
609        Items::ROCKGEM => power_up_gem(
610            side_ref,
611            active_pkmn,
612            choice,
613            PokemonType::ROCK,
614            instructions,
615        ),
616        Items::GRASSGEM => power_up_gem(
617            side_ref,
618            active_pkmn,
619            choice,
620            PokemonType::GRASS,
621            instructions,
622        ),
623        Items::FAIRYGEM => power_up_gem(
624            side_ref,
625            active_pkmn,
626            choice,
627            PokemonType::FAIRY,
628            instructions,
629        ),
630        Items::LUMBERRY if active_pkmn.status != PokemonStatus::NONE => {
631            lum_berry(side_ref, attacking_side, instructions)
632        }
633        Items::SITRUSBERRY
634            if active_pkmn.ability == Abilities::GLUTTONY
635                && active_pkmn.hp <= active_pkmn.maxhp / 2 =>
636        {
637            sitrus_berry(side_ref, attacking_side, instructions)
638        }
639        Items::SITRUSBERRY if active_pkmn.hp <= active_pkmn.maxhp / 4 => {
640            sitrus_berry(side_ref, attacking_side, instructions)
641        }
642        Items::PETAYABERRY if active_pkmn.hp <= active_pkmn.maxhp / 4 => boost_berry(
643            side_ref,
644            attacking_side,
645            PokemonBoostableStat::SpecialAttack,
646            instructions,
647        ),
648        Items::LIECHIBERRY if active_pkmn.hp <= active_pkmn.maxhp / 4 => boost_berry(
649            side_ref,
650            attacking_side,
651            PokemonBoostableStat::Attack,
652            instructions,
653        ),
654        Items::SALACBERRY if active_pkmn.hp <= active_pkmn.maxhp / 4 => boost_berry(
655            side_ref,
656            attacking_side,
657            PokemonBoostableStat::Speed,
658            instructions,
659        ),
660        Items::CUSTAPBERRY => {
661            if active_pkmn.hp <= active_pkmn.maxhp / 4 {
662                active_pkmn.item = Items::NONE;
663                instructions.instruction_list.push(Instruction::ChangeItem(
664                    ChangeItemInstruction {
665                        side_ref: *side_ref,
666                        current_item: Items::CUSTAPBERRY,
667                        new_item: Items::NONE,
668                    },
669                ));
670            }
671        }
672        Items::CHOICESPECS | Items::CHOICEBAND | Items::CHOICESCARF => {
673            let ins = get_choice_move_disable_instructions(active_pkmn, side_ref, &choice.move_id);
674            for i in ins {
675                state.apply_one_instruction(&i);
676                instructions.instruction_list.push(i);
677            }
678        }
679        Items::PROTECTIVEPADS => {
680            choice.flags.contact = false;
681        }
682        _ => {}
683    }
684}
685
686pub fn item_on_switch_in(
687    state: &mut State,
688    side_ref: &SideReference,
689    instructions: &mut StateInstructions,
690) {
691    let switching_in_side = state.get_side_immutable(side_ref);
692    let switching_in_pkmn = switching_in_side.get_active_immutable();
693    match switching_in_pkmn.item {
694        Items::ELECTRICSEED => {
695            if state.terrain_is_active(&Terrain::ELECTRICTERRAIN) {
696                if let Some(boost_instruction) = get_boost_instruction(
697                    &switching_in_side,
698                    &PokemonBoostableStat::Defense,
699                    &1,
700                    side_ref,
701                    side_ref,
702                ) {
703                    state.apply_one_instruction(&boost_instruction);
704                    instructions.instruction_list.push(boost_instruction);
705                    state.get_side(side_ref).get_active().item = Items::NONE;
706                    instructions.instruction_list.push(Instruction::ChangeItem(
707                        ChangeItemInstruction {
708                            side_ref: side_ref.clone(),
709                            current_item: Items::ELECTRICSEED,
710                            new_item: Items::NONE,
711                        },
712                    ));
713                }
714            }
715        }
716        Items::GRASSYSEED => {
717            if state.terrain_is_active(&Terrain::GRASSYTERRAIN) {
718                if let Some(boost_instruction) = get_boost_instruction(
719                    &switching_in_side,
720                    &PokemonBoostableStat::Defense,
721                    &1,
722                    side_ref,
723                    side_ref,
724                ) {
725                    state.apply_one_instruction(&boost_instruction);
726                    instructions.instruction_list.push(boost_instruction);
727                    state.get_side(side_ref).get_active().item = Items::NONE;
728                    instructions.instruction_list.push(Instruction::ChangeItem(
729                        ChangeItemInstruction {
730                            side_ref: side_ref.clone(),
731                            current_item: Items::GRASSYSEED,
732                            new_item: Items::NONE,
733                        },
734                    ));
735                }
736            }
737        }
738        Items::MISTYSEED => {
739            if state.terrain_is_active(&Terrain::MISTYTERRAIN) {
740                if let Some(boost_instruction) = get_boost_instruction(
741                    &switching_in_side,
742                    &PokemonBoostableStat::SpecialDefense,
743                    &1,
744                    side_ref,
745                    side_ref,
746                ) {
747                    state.apply_one_instruction(&boost_instruction);
748                    instructions.instruction_list.push(boost_instruction);
749                    state.get_side(side_ref).get_active().item = Items::NONE;
750                    instructions.instruction_list.push(Instruction::ChangeItem(
751                        ChangeItemInstruction {
752                            side_ref: side_ref.clone(),
753                            current_item: Items::MISTYSEED,
754                            new_item: Items::NONE,
755                        },
756                    ));
757                }
758            }
759        }
760        Items::PSYCHICSEED => {
761            if state.terrain_is_active(&Terrain::PSYCHICTERRAIN) {
762                if let Some(boost_instruction) = get_boost_instruction(
763                    &switching_in_side,
764                    &PokemonBoostableStat::SpecialDefense,
765                    &1,
766                    side_ref,
767                    side_ref,
768                ) {
769                    state.apply_one_instruction(&boost_instruction);
770                    instructions.instruction_list.push(boost_instruction);
771                    state.get_side(side_ref).get_active().item = Items::NONE;
772                    instructions.instruction_list.push(Instruction::ChangeItem(
773                        ChangeItemInstruction {
774                            side_ref: side_ref.clone(),
775                            current_item: Items::PSYCHICSEED,
776                            new_item: Items::NONE,
777                        },
778                    ));
779                }
780            }
781        }
782        _ => {}
783    }
784}
785
786pub fn item_end_of_turn(
787    state: &mut State,
788    side_ref: &SideReference,
789    instructions: &mut StateInstructions,
790) {
791    let attacking_side = state.get_side(side_ref);
792    let active_pkmn = attacking_side.get_active();
793    match active_pkmn.item {
794        Items::LUMBERRY if active_pkmn.status != PokemonStatus::NONE => {
795            lum_berry(side_ref, attacking_side, instructions)
796        }
797        Items::SITRUSBERRY if active_pkmn.hp <= active_pkmn.maxhp / 2 => {
798            sitrus_berry(side_ref, attacking_side, instructions)
799        }
800        Items::BLACKSLUDGE => {
801            if active_pkmn.has_type(&PokemonType::POISON) {
802                if active_pkmn.hp < active_pkmn.maxhp {
803                    let heal_amount =
804                        cmp::min(active_pkmn.maxhp / 16, active_pkmn.maxhp - active_pkmn.hp);
805                    let ins = Instruction::Heal(HealInstruction {
806                        side_ref: side_ref.clone(),
807                        heal_amount: heal_amount,
808                    });
809                    active_pkmn.hp += heal_amount;
810                    instructions.instruction_list.push(ins);
811                }
812            } else {
813                let damage_amount =
814                    cmp::min(active_pkmn.maxhp / 16, active_pkmn.maxhp - active_pkmn.hp);
815                let ins = Instruction::Damage(DamageInstruction {
816                    side_ref: side_ref.clone(),
817                    damage_amount: damage_amount,
818                });
819                active_pkmn.hp -= damage_amount;
820                instructions.instruction_list.push(ins);
821            }
822        }
823        Items::FLAMEORB => {
824            if !immune_to_status(state, &MoveTarget::User, side_ref, &PokemonStatus::BURN) {
825                let side = state.get_side(side_ref);
826                let ins = Instruction::ChangeStatus(ChangeStatusInstruction {
827                    side_ref: side_ref.clone(),
828                    pokemon_index: side.active_index,
829                    new_status: PokemonStatus::BURN,
830                    old_status: PokemonStatus::NONE,
831                });
832                side.get_active().status = PokemonStatus::BURN;
833                instructions.instruction_list.push(ins);
834            }
835        }
836        Items::LEFTOVERS => {
837            let attacker = state.get_side(side_ref).get_active();
838            if attacker.hp < attacker.maxhp {
839                let heal_amount = cmp::min(attacker.maxhp / 16, attacker.maxhp - attacker.hp);
840                let ins = Instruction::Heal(HealInstruction {
841                    side_ref: side_ref.clone(),
842                    heal_amount: heal_amount,
843                });
844                attacker.hp += heal_amount;
845                instructions.instruction_list.push(ins);
846            }
847        }
848        Items::TOXICORB => {
849            if !immune_to_status(state, &MoveTarget::User, side_ref, &PokemonStatus::TOXIC) {
850                let side = state.get_side(side_ref);
851                let ins = Instruction::ChangeStatus(ChangeStatusInstruction {
852                    side_ref: side_ref.clone(),
853                    pokemon_index: side.active_index,
854                    new_status: PokemonStatus::TOXIC,
855                    old_status: PokemonStatus::NONE,
856                });
857                side.get_active().status = PokemonStatus::TOXIC;
858                instructions.instruction_list.push(ins);
859            }
860        }
861        _ => {}
862    }
863}
864
865pub fn item_modify_attack_against(
866    state: &State,
867    attacking_choice: &mut Choice,
868    attacking_side_ref: &SideReference,
869) {
870    let (attacking_side, defending_side) = state.get_both_sides_immutable(attacking_side_ref);
871    match defending_side.get_active_immutable().item {
872        Items::ABSORBBULB => {
873            if attacking_choice.move_type == PokemonType::WATER {
874                attacking_choice.add_or_create_secondaries(Secondary {
875                    chance: 100.0,
876                    effect: Effect::Boost(StatBoosts {
877                        attack: 0,
878                        defense: 0,
879                        special_attack: 1,
880                        special_defense: 0,
881                        speed: 0,
882                        accuracy: 0,
883                    }),
884                    target: MoveTarget::Opponent,
885                });
886                attacking_choice.add_or_create_secondaries(Secondary {
887                    chance: 100.0,
888                    effect: Effect::RemoveItem,
889                    target: MoveTarget::Opponent,
890                });
891            }
892        }
893        Items::AIRBALLOON => {
894            if attacking_choice.move_type == PokemonType::GROUND
895                && attacking_choice.move_id != Choices::THOUSANDARROWS
896            {
897                attacking_choice.base_power = 0.0;
898            } else {
899                attacking_choice.add_or_create_secondaries(Secondary {
900                    chance: 100.0,
901                    effect: Effect::RemoveItem,
902                    target: MoveTarget::Opponent,
903                });
904            }
905        }
906        Items::ASSAULTVEST => {
907            if attacking_choice.targets_special_defense() {
908                attacking_choice.base_power /= 1.5;
909            }
910        }
911        Items::METALPOWDER if attacking_side.get_active_immutable().id == PokemonName::DITTO => {
912            attacking_choice.base_power /= 1.5;
913        }
914        Items::CELLBATTERY => {
915            if attacking_choice.move_type == PokemonType::ELECTRIC {
916                attacking_choice.add_or_create_secondaries(Secondary {
917                    chance: 100.0,
918                    effect: Effect::Boost(StatBoosts {
919                        attack: 1,
920                        defense: 0,
921                        special_attack: 0,
922                        special_defense: 0,
923                        speed: 0,
924                        accuracy: 0,
925                    }),
926                    target: MoveTarget::Opponent,
927                });
928                attacking_choice.add_or_create_secondaries(Secondary {
929                    chance: 100.0,
930                    effect: Effect::RemoveItem,
931                    target: MoveTarget::Opponent,
932                });
933            }
934        }
935        Items::EVIOLITE => {
936            attacking_choice.base_power /= 1.5;
937        }
938        Items::ROCKYHELMET => {
939            if attacking_choice.flags.contact {
940                attacking_choice.add_or_create_secondaries(Secondary {
941                    chance: 100.0,
942                    effect: Effect::Heal(-0.166),
943                    target: MoveTarget::User,
944                })
945            }
946        }
947        Items::WEAKNESSPOLICY => {
948            if attacking_choice.category != MoveCategory::Status
949                && type_effectiveness_modifier(
950                    &attacking_choice.move_type,
951                    &defending_side.get_active_immutable(),
952                ) > 1.0
953            {
954                attacking_choice.add_or_create_secondaries(Secondary {
955                    chance: 100.0,
956                    effect: Effect::Boost(StatBoosts {
957                        attack: 2,
958                        defense: 0,
959                        special_attack: 2,
960                        special_defense: 0,
961                        speed: 0,
962                        accuracy: 0,
963                    }),
964                    target: MoveTarget::Opponent,
965                });
966                attacking_choice.add_or_create_secondaries(Secondary {
967                    chance: 100.0,
968                    effect: Effect::RemoveItem,
969                    target: MoveTarget::Opponent,
970                });
971            }
972        }
973        Items::SOULDEW => {
974            if defending_side.get_active_immutable().id == PokemonName::LATIOS
975                || defending_side.get_active_immutable().id == PokemonName::LATIAS
976            {
977                #[cfg(any(feature = "gen3", feature = "gen4", feature = "gen5", feature = "gen6"))]
978                if attacking_choice.category == MoveCategory::Special {
979                    attacking_choice.base_power /= 1.5;
980                }
981            }
982        }
983        _ => {}
984    }
985}
986
987pub fn item_modify_attack_being_used(
988    state: &State,
989    attacking_choice: &mut Choice,
990    attacking_side_ref: &SideReference,
991) {
992    let (attacking_side, defending_side) = state.get_both_sides_immutable(attacking_side_ref);
993    match attacking_side.get_active_immutable().item {
994        Items::WELLSPRINGMASK => match attacking_side.get_active_immutable().id {
995            PokemonName::OGERPONWELLSPRING | PokemonName::OGERPONWELLSPRINGTERA => {
996                attacking_choice.base_power *= 1.2;
997            }
998            _ => {}
999        },
1000        Items::HEARTHFLAMEMASK => match attacking_side.get_active_immutable().id {
1001            PokemonName::OGERPONHEARTHFLAME | PokemonName::OGERPONHEARTHFLAMETERA => {
1002                attacking_choice.base_power *= 1.2;
1003            }
1004            _ => {}
1005        },
1006        Items::CORNERSTONEMASK => match attacking_side.get_active_immutable().id {
1007            PokemonName::OGERPONCORNERSTONE | PokemonName::OGERPONCORNERSTONETERA => {
1008                attacking_choice.base_power *= 1.2;
1009            }
1010            _ => {}
1011        },
1012        #[cfg(feature = "gen3")]
1013        Items::BLACKBELT => {
1014            if attacking_choice.move_type == PokemonType::FIGHTING {
1015                attacking_choice.base_power *= 1.1;
1016            }
1017        }
1018        #[cfg(any(
1019            feature = "gen4",
1020            feature = "gen5",
1021            feature = "gen6",
1022            feature = "gen7",
1023            feature = "gen8",
1024            feature = "gen9"
1025        ))]
1026        Items::BLACKBELT => {
1027            if attacking_choice.move_type == PokemonType::FIGHTING {
1028                attacking_choice.base_power *= 1.2;
1029            }
1030        }
1031        #[cfg(feature = "gen3")]
1032        Items::BLACKGLASSES => {
1033            if attacking_choice.move_type == PokemonType::DARK {
1034                attacking_choice.base_power *= 1.1;
1035            }
1036        }
1037        #[cfg(any(
1038            feature = "gen4",
1039            feature = "gen5",
1040            feature = "gen6",
1041            feature = "gen7",
1042            feature = "gen8",
1043            feature = "gen9"
1044        ))]
1045        Items::BLACKGLASSES => {
1046            if attacking_choice.move_type == PokemonType::DARK {
1047                attacking_choice.base_power *= 1.2;
1048            }
1049        }
1050        #[cfg(feature = "gen3")]
1051        Items::CHARCOAL => {
1052            if attacking_choice.move_type == PokemonType::FIRE {
1053                attacking_choice.base_power *= 1.1;
1054            }
1055        }
1056        #[cfg(any(
1057            feature = "gen4",
1058            feature = "gen5",
1059            feature = "gen6",
1060            feature = "gen7",
1061            feature = "gen8",
1062            feature = "gen9"
1063        ))]
1064        Items::CHARCOAL => {
1065            if attacking_choice.move_type == PokemonType::FIRE {
1066                attacking_choice.base_power *= 1.2;
1067            }
1068        }
1069        Items::CHOICEBAND => {
1070            if attacking_choice.category == MoveCategory::Physical {
1071                attacking_choice.base_power *= 1.5;
1072            }
1073        }
1074        Items::CHOICESPECS => {
1075            if attacking_choice.category == MoveCategory::Special {
1076                attacking_choice.base_power *= 1.5;
1077            }
1078        }
1079        #[cfg(feature = "gen3")]
1080        Items::DRAGONFANG | Items::DRAGONSCALE => {
1081            if attacking_choice.move_type == PokemonType::DRAGON {
1082                attacking_choice.base_power *= 1.1;
1083            }
1084        }
1085        #[cfg(any(
1086            feature = "gen4",
1087            feature = "gen5",
1088            feature = "gen6",
1089            feature = "gen7",
1090            feature = "gen8",
1091            feature = "gen9"
1092        ))]
1093        Items::DRAGONFANG | Items::DRAGONSCALE => {
1094            if attacking_choice.move_type == PokemonType::DRAGON {
1095                attacking_choice.base_power *= 1.2;
1096            }
1097        }
1098        Items::EXPERTBELT => {
1099            if type_effectiveness_modifier(
1100                &attacking_choice.move_type,
1101                &defending_side.get_active_immutable(),
1102            ) > 1.0
1103            {
1104                attacking_choice.base_power *= 1.2;
1105            }
1106        }
1107        Items::FAIRYFEATHER => {
1108            if attacking_choice.move_type == PokemonType::FAIRY {
1109                attacking_choice.base_power *= 1.2;
1110            }
1111        }
1112        Items::LIFEORB => {
1113            if attacking_choice.category != MoveCategory::Status {
1114                attacking_choice.base_power *= 1.3;
1115
1116                #[cfg(feature = "gen4")]
1117                if !defending_side
1118                    .volatile_statuses
1119                    .contains(&PokemonVolatileStatus::SUBSTITUTE)
1120                    && attacking_side.get_active_immutable().ability != Abilities::MAGICGUARD
1121                {
1122                    attacking_choice.add_or_create_secondaries(Secondary {
1123                        chance: 100.0,
1124                        effect: Effect::Heal(-0.1),
1125                        target: MoveTarget::User,
1126                    });
1127                }
1128
1129                #[cfg(not(feature = "gen4"))]
1130                if attacking_side.get_active_immutable().ability != Abilities::MAGICGUARD {
1131                    attacking_choice.add_or_create_secondaries(Secondary {
1132                        chance: 100.0,
1133                        effect: Effect::Heal(-0.1),
1134                        target: MoveTarget::User,
1135                    });
1136                }
1137            }
1138        }
1139        #[cfg(feature = "gen3")]
1140        Items::METALCOAT => {
1141            if attacking_choice.move_type == PokemonType::STEEL {
1142                attacking_choice.base_power *= 1.1;
1143            }
1144        }
1145        #[cfg(any(
1146            feature = "gen4",
1147            feature = "gen5",
1148            feature = "gen6",
1149            feature = "gen7",
1150            feature = "gen8",
1151            feature = "gen9"
1152        ))]
1153        Items::METALCOAT => {
1154            if attacking_choice.move_type == PokemonType::STEEL {
1155                attacking_choice.base_power *= 1.2;
1156            }
1157        }
1158        Items::MUSCLEBAND => {
1159            if attacking_choice.category == MoveCategory::Physical {
1160                attacking_choice.base_power *= 1.1;
1161            }
1162        }
1163        #[cfg(feature = "gen3")]
1164        Items::MYSTICWATER => {
1165            if attacking_choice.move_type == PokemonType::WATER {
1166                attacking_choice.base_power *= 1.1;
1167            }
1168        }
1169        #[cfg(any(
1170            feature = "gen4",
1171            feature = "gen5",
1172            feature = "gen6",
1173            feature = "gen7",
1174            feature = "gen8",
1175            feature = "gen9"
1176        ))]
1177        Items::MYSTICWATER => {
1178            if attacking_choice.move_type == PokemonType::WATER {
1179                attacking_choice.base_power *= 1.2;
1180            }
1181        }
1182        #[cfg(feature = "gen3")]
1183        Items::NEVERMELTICE => {
1184            if attacking_choice.move_type == PokemonType::ICE {
1185                attacking_choice.base_power *= 1.1;
1186            }
1187        }
1188        #[cfg(any(
1189            feature = "gen4",
1190            feature = "gen5",
1191            feature = "gen6",
1192            feature = "gen7",
1193            feature = "gen8",
1194            feature = "gen9"
1195        ))]
1196        Items::NEVERMELTICE => {
1197            if attacking_choice.move_type == PokemonType::ICE {
1198                attacking_choice.base_power *= 1.2;
1199            }
1200        }
1201        Items::PINKBOW | Items::POLKADOTBOW => {
1202            if attacking_choice.move_type == PokemonType::NORMAL {
1203                attacking_choice.base_power *= 1.1;
1204            }
1205        }
1206        Items::ODDINCENSE => {
1207            if attacking_choice.move_type == PokemonType::PSYCHIC {
1208                attacking_choice.base_power *= 1.2;
1209            }
1210        }
1211        #[cfg(feature = "gen3")]
1212        Items::POISONBARB => {
1213            if attacking_choice.move_type == PokemonType::POISON {
1214                attacking_choice.base_power *= 1.1;
1215            }
1216        }
1217        #[cfg(any(
1218            feature = "gen4",
1219            feature = "gen5",
1220            feature = "gen6",
1221            feature = "gen7",
1222            feature = "gen8",
1223            feature = "gen9"
1224        ))]
1225        Items::POISONBARB => {
1226            if attacking_choice.move_type == PokemonType::POISON {
1227                attacking_choice.base_power *= 1.2;
1228            }
1229        }
1230        Items::PUNCHINGGLOVE => {
1231            if attacking_choice.flags.punch {
1232                attacking_choice.base_power *= 1.1;
1233                attacking_choice.flags.contact = false
1234            }
1235        }
1236        Items::SEAINCENSE => {
1237            if attacking_choice.move_type == PokemonType::WATER {
1238                attacking_choice.base_power *= 1.2;
1239            }
1240        }
1241        #[cfg(feature = "gen3")]
1242        Items::SHARPBEAK => {
1243            if attacking_choice.move_type == PokemonType::FLYING {
1244                attacking_choice.base_power *= 1.1;
1245            }
1246        }
1247        #[cfg(any(
1248            feature = "gen4",
1249            feature = "gen5",
1250            feature = "gen6",
1251            feature = "gen7",
1252            feature = "gen8",
1253            feature = "gen9"
1254        ))]
1255        Items::SHARPBEAK => {
1256            if attacking_choice.move_type == PokemonType::FLYING {
1257                attacking_choice.base_power *= 1.2;
1258            }
1259        }
1260        Items::SHELLBELL => {
1261            attacking_choice.drain = Some(0.125);
1262        }
1263        Items::SILKSCARF => {
1264            if attacking_choice.move_type == PokemonType::NORMAL {
1265                attacking_choice.base_power *= 1.2;
1266            }
1267        }
1268        #[cfg(feature = "gen3")]
1269        Items::SILVERPOWDER => {
1270            if attacking_choice.move_type == PokemonType::BUG {
1271                attacking_choice.base_power *= 1.1;
1272            }
1273        }
1274        #[cfg(any(
1275            feature = "gen4",
1276            feature = "gen5",
1277            feature = "gen6",
1278            feature = "gen7",
1279            feature = "gen8",
1280            feature = "gen9"
1281        ))]
1282        Items::SILVERPOWDER => {
1283            if attacking_choice.move_type == PokemonType::BUG {
1284                attacking_choice.base_power *= 1.2;
1285            }
1286        }
1287        #[cfg(feature = "gen3")]
1288        Items::SOFTSAND => {
1289            if attacking_choice.move_type == PokemonType::GROUND {
1290                attacking_choice.base_power *= 1.1;
1291            }
1292        }
1293        #[cfg(any(
1294            feature = "gen4",
1295            feature = "gen5",
1296            feature = "gen6",
1297            feature = "gen7",
1298            feature = "gen8",
1299            feature = "gen9"
1300        ))]
1301        Items::SOFTSAND => {
1302            if attacking_choice.move_type == PokemonType::GROUND {
1303                attacking_choice.base_power *= 1.2;
1304            }
1305        }
1306        #[cfg(feature = "gen3")]
1307        Items::SPELLTAG => {
1308            if attacking_choice.move_type == PokemonType::GHOST {
1309                attacking_choice.base_power *= 1.1;
1310            }
1311        }
1312        #[cfg(any(
1313            feature = "gen4",
1314            feature = "gen5",
1315            feature = "gen6",
1316            feature = "gen7",
1317            feature = "gen8",
1318            feature = "gen9"
1319        ))]
1320        Items::SPELLTAG => {
1321            if attacking_choice.move_type == PokemonType::GHOST {
1322                attacking_choice.base_power *= 1.2;
1323            }
1324        }
1325        #[cfg(feature = "gen3")]
1326        Items::MIRACLESEED => {
1327            if attacking_choice.move_type == PokemonType::GRASS {
1328                attacking_choice.base_power *= 1.1;
1329            }
1330        }
1331        #[cfg(any(
1332            feature = "gen4",
1333            feature = "gen5",
1334            feature = "gen6",
1335            feature = "gen7",
1336            feature = "gen8",
1337            feature = "gen9"
1338        ))]
1339        Items::MIRACLESEED => {
1340            if attacking_choice.move_type == PokemonType::GRASS {
1341                attacking_choice.base_power *= 1.2;
1342            }
1343        }
1344        Items::SOULDEW => {
1345            if attacking_side.get_active_immutable().id == PokemonName::LATIOS
1346                || attacking_side.get_active_immutable().id == PokemonName::LATIAS
1347            {
1348                #[cfg(any(feature = "gen3", feature = "gen4", feature = "gen5", feature = "gen6"))]
1349                if attacking_choice.category == MoveCategory::Special {
1350                    attacking_choice.base_power *= 1.5;
1351                }
1352
1353                #[cfg(not(any(
1354                    feature = "gen3",
1355                    feature = "gen4",
1356                    feature = "gen5",
1357                    feature = "gen6"
1358                )))]
1359                if attacking_choice.move_type == PokemonType::DRAGON
1360                    || attacking_choice.move_type == PokemonType::PSYCHIC
1361                {
1362                    attacking_choice.base_power *= 1.2;
1363                }
1364            }
1365        }
1366        Items::GRISEOUSORB | Items::GRISEOUSCORE => {
1367            if [PokemonName::GIRATINAORIGIN, PokemonName::GIRATINA]
1368                .contains(&attacking_side.get_active_immutable().id)
1369            {
1370                if attacking_choice.move_type == PokemonType::DRAGON
1371                    || attacking_choice.move_type == PokemonType::GHOST
1372                {
1373                    attacking_choice.base_power *= 1.2;
1374                }
1375            }
1376        }
1377        Items::LUSTROUSORB | Items::LUSTROUSGLOBE => {
1378            if [PokemonName::PALKIAORIGIN, PokemonName::PALKIA]
1379                .contains(&attacking_side.get_active_immutable().id)
1380            {
1381                if attacking_choice.move_type == PokemonType::DRAGON
1382                    || attacking_choice.move_type == PokemonType::WATER
1383                {
1384                    attacking_choice.base_power *= 1.2;
1385                }
1386            }
1387        }
1388        Items::ADAMANTORB | Items::ADAMANTCRYSTAL => {
1389            if [PokemonName::DIALGAORIGIN, PokemonName::DIALGA]
1390                .contains(&attacking_side.get_active_immutable().id)
1391            {
1392                if attacking_choice.move_type == PokemonType::DRAGON
1393                    || attacking_choice.move_type == PokemonType::STEEL
1394                {
1395                    attacking_choice.base_power *= 1.2;
1396                }
1397            }
1398        }
1399        Items::THROATSPRAY => {
1400            if attacking_choice.flags.sound {
1401                attacking_choice.add_or_create_secondaries(Secondary {
1402                    chance: 100.0,
1403                    effect: Effect::Boost(StatBoosts {
1404                        attack: 0,
1405                        defense: 0,
1406                        special_attack: 1,
1407                        special_defense: 0,
1408                        speed: 0,
1409                        accuracy: 0,
1410                    }),
1411                    target: MoveTarget::User,
1412                });
1413                attacking_choice.add_or_create_secondaries(Secondary {
1414                    chance: 100.0,
1415                    effect: Effect::RemoveItem,
1416                    target: MoveTarget::User,
1417                });
1418            }
1419        }
1420        Items::THICKCLUB => match attacking_side.get_active_immutable().id {
1421            PokemonName::CUBONE
1422            | PokemonName::MAROWAK
1423            | PokemonName::MAROWAKALOLA
1424            | PokemonName::MAROWAKALOLATOTEM => {
1425                attacking_choice.base_power *= 2.0;
1426            }
1427            _ => {}
1428        },
1429        #[cfg(feature = "gen3")]
1430        Items::TWISTEDSPOON => {
1431            if attacking_choice.move_type == PokemonType::PSYCHIC {
1432                attacking_choice.base_power *= 1.1;
1433            }
1434        }
1435        #[cfg(any(
1436            feature = "gen4",
1437            feature = "gen5",
1438            feature = "gen6",
1439            feature = "gen7",
1440            feature = "gen8",
1441            feature = "gen9"
1442        ))]
1443        Items::TWISTEDSPOON => {
1444            if attacking_choice.move_type == PokemonType::PSYCHIC {
1445                attacking_choice.base_power *= 1.2;
1446            }
1447        }
1448        #[cfg(feature = "gen3")]
1449        Items::HARDSTONE => {
1450            if attacking_choice.move_type == PokemonType::ROCK {
1451                attacking_choice.base_power *= 1.1;
1452            }
1453        }
1454        #[cfg(any(
1455            feature = "gen4",
1456            feature = "gen5",
1457            feature = "gen6",
1458            feature = "gen7",
1459            feature = "gen8",
1460            feature = "gen9"
1461        ))]
1462        Items::HARDSTONE => {
1463            if attacking_choice.move_type == PokemonType::ROCK {
1464                attacking_choice.base_power *= 1.2;
1465            }
1466        }
1467        Items::WAVEINCENSE => {
1468            if attacking_choice.move_type == PokemonType::WATER {
1469                attacking_choice.base_power *= 1.2;
1470            }
1471        }
1472        #[cfg(feature = "gen3")]
1473        Items::MAGNET => {
1474            if attacking_choice.move_type == PokemonType::ELECTRIC {
1475                attacking_choice.base_power *= 1.1;
1476            }
1477        }
1478        #[cfg(any(
1479            feature = "gen4",
1480            feature = "gen5",
1481            feature = "gen6",
1482            feature = "gen7",
1483            feature = "gen8",
1484            feature = "gen9"
1485        ))]
1486        Items::MAGNET => {
1487            if attacking_choice.move_type == PokemonType::ELECTRIC {
1488                attacking_choice.base_power *= 1.2;
1489            }
1490        }
1491        Items::WISEGLASSES => {
1492            if attacking_choice.category == MoveCategory::Special {
1493                attacking_choice.base_power *= 1.1;
1494            }
1495        }
1496        Items::FISTPLATE => {
1497            if attacking_choice.move_id == Choices::JUDGMENT {
1498                attacking_choice.move_type = PokemonType::FIGHTING;
1499            }
1500            if attacking_choice.move_type == PokemonType::FIGHTING {
1501                attacking_choice.base_power *= 1.2;
1502            }
1503        }
1504        Items::SKYPLATE => {
1505            if attacking_choice.move_id == Choices::JUDGMENT {
1506                attacking_choice.move_type = PokemonType::FLYING;
1507            }
1508            if attacking_choice.move_type == PokemonType::FLYING {
1509                attacking_choice.base_power *= 1.2;
1510            }
1511        }
1512        Items::TOXICPLATE => {
1513            if attacking_choice.move_id == Choices::JUDGMENT {
1514                attacking_choice.move_type = PokemonType::POISON;
1515            }
1516            if attacking_choice.move_type == PokemonType::POISON {
1517                attacking_choice.base_power *= 1.2;
1518            }
1519        }
1520        Items::EARTHPLATE => {
1521            if attacking_choice.move_id == Choices::JUDGMENT {
1522                attacking_choice.move_type = PokemonType::GROUND;
1523            }
1524            if attacking_choice.move_type == PokemonType::GROUND {
1525                attacking_choice.base_power *= 1.2;
1526            }
1527        }
1528        Items::STONEPLATE => {
1529            if attacking_choice.move_id == Choices::JUDGMENT {
1530                attacking_choice.move_type = PokemonType::ROCK;
1531            }
1532            if attacking_choice.move_type == PokemonType::ROCK {
1533                attacking_choice.base_power *= 1.2;
1534            }
1535        }
1536        Items::INSECTPLATE => {
1537            if attacking_choice.move_id == Choices::JUDGMENT {
1538                attacking_choice.move_type = PokemonType::BUG;
1539            }
1540            if attacking_choice.move_type == PokemonType::BUG {
1541                attacking_choice.base_power *= 1.2;
1542            }
1543        }
1544        Items::SPOOKYPLATE => {
1545            if attacking_choice.move_id == Choices::JUDGMENT {
1546                attacking_choice.move_type = PokemonType::GHOST;
1547            }
1548            if attacking_choice.move_type == PokemonType::GHOST {
1549                attacking_choice.base_power *= 1.2;
1550            }
1551        }
1552        Items::IRONPLATE => {
1553            if attacking_choice.move_id == Choices::JUDGMENT {
1554                attacking_choice.move_type = PokemonType::STEEL;
1555            }
1556            if attacking_choice.move_type == PokemonType::STEEL {
1557                attacking_choice.base_power *= 1.2;
1558            }
1559        }
1560        Items::FLAMEPLATE => {
1561            if attacking_choice.move_id == Choices::JUDGMENT {
1562                attacking_choice.move_type = PokemonType::FIRE;
1563            }
1564            if attacking_choice.move_type == PokemonType::FIRE {
1565                attacking_choice.base_power *= 1.2;
1566            }
1567        }
1568        Items::SPLASHPLATE => {
1569            if attacking_choice.move_id == Choices::JUDGMENT {
1570                attacking_choice.move_type = PokemonType::WATER;
1571            }
1572            if attacking_choice.move_type == PokemonType::WATER {
1573                attacking_choice.base_power *= 1.2;
1574            }
1575        }
1576        Items::MEADOWPLATE => {
1577            if attacking_choice.move_id == Choices::JUDGMENT {
1578                attacking_choice.move_type = PokemonType::GRASS;
1579            }
1580            if attacking_choice.move_type == PokemonType::GRASS {
1581                attacking_choice.base_power *= 1.2;
1582            }
1583        }
1584        Items::ZAPPLATE => {
1585            if attacking_choice.move_id == Choices::JUDGMENT {
1586                attacking_choice.move_type = PokemonType::ELECTRIC;
1587            }
1588            if attacking_choice.move_type == PokemonType::ELECTRIC {
1589                attacking_choice.base_power *= 1.2;
1590            }
1591        }
1592        Items::MINDPLATE => {
1593            if attacking_choice.move_id == Choices::JUDGMENT {
1594                attacking_choice.move_type = PokemonType::PSYCHIC;
1595            }
1596            if attacking_choice.move_type == PokemonType::PSYCHIC {
1597                attacking_choice.base_power *= 1.2;
1598            }
1599        }
1600        Items::ICICLEPLATE => {
1601            if attacking_choice.move_id == Choices::JUDGMENT {
1602                attacking_choice.move_type = PokemonType::ICE;
1603            }
1604            if attacking_choice.move_type == PokemonType::ICE {
1605                attacking_choice.base_power *= 1.2;
1606            }
1607        }
1608        Items::DRACOPLATE => {
1609            if attacking_choice.move_id == Choices::JUDGMENT {
1610                attacking_choice.move_type = PokemonType::DRAGON;
1611            }
1612            if attacking_choice.move_type == PokemonType::DRAGON {
1613                attacking_choice.base_power *= 1.2;
1614            }
1615        }
1616        Items::DREADPLATE => {
1617            if attacking_choice.move_id == Choices::JUDGMENT {
1618                attacking_choice.move_type = PokemonType::DARK;
1619            }
1620            if attacking_choice.move_type == PokemonType::DARK {
1621                attacking_choice.base_power *= 1.2;
1622            }
1623        }
1624        Items::PIXIEPLATE => {
1625            if attacking_choice.move_id == Choices::JUDGMENT {
1626                attacking_choice.move_type = PokemonType::FAIRY;
1627            }
1628            if attacking_choice.move_type == PokemonType::FAIRY {
1629                attacking_choice.base_power *= 1.2;
1630            }
1631        }
1632        Items::LIGHTBALL => {
1633            if attacking_side
1634                .get_active_immutable()
1635                .id
1636                .is_pikachu_variant()
1637            {
1638                attacking_choice.base_power *= 2.0;
1639            }
1640        }
1641        _ => {}
1642    }
1643}