Module: Battle::Move::Mechanics::ItemBased

Included in:
PowerBasedOnItem, TypesBasedOnItem
Defined in:
scripts/01600 Alpha 25 Battle Engine/04150 Battle_Move/00001 Mechanics/00050 ItemBased.rb

Overview

Preset used for item based attacks Should be included only in a Battle::Move class or a class with the same interface The includer must overwrite the following methods:

  • private consume_item?

  • private valid_item_hold?

Instance Method Summary collapse

Instance Method Details

#move_usable_by_user(user, targets) ⇒ Boolean Also known as: item_based_move_usable_by_user

Note:

Thing that prevents the move from being used should be defined by :move_prevention_user Hook

Function that tests if the user is able to use the move

Parameters:

Returns:

  • (Boolean)

    if the procedure can continue



15
16
17
18
19
20
# File 'scripts/01600 Alpha 25 Battle Engine/04150 Battle_Move/00001 Mechanics/00050 ItemBased.rb', line 15

def move_usable_by_user(user, targets)
  return false unless super
  return show_usage_failure(user) && false unless valid_held_item?(user.item_db_symbol)

  return true
end