class Game_Battler attr_accessor :target end class Scene_Battle attr_reader :subject end class RPG::Enemy def 西蘭花(skill_id) /<#{skill_id}\s*(\d+)>/ =~ note ? $1.to_i : nil end end class Game_Enemy alias baby_action_valid? action_valid? def action_valid?(action) if state_id = enemy.西蘭花(action.skill_id) targets = $game_party.battle_members.select {|actor| actor.state?(state_id)} return if targets.empty? self.target = random_target(targets) end baby_action_valid?(action) end def tgr_sum(targets) targets.inject(0) {|r, target| r + target.tgr } end def random_target(targets) tgr_rand = rand * tgr_sum(targets) targets.each do |target| tgr_rand -= target.tgr return target if tgr_rand < 0 end targets[0] end end class Game_Action alias baby_make_targets make_targets def make_targets if target = SceneManager.scene.subject.target SceneManager.scene.subject.target = nil return [target] end baby_make_targets end end
class Game_Battler
attr_accessor :target
end
class Scene_Battle
attr_reader :subject
end
class RPG::Enemy
def 西蘭花(skill_id)
/<#{skill_id}\s*(\d+)>/ =~ note ? $1.to_i : nil
end
end
class Game_Enemy
alias baby_action_valid? action_valid?
def action_valid?(action)
if state_id = enemy.西蘭花(action.skill_id)
targets = $game_party.battle_members.select {|actor| actor.state?(state_id)}
return if targets.empty?
self.target = random_target(targets)
end
baby_action_valid?(action)
end
def tgr_sum(targets)
targets.inject(0) {|r, target| r + target.tgr }
end
def random_target(targets)
tgr_rand = rand * tgr_sum(targets)
targets.each do |target|
tgr_rand -= target.tgr
return target if tgr_rand < 0
end
targets[0]
end
end
class Game_Action
alias baby_make_targets make_targets
def make_targets
if target = SceneManager.scene.subject.target
SceneManager.scene.subject.target = nil
return [target]
end
baby_make_targets
end
end
使用方法:
敵人備注欄寫上<技能id 狀態id>後
己方沒存活隊員有該狀態時敵人不會使用該技能
如果有的話也不一定會使用該技能,而是像一般情況一樣計算優先權(就是數據庫設置的)
多於一個隊員有該狀態的話,也會像一般情況一樣計算受攻擊率...
對了,技能會強制變成單體目標...(不清楚你的要求 就不改了) |