# <ForClass2> 限定只有2号职业能用
# <ForActor1> 限定只有1号角色能用
# 可以限定多个职业与角色,但是限定了职业就不要限定角色了,这里是只能判断其中一个。
class RPG::UsableItem
def can_this_actor_use?(actor)
return @note.include?("<ForActor#{actor.id}>") if @note.include?("<ForActor")
return @note.include?("<ForClass#{actor.class_id}>") if\
@note.include?("<ForClass")
return true
end
end
class Game_Battler
def item_test(user, item)
return false if item.for_dead_friend? != dead?
return true if $game_party.in_battle
return true if item.for_opponent?
return true if item.damage.recover? && item.damage.to_hp? && hp < mhp
return true if item.damage.recover? && item.damage.to_mp? && mp < mmp
return true if item_has_any_valid_effects?(user, item) &&
item.can_this_actor_use?(self)
return false
end
end
class Window_BattleActor
def item=(item)
return if @item== item
@item= item
refresh
end
def current_item_enabled?(i=index)
!@item || @item.can_this_actor_use?($game_party.battle_members[i])
end
#
alias_method :s20140329_draw_item, :draw_item
def draw_item(index)
@tmpindex = index
s20140329_draw_item(index)
@tmpindex = nil
end
def change_color(*args)
super
contents.font.color.alpha = translucent_alpha unless
current_item_enabled?(@tmpindex)
end
end
class Window_BattleItem
def process_ok
super
item_ = item
SceneManager.scene.instance_eval { @actor_window.item = item_ }
end
end
class Window_BattleSkill
def process_ok
super
item_ = item
SceneManager.scene.instance_eval { @actor_window.item = item_ }
end
end