Advertisement
blurose

[HGSS] GetBattleMonItem function + Unnerve handling

Jan 16th, 2022
1,096
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.74 KB | None | 0 0
  1. u16 GetBattleMonItem(struct BattleStruct *sp, int client_no)
  2. {
  3.     if ((GetBattlerAbility(sp, client_no) == ABILITY_KLUTZ))
  4.     {
  5.         return 0;
  6.     }
  7.     if (sp->battlemon[client_no].moveeffect.embargo_count)
  8.     {
  9.         return 0;
  10.     }
  11.     // handle unnerve:  if an opposing pokemon has unnerve and the item it is holding is a berry, then no item will be read.
  12.     if (((GetBattlerAbility(sp, BATTLER_OPPONENT(client_no)) == ABILITY_UNNERVE && sp->battlemon[BATTLER_OPPONENT(client_no)].hp != 0)
  13.       || (GetBattlerAbility(sp, BATTLER_ACROSS(client_no)) == ABILITY_UNNERVE && sp->battlemon[BATTLER_ACROSS(client_no)].hp != 0))
  14.      && (IS_ITEM_BERRY(sp->battlemon[client_no].item)))
  15.     {
  16.         return 0;
  17.     }
  18.    
  19.     return sp->battlemon[client_no].item;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement