説明なし

ability_change.c 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #include <battle_locations.h>
  2. #include <types.h>
  3. #include <battle_structs.h>
  4. #include <constants/abilities.h>
  5. #include <constants/moves.h>
  6. extern char str_worry_seed[];
  7. extern char str_entrainment[];
  8. extern char str_simple_beam[];
  9. extern char str_role_play[];
  10. extern char str_skill_swap[];
  11. u8 worry_seed() {
  12. u8 def_ability = battle_participants[battle_defender_bank].ability_id;
  13. if (def_ability == ABILITY_STANCE_CHANGE && def_ability == ABILITY_MULTITYPE && def_ability == ABILITY_TRUANT) {
  14. //we fail
  15. battlescript_cursor = (void*) (0x081D7DF0);
  16. return true;
  17. } else {
  18. battle_participants[battle_defender_bank].ability_id = ABILITY_INSOMNIA;
  19. battle_last_used_ability = ABILITY_INSOMNIA;
  20. battle_string_chooser = str_worry_seed;
  21. return false;
  22. }
  23. return false;
  24. }
  25. u8 entrainment() {
  26. u8 def_ability = battle_participants[battle_defender_bank].ability_id;
  27. if (def_ability == ABILITY_TRACE || def_ability == ABILITY_TRUANT || def_ability == ABILITY_FLOWER_GIFT || def_ability == ABILITY_IMPOSTER || def_ability == ABILITY_STANCE_CHANGE || def_ability == ABILITY_MULTITYPE) {
  28. //we fail
  29. battlescript_cursor = (void*) (0x081D7DF0);
  30. return true;
  31. } else {
  32. battle_participants[battle_defender_bank].ability_id = battle_participants[battle_attacker_bank].ability_id;
  33. battle_last_used_ability = battle_participants[battle_defender_bank].ability_id;
  34. battle_string_chooser = str_entrainment;
  35. return false;
  36. }
  37. return false;
  38. }
  39. u8 simple_beam() {
  40. u8 def_ability = battle_participants[battle_defender_bank].ability_id;
  41. if (def_ability == ABILITY_STANCE_CHANGE && def_ability == ABILITY_MULTITYPE && def_ability == ABILITY_TRUANT) {
  42. //we fail
  43. battlescript_cursor = (void*) (0x081D7DF0);
  44. return true;
  45. } else {
  46. battle_participants[battle_defender_bank].ability_id = ABILITY_SIMPLE;
  47. battle_last_used_ability = ABILITY_SIMPLE;
  48. battle_string_chooser = str_simple_beam;
  49. return false;
  50. }
  51. return false;
  52. }
  53. u8 role_play() {
  54. u8 def_ability = battle_participants[battle_defender_bank].ability_id;
  55. if (def_ability == ABILITY_ZEN_MODE || def_ability == ABILITY_WONDER_GUARD || def_ability == ABILITY_MULTITYPE || def_ability == ABILITY_IMPOSTER || def_ability == ABILITY_ILLUSION || def_ability == ABILITY_STANCE_CHANGE) {
  56. //we fail
  57. battlescript_cursor = (void*) (0x081D7DF0);
  58. return true;
  59. } else {
  60. battle_participants[battle_attacker_bank].ability_id = battle_participants[battle_defender_bank].ability_id;
  61. battle_last_used_ability = battle_participants[battle_attacker_bank].ability_id;
  62. battle_string_chooser = str_role_play;
  63. return false;
  64. }
  65. return false;
  66. }
  67. u8 skill_swap() {
  68. u8 check_ability = battle_participants[battle_defender_bank].ability_id;
  69. if (check_ability == ABILITY_ZEN_MODE || check_ability == ABILITY_WONDER_GUARD || check_ability == ABILITY_MULTITYPE || check_ability == ABILITY_STANCE_CHANGE) {
  70. //we fail
  71. battlescript_cursor = (void*) (0x081D7DF0);
  72. return true;
  73. } else {
  74. check_ability = battle_participants[battle_attacker_bank].ability_id;
  75. if (check_ability == ABILITY_ZEN_MODE || check_ability == ABILITY_WONDER_GUARD || check_ability == ABILITY_MULTITYPE || check_ability == ABILITY_STANCE_CHANGE) {
  76. //we fail
  77. battlescript_cursor = (void*) (0x081D7DF0);
  78. return true;
  79. } else {
  80. u8 swap = battle_participants[battle_defender_bank].ability_id;
  81. battle_participants[battle_defender_bank].ability_id = battle_participants[battle_attacker_bank].ability_id;
  82. battle_participants[battle_attacker_bank].ability_id = swap;
  83. battle_string_chooser = str_skill_swap;
  84. return false;
  85. }
  86. }
  87. return false;
  88. }
  89. u8 ability_change() {
  90. switch (battle_executed_move) {
  91. case MOVE_WORRY_SEED:
  92. return worry_seed();
  93. case MOVE_ENTRAINMENT:
  94. return entrainment();
  95. case MOVE_SIMPLE_BEAM:
  96. return simple_beam();
  97. case MOVE_ROLE_PLAY:
  98. return role_play();
  99. case MOVE_SKILL_SWAP:
  100. return skill_swap();
  101. default:
  102. return false;
  103. }
  104. }