123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
-
-
-
-
-
-
-
- #include <battle_custom_structs.h>
- #include <game_engine.h>
- #include <memory.h>
- #include <moves.h>
- #include <battle_common.h>
- #include <battle_locations.h>
-
-
-
-
- void malloc_battle_structs();
-
-
- void free_battle_structs();
-
-
- void battle_switch_in();
-
-
-
- void malloc_battle_structs()
- {
- custom_battle_elements.ptr=(struct custom_battle_struct*)malloc(sizeof(struct custom_battle_struct));
- }
-
- void free_battle_structs()
- {
- free(custom_battle_elements.ptr);
- custom_battle_elements.ptr=0;
- }
-
-
- void battle_switch_in()
- {
- struct bank_affecting* current_bank_affecting = &custom_battle_elements.ptr->bank_affecting[battle_active_bank];
-
- struct bank_affecting prev_bank_affecting = custom_battle_elements.ptr->bank_affecting[battle_active_bank];
- memset(current_bank_affecting, 0, sizeof(struct bank_affecting));
-
- current_bank_affecting->just_switched_in = 1;
- current_bank_affecting->wish_hp = prev_bank_affecting.wish_hp;
- if(battle_executed_move == MOVE_BATON_PASS)
- {
- current_bank_affecting->aqua_ring = prev_bank_affecting.aqua_ring;
- current_bank_affecting->embargo = prev_bank_affecting.embargo;
- current_bank_affecting->powertrick = prev_bank_affecting.powertrick;
- current_bank_affecting->gastro_acided = prev_bank_affecting.gastro_acided;
- current_bank_affecting->heal_block = prev_bank_affecting.heal_block;
-
- if(prev_bank_affecting.powertrick)
- {
-
- u16 *atk = &battle_participants[battle_active_bank].atk;
- u16 *def = &battle_participants[battle_active_bank].def;
- u16 switch_var = *atk;
- *atk = *def;
- *def = switch_var;
- }
- }
-
- struct side_affecting* active_side = &custom_battle_elements.ptr->side_affecting[get_side_from_bank(battle_active_bank)];
- active_side->stealth_rock_done = 0;
- active_side->sticky_web_done = 0;
- active_side->toxic_spikes_done = 0;
- active_side->lunardance_done = 0;
-
- return;
- }
|