# @taroxd metadata 1.0
# @id drain
# @display 按比例吸血
# @require taroxd_core
# 在可以设置“特性”的地方备注 <drain r>。
# 其中 r 为吸血的比例。
Taroxd::Drain = true
RPG::BaseItem.note_f :drain
Game_Battler.send :def_after, :execute_damage do |user|
if @result.hp_damage > 0
user.hp += (@result.hp_damage * user.feature_objects.sum(&:drain)).to_i
end
end
按比例吸血
禁用贵重物品
# @taroxd metadata 1.0
# @id disable_key_item
# @display 禁用贵重物品
# @require taroxd_core
# @help 禁用“贵重物品”功能
Taroxd::DisableKeyItem = true
class RPG::Item < RPG::UsableItem
def key_item?
false
end
end
class Window_ItemCategory < Window_HorzCommand
def col_max
3
end
def make_command_list
add_command(Vocab::item, :item)
add_command(Vocab::weapon, :weapon)
add_command(Vocab::armor, :armor)
end
end
class Window_KeyItem < Window_ItemList
def_after(:start) { self.category = :item }
def enable?(item)
true
end
end
延迟技能
# @taroxd metadata 1.0
# @require taroxd_core
# @id delay_item
# @display 延迟技能
# @help
# 技能备注<delay message s>,s为技能施放时提示的信息。
# 其中使用者名称用\N代替。
module Taroxd
DelayItem = '\N' # 用 \N 代替使用者名称
end
class RPG::UsableItem
note_i :delay, false
note_s :delay_message
end
class Window_BattleLog < Window_Selectable
def display_delay_use_item(subject, item)
add_text(item.delay_message.gsub(Taroxd::DelayItem, subject.name))
end
end
class Scene_Battle < Scene_Base
def_after(:start) { @delay_list = [] }
def_chain :execute_action do |old|
item = @subject.current_action.item
return old.call unless item.delay
@log_window.display_delay_use_item(@subject, item)
subject = @subject
action = @subject.current_action
@delay_list.push Fiber.new {
item.delay.times { Fiber.yield }
subject.actions.unshift(action)
@subject, subject = subject, @subject
old.call
@subject.remove_current_action
@subject = subject
true
}
end
def_before(:turn_end) { @delay_list.delete_if(&:resume) }
end