赞 | 0 |
VIP | 3 |
好人卡 | 2 |
积分 | 1 |
经验 | 1895 |
最后登录 | 2018-12-5 |
在线时间 | 44 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 60
- 在线时间
- 44 小时
- 注册时间
- 2010-6-17
- 帖子
- 74
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 ashion 于 2010-10-6 00:22 编辑
RT- #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
- #_/ ◆ オーバードライブ - KGC_OverDrive ◆ VX ◆
- #_/ ◇ Last update : 2009/11/01 ◇
- #_/----------------------------------------------------------------------------
- #_/ 作成使用特殊气槽的技能(超必杀)
- #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
- #==============================================================================
- # ★ Customize项目 - Customize BEGIN ★
- #==============================================================================
- module KGC
- module OverDrive
- # ◆ 特殊气槽的最大值
- # 一般1000便可以了,可以自己微调。
- GAUGE_MAX = 1000
- # ◆ 特殊气槽的增加量
- # 若增加量高,则容易储满。
- # 如果指定负数,则代表特殊气槽减少
- # 「受到伤害」是、减少的HP乘上一定比例计算出来的增加量
- # (500的话、等于HP减少了500,气槽增加值也为500)
- GAIN_RATE = [
- 80, # 攻击
- 500, # 受到伤害
- 200, # 胜利
- 100, # 逃走
- 160, # 单独战斗
- 40, # 行动
- 160, # 濒死
- 50, # 防御
- ] # ← 这个 ] 不可以删掉!
- # ◆ 气槽的初始量
- DEFAULT_GAUGE_NUMBER = 1
- # ◆ 默认会增加气槽的类型
- # 0..攻击 1..受到伤害 2..胜利 3..逃走 4..单独战斗 5..行动
- # 6..濒死 7..防御
- DEFAULT_ACTOR_DRIVE_TYPE = [0, 1, 6] # 角色
- DEFAULT_ENEMY_DRIVE_TYPE = [0, 1, 4, 5, 6] # 敌人
- # ◆ 气槽中的能量颜色
- # 数值 : 和 \C[n] 颜色一样。
- # Color : 指定颜色。 ( Color.new(255, 128, 128) 等 )
- GAUGE_NORMAL_START_COLOR = 14 # 一般开始时的颜色
- GAUGE_NORMAL_END_COLOR = 6 # 一般结束时的颜色
- GAUGE_MAX_START_COLOR = 10 # 最大时的颜色
- GAUGE_MAX_END_COLOR = 2 # 最大结束时的颜色
- # ◆ 特殊气槽设计为和一般气槽相同
- # 只在导入≪一般气槽能量表现≫时有效
- ENABLE_GENERIC_GAUGE = true
- # ◆ 气槽中的能量设定
- # 图片从 "Graphics/System" 中读取
- GAUGE_IMAGE = "GaugeOD" # 一般时的图片
- GAUGE_MAX_IMAGE = "GaugeODMax" # 最大时的图片
- GAUGE_OFFSET = [-23, -2] # 位置修正 [x, y]
- GAUGE_LENGTH = -4 # 长度修正
- GAUGE_SLOPE = 30 # 倾斜度 (-89 ~ 89)
- # ◆ 气槽能量的Y坐标修正值
- # 未使用一般气槽时,才有效
- # 如果是 -8、HP/MP 和气槽在同一位置。
- GAUGE_OFFSET_Y = -8
- # ◆ 能量的数值表示
- # 0 .. 不表示 ※如果有两个能量珠以上时,不推荐这种
- # 1 .. 直接表示 (储存多少直接数字表示)
- # 2 .. 百分比 --> x%
- # 3 .. 百分比 (小数点后一位) --> x.x%
- # 4 .. 百分比 (小数点后两位) --> x.xx%
- # 5 .. 按能量珠表示
- GAUGE_VALUE_STYLE = 2
- # ◆ 能量储存值的表示文字的字体大小
- # 太大的话字体回模糊
- GAUGE_VALUE_FONT_SIZE = 14
- # ◆ 死亡(HP 0)时气槽能量归0
- EMPTY_ON_DEAD = true
- # ◆ 不显示气槽的角色
- # 通过输入角色ID归类为不显示气槽
- HIDE_GAUGE_ACTOR = []
- # ◆ 非战斗时不显示气槽
- HIDE_GAUGE_NOT_IN_BATTLE = false
- # ◆ 没有学习到超必杀技能时,不显示气槽
- HIDE_GAUGE_NO_OD_SKILLS = true
- # ◆ 不显示气槽的场合,不能增加能量
- NOT_GAIN_GAUGE_HIDING = true
- # ◆ 能量不足时不显示超必杀技能
- HIDE_SKILL_LACK_OF_GAUGE = false
- # ◆ 气槽能量的名字
- GAUGE_NAME = "气槽能量"
- # ◆ 使用影响气槽能量的道具时,显示的信息
- OD_GAIN_MESSAGE = {
- :drain_a => "%s夺取了%s的能量!", # 吸收: 角色
- :drain_e => "%s的%s能量被夺取了!", # 吸收: 敌人
- :loss_a => "%s减少了%s的能量!", # 减少: 角色
- :loss_e => "%s减少了%s的能量!", # 减少: 敌人
- :recover_a => "%s增加了%s的能量!", # 增加: 角色
- :recover_e => "%s增加了%s的能量!", # 增加: 敌人
- }
- end
- end
- #==============================================================================
- # ☆ Customize项目结束 - Customize END ☆
- #==============================================================================
- $imported = {} if $imported == nil
- $imported["OverDrive"] = true
- module KGC::OverDrive
- # ドライブタイプ
- module Type
- ATTACK = 0 # 攻击
- DAMAGE = 1 # 受到伤害
- VICTORY = 2 # 胜利
- ESCAPE = 3 # 逃走
- ALONE = 4 # 单独战斗
- ACTION = 5 # 行动
- FATAL = 6 # 濒死
- GUARD = 7 # 防御
- end
- # 储存量表示
- module ValueStyle
- NONE = 0 # 不显示
- IMMEDIATE = 1 # 直接表示
- RATE = 2 # 百分比
- RATE_DETAIL1 = 3 # 百分比 (小数点后一位)
- RATE_DETAIL2 = 4 # 百分比 (小数点后两位)
- NUMBER = 5 # 按能量珠表示
- end
- module Regexp
- module UsableItem
- # 气槽能量增加
- OD_GAIN = /<(?:OD_GAIN|(?:OD|ドライブ)ゲージ増加)\s*([\+\-]?\d+)>/i
- end
- module Skill
- # 超必杀技能
- OVER_DRIVE = /<(?:OVER_DRIVE|オーバードライブ)\s*(\d+)?(\+)?>/i
- # 能量的增加量
- OD_GAIN_RATE =
- /<(?:OD_GAIN_RATE|(?:OD|ドライブ)ゲージ増加率)\s*(\d+)[%%]?>/i
- end
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # □ KGC::Commands
- #==============================================================================
- module KGC
- module Commands
- module_function
- #--------------------------------------------------------------------------
- # ○ 角色的气槽能量的增减
- # actor_id : 角色 ID (-1 : 表示全体)
- # value : 增加量 (可以是负数)
- #--------------------------------------------------------------------------
- def gain_actor_od_gauge(actor_id, value)
- if actor_id == -1
- # 操作生存中的我方角色全员的气槽能量
- $game_party.existing_members.each { |actor|
- next unless actor.can_gain_overdrive?
- actor.overdrive += value
- }
- else
- actor = $game_actors[actor_id]
- actor.overdrive += value if actor != nil && actor.exist?
- end
- end
- #--------------------------------------------------------------------------
- # ○ 敌人的气槽能量的增减
- # enemy_index : 敌人 index (-1 : 表示全体)
- # value : 增加量 (可以是负数)
- #--------------------------------------------------------------------------
- def gain_enemy_od_gauge(enemy_index, value)
- if enemy_index == -1
- # 操作生存中的敌方角色全员的气槽能量
- $game_troop.existing_members.each { |enemy|
- enemy.overdrive += value
- }
- else
- enemy = $game_troop.members[enemy_index]
- enemy.overdrive += value if enemy != nil && enemy.exist?
- end
- end
- #--------------------------------------------------------------------------
- # ○ 角色的气槽能量的获得
- # actor_id : 角色 ID
- # variable_id : 可以容纳的返回值的变量数 ID
- #--------------------------------------------------------------------------
- def get_actor_od_gauge(actor_id, variable_id = 0)
- actor = $game_actors[actor_id]
- n = (actor != nil ? actor.overdrive : 0)
- if variable_id > 0
- $game_variables[variable_id] = n
- end
- return n
- end
- #--------------------------------------------------------------------------
- # ○ 敌方的气槽能量的获得
- # enemy_index : 敌人 index
- # variable_id : 可以容纳的返回值的变量数 ID
- #--------------------------------------------------------------------------
- def get_enemy_od_gauge(enemy_index, variable_id = 0)
- enemy = $game_troop.members[enemy_index]
- n = (enemy != nil ? enemy.overdrive : 0)
- if variable_id > 0
- $game_variables[variable_id] = n
- end
- return n
- end
- #--------------------------------------------------------------------------
- # ○ 角色的气槽能量的能量珠数
- # actor_id : 角色 ID (-1 : 表示全体)
- # number : 能量珠数
- #--------------------------------------------------------------------------
- def set_actor_od_gauge_number(actor_id, number)
- if actor_id == -1
- # 设定我方角色全体的能量珠数
- $game_party.members.each { |actor|
- actor.drive_gauge_number = number
- }
- else
- actor = $game_actors[actor_id]
- actor.drive_gauge_number = number if actor != nil
- end
- end
- #--------------------------------------------------------------------------
- # ○ 敌方的气槽能量的能量珠数
- # enemy_index : 敌方 index (-1 : 表示全体)
- # number : 能量猪数
- #--------------------------------------------------------------------------
- def set_enemy_od_gauge_number(enemy_index, number)
- if enemy_index == -1
- # 设定生存中的敌方全体的能量珠数
- $game_troop.members.each { |enemy|
- enemy.drive_gauge_number = number
- }
- else
- enemy = $game_troop.members[enemy_index]
- enemy.drive_gauge_number = number if enemy != nil
- end
- end
- #--------------------------------------------------------------------------
- # ○ 角色的气槽能量变为最大时的设置
- # actor_id : 角色 ID
- #--------------------------------------------------------------------------
- def actor_od_gauge_max?(actor_id)
- actor = $game_actors[actor_id]
- return false if actor == nil
- return actor.overdrive == actor.max_overdrive
- end
- #--------------------------------------------------------------------------
- # ○ 敌方的气槽能量变为最大时的设置
- # enemy_index : 敌方 index
- #--------------------------------------------------------------------------
- def enemy_od_gauge_max?(enemy_index)
- enemy = $game_troop.members[enemy_index]
- return false if enemy == nil
- return enemy.overdrive == enemy.max_overdrive
- end
- #--------------------------------------------------------------------------
- # ○ 改变角色的能量槽类型
- # actor_id : 角色 ID (-1 : 表示全体)
- # types : 能量槽的类型列表 (省略时 : 初始化)
- #--------------------------------------------------------------------------
- def set_actor_drive_type(actor_id, types = nil)
- if actor_id == -1
- # 改变角色全体的能量槽类型
- $game_party.members.each { |actor|
- actor.drive_type = types
- }
- else
- actor = $game_actors[actor_id]
- actor.drive_type = types if actor != nil
- end
- end
- #--------------------------------------------------------------------------
- # ○ 改变敌方的能量槽类型
- # enemy_index : 敌方 index (-1 : 表示全体)
- # types : 能量槽的类型列表 (省略时 : 初始化)
- #--------------------------------------------------------------------------
- def set_enemy_drive_type(enemy_index, types = nil)
- if enemy_index == -1
- # 改变敌方全体的能量槽类型
- $game_troop.members.each { |enemy|
- enemy.drive_type = types
- }
- else
- enemy = $game_troop.members[enemy_index]
- enemy.drive_type = types if enemy != nil
- end
- end
- end
- end
- class Game_Interpreter
- include KGC::Commands
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ RPG::UsableItem
- #==============================================================================
- class RPG::UsableItem < RPG::BaseItem
- #--------------------------------------------------------------------------
- # ○ 超必杀技能的生成
- #--------------------------------------------------------------------------
- def create_overdrive_cache
- @__od_gain = 0
- self.note.each_line { |line|
- case line
- when KGC::OverDrive::Regexp::UsableItem::OD_GAIN
- # 增加气槽能量
- @__od_gain = $1.to_i
- end
- }
- end
- #--------------------------------------------------------------------------
- # ○ 气槽能量的增加量
- #--------------------------------------------------------------------------
- def od_gain
- create_overdrive_cache if @__od_gain == nil
- return @__od_gain
- end
- #--------------------------------------------------------------------------
- # ○ 如果有超必杀技能的话
- #--------------------------------------------------------------------------
- def overdrive
- return false
- end
- alias overdrive? overdrive
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ RPG::Skill
- #==============================================================================
- class RPG::Skill < RPG::UsableItem
- #--------------------------------------------------------------------------
- # ○ 生存超必杀技能的内存
- #--------------------------------------------------------------------------
- def create_overdrive_cache
- super
- @__is_overdrive = false
- @__od_cost = KGC::OverDrive::GAUGE_MAX
- @__od_consume_all = false
- @__od_gain_rate = 100
- self.note.each_line { |line|
- case line
- when KGC::OverDrive::Regexp::Skill::OVER_DRIVE
- # オーバードライブ
- @__is_overdrive = true
- @__od_cost = $1.to_i if $1 != nil
- @__od_consume_all = ($2 != nil)
- when KGC::OverDrive::Regexp::Skill::OD_GAIN_RATE
- # 能量增加率
- @__od_gain_rate = $1.to_i
- end
- }
- # 如果没有超必杀技能,则能量槽能量为0
- unless @__is_overdrive
- @__od_cost = 0
- end
- end
- #--------------------------------------------------------------------------
- # ○ 如果有超必杀技能
- #--------------------------------------------------------------------------
- def overdrive
- create_overdrive_cache if @__is_overdrive == nil
- return @__is_overdrive
- end
- alias overdrive? overdrive
- #--------------------------------------------------------------------------
- # ○ 气槽能量的消耗值
- #--------------------------------------------------------------------------
- def od_cost
- create_overdrive_cache if @__od_cost == nil
- return @__od_cost
- end
- #--------------------------------------------------------------------------
- # ○ 气槽能量全部消耗掉
- #--------------------------------------------------------------------------
- def od_consume_all
- create_overdrive_cache if @__od_consume_all == nil
- return @__od_consume_all
- end
- alias od_consume_all? od_consume_all
- #--------------------------------------------------------------------------
- # ○ 气槽能量的增加率
- #--------------------------------------------------------------------------
- def od_gain_rate
- create_overdrive_cache if @__od_gain_rate == nil
- return @__od_gain_rate
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Vocab
- #==============================================================================
- module Vocab
- # 气槽能量名
- def self.overdrive
- return KGC::OverDrive::GAUGE_NAME
- end
- # 角色这边的显示信息
- ActorODDrain = KGC::OverDrive::OD_GAIN_MESSAGE[:drain_a]
- ActorODLoss = KGC::OverDrive::OD_GAIN_MESSAGE[:loss_a]
- ActorODRecovery = KGC::OverDrive::OD_GAIN_MESSAGE[:recover_a]
- # 敌人那边的显示信息
- EnemyODDrain = KGC::OverDrive::OD_GAIN_MESSAGE[:drain_e]
- EnemyODLoss = KGC::OverDrive::OD_GAIN_MESSAGE[:loss_e]
- EnemyODRecovery = KGC::OverDrive::OD_GAIN_MESSAGE[:recover_e]
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Game_Battler
- #==============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- # ● 公开的公有变量
- #--------------------------------------------------------------------------
- attr_writer :drive_type # 气槽类型
- attr_reader :od_damage # 行动结果: 气槽伤害
- #--------------------------------------------------------------------------
- # ● 清除保存行动效果的变量
- #--------------------------------------------------------------------------
- alias clear_action_results_KGC_OverDrive clear_action_results
- def clear_action_results
- clear_action_results_KGC_OverDrive
- @od_damage = 0
- end
- #--------------------------------------------------------------------------
- # ○ 获得气槽能量
- #--------------------------------------------------------------------------
- def overdrive
- @overdrive = 0 if @overdrive == nil
- return @overdrive
- end
- #--------------------------------------------------------------------------
- # ○ 操作气槽能量
- #--------------------------------------------------------------------------
- def overdrive=(value)
- @overdrive = [[value, max_overdrive].min, 0].max
- end
- #--------------------------------------------------------------------------
- # ○ 获得气槽能量的最大值
- #--------------------------------------------------------------------------
- def max_overdrive
- return KGC::OverDrive::GAUGE_MAX * drive_gauge_number
- end
- #--------------------------------------------------------------------------
- # ○ 能量为MAX时的判定
- #--------------------------------------------------------------------------
- def overdrive_max?
- return (overdrive == max_overdrive)
- end
- #--------------------------------------------------------------------------
- # ○ 能量珠数的取得
- #--------------------------------------------------------------------------
- def drive_gauge_number
- if @drive_gauge_number == nil
- @drive_gauge_number = KGC::OverDrive::DEFAULT_GAUGE_NUMBER
- end
- return @drive_gauge_number
- end
- #--------------------------------------------------------------------------
- # ○ 操作能量珠数
- #--------------------------------------------------------------------------
- def drive_gauge_number=(value)
- @drive_gauge_number = [value, 1].max
- end
- #--------------------------------------------------------------------------
- # ○ 气槽类型的取得
- #--------------------------------------------------------------------------
- def drive_type
- return []
- end
- #--------------------------------------------------------------------------
- # ○ 超必杀是否学习到的判断
- #--------------------------------------------------------------------------
- def overdrive_skill_learned?
- return true
- end
- #--------------------------------------------------------------------------
- # ○ 气槽是否表示的判断
- #--------------------------------------------------------------------------
- def od_gauge_visible?
- return false
- end
- #--------------------------------------------------------------------------
- # ○ 能量可否增加的判断
- #--------------------------------------------------------------------------
- def can_gain_overdrive?
- return true
- end
- #--------------------------------------------------------------------------
- # ○ 攻撃時増加判定
- #--------------------------------------------------------------------------
- def drive_attack?
- return drive_type.include?(KGC::OverDrive::Type::ATTACK)
- end
- #--------------------------------------------------------------------------
- # ○ 受到伤害时的增加判断
- #--------------------------------------------------------------------------
- def drive_damage?
- return drive_type.include?(KGC::OverDrive::Type::DAMAGE)
- end
- #--------------------------------------------------------------------------
- # ○ 胜利时的增加判断
- #--------------------------------------------------------------------------
- def drive_victory?
- return drive_type.include?(KGC::OverDrive::Type::VICTORY)
- end
- #--------------------------------------------------------------------------
- # ○ 逃走时的增加判断
- #--------------------------------------------------------------------------
- def drive_escape?
- return drive_type.include?(KGC::OverDrive::Type::ESCAPE)
- end
- #--------------------------------------------------------------------------
- # ○ 单独战斗时的增加判断
- #--------------------------------------------------------------------------
- def drive_alone?
- return drive_type.include?(KGC::OverDrive::Type::ALONE)
- end
- #--------------------------------------------------------------------------
- # ○ 行动时的增加判断
- #--------------------------------------------------------------------------
- def drive_action?
- return drive_type.include?(KGC::OverDrive::Type::ACTION)
- end
- #--------------------------------------------------------------------------
- # ○ 濒死的增加判断
- #--------------------------------------------------------------------------
- def drive_fatal?
- return drive_type.include?(KGC::OverDrive::Type::FATAL)
- end
- #--------------------------------------------------------------------------
- # ○ 防御时的增加判断
- #--------------------------------------------------------------------------
- def drive_guard?
- return drive_type.include?(KGC::OverDrive::Type::GUARD)
- end
- #--------------------------------------------------------------------------
- # ● 状态附加
- # state_id : 状态 ID
- #--------------------------------------------------------------------------
- alias add_state_KGC_OverDrive add_state
- def add_state(state_id)
- add_state_KGC_OverDrive(state_id)
- reset_overdrive_on_dead if dead?
- end
- #--------------------------------------------------------------------------
- # ○ 计算技能消耗的能量
- # skill : 技能
- #--------------------------------------------------------------------------
- def calc_od_cost(skill)
- return 0 unless skill.is_a?(RPG::Skill)
- return skill.od_cost
- end
- #--------------------------------------------------------------------------
- # ● 技能是否可以使用的判断
- # skill : 技能
- #--------------------------------------------------------------------------
- alias skill_can_use_KGC_OverDrive? skill_can_use?
- def skill_can_use?(skill)
- return false unless skill_can_use_KGC_OverDrive?(skill)
- return false if calc_od_cost(skill) > overdrive
- return true
- end
- #--------------------------------------------------------------------------
- # ● 基于技能或物品的伤害判定
- # user : 技能或物品的使用者
- # obj : 技能或物品
- # 结果将代入 @hp_damage 或 @mp_damage 。
- #--------------------------------------------------------------------------
- alias make_obj_damage_value_KGC_OverDrive make_obj_damage_value
- def make_obj_damage_value(user, obj)
- make_obj_damage_value_KGC_OverDrive(user, obj)
- apply_od_consume_all_for_damage(user, obj)
- end
- #--------------------------------------------------------------------------
- # ○ 适用于气槽能量全消耗时
- # user : 技能或物品的使用者
- # obj : 技能或物品
- # 结果将代入 @hp_damage 或 @mp_damage 。
- #--------------------------------------------------------------------------
- def apply_od_consume_all_for_damage(user, obj)
- return unless obj.is_a?(RPG::Skill)
- return unless obj.overdrive? && obj.od_consume_all?
- # 剩余能量消耗的强化 (例: 最低消耗量为 1000 时消耗 1200 的话效果是 1.2 倍)
- rate = [user.overdrive * 1000 / obj.od_cost, 1000].max
- @hp_damage = @hp_damage * rate / 1000
- @mp_damage = @mp_damage * rate / 1000
- end
- #--------------------------------------------------------------------------
- # ● 受到伤害时的反映
- # user : 技能或物品的使用者
- # 若要使用此部分,请先设置 @hp_damage、@mp_damage、@absorbed 。
- #--------------------------------------------------------------------------
- alias execute_damage_KGC_OverDrive execute_damage
- def execute_damage(user)
- execute_damage_KGC_OverDrive(user)
- increase_overdrive(user)
- increase_overdrive_by_item(user)
- end
- #--------------------------------------------------------------------------
- # ○ 死亡时气槽能量的初始化
- #--------------------------------------------------------------------------
- def reset_overdrive_on_dead
- return unless KGC::OverDrive::EMPTY_ON_DEAD
- self.overdrive = 0
- end
- #--------------------------------------------------------------------------
- # ○ 气槽能量的增加处理
- # attacker : 攻击者
- #--------------------------------------------------------------------------
- def increase_overdrive(attacker = nil)
- return unless attacker.is_a?(Game_Battler) # 攻击者非战场单位
- return unless actor? ^ attacker.actor? # 攻击者和防御者在同一阵型
- return if hp_damage == 0 && mp_damage == 0 # 不受到伤害
- increase_attacker_overdrive(attacker)
- increase_defender_overdrive(attacker)
- reset_overdrive_on_dead if dead?
- end
- #--------------------------------------------------------------------------
- # ○ 攻击方的气槽能量处理
- # attacker : 攻击者
- #--------------------------------------------------------------------------
- def increase_attacker_overdrive(attacker)
- return unless can_gain_overdrive?
- return unless attacker.drive_attack? # ドライブタイプ「攻撃」なし
- od_gain = KGC::OverDrive::GAIN_RATE[KGC::OverDrive::Type::ATTACK]
- if attacker.action.kind == 1
- rate = attacker.action.skill.od_gain_rate # スキルの倍率を適用
- od_gain = od_gain * rate / 100
- if rate > 0
- od_gain = [od_gain, 1].max
- elsif rate < 0
- od_gain = [od_gain, -1].min
- end
- end
- attacker.overdrive += od_gain
- end
- #--------------------------------------------------------------------------
- # ○ 防御方的气槽能量处理
- # attacker : 攻击者
- #--------------------------------------------------------------------------
- def increase_defender_overdrive(attacker)
- return unless can_gain_overdrive?
- return unless self.drive_damage? # 气槽类型不受到伤害
- rate = KGC::OverDrive::GAIN_RATE[KGC::OverDrive::Type::DAMAGE]
- od_gain = 0
- od_gain += hp_damage * rate / maxhp if hp_damage > 0
- od_gain += mp_damage * rate / maxmp if mp_damage > 0 && maxmp > 0
- if rate > 0
- od_gain = [od_gain, 1].max
- elsif rate < 0
- od_gain = [od_gain, -1].min
- end
- self.overdrive += od_gain
- end
- #--------------------------------------------------------------------------
- # ○ 使用物品增加气槽时的处理
- # user : 使用者
- #--------------------------------------------------------------------------
- def increase_overdrive_by_item(user = nil)
- return unless user.is_a?(Game_Battler)
- return unless can_gain_overdrive?
- if user.action.skill?
- obj = user.action.skill
- elsif user.action.item?
- obj = user.action.item
- else
- return
- end
- @od_damage = -obj.od_gain
- self.overdrive -= @od_damage
- end
- #--------------------------------------------------------------------------
- # ● 适用于技能效果
- # user : 技能的使用者
- # skill : 技能
- #--------------------------------------------------------------------------
- alias skill_effect_KGC_OverDrive skill_effect
- def skill_effect(user, skill)
- skill_effect_KGC_OverDrive(user, skill)
- # 无视物品或技能对气槽能量的影响
- if $imported["ReproduceFunctions"] && $game_temp.exec_skill_on_item
- return
- end
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # ● 设置
- # actor_id : 角色 ID
- #--------------------------------------------------------------------------
- alias setup_KGC_OverDrive setup
- def setup(actor_id)
- setup_KGC_OverDrive(actor_id)
- @overdrive = 0
- @drive_type = nil
- end
- #--------------------------------------------------------------------------
- # ○ 气槽类型的获得
- #--------------------------------------------------------------------------
- def drive_type
- unless @drive_type.is_a?(Array)
- return KGC::OverDrive::DEFAULT_ACTOR_DRIVE_TYPE
- end
- return @drive_type
- end
- #--------------------------------------------------------------------------
- # ○ 判断是否学习到超必杀技能
- #--------------------------------------------------------------------------
- def overdrive_skill_learned?
- result = false
- # 解除一时的战斗FLAG
- last_in_battle = $game_temp.in_battle
- $game_temp.in_battle = false
- self.skills.each { |skill|
- if skill.overdrive?
- result = true
- break
- end
- }
- $game_temp.in_battle = last_in_battle
- return result
- end
- #--------------------------------------------------------------------------
- # ○ 判断是否可以增加气槽能量
- #--------------------------------------------------------------------------
- def can_gain_overdrive?
- if KGC::OverDrive::NOT_GAIN_GAUGE_HIDING
- # 不表示
- return false unless od_gauge_visible_l?
- end
- if KGC::OverDrive::HIDE_GAUGE_NO_OD_SKILLS
- # 没有学到超必杀
- return false unless overdrive_skill_learned?
- end
- return true
- end
- #--------------------------------------------------------------------------
- # ○ 气槽能量的表示判断
- #--------------------------------------------------------------------------
- def od_gauge_visible?
- return false unless od_gauge_visible_l?
- return false unless can_gain_overdrive?
- return true
- end
- #--------------------------------------------------------------------------
- # ○ 气槽能量的表示判断 (简易版)
- #--------------------------------------------------------------------------
- def od_gauge_visible_l?
- # 战斗中不表示
- if KGC::OverDrive::HIDE_GAUGE_NOT_IN_BATTLE && !$game_temp.in_battle
- return false
- end
- # 完全不表示
- return false if KGC::OverDrive::HIDE_GAUGE_ACTOR.include?(self.id)
- return true
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Game_Enemy
- #==============================================================================
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # ● 对象初始化
- # index : 敌方团体的编号
- # enemy_id : 敌方编号 ID
- #--------------------------------------------------------------------------
- alias initialize_KGC_OverDrive initialize
- def initialize(index, enemy_id)
- initialize_KGC_OverDrive(index, enemy_id)
- @overdrive = 0
- @drive_type = nil
- end
- #--------------------------------------------------------------------------
- # ○ 气槽类型的取得
- #--------------------------------------------------------------------------
- def drive_type
- unless @drive_type.is_a?(Array)
- return KGC::OverDrive::DEFAULT_ENEMY_DRIVE_TYPE
- end
- return @drive_type
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Window_Base
- #==============================================================================
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # ○ 气槽能量的一般颜色 1 的获得
- #--------------------------------------------------------------------------
- def od_gauge_normal_color1
- color = KGC::OverDrive::GAUGE_NORMAL_START_COLOR
- return (color.is_a?(Integer) ? text_color(color) : color)
- end
- #--------------------------------------------------------------------------
- # ○ 气槽能量的一般颜色 2 的获得
- #--------------------------------------------------------------------------
- def od_gauge_normal_color2
- color = KGC::OverDrive::GAUGE_NORMAL_END_COLOR
- return (color.is_a?(Integer) ? text_color(color) : color)
- end
- #--------------------------------------------------------------------------
- # ○ 气槽能量的最大颜色 1 的获得
- #--------------------------------------------------------------------------
- def od_gauge_max_color1
- color = KGC::OverDrive::GAUGE_MAX_START_COLOR
- return (color.is_a?(Integer) ? text_color(color) : color)
- end
- #--------------------------------------------------------------------------
- # ○ 气槽能量的最大颜色 2 的获得
- #--------------------------------------------------------------------------
- def od_gauge_max_color2
- color = KGC::OverDrive::GAUGE_MAX_END_COLOR
- return (color.is_a?(Integer) ? text_color(color) : color)
- end
- #--------------------------------------------------------------------------
- # ● 名字的表示
- # actor : 角色
- # x : X坐标
- # y : Y坐标
- #--------------------------------------------------------------------------
- alias draw_actor_name_KGC_OverDrive draw_actor_name
- def draw_actor_name(actor, x, y)
- draw_actor_od_gauge(actor, x, y, 108)
- draw_actor_name_KGC_OverDrive(actor, x, y)
- end
- #--------------------------------------------------------------------------
- # ○ 气槽能量的表示
- # actor : 角色
- # x : X坐标
- # y : Y坐标
- # width : 宽度
- #--------------------------------------------------------------------------
- def draw_actor_od_gauge(actor, x, y, width = 120)
- return unless actor.od_gauge_visible?
- n = actor.overdrive % KGC::OverDrive::GAUGE_MAX
- n = KGC::OverDrive::GAUGE_MAX if actor.overdrive_max?
- if KGC::OverDrive::ENABLE_GENERIC_GAUGE && $imported["GenericGauge"]
- # 汎用ゲージ
- file = (actor.overdrive_max? ?
- KGC::OverDrive::GAUGE_MAX_IMAGE : KGC::OverDrive::GAUGE_IMAGE)
- draw_gauge(file,
- x, y, width, n, KGC::OverDrive::GAUGE_MAX,
- KGC::OverDrive::GAUGE_OFFSET,
- KGC::OverDrive::GAUGE_LENGTH,
- KGC::OverDrive::GAUGE_SLOPE)
- else
- # デフォルトゲージ
- gw = width * n / KGC::OverDrive::GAUGE_MAX
- gc1 = (gw == width ? od_gauge_max_color1 : od_gauge_normal_color1)
- gc2 = (gw == width ? od_gauge_max_color2 : od_gauge_normal_color2)
- self.contents.fill_rect(x, y + WLH + KGC::OverDrive::GAUGE_OFFSET_Y,
- width, 6, gauge_back_color)
- self.contents.gradient_fill_rect(
- x, y + WLH + KGC::OverDrive::GAUGE_OFFSET_Y, gw, 6, gc1, gc2)
- end
- draw_actor_od_gauge_value(actor, x, y, width)
- end
- #--------------------------------------------------------------------------
- # ○ 气槽能量的储存量的表示
- # actor : 角色
- # x : X坐标
- # y : Y坐标
- # width : 宽度
- #--------------------------------------------------------------------------
- def draw_actor_od_gauge_value(actor, x, y, width = 120)
- text = ""
- value = actor.overdrive * 100.0 / KGC::OverDrive::GAUGE_MAX
- case KGC::OverDrive::GAUGE_VALUE_STYLE
- when KGC::OverDrive::ValueStyle::IMMEDIATE
- text = actor.overdrive.to_s
- when KGC::OverDrive::ValueStyle::RATE
- text = sprintf("%d%%", actor.overdrive * 100 / KGC::OverDrive::GAUGE_MAX)
- when KGC::OverDrive::ValueStyle::RATE_DETAIL1
- text = sprintf("%0.1f%%", value)
- when KGC::OverDrive::ValueStyle::RATE_DETAIL2
- text = sprintf("%0.2f%%", value)
- when KGC::OverDrive::ValueStyle::NUMBER
- text = "#{actor.overdrive / KGC::OverDrive::GAUGE_MAX}"
- else
- return
- end
- last_font_size = self.contents.font.size
- new_font_size = KGC::OverDrive::GAUGE_VALUE_FONT_SIZE
- self.contents.font.size = new_font_size
- self.contents.draw_text(
- x, y + WLH + KGC::OverDrive::GAUGE_OFFSET_Y - new_font_size / 2,
- width, new_font_size, text, 2)
- self.contents.font.size = last_font_size
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Window_Skill
- #==============================================================================
- if KGC::OverDrive::HIDE_SKILL_LACK_OF_GAUGE
- class Window_Skill < Window_Selectable
- #--------------------------------------------------------------------------
- # ○ 如果含有技能的列表?
- # skill : 技能
- #--------------------------------------------------------------------------
- unless $@
- alias include_KGC_OverDrive? include? if method_defined?(:include?)
- end
- def include?(skill)
- return false if skill == nil
- if defined?(include_KGC_OverDrive?)
- return false unless include_KGC_OverDrive?(skill)
- end
- if skill.overdrive?
- return (@actor.calc_od_cost(skill) <= @actor.overdrive)
- else
- return true
- end
- end
- if method_defined?(:include_KGC_OverDrive?)
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- @data = []
- for skill in @actor.skills
- next unless include?(skill)
- @data.push(skill)
- if skill.id == @actor.last_skill_id
- self.index = @data.size - 1
- end
- end
- @item_max = @data.size
- create_contents
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- end # <-- class
- end # <-- if KGC::OverDrive::HIDE_SKILL_LACK_OF_GAUGE
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Scene_Skill
- #==============================================================================
- class Scene_Skill < Scene_Base
- #--------------------------------------------------------------------------
- # ● 使用技能 (使用效果适用于非我方人物)
- #--------------------------------------------------------------------------
- alias use_skill_nontarget_KGC_OverDrive use_skill_nontarget
- def use_skill_nontarget
- consume_od_gauge
- use_skill_nontarget_KGC_OverDrive
- end
- #--------------------------------------------------------------------------
- # ○ 使用技能时气槽能量的消耗
- #--------------------------------------------------------------------------
- def consume_od_gauge
- if @skill.od_consume_all?
- @actor.overdrive = 0
- else
- @actor.overdrive -= @actor.calc_od_cost(@skill)
- end
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Scene_Battle
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # ● 战斗结束
- # result : 结果 (0:胜利 1:逃走 2:失败)
- #--------------------------------------------------------------------------
- alias battle_end_KGC_OverDrive battle_end
- def battle_end(result)
- increase_overdrive_on_battle_end(result)
- battle_end_KGC_OverDrive(result)
- end
- #--------------------------------------------------------------------------
- # ○ 战斗结束时气槽能量的增加处理
- # result : 结果 (0:胜利 1:逃走 2:失败)
- #--------------------------------------------------------------------------
- def increase_overdrive_on_battle_end(result)
- case result
- when 0 # 胜利
- od_gain = KGC::OverDrive::GAIN_RATE[KGC::OverDrive::Type::VICTORY]
- $game_party.existing_members.each { |actor|
- actor.overdrive += od_gain if actor.drive_victory?
- }
- when 1 # 逃走
- od_gain = KGC::OverDrive::GAIN_RATE[KGC::OverDrive::Type::ESCAPE]
- $game_party.existing_members.each { |actor|
- actor.overdrive += od_gain if actor.drive_escape?
- }
- end
- end
- #--------------------------------------------------------------------------
- # ● 战斗行动的实行
- #--------------------------------------------------------------------------
- alias execute_action_KGC_OverDrive execute_action
- def execute_action
- increase_overdrive_on_action
- execute_action_KGC_OverDrive
- end
- #--------------------------------------------------------------------------
- # ○ 行动时的气槽能量的增加处理
- #--------------------------------------------------------------------------
- def increase_overdrive_on_action
- battler = @active_battler
- od_gain = 0
- unit = (battler.actor? ? $game_party : $game_troop)
- # 单独战斗
- if battler.drive_alone? && unit.existing_members.size == 1
- od_gain += KGC::OverDrive::GAIN_RATE[KGC::OverDrive::Type::ALONE]
- end
- # 行动
- if battler.drive_action?
- od_gain += KGC::OverDrive::GAIN_RATE[KGC::OverDrive::Type::ACTION]
- end
- # 濒死
- if battler.drive_fatal? && battler.hp < battler.maxhp / 4
- od_gain += KGC::OverDrive::GAIN_RATE[KGC::OverDrive::Type::FATAL]
- end
- # 防御
- if battler.drive_guard? && battler.action.kind == 0 &&
- battler.action.basic == 1
- od_gain += KGC::OverDrive::GAIN_RATE[KGC::OverDrive::Type::GUARD]
- end
- battler.overdrive += od_gain
- end
- #--------------------------------------------------------------------------
- # ● 战斗行动的实行:技能
- #--------------------------------------------------------------------------
- alias execute_action_skill_KGC_OverDrive execute_action_skill
- def execute_action_skill
- execute_action_skill_KGC_OverDrive
- consume_od_gauge
- end
- #--------------------------------------------------------------------------
- # ○ 技能使用时的气槽能量的增加处理
- #--------------------------------------------------------------------------
- def consume_od_gauge
- return unless @active_battler.action.skill?
- skill = @active_battler.action.skill
- if skill.od_consume_all?
- @active_battler.overdrive = 0
- else
- @active_battler.overdrive -= @active_battler.calc_od_cost(skill)
- end
- end
- #--------------------------------------------------------------------------
- # ● 伤害的表示
- # target : 目标
- # obj : 技能或物品
- #--------------------------------------------------------------------------
- alias display_damage_KGC_OverDrive display_damage
- def display_damage(target, obj = nil)
- display_damage_KGC_OverDrive(target, obj)
- return if target.missed || target.evaded
- display_od_damage(target, obj)
- end
- #--------------------------------------------------------------------------
- # ○ 超必杀的伤害表示
- # target : 目标
- # obj : 技能或物品
- #--------------------------------------------------------------------------
- def display_od_damage(target, obj = nil)
- return if target.dead?
- return if target.od_damage == 0
- if target.absorbed # 吸收
- fmt = target.actor? ? Vocab::ActorODDrain : Vocab::EnemyODDrain
- text = sprintf(fmt, target.name, Vocab::overdrive)
- elsif target.od_damage > 0 # 受到伤害
- fmt = target.actor? ? Vocab::ActorODLoss : Vocab::EnemyODLoss
- text = sprintf(fmt, target.name, Vocab::overdrive)
- else # 回复
- fmt = target.actor? ? Vocab::ActorODRecovery : Vocab::EnemyODRecovery
- text = sprintf(fmt, target.name, Vocab::overdrive)
- Sound.play_recovery
- end
- @message_window.add_instant_text(text)
- wait(30)
- end
- end
复制代码 |
|