poke_engine/genx/
items.rs

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