| 赞 | 276 |
| VIP | |
| 好人卡 | |
| 积分 | 154 |
| 经验 | |
| 最后登录 | 2026-11-3 |
| 在线时间 | 2110 小时 |
- 梦石
- 1
- 星屑
- 14389
- 在线时间
- 2110 小时
- 注册时间
- 2017-9-28
- 回帖
- 607
|
发表于 2020-1-31 20:01:44
|
显示全部楼层
- #==============================================================================
- # ■ RGSS3 延迟效果 Ver2.01 by 星潟
- #------------------------------------------------------------------------------
- # 物品或技能使用後延迟使用其他技能的效果
- # 可以在n回合后发动,也可以是n次行动结束后。
- #==============================================================================
- # 使用技能或物品备注:
- #
- # <回合后延迟发动:a,b,c(,d,e)>
- # <回合后延迟发动:a,b,c(,d,e)>
- #
- # a:技能发动对象,可以是0或1,0代表自身使用,1代表目标使用
- # b:延迟发动的技能或物品id,物品只能延迟发动物品,而不能是技能,反之也是
- # c:延迟n回合
- # d:(可被省略,d省略时e也必须被省略)延长发动时间
- # e:(可被省略)发动几率,仅在存在延长发动时间时有效
- #
- # 可以一次性使用多个备注。
- #==============================================================================
- # 物品/技能备注
- #==============================================================================
- # <回合后延迟发动:0,20,0>
- # 该技能或物品使用后,本回合结束时自身使用20号技能或物品
- #------------------------------------------------------------------------------
- # <回合后延迟发动:1,25,1,0,50>
- # 该技能或物品使用后,下回合结束时有50%概率目标使用25号技能或物品
- #------------------------------------------------------------------------------
- # <行动后延迟发动:0,30,2>
- # 该技能或物品使用后,自身行动结束两回时自身使用30号技能或物品
- #------------------------------------------------------------------------------
- # <行动后延迟发动:1,35,3,2,25>
- # 该技能或物品使用后,4回合结束至6回合时有25%概率目标使用35号技能或物品
- # (看不懂就去群里问)
- #==============================================================================
- # 使用者対象のスキルで遅延発動させ
- # 遅延発動させるスキルとして敵をランダム攻撃する物や敵全体攻撃の物を指定すれば
- # 一度の遅延効果で複数の敵を攻撃する遅延スキルも作成出来ます。
- # (日文太可怕了,看不懂,估计是延迟技能也可以延迟发动其他技能,做连锁效果)
- #==============================================================================
- module DelayAct
-
- #ターン終了時に発動する場合のキーワード設定
-
- WORD1 = "回合后延迟发动"
-
- #行動後に発動する場合のキーワード設定
-
- WORD2 = "行动后延迟发动"
-
- end
- class RPG::UsableItem < RPG::BaseItem
- #--------------------------------------------------------------------------
- # 遅延発動
- #--------------------------------------------------------------------------
- def delay_skill_data
- @delay_skill_data ||= create_delay_skill_data
- end
- #--------------------------------------------------------------------------
- # 遅延発動データ作成
- #--------------------------------------------------------------------------
- def create_delay_skill_data
- h = {}
- self.note.each_line {|l|
- if /<#{DelayAct::WORD1}[::](\S+)>/ =~ l
- a = $1.to_s.split(/\s*,\s*/).inject([]) {|r,i| r.push(i.to_i)}
- if a.size > 2
- a.push(0) if a.size == 3
- a.push(100) if a.size == 4
- a.push(0)
- h[h.size] = a
- end
- end
- if /<#{DelayAct::WORD2}[::](\S+)>/ =~ l
- a = $1.to_s.split(/\s*,\s*/).inject([]) {|r,i| r.push(i.to_i)}
- if a.size > 2
- a.push(0) if a.size == 3
- a.push(100) if a.size == 4
- a.push(1)
- h[h.size] = a
- end
- end}
- h
- end
- end
- class << BattleManager
- attr_accessor :delay_actions_turnend
- attr_accessor :delay_actions_actend
- attr_accessor :display_name_delayact
- #--------------------------------------------------------------------------
- # メンバ変数の初期化
- #--------------------------------------------------------------------------
- alias init_members_delay_actions init_members
- def init_members
- init_members_delay_actions
- @delay_actions_turnend = []
- @delay_actions_actend = []
- @display_name_delayact = nil
- end
- #--------------------------------------------------------------------------
- # ターン終了時遅延発動の配列内データを更新
- #--------------------------------------------------------------------------
- def delay_actions_turnend_update
- a1 = []
- a2 = []
- @delay_actions_turnend.each_with_index {|a|
- if a[:count] >= 1
- a[:count] -= 1
- a1.push(a)
- else
- a2.push(a)
- end}
- @delay_actions_turnend = a1
- a2
- end
- #--------------------------------------------------------------------------
- # 行動終了時遅延発動の配列内データを更新
- #--------------------------------------------------------------------------
- def delay_actions_actend_update(target)
- ar = []
- @delay_actions_actend.each {|a|
- next if target != a[:target]
- if a[:count] <= 0
- ar.push(a.clone)
- else
- a[:count] -= 1
- end}
- ar.each {|a| @delay_actions_actend.delete(a)}
- ar
- end
- end
- class Game_Battler < Game_BattlerBase
- #--------------------------------------------------------------------------
- # スキル/アイテムの使用者側への効果
- #--------------------------------------------------------------------------
- alias item_user_effect_delayact item_user_effect
- def item_user_effect(user, item)
- if $game_party.in_battle
- item.delay_skill_data.each_value {|data|
- if data[4].to_i > rand(100)
- count = data[2].to_i + rand(data[3].to_i + 1)
- sid = data[1].to_i
- item2 = item.is_a?(RPG::Skill) ? $data_skills[sid] : $data_items[sid]
- hash = {:user => user,:target => self,:item => item2,:count => count,:name_type => data[0] == 1 ? true : false}
- if data[5].to_i == 0
- BattleManager.delay_actions_turnend.push(hash)
- else
- BattleManager.delay_actions_actend.push(hash)
- end
- @result.success = true
- end}
- end
- item_user_effect_delayact(user, item)
- end
- #--------------------------------------------------------------------------
- # スキル/アイテムの使用者側への効果
- #--------------------------------------------------------------------------
- def set_deley_act(target,item)
- @pre_delay_actions = @actions.clone
- @actions.clear
- action = Game_Action.new(self,true)
- action.target_index = target.index
- if item.is_a?(RPG::Skill)
- action.set_skill(item.id)
- else
- action.set_item(item.id)
- end
- @actions.push(action)
- end
- #--------------------------------------------------------------------------
- # 遅延行動後のデータ復帰
- #--------------------------------------------------------------------------
- def after_delay_act
- @actions = @pre_delay_actions.clone if movable?
- @pre_delay_actions = nil
- end
- end
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # 行動終了の処理
- #--------------------------------------------------------------------------
- alias process_action_end_delayact process_action_end
- def process_action_end
- a = BattleManager.delay_actions_actend_update(@subject)
- a.each {|hash| delay_act_execute(hash);@log_window.clear} if !a.empty?
- process_action_end_delayact
- end
- #--------------------------------------------------------------------------
- # 遅延行動の実行
- #--------------------------------------------------------------------------
- def delay_act_execute(hash)
- last_subject = @subject
- user = hash[:user]
- target = hash[:target]
- item = hash[:item]
- return unless target.exist?
- return if target.dead?
- @subject = user
- user.set_deley_act(target,item)
- BattleManager.display_name_delayact = target if hash[:name_type]
- use_item
- user.after_delay_act
- @subject = last_subject
- end
- #--------------------------------------------------------------------------
- # ターン終了
- #--------------------------------------------------------------------------
- alias turn_end_delayact turn_end
- def turn_end
- return if @turn_ending_delay_act
- @turn_ending_delay_act = true
- a = BattleManager.delay_actions_turnend_update
- a.each {|hash| delay_act_execute(hash);@log_window.clear} if !a.empty?
- turn_end_delayact
- @turn_ending_delay_act = nil
- end
- end
- class Window_BattleLog < Window_Selectable
- #--------------------------------------------------------------------------
- # スキル/アイテム使用の表示
- #--------------------------------------------------------------------------
- alias display_use_item_delayact display_use_item
- def display_use_item(subject, item)
- s = BattleManager.display_name_delayact
- BattleManager.display_name_delayact = nil
- display_use_item_delayact(s ? s : subject, item)
- end
- end
复制代码 |
评分
-
查看全部评分
|