所謂「被動技能」者,不能使用但是有自動效果。
具體實現方法如下: - class Game_Battler def skill?(skill_id) @skills||=[] return @skills.include?(skill_id) endend复制代码
复制代码啥?就這麽簡單?!
當然不是。這個只是核心語句。作用如同增加一個 actor.state?( )的功能。
因此,我們可以直接複製修改其他現有的特殊狀態效果腳本。比如自動回血: - class Game_Battler def skill?(skill_id) @skills||=[] return @skills.include?(skill_id) endendclass Scene_Battle #-------------------------------------------------------------------------- # ● 刷新画面 (主回合步骤 1 : 准备行动) #-------------------------------------------------------------------------- def update_phase4_step1 # 隐藏帮助窗口 @help_window.visible = false # 判定胜败 if judge # 胜利或者失败的情况下 : 过程结束 return end # 强制行动的战斗者不存在的情况下 if $game_temp.forcing_battler == nil # 设置战斗事件 setup_battle_event # 执行战斗事件中的情况下 if $game_system.battle_interpreter.running? return end end # 强制行动的战斗者存在的情况下 if $game_temp.forcing_battler != nil # 在头部添加后移动 @action_battlers.delete($game_temp.forcing_battler) @action_battlers.unshift($game_temp.forcing_battler) end # 未行动的战斗者不存在的情况下 (全员已经行动) if @action_battlers.size == 0 # 开始同伴命令回合 start_phase2 return end # 初始化动画 ID 和公共事件 ID @animation1_id = 0 @animation2_id = 0 @common_event_id = 0 # 未行动的战斗者移动到序列的头部 @active_battler = @action_battlers.shift # 如果已经在战斗之外的情况下 if @active_battler.index == nil return end # 连续伤害 if @active_battler.hp > 0 and @active_battler.slip_damage? @active_battler.slip_damage_effect @active_battler.damage_pop = true end#-------------------------------------- if @active_battler.hp > 0 and @active_battler.skill?(57) @active_battler.animation_id = 17 # 显示17号动画 @active_battler.damage = -@active_battler.maxhp/5# 兌換傷害 @active_battler.hp += -@active_battler.damage # 恢复1/5的最大生命 @active_battler.damage_pop = true # 将伤害显示在屏幕上 end#-------------------------------------- # 自然解除状态 @active_battler.remove_states_auto # 刷新状态窗口 @status_window.refresh # 移至步骤 2 @phase4_step = 2 endend复制代码
复制代码或者會心一擊率上昇40%: - class Game_Battler def skill?(skill_id) @skills||=[] return @skills.include?(skill_id) endendclass Game_Battler #-------------------------------------------------------------------------- # ● 应用通常攻击效果 # attacker : 攻击者 (battler) #-------------------------------------------------------------------------- def attack_effect(attacker) # 清除会心一击标志 self.critical = false # 第一命中判定 hit_result = (rand(100) < attacker.hit) # 命中的情况下 if hit_result == true # 计算基本伤害 atk = [attacker.atk - self.pdef / 2, 0].max self.damage = atk * (20 + attacker.str) / 20 # 属性修正 self.damage *= elements_correct(attacker.element_set) self.damage /= 100 # 伤害符号正确的情况下 if self.damage > 0#=----------------------------------------------------------------- # 会心一击修正 hit_rate = 4 * attacker.dex / self.agi if attacker.is_a?(Game_Actor) if self.skill?(57) if rand(100) < (hit_rate + 40) self.damage[attacker] *= 2 self.critical[attacker] = true end end else if rand(100) < hit_rate self.damage[attacker] *= 2 self.critical[attacker] = true end#=----------------------------------------------------------------- # 防御修正 if self.guarding? self.damage /= 2 end end # 分散 if self.damage.abs > 0 amp = [self.damage.abs * 15 / 100, 1].max self.damage += rand(amp+1) + rand(amp+1) - amp end # 第二命中判定 eva = 8 * self.agi / attacker.dex + self.eva hit = self.damage < 0 ? 100 : 100 - eva hit = self.cant_evade? ? 100 : hit hit_result = (rand(100) < hit) end # 命中的情况下 if hit_result == true # 状态冲击解除 remove_states_shock # HP 的伤害计算 self.hp -= self.damage # 状态变化 @state_changed = false states_plus(attacker.plus_state_set) states_minus(attacker.minus_state_set) # Miss 的情况下 else # 伤害设置为 "Miss" self.damage = "Miss" # 清除会心一击标志 self.critical = false end # 过程结束 return true endend复制代码
复制代码以上的被動技能都默認爲 57 號技能,也就是 「十字斬」
其他增補功能連接
循環動畫
聲明一下,所謂 「增補功能計劃」都是一些沒有技術含量,不會産生衝突,原作者沒有寫,禾西寫遊戲的副産品,但是有時候很需要的低能語句。
如果你覺得自己有一定水平,不用看也可以辦到,完全用不上。就請漠視……
本帖来自P1论坛作者禾西,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址: https://rpg.blue/forum.php?mod=viewthread&tid=84941 若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。 |