赞 | 0 |
VIP | 30 |
好人卡 | 0 |
积分 | 1 |
经验 | 5318 |
最后登录 | 2016-11-17 |
在线时间 | 60 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 60 小时
- 注册时间
- 2008-8-27
- 帖子
- 531
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 angelwangm 于 2009-7-22 14:26 编辑
这个战斗公式的脚本和技能升级的脚本冲突了,两个效果只能出来一个
求救........- #============================================================================
- #
- # ●●作为XP的整核心战斗公式重新整理,很多东西不再是默认的使用前请看懂说明
- # 否则会莫名奇妙
- # 该脚本与装备扩充,不兼容不过稍作协调即可,另外属性扩从也需要协调
- #
- # ---------------------------------------------------------------------------
- # 新的装备属性设定
- # ●武器的会心几率 = 武器的灵巧
- # ●武器命中修正 = 武器的力量
- # ●实际攻击 = 力量 + 装备攻击
- #
- # 那么所有的防具的力量都改成攻击力了
- # 考虑到有些人希望升级有防御力
- # 为了方便设定,把灵巧改为防御(魔法防御的话,不同人的意见很不同,把魔力基础跟魔防基础)
- # ●实际防御 = 基础灵巧 + 装备防御力
- # ●实际魔防 = 基础魔力 + 装备魔防 (基础就是本身的,不加装备的属性)
- # 如果还需要防具如首饰也有会心几率的话
- # ●防具的会心几率 = 防具的灵巧
- # 关于怪物的相关属性,由于怪物没有装备,所以就设为默认
- # ●怪物的:命中 = 速度 + 力量,会心率 = 灵巧,躲闪 = 速度 + 回避修正(力量是干什么的?)
- # 最后战斗公式
- # ●攻击力 = 攻击 + 力量
- # ●伤害 = 攻击力 - 防御力
- # ●会心几率 = 会心几率(怪物,主角不一样啊)
- # ●命中率% = 武器命中 + 速度 - 敌方速度 -敌方回避修正
- #-------------------------------------------------------------------------------
- # 新的技能属性设定
- # 技能灵巧为技能会心率
- # 关于技能命中你可以做如下设定;
- # 当技能命中设定为0时,该技能没有自身命中,其命中与主角普通攻击时命中相同
- # 最终技能公式
- # ●伤害 = 技能威力 + (主角能力)* 相关度 - 敌人守备 * 相关度
- # ●会心率 = 技能灵巧
- #----------------暂时这样吧,大概跟火纹相似--------------------------------------------------------
- class Game_Actor < Game_Battler
- #--------是否为主角----------------------------------------------------
- def actor?
- true
- end
- #--------------------------------------------------------------------------
- # ● 获取基本力量
- #--------------------------------------------------------------------------
- def base_str
- n = $data_actors[@actor_id].parameters[2, @level]
- #weapon = $data_weapons[@weapon_id]
- #armor1 = $data_armors[@armor1_id]
- #armor2 = $data_armors[@armor2_id]
- #armor3 = $data_armors[@armor3_id]
- #armor4 = $data_armors[@armor4_id]
- #n += weapon != nil ? weapon.str_plus : 0
- #n += armor1 != nil ? armor1.str_plus : 0
- #n += armor2 != nil ? armor2.str_plus : 0
- #n += armor3 != nil ? armor3.str_plus : 0
- #n += armor4 != nil ? armor4.str_plus : 0
- return [[n, 1].max, 999].min
- end
- #--------------------------------------------------------------------------
- # ● 获取基本灵巧 — 这个是会心率啦!
- #--------------------------------------------------------------------------
- def base_dex
- #n = $data_actors[@actor_id].parameters[3, @level]
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- armor5 = $data_armors[@armor5_id] if @armor5_id != nil
- armor6 = $data_armors[@armor6_id] if @armor6_id != nil
- n = weapon != nil ? weapon.dex_plus : 0
- n += armor1 != nil ? armor1.dex_plus : 0
- n += armor2 != nil ? armor2.dex_plus : 0
- n += armor3 != nil ? armor3.dex_plus : 0
- n += armor4 != nil ? armor4.dex_plus : 0
- n += armor5 != nil ? armor5.dex_plus : 0
- n += armor6 != nil ? armor6.dex_plus : 0
- return [[n, 1].max, 999].min
- end
- #--------------------------------------------------------------------------
- # ● 获取基本攻击力
- #--------------------------------------------------------------------------
- def base_atk
- n = $data_actors[@actor_id].parameters[2, @level]
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- armor5 = $data_armors[@armor5_id] if @armor5_id != nil
- armor6 = $data_armors[@armor6_id] if @armor6_id != nil
- n += weapon != nil ? weapon.atk : 0
- n += armor1 != nil ? armor1.str_plus : 0
- n += armor2 != nil ? armor2.str_plus : 0
- n += armor3 != nil ? armor3.str_plus : 0
- n += armor4 != nil ? armor4.str_plus : 0
- n += armor5 != nil ? armor5.str_plus : 0
- n += armor6 != nil ? armor6.str_plus : 0
- return [[n, 1].max, 999].min
- end
- #--------------------------------------------------------------------------
- # ● 获取基本物理防御
- #--------------------------------------------------------------------------
- def base_pdef
- n = $data_actors[@actor_id].parameters[3, @level]
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- armor5 = $data_armors[@armor5_id] if @armor5_id != nil
- armor6 = $data_armors[@armor6_id] if @armor5_id != nil
- pdef1 = weapon != nil ? weapon.pdef : 0
- pdef2 = armor1 != nil ? armor1.pdef : 0
- pdef3 = armor2 != nil ? armor2.pdef : 0
- pdef4 = armor3 != nil ? armor3.pdef : 0
- pdef5 = armor4 != nil ? armor4.pdef : 0
- pdef6 = armor5 != nil ? armor5.pdef : 0
- pdef7 = armor6 != nil ? armor6.pdef : 0
- return pdef1 + pdef2 + pdef3 + pdef4 + pdef5 + pdef6 + pdef7 + n
- end
- #--------------------------------------------------------------------------
- # ● 获取基本魔法防御
- #--------------------------------------------------------------------------
- def base_mdef
- n = $data_actors[@actor_id].parameters[5, @level]
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- armor5 = $data_armors[@armor5_id] if @armor5_id != nil
- armor6 = $data_armors[@armor6_id] if @armor5_id != nil
- mdef1 = weapon != nil ? weapon.mdef : 0
- mdef2 = armor1 != nil ? armor1.mdef : 0
- mdef3 = armor2 != nil ? armor2.mdef : 0
- mdef4 = armor3 != nil ? armor3.mdef : 0
- mdef5 = armor4 != nil ? armor4.mdef : 0
- mdef6 = armor5 != nil ? armor5.mdef : 0
- mdef7 = armor6 != nil ? armor6.mdef : 0
- return mdef1 + mdef2 + mdef3 + mdef4 + mdef5 + mdef6 + mdef7 + n
- end
- #--------------------------------------------------------------------------
- # ● 获取修正命中率
- #--------------------------------------------------------------------------
- def base_hit
- weapon = $data_weapons[@weapon_id]
- return weapon != nil ? weapon.str_plus : 0
- end
- end
- #==============================================================================
- # ■ Game_Enemy
- #------------------------------------------------------------------------------
- # 处理敌人的类。本类在 Game_Troop 类 ($game_troop) 的
- # 内部使用。
- #==============================================================================
- class Game_Enemy < Game_Battler
- def actor?
- false
- end
- def base_hit
- return $data_enemies[@enemy_id].str
- end
- end
- #==============================================================================
- # ■ Game_Battler (分割定义 1)
- #------------------------------------------------------------------------------
- # 处理战斗者的类。这个类作为 Game_Actor 类与 Game_Enemy 类的
- # 超级类来使用。
- #==============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- # ● 获取命中修正
- #--------------------------------------------------------------------------
- def eva
- return base_hit
- end
- #--------------------------------------------------------------------------
- # ● 应用通常攻击效果
- # attacker : 攻击者 (battler)
- #--------------------------------------------------------------------------
- def attack_effect(attacker)
- # 清除会心一击标志
- self.critical = false
- # 第一命中判定
- hit_result = (rand(100) < 101)
- # 命中的情况下
- if hit_result == true
- # 计算基本伤害
- self.damage = [attacker.atk - self.pdef , 0].max + rand(30) +12
- # 属性修正
- self.damage *= elements_correct(attacker.element_set)
- self.damage /= 100
- # 伤害符号正确的情况下
- if self.damage > 0
- # 会心一击修正
- if rand(100) < attacker.dex
- self.damage *= 3
- self.critical = 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
- # 第二命中判定
- 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
- end
- #--------------------------------------------------------------------------
- # ● 应用特技效果
- # user : 特技的使用者 (battler)
- # skill : 特技
- #--------------------------------------------------------------------------
- def skill_effect(user, skill)
- # 清除会心一击标志
- self.critical = false
- # 特技的效果范围是 HP 1 以上的己方、自己的 HP 为 0、
- # 或者特技的效果范围是 HP 0 的己方、自己的 HP 为 1 以上的情况下
- if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
- ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
- # 过程结束
- return false
- end
- # 清除有效标志
- effective = false
- # 公共事件 ID 是有效的情况下,设置为有效标志
- effective |= skill.common_event_id > 0
- # 第一命中判定
- if skill.hit !=0
- hit = skill.hit
- else
- hit = user.hit + user.agi - self.agi - self.eva
- end
- if skill.atk_f > 0
- hit *= user.hit / 100
- end
- hit_result = (rand(100) < 101)
- # 不确定的特技的情况下设置为有效标志
- effective |= hit < 100
- # 命中的情况下
- if hit_result == true
- # 计算威力
- power = skill.power #+ user.atk * skill.atk_f / 100
- if power > 0
- power -= self.pdef * skill.pdef_f / 100
- power -= self.mdef * skill.mdef_f / 100
- power += (user.int * skill.int_f / 100)
- power += (user.atk * skill.atk_f / 100)
- #===============================================================
- power = [power, 0].max + rand(40) + 16
-
- #===============================================================
-
- else
- power -= (user.int * skill.int_f / 100)
- power -= (user.atk * skill.atk_f / 100)
- end
- # 计算倍率
- # rate = 20
- # rate += (user.str * skill.str_f / 100)
- # rate += (user.dex * skill.dex_f / 100)
- # rate += (user.agi * skill.agi_f / 100)
-
- # 计算基本伤害
- self.damage = power
- # 属性修正
- self.damage *= elements_correct(skill.element_set)
- self.damage /= 100
- # 伤害符号正确的情况下
- if self.damage > 0
- #h会心修正
- if rand(100) < skill.dex_f
- self.damage *= 3
- self.critical = true
- end
- # 防御修正
- if self.guarding?
- self.damage /= 2
- end
- end
- # 分散
- if skill.variance > 0 and self.damage.abs > 0
- amp = [self.damage.abs * skill.variance / 100, 1].max
- self.damage += rand(amp+1) + rand(amp+1) - amp
- end
-
- # 不确定的特技的情况下设置为有效标志
- effective |= hit < 100
- end
- # 命中的情况下
- if hit_result == true
- # 威力 0 以外的物理攻击的情况下
- if skill.power != 0 and skill.atk_f > 0
- # 状态冲击解除
- remove_states_shock
- # 设置有效标志
- effective = true
- end
- # HP 的伤害减法运算
- last_hp = self.hp
- self.hp -= self.damage
- effective |= self.hp != last_hp
- # 状态变化
- @state_changed = false
- effective |= states_plus(skill.plus_state_set)
- effective |= states_minus(skill.minus_state_set)
- # 威力为 0 的场合
- if skill.power == 0
- # 伤害设置为空的字串
- self.damage = ""
- # 状态没有变化的情况下
- unless @state_changed
- # 伤害设置为 "Miss"
- self.damage = "Miss"
- end
- end
- # Miss 的情况下
- else
- # 伤害设置为 "Miss"
- self.damage = "Miss"
- end
- # 不在战斗中的情况下
- unless $game_temp.in_battle
- # 伤害设置为 nil
- self.damage = nil
- end
- # 过程结束
- return effective
- end
- end
复制代码- #=====================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #====================================================================
- #====================================================================
- # ■ スキルアップデート Ver. 4.4.0 by Claimh
- #---------------------------------------------------------------
- # スキルごとにレベル制を導入する
- # 戦闘中にスキルを使用するほど、威力上昇、消費SP減少、命中率上昇
- #==============================================================
- module Skill_updata
- S_MIGHT = []
- S_COST = []
- S_HIT = []
- S_LEVEL = []
- S_INTER = []
- S_SLOPE = []
- S_ANIME = []
- S_ELEMENT = []
- S_STATE_P = []
- S_STATE_N = []
- #=============================================================
- # □ 自定义内容
- #==============================================================
- # 威力上升使用true/false
- SKILL_MIGHT_UP = true
-
- # SP消耗减少使用true/false
- SP_COST_DOWN = false
-
- # 命中率上升使用true/false
- SKILL_HIT_UP = true
-
- # 属性变化的使用true/false
- ELEMENT_CHANGE = true
-
- # 状态变化的使用true/false
- STATE_CHANGE = true
-
- # 显示特技等级上升true/false
- SHOW_SKILL_LV_UP = true
-
- # 等级上升的声效,不用的时候就=nil
- SKILLUP_SE = "wd006"
-
- # 菜单使用计数true/false
- MENU_COUNT = true
- # 升级所需次数
- UPDATA_INTERVAL = 1
-
- # 等级上限
- LEVEL_LIMIT = 20
- # 威力上升率(%%)
- MIGHT_RATE = 20
-
- # SP消耗减少率(%)
- COST_RATE = 3
-
- # 命中上升率(%)
- HIT_RATE = 1
- #-------------------------------------------------------------
- # 特别技能的详细设定,57和61号特技分别是十字斩和扫荡,大家最熟悉的两个招数
- #----------------------------------------------------------------
-
- # 界限水平
- # S_LEVEL[技艺ID]=[角色ID=>界限,…]
- S_LEVEL[57] = {1=>18, 2=>12, 3=>5, 4=>12, 5=>12, 6=>12, 7=>12, 8=>12}
- S_LEVEL[61] = {1=>12, 2=>18, 3=>15, 4=>12, 5=>12, 6=>12, 7=>12, 8=>12}
-
- # 技艺&actor威力上升率
- # S_MIGHT[技艺ID]=[角色ID=>威力上升率,…]
- S_MIGHT[57] = {1=>2, 2=>2, 3=>5, 4=>2, 5=>2, 6=>2, 7=>2, 8=>2}
- S_MIGHT[61] = {1=>2, 2=>8, 3=>5, 4=>2, 5=>2, 6=>2, 7=>2, 8=>2}
- # 技艺&actorSP消费减少率
- # S_COST[技艺ID]=[角色ID=>SP消费减少率,…]
- S_COST[57] = {1=>8, 2=>2, 3=>5, 4=>2, 5=>2, 6=>2, 7=>2, 8=>2}
- S_COST[61] = {1=>2, 2=>8, 3=>5, 4=>2, 5=>2, 6=>2, 7=>2, 8=>2}
- # 技艺&actor命中率
- # S_HIT[技艺ID]=[角色ID=>命中上升率,…]
- S_HIT[57] = {1=>2, 2=>1, 3=>1, 4=>1, 5=>1, 6=>1, 7=>1, 8=>1}
- S_HIT[61] = {1=>1, 2=>2, 3=>1, 4=>1, 5=>1, 6=>1, 7=>1, 8=>1}
- #-----------------------------------------------------------------
- # 技能成长的具体调节
- #-----------------------------------------------------------------
- # 技艺的增长图形
- # 0:使用技艺一定回数的话提高水平
- # 1:技艺一定回数+每水平の使用提高水平
- SKILL_PATTERN = 0
-
- # 技艺水平上升间隔每(使用几回Lv提高)
- # ※没有设定的情况→基本设定被适应
- # S_INTER[技艺ID]=[角色ID=>上升间隔,…]
- S_INTER[57] = {1=>5, 2=>8, 3=>8, 4=>8, 5=>8, 6=>8, 7=>8, 8=>8}
-
- # スキルレベル上昇の傾き(パターン1を使用する場合のみ必要)
- # ※設定がない場合は1となります。
- # S_SLOPE[スキルID] = [アクターID=>上昇の傾き, …]
- S_SLOPE[57] = {1=>5, 2=>8, 3=>8, 4=>8, 5=>8, 6=>8, 7=>8, 8=>8}
- #-------------------------------------------------------------
- # 技艺增长的话使之动画变化
- # 记录格式: S_ANIME[技艺ID] = [角色ID=>[[等级, 动画ID]], ・・・]
- #------------------------------------------------------------
- # 实施技艺增长的动画变化?
- USE_S_ANIME = true
-
- # 設定例
- # 1号角色,57号特技,lv5,lv10动画变化
- # 2号角色,Lv.11动画变化
- S_ANIME[57] = {1=>[[5, 69], [10, 70]], 2=>[[11, 70]]}
- #-------------------------------------------------------------------
- # 属性変化/状态変化
- #------------------------------------------------------------------
- # 属性変化
- # S_ELEMENT[技艺ID] = {角色ID=>{水平=>[属性ID,属性ID…]}, ・・・・}
- S_ELEMENT[57] = {1=>{1=>[1], 2=>[2], 3=>[3]}, 2=>{1=>[2], 2=>[5]}}
- # 状态変化+
- # S_STATE_P[技艺ID] = {角色ID=>{水平=>[属性ID,属性ID…]}, ・・・・}
- S_STATE_P[57] = {1=>{1=>[1], 2=>[2], 3=>[3]}, 2=>{1=>[2], 2=>[5]}}
- # 状态変化-
- # S_STATE_N[技艺ID] = {角色ID=>{水平=>[属性ID,属性ID…]}, ・・・・}
- S_STATE_N[57] = {1=>{1=>[1], 2=>[2], 3=>[3]}, 2=>{1=>[2], 2=>[5]}}
- #==================================================================
- # □ 自定义内容终了
- #==================================================================
- end
- class Game_Actor
- include Skill_updata
- attr_accessor :skill_use # スキル使用回数
- attr_accessor :skill_level # スキルレベル
- attr_accessor :skill_power # スキル威力更新値
- attr_accessor :skill_sp_cost # スキルSP消費更新値
- attr_accessor :skill_hit # スキル命中率
- attr_accessor :skill_up # レベルアップフラグ
- attr_accessor :skill_list # スキルEXPリスト
- alias skill_updata_init setup
- def setup(actor_id)
- skill_updata_init(actor_id)
- @skill_use = []
- @skill_level = []
- @skill_power = []
- @skill_sp_cost = []
- @skill_hit = []
- @skill_up = false
- @skill_list = []
- for id in 1...$data_skills.size
- @skill_use[id] = 0
- @skill_level[id] = 0
- @skill_power[id] = $data_skills[id].power
- @skill_sp_cost[id] = $data_skills[id].sp_cost
- @skill_hit[id] = $data_skills[id].hit
- @skill_list[id] = make_skill_list(id)
- end
- end
- #-------------------------------------------------------------
- # ● スキルEXP 計算
- #------------------------------------------------------------
- def make_skill_list(skill_id)
- interval = S_INTER[skill_id]
- up_interval = ( (interval != nil and interval[@actor_id] != nil) ? interval[@actor_id] : UPDATA_INTERVAL )
- slope = S_SLOPE[skill_id]
- up_slope = ( (slope != nil and slope[@actor_id] != nil) ? slope[@actor_id] : 1 )
- limit = S_LEVEL[skill_id]
- limit_lv = ( (limit != nil and limit[@actor_id] != nil) ? limit[@actor_id] : LEVEL_LIMIT )
- list = []
- list[0] = 0
- for lv in 1...limit_lv+1
- exp = 0
- case SKILL_PATTERN
- when 0
- exp = up_interval * lv
- when 1
- exp = list[lv-1] + up_slope * lv + up_interval
- end
- list[lv] = exp.truncate
- end
- return list
- end
- end
- class Game_Battler
- include Skill_updata
- #-----------------------------------------------------------------
- # ● スキルの効果適用
- # user : スキルの使用者 (バトラー)
- # skill : スキル
- #-------------------------------------------------------------
- alias skill_effect_update skill_effect
- def skill_effect(user, skill)
- up_flag = false
- if user.is_a?(Game_Actor) and ($scene.is_a?(Scene_Battle) or MENU_COUNT)
- skill_update_main(user, skill)
- skill_base = skill.dup
- # 威力上昇
- if SKILL_MIGHT_UP
- skill.power = user.skill_power[skill.id]
- end
- # 命中率上昇
- if SKILL_HIT_UP
- skill.hit = user.skill_hit[skill.id]
- end
- # 属性変化
- if ELEMENT_CHANGE and S_ELEMENT != []
- ele1 = S_ELEMENT[skill.id]
- if ele1 != nil and ele1[user.id] != nil
- ele2 = ele1[user.id]
- if ele2 != [] and ele2[user.skill_level[skill.id]] != nil
- skill.element_set = ele2[user.skill_level[skill.id]]
- end
- end
- end
- # ステート変化
- if STATE_CHANGE
- if S_STATE_P != []
- pst1 = S_STATE_P[skill.id]
- if pst1 != nil and pst1[user.id] != nil
- pst2 = pst1[user.id]
- if pst2 != nil and pst2[user.skill_level[skill.id]] != nil
- skill.plus_state_set = pst2[user.skill_level[skill.id]]
- # p skill.plus_state_set
- end
- end
- end
- if S_STATE_N != []
- nst1 = S_STATE_N[skill.id]
- if nst1 != nil and nst1[user.id] != nil
- nst2 = nst1[user.id]
- if nst1 != nil and nst2[user.skill_level[skill.id]] != nil
- skill.minus_state_set = nst2[user.skill_level[skill.id]]
- end
- end
- end
- end
- up_flag = true
- end
- ret = skill_effect_update(user, skill) # 原物
- if up_flag
- skill = skill_base
- # Miss時には後戻し
- if self.damage == "miss"
- skill_use_recount(user, skill)
- end
- end
- return ret
- end
-
- #------------------------------------------------------------
- # ● スキルアップデータメイン
- #-------------------------------------------------------------
- def skill_update_main(actor, skill)
- # スキル使用回数のカウント
- actor.skill_use[skill.id] += 1
- # リミット取得
- limit = S_LEVEL[skill.id]
- s_limit = ( (limit != nil and limit[actor.id] != nil) ? limit[actor.id] : LEVEL_LIMIT)
- # 書き換え限界到達
- if s_limit == false or actor.skill_level[skill.id] < s_limit
- # レベルアップ間隔取得
- interval = actor.skill_list[skill.id]
- # 書き換え回数到達
- if actor.skill_use[skill.id] == interval[actor.skill_level[skill.id]+1]
- # スキルレベル上昇
- actor.skill_level[skill.id] += 1
- actor.skill_up = true
- # 威力上昇 = 有効
- if SKILL_MIGHT_UP
- might = S_MIGHT[skill.id]
- might_rate = ((might != nil and might[actor.id] != nil) ? might[actor.id] : MIGHT_RATE)
- # 補正値更新
- actor.skill_power[skill.id] += skill.power * might_rate / 100
- actor.skill_power[skill.id] = actor.skill_power[skill.id].truncate
- end
- # SP消費減少 = 有効
- if SP_COST_DOWN
- cost = S_COST[skill.id]
- cost_rate = ((cost != nil and cost[actor.id] != nil) ? cost[actor.id] : COST_RATE)
- actor.skill_sp_cost[skill.id] -= skill.sp_cost * cost_rate / 100
- actor.skill_sp_cost[skill.id] = actor.skill_sp_cost[skill.id].truncate
- # SP消費が0以下はありえない
- if actor.skill_sp_cost[skill.id] < 0
- actor.skill_sp_cost[skill.id] = 0
- end
- end
- # 命中率上昇 = 有効
- if SKILL_HIT_UP
- hit = S_HIT[skill.id]
- hit_rate = ((hit != nil and hit[actor.id] != nil) ? hit[actor.id] : HIT_RATE)
- actor.skill_hit[skill.id] += skill.hit * hit_rate / 100
- actor.skill_hit[skill.id] = actor.skill_hit[skill.id].truncate
- # 100以上はありえない
- if actor.skill_hit[skill.id] > 100
- actor.skill_hit[skill.id] = 100
- end
- end
- end
- end
- end
-
- #---------------------------------------------------------
- # ● 再カウント
- #------------------------------------------------------
- def skill_use_recount(actor, skill)
- if actor.skill_up
- actor.skill_level[skill.id] -= 1
- # 威力を再計算
- if SKILL_MIGHT_UP
- actor.skill_power[skill.id] = skill.power
- might = S_MIGHT[skill.id]
- might_rate = ((might != nil and might[actor.id] != nil) ? might[actor.id] : MIGHT_RATE)
- for i in 1...actor.skill_level[skill.id]
- actor.skill_power[skill.id] += skill.power * might_rate / 100
- actor.skill_power[skill.id] = actor.skill_power[skill.id].truncate
- end
- end
- # SP消費再計算
- if SP_COST_DOWN
- actor.skill_sp_cost[skill.id] = skill.sp_cost
- cost = S_COST[skill.id]
- cost_rate = ((cost != nil and cost[actor.id] != nil) ? cost[actor.id] : COST_RATE)
- for i in 1...actor.skill_level[skill.id]
- actor.skill_sp_cost[skill.id] -= skill.sp_cost * cost_rate / 100
- actor.skill_sp_cost[skill.id] = actor.skill_sp_cost[skill.id].truncate
- end
- # SP消費が0以下はありえない
- if actor.skill_sp_cost[skill.id] < 0
- actor.skill_sp_cost[skill.id] = 0
- end
- end
- # 命中率再計算
- if SKILL_HIT_UP
- actor.skill_hit[skill.id] = skill.hit
- hit = S_HIT[skill.id]
- hit_rate = ((hit != nil and hit[actor.id] != nil) ? hit[actor.id] : HIT_RATE)
- for i in 1...actor.skill_level[skill.id]
- actor.skill_hit[skill.id] += skill.hit * hit_rate / 100
- actor.skill_hit[skill.id] = actor.skill_hit[skill.id].truncate
- end
- # 100以上はありえない
- if actor.skill_hit[skill.id] > 100
- actor.skill_hit[skill.id] = 100
- end
- end
- actor.skill_up = false
- end
- actor.skill_use[skill.id] -= 1
- end
- end
- #=================================================================
- # スキル成長によるアニメーション変化
- #=================================================================
- class Scene_Battle
- include Skill_updata
- #--------------------------------------------------------------
- # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
- #-----------------------------------------------------------
- alias update_phase4_step4_skillup update_phase4_step4
- def update_phase4_step4
- update_phase4_step4_skillup
- if USE_S_ANIME#@active_battler.is_a?(Game_Actor) and
- s_anime = S_ANIME[@skill.id]
- # 設定がないなら無視
- if s_anime != nil and s_anime[@active_battler.id] != nil
- s_anime_set = s_anime[@active_battler.id]
- for i in 0...s_anime_set.size
- s_anime_def = s_anime_set[i]
- # 規定レベル以上
- if @active_battler.skill_level[@skill.id] >= s_anime_def[0]
- # 対象側アニメーション
- for target in @target_battlers
- target.animation_id = s_anime_def[1]
- end
- end
- end
- end
- end
- end
- end
- #=================================================================
- # 以下、レベルアップ表示部分(レベルアップ表示がいらないなら消してもOK)
- #=================================================================
- class Scene_Battle
- include Skill_updata
- if SHOW_SKILL_LV_UP
- #----------------------------------------------------------
- # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
- #----------------------------------------------------------
- alias update_phase4_step2_skillup update_phase4_step2
- def update_phase4_step2
- if @active_battler.is_a?(Game_Actor)
- @active_battler.skill_up = false
- end
- @skillup = false
- update_phase4_step2_skillup # 原物
- end
- #-------------------------------------------------------------
- # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
- #-----------------------------------------------------------
- alias update_phase4_step3_skillup update_phase4_step3
- def update_phase4_step3
- if @active_battler.is_a?(Game_Actor) and @active_battler.skill_up != false
- @skillup = true
- @skill_up_window = Window_Skillup.new(@active_battler)
- if SKILLUP_SE != nil
- Audio.se_play("Audio/SE/" + SKILLUP_SE)
- sleep(0.1)
- end
- end
- update_phase4_step3_skillup
- end
- #--------------------------------------------------------------
- # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
- #--------------------------------------------------------------
- alias update_phase4_step5_skillup update_phase4_step5
- def update_phase4_step5
- if @active_battler.is_a?(Game_Actor) and @skillup
- @skill_up_window.dispose
- @active_battler.skill_up = false
- @skillup = false
- end
- update_phase4_step5_skillup # 原物
- end
- #---------------------------------------------------------------
- # ● フレーム更新
- #----------------------------------------------------------------
- alias update_skillup update
- def update
- if @active_battler.is_a?(Game_Actor) and @active_battler.skill_up and @skillup
- @skill_up_window.contents_opacity -= 4
- end
- update_skillup # 原物
- end
- end # if SHOW_SKILL_LV_UP
- end
- class Window_Skillup < Window_Base
- #--------------------------------------------------------------
- # ● オブジェクト初期化
- # actor : アクター
- #-------------------------------------------------------------
- def initialize(actor)
- super(actor.screen_x-140, 260, 250, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.opacity = 0
- self.contents.font.color = Color.new(255, 64, 0)
- self.contents.draw_text(80, 0, 150, 32, "招式升级!")
- end
- end
-
- #====================================================================
- # 以下、再定義部分を含む(SP消費減少の機能がいらないなら消してもOK)
- #====================================================================
- class Window_Skill < Window_Selectable
- #----------------------------------------------------------------
- # ● 項目の描画
- # index : 項目番号
- #-----------------------------------------------------------------
- def draw_item(index)
- skill = @data[index]
- if @actor.skill_can_use?(skill.id)
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- x = 4
- y = index * 32
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(skill.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- #-修正-----
- @actor.skill_level[skill.id] = 0 if @actor.skill_level[skill.id] == nil
- name_level = skill.name + "(等级" + @actor.skill_level[skill.id].to_s + ")"
- self.contents.draw_text(x + 28, y, 204, 32, name_level, 0)
- @actor.skill_sp_cost[skill.id] = skill.sp_cost if @actor.skill_sp_cost[skill.id] == nil
- self.contents.draw_text(x + 232, y, 48, 32, @actor.skill_sp_cost[skill.id].to_s, 2)
- #----------
- end
- end
- class Scene_Skill
- #----------------------------------------------------------
- # ● フレーム更新 (ターゲットウィンドウがアクティブの場合)
- #-------------------------------------------------------------
- def update_target
- # B ボタンが押された場合
- if Input.trigger?(Input::B)
- # キャンセル SE を演奏
- $game_system.se_play($data_system.cancel_se)
- # ターゲットウィンドウを消去
- @skill_window.active = true
- @target_window.visible = false
- @target_window.active = false
- return
- end
- # C ボタンが押された場合
- if Input.trigger?(Input::C)
- # SP 切れなどで使用できなくなった場合
- unless @actor.skill_can_use?(@skill.id)
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # ターゲットが全体の場合
- if @target_window.index == -1
- # パーティ全体にスキルの使用効果を適用
- used = false
- for i in $game_party.actors
- used |= i.skill_effect(@actor, @skill)
- end
- end
- # ターゲットが使用者の場合
- if @target_window.index <= -2
- # ターゲットのアクターにスキルの使用効果を適用
- target = $game_party.actors[@target_window.index + 10]
- used = target.skill_effect(@actor, @skill)
- end
- # ターゲットが単体の場合
- if @target_window.index >= 0
- # ターゲットのアクターにスキルの使用効果を適用
- target = $game_party.actors[@target_window.index]
- used = target.skill_effect(@actor, @skill)
- end
- # スキルを使った場合
- if used
- # スキルの使用時 SE を演奏
- $game_system.se_play(@skill.menu_se)
- #-----修正---------------------------------------------
- @actor.skill_sp_cost[@skill.id] = @skill.sp_cost if @actor.skill_sp_cost[@skill.id] == nil
- # SP 消費
- @actor.sp -= @actor.skill_sp_cost[@skill.id]
- #------------------------------------------------
- # 各ウィンドウの内容を再作成
- @status_window.refresh
- @skill_window.refresh
- @target_window.refresh
- # 全滅の場合
- if $game_party.all_dead?
- # ゲームオーバー画面に切り替え
- $scene = Scene_Gameover.new
- return
- end
- # コモンイベント ID が有効の場合
- if @skill.common_event_id > 0
- # コモンイベント呼び出し予約
- $game_temp.common_event_id = @skill.common_event_id
- # マップ画面に切り替え
- $scene = Scene_Map.new
- return
- end
- end
- # スキルを使わなかった場合
- unless used
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- end
- return
- end
- end
- end
- class Scene_Battle
- include Skill_updata
- #------------------------------------------------------
- # ● スキルアクション 結果作成
- #-------------------------------------------------------
- alias make_skill_action_result_skill_update make_skill_action_result
- def make_skill_action_result
- make_skill_action_result_skill_update
- # SP 消費
- if SP_COST_DOWN and @active_battler.is_a?(Game_Actor)
- @active_battler.sp += @skill.sp_cost
- @active_battler.sp -= @active_battler.skill_sp_cost[@skill.id]
- end
- end
- end
- class Game_Battler
- #--------------------------------------------------------
- # ● スキルの使用可能判定
- # skill_id : スキル ID
- #------------------------------------------------------
- alias skill_update_can_use? skill_can_use?
- def skill_can_use?(skill_id)
- ret = skill_update_can_use?(skill_id)
- if !ret and SP_COST_DOWN
- # SP が足りない場合は使用不可となった?
- if $data_skills[skill_id].sp_cost > self.sp
- if self.is_a?(Game_Actor)
- skill_sp_cost = self.skill_sp_cost[skill_id]
- if skill_sp_cost < self.sp
- ret = true
- end
- end
- end
- end
- return ret
- end
- end
- #===============================================================
- # イベントスクリプト操作
- #===============================================================
- class Interpreter
- include Skill_updata
- #-----------------------------------------------------------
- # ● スキルレベル設定(レベルセット)
- # actor_id : アクターID
- # skill_id : スキルID
- # level : 設定レベル
- #-----------------------------------------------------------
- def set_skill_level(actor_id, skill_id, level)
- actor = $game_actors[actor_id]
- skill = $data_skills[skill_id]
- # リミット取得
- limit = S_LEVEL[skill_id]
- s_limit = ( (limit != nil and limit[actor.id] != nil) ? limit[actor.id] : LEVEL_LIMIT)
- if level > s_limit or level < 0
- return
- end
- # レベル
- actor.skill_level[skill.id] = level
- # 使用回数
- use_list = actor.skill_list[skill.id]
- actor.skill_use[skill.id] = use_list[level]
- # 威力を再計算
- if SKILL_MIGHT_UP
- actor.skill_power[skill.id] = skill.power
- might = S_MIGHT[skill.id]
- might_rate = ((might != nil and might[actor.id] != nil) ? might[actor.id] : MIGHT_RATE)
- for i in 0...level
- actor.skill_power[skill.id] += skill.power * might_rate / 100
- actor.skill_power[skill.id] = actor.skill_power[skill.id].truncate
- end
- end
- # SP消費再計算
- if SP_COST_DOWN
- actor.skill_sp_cost[skill.id] = skill.sp_cost
- cost = S_COST[skill.id]
- cost_rate = ((cost != nil and cost[actor.id] != nil) ? cost[actor.id] : COST_RATE)
- for i in 0...level
- actor.skill_sp_cost[skill.id] -= skill.sp_cost * cost_rate / 100
- actor.skill_sp_cost[skill.id] = actor.skill_sp_cost[skill.id].truncate
- end
- # SP消費が0以下はありえない
- if actor.skill_sp_cost[skill.id] < 0
- actor.skill_sp_cost[skill.id] = 0
- end
- end
- # 命中率再計算
- if SKILL_HIT_UP
- actor.skill_hit[skill.id] = skill.hit
- hit = S_HIT[skill.id]
- hit_rate = ((hit != nil and hit[actor.id] != nil) ? hit[actor.id] : HIT_RATE)
- for i in 0...level
- actor.skill_hit[skill.id] += skill.hit * hit_rate / 100
- actor.skill_hit[skill.id] = actor.skill_hit[skill.id].truncate
- end
- # 100以上はありえない
- if actor.skill_hit[skill.id] > 100
- actor.skill_hit[skill.id] = 100
- end
- end
- end
-
- #---------------------------------------------------------
- # ● スキルレベル設定(レベルアップ)
- # actor_id : アクターID
- # skill_id : スキルID
- #--------------------------------------------------------
- def skill_level_up(actor_id, skill_id)
- actor = $game_actors[actor_id]
- set_skill_level(actor_id, skill_id, actor.skill_level[skill_id]+1)
- end
-
- #-------------------------------------------------------
- # ● スキルレベル設定(レベルダウン)
- # actor_id : アクターID
- # skill_id : スキルID
- #--------------------------------------------------------
- def skill_level_down(actor_id, skill_id)
- actor = $game_actors[actor_id]
- set_skill_level(actor_id, skill_id, actor.skill_level[skill_id]-1)
- end
- end
- #==================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==================================================================
复制代码 |
|