class SideView
#--------------------------------------------------------------------------
# ● 战斗者动画的横/纵元件数 = [横, 纵]。无动画为 [1, 1]
#--------------------------------------------------------------------------
def max_pattern
# 根据战斗者 id 分歧
case id
when 1 # 1 号角色
return [ 3, 4]
when -1 # 1 号敌人 (敌人 ID 通过负数指定) #【这一行修改下,如 [1,1] 就是敌人的图片整个一张;[3,4] 就是敌人的图片分成 3 * 4,有3列,4排。】
return [ 1, 1]
else # 上面的 ID 之外的统一设定
return [ 3, 4] if id > 0 # 所有角色(ID 为正)
return [ 1, 1] if id < 0 # 所有敌人(ID 为负)#【这一行修改下,如 [1,1] 就是敌人的图片整个一张;[3,4] 就是敌人的图片分成 3 * 4,有3列,4排。】
end
# 之后的设定中,有根据 id 来分歧的话,请参考上面的描述。
end
#--------------------------------------------------------------------------
# ● 影子的图像 文件名图像请放在 Characters 文件夹,设置没有影子的话 false
#--------------------------------------------------------------------------
def shadow
return "shadow01" if id > 0 # 全体队员
return false if id < 0 # 所有敌人
end
#--------------------------------------------------------------------------
# ● 战斗图像反转 设定初期状态战斗图像反转的话 true
#--------------------------------------------------------------------------
def graphic_mirror_flag
return false if id > 0 # 全体队员
return true if id < 0 # 所有敌人
end
#--------------------------------------------------------------------------
# ● 先固定战斗参照图 先固定战斗动画设定的指数参照的话一定要 true
#--------------------------------------------------------------------------
def graphic_fix
return false if id > 0 # 全体队员
return true if id < 0 # 所有敌人
end
#--------------------------------------------------------------------------
# ● 通常待命
#--------------------------------------------------------------------------
def normal
return "通常待机" if id > 0 # 全体队员
return "通常待机" if id < 0 # 所有敌人
# 全动作不是只贴了动作也能
end
#--------------------------------------------------------------------------
# ● 危机待命 HP在1/4以下的状态下进行的待命的动作
#--------------------------------------------------------------------------
def pinch
return "危机待机" if id > 0 # 全体队员
end
#--------------------------------------------------------------------------
# ● 状态动作 复数重合的话,表示优先度高的状态被优先
#--------------------------------------------------------------------------
def state(state_id)
# 该类的ID分歧
case state_id
when 1
return "敌人崩溃" if id > 0 # 全体队员
return "敌人崩溃" if id < 0 # 所有敌人
when 2
return "中毒待机"
when 3
return "黑暗待机"
when 4
return "虚弱待机"
when 5
return "混乱待机"
when 6
return "睡眠待机"
when 7
return "中断待机"
when 8
return "眩晕待机"
when 9
return "防御待机"
end
end
#--------------------------------------------------------------------------
# ● 指令输入后的行动
#--------------------------------------------------------------------------
def command
# 选择了的技能ID分歧
case skill_id
when 2
return "防御指令"
end
# 选择了的技能类型指定
case skill_type
when 1 # 特技
return "战士技指令"
when 2 # 魔法
return "法术指令"
when 3
return "法术指令2"
when 4,5,6 # 特殊战士技
return "普通技指令"
# when 5 # 开枪
# return "开枪指令"
# when 6 # 聚能
# return "聚能指令"
end
end
#--------------------------------------------------------------------------
# ● 战斗开始动作
#--------------------------------------------------------------------------
def first_action
return "我方开始战斗" if id > 0 # 全体队员
return "待机固定WT" if id < 0 # 所有敌人
end
#--------------------------------------------------------------------------
# ● 胜利动作
#--------------------------------------------------------------------------
def win
case id
when 5 # 5 号角色
return "胜利后空翻"
when 4
return "胜利站立"
when 6
return "胜利前空翻"
when 10
return "胜利斩击"
when 29
return "胜利挥剑"
when 1,2,28
return "胜利动作"
else # 上述以外
return "胜利挥动"
end
end
#--------------------------------------------------------------------------
# ● 战斗退场动作 游戏方交换的战斗
#--------------------------------------------------------------------------
def remove_action
return "中止战斗"
end
#--------------------------------------------------------------------------
# ● 逃走动作
#--------------------------------------------------------------------------
def escape
return "逃跑" if id > 0 # 全体队员
return "敌人逃跑" if id < 0 # 所有敌人
end
#--------------------------------------------------------------------------
# ● 逃走失败动作
#--------------------------------------------------------------------------
def escape_ng
return "逃跑失败"
end
#--------------------------------------------------------------------------
# ● 指令输入开始动作
#--------------------------------------------------------------------------
def command_b
return "指令输入"
end
#--------------------------------------------------------------------------
# ● 指令输入终了动作
#--------------------------------------------------------------------------
def command_a
return "指令输入终了"
end
#--------------------------------------------------------------------------
# ● 被伤害的动作
#--------------------------------------------------------------------------
def damage(attacker)
# 受到了关键一击 伤害的场合
if critical?
return "被关键一击"
# 回复的情况
elsif recovery?
# 它描述了只有返回,当你不想采取的行动
return
end
# 接受了的技能ID分歧
case damage_skill_id
when 1 # 1号技能的场合
return "被攻击"
when 136 # 它描述了只返回这里如果你不想采取行动,损害特定的技能特定技能伤害动作不想让时间在这里只return记述。
return
end
# 受到的道具ID指定(回复的情况已经动作被决定)
case damage_item_id
when 1 # 1号物品的场合
return
else
# 上述以外的物品ID
if damage_item_id != 0
return
end
end
# 伤害为0的场合(强化、削弱法术和防御,敌人逃跑等)
if damage_zero?
return
end
# 如果你不符合上面的设置
return "被攻击"
end
#--------------------------------------------------------------------------
# ● 躲避动作 被伤害的动作一样分歧使用
#--------------------------------------------------------------------------
def evasion(attacker)
# return "盾防御" if shield? # 装备盾的场合
return "回避"
end
#--------------------------------------------------------------------------
# ● 攻击对方失误时的动作 被伤害的动作一样分歧使用
#--------------------------------------------------------------------------
def miss(attacker)
# return "盾防御" if shield? # 装备盾的场合
return "回避"
end
#--------------------------------------------------------------------------
# ● 武器的动作 通常攻击动作,装备的武器中指定
# 敌人 下面的敌人武器设定可以让
#--------------------------------------------------------------------------
def weapon_action
# 指定武器ID
case weapon_id
when 0 # 武器0号的情况(空手)
return "普通攻击"
when 1 # 1号武器的场合
return "斩击"
end
# 武器类型指定
case weapon_type
when 1 # 1号武器 复数总结指定的场合
return "斩击"
when 2
return "刺击"
when 3
return "拔刀"
when 4
return "射击1"
when 5
return "反手斩"
when 6
return "射击2"
when 7
return "射击3"
when 8
return "砸击"
when 14
return "斩击2"
when 15
return "刺击2"
when 16
return "拔刀2"
when 17
return "射击1s"
when 18
return "反手斩2"
when 11
return "修罗斩"
when 30
return "刺击"
end
end
#--------------------------------------------------------------------------
# ● 敌人右武器 我会指定的设备ID武器的敌人
#--------------------------------------------------------------------------
def enemy_weapon1_id # 武器ID指定。0号是空手处理
case id
when -70 #负数表示敌人 (ID=50 冢原卜全)
return 22 #装备ID (ID=33 鹿岛太刀)
when -89 #佐佐木
return 23
when -69 #阴阳师
return 18
when -77 #山本斟助
return 38
when -80 #信玄
return 1
when -90 #真.佐佐木
return 23
when -100 #阿修罗
return 85
def weapon_graphic(weapon_id, weapon_type)
# 指定武器ID
case weapon_id
when 1 # 1号武器的图像文件名
return ""
end
# 指定武器类型
case weapon_type
when 6 # 第6种武器类型的图像文件名
return "bow01"
end
end
#--------------------------------------------------------------------------
# ● 盾牌指定
#--------------------------------------------------------------------------
# 武器的动作的类型的设定 [1:原图],并且选择[2:2003规格]。
# 武器的动作的反手设定为true时,参照之前的盾图像在这里指定:
#
# return "001-Shield01" ←请输入对应的盾牌图形的文件名
# 请放入盾牌图形到 Characters 文件夹
def shield_graphic(weapon_id, shield_type)
# 指定防具ID
case shield_id
when 41 # 41号防具(圆盾)的图像文件名
return ""
end
# 指定的护甲类型
case shield_type
when 5 # 第5种护甲类型(小盾牌)的图像文件名
return ""
end
end
#--------------------------------------------------------------------------
# ● 技能动作
#--------------------------------------------------------------------------
def skill_action
# 指定技能ID
case skill_id
when 1 # 1号技能是普通攻击,所以上的武器采取行动
return weapon_action
when 2 # 2号技能是防御
return "防御"
when 3,4,5,115 # 3/4/5号技能是武器攻击
return weapon_action
when 6 # 6号技能是敌人逃走
return escape
when 7 # 7号技能是观察情况
return "观望"
when 8 # 8号技能是反击
return weapon_action
when 10
return "弓射击"
when 11
return "火枪射击"
when 12
return "手里剑射击"
when 20
return "苦无射击"
when 13
return "太刀攻击"
when 14
return "忍者刀攻击"
when 15
return "剑攻击"
when 16
return "长枪攻击"
when 17
return "大筒射击"
when 14
return "钝器攻击"
when 50
return "太刀攻击2"
when 58
return "赤备突击-枪"
when 59
return "赤备突击-刀"
when 26
return "弓乱射"
when 27
return "火枪齐射"
when 28
return "马冲击"
when 29
return "近身连斩"
when 30
return "连发火枪"
when 31
return "连发手里剑"
when 32
return "秘剑燕返"
when 33
return "秘剑一闪"
when 34
return "极一闪"
when 35
return "落叶斩"
when 205
return "风林火山sp"
when 128
return "水枪"
when 129
return "投掷武器"
when 130
return "5回攻击"
when 131
return "切入攻击"
when 132
return "多段攻击"
when 133
return "化身"
when 134
return "技能派生"
when 135
return "转换攻击"
when 136
return "空中攻击"
#———太刀技
when 66
return "内劲"
when 67
return "三段斩"
when 68
return "叶切合"
when 69
return "浮舟"
when 70
return "霞男"
when 71
return "霞女"
when 72
return "一闪"
when 75
return "鸟王剑男"
when 76
return "鸟王剑女"
when 77
return "无想剑"
when 78
return "一之太刀男"
when 79
return "一之太刀女"
when 80
return "居合斩"
when 81
return "乾龙破"
#———特殊技
when 181
return "切腹男"
when 182
return "切腹女"
when 183
return "苦无射击"
when 184
return "手里剑射击"
when 185
return "毒苦无"
when 186
return "多发手里剑"
#———铁砲技
when 83
return "强力射击"
when 84
return "炸膛"
when 85
return "急所击"
when 86
return "三段射击"
when 87
return "铁砲齐射"
when 88
return "狙击"
when 89
return "钓瓶击"
#———忍者技
when 93
return "跃空斩"
when 94
return "影袭"
when 95
return "旋风斩"
when 99
return "韦驸天术"
when 100
return "幻惑术"
when 101
return "爆破之术男"
when 102
return "爆破之术女"
when 103
return "鬼脚之术男"
when 104
return "鬼脚之术女"
when 105
return "变化男"
#———弓技
when 116
return "强弓"
when 119
return "穿心箭"
when 120
return "剎那五月雨"
when 170
return "风林火山男"
when 200
return "毗沙门天"
when 201
return "毗沙门天BOSS"
end
# 技能名指定(数据库ID移动来也没问题的,所以推荐)
case skill_name
when "背景变更样本"
return "背景变更攻击"
when "图片攻击样本"
return "图片攻击"
end
# 指定技能类型
case skill_type
when 1,4,5,6 # 战士技
return "战士技"
when 2 # 法术
return "法术"
when 3
return "觉醒"
# when 5 # 枪技
# return "枪技"
# when 6 # 聚能
# return "聚能"
end
# 上述以外
return "战士技"
end
#--------------------------------------------------------------------------
# ● 道具的动作
#--------------------------------------------------------------------------
def item_action
case item_id # 指定物品ID
when 1
return "物品使用"
else
return "物品使用"
end
end
#--------------------------------------------------------------------------
# ● 反击技能ID 反击时的技能ID指定。
#--------------------------------------------------------------------------
# ※数据库中设定的复数回攻击被反映。
def counter_skill_id
return 8
end
#--------------------------------------------------------------------------
# ● 魔法反射动画ID 魔法反射时的动画ID指定。
#--------------------------------------------------------------------------
def reflection_anime_id
return 123
end
#--------------------------------------------------------------------------
# ● 替身开始动作
#--------------------------------------------------------------------------
def substitute_start_action
return "替身开始动作"
end
#--------------------------------------------------------------------------
# ● 替身终了动作
#--------------------------------------------------------------------------
def substitute_end_action
return "替身终了动作"
end
#--------------------------------------------------------------------------
# ● 替身的横版动作开始
#--------------------------------------------------------------------------
def substitute_receiver_start_action
return "替身的横版动作开始"
end
#--------------------------------------------------------------------------
# ● 替身的横版动作结束
#--------------------------------------------------------------------------
def substitute_receiver_end_action
return "替身的横版动作结束"
end
#--------------------------------------------------------------------------
# ● 敌人的等级 条件分支等利用的东西,参数是反映。
#--------------------------------------------------------------------------
def level
case id
when -1 # 1号的敌人
return 0
end
return 0
end
#==============================================================================
# ■ Spriteset_Sideview
#------------------------------------------------------------------------------
# サイドビュー独自のスプライトをまとめたクラスです。
#==============================================================================
class Spriteset_Sideview
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(viewport)
@viewport = viewport
@weapons = []
@pictures = []
@back_pic = []
@damage = []
$sv_camera.setup
N03.camera(nil, N03::BATTLE_CAMERA["回合开始"].dup)
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
update_battler_data
update_damage
update_pictures
update_back_pic
update_weapons
end
#--------------------------------------------------------------------------
# ● バトラーデータの更新
#--------------------------------------------------------------------------
def update_battler_data
for battler in $game_party.battle_members + $game_troop.members
weapon_end(battler) if battler.sv.weapon_end
next if battler.sv.effect_data == []
for effect_data in battler.sv.effect_data do set_effects(battler, effect_data) end
end
end
#--------------------------------------------------------------------------
# ● ダメージ画像の更新
#--------------------------------------------------------------------------
def update_damage
for i in [email protected]
next if @damage == nil
@damage.update if @damage != nil
next if !@damage.action_end
@damage.dispose
@damage = nil
end
end
#--------------------------------------------------------------------------
# ● 图片动作の更新
#--------------------------------------------------------------------------
def update_pictures
for i in [email protected]
next if @pictures == nil
@pictures.update if @pictures != nil
next if !@pictures.action_end
@pictures.dispose
@pictures = nil
end
end
#--------------------------------------------------------------------------
# ● 周期图片の更新
#--------------------------------------------------------------------------
def update_back_pic
set_back_pic if $sv_camera.program_picture != []
for i in 0...@back_pic.size
next if @back_pic == nil
@back_pic.update if @back_pic != nil
next if !@back_pic.action_end
@back_pic.dispose
@back_pic = nil
end
end
#--------------------------------------------------------------------------
# ● 武器动作の更新
#--------------------------------------------------------------------------
def update_weapons
for i in [email protected]
next if @weapons == nil
@weapons.update if @weapons != nil
next if !@weapons.action_end
@weapons.dispose
@weapons = nil
end
end
#--------------------------------------------------------------------------
# ● ダメージ运行
#--------------------------------------------------------------------------
def set_damage_pop(target)
for i in [email protected]
next if @damage != nil
return @damage = Sprite_Damage.new(@viewport, target)
end
@damage.push(Sprite_Damage.new(@viewport, target))
end
#--------------------------------------------------------------------------
# ● 周期图片运行
#--------------------------------------------------------------------------
def set_back_pic
for data in $sv_camera.program_picture
if @back_pic[data[2]] != nil
@back_pic[data[2]].dispose
@back_pic[data[2]] = nil
end
@back_pic[data[2]] = Sprite_Back_Picture.new(@viewport, data[2])
@back_pic[data[2]].setup(data)
end
$sv_camera.program_picture = []
end
#--------------------------------------------------------------------------
# ● エフェクト开始
#--------------------------------------------------------------------------
def set_effects(battler, effect_data)
case effect_data[0]
when "pic" ; set_pictures(battler, effect_data)
when "wp" ; set_weapons(battler, true)
when "m_a" ; set_weapons(battler, false)
end
end
#--------------------------------------------------------------------------
# ● 图片动作运行
#--------------------------------------------------------------------------
def set_pictures(battler, effect_data)
@pictures[effect_data[1]] = Sprite_Battle_Picture.new if @pictures[effect_data[1]] == nil
@pictures[effect_data[1]].set(battler)
end
#--------------------------------------------------------------------------
# ● 武器动作运行
#--------------------------------------------------------------------------
def set_weapons(battler, weapon_flag, test = true)
for i in [email protected]
next if @weapons != nil
@weapons = Sprite_Weapon.new(@viewport, i, battler)
battler.sv.weapon_index.push(i) if weapon_flag
return i
end
@weapons.push(Sprite_Weapon.new(@viewport, @weapons.size, battler))
battler.sv.weapon_index.push(@weapons.size - 1) if weapon_flag
return @weapons.size - 1
end
#--------------------------------------------------------------------------
# ● バトラーの武器动作终了
#--------------------------------------------------------------------------
def weapon_end(battler)
battler.sv.weapon_end = false
for index in battler.sv.weapon_index
weapon_index = battler.sv.weapon_index.shift
@weapons[weapon_index].dispose if @weapons[weapon_index] != nil
@weapons[weapon_index] = nil
end
battler.sv.weapon_index.compact!
end
#--------------------------------------------------------------------------
# ● ヒット時の战斗动画运行
#--------------------------------------------------------------------------
def set_hit_animation(battler, weapon_index, hit_targets, miss)
weapon = @weapons[weapon_index]
for target in hit_targets
next @weapons[@hit_index].timing_battler_set(target) if @hit_index != nil
@hit_index = set_weapons(battler, false, false)
@weapons[@hit_index].set_hit_animation(weapon.hit_position, weapon.hit_anime_id, target)
end
@hit_index = nil
if !weapon.through && !miss
@weapons[weapon_index].dispose
@weapons[weapon_index] = nil
else
@weapons[weapon_index].through_change
end
end
#--------------------------------------------------------------------------
# ● サイドビューデータの初期化
#--------------------------------------------------------------------------
def reset_sideview
$sv_camera.reset
for member in $game_troop.members + $game_party.battle_members do member.sv.reset end
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
dispose_effects(@weapons)
dispose_effects(@pictures)
dispose_effects(@back_pic)
dispose_effects(@damage)
reset_sideview
end
#--------------------------------------------------------------------------
# ● エフェクト画像の解放
#--------------------------------------------------------------------------
def dispose_effects(effects)
for i in 0...effects.size
effects.dispose if effects != nil
effects = nil
end
end
end
#==============================================================================
# ■ Sprite_Battle_Back
#------------------------------------------------------------------------------
# 戦闘背景用のスプライトです。
#==============================================================================
class Sprite_Battle_Back < Plane
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(viewport = nil, index, battleback_name)
super(viewport)
@index = index
if @index == 1
data = N03::FLOOR1_DATA[battleback_name]
data = N03::FLOOR1_DATA["全Battlebacks1"] if data == nil
elsif @index == 2
data = N03::FLOOR2_DATA[battleback_name]
data = N03::FLOOR2_DATA["全Battlebacks2"] if data == nil
end
data = data.dup
@adjust_position = data[0]
@zoom_x = data[1][0] / 100.0
@zoom_y = data[1][1] / 100.0
@shake_on = data[2]
$game_switches[data[3]] = true if data[3] > 0
$sv_camera.switches[data[3].abs] = true if data[3] < 0
reset_scroll
reset_back_data(battleback_name)
end
#--------------------------------------------------------------------------
# ● 背景スクロールを初期化
#--------------------------------------------------------------------------
def reset_scroll
@scroll_x = 0
@scroll_y = 0
@move_x = 0
@move_y = 0
end
#--------------------------------------------------------------------------
# ● 背景データを初期化
#--------------------------------------------------------------------------
def reset_back_data(battleback_name)
@back_data = []
@active_data = ["scroll",0, @move_x, @move_y, false, battleback_name,""]
start_back_data(@active_data)
end
#--------------------------------------------------------------------------
# ● 背景画像のセッティング
#--------------------------------------------------------------------------
def set_graphics(new_bitmap)
self.bitmap = new_bitmap
@base_x = (self.bitmap.width * @zoom_x - Graphics.width) / 2 + @adjust_position[0]
@base_y = (self.bitmap.height * @zoom_y - Graphics.height) / 2 + @adjust_position[1]
# 限界坐标を取得
max_top = 0
max_bottom = self.bitmap.height * @zoom_y - Graphics.height
max_left = 0
max_right = self.bitmap.width * @zoom_x - Graphics.width
exist = true
exist = false if self.bitmap.height == 32 && self.bitmap.width == 32
$sv_camera.setting(@index, [max_top, max_bottom, max_left, max_right, @base_x, @base_y,exist])
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
return if !bitmap
update_back_data
update_scroll unless @move_x == 0 && @move_y == 0
update_color
update_position
update_back_adjust if @bt_back != nil
create_back_adjust if @bt_back == nil && !@active_data[10] && @scroll_x == 0 && @scroll_y == 0
end
#--------------------------------------------------------------------------
# ● 背景データを更新
#--------------------------------------------------------------------------
def update_back_data
delete = true if @active_data[1] > 0 && !$game_switches[@active_data[1]]
delete = true if @active_data[1] < 0 && !$sv_camera.switches[@active_data[1].abs]
return if !delete
for i in 0...@back_data.size
@back_data = nil if @back_data[1] > 0 && !$game_switches[@back_data[1]]
@back_data = nil if @back_data[1] < 0 && !$sv_camera.switches[@back_data[1].abs]
end
@back_data.compact!
next_back_data
end
#--------------------------------------------------------------------------
# ● 次の背景データをセット
#--------------------------------------------------------------------------
def next_back_data
@back_data.delete(@active_data[11]) if @active_data[11] != nil
@back_data.push(@active_data[11]) if @active_data[11] != nil
@active_data = nil
data = @back_data.pop
@back_data = [@active_data] if @back_data.size == 0
start_back_data(data)
end
#--------------------------------------------------------------------------
# ● 背景データを运行
#--------------------------------------------------------------------------
def start_back_data(data)
return if back_data_remain(data)
bt_back_dispose
pre_active_data = @active_data
@active_data[8] = [@back_name, @move_x, @move_y, @scroll_x, @scroll_y] if @active_data != nil
@back_data.push(@active_data) if @active_data != nil
@active_data = data.dup
@active_data[5] = @back_name if @active_data[5] == ""
@active_data[9] = set_back_adjust if @active_data[9] == nil
back_data_scroll_on if @active_data[8] == nil && @active_data[9][0] == false
set_remain_back_data if @active_data[8] != nil
create_back(@active_data[5]) if @active_data[9][0] == false
create_back_adjust if @active_data[10]
@active_data[11] = pre_active_data if pre_active_data && @active_data[7] == false
end
#--------------------------------------------------------------------------
# ● 背景データの保留
#--------------------------------------------------------------------------
def back_data_remain(data)
remain = false
remain = true if data[6] != "" && @active_data != nil && @active_data[9] != nil && @active_data[9][0] != false
remain = true if @active_data != nil && @active_data[7] == false
return remain if !remain
@remain = true
@back_data.push(data)
return remain
end
#--------------------------------------------------------------------------
# ● 背景变更補正データをセット
#--------------------------------------------------------------------------
def set_back_adjust
bt_adjust = []
sign = -1
if @active_data[6] == ""
reset_scroll if @active_data[3][0] == 0 && @active_data[3][1] == 0
bt_adjust = [false,false,0,0]
return bt_adjust
elsif @move_x != 0 or @active_data[3][0] != 0
sign = 1 if @move_x < 0
bt_adjust[0] = [self.bitmap.width * @zoom_x * sign, 0]
bt_adjust[1] = [self.bitmap.width * @zoom_x * sign * 2, 0]
elsif @move_y != 0 or @active_data[3][1] != 0
sign = 1 if @move_y < 0
bt_adjust[0] = [0, self.bitmap.height * @zoom_y * sign]
bt_adjust[1] = [0, self.bitmap.height * @zoom_y * sign * 2]
else
reset_scroll if @active_data[3][0] == 0 && @active_data[3][1] == 0
bt_adjust = [false,false,0,0]
return bt_adjust
end
bt_adjust[2] = [bt_adjust[0][0], bt_adjust[0][1]]
return bt_adjust
end
#--------------------------------------------------------------------------
# ● 背景スクロールデータを运行
#--------------------------------------------------------------------------
def back_data_scroll_on
mirror = $sv_camera.mirror
mirror = false if !@active_data[4]
@move_x = @active_data[3][0]
@move_x *= -1 if mirror
@move_y = @active_data[3][1]
end
#--------------------------------------------------------------------------
# ● 保持している背景データを运行
#--------------------------------------------------------------------------
def set_remain_back_data
return back_data_scroll_on if @move_x != 0 or @move_y != 0
create_back(@active_data[8][0])
@move_x = @active_data[8][1]
@move_y = @active_data[8][2]
@scroll_x = @active_data[8][3]
@scroll_y = @active_data[8][4]
end
#--------------------------------------------------------------------------
# ● 背景画像の作成
#--------------------------------------------------------------------------
def create_back(back_name)
return if back_name == @back_name or back_name == ""
self.bitmap = Cache.battleback1(back_name) if @index == 1
self.bitmap = Cache.battleback2(back_name) if @index == 2
@back_name = back_name
end
#--------------------------------------------------------------------------
# ● 背景变更補正画像の作成
#--------------------------------------------------------------------------
def create_back_adjust
return if @active_data[9][0] == false
@active_data[10] = true
mirror = $sv_camera.mirror
mirror = false if !@active_data[4]
@bt_back = []
@bt_back[0] = Sprite.new(viewport)
@bt_back[0].bitmap = Cache.battleback1(@active_data[6]) if @index == 1
@bt_back[0].bitmap = Cache.battleback2(@active_data[6]) if @index == 2
@bt_back[0].mirror = mirror
@bt_back[1] = Sprite.new(viewport)
@bt_back[1].bitmap = Cache.battleback1(@active_data[5]) if @index == 1
@bt_back[1].bitmap = Cache.battleback2(@active_data[5]) if @index == 2
@bt_back[1].mirror = mirror
end
#--------------------------------------------------------------------------
# ● 背景スクロールの更新
#--------------------------------------------------------------------------
def update_scroll
@scroll_x += @move_x
@scroll_y += @move_y
@scroll_x = 0 if @scroll_x / 100 >= self.bitmap.width * @zoom_x or @scroll_x / 100 <= -self.bitmap.width * @zoom_x
@scroll_y = 0 if @scroll_y / 100 >= self.bitmap.height * @zoom_y or @scroll_y / 100 <= -self.bitmap.height * @zoom_y
end
#--------------------------------------------------------------------------
# ● 色调变更の更新
#--------------------------------------------------------------------------
def update_color
color_set if $sv_camera.color_set[@index] != nil
return if @color_data == nil
@color_data[4] -= 1
if @color_data[4] == 0 && @color_data[5] != 0
@color_data[4] = @color_data[5]
@color_data[5] = 0
@color_data[6] = [0,0,0,0]
elsif @color_data[4] == 0
@remain_color_data = @color_data
return @color_data = nil
end
for i in 0..3
@color_data = (@color_data * (@color_data[4] - 1) + @color_data[6]) / @color_data[4]
end
self.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3])
end
#--------------------------------------------------------------------------
# ● 坐标の更新
#--------------------------------------------------------------------------
def update_position
self.ox = $sv_camera.x + @base_x - @scroll_x / 100
self.oy = $sv_camera.y + @base_y - @scroll_y / 100
self.ox -= $sv_camera.sx / 100 if @shake_on
self.oy -= $sv_camera.sy / 100 if @shake_on
self.zoom_x = @zoom_x * $sv_camera.zoom
self.zoom_y = @zoom_y * $sv_camera.zoom
self.ox *= $sv_camera.zoom
self.oy *= $sv_camera.zoom
self.z = @index * 10
end
#--------------------------------------------------------------------------
# ● 背景变更補正画像を更新
#--------------------------------------------------------------------------
def update_back_adjust
@active_data[9][0][0] = 0 if @scroll_x == 0
@active_data[9][0][1] = 0 if @scroll_y == 0
@active_data[9][1][0] -= @active_data[9][2][0] if @scroll_x == 0
@active_data[9][1][1] -= @active_data[9][2][1] if @scroll_y == 0
for i in 0...@bt_back.size
@bt_back.x = -self.ox + @active_data[9][0] * $sv_camera.zoom
@bt_back.y = -self.oy + @active_data[9][1] * $sv_camera.zoom
@bt_back.zoom_x = self.zoom_x
@bt_back.zoom_y = self.zoom_y
@bt_back.z = self.z + 1
@bt_back.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
end
back_data_scroll_on if @active_data[9][0][0] == 0 && @active_data[9][0][1] == 0
return unless @active_data[9][1][0] == 0 && @active_data[9][1][1] == 0
bt_back_dispose
create_back(@active_data[5])
@active_data[9][0] = false
next_back_data if @remain && @back_data.size != 1
@remain = false
end
#--------------------------------------------------------------------------
# ● 色调变更
#--------------------------------------------------------------------------
def color_set
set = $sv_camera.color_set[@index]
$sv_camera.color_set[@index] = nil
set[4] = 1 if set[4] == 0
@remain_color_data = [0,0,0,0] if @remain_color_data == nil
@color_data = @remain_color_data
@color_data[4] = set[4]
@color_data[5] = set[5]
@color_data[6] = set
end
#--------------------------------------------------------------------------
# ● 背景变更補正画像の解放
#--------------------------------------------------------------------------
def bt_back_dispose
for i in 0...@bt_back.size do @bt_back.dispose end if @bt_back != nil
@bt_back = nil
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
bitmap.dispose if bitmap
bt_back_dispose
super
end
end
#==============================================================================
# ■ Battle_Camera
#------------------------------------------------------------------------------
# 戦闘カメラやバトルプログラムを扱うクラスです。
#==============================================================================
class Battle_Camera
#--------------------------------------------------------------------------
# ● 公开インスタンス变数
#--------------------------------------------------------------------------
attr_reader :sx # 摇晃X坐标
attr_reader :sy # 摇晃Y坐标
attr_reader :max_top # 上限界坐标
attr_reader :max_bottom # 下限界坐标
attr_reader :max_left # 左限界坐标
attr_reader :max_right # 右限界坐标
attr_accessor :switches # サイドビュー専用スイッチ
attr_accessor :color_set # 色调变更データ
attr_accessor :wait # 戦闘シーンの强制ウエイト
attr_accessor :win_wait # 戦闘勝利前のウエイト
attr_accessor :mirror # 画面反转フラグ
attr_accessor :program_scroll # バトルプログラム 背景の自动スクロール
attr_accessor :program_picture # バトルプログラム 周期图片
attr_accessor :event # 常见イベント呼び出し
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
@switches = []
@max_data = []
@color_set = []
@wait = 0
@win_wait = false
@mirror = false
@event = false
setup
end
#--------------------------------------------------------------------------
# ● カメラX坐标
#--------------------------------------------------------------------------
def x
return @x / 100
end
#--------------------------------------------------------------------------
# ● カメラY坐标
#--------------------------------------------------------------------------
def y
return @y / 100
end
#--------------------------------------------------------------------------
# ● ズーム率
#--------------------------------------------------------------------------
def zoom
return @zoom * 0.001
end
#--------------------------------------------------------------------------
# ● ズーム率による坐标变換
#--------------------------------------------------------------------------
def convert
return @zoom
end
#--------------------------------------------------------------------------
# ● カメラセットアップ
#--------------------------------------------------------------------------
def setup
@x = 0
@y = 0
@sx = 0
@sy = 0
@zoom = 1000
@time = 0
@shake_time = 0
program_setup
end
#--------------------------------------------------------------------------
# ● カメラ初期化
#--------------------------------------------------------------------------
def reset
@switches = []
@max_data = []
@color_set = []
@wait = 0
@win_wait = false
@mirror = false
program_setup(false)
end
#--------------------------------------------------------------------------
# ● バトルプログラムのセットアップ
#--------------------------------------------------------------------------
def program_setup(check = true)
@played_program = []
@program_switch = []
@program_sound = []
@program_scroll = []
@program_se = []
@program_shake = []
@program_color = []
@program_picture = []
@program_base = N03::BATTLE_PROGRAM.values.dup
program_check if check
end
#--------------------------------------------------------------------------
# ● バトルプログラムのチェック
#--------------------------------------------------------------------------
def program_check
for data in @program_base
if program_start?(data) && !@played_program.include?(data)
@played_program.push(data.dup)
@program_scroll.push(data.dup) if data[0] == "scroll"
@program_picture.push(data.dup) if data[0] == "kpic"
start_sound(data.dup) if data[0] == "sound"
start_program_switch(data.dup) if data[0] == "switch"
start_program_se(data.dup) if data[0] == "keep_se"
start_program_shake(data.dup) if data[0] == "keep_sk"
start_program_color(data.dup) if data[0] == "keep_c"
else
@played_program.delete(data) if !program_start?(data)
@program_scroll.delete(data) if data[0] == "scroll"
@program_picture.delete(data) if data[0] == "kpic"
@program_switch.delete(data) if data[0] == "switch"
@program_sound.delete(data) if data[0] == "sound"
@program_se.delete(data) if data[0] == "keep_se"
@program_shake.delete(data) if data[0] == "keep_sk"
@program_color.delete(data) if data[0] == "keep_c"
end
end
end
#--------------------------------------------------------------------------
# ● バトルプログラムの开始
#--------------------------------------------------------------------------
def program_start?(data)
start = false
start = true if $game_switches[data[1].abs] && data[1] > 0
start = true if @switches[data[1].abs] && data[1] < 0
return start
end
#--------------------------------------------------------------------------
# ● バトルプログラム スイッチ操作の开始
#--------------------------------------------------------------------------
def start_program_switch(data)
data[4] = data[4] + rand(data[5] + 1)
data[4] = 1 if data[4] <= 0
@program_switch.push(data)
end
#--------------------------------------------------------------------------
# ● スイッチ操作の更新
#--------------------------------------------------------------------------
def update_program_switch
for data in @program_switch
data[4] -= 1
next @program_switch.delete(data) if data[1] > 0 && !$game_switches[data[1]]
next @program_switch.delete(data) if data[1] < 0 && !@switches[data[1].abs]
next if data[4] != 0
for id in data[2]
$game_switches[id] = true if id > 0
@switches[id.abs] = true if id < 0
end
for id in data[3]
$game_switches[id] = false if id > 0
@switches[id.abs] = false if id < 0
end
@program_switch.delete(data)
program_check
end
end
#--------------------------------------------------------------------------
# ● バトルプログラム BGM/BGSの开始
#--------------------------------------------------------------------------
def start_sound(data)
@program_sound.push(data)
name = data[5]
case data[2]
when "se"
Audio.se_play("Audio/SE/" + name, data[4], data[3])
when "bgm"
name = RPG::BGM.last.name if data[5] == ""
Audio.bgm_play("Audio/BGM/" + name, data[4], data[3])
when "bgs"
name = RPG::BGS.last.name if data[5] == ""
Audio.bgs_play("Audio/BGS/" + name, data[4], data[3])
end
end
#--------------------------------------------------------------------------
# ● バトルプログラム 周期SEの开始
#--------------------------------------------------------------------------
def start_program_se(data)
data[3] = [data[2], data[3]]
data[2] = data[3][0] + rand(data[3][1] + 1)
@program_se.push(data)
Audio.se_play("Audio/SE/" + data[7], data[5], data[4]) if data[6]
end
#--------------------------------------------------------------------------
# ● 周期SEの更新
#--------------------------------------------------------------------------
def update_program_se
for data in @program_se
data[2] -= 1
next @program_se.delete(data) if data[1] > 0 && !$game_switches[data[1]]
next @program_se.delete(data) if data[1] < 0 && !@switches[data[1].abs]
next if data[2] != 0
Audio.se_play("Audio/SE/" + data[7], data[5], data[4])
data[2] = data[3][0] + rand(data[3][1] + 1)
end
end
#--------------------------------------------------------------------------
# ● バトルプログラム 周期摇晃の开始
#--------------------------------------------------------------------------
def start_program_shake(data)
data[3] = [data[2], data[3]]
data[2] = data[3][0] + rand(data[3][1] + 1)
@program_shake.push(data)
shake(data[4], data[5], data[6]) if data[7]
end
#--------------------------------------------------------------------------
# ● 周期摇晃の更新
#--------------------------------------------------------------------------
def update_program_shake
for data in @program_shake
data[2] -= 1
next @program_shake.delete(data) if data[1] > 0 && !$game_switches[data[1]]
next @program_shake.delete(data) if data[1] < 0 && !@switches[data[1].abs]
next if data[2] != 0
shake(data[4], data[5], data[6])
data[2] = data[3][0] + rand(data[3][1] + 1)
end
end
#--------------------------------------------------------------------------
# ● バトルプログラム 周期色调变更の开始
#--------------------------------------------------------------------------
def start_program_color(data)
data[3] = [data[2], data[3]]
data[2] = data[3][0] + rand(data[3][1] + 1)
data[7] = true if data[4] == 0 or data[4] == 4
case data[4]
when 1 ;data[4] = $game_troop.members
when 2 ;data[4] = $game_party.battle_members
when 3,4 ;data[4] = $game_troop.members + $game_party.battle_members
else ;data[4] = []
end
@program_color.push(data)
return if !data[6]
for target in data[4] do target.sv.color_set = data[5] end if data[4] != []
@color_set[1] = data[5] if data[7]
@color_set[2] = data[5] if data[7]
end
#--------------------------------------------------------------------------
# ● 周期色调变更の更新
#--------------------------------------------------------------------------
def update_program_color
for data in @program_color
data[2] -= 1
next @program_color.delete(data) if data[1] > 0 && !$game_switches[data[1]]
next @program_color.delete(data) if data[1] < 0 && !@switches[data[1].abs]
next if data[2] != 0
for target in data[4] do target.sv.color_set = data[5] end if data[4] != []
@color_set[1] = data[5] if data[7]
@color_set[2] = data[5] if data[7]
data[2] = data[3][0] + rand(data[3][1] + 1)
end
end
#--------------------------------------------------------------------------
# ● トランジション运行
#--------------------------------------------------------------------------
def perform_transition(data)
Graphics.transition(data[2], "Graphics/Pictures/" + data[3], data[1])
end
#--------------------------------------------------------------------------
# ● 背景からカメラの限界值を取得 data = [max_top, max_bottom, max_left, max_right]
#--------------------------------------------------------------------------
def setting(index, data)
@max_data[index - 1] = data
return if index != 2
setup
# カメラの中心坐标
@center_x = (Graphics.width / 2 + N03::CAMERA_POSITION[0]) * 100
@center_y = (Graphics.height / 2 + N03::CAMERA_POSITION[1]) * 100
# 上下左右の移动限界距離
@max_top = [@max_data[0][5], @max_data[1][5]].min * -1
@max_bottom = [@max_data[0][1], @max_data[1][1]].min + @max_top
@max_left = [@max_data[0][4], @max_data[1][4]].min * -1
@max_right = [@max_data[0][3], @max_data[1][3]].min + @max_left
exist_data = @max_data[0] if !@max_data[1][6]
exist_data = @max_data[1] if !@max_data[0][6]
@max_top = exist_data[5] * -1 if exist_data != nil
@max_bottom = exist_data[1] + @max_top if exist_data != nil
@max_left = exist_data[4] * -1 if exist_data != nil
@max_right = exist_data[3] + @max_left if exist_data != nil
@max_top = @max_bottom = @max_left = @max_right = 0 if !@max_data[1][6] && !@max_data[0][6]
@max_width = @max_right - @max_left + Graphics.width
@max_height = @max_bottom - @max_top + Graphics.height
# ズームアウト限界值
max_zoom_x = 100 * Graphics.width / @max_width
max_zoom_y = 100 * Graphics.height / @max_height
@max_zoom_out = [max_zoom_x, max_zoom_y].max
end
#--------------------------------------------------------------------------
# ● カメラ移动
#--------------------------------------------------------------------------
def move(target_x, target_y, zoom, time, screen = true)
# 戦闘背景以上のサイズまでズームアウトしないよう调整
@target_zoom = [zoom * 0.01, @max_zoom_out * 0.01].max
target_x *= -1 if screen && @mirror
# ズーム分の中心坐标補正
if screen && @target_zoom != 1
target_x = target_x + @center_x
target_y = target_y + @center_y
end
adjust_x = @center_x * (@target_zoom - 1) / (@target_zoom ** 2 - @target_zoom)
adjust_y = @center_y * (@target_zoom - 1) / (@target_zoom ** 2 - @target_zoom)
adjust_x = 0 if adjust_x.nan?
adjust_y = 0 if adjust_y.nan?
adjust_x = @center_x if !screen && adjust_x == 0
adjust_y = @center_y if !screen && adjust_y == 0
@target_x = target_x - adjust_x.to_i
@target_y = target_y - adjust_y.to_i
@target_zoom = (@target_zoom * 1000).to_i
@zoom = @zoom.to_i
limit_test
# 时间0の場合は即运行
return @time = time.abs if time != 0
@time = 1
update
end
#--------------------------------------------------------------------------
# ● 限界坐标の試算
#--------------------------------------------------------------------------
def limit_test
new_width = @max_width * @target_zoom / 1000
new_height = @max_height * @target_zoom / 1000
new_max_right = @max_right - (@max_width - new_width)
new_max_bottom = @max_bottom - (@max_height - new_height)
# 画面の移动先が限界の場合、限界坐标をセット
if @target_x < @max_left * 100
@target_x = @max_left * 100
end
if @target_x > new_max_right * 100
@target_x = new_max_right * 100
end
if @target_y < @max_top * 100
@target_y = @max_top * 100
end
if @target_y > new_max_bottom * 100
@target_y = new_max_bottom * 100
end
end
#--------------------------------------------------------------------------
# ● 画面の摇晃
#--------------------------------------------------------------------------
def shake(power, speed, time)
@shake_x = power[0] * 100
@shake_y = power[1] * 100
@power_time_base = @power_time = speed
@shake_time = time
update_shake
end
#--------------------------------------------------------------------------
# ● 摇晃の更新
#--------------------------------------------------------------------------
def update_shake
@sx = (@sx * (@power_time - 1) + @shake_x) / @power_time
@sy = (@sy * (@power_time - 1) + @shake_y) / @power_time
@power_time -= 1
@shake_time -= 1
return @sx = @sy = 0 if @shake_time == 0
return if @power_time != 0
@power_time = @power_time_base
@shake_x = @shake_x * -4 / 5
@shake_y = @shake_y * -4 / 5
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
update_shake if @shake_time != 0
update_program
return if @time == 0
@x = (@x * (@time - 1) + @target_x) / @time
@y = (@y * (@time - 1) + @target_y) / @time
@zoom = (@zoom * (@time - 1) + @target_zoom) / @time
@time -= 1
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update_program
update_program_switch if @program_switch != []
update_program_se if @program_se != []
update_program_shake if @program_shake != []
update_program_color if @program_color != []
end
end
#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
# バトル画面の处理を行うクラスです。
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● フレーム更新(基本)
#--------------------------------------------------------------------------
alias update_basic_scene_battle_n03 update_basic
def update_basic
update_basic_scene_battle_n03
$sv_camera.update
$sv_camera.wait = N03::TURN_END_WAIT + 1 if $sv_camera.win_wait
camera_wait
end
#--------------------------------------------------------------------------
# ● カメラウェイト
#--------------------------------------------------------------------------
def camera_wait
process_event if $sv_camera.event
$sv_camera.event = false if $sv_camera.event
while $sv_camera.wait != 0
Graphics.update
Input.update
update_all_windows
$game_timer.update
$game_troop.update
$sv_camera.update
@spriteset.update
update_info_viewport
update_message_open
$sv_camera.wait -= 1 if $sv_camera.wait > 0
$sv_camera.wait = 1 if $sv_camera.wait == 0 && @spriteset.effect?
BattleManager.victory if $sv_camera.win_wait && $sv_camera.wait == 0
end
end
#--------------------------------------------------------------------------
# ● カメラウェイトのセット
#--------------------------------------------------------------------------
def set_camera_wait(time)
$sv_camera.wait = time
camera_wait
end
#--------------------------------------------------------------------------
# ● エフェクト运行が终わるまでウェイト ★再定義
#--------------------------------------------------------------------------
def wait_for_effect
end
#--------------------------------------------------------------------------
# ● ターン开始
#--------------------------------------------------------------------------
alias turn_start_scene_battle_n03 turn_start
def turn_start
turn_start_scene_battle_n03
N03.camera(nil, N03::BATTLE_CAMERA["回合结束"].dup)
end
#--------------------------------------------------------------------------
# ● ターン终了
#--------------------------------------------------------------------------
alias turn_end_scene_battle_n03 turn_end
def turn_end
turn_end_scene_battle_n03
for member in $game_troop.members + $game_party.members
N03.set_damage(member, member.sv.result_damage[0],member.sv.result_damage[1])
member.sv.result_damage = [0,0]
@spriteset.set_damage_pop(member) if member.result.hp_damage != 0 or member.result.mp_damage != 0
end
set_camera_wait(N03::TURN_END_WAIT)
N03.camera(nil, N03::BATTLE_CAMERA["回合开始"].dup) if $game_party.inputable?
@log_window.clear
end
#--------------------------------------------------------------------------
# ● 技能/物品の使用 ★再定義
#--------------------------------------------------------------------------
def use_item
item = @subject.current_action.item
display_item(item)
@subject.use_item(item)
refresh_status
@targets = @subject.current_action.make_targets.compact
@targets = [@subject] if @targets.size == 0
set_substitute(item)
for time in item.repeats.times do play_sideview(@targets, item) end
end_reaction(item)
display_end_item
end
#--------------------------------------------------------------------------
# ● 技能/物品名の表示
#--------------------------------------------------------------------------
def display_item(item)
return @log_window.display_use_item(@subject, item) if N03::BATTLE_LOG
@log_window.off
@skill_name_window = Window_Skill_name.new(item.name) unless N03::NO_DISPLAY_SKILL_ID.include?(item.id) && item.is_a?(RPG::Skill)
end
#--------------------------------------------------------------------------
# ● 技能/物品名の表示终了
#--------------------------------------------------------------------------
def display_end_item
@skill_name_window.dispose if @skill_name_window != nil
@skill_name_window = nil
set_camera_wait(N03::ACTION_END_WAIT) if @subject.sv.derivation_skill_id == 0
@log_window.clear if N03::BATTLE_LOG
end
#--------------------------------------------------------------------------
# ● 反击/魔法反射/身代わり处理
#--------------------------------------------------------------------------
def end_reaction(item)
end_substitute if @substitute != nil
set_reflection(item) if @reflection_data != nil
set_counter_attack if @counter_attacker != nil
end
#--------------------------------------------------------------------------
# ● 反击の发动 ★再定義
#--------------------------------------------------------------------------
def invoke_counter_attack(target, item)
return if @subject.sv.counter_id != 0
@counter_attacker = [] if @counter_attacker == nil
return apply_item_effects(apply_substitute(target, item), item) if !target.movable?
@log_window.add_text(sprintf(Vocab::CounterAttack, target.name)) if N03::BATTLE_LOG
target.sv.counter_id = target.sv.counter_skill_id
@counter_attacker.push(target)
end
#--------------------------------------------------------------------------
# ● 魔法反射の发动 ★再定義
#--------------------------------------------------------------------------
def invoke_magic_reflection(target, item)
return if @subject.sv.reflection_id != 0
@log_window.add_text(sprintf(Vocab::MagicReflection, target.name)) if N03::BATTLE_LOG
target.sv.reflection_id = target.sv.reflection_anime_id
end
#--------------------------------------------------------------------------
# ● 身代わりの適用 ★再定義
#--------------------------------------------------------------------------
def apply_substitute(target, item)
return target if @substitute == nil
return target if !check_substitute(target, item)
return @substitute
end
#--------------------------------------------------------------------------
# ● 身代わりセット
#--------------------------------------------------------------------------
def set_substitute(item)
@substitute = N03.get_enemy_unit(@subject).substitute_battler
return if @substitute == nil
s_targets = []
for i in [email protected]
next if @targets == @substitute
next if !check_substitute(@targets, item)
@log_window.add_text(sprintf(Vocab::Substitute, @substitute.name, @targets.name))
@targets.sv.start_action(@targets.sv.substitute_receiver_start_action)
s_targets.push(@targets)
@targets = @substitute
end
return @substitute = nil if s_targets == []
@substitute.sv.set_target(s_targets)
@substitute.sv.start_action(@substitute.sv.substitute_start_action)
end
#--------------------------------------------------------------------------
# ● 身代わり终了
#--------------------------------------------------------------------------
def end_substitute
for member in @substitute.sv.target_battler
member.sv.start_action(member.sv.substitute_receiver_end_action)
end
@substitute.sv.start_action(@substitute.sv.substitute_end_action)
@substitute = nil
end
#--------------------------------------------------------------------------
# ● 反击
#--------------------------------------------------------------------------
def set_counter_attack
pre_subject = @subject
for attacker in @counter_attacker
@subject = attacker
item = $data_skills[attacker.sv.counter_skill_id]
play_sideview([pre_subject], item)
end
# 同一カウンター者を考慮してカウンターIDの初期化は动作后に运行
for attacker in @counter_attacker do attacker.sv.counter_id = 0 end
@subject = pre_subject
@counter_attacker = nil
end
#--------------------------------------------------------------------------
# ● 魔法反射
#--------------------------------------------------------------------------
def set_reflection(item)
@log_window.back_to(1)
for data in @reflection_data
@subject.sv.damage_action(@subject, item)
N03.set_damage_anime_data([@subject], @subject, data)
apply_item_effects(@subject, item)
@spriteset.set_damage_pop(@subject)
end
set_camera_wait(N03.get_anime_time(@reflection_data[0][0]))
@reflection_data = nil
end
#--------------------------------------------------------------------------
# ● サイドビュー动作运行
#--------------------------------------------------------------------------
def play_sideview(targets, item)
@subject.sv.set_target(targets)
return if @subject.sv.attack_action(item) == nil
return if [email protected]?
return if item.scope != 9 && item.scope != 10 && !N03.targets_alive?(targets)
@subject.sv.start_action(@subject.sv.attack_action(item))
@subject.sv.unshift_action(@subject.sv.flash_action) if @subject.flash_flg
@subject.sv.active = true
@subject.sv.command_action = false
loop do
update_basic
data = @subject.sv.play_data
@targets = N03.s_targets(@subject) if data[0] == "second_targets_set"
N03.targets_set(@subject) if data[0] == "targets_set"
@immortal = N03.immortaling if data[0] == "no_collapse" && !N03.dead_attack?(@subject, item)
@immortal = N03.unimmortaling if data[0] == "collapse"
next set_move_anime(item) if @subject.sv.m_a_data != []
set_damage(item) if @subject.sv.set_damage
break N03.derived_skill(@subject) if @subject.sv.derivation_skill_id != 0
break if @subject.sv.action_end or @subject.hidden?
end
@immortal = N03.unimmortaling if @immortal
end
#--------------------------------------------------------------------------
# ● ダメージの运行
#--------------------------------------------------------------------------
def set_damage(item)
targets = @targets
targets = [@subject.sv.individual_targets[0]] if @subject.sv.individual_targets.size != 0
for target in targets do damage_anime(targets.dup, target, item) end
@subject.sv.set_damage = false
@subject.sv.damage_anime_data = []
end
#--------------------------------------------------------------------------
# ● ダメージ战斗动画处理
#--------------------------------------------------------------------------
def damage_anime(targets, target, item)
@log_window.back_to(1) if @log_window.line_number == 5
return if item.scope != 9 && item.scope != 10 && target.dead?
@miss = false
invoke_item(target,item)
if target.result.missed
target.sv.miss_action(@subject, item)
return @miss = true
elsif target.result.evaded or target.sv.counter_id != 0
target.sv.evasion_action(@subject, item)
return @miss = true
elsif target.sv.reflection_id != 0
N03.set_damage_anime_data(targets, target, [target.sv.reflection_id, false, false, true])
target.sv.reflection_id = 0
@reflection_data = [] if @reflection_data == nil
return @reflection_data.push([N03.get_attack_anime_id(-3, @subject), false, false, true])
end
target.sv.damage_action(@subject, item)
N03.set_damage(@subject, -target.result.hp_drain, -target.result.mp_drain) if target != @subject
@spriteset.set_damage_pop(target)
@spriteset.set_damage_pop(@subject) if target != @subject && @subject.result.hp_damage != 0 or @subject.result.mp_damage != 0
N03.set_damage_anime_data(targets, target, @subject.sv.damage_anime_data) if @subject.sv.damage_anime_data != []
end
#--------------------------------------------------------------------------
# ● 飛ばし动画处理
#--------------------------------------------------------------------------
def set_move_anime(item)
for data in @subject.sv.m_a_data
@subject.sv.damage_anime_data = data[4]
hit_targets = []
for target in data[1]
damage_anime(data[1], target, item) if data[0]
hit_targets.push(target) if !@miss
end
@miss = false if !data[3]
@spriteset.set_hit_animation(@subject, data[2], hit_targets, @miss)
end
@subject.sv.set_damage = false
@subject.sv.m_a_data = []
end
end
#==============================================================================
# ■ BattleManager
#------------------------------------------------------------------------------
# 戦闘の進行を管理するモジュールです。
#==============================================================================
module BattleManager
#--------------------------------------------------------------------------
# ● エンカウント時の处理 ★再定義
#--------------------------------------------------------------------------
def self.on_encounter
@preemptive = (rand < rate_preemptive)
@surprise = (rand < rate_surprise && !@preemptive)
$sv_camera.mirror = @surprise if N03::BACK_ATTACK
end
#--------------------------------------------------------------------------
# ● 勝利の处理 ★再定義
#--------------------------------------------------------------------------
def self.process_victory
$sv_camera.win_wait = true
end
#--------------------------------------------------------------------------
# ● 勝利
#--------------------------------------------------------------------------
def self.victory
$sv_camera.win_wait = false
N03.camera(nil, N03::BATTLE_CAMERA["战斗结束时"].dup)
for member in $game_party.members do member.sv.start_action(member.sv.win) if member.movable? end
play_battle_end_me
replay_bgm_and_bgs
$game_message.add(sprintf(Vocab::Victory, $game_party.name))
display_exp
gain_gold
gain_drop_items
gain_exp
SceneManager.return
battle_end(0)
return true
end
#--------------------------------------------------------------------------
# ● 逃走の处理 ★再定義
#--------------------------------------------------------------------------
def self.process_escape
$game_message.add(sprintf(Vocab::EscapeStart, $game_party.name))
success = @preemptive ? true : (rand < @escape_ratio)
Sound.play_escape
if success
process_abort
for member in $game_party.members do member.sv.start_action(member.sv.escape) if member.movable? end
else
@escape_ratio += 0.1
$game_message.add('\.' + Vocab::EscapeFailure)
$game_party.clear_actions
for member in $game_party.members do member.sv.start_action(member.sv.escape_ng) if member.movable? end
end
wait_for_message
return success
end
#--------------------------------------------------------------------------
# ● 次の指令输入へ ★再定義
#--------------------------------------------------------------------------
def self.next_command
begin
if !actor || !actor.next_command
$game_party.battle_members[@actor_index].sv.command_action = true
@actor_index += 1
if @actor_index >= $game_party.members.size
for member in $game_party.battle_members.reverse
break member.sv.start_action(member.sv.command_a) if member.inputable?
end
return false
end
end
end until actor.inputable?
actor.sv.start_action(actor.sv.command_b) if actor != nil && actor.inputable?
if pre_actor
pre_actor.sv.start_action(pre_actor.sv.command_a) if pre_actor != nil && pre_actor.inputable?
end
return true
end
#--------------------------------------------------------------------------
# ● 前の指令输入へ ★再定義
#--------------------------------------------------------------------------
def self.prior_command
begin
if !actor || !actor.prior_command
$game_party.battle_members[@actor_index].sv.command_action = false
@actor_index -= 1
if @actor_index < 0
for member in $game_party.battle_members
break member.sv.start_action(member.sv.command_a) if member.inputable?
end
return false
end
end
end until actor.inputable?
actor.make_actions if actor.inputable?
actor.sv.start_action(actor.sv.command_b) if actor.inputable?
after_actor.sv.start_action(after_actor.sv.command_a) if after_actor != nil && after_actor.inputable?
return true
end
#--------------------------------------------------------------------------
# ● 指令输入前のアクターを取得
#--------------------------------------------------------------------------
def self.pre_actor
return if @actor_index == 0
$game_party.members[@actor_index - 1]
end
#--------------------------------------------------------------------------
# ● 指令输入后のアクターを取得
#--------------------------------------------------------------------------
def self.after_actor
$game_party.members[@actor_index + 1]
end
#--------------------------------------------------------------------------
# ● 戦闘行动者を前に追加
#--------------------------------------------------------------------------
def self.unshift_action_battlers(battler)
@action_battlers.unshift(battler)
end
end
#==============================================================================
# ■ Game_Battler
#------------------------------------------------------------------------------
# スプライトや行动に関するメソッドを追加したバトラーのクラスです。
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# ● 公开インスタンス变数
#--------------------------------------------------------------------------
attr_reader :sv # サイドビューデータ
attr_accessor :flash_flg # 閃きフラグ
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_game_battler_n03 initialize
def initialize
initialize_game_battler_n03
@sv = SideView.new(self)
end
#--------------------------------------------------------------------------
# ● 現在の戦闘行动を除去
#--------------------------------------------------------------------------
alias remove_current_action_game_battler_n03 remove_current_action
def remove_current_action
return @sv.derivation_skill_id = 0 if @sv.derivation_skill_id != 0
remove_current_action_game_battler_n03
end
#--------------------------------------------------------------------------
# ● ターン终了处理
#--------------------------------------------------------------------------
alias on_turn_end_game_battler_n03 on_turn_end
def on_turn_end
on_turn_end_game_battler_n03
@sv.add_state = []
@sv.result_damage = [@result.hp_damage, @result.mp_damage]
end
#--------------------------------------------------------------------------
# ● パラメータ条件比較 data = [类别, 数值, 区别]
#--------------------------------------------------------------------------
def comparison_parameter(data)
return true if data[0][0] == 0
kind = data[0]
num = data[1]
select = data[2]
case kind
when 1 ; par = level
when 2 ; par = mhp
when 3 ; par = mmp
when 4 ; par = hp
when 5 ; par = mp
when 6 ; par = tp
when 7 ; par = atk
when 8 ; par = self.def
when 9 ; par = mat
when 10 ; par = mdf
when 11 ; par = agi
when 12 ; par = luk
end
if num < 0
case kind
when 4 ; num = mhp * num / 100
when 5 ; num = mmp * num / 100
when 6 ; num = max_tp * num / 100
end
num = num.abs
end
case select
when 0 ; return par == num
when 1 ; return par < num
when 2 ; return par > num
end
end
#--------------------------------------------------------------------------
# ● 装备条件比較 data = [装备类别, タイプID]
#--------------------------------------------------------------------------
def comparison_equip(data)
kind = data[0]
items = weapons if kind == 0
items = armors if kind == 1
for item in items
for id in data[1]
return true if id > 0 && item.is_a?(RPG::Weapon) && item == $data_weapons[id.abs]
return true if id > 0 && item.is_a?(RPG::Armor) && item == $data_armors[id.abs]
return true if id < 0 && item.is_a?(RPG::Weapon) && item.wtype_id == id.abs
return true if id < 0 && item.is_a?(RPG::Armor) && item.stype_id == id.abs
end
end
return false
end
end
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# アクターを扱うクラスです。
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 公开インスタンス变数
#--------------------------------------------------------------------------
attr_reader :actor_id # ID
#--------------------------------------------------------------------------
# ● ID
#--------------------------------------------------------------------------
def id
return @actor_id
end
#--------------------------------------------------------------------------
# ● スプライトを使うか? ★再定義
#--------------------------------------------------------------------------
def use_sprite?
return true
end
#--------------------------------------------------------------------------
# ● ダメージ効果の运行 ★再定義
#--------------------------------------------------------------------------
def perform_damage_effect
return if !N03::ACTOR_DAMAGE
$game_troop.screen.start_shake(5, 5, 10)
@sprite_effect_type = :blink
Sound.play_actor_damage
end
end
#==============================================================================
# ■ Game_Enemy
#------------------------------------------------------------------------------
# 敵キャラを扱うクラスです。
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ● 公开インスタンス变数
#--------------------------------------------------------------------------
attr_reader :enemy_id # ID
#--------------------------------------------------------------------------
# ● ID
#--------------------------------------------------------------------------
def id
return @enemy_id
end
#--------------------------------------------------------------------------
# ● レベル
#--------------------------------------------------------------------------
def level
return @sv.level
end
#--------------------------------------------------------------------------
# ● ダメージ効果の运行 ★再定義
#--------------------------------------------------------------------------
def perform_damage_effect
return if !N03::ENEMY_DAMAGE
@sprite_effect_type = :blink
Sound.play_enemy_damage
end
#--------------------------------------------------------------------------
# ● 武器
#--------------------------------------------------------------------------
def weapons
weapon1 = $data_weapons[@sv.enemy_weapon1_id]
weapon2 = $data_weapons[@sv.enemy_weapon2_id]
return [weapon1, weapon2]
end
#--------------------------------------------------------------------------
# ● 防具
#--------------------------------------------------------------------------
def armors
return [$data_armors[@sv.enemy_shield_id]]
end
#--------------------------------------------------------------------------
# ● 二刀流の判定
#--------------------------------------------------------------------------
def dual_wield?
return $data_weapons[@sv.enemy_weapon2_id] != nil
end
#--------------------------------------------------------------------------
# ● バトラー画像变更
#--------------------------------------------------------------------------
def graphics_change(battler_name)
@battler_name = battler_name
end
#--------------------------------------------------------------------------
# ● 通常攻击 动画ーション ID の取得
#--------------------------------------------------------------------------
def atk_animation_id1
return weapons[0].animation_id if weapons[0]
return weapons[1] ? 0 : 1
end
#--------------------------------------------------------------------------
# ● 通常攻击 动画ーション ID の取得(二刀流:武器2)
#--------------------------------------------------------------------------
def atk_animation_id2
return weapons[1] ? weapons[1].animation_id : 0
end
end
#==============================================================================
# ■ Sprite_Base
#------------------------------------------------------------------------------
# 动画ーションの表示处理を追加したスプライトのクラスです。
#==============================================================================
class Sprite_Base < Sprite
#--------------------------------------------------------------------------
# ● 动画ーションの坐标更新 (ホーミングあり)
#--------------------------------------------------------------------------
def update_animation_position_horming
return if @action_end_cancel
ani_ox_set if @horming
camera_zoom = $sv_camera.zoom
camera_zoom = 1 if @move_anime
kind = 1
kind = -1 if @ani_mirror && !@anime_no_mirror
cell_data = @animation.frames[@animation.frame_max - (@ani_duration + @ani_rate - 1) / @ani_rate].cell_data
for i in 0..15
@ani_sprites.x = (@ani_ox + cell_data[i, 1] * kind - $sv_camera.x) * camera_zoom if @ani_sprites != nil && cell_data[i, 1] != nil
@ani_sprites.y = (@ani_oy + cell_data[i, 2] - $sv_camera.y) * camera_zoom if @ani_sprites != nil && cell_data[i, 2] != nil
end
end
#--------------------------------------------------------------------------
# ● 动画ーション元の坐标をセット
#--------------------------------------------------------------------------
def ani_ox_set
if !SceneManager.scene_is?(Scene_Battle)
@real_x = x
@real_y = y
end
@ani_ox = @real_x - ox + width / 2
@ani_oy = @real_y - oy + height / 2
@ani_oy -= height / 2 if @animation.position == 0
@ani_oy += height / 2 if @animation.position == 2
end
#--------------------------------------------------------------------------
# ● 动画ーションの更新
#--------------------------------------------------------------------------
alias update_animation_sprite_base_n03 update_animation
def update_animation
update_animation_position_horming if animation? && SceneManager.scene_is?(Scene_Battle) && @animation.position != 3
update_animation_sprite_base_n03
end
#--------------------------------------------------------------------------
# ● 动画ーションの原点設定 ★再定義
#--------------------------------------------------------------------------
def set_animation_origin
return ani_ox_set if @animation.position != 3
if viewport == nil
@ani_ox = Graphics.width / 2
@ani_oy = Graphics.height / 2
else
@ani_ox = viewport.rect.width / 2
@ani_oy = viewport.rect.height / 2
end
end
#--------------------------------------------------------------------------
# ● 动画ーションスプライトの設定 ★再定義
#--------------------------------------------------------------------------
def animation_set_sprites(frame)
camera_zoom = 1
camera_zoom = $sv_camera.zoom if @anime_camera_zoom && @animation.position != 3 && SceneManager.scene_is?(Scene_Battle)
camera_x = $sv_camera.x
camera_y = $sv_camera.y
camera_x = camera_y = 0 if @animation.position == 3 or !SceneManager.scene_is?(Scene_Battle)
plus_z = 5
plus_z = 1000 if @animation.position == 3
plus_z = -17 if @plus_z != nil && @plus_z == false
plus_z = -self.z + 10 if @plus_z != nil && @plus_z == false && @animation.position == 3
cell_data = frame.cell_data
@ani_sprites.each_with_index do |sprite, i|
next unless sprite
pattern = cell_data[i, 0]
if !pattern || pattern < 0
sprite.visible = false
next
end
sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2
sprite.visible = true
sprite.src_rect.set(pattern % 5 * 192,
pattern % 100 / 5 * 192, 192, 192)
if @ani_mirror && !@anime_no_mirror
sprite.x = (@ani_ox - cell_data[i, 1] - camera_x) * camera_zoom
sprite.y = (@ani_oy + cell_data[i, 2] - camera_y) * camera_zoom
sprite.angle = (360 - cell_data[i, 4])
sprite.mirror = (cell_data[i, 5] == 0)
else
sprite.x = (@ani_ox + cell_data[i, 1] - camera_x) * camera_zoom
sprite.y = (@ani_oy + cell_data[i, 2] - camera_y) * camera_zoom
sprite.angle = cell_data[i, 4]
sprite.mirror = (cell_data[i, 5] == 1)
end
sprite.z = self.z + plus_z + i
sprite.ox = 96
sprite.oy = 96
sprite.zoom_x = cell_data[i, 3] * camera_zoom / 100.0
sprite.zoom_y = cell_data[i, 3] * camera_zoom/ 100.0
sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
sprite.blend_type = cell_data[i, 7]
end
end
#--------------------------------------------------------------------------
# ● 子スプライトフラグ
#--------------------------------------------------------------------------
def set(battler, horming, camera_zoom, no_mirror)
@battler = battler
@next = true
self.bitmap = Bitmap.new(@battler.sv.cw, @battler.sv.ch)
self.ox = bitmap.width / 2
self.oy = bitmap.height
@horming = horming
@anime_camera_zoom = camera_zoom
@anime_no_mirror = no_mirror
@battler.sv.reset_anime_data
end
#--------------------------------------------------------------------------
# ● 子スプライト坐标セット
#--------------------------------------------------------------------------
def set_position(z, zoom_x, zoom_y, real_x, real_y)
self.z = z
self.zoom_x = zoom_x
self.zoom_y = zoom_y
@real_x = real_x
@real_y = real_y
end
#--------------------------------------------------------------------------
# ● 他スプライトへのタイミング处理
#--------------------------------------------------------------------------
def other_process_timing(timing)
se_flag = true
se_flag = @se_flag if @se_flag != nil
@battler.sv.timing.push([se_flag, timing.dup])
end
#--------------------------------------------------------------------------
# ● 他バトラーへのタイミング处理
#--------------------------------------------------------------------------
def target_battler_process_timing(timing)
for target in @timing_targets
target.sv.timing.push([false, timing.dup])
end
end
#--------------------------------------------------------------------------
# ● SE とフラッシュのタイミング处理
#--------------------------------------------------------------------------
alias animation_process_timing_sprite_base_n03 animation_process_timing
def animation_process_timing(timing)
target_battler_process_timing(timing) if @timing_targets && @timing_targets != []
return other_process_timing(timing) if @next != nil
animation_process_timing_sprite_base_n03(timing)
end
#--------------------------------------------------------------------------
# ● 动画ーションの解放
#--------------------------------------------------------------------------
alias dispose_animation_sprite_base_n03 dispose_animation
def dispose_animation
dispose_animation_sprite_base_n03
end
end
#==============================================================================
# ■ Sprite_Battler
#------------------------------------------------------------------------------
# バトラー表示用のスプライトです。
#==============================================================================
class Sprite_Battler < Sprite_Base
#--------------------------------------------------------------------------
# ● 公开インスタンス变数
#--------------------------------------------------------------------------
attr_accessor :removing # パーティ離脱中
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_sprite_battler_n03 initialize
def initialize(viewport, battler = nil)
initialize_sprite_battler_n03(viewport, battler)
@real_x = @real_y = 0
update_bitmap if @battler != nil
end
#--------------------------------------------------------------------------
# ● 动画ーションの开始 ★再定義
#--------------------------------------------------------------------------
def start_animation(animation, mirror = false)
return next_animation(animation, mirror) if animation?
@animation = animation
if @animation
@horming = @battler.sv.anime_horming
@anime_camera_zoom = @battler.sv.anime_camera_zoom
@anime_no_mirror = @battler.sv.anime_no_mirror
@timing_targets = @battler.sv.timing_targets
@plus_z = @battler.sv.anime_plus_z
@battler.sv.reset_anime_data
@ani_mirror = mirror
set_animation_rate
@ani_duration = @animation.frame_max * @ani_rate + 1
load_animation_bitmap
make_animation_sprites
set_animation_origin
end
end
#--------------------------------------------------------------------------
# ● 次の动画を开始
#--------------------------------------------------------------------------
def next_animation(animation, mirror)
@next_anime = [] if @next_anime == nil
@next_anime.push(Sprite_Base.new(viewport))
@next_anime[@next_anime.size - 1].set(battler, @battler.sv.anime_horming, @battler.sv.anime_camera_zoom, @battler.sv.anime_no_mirror)
@next_anime[@next_anime.size - 1].set_position(self.z, self.zoom_x, self.zoom_y, @real_x, @real_y)
@next_anime[@next_anime.size - 1].start_animation(animation, mirror)
end
#--------------------------------------------------------------------------
# ● 影グラフィック作成
#--------------------------------------------------------------------------
def create_shadow
reset_shadow
return if @battler.sv.shadow == false
@shadow = Sprite.new(viewport) if @shadow == nil
@shadow.bitmap = Cache.character(@battler.sv.shadow)
@shadow.ox = @shadow.bitmap.width / 2
@shadow.oy = @shadow.bitmap.height / 2
end
#--------------------------------------------------------------------------
# ● 影グラフィック初期化
#--------------------------------------------------------------------------
def reset_shadow
return if @shadow == nil
@shadow.dispose
@shadow = nil
end
#--------------------------------------------------------------------------
# ● 旋送元ビットマップの更新 ★再定義
#--------------------------------------------------------------------------
def update_bitmap
update_bitmap_enemy if [email protected]?
update_bitmap_actor if @battler.actor?
update_src_rect if @battler != nil
update_color if @battler != nil
end
#--------------------------------------------------------------------------
# ● 旋送元ビットマップ:敌人
#--------------------------------------------------------------------------
def update_bitmap_enemy
if @battler.battler_name != @battler_name or @battler.battler_hue != @battler_hue
@battler_name = @battler.battler_name
@battler_hue = @battler.battler_hue
@battler_graphic_file_index = @battler.sv.graphic_file_index
@graphic_mirror_flag = @battler.sv.graphic_mirror_flag
self.bitmap = Cache.battler(@battler_name + @battler_graphic_file_index, @battler_hue)
@battler.sv.setup(self.bitmap.width, self.bitmap.height, @battler_id != @battler.id)
create_shadow
init_visibility
@battler_id = @battler.id
end
end
#--------------------------------------------------------------------------
# ● 旋送元ビットマップ:アクター
#--------------------------------------------------------------------------
def update_bitmap_actor
if @battler.character_name != @battler_name or @battler.character_index != @battler_index
@battler_name = @battler.character_name
@battler_index = @battler.character_index
@battler_graphic_file_index = @battler.sv.graphic_file_index
@graphic_mirror_flag = @battler.sv.graphic_mirror_flag
self.bitmap = Cache.character(@battler_name + @battler_graphic_file_index)
@battler.sv.setup(self.bitmap.width, self.bitmap.height, @battler_id != @battler.id)
create_shadow
init_visibility
@battler_id = @battler.id
end
end
#--------------------------------------------------------------------------
# ● 可視状態の初期化 ★再定義
#--------------------------------------------------------------------------
def init_visibility
@battler_visible = @battler.alive?
@battler_visible = true if @battler.sv.state(1) != "敌人崩溃"
@battler_visible = false if @battler.hidden?
@battler.sv.opacity = 0 unless @battler_visible
self.opacity = 0 unless @battler_visible
self.opacity = 255 if @battler_visible
@battler.sv.weapon_visible = @battler_visible
end
#--------------------------------------------------------------------------
# ● 旋送元矩形の更新
#--------------------------------------------------------------------------
def update_src_rect
return if @battler.sv.collapse
if @battler_graphic_file_index != @battler.sv.graphic_file_index
@battler_graphic_file_index = @battler.sv.graphic_file_index
self.bitmap = Cache.character(@battler_name + @battler_graphic_file_index) if @battler.actor?
self.bitmap = Cache.battler(@battler_name + @battler_graphic_file_index, @battler_hue) if [email protected]?
@battler.sv.set_graphics(self.bitmap.width, self.bitmap.height)
end
anime_off if @battler.sv.anime_off
self.src_rect.set(@battler.sv.sx, @battler.sv.sy, @battler.sv.cw, @battler.sv.ch)
self.opacity = @battler.sv.opacity if @battler_visible
set_process_timing(@battler.sv.timing) if @battler && @battler.sv.timing != []
end
#--------------------------------------------------------------------------
# ● 位置の更新 ★再定義
#--------------------------------------------------------------------------
def update_position
@real_x = @battler.sv.x / 100
@real_y = (@battler.sv.y - @battler.sv.h - @battler.sv.j - @battler.sv.c - @battler.sv.oy_adjust)/ 100
self.x = @real_x - $sv_camera.x
self.y = @real_y - $sv_camera.y
self.z = @battler.sv.z - @battler.sv.c / 100
if @battler.sv.h <= 0
self.x += $sv_camera.sx / 100
self.y += $sv_camera.sy / 100
end
self.x *= $sv_camera.zoom
self.y *= $sv_camera.zoom
end
#--------------------------------------------------------------------------
# ● 原点の更新 ★再定義
#--------------------------------------------------------------------------
def update_origin
return if !bitmap or @battler.sv.collapse
self.ox = @battler.sv.ox
self.oy = @battler.sv.oy
self.angle = @battler.sv.angle
self.zoom_x = @battler.sv.zoom_x * $sv_camera.zoom
self.zoom_y = @battler.sv.zoom_y * $sv_camera.zoom
self.mirror = @battler.sv.mirror if !@graphic_mirror_flag
self.mirror = [email protected] if @graphic_mirror_flag
end
#--------------------------------------------------------------------------
# ● 影グラフィックの更新
#--------------------------------------------------------------------------
def update_shadow
@shadow.visible = @battler.sv.shadow_visible
@shadow.opacity = @battler.sv.opacity if @battler.sv.opacity_data[3]
@shadow.opacity = self.opacity if [email protected]_data[3]
@shadow.x = @real_x - $sv_camera.x
@shadow.y = (@battler.sv.y - @battler.sv.c)/ 100 - $sv_camera.y
@shadow.z = @battler.sv.z - 10
@shadow.zoom_x = $sv_camera.zoom
@shadow.zoom_y = $sv_camera.zoom
@shadow.x += $sv_camera.sx / 100
@shadow.y += $sv_camera.sy / 100
@shadow.x *= $sv_camera.zoom
@shadow.y *= $sv_camera.zoom
@shadow.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
end
#--------------------------------------------------------------------------
# ● ふきだしの更新
#--------------------------------------------------------------------------
def update_balloon
if @battler.sv.balloon_data == [] && @balloon
@balloon_data = []
@balloon.dispose
return @balloon = nil
elsif @battler.sv.balloon_data != [] && @battler.sv.balloon_data != @balloon_data
@balloon_data = @battler.sv.balloon_data
@balloon = Sprite.new(self.viewport)
@balloon.bitmap = Cache.system("Balloon")
@balloon.zoom_x = @balloon_data[3]
@balloon.zoom_y = @balloon_data[3]
@balloon.ox = 32 if @battler.sv.mirror
@balloon.oy = 16
@balloon_count = 0
end
return if !@balloon
@balloon.opacity = self.opacity
@balloon.x = self.x
@balloon.y = self.y - @battler.sv.ch * $sv_camera.zoom
@balloon.z = self.z + 20
@balloon.src_rect.set(32 + @balloon_count / @balloon_data[2] * 32, @balloon_data[1] * 32, 32, 32) if @balloon_count % @balloon_data[2] == 0
@balloon.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
@balloon_count += 1
@balloon_count = 0 if @balloon_count == @balloon_data[2] * 7
end
#--------------------------------------------------------------------------
# ● 色调变更の更新
#--------------------------------------------------------------------------
def update_color
color_set if @battler.sv.color_set != []
return if @color_data == nil
@color_data[4] -= 1
if @color_data[4] == 0 && @color_data[5] != 0
@color_data[4] = @color_data[5]
@color_data[5] = 0
@color_data[6] = [0,0,0,0]
elsif @color_data[4] == 0
@remain_color_data = @color_data
@battler.sv.color = @color_data.dup
return @color_data = nil
end
for i in 0..3
@color_data = (@color_data * (@color_data[4] - 1) + @color_data[6]) / @color_data[4]
end
@battler.sv.color = @color_data.dup
self.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3])
end
#--------------------------------------------------------------------------
# ● 残像の更新
#--------------------------------------------------------------------------
def update_mirage
if @battler.sv.mirage == [] && @mirages
@mirage_data = []
for mirage in @mirages do mirage.dispose end
return @mirages = nil
elsif @battler.sv.mirage != [] && @battler.sv.mirage != @mirage_data
@mirage_data = @battler.sv.mirage
@mirages = []
for i in 0...@mirage_data[1] do @mirages = Sprite.new(self.viewport) end
@mirage_count = 0
end
return if !@mirages
@mirage_count += 1
@mirage_count = 0 if @mirage_count == @mirage_data[2] * @mirages.size
for i in [email protected]
mirage_body(@mirages, @mirage_data[4]) if @mirage_count == 1 + i * @mirage_data[2]
end
end
#--------------------------------------------------------------------------
# ● 残像本体
#--------------------------------------------------------------------------
def mirage_body(body, opacity)
body.bitmap = self.bitmap.dup
body.x = self.x
body.y = self.y
body.ox = self.ox
body.oy = self.oy
body.z = self.z - 20
body.mirror = self.mirror
body.angle = self.angle
body.opacity = opacity * self.opacity / 255
body.zoom_x = self.zoom_x
body.zoom_y = self.zoom_y
body.src_rect.set(@battler.sv.sx, @battler.sv.sy, @battler.sv.cw, @battler.sv.ch)
body.color.set(@color_data[0], @color_data[1], @color_data[2], @color_data[3]) if @color_data != nil
end
#--------------------------------------------------------------------------
# ● 次の动画を更新
#--------------------------------------------------------------------------
def update_next_anime
return if !@next_anime
for anime in @next_anime
anime.update
anime.set_position(self.z, self.zoom_x, self.zoom_y, @real_x, @real_y) if @horming
anime.dispose if !anime.animation?
@next_anime.delete(anime) if !anime.animation?
end
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias update_sprite_battler_n03 update
def update
@battler.sv.update if @battler
update_sprite_battler_n03
update_next_anime
update_shadow if @battler && @shadow
update_mirage if @battler
update_balloon if @battler
update_remove if @battler && @removing && @battler.sv.change_up
end
#--------------------------------------------------------------------------
# ● 战斗动画消去
#--------------------------------------------------------------------------
def anime_off
@battler.sv.anime_off = false
dispose_animation
for anime in @next_anime do anime.dispose_animation end if @next_anime
end
#--------------------------------------------------------------------------
# ● バトラー入れ替え
#--------------------------------------------------------------------------
def remove
@battler.sv.start_action(@battler.sv.remove_action)
$sv_camera.wait = 40
@battler.sv.add_action("eval('set_change')")
@removing = true
end
#--------------------------------------------------------------------------
# ● バトラー入れ替えの更新
#--------------------------------------------------------------------------
def update_remove
@battler.sv.change_up = false
@removing = false
@battler = nil
end
#--------------------------------------------------------------------------
# ● バトラー加入
#--------------------------------------------------------------------------
def join(join_battler)
$sv_camera.wait = 30
@battler = join_battler
@battler_name = @battler.character_name
@battler_index = @battler.character_index
@battler_graphic_file_index = @battler.sv.graphic_file_index
self.bitmap = Cache.character(@battler_name)
@battler.sv.setup(self.bitmap.width, self.bitmap.height, true)
create_shadow
init_visibility
end
#--------------------------------------------------------------------------
# ● 通常の設定に戻す ★再定義
#--------------------------------------------------------------------------
def revert_to_normal
self.blend_type = 0
self.opacity = 255
end
#--------------------------------------------------------------------------
# ● 崩壊エフェクトの更新
#--------------------------------------------------------------------------
alias update_collapse_sprite_battler_n03 update_collapse
def update_collapse
return if @battler.sv.state(1) != "敌人崩溃"
update_collapse_sprite_battler_n03
@battler.sv.weapon_visible = false
end
#--------------------------------------------------------------------------
# ● ボス崩壊エフェクトの更新 ★再定義
#--------------------------------------------------------------------------
def update_boss_collapse
@effect_duration = @battler.sv.ch if @effect_duration >= @battler.sv.ch
alpha = @effect_duration * 120 / @battler.sv.ch
self.ox = @battler.sv.cw / 2 + @effect_duration % 2 * 4 - 2
self.blend_type = 1
self.color.set(255, 255, 255, 255 - alpha)
self.opacity = alpha
self.src_rect.y -= 1
Sound.play_boss_collapse2 if @effect_duration % 20 == 19
end
#--------------------------------------------------------------------------
# ● 別スプライトからのタイミング处理
#--------------------------------------------------------------------------
def set_process_timing(timing_data)
for data in timing_data
set_timing(data[0],data[1])
end
@battler.sv.timing = []
end
#--------------------------------------------------------------------------
# ● タイミング处理
#--------------------------------------------------------------------------
def set_timing(se_flag, data)
@ani_rate = 4
data.se.play if se_flag
case data.flash_scope
when 1 ;self.flash(data.flash_color, data.flash_duration * @ani_rate)
when 2 ;viewport.flash(data.flash_color, data.flash_duration * @ani_rate) if viewport
when 3 ;self.flash(nil, data.flash_duration * @ani_rate)
end
end
#--------------------------------------------------------------------------
# ● 色调变更
#--------------------------------------------------------------------------
def color_set
set = @battler.sv.color_set
@battler.sv.color_set= []
set[4] = 1 if set[4] == 0
@remain_color_data = [0,0,0,0] if @remain_color_data == nil
@color_data = @remain_color_data
@color_data[4] = set[4]
@color_data[5] = set[5]
@color_data[6] = set
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
alias dispose_sprite_battler_n03 dispose
def dispose
dispose_sprite_battler_n03
@shadow.dispose if @shadow != nil
@balloon.dispose if @balloon != nil
for mirage in @mirages do mirage.dispose end if @mirages != nil
for anime in @next_anime do anime.dispose end if @next_anime
end
end
#==============================================================================
# ■ Spriteset_Battle
#------------------------------------------------------------------------------
# バトル画面のスプライトをまとめたクラスです。
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# ● 戦闘背景(床)スプライトの作成 ★再定義
#--------------------------------------------------------------------------
def create_battleback1
@back1_sprite = Sprite_Battle_Back.new(@viewport1, 1, battleback1_name)
@back1_sprite.set_graphics(battleback1_bitmap) if battleback1_name != nil
@back1_sprite.z = 0
end
#--------------------------------------------------------------------------
# ● 戦闘背景(壁)スプライトの作成 ★再定義
#--------------------------------------------------------------------------
def create_battleback2
@back2_sprite = Sprite_Battle_Back.new(@viewport1, 2, battleback2_name)
@back2_sprite.set_graphics(battleback2_bitmap) if battleback2_name != nil
@back2_sprite.z = 1
end
#--------------------------------------------------------------------------
# ● アクタースプライトの作成 ★再定義
#--------------------------------------------------------------------------
def create_actors
@actor_sprites = []
for i in 0...$game_party.max_battle_members
@actor_sprites = Sprite_Battler.new(@viewport1, $game_party.members)
end
@effect_sprites = Spriteset_Sideview.new(@viewport1)
end
#--------------------------------------------------------------------------
# ● アクタースプライトの更新 ★再定義
#--------------------------------------------------------------------------
def update_actors
@actor_sprites.each_with_index do |sprite, i|
sprite_join($game_party.members, sprite) if sprite.battler == nil && sprite.battler != $game_party.members
sprite.remove if sprite.battler != nil && !sprite.removing && sprite.battler != $game_party.members
sprite.update
end
@effect_sprites.update
update_program
end
#--------------------------------------------------------------------------
# ● メンバーを加える
#--------------------------------------------------------------------------
def sprite_join(member, sprite)
for sp in @actor_sprites
sp.update_remove if member == sp.battler && !sp.battler.sv.change_up
end
sprite.join(member)
end
#--------------------------------------------------------------------------
# ● バトルプログラムの更新
#--------------------------------------------------------------------------
def update_program
return if $sv_camera.program_scroll == []
for data in $sv_camera.program_scroll
@back1_sprite.start_back_data(data) if data[2] == 1
@back2_sprite.start_back_data(data) if data[2] == 2
end
$sv_camera.program_scroll = []
end
#--------------------------------------------------------------------------
# ● ヒット時の战斗动画运行
#--------------------------------------------------------------------------
def set_hit_animation(battler, weapon_index, hit_targets, miss)
@effect_sprites.set_hit_animation(battler, weapon_index, hit_targets, miss)
end
#--------------------------------------------------------------------------
# ● ダメージPOP
#--------------------------------------------------------------------------
def set_damage_pop(target)
@effect_sprites.set_damage_pop(target)
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
alias dispose_spriteset_battle_n03 dispose
def dispose
dispose_spriteset_battle_n03
@effect_sprites.dispose
end
end
#==============================================================================
# ■ Window_BattleLog
#------------------------------------------------------------------------------
# 戦闘の進行を运況表示するウィンドウです。
#==============================================================================
class Window_BattleLog < Window_Selectable
#--------------------------------------------------------------------------
# ● ウェイト ★再定義
#--------------------------------------------------------------------------
def wait
end
#--------------------------------------------------------------------------
# ● ウェイトとクリア ★再定義
#--------------------------------------------------------------------------
def wait_and_clear
$sv_camera.wait = 10
end
#--------------------------------------------------------------------------
# ● 行动結果の表示 ★再定義
#--------------------------------------------------------------------------
def display_action_results(target, item)
if target.result.used
last_line_number = line_number
display_critical(target, item)
display_damage(target, item)
display_affected_status(target, item)
display_failure(target, item)
end
off if !N03::BATTLE_LOG
end
#--------------------------------------------------------------------------
# ● ウインドウ非表示
#--------------------------------------------------------------------------
def off
@back_sprite.visible = self.visible = false
end
end
#==============================================================================
# ■ Game_Interpreter
#------------------------------------------------------------------------------
# イベントコマンドを运行するインタプリタです。
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# ● スイッチの操作
#--------------------------------------------------------------------------
alias command_121_game_interpreter_n03 command_121
def command_121
command_121_game_interpreter_n03
$sv_camera.program_check
end
end