Project1
标题:
技能消耗物品
[打印本页]
作者:
子弹君
时间:
2014-9-20 12:07
标题:
技能消耗物品
#==============================================================================
# 技能消耗物品 by 子弹君
#==============================================================================
# 说明:
# 在技能备注栏上写上<消耗 物品id>
#
# 例子:在技能备注栏上写上<消耗 25>,那么使用该技能需消耗25号id物品。
#==============================================================================
class RPG::Skill
def item_cost
/<消耗\s*(\d+)>/ =~ note ? $1.to_i : 0
end
end
class Game_Actor
alias bomb2014920_skill_cost_payable? skill_cost_payable?
def skill_cost_payable?(skill)
item = $data_items[skill.item_cost]
bomb2014920_skill_cost_payable?(skill) &&
(!item || $game_party.has_item?(item))
end
end
class Game_Actor
alias bomb2014920_pay_skill_cost pay_skill_cost
def pay_skill_cost(skill)
bomb2014920_pay_skill_cost(skill)
item = $data_items[skill.item_cost]
$game_party.lose_item(item, 1) if item
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1