module RPG
class Skill < UsableItem
def description
nnn = @description.split(/,/)[0].to_s
return nnn == nil ? '' : nnn
end
def skill_waiting
nnn = @description.split(/,/)[1].to_i
return nnn == nil ? 0 : nnn
end
end
end
#==============================================================================
# ■ Game_Battler (分割定义 1)
#------------------------------------------------------------------------------
# 处理角色的类。
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 公开变数
#--------------------------------------------------------------------------
attr_accessor :hp_damage # 行动結果: HP 伤害
attr_accessor :mp_damage # 行动結果: MP 伤害
attr_accessor :move_x # X方向的移动修正
attr_accessor :move_y # Y方向的移动修正
attr_accessor :move_z # Z方向的移动修正
attr_accessor :jump # 修正跳跃
attr_accessor :active # 是否主动
attr_accessor :non_dead # 不死身标志
attr_accessor :dying # 即死标志
attr_accessor :slip_damage # 连续伤害标志
attr_accessor :derivation # 技能连发ID
attr_accessor :individual # 技能连发ID
attr_accessor :play # 动作情报
attr_accessor :force_action # 强制动作情报
attr_accessor :force_target # 目标变更情报
attr_accessor :revival # 复活
attr_accessor :double_damage # HPMP两方同时伤害
attr_accessor :reflex # 技能反射情报
attr_accessor :absorb # 技能成本吸收
attr_reader :base_position_x # 初期配置X坐标
attr_reader :base_position_y # 初期配置Y坐标
attr_accessor :force_damage # 事件的伤害
attr_accessor :cp
attr_accessor :turn_count
attr_accessor :my_turn #轮到这个家伙行动了吗?
attr_accessor :waiting_time
attr_accessor :max_waiting_time
#--------------------------------------------------------------------------
# ● 客观初期化
#--------------------------------------------------------------------------
alias initialize_n01 initialize
def initialize
@cp = 0
@turn_count = 0
@waiting_time = 0
@max_waiting_time = 1
@my_turn = false
initialize_n01
@move_x = @move_y = @move_z = @plus_y = @jump = @derivation = @play = 0
@force_action = @force_target = @base_position_x = @base_position_y = 0
@absorb = @act_time = @force_damage = 0
@active = @non_dead = @individual = @slip_damage = @revival = false
@double_damage = @dying = false
# 整合入:特殊脚本
@rx_magic_use = true # ★ 魔法使用的标志
# 整合入:不能回复状态
@rx_hp_cannot_heal = false # ★ HP不能回复标志
@rx_mp_cannot_heal = false # ★ MP不能回复标志
# 整合入:特殊混乱状态
@rx_s_confusion = false # ★ 特殊混乱标志
# 整合入:全员中状态时战败
@rx_st_lose = false # ★ 战败标志
# 整合入:无敌状态
@rx_invincible = false # ★ 无敌标志
# 整合入:暂时改变参数的技能
@rx_chg_atk = 0
@rx_chg_def = 0
@rx_chg_spi = 0
@rx_chg_agi = 0
@rx_chg_params = [0, 0, 0, 0]
# 整合入:自动复活一次状态
@rx_revival_a = false # ★ 防止死亡标志A
@rx_revival_b = false # ★ 防止死亡标志B(完全复活)
@rx_revival_effect_id = 0 # ★ 效果 ID
end
#--------------------------------------------------------------------------
# ● 可以输入命令判定
#--------------------------------------------------------------------------
def inputable?
if @my_turn
return (not @hidden and restriction <= 1)
else
return false
end
end
#--------------------------------------------------------------------------
# ● 返还最新的状态ID
#--------------------------------------------------------------------------
def state_id
return @states[@states.size - 1]
end
#--------------------------------------------------------------------------
# ● 判定技能的使用可能 ※再定义
#--------------------------------------------------------------------------
def skill_can_use?(skill)
return false unless skill.is_a?(RPG::Skill)
return false unless movable?
return false if silent? and skill.spi_f > 0
if skill.extension.include?("HP消耗")
return false if calc_mp_cost(skill) > hp
else
return false if calc_mp_cost(skill) > mp
end
if $game_temp.in_battle
return skill.battle_ok?
else
return skill.menu_ok?
end
end
#--------------------------------------------------------------------------
# ● 伤害效果 ※再定义
# user : 技能或物品使用者
# @hp_damage、@mp_damage、或@absorbed需要在此之前计算完毕。
#--------------------------------------------------------------------------
def execute_damage(user)
if @hp_damage > 0 # 若伤害为正数
remove_states_shock # 攻击移除状态
end
# 特技吟唱期间受到惊扰,本轮行动作废
self.waiting_time = 0
self.hp -= @hp_damage
self.mp -= @mp_damage
if @absorbed # 若吸收
user.hp += @hp_damage
user.mp += @mp_damage
end
end
#--------------------------------------------------------------------------
# ● 技能的消费 MP 计算 ※再定义
#--------------------------------------------------------------------------
def calc_mp_cost(skill)
if half_mp_cost && !skill.extension.include?("MP消耗减半无效")
cost = skill.mp_cost / 2
else
cost = skill.mp_cost
end
if skill.extension.include?("%成本MAX")
return self.maxhp * cost / 100 if skill.extension.include?("HP消耗")
return self.maxmp * cost / 100
elsif skill.extension.include?("%成本NOW")
return self.hp * cost / 100 if skill.extension.include?("HP消耗")
return self.mp * cost / 100
end
return cost
end
#--------------------------------------------------------------------------
# ● 技能成本消费
#--------------------------------------------------------------------------
def consum_skill_cost(skill)
return false unless skill_can_use?(skill)
cost = calc_mp_cost(skill)
return self.hp -= cost if skill.extension.include?("HP消耗")
return self.mp -= cost
end
#--------------------------------------------------------------------------
# ● 根据通常攻击计算伤害 修正二刀流
#--------------------------------------------------------------------------
def make_attack_damage_value(attacker)
damage = attacker.atk * 4 - self.def * 2 # 基础计算
damage = 0 if damage < 0 # 设负数伤害为 0
damage *= elements_max_rate(attacker.element_set) # 属性校正
damage /= 100
if damage == 0 # 若伤害为 0
damage = rand(2) # 一半机率伤害为1
elsif damage > 0 # 若伤害为正数
# 改变人物的重击率 =============================================================
jjj = []
for iii in attacker.states
jjj.push(iii.id)
end
kkk = attacker.cri
if jjj.include?(27)
kkk *= 50
end
if jjj.include?(28)
kkk /= 2
end
# 角色如果装备着特殊装备,则改变重击率
if attacker.is_a?(Game_Actor)
kkk += attacker.critical_up
end
@critical = (rand(100) < kkk) # 会心一击判断
# ==============================================================================
@critical = false if prevent_critical # 防止会心一击判断
# 强硬!必有会心一击!========================
if jjj.include?(46)
@critical = true
end
# ============================================
damage *= 3 if @critical # 会心一击校正
end
damage = apply_variance(damage, 20) # 分散度
damage = apply_guard(damage) # 防御校正
# 攻击特定属性的怪要出问题 =====================================================
if self.is_a?(Game_Enemy)
if $data_enemies[self.enemy_id].note.split(/,/)[0] == "特种敌人"
neodamage = rand(3) + 1
neodamage = 3 if @critical
damage = [damage, neodamage].min
end
end
# ==============================================================================
# 如果攻击者有特定状态,那么攻击也要出问题 =====================================
#if attacker.is_a?(Game_Actor)
jjj = []
for iii in attacker.states
jjj.push(iii.id)
end
if jjj.include?(25)
neodamage = rand(3) + 1
neodamage = 3 if @critical
damage = [damage, neodamage].min
end
#end
# ==============================================================================
@hp_damage = damage # 体力伤害
# 只有在装备了两把武器时修正有效
return unless attacker.actor?
return if attacker.weapons[0] == nil
return if attacker.weapons[1] == nil
@hp_damage = @hp_damage * N01::TWO_SWORDS_STYLE[0] / 100
end
#--------------------------------------------------------------------------
# ● 根据技能或者物品来计算伤害 修正二刀流
#--------------------------------------------------------------------------
def make_obj_damage_value(user, obj)
damage = obj.base_damage # 基础计算
if damage > 0 # 若伤害为正
damage += user.atk * 4 * obj.atk_f / 100 # 使用者攻击力关系度
damage += user.spi * 2 * obj.spi_f / 100 # 使用者精神力关系度
unless obj.ignore_defense # 除非无视防御力
damage -= self.def * 2 * obj.atk_f / 100 # 目标攻击力关系度
# 改了!改成“魔法防”
damage -= self.mdef * 1 * obj.spi_f / 100 # 目标精神力关系度
end
damage = 0 if damage < 0 # 设负数伤害为0
elsif damage < 0 # 若伤害为负
damage -= user.atk * 4 * obj.atk_f / 100 # 使用者攻击力关系度
damage -= user.spi * 2 * obj.spi_f / 100 # 使用者精神力关系度
end
damage *= elements_max_rate(obj.element_set) # 属性校正
damage /= 100
damage = apply_variance(damage, obj.variance) # 分散度
damage = apply_guard(damage) # 防御校正
# 用法术攻击特定属性的怪要出问题 ===============================================
if self.is_a?(Game_Enemy)
if $data_enemies[self.enemy_id].note.split(/,/)[0] == "特种敌人"
if obj.is_a?(RPG::Skill)
damage = [damage, 1].min
end
end
end
# ==============================================================================
# 如果攻击者有特定状态,那么攻击也要出问题 =====================================
#if user.is_a?(Game_Actor)
jjj = []
for iii in user.states
jjj.push(iii.id)
end
if jjj.include?(25)
if obj.is_a?(RPG::Skill)
damage = [damage, 1].min
end
end
#end
# ==============================================================================
if obj.damage_to_mp
@mp_damage = damage # 伤害魔力
else
@hp_damage = damage # 伤害体力
end
# 只有在装备了两把武器时修正有效
return unless user.actor?
return if user.weapons[0] == nil
return if user.weapons[1] == nil
if obj.damage_to_mp
@mp_damage = @mp_damage * N01::TWO_SWORDS_STYLE[1] / 100 # 伤害MP
else
@hp_damage = @hp_damage * N01::TWO_SWORDS_STYLE[1] / 100 # 伤害HP
end
end
#--------------------------------------------------------------------------
# ● 使用通常攻击的効果 全部战斗不能,不能绝对回避的处理
#--------------------------------------------------------------------------
def perfect_attack_effect(attacker)
clear_action_results
make_attack_damage_value(attacker) # 计算伤害
execute_damage(attacker) # 反映伤害
apply_state_changes(attacker) # 状态变化
end
#--------------------------------------------------------------------------
# ● 使用技能的效果 全部战斗不能,不能绝对回避的处理
#--------------------------------------------------------------------------
def perfect_skill_effect(user, skill)
clear_action_results
make_obj_damage_value(user, skill) # 伤害計算
make_obj_absorb_effect(user, skill) # 吸収効果計算
execute_damage(user) # 伤害反映
apply_state_changes(skill) # ステート変化
end
#--------------------------------------------------------------------------
# ● 使用物品的効果 全部战斗不能,不能绝对回避的处理
#--------------------------------------------------------------------------
def perfect_item_effect(user, item)
clear_action_results
hp_recovery = calc_hp_recovery(user, item) # 计算HP的回复量
mp_recovery = calc_mp_recovery(user, item) # 计算MP的回复量
make_obj_damage_value(user, item) # 计算伤害
@hp_damage -= hp_recovery # 扣除HP的回复量
@mp_damage -= mp_recovery # 扣除MP的回复量
make_obj_absorb_effect(user, item) # 计算吸收效果
execute_damage(user) # 反映伤害
item_growth_effect(user, item) # 使用成长效果
if item.physical_attack and @hp_damage == 0 # 物理ノー伤害判定
return
end
apply_state_changes(item) # 状态变化
end
#--------------------------------------------------------------------------
# ● 伤害的反映
#--------------------------------------------------------------------------
alias execute_damage_n01 execute_damage
def execute_damage(user)
execute_damage_n01(user)
# 吸収时这里的处理相冲
if @absorbed
user.hp_damage = -@hp_damage
user.mp_damage = -@mp_damage
end
end
#--------------------------------------------------------------------------
# ● 使用技能的効果
#--------------------------------------------------------------------------
alias skill_effect_n01 skill_effect
def skill_effect(user, obj)
# 保持变化前的HPMP
nowhp = self.hp
nowmp = self.mp
# 为了计算现在HPMP的威力获取变化前的使用者的HPMP
if obj.extension.include?("HP消耗")
user_hp = user.hp + user.calc_mp_cost(obj)
user_mp = user.mp
else
user_hp = user.hp
user_mp = user.mp + user.calc_mp_cost(obj)
end
# 确认扩张设定
check_extension(obj)
# 计算伤害
skill_effect_n01(user, obj)
# 有伤害系的扩张时这里的处理会相冲
if @extension
self.hp = nowhp
self.mp = nowmp
end
# 攻击未名中时中断处理
return if self.evaded or self.missed
# 变换伤害属性
damage = @hp_damage unless obj.damage_to_mp
damage = @mp_damage if obj.damage_to_mp
# 比例伤害
if @ratio_maxdamage != nil
damage = self.maxhp * @ratio_maxdamage / 100 unless obj.damage_to_mp
damage = self.maxmp * @ratio_maxdamage / 100 if obj.damage_to_mp
end
if @ratio_nowdamage != nil
damage = self.hp * @ratio_nowdamage / 100 unless obj.damage_to_mp
damage = self.mp * @ratio_nowdamage / 100 if obj.damage_to_mp
end
# 成本威力
if @cost_damage
cost = user.calc_mp_cost(obj)
if obj.extension.include?("HP消耗")
damage = damage * cost / user.maxhp
else
damage = damage * cost / user.maxmp
end
end
# 现在HP威力
damage = damage * user_hp / user.maxhp if @nowhp_damage
# 现在MP威力
damage = damage * user_mp / user.maxmp if @nowmp_damage
# 放弃伤害属性的变换
@hp_damage = damage unless obj.damage_to_mp
@mp_damage = damage if obj.damage_to_mp
# 反应扩张
if @extension
self.hp -= @hp_damage
self.mp -= @mp_damage
end
# 初期化
@extension = false
@cost_damage = false
@nowhp_damage = false
@nowmp_damage = false
@ratio_maxdamage = nil
@ratio_nowdamage = nil
end
#--------------------------------------------------------------------------
# ● 确认扩张设定
#--------------------------------------------------------------------------
def check_extension(skill)
for ext in skill.extension
# 成本威力
if ext == "成本威力"
@extension = true
next @cost_damage = true
# 现在HP威力
elsif ext == "现HP威力"
@extension = true
next @nowhp_damage = true
# 现在MP威力
elsif ext == "现MP威力"
@extension = true
next @nowmp_damage = true
else
# 比例伤害
name = ext.split('')
if name[5] == "M"
name = name.join
name.slice!("%伤害MAX/")
@extension = true
next @ratio_maxdamage = name.to_i
elsif name[5] == "N"
name = name.join
name.slice!("%伤害NOW/")
@extension = true
next @ratio_nowdamage = name.to_i
end
end
end
end
#--------------------------------------------------------------------------
# ● 初期配置的変更
#--------------------------------------------------------------------------
def change_base_position(x, y)
@base_position_x = x
@base_position_y = y
end
#--------------------------------------------------------------------------
# ● 初期化
#--------------------------------------------------------------------------
def reset_coordinate
@move_x = @move_y = @move_z = @jump = @derivation = 0
@active = @non_dead = @individual = false
end
#--------------------------------------------------------------------------
# ● 使用连续伤害的効果
#--------------------------------------------------------------------------
def slip_damage_effect
if slip_damage? and @hp > 0
@hp_damage = apply_variance(maxhp / 20, 10)
@hp_damage = @hp - 1 if @hp_damage >= @hp
self.hp -= @hp_damage
if self.hp <= 0
self.hp = 1
end
end
end
#--------------------------------------------------------------------------
# ● 事件的伤害POP
#--------------------------------------------------------------------------
def damage_num(num = nil)
return if dead? or !$game_temp.in_battle or num == 0
@force_damage = num
end
end
#==============================================================================
# ■ Game_Troop
#------------------------------------------------------------------------------
# 处理敌人队伍和战斗相关资料的类,也可执行如战斗事件管理之类的功能。
# 本类的实例请参考 $game_troop。
#==============================================================================
class Game_Troop < Game_Unit
#--------------------------------------------------------------------------
# ● 增加回合数
#--------------------------------------------------------------------------
def increase_turn(enemy)
for page in troop.pages
if page.span == 1
@event_flags= false
end
end
#enemy.turn_count += 1
aaa = []
for iii in $game_troop.members
aaa.push(iii.turn_count)
end
@turn_count = aaa.min
end
#--------------------------------------------------------------------------
# ● 生成战斗行动
#--------------------------------------------------------------------------
def make_actions(enemy)
enemy.make_action
end
end
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# 处理主人公的类。
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 公开变数
#--------------------------------------------------------------------------
attr_accessor :two_swords_change # 强制替换二刀流的标志
#--------------------------------------------------------------------------
# ● 根据ID判定技能是否习得
#--------------------------------------------------------------------------
def skill_id_learn?(skill_id)
return @skills.include?(skill_id)
end
#--------------------------------------------------------------------------
# ● 判定技能的使用可能 ※再定义
#--------------------------------------------------------------------------
def skill_can_use?(skill)
return super
end
#--------------------------------------------------------------------------
# ● 图片的变更
#--------------------------------------------------------------------------
def graphic_change(character_name)
@character_name = character_name
end
#--------------------------------------------------------------------------
# ● 击倒的实行 ※再定义
#--------------------------------------------------------------------------
def perform_collapse
Sound.play_actor_collapse if $game_temp.in_battle and dead?
end
#--------------------------------------------------------------------------
# ● 初期配置的取得
#--------------------------------------------------------------------------
def base_position
base = N01::ACTOR_POSITION[self.index]
@base_position_x = base[0]
@base_position_y = base[1]
# バックアタック時はX軸を逆に
@base_position_x = Graphics.width - base[0] if $back_attack && N01::BACK_ATTACK
end
#--------------------------------------------------------------------------
# ● 战斗画面 X 坐标的取得
#--------------------------------------------------------------------------
def position_x
return 0 if self.index == nil
return @base_position_x + @move_x
end
#--------------------------------------------------------------------------
# ● 战斗画面 Y 坐标的取得
#--------------------------------------------------------------------------
def position_y
return 0 if self.index == nil
return @base_position_y + @move_y + @jump
end
#--------------------------------------------------------------------------
# ● 战斗画面 Z 坐标的取得
#--------------------------------------------------------------------------
def position_z
return 0 if self.index == nil
return self.index + @base_position_y + @move_y + @move_z - @jump + 200
end
end
#==============================================================================
# ■ Game_Enemy
#------------------------------------------------------------------------------
# 处理敌方的类。
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ● 公开变数
#--------------------------------------------------------------------------
attr_accessor :adj_speed # 复数会合行动的速度修正
attr_accessor :act_time # 行动数回
#--------------------------------------------------------------------------
# ● 动作速度的決定 复数回合行动用
#--------------------------------------------------------------------------
def make_action_speed2(adj)
@adj_speed = self.action.speed if @adj_speed == nil
@adj_speed = @adj_speed * adj / 100
end
#--------------------------------------------------------------------------
# ● 击倒的实行 ※再定义
#--------------------------------------------------------------------------
def perform_collapse
@force_action = ["N01collapse"] if $game_temp.in_battle and dead?
end
#--------------------------------------------------------------------------
# ● 获取初期配置
#--------------------------------------------------------------------------
def base_position
return if self.index == nil
# 确认角色画像的大小修正Y坐标
bitmap = Bitmap.new("Graphics/Battlers/" + @battler_name) if !self.anime_on
bitmap = Bitmap.new("Graphics/Characters/" + @battler_name) if self.anime_on && N01::WALK_ANIME
bitmap = Bitmap.new("Graphics/Characters/" + @battler_name + "_1") if self.anime_on && !N01::WALK_ANIME
height = bitmap.height
@base_position_x = self.screen_x + self.position_plus[0]
@base_position_y = self.screen_y + self.position_plus[1] - height / 3
bitmap.dispose
# 背后攻击时X轴逆转
if $back_attack && N01::BACK_ATTACK
@base_position_x = Graphics.width - self.screen_x - self.position_plus[0]
end
end
#--------------------------------------------------------------------------
# ● 战斗画面 X 坐标的取得
#--------------------------------------------------------------------------
def position_x
return @base_position_x - @move_x
end
#--------------------------------------------------------------------------
# ● 战斗画面 Y 坐标的取得
#--------------------------------------------------------------------------
def position_y
return @base_position_y + @move_y + @jump
end
#--------------------------------------------------------------------------
# ● 战斗画面 Z 坐标的取得
#--------------------------------------------------------------------------
def position_z
return position_y + @move_z - @jump + 200
end
end
#==============================================================================
# ■ Sprite_Damage
#------------------------------------------------------------------------------
# 伤害表示的精灵。
#==============================================================================
class Sprite_Damage < Sprite_Base
#--------------------------------------------------------------------------
# ● 公开变数
#--------------------------------------------------------------------------
attr_accessor :battler
#--------------------------------------------------------------------------
# ● 客观初期化
#--------------------------------------------------------------------------
def initialize(viewport,battler = nil)
super(viewport)
@battler = battler
@damage = 0
@duration = 0
@x = 0
@y = 0
@z_plus = 0
@minus = false
@num1 = Sprite.new(viewport)
@num2 = Sprite.new(viewport)
@num3 = Sprite.new(viewport)
@num4 = Sprite.new(viewport)
@num5 = Sprite.new(viewport)
@num1.visible = false
@num2.visible = false
@num3.visible = false
@num4.visible = false
@num5.visible = false
end
#--------------------------------------------------------------------------
# ● 更新
#--------------------------------------------------------------------------
def update
force_damage
move_damage(@num5, @pop_time) if @num5.visible
move_damage(@num4, @pop_time - 2) if @num4.visible
move_damage(@num3, @pop_time - 4) if @num3.visible
move_damage(@num2, @pop_time - 6) if @num2.visible
move_damage(@num1, @pop_time - 8) if @num1.visible
move_window if @window != nil
@duration -= 1 if @duration > 0
end
#--------------------------------------------------------------------------
# ● 事件的伤害POP
#--------------------------------------------------------------------------
def force_damage
if @battler.force_damage != 0
damage_pop(@battler.force_damage)
@battler.hp -= @battler.force_damage
@force_damage = true
@battler.force_damage = 0
$game_temp.status_window_refresh = true
end
end
#--------------------------------------------------------------------------
# ● 数値的移动
#--------------------------------------------------------------------------
def move_damage(num, min)
case @duration
when min-1..min
num.y -= 4
when min-3..min-2
num.y -= 3
when min-6..min-4
num.y -= 2
when min-14..min-7
num.y += 2
when min-17..min-15
num.y -= 2
when min-23..min-18
num.y += 1
when min-27..min-24
num.y -= 1
when min-30..min-28
num.y += 1
when min-33..min-31
num.y -= 1
when min-36..min-34
num.y += 1
end
next_damage if @battler.double_damage && @duration == min-34
num.opacity = 256 - (12 - @duration) * 32
num.visible = false if @duration == 0
if @force_damage && @duration == 0
@force_damage = false
@battler.perform_collapse
end
end
#--------------------------------------------------------------------------
# ● 文字窗口的移动
#--------------------------------------------------------------------------
def move_window
@window.x -= 6 if @window_time > 0 && @window.x > 0
@window_time -= 1
if @duration == 0
@window.dispose
@window = nil
end
end
#--------------------------------------------------------------------------
# ● HPMP两方同时伤害
#--------------------------------------------------------------------------
def next_damage
@battler.hp_damage = 0
@battler.double_damage = false
damage_pop
end
#--------------------------------------------------------------------------
# ● 准备伤害POP
#--------------------------------------------------------------------------
def damage_pop(num = nil)
reset
damage = battler.hp_damage
# 抽出状态的变化
states = battler.added_states
text = ""
# MP伤害用文本(HPMP两方同时伤害除外)
text = N01::POP_MP_DAM if battler.mp_damage > 0
text = N01::POP_MP_REC if battler.mp_damage < 0
damage = battler.mp_damage
end
# 连续伤害不显示MP伤害以外的文字
if num == nil
text = N01::POP_MISS if battler.missed && states == []
text = N01::POP_DAMAGE0 if damage == 0 && states == [] && !battler.revival
text = N01::POP_EVA if battler.evaded
text = N01::POP_CRI if battler.critical
for state in states
# 无POP设定的状态不显示
unless state.extension.include?("无POP")
text += " " if text != ""
text += state.name
end
end
else
damage = num
end
# 区分伤害和回复
@minus = false
@minus = true if damage < 0
damage = damage.abs
# 略微调整POP位置
adjust = -16
adjust = 16 if $back_attack
adjust = 32 if battler.critical
adjust = 0 if damage == 0
@x = battler.position_x + adjust
@y = battler.position_y
window(text) if text != ""
@pop_time = N01::NUM_DURATION
# 没有伤害时没有数字的POP
return @duration = @pop_time if damage == 0
@num_time = -1
damage_file(@num1, damage % 10, @pop_time - 7) if damage >= 0
damage_file(@num2, (damage % 100)/10, @pop_time - 5) if damage >= 10
damage_file(@num3, (damage % 1000)/100, @pop_time - 3) if damage >= 100
damage_file(@num4, (damage % 10000)/1000, @pop_time - 1) if damage >= 1000
damage_file(@num5, (damage % 100000)/10000, @pop_time + 1) if damage >= 10000
end
#--------------------------------------------------------------------------
# ● 准备情报窗口
#--------------------------------------------------------------------------
def window(text)
@window = Window_Damage.new(@x - 64, @y - 22)
@window.pop_text(text)
@window_time = 5
end
#--------------------------------------------------------------------------
# ● 准备数字画像
#--------------------------------------------------------------------------
def damage_file(num, cw, dur)
num.visible = true
# 判別文件
file = N01::DAMAGE_GRAPHICS
file = N01::RECOVER_GRAPHICS if @minus
# 数字
num.bitmap = Cache.system(file)
@num_time += 1
sx = num.bitmap.width / 10
num.src_rect.set(cw * sx, 0, sx, num.height)
num.x = @x - (num.width + N01::NUM_INTERBAL) * @num_time
num.y = @y
num.z = 2000 - @num_time
@duration = dur
@window.x = num.x - @window.width + 64 if @window != nil && N01::NON_DAMAGE_WINDOW
@window.x = num.x - @window.width + 26 if @window != nil && !N01::NON_DAMAGE_WINDOW
@window.x = 0 if @window != nil && @window.x < 0
end
#--------------------------------------------------------------------------
# ● 伤害组合
#--------------------------------------------------------------------------
def reset
@num5.visible = @num4.visible = @num3.visible = @num2.visible = @num1.visible = false
@window.dispose if @window != nil
@window = nil
end
#--------------------------------------------------------------------------
# ● 开放
#--------------------------------------------------------------------------
def dispose
super
@num1.dispose
@num2.dispose
@num3.dispose
@num4.dispose
@num5.dispose
@window.dispose if @window != nil
end
end
#==============================================================================
# ■ Window_Damage
#------------------------------------------------------------------------------
# 危机等表示的窗口。
#==============================================================================
class Window_Damage < Window_Base
#--------------------------------------------------------------------------
# ● 客观初期化
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 160, 46)
self.opacity = 0 if N01::NON_DAMAGE_WINDOW
end
#--------------------------------------------------------------------------
# ● 窗口内容的作成
#--------------------------------------------------------------------------
def create_contents
self.contents.dispose
self.contents = Bitmap.new(width - 32, height - 32)
end
#--------------------------------------------------------------------------
# ● 状态设定
#--------------------------------------------------------------------------
def pop_text(text, align = 1)
self.contents.clear
self.width = self.contents.text_size(text).width + 36
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.color = normal_color
self.contents.font.size = 16
self.contents.draw_text(0,-8, width - 32, 32, text, align)
end
end
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
# 游戏中处理所有窗口的超级类。
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● 状态的描画 ※再定义(反映设定不显示状态ICON)
#--------------------------------------------------------------------------
def draw_actor_state(actor, x, y, width = 96)
count = 0
for state in actor.states
break if state.extension.include?("不显示ICON")
draw_icon(state.icon_index, x + 24 * count, y)
count += 1
break if (24 * count > width - 24)
end
end
end
#==============================================================================
# ■ Game_Temp
#------------------------------------------------------------------------------
# 不包含存储数据、处理一时数据的类。
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# ● 公开变数
#--------------------------------------------------------------------------
attr_accessor :status_window_refresh # 状态窗口的还原标志
#--------------------------------------------------------------------------
# ● 客观初期化
#--------------------------------------------------------------------------
alias initialize_n01 initialize
def initialize
initialize_n01
@status_window_refresh = false
end
end
#==============================================================================
# ■ Game_Interpreter
#------------------------------------------------------------------------------
# 实行时间指令的解释。
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# ● HP 的增减
#--------------------------------------------------------------------------
def command_311
if $game_temp.in_battle
value = operate_value(@params[1], @params[2], @params[3])
iterate_actor_id(@params[0]) do |actor|
next if actor.dead?
if @params[4] == false and actor.hp + value <= 0
actor.damage_num(actor.hp - 1) # 如果不允许战斗不能时变为1
else
actor.damage_num(-value)
end
end
return true
else
value = operate_value(@params[1], @params[2], @params[3])
iterate_actor_id(@params[0]) do |actor|
next if actor.dead?
if @params[4] == false and actor.hp + value <= 0
actor.hp = 1 # 如果不允许战斗不能时变为1
else
actor.hp += value
end
actor.perform_collapse
end
if $game_party.all_dead?
$game_temp.next_scene = "gameover"
end
return true
end
end
#--------------------------------------------------------------------------
# ● 敌角色的 HP 增减
#--------------------------------------------------------------------------
def command_331
value = operate_value(@params[1], @params[2], @params[3])
iterate_enemy_index(@params[0]) do |enemy|
if enemy.hp > 0
if @params[4] == false and enemy.hp + value <= 0
enemy.damage_num(enemy.hp - 1) # 如果不允许战斗不能时变为1
else
enemy.damage_num(-value)
end
end
end
return true
end
end