赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 0 |
最后登录 | 2013-11-27 |
在线时间 | 33 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 1024
- 在线时间
- 33 小时
- 注册时间
- 2012-11-14
- 帖子
- 2
|
不知道发生什么错误了,我打了显示技能详细和新游戏系统2.0的战斗界面之后出现上图。不知道是不是哪里冲突了。我发两个代码下来
这个事显示技能详细的代码
#==============================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
# 特技及物品的说明、角色的状态显示的窗口。
#==============================================================================
class Window_SkillHelp < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(320-50, 0, 320+50,416)
self.contents = Bitmap.new(width - 32, height - 32)
if $game_temp.in_battle
self.height = 256+64
self.back_opacity = 160
end
end
#--------------------------------------------------------------------------
# ● 设置文本
# text : 窗口显示的字符串
# align : 对齐方式 (0..左对齐、1..中间对齐、2..右对齐)
#--------------------------------------------------------------------------
def set_text(skill)
if skill !=nil
fontsize=18 #定义文字大小
infx=140 #定义说明文字左边内容的宽度
y=20 #定义行距
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.size = fontsize
xx=0
yy=0
s=[]
s=skill.description.scan(/./)
space = self.contents.text_size(" ").width
#一行显示21个字
for i in s
sss = self.contents.text_size(i)
if (xx+sss.width)>(width - 32)#超过屏幕就换行
yy+=y
xx=4
end
self.contents.draw_text(xx, yy, sss.width, sss.height, i)
xx+=sss.width
end
self.contents.font.size = fontsize
xx=0
yy+=y
self.contents.font.color=system_color
self.contents.draw_text(xx, yy, infx, sss.height, "效果范围")
xx=infx
self.contents.font.color=normal_color
case skill.scope
when 0
i="无"
when 1
i="敌方单体"
when 2
i="敌方全体"
when 3
i="我方单体"
when 4
i="我方全体"
when 5
i="我方濒死单体"
when 6
i="我方濒死全体"
when 7
i="自身"
end
self.contents.draw_text(xx, yy, infx, sss.height, i)
xx=0
yy+=y
self.contents.font.color=system_color
self.contents.draw_text(xx, yy, infx, sss.height, "基础威力")
xx=infx
self.contents.font.color=normal_color
self.contents.draw_text(xx, yy, infx*2, sss.height, skill.power.to_s)
xx=0
yy+=y
self.contents.font.color=system_color
self.contents.draw_text(xx, yy, infx, sss.height, "攻击比率")
xx=infx
self.contents.font.color=normal_color
self.contents.draw_text(xx, yy, infx*2, sss.height, "攻击 "+skill.atk_f.to_s+" 魔力 "+skill.int_f.to_s)
xx=0
yy+=y
self.contents.font.color=system_color
self.contents.draw_text(xx, yy, infx, sss.height, "受能力影响度")
xx=infx
self.contents.font.color=normal_color
self.contents.draw_text(xx, yy, infx*2, sss.height, "力量 "+skill.str_f.to_s+" 灵巧 "+skill.dex_f.to_s+" 速度 "+skill.agi_f.to_s)
xx=0
yy+=y
self.contents.font.color=system_color
self.contents.draw_text(xx, yy, infx, sss.height, "对象防御影响比率")
xx=infx
self.contents.font.color=normal_color
self.contents.draw_text(xx, yy, infx*2, sss.height, "物理 "+skill.pdef_f.to_s+" 魔法 "+skill.mdef_f.to_s)
xx=0
yy+=y
self.contents.font.color=system_color
self.contents.draw_text(xx, yy, infx, sss.height, "威力波动度")
xx=infx
self.contents.font.color=normal_color
self.contents.draw_text(xx, yy, infx*2, sss.height, skill.variance.to_s)
xx=0
yy+=y
self.contents.font.color=system_color
self.contents.draw_text(xx, yy, infx, sss.height, "基础命中/回避修正")
xx=infx
self.contents.font.color=normal_color
self.contents.draw_text(xx, yy, infx*2, sss.height, skill.hit.to_s+"/"+skill.eva_f.to_s)
xx=0
yy+=y
element=""
race=""
for i in skill.element_set
if i <=8
element =element+" "+$data_system.elements
elsif i>8 and i<=18
race=race+" "+$data_system.elements
end
if i>18
break
end
end
self.contents.font.color=system_color
self.contents.draw_text(xx, yy, infx, sss.height, "特效对象种族")
xx=infx-space
self.contents.font.color=normal_color
s=[]
s=race.scan(/./)
#一行显示21个字
for i in s
sss = self.contents.text_size(i)
if (xx+sss.width)>(width - 32)#超过屏幕就换行
yy+=y
xx=infx
end
self.contents.draw_text(xx, yy, sss.width, sss.height, i)
xx+=sss.width
end
yy+=y
xx=0
self.contents.font.color=system_color
self.contents.draw_text(xx, yy, infx, sss.height, "攻击属性")
xx=infx-space
self.contents.font.color=normal_color
s=[]
s=element.scan(/./)
#一行显示21个字
for i in s
sss = self.contents.text_size(i)
if (xx+sss.width)>(width - 32)#超过屏幕就换行
yy+=y
xx=infx
end
self.contents.draw_text(xx, yy, sss.width, sss.height, i)
xx+=sss.width
end
xx=0
yy+=y
race=""
for i in skill.plus_state_set
race=race+"["+$data_states.name+"]"
end
self.contents.font.color=system_color
self.contents.draw_text(xx, yy, infx, sss.height, "附加状态")
xx=infx
self.contents.font.color=normal_color
s=[]
s=race.scan(/./)
#一行显示21个字
for i in s
sss = self.contents.text_size(i)
if (xx+sss.width)>(width - 32)#超过屏幕就换行
yy+=y
xx=infx
end
self.contents.draw_text(xx, yy, sss.width, sss.height, i)
xx+=sss.width
end
xx=0
yy+=y
race=""
for i in skill.minus_state_set
race=race+"["+$data_states.name+"]"
end
self.contents.font.color=system_color
self.contents.draw_text(xx, yy, infx, sss.height, "解除状态")
xx=infx
self.contents.font.color=normal_color
s=[]
s=race.scan(/./)
#一行显示21个字
for i in s
sss = self.contents.text_size(i)
if (xx+sss.width)>(width - 32)#超过屏幕就换行
yy+=y
xx=infx
end
self.contents.draw_text(xx, yy, sss.width, sss.height, i)
xx+=sss.width
end
@actor = nil
end
self.visible = true
end
end
这个是战斗系统的代码:
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# 处理角色的类。本类在 Game_Actors 类 ($game_actors)
# 的内部使用、Game_Party 类请参考 ($game_party) 。
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 取得战斗画面的 X 坐标
#--------------------------------------------------------------------------
def screen_x
case self.index
when 0
return 500
when 1
return 450
when 2
return 500
when 3
return 450
else
return 600
end
end
#--------------------------------------------------------------------------
# ● 取得战斗画面的 Y 坐标
#--------------------------------------------------------------------------
def screen_y
case self.index
when 0
return 360
when 1
return 300
when 2
return 240
when 3
return 180
else
return 1000
end
end
#--------------------------------------------------------------------------
# ● 取得战斗画面的 Z 坐标
#--------------------------------------------------------------------------
def screen_z
case self.index
when 0
return 10
when 1
return 9
when 2
return 8
when 3
return 7
else
return 0
end
end
end
#==============================================================================
# ■ Window_BattleStatus
#------------------------------------------------------------------------------
# 显示战斗画面同伴状态的窗口。
#==============================================================================
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(0, 320, 640, 160)
self.opacity = 0
self.contents = Bitmap.new(width - 32, height - 32)
@level_up_flags = [false, false, false, false]
refresh
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
super
end
#--------------------------------------------------------------------------
# ● 设置升级标志
# actor_index : 角色索引
#--------------------------------------------------------------------------
def level_up(actor_index)
@level_up_flags[actor_index] = true
end
def draw_actor_face(actor,x,y)
bitmap = RPG::Cache.battler(actor.name + "_C" , actor.battler_hue)
self.contents.blt(x,y,bitmap,Rect.new(0,0,bitmap.width,bitmap.height ))
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
actor = $game_party.actors
actor_x = i * 160 + 4
self.contents.font.size = 20
draw_actor_face(actor,actor_x,0)
draw_actor_name(actor, actor_x, 0)
draw_actor_hp(actor, actor_x, 64, 120)
draw_actor_sp(actor, actor_x, 80, 120)
if @level_up_flags
self.contents.font.color = normal_color
self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
else
self.contents.font.size = 16
draw_actor_state(actor, actor_x, 96)
end
end
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
# 主界面的不透明度下降
if $game_temp.battle_main_phase
self.contents_opacity -= 4 if self.contents_opacity > 191
else
self.contents_opacity += 4 if self.contents_opacity < 255
end
end
end
#==============================================================================
# ■ Window_BattleResult
#------------------------------------------------------------------------------
# 战斗结束时、显示获得的 EXP 及金钱的窗口。
#==============================================================================
class Window_BattleResult < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# exp : EXP
# gold : 金钱
# treasures : 宝物
#--------------------------------------------------------------------------
def initialize(exp, gold, treasures)
@exp = exp
@gold = gold
@treasures = treasures
super(160, 0, 320, @treasures.size * 32 + 64)
self.z = 999
self.contents = Bitmap.new(width - 32, height - 32)
self.y = 160 - height / 2
self.back_opacity = 160
self.visible = false
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
x = 4
self.contents.font.color = normal_color
cx = contents.text_size(@exp.to_s).width
self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
x += cx + 4
self.contents.font.color = system_color
cx = contents.text_size("EXP").width
self.contents.draw_text(x, 0, 64, 32, "EXP")
x += cx + 16
self.contents.font.color = normal_color
cx = contents.text_size(@gold.to_s).width
self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
x += cx + 4
self.contents.font.color = system_color
self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
y = 32
for item in @treasures
draw_item_name(item, 4, y)
y += 32
end
end
end
#==============================================================================
# ■ Spriteset_Battle
#------------------------------------------------------------------------------
# 处理战斗画面的活动块的类。本类在 Scene_Battle 类
# 的内部使用。
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :viewport1 # 敌人方的显示端口
attr_reader :viewport2 # 角色方的显示端口
#--------------------------------------------------------------------------
# ● 初始化变量
#--------------------------------------------------------------------------
def initialize
# 生成显示端口
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport4 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 101
@viewport3.z = 200
@viewport4.z = 5000
# 生成战斗背景活动块
@battleback_sprite = Sprite.new(@viewport1)
# 生成敌人活动块
@enemy_sprites = []
for enemy in $game_troop.enemies.reverse
@enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
end
# 生成敌人活动块
@actor_sprites = []
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
# 生成天候
@weather = RPG::Weather.new(@viewport1)
# 生成图片活动块
@picture_sprites = []
for i in 51..100
@picture_sprites.push(Sprite_Picture.new(@viewport3,
$game_screen.pictures))
end
# 生成计时器块
@timer_sprite = Sprite_Timer.new
# 刷新画面
update
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
# 如果战斗背景位图存在的情况下就释放
if @battleback_sprite.bitmap != nil
@battleback_sprite.bitmap.dispose
end
# 释放战斗背景活动块
@battleback_sprite.dispose
# 释放敌人活动块、角色活动块
for sprite in @enemy_sprites + @actor_sprites
sprite.dispose
end
# 释放天候
@weather.dispose
# 释放图片活动块
for sprite in @picture_sprites
sprite.dispose
end
# 释放计时器活动块
@timer_sprite.dispose
# 释放显示端口
@viewport1.dispose
@viewport2.dispose
@viewport3.dispose
@viewport4.dispose
end
#--------------------------------------------------------------------------
# ● 显示效果中判定
#--------------------------------------------------------------------------
def effect?
# 如果是在显示效果中的话就返回 true
for sprite in @enemy_sprites + @actor_sprites
return true if sprite.effect?
end
return false
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 刷新角色的活动块 (对应角色的替换)
@actor_sprites[0].battler = $game_party.actors[0]
@actor_sprites[1].battler = $game_party.actors[1]
@actor_sprites[2].battler = $game_party.actors[2]
@actor_sprites[3].battler = $game_party.actors[3]
# 战斗背景的文件名与现在情况有差异的情况下
if @battleback_name != $game_temp.battleback_name
@battleback_name = $game_temp.battleback_name
if @battleback_sprite.bitmap != nil
@battleback_sprite.bitmap.dispose
end
@battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
@battleback_sprite.src_rect.set(0, 0, 640, 480)
end
# 刷新战斗者的活动块
for sprite in @enemy_sprites + @actor_sprites
sprite.update
end
# 刷新天气图形
@weather.type = $game_screen.weather_type
@weather.max = $game_screen.weather_max
@weather.update
# 刷新图片活动块
for sprite in @picture_sprites
sprite.update
end
# 刷新计时器活动块
@timer_sprite.update
# 设置画面的色调与震动位置
@viewport1.tone = $game_screen.tone
@viewport1.ox = $game_screen.shake
# 设置画面的闪烁色
@viewport4.color = $game_screen.flash_color
# 刷新显示端口
@viewport1.update
@viewport2.update
@viewport4.update
end
end
#==============================================================================
# ■ Scene_Battle (分割定义 1)
#------------------------------------------------------------------------------
# 处理战斗画面的类。
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
# 初始化战斗用的各种暂时数据
$game_temp.in_battle = true
$game_temp.battle_turn = 0
$game_temp.battle_event_flags.clear
$game_temp.battle_abort = false
$game_temp.battle_main_phase = false
$game_temp.battleback_name = $game_map.battleback_name
$game_temp.forcing_battler = nil
# 初始化战斗用事件解释器
$game_system.battle_interpreter.setup(nil, 0)
# 准备队伍
@troop_id = $game_temp.battle_troop_id
$game_troop.setup(@troop_id)
# 生成角色命令窗口
s1 = $data_system.words.attack
s2 = $data_system.words.skill
s3 = $data_system.words.guard
s4 = $data_system.words.item
s5 = "逃跑"
@actor_command_window = Window_Command.new(160, [s1, s2, s3, s4, s5])
# 不能逃跑的情况下
if $game_temp.battle_can_escape == false
@actor_command_window.disable_item(4)
end
@actor_command_window.y = 160
@actor_command_window.back_opacity = 160
@actor_command_window.active = false
@actor_command_window.visible = false
# 生成其它窗口
@party_command_window = Window_PartyCommand.new
@help_window = Window_Help.new
@help_window.back_opacity = 160
@help_window.visible = false
@status_window = Window_BattleStatus.new
@message_window = Window_Message.new
# 生成活动块
@spriteset = Spriteset_Battle.new
# 初始化等待计数
@wait_count = 0
# 执行过渡
if $data_system.battle_transition == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$data_system.battle_transition)
end
# 开始自由战斗回合
start_phase1
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面切换的话就中断循环
if $scene != self
break
end
end
# 刷新地图
$game_map.refresh
# 准备过渡
Graphics.freeze
# 释放窗口
@actor_command_window.dispose
@party_command_window.dispose
@help_window.dispose
@status_window.dispose
@message_window.dispose
if @skill_window != nil
@skill_window.dispose
end
if @item_window != nil
@item_window.dispose
end
if @result_window != nil
@result_window.dispose
end
# 释放活动块
@spriteset.dispose
# 标题画面切换中的情况
if $scene.is_a?(Scene_Title)
# 淡入淡出画面
Graphics.transition
Graphics.freeze
end
# 战斗测试或者游戏结束以外的画面切换中的情况
if $BTEST and not $scene.is_a?(Scene_Gameover)
$scene = nil
end
end
#--------------------------------------------------------------------------
# ● 胜负判定
#--------------------------------------------------------------------------
def judge
# 全灭判定是真、并且同伴人数为 0 的情况下
if $game_party.all_dead? or $game_party.actors.size == 0
# 允许失败的情况下
if $game_temp.battle_can_lose
# 还原为战斗开始前的 BGM
$game_system.bgm_play($game_temp.map_bgm)
# 战斗结束
battle_end(2)
# 返回 true
return true
end
# 设置游戏结束标志
$game_temp.gameover = true
# 返回 true
return true
end
# 如果存在任意 1 个敌人就返回 false
for enemy in $game_troop.enemies
if enemy.exist?
return false
end
end
# 开始结束战斗回合 (胜利)
start_phase5
# 返回 true
return true
end
#--------------------------------------------------------------------------
# ● 战斗结束
# result : 結果 (0:胜利 1:失败 2:逃跑)
#--------------------------------------------------------------------------
def battle_end(result)
# 清除战斗中标志
$game_temp.in_battle = false
# 清除全体同伴的行动
$game_party.clear_actions
# 解除战斗用状态
for actor in $game_party.actors
actor.remove_states_battle
end
# 清除敌人
$game_troop.enemies.clear
# 调用战斗返回调用
if $game_temp.battle_proc != nil
$game_temp.battle_proc.call(result)
$game_temp.battle_proc = nil
end
# 切换到地图画面
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# ● 设置战斗事件
#--------------------------------------------------------------------------
def setup_battle_event
# 正在执行战斗事件的情况下
if $game_system.battle_interpreter.running?
return
end
# 搜索全部页的战斗事件
for index in 0...$data_troops[@troop_id].pages.size
# 获取事件页
page = $data_troops[@troop_id].pages[index]
# 事件条件可以参考 c
c = page.condition
# 没有指定任何条件的情况下转到下一页
unless c.turn_valid or c.enemy_valid or
c.actor_valid or c.switch_valid
next
end
# 执行完毕的情况下转到下一页
if $game_temp.battle_event_flags[index]
next
end
# 确认回合条件
if c.turn_valid
n = $game_temp.battle_turn
a = c.turn_a
b = c.turn_b
if (b == 0 and n != a) or
(b > 0 and (n < 1 or n < a or n % b != a % b))
next
end
end
# 确认敌人条件
if c.enemy_valid
enemy = $game_troop.enemies[c.enemy_index]
if enemy == nil or enemy.hp * 100.0 / enemy.maxhp > c.enemy_hp
next
end
end
# 确认角色条件
if c.actor_valid
actor = $game_actors[c.actor_id]
if actor == nil or actor.hp * 100.0 / actor.maxhp > c.actor_hp
next
end
end
# 确认开关条件
if c.switch_valid
if $game_switches[c.switch_id] == false
next
end
end
# 设置事件
$game_system.battle_interpreter.setup(page.list, 0)
# 本页的范围是 [战斗] 或 [回合] 的情况下
if page.span <= 1
# 设置执行结束标志
$game_temp.battle_event_flags[index] = true
end
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 执行战斗事件中的情况下
if $game_system.battle_interpreter.running?
# 刷新解释器
$game_system.battle_interpreter.update
# 强制行动的战斗者不存在的情况下
if $game_temp.forcing_battler == nil
# 执行战斗事件结束的情况下
unless $game_system.battle_interpreter.running?
# 继续战斗的情况下、再执行战斗事件的设置
unless judge
setup_battle_event
end
end
# 如果不是结束战斗回合的情况下
if @phase != 5
# 刷新状态窗口
@status_window.refresh
end
end
end
# 系统 (计时器)、刷新画面
$game_system.update
$game_screen.update
# 计时器为 0 的情况下
if $game_system.timer_working and $game_system.timer == 0
# 中断战斗
$game_temp.battle_abort = true
end
# 刷新窗口
@help_window.update
@party_command_window.update
@actor_command_window.update
@status_window.update
@message_window.update
# 刷新活动块
@spriteset.update
# 处理过渡中的情况下
if $game_temp.transition_processing
# 清除处理过渡中标志
$game_temp.transition_processing = false
# 执行过渡
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# 显示信息窗口中的情况下
if $game_temp.message_window_showing
return
end
# 显示效果中的情况下
if @spriteset.effect?
return
end
# 游戏结束的情况下
if $game_temp.gameover
# 切换到游戏结束画面
$scene = Scene_Gameover.new
return
end
# 返回标题画面的情况下
if $game_temp.to_title
# 切换到标题画面
$scene = Scene_Title.new
return
end
# 中断战斗的情况下
if $game_temp.battle_abort
# 还原为战斗前的 BGM
$game_system.bgm_play($game_temp.map_bgm)
# 战斗结束
battle_end(1)
return
end
# 等待中的情况下
if @wait_count > 0
# 减少等待计数
@wait_count -= 1
return
end
# 强制行动的角色存在、
# 并且战斗事件正在执行的情况下
if $game_temp.forcing_battler == nil and
$game_system.battle_interpreter.running?
return
end
# 回合分支
case @phase
when 1 # 自由战斗回合
update_phase1
when 2 # 同伴命令回合
update_phase2
when 3 # 角色命令回合
update_phase3
when 4 # 主回合
update_phase4
when 5 # 战斗结束回合
update_phase5
end
end
end
#==============================================================================
# ■ Scene_Battle (分割定义 2)
#------------------------------------------------------------------------------
# 处理战斗画面的类。
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● 开始自由战斗回合
#--------------------------------------------------------------------------
def start_phase1
# 转移到回合 1
@phase = 1
# 清除全体同伴的行动
$game_party.clear_actions
# 设置战斗事件
setup_battle_event
end
#--------------------------------------------------------------------------
# ● 刷新画面 (自由战斗回合)
#--------------------------------------------------------------------------
def update_phase1
# 胜败判定
if judge
# 胜利或者失败的情况下 : 过程结束
return
end
# 开始同伴命令回合
start_phase2
end
#--------------------------------------------------------------------------
# ● 开始同伴命令回合
#--------------------------------------------------------------------------
def start_phase2
# 转移到回合 2
@phase = 2
# 设置角色为非选择状态
@actor_index = -1
@active_battler = nil
# 有效化同伴指令窗口
#@party_command_window.active = true
#@party_command_window.visible = true
# 无效化角色指令窗口
@actor_command_window.active = false
@actor_command_window.visible = false
# 清除主回合标志
$game_temp.battle_main_phase = false
# 清除全体同伴的行动
$game_party.clear_actions
# 不能输入命令的情况下
unless $game_party.inputable?
# 开始主回合
start_phase4
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (同伴命令回合)
#--------------------------------------------------------------------------
def update_phase2
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 开始角色的命令回合
start_phase3
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 同伴指令窗口光标位置分支
case @party_command_window.index
when 0 # 战斗
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 开始角色的命令回合
start_phase3
when 1 # 逃跑
# 不能逃跑的情况下
if $game_temp.battle_can_escape == false
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 逃走处理
update_phase2_escape
end
return
end
end
#--------------------------------------------------------------------------
# ● 画面更新 (同伴指令回合 : 逃跑)
#--------------------------------------------------------------------------
def update_phase2_escape
# 计算敌人速度的平均值
enemies_agi = 0
enemies_number = 0
for enemy in $game_troop.enemies
if enemy.exist?
enemies_agi += enemy.agi
enemies_number += 1
end
end
if enemies_number > 0
enemies_agi /= enemies_number
end
# 计算角色速度的平均值
actors_agi = 0
actors_number = 0
for actor in $game_party.actors
if actor.exist?
actors_agi += actor.agi
actors_number += 1
end
end
if actors_number > 0
actors_agi /= actors_number
end
# 逃跑成功判定
success = rand(100) < 50 * actors_agi / enemies_agi
# 成功逃跑的情况下
if success
# 演奏逃跑 SE
$game_system.se_play($data_system.escape_se)
# 还原为战斗开始前的 BGM
$game_system.bgm_play($game_temp.map_bgm)
# 战斗结束
battle_end(1)
# 逃跑失败的情况下
else
# 清除全体同伴的行动
$game_party.clear_actions
# 开始主回合
start_phase4
end
end
#--------------------------------------------------------------------------
# ● 开始结束战斗回合
#--------------------------------------------------------------------------
def start_phase5
# 转移到回合 5
@phase = 5
# 演奏战斗结束 ME
$game_system.me_play($game_system.battle_end_me)
# 还原为战斗开始前的 BGM
$game_system.bgm_play($game_temp.map_bgm)
# 初始化 EXP、金钱、宝物
exp = 0
gold = 0
treasures = []
# 循环
for enemy in $game_troop.enemies
# 敌人不是隐藏状态的情况下
unless enemy.hidden
# 获得 EXP、增加金钱
exp += enemy.exp
gold += enemy.gold
# 出现宝物判定
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
end
# 限制宝物数为 6 个
treasures = treasures[0..5]
# 获得 EXP
for i in 0...$game_party.actors.size
actor = $game_party.actors
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += exp
if actor.level > last_level
@status_window.level_up(i)
end
end
end
# 获得金钱
$game_party.gain_gold(gold)
# 获得宝物
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
# 生成战斗结果窗口
@result_window = Window_BattleResult.new(exp, gold, treasures)
# 设置等待计数
@phase5_wait_count = 100
end
#--------------------------------------------------------------------------
# ● 画面更新 (结束战斗回合)
#--------------------------------------------------------------------------
def update_phase5
# 等待计数大于 0 的情况下
if @phase5_wait_count > 0
# 减少等待计数
@phase5_wait_count -= 1
# 等待计数为 0 的情况下
if @phase5_wait_count == 0
# 显示结果窗口
@result_window.visible = true
# 清除主回合标志
$game_temp.battle_main_phase = false
# 刷新状态窗口
@status_window.refresh
end
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 战斗结束
battle_end(0)
end
end
end
#==============================================================================
# ■ Scene_Battle (分割定义 3)
#------------------------------------------------------------------------------
# 处理战斗画面的类。
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● 开始角色命令回合
#--------------------------------------------------------------------------
def start_phase3
# 转移到回合 3
@phase = 3
# 设置觉得为非选择状态
@actor_index = -1
@active_battler = nil
# 输入下一个角色的命令
phase3_next_actor
end
#--------------------------------------------------------------------------
# ● 转到输入下一个角色的命令
#--------------------------------------------------------------------------
def phase3_next_actor
# 循环
begin
# 角色的明灭效果 OFF
if @active_battler != nil
@active_battler.blink = false
end
# 最后的角色的情况
if @actor_index == $game_party.actors.size-1
# 开始主回合
start_phase4
return
end
# 推进角色索引
@actor_index += 1
@active_battler = $game_party.actors[@actor_index]
@active_battler.blink = true
# 如果角色是在无法接受指令的状态就再试
end until @active_battler.inputable?
# 设置角色的命令窗口
phase3_setup_command_window
end
#--------------------------------------------------------------------------
# ● 转向前一个角色的命令输入
#--------------------------------------------------------------------------
def phase3_prior_actor
# 循环
begin
# 角色的明灭效果 OFF
if @active_battler != nil
@active_battler.blink = false
end
# 最初的角色的情况下
if @actor_index == 0
# 开始同伴指令回合
start_phase2
return
end
# 返回角色索引
@actor_index -= 1
@active_battler = $game_party.actors[@actor_index]
@active_battler.blink = true
# 如果角色是在无法接受指令的状态就再试
end until @active_battler.inputable?
# 设置角色的命令窗口
phase3_setup_command_window
end
#--------------------------------------------------------------------------
# ● 设置角色指令窗口
#--------------------------------------------------------------------------
def phase3_setup_command_window
# 同伴指令窗口无效化
@party_command_window.active = false
@party_command_window.visible = false
# 角色指令窗口无效化
@actor_command_window.active = true
@actor_command_window.visible = true
# 设置角色指令窗口的位置
@actor_command_window.x = @actor_index * 160
# 设置索引为 0
@actor_command_window.index = 0
end
#--------------------------------------------------------------------------
# ● 刷新画面 (角色命令回合)
#--------------------------------------------------------------------------
def update_phase3
# 敌人光标有效的情况下
if @enemy_arrow != nil
update_phase3_enemy_select
# 角色光标有效的情况下
elsif @actor_arrow != nil
update_phase3_actor_select
# 特技窗口有效的情况下
elsif @skill_window != nil
update_phase3_skill_select
# 物品窗口有效的情况下
elsif @item_window != nil
update_phase3_item_select
# 角色指令窗口有效的情况下
elsif @actor_command_window.active
update_phase3_basic_command
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (角色命令回合 : 基本命令)
#--------------------------------------------------------------------------
def update_phase3_basic_command
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 转向前一个角色的指令输入
phase3_prior_actor
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 角色指令窗口光标位置分之
case @actor_command_window.index
when 0 # 攻击
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
# 开始选择敌人
start_enemy_select
when 1 # 特技
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.kind = 1
# 开始选择特技
start_skill_select
when 2 # 防御
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 1
# 转向下一位角色的指令输入
phase3_next_actor
when 3 # 物品
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.kind = 2
# 开始选择物品
start_item_select
when 4
escaping
end
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (角色命令回合 : 选择特技)
#--------------------------------------------------------------------------
def update_phase3_skill_select
# 设置特技窗口为可视状态
@skill_window.visible = true
# 刷新特技窗口
@skill_window.update
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 结束特技选择
end_skill_select
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 获取特技选择窗口现在选择的特技的数据
@skill = @skill_window.skill
# 无法使用的情况下
if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.skill_id = @skill.id
# 设置特技窗口为不可见状态
@skill_window.visible = false
# 效果范围是敌单体的情况下
if @skill.scope == 1
# 开始选择敌人
start_enemy_select
# 效果范围是我方单体的情况下
elsif @skill.scope == 3 or @skill.scope == 5
# 开始选择角色
start_actor_select
# 效果范围不是单体的情况下
else
# 选择特技结束
end_skill_select
# 转到下一位角色的指令输入
phase3_next_actor
end
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (角色命令回合 : 选择物品)
#--------------------------------------------------------------------------
def update_phase3_item_select
# 设置物品窗口为可视状态
@item_window.visible = true
# 刷新物品窗口
@item_window.update
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 选择物品结束
end_item_select
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 获取物品窗口现在选择的物品资料
@item = @item_window.item
# 无法使用的情况下
unless $game_party.item_can_use?(@item.id)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.item_id = @item.id
# 设置物品窗口为不可见状态
@item_window.visible = false
# 效果范围是敌单体的情况下
if @item.scope == 1
# 开始选择敌人
start_enemy_select
# 效果范围是我方单体的情况下
elsif @item.scope == 3 or @item.scope == 5
# 开始选择角色
start_actor_select
# 效果范围不是单体的情况下
else
# 物品选择结束
end_item_select
# 转到下一位角色的指令输入
phase3_next_actor
end
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面画面 (角色命令回合 : 选择敌人)
#--------------------------------------------------------------------------
def update_phase3_enemy_select
# 刷新敌人箭头
@enemy_arrow.update
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 选择敌人结束
end_enemy_select
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.target_index = @enemy_arrow.index
# 选择敌人结束
end_enemy_select
# 显示特技窗口中的情况下
if @skill_window != nil
# 结束特技选择
end_skill_select
end
# 显示物品窗口的情况下
if @item_window != nil
# 结束物品选择
end_item_select
end
# 转到下一位角色的指令输入
phase3_next_actor
end
end
#--------------------------------------------------------------------------
# ● 画面更新 (角色指令回合 : 选择角色)
#--------------------------------------------------------------------------
def update_phase3_actor_select
# 刷新角色箭头
@actor_arrow.update
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 选择角色结束
end_actor_select
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.target_index = @actor_arrow.index
# 选择角色结束
end_actor_select
# 显示特技窗口中的情况下
if @skill_window != nil
# 结束特技选择
end_skill_select
end
# 显示物品窗口的情况下
if @item_window != nil
# 结束物品选择
end_item_select
end
# 转到下一位角色的指令输入
phase3_next_actor
end
end
#--------------------------------------------------------------------------
# ● 开始选择敌人
#--------------------------------------------------------------------------
def start_enemy_select
# 生成敌人箭头
@enemy_arrow = Arrow_Enemy.new(@spriteset.viewport1)
# 关联帮助窗口
@enemy_arrow.help_window = @help_window
# 无效化角色指令窗口
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
# ● 结束选择敌人
#--------------------------------------------------------------------------
def end_enemy_select
# 释放敌人箭头
@enemy_arrow.dispose
@enemy_arrow = nil
# 指令为 [战斗] 的情况下
if @actor_command_window.index == 0
# 有效化角色指令窗口
@actor_command_window.active = true
@actor_command_window.visible = true
# 隐藏帮助窗口
@help_window.visible = false
end
end
#--------------------------------------------------------------------------
# ● 开始选择角色
#--------------------------------------------------------------------------
def start_actor_select
# 生成角色箭头
@actor_arrow = Arrow_Actor.new(@spriteset.viewport2)
@actor_arrow.index = @actor_index
# 关联帮助窗口
@actor_arrow.help_window = @help_window
# 无效化角色指令窗口
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
# ● 结束选择角色
#--------------------------------------------------------------------------
def end_actor_select
# 释放角色箭头
@actor_arrow.dispose
@actor_arrow = nil
end
#--------------------------------------------------------------------------
# ● 开始选择特技
#--------------------------------------------------------------------------
def start_skill_select
# 生成特技窗口
@skill_window = Window_Skill.new(@active_battler)
# 关联帮助窗口
@skill_window.help_window = @help_window
# 无效化角色指令窗口
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
# ● 选择特技结束
#--------------------------------------------------------------------------
def end_skill_select
# 释放特技窗口
@skill_window.dispose
@skill_window = nil
# 隐藏帮助窗口
@help_window.visible = false
# 有效化角色指令窗口
@actor_command_window.active = true
@actor_command_window.visible = true
end
#--------------------------------------------------------------------------
# ● 开始选择物品
#--------------------------------------------------------------------------
def start_item_select
# 生成物品窗口
@item_window = Window_Item.new
# 关联帮助窗口
@item_window.help_window = @help_window
# 无效化角色指令窗口
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
# ● 结束选择物品
#--------------------------------------------------------------------------
def end_item_select
# 释放物品窗口
@item_window.dispose
@item_window = nil
# 隐藏帮助窗口
@help_window.visible = false
# 有效化角色指令窗口
@actor_command_window.active = true
@actor_command_window.visible = true
end
def escaping
# 不能逃跑的情况下
if $game_temp.battle_can_escape == false
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 逃走处理
@actor_command_window.active = false
@actor_command_window.visible = false
update_phase2_escape
end
end
module Momo_IconCommand
# 图标名称设定
ATTACK_ICON_NAME = "攻击" # 攻撃
SKILL_ICON_NAME = "技能" # 特技
GUARD_ICON_NAME = "防御" # 防御
ITEM_ICON_NAME = "物品" # 物品
ESCAPE_ICON_NAME = "逃跑" # 逃跑
# X坐标修正
X_PLUS = 30#-120
# Y坐标修正
Y_PLUS = -60#10
# 选择时图标的动作
# 0:静止 1:放大
SELECT_TYPE = 0
# 闪烁时光芒的颜色
FLASH_COLOR = Color.new(255, 255, 255, 128)
# 闪烁时间
FLASH_DURATION = 10
# 闪烁间隔
FLASH_INTERVAL = 20
# 是否写出文字的名称
COM_NAME_DROW = true
# 文字名称是否移动
COM_NAME_MOVE = true
# 文字内容
ATTACK_NAME = "攻击" # 攻击
SKILL_NAME = "特技" # 特技
GUARD_NAME = "防御" # 防御
ITEM_NAME = "物品" # 物品
ESCAPE_NAME = "逃跑" # 逃跑
# 文字颜色
COM_NAME_COLOR = Color.new(255, 255, 255, 255)
# 文字坐标修正
COM_NAME_X_PLUS = 0
COM_NAME_Y_PLUS = 0
end
class Window_CommandIcon < Window_Selectable
attr_accessor :last_index
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(x, y, commands)
super(x, y, 32, 32)
# ウィンドウスキンに空文字列を指定してウィンドウを描画しないようにする
self.windowskin = RPG::Cache.windowskin("")
@item_max = commands.size
@commands = commands
@column_max = commands.size
@index = 0
@last_index = nil
@name_sprite = nil
@sprite = []
refresh
end
def dispose
super
for sprite in @sprite
sprite.dispose unless sprite.nil?
end
@name_sprite.dispose unless @name_sprite.nil?
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
@name_sprite.dispose unless @name_sprite.nil?
for sprite in @sprite
sprite.dispose unless sprite.nil?
end
@name_sprite = nil
draw_com_name if Momo_IconCommand::COM_NAME_DROW
@sprite = []
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(index)
@sprite[index] = Sprite_Icon.new(nil, @commands[index])
@sprite[index].z = self.z + 100##########################
end
def draw_com_name
@name_sprite = Sprite_Comm_Name.new(nil, get_com_name)
end
# 更新
def update
super
icon_update
com_name_update if Momo_IconCommand::COM_NAME_DROW
if move_index?
@last_index = self.index
end
end
# アイコンの更新
def icon_update
for i in [email protected]
@sprite.active = (self.index == i)
@sprite.x = self.x + i * 24
@sprite.y = self.y + 0
@sprite.z = (self.index == i) ? self.z + 2 : self.z + 1
@sprite.visible = self.visible
@sprite.update
end
end
# コマンドネームの更新
def com_name_update
if move_index?
@name_sprite.name = get_com_name
end
@name_sprite.x = self.x - 12 + Momo_IconCommand::COM_NAME_X_PLUS
@name_sprite.y = self.y - 40 + Momo_IconCommand::COM_NAME_Y_PLUS
@name_sprite.z = self.z + 1
@name_sprite.active = self.active
@name_sprite.visible = self.visible
@name_sprite.update
end
def get_com_name
make_name_set if @name_set.nil?
name = @name_set[self.index]
name = "" if name.nil?
return name
end
def make_name_set
@name_set = []
@name_set[0] = Momo_IconCommand::ATTACK_NAME
@name_set[1] = Momo_IconCommand::SKILL_NAME
@name_set[2] = Momo_IconCommand::GUARD_NAME
@name_set[3] = Momo_IconCommand::ITEM_NAME
@name_set[4] = Momo_IconCommand::ESCAPE_NAME
end
def move_index?
return self.index != @last_index
end
def need_reset
@name_sprite.need_reset = true if Momo_IconCommand::COM_NAME_DROW
end
end
# アイコン用スプライト
class Sprite_Icon < Sprite
attr_accessor :active
attr_accessor :icon_name
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(viewport, icon_name)
super(viewport)
@icon_name = icon_name
@last_icon = @icon_name
@count = 0
self.bitmap = RPG::Cache.icon(@icon_name)
self.ox = self.bitmap.width / 2
self.oy = self.bitmap.height / 2
@active = false
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
super
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
if @icon_name != @last_icon
@last_icon = @icon_name
self.bitmap = RPG::Cache.icon(@icon_name)
end
if @active
@count += 1
case Momo_IconCommand::SELECT_TYPE
when 0
icon_flash
when 1
icon_zoom
end
@count = 0 if @count == 20
else
icon_reset
end
end
def icon_flash
if @count % Momo_IconCommand::FLASH_INTERVAL == 0 or @count == 1
self.flash(Momo_IconCommand::FLASH_COLOR, Momo_IconCommand::FLASH_DURATION)
end
end
def icon_zoom
case @count
when 1..10
zoom = 1.0 + @count / 10.0
when 11..20
zoom = 2.0 - (@count - 10) / 10.0
end
self.zoom_x = zoom
self.zoom_y = zoom
end
def icon_reset
@count = 0
self.zoom_x = 1.0
self.zoom_y = 1.0
end
end
# コマンドネーム用スプライト
class Sprite_Comm_Name < Sprite
attr_accessor :active
attr_accessor :name
attr_accessor :need_reset
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(viewport, name)
super(viewport)
@name = name
@last_name = nil
@count = 0
@x_plus = 0
@opa_plus = 0
@need_reset = false
@active = false
self.bitmap = Bitmap.new(160, 32)
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
super
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
if @active
if need_reset?
@need_reset = false
@last_name = @name
text_reset
end
move_text if Momo_IconCommand::COM_NAME_MOVE
end
end
def move_text
@count += 1
@x_plus = [@count * 8, 80].min
self.x = self.x - 80 + @x_plus
self.opacity = @count * 25
end
def text_reset
@count = 0
@x_plus = 0
self.bitmap.clear
self.bitmap.font.color = Momo_IconCommand::COM_NAME_COLOR
if @name == Momo_IconCommand::ESCAPE_NAME and $game_temp.battle_can_escape == false
self.bitmap.font.color = Color.new(192, 192, 192, 255)
else
self.bitmap.font.color = Momo_IconCommand::COM_NAME_COLOR
end
self.bitmap.draw_text(0, 0, 160, 32, @name)
end
def need_reset?
return (@name != @last_name or @need_reset)
end
end
class Scene_Battle
#--------------------------------------------------------------------------
# ● プレバトルフェーズ開始
#--------------------------------------------------------------------------
alias scene_battle_icon_command_start_phase1 start_phase1
def start_phase1
com1 = Momo_IconCommand::ATTACK_ICON_NAME
com2 = Momo_IconCommand::SKILL_ICON_NAME
com3 = Momo_IconCommand::GUARD_ICON_NAME
com4 = Momo_IconCommand::ITEM_ICON_NAME
com5 = Momo_IconCommand::ESCAPE_ICON_NAME
@actor_command_window = Window_CommandIcon.new(0, 0, [com1, com2, com3, com4, com5])
@actor_command_window.y = 160
@actor_command_window.back_opacity = 160
@actor_command_window.active = false
@actor_command_window.visible = false
@actor_command_window.update
scene_battle_icon_command_start_phase1
end
#--------------------------------------------------------------------------
# ● アクターコマンドウィンドウのセットアップ
#--------------------------------------------------------------------------
alias scene_battle_icon_command_phase3_setup_command_window phase3_setup_command_window
def phase3_setup_command_window
scene_battle_icon_command_phase3_setup_command_window
# アクターコマンドウィンドウの位置を設定
@actor_command_window.x = command_window_actor_x(@actor_index)
@actor_command_window.y = command_window_actor_y(@actor_index)
@actor_command_window.need_reset
end
def command_window_actor_x(index)
#$game_party.actors[index].screen_x + Momo_IconCommand::X_PLUS
index * 160 + Momo_IconCommand::X_PLUS
end
def command_window_actor_y(index)
#$game_party.actors[index].screen_y + Momo_IconCommand::Y_PLUS
390 + Momo_IconCommand::Y_PLUS
end
end
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
$data_system_level_up_se = "" #升级时的音效设置
$data_system_level_up_me = "Audio/ME/007-Fanfare01" # 升级时播放的ME
$data_system_skilllearn_se = "Audio/SE/106-Heal02" # 学会特技时播放的声效。
#=============================================================
# ■ Window_LevelUpWindow
#-------------------------------------------------------------------
# バトル終了時、レベルアップした場合にステータスを表示するウィンドウです。
#=============================================================
class Window_LevelUpWindow < Window_Base
#---------------------------------------------------------
# ● オブジェクト初期化
#------------------------------------------------------
def initialize(actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)
super(0, 128, 160, 192)
self.z = 999
self.contents = Bitmap.new(width - 32, height - 32)
self.visible = false
self.back_opacity = 160
refresh(actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)
end
#-----------------------------------------------------------
# ● リフレッシュ
#---------------------------------------------------------
def refresh(actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)
self.contents.clear
self.contents.font.color = system_color
self.contents.font.size = 14
self.contents.draw_text( 0, 0, 160, 24, "等级上升")
self.contents.font.size = 18
self.contents.draw_text( 0, 28, 160, 24, $data_system.words.hp)
self.contents.draw_text( 0, 50, 160, 24, $data_system.words.sp)
self.contents.font.size = 14
self.contents.draw_text( 0, 72, 80, 24, $data_system.words.str)
self.contents.draw_text( 0, 94, 80, 24, $data_system.words.dex)
self.contents.draw_text( 0, 116, 80, 24, $data_system.words.agi)
self.contents.draw_text( 0, 138, 80, 24, $data_system.words.int)
self.contents.draw_text(92, 0, 128, 24, "→")
self.contents.draw_text(76, 28, 128, 24, "=")
self.contents.draw_text(76, 50, 128, 24, "=")
self.contents.draw_text(76, 72, 128, 24, "=")
self.contents.draw_text(76, 94, 128, 24, "=")
self.contents.draw_text(76, 116, 128, 24, "=")
self.contents.draw_text(76, 138, 128, 24, "=")
self.contents.font.color = normal_color
self.contents.draw_text( 0, 0, 88, 24, last_lv.to_s, 2)
self.contents.draw_text( 0, 28, 72, 24, "+" + up_hp.to_s, 2)
self.contents.draw_text( 0, 50, 72, 24, "+" + up_sp.to_s, 2)
self.contents.draw_text( 0, 72, 72, 24, "+" + up_str.to_s, 2)
self.contents.draw_text( 0, 94, 72, 24, "+" + up_dex.to_s, 2)
self.contents.draw_text( 0, 116, 72, 24, "+" + up_agi.to_s, 2)
self.contents.draw_text( 0, 138, 72, 24, "+" + up_int.to_s, 2)
self.contents.font.size = 20
self.contents.draw_text( 0, 0, 128, 24, actor.level.to_s, 2)
self.contents.draw_text( 0, 26, 128, 24, actor.maxhp.to_s, 2)
self.contents.draw_text( 0, 48, 128, 24, actor.maxsp.to_s, 2)
self.contents.draw_text( 0, 70, 128, 24, actor.str.to_s, 2)
self.contents.draw_text( 0, 92, 128, 24, actor.dex.to_s, 2)
self.contents.draw_text( 0, 114, 128, 24, actor.agi.to_s, 2)
self.contents.draw_text( 0, 136, 128, 24, actor.int.to_s, 2)
end
end
#===========================================================
# ■ Window_SkillLearning
#------------------------------------------------------------------------------
# レベルアップ時などにスキルを習得した場合にそれを表示するウィンドウです。
#=============================================================
class Window_SkillLearning < Window_Base
#-------------------------------------------------------------
# ● 公開インスタンス変数
#-----------------------------------------------------------
attr_reader :learned # スキルを習得したかどうか
#----------------------------------------------------------
# ● オブジェクト初期化
#----------------------------------------------------------
def initialize(class_id, last_lv, now_lv)
super(160, 64, 320, 64)
self.z = 999
self.contents = Bitmap.new(width - 32, height - 28) # わざと▽を表示
self.visible = false
self.back_opacity = 160
@learned = false
refresh(class_id, last_lv, now_lv)
end
#------------------------------------------------------------
# ● リフレッシュ
#-------------------------------------------------------
def refresh(class_id, last_lv, now_lv)
for i in 0...$data_classes[class_id].learnings.size
learn_lv = $data_classes[class_id].learnings.level
# 今回のレベルアップ範囲で習得するスキルの場合
if learn_lv > last_lv and learn_lv <= now_lv
@learned = true
# SEの再生
if $data_system_skilllearn_se != ""
Audio.se_play($data_system_skilllearn_se)
end
# 各描写
skill_name = $data_skills[$data_classes[class_id].learnings.skill_id].name
self.contents.clear
self.contents.font.color = text_color(0)
self.contents.draw_text(0,0,448,32, "学会特技:"+skill_name)
self.contents.font.color = text_color(6)
self.contents.draw_text(0,0,448,32, " "+skill_name)
self.contents.font.color = text_color(0)
self.visible = true
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if @learned == false
break
end
end
# メインループここまで
end
end
end
#-----------------------------------------------------------
# ● フレーム更新
#------------------------------------------------------------
def update
# C ボタンが押された場合
if Input.trigger?(Input::C)
@learned = false
self.visible = false
end
end
end
#==================================================================
# ■ Window_BattleStatus
#==================================================================
class Window_BattleStatus < Window_Base
#---------------------------------------------------------
# ● 追加?公開インスタンス変数
#-------------------------------------------------------
attr_accessor :level_up_flags # LEVEL UP!表示
end
#===============================================================
# ■ Game_Battler
#===============================================================
class Game_Battler
#--------------------------------------------------------------
# ● 追加?公開インスタンス変数
#----------------------------------------------------------
attr_accessor :exp_gain_ban # EXP取得一時禁止
#------------------------------------------------------
# ● オブジェクト初期化
#-----------------------------------------------------
alias xrxs_bp10_initialize initialize
def initialize
@exp_gain_ban = false
xrxs_bp10_initialize
end
#-------------------------------------------------------
# ● ステート [EXP を獲得できない] 判定
#-----------------------------------------------------
alias xrxs_bp10_cant_get_exp? cant_get_exp?
def cant_get_exp?
if @exp_gain_ban == true
return true
else
return xrxs_bp10_cant_get_exp?
end
end
end
#==============================================================
# ■ Scene_Battle
#==============================================================
class Scene_Battle
#--------------------------------------------------
# ● アフターバトルフェーズ開始
#--------------------------------------------------
alias xrxs_bp10_start_phase5 start_phase5
def start_phase5
# EXP 獲得禁止
for i in 0...$game_party.actors.size
$game_party.actors.exp_gain_ban = true
end
xrxs_bp10_start_phase5
# EXP 獲得禁止の解除
for i in 0...$game_party.actors.size
$game_party.actors.exp_gain_ban = false
end
# EXPを初期化
@exp_gained = 0
for enemy in $game_troop.enemies
# 獲得 EXPを追加 # エネミーが隠れ状態でない場合
@exp_gained += enemy.exp if not enemy.hidden
end
# 設定
@phase5_step = 1
@exp_gain_actor = -1
# リザルトウィンドウを表示
@result_window.visible = true
end
#----------------------------------------------------------
# ● フレーム更新 (アフターバトルフェーズ)
#--------------------------------------------------------
#alias xrxs_bp10_update_phase5 update_phase5
def update_phase5
case @phase5_step
when 1
update_phase5_step1
else
# ウェイトカウントが 0 より大きい場合
if @phase5_wait_count > 0
# ウェイトカウントを減らす
@phase5_wait_count -= 1
# ウェイトカウントが 0 になった場合
if @phase5_wait_count == 0
# リザルトウィンドウを表示
#@result_window.visible = true
# メインフェーズフラグをクリア
$game_temp.battle_main_phase = false
# ステータスウィンドウをリフレッシュ
@status_window.refresh
end
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# バトル終了
battle_end(0)
end
# レベルアップしている場合は強制バトル終了
battle_end(0) if @levelup_window != nil and @phase5_wait_count <= 0
end
end
#-----------------------------------------------------------
# ● フレーム更新 (アフターバトルフェーズ 1 : レベルアップ)
#-----------------------------------------------------------
def update_phase5_step1
# C ボタンが押された場合
if Input.trigger?(Input::C)
# ウィンドウを閉じて次のアクターへ
@levelup_window.visible = false if @levelup_window != nil
@status_window.level_up_flags[@exp_gain_actor] = false
phase5_next_levelup
end
end
#---------------------------------------------------------
# ● 次のアクターのレベルアップ表示へ
#---------------------------------------------------------
def phase5_next_levelup
begin
# 次のアクターへ
@exp_gain_actor += 1
# 最後のアクターの場合
if @exp_gain_actor >= $game_party.actors.size
# アフターバトルフェーズ開始
@phase5_step = 0
return
end
actor = $game_party.actors[@exp_gain_actor]
if actor.cant_get_exp? == false
# 現在の能力値を保持
last_level = actor.level
last_maxhp = actor.maxhp
last_maxsp = actor.maxsp
last_str = actor.str
last_dex = actor.dex
last_agi = actor.agi
last_int = actor.int
# 経験値取得の決定的瞬間(謎
actor.exp += @exp_gained
# 判定
if actor.level > last_level
# レベルアップした場合
@status_window.level_up(@exp_gain_actor)
# リザルトウィンドウを消す
@result_window.visible = false
# SEの再生
if $data_system_level_up_se != ""
Audio.se_play($data_system_level_up_se)
end
# MEの再生
if $data_system_level_up_me != ""
Audio.me_stop
Audio.me_play($data_system_level_up_me)
end
# LEVEL-UPウィンドウの設定
@levelup_window = Window_LevelUpWindow.new(actor, last_level,
actor.maxhp - last_maxhp, actor.maxsp - last_maxsp, actor.str - last_str,
actor.dex - last_dex, actor.agi - last_agi, actor.int - last_int)
@levelup_window.x = 160 * @exp_gain_actor
@levelup_window.visible = true
# ステータスウィンドウをリフレッシュ
@status_window.refresh
# スキル習得ウィンドウの設定
@skilllearning_window = Window_SkillLearning.new(actor.class_id, last_level, actor.level)
# ウェイトカウントを設定
@phase5_wait_count = 40
@phase5_step = 1
return
end
end
end until false
end
end
#=============================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#=============================================================
我两个都想保留下来,请问怎么修改才好? |
|