001.png (13.17 KB, 下载次数: 22)
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
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |