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