求助,脚本冲突,在线等高手。
你好,我是属于VX的新手,当我调用了cp半即时战斗(普通版1.02a)脚本时后,一切正常,可是在调用了 装备升级脚本后,横板战斗的人物却无法显示了,自己找了很久也没有找到原因,希望有高手能帮我解答一下是哪里冲突。(当我删除装备升级的脚本以后,恢复正常。)谢谢。。 先把脚本贴出来吧。。。谁有时间就会给你看的。。但是整合这种事情。。。愿意做的人少 哦,不管怎么说先谢了。。cp半即时战斗(普通版1.02a)
#=============================================================================
#★Zhong RMVX 半即时战斗系统 1.02a版★
#-----------------------------------------------------------------------------
#★Scene_CP核心部分参考自 : 神思《战斗真位移》战斗系统
#★作者: Zhong_zw
#★联系方式: 66rpg.com论坛短信 或 zhong8890@126.com
#★游戏中如若引用本脚本,请保留以上信息,并作相关说明.
#☆如若转载本脚本请联系本人☆
#=============================================================================
#=============================================================================
#☆1.01版修正问题:
#1、物品、特技窗口选择我方人物时,头像重叠
#2、连续伤害及自动回复效果无效。
#☆1.02版修正问题:
#1、减少刷新次数,提高速度
#2、修正被打击时有可能退到cp槽外
#☆1.02a版修正问题:
#1、复活问题.
#2、头像刷新问题.
#☆使用方法说明☆
#☆使用方法基本与我之前发的朴素横版战斗相同
#☆动画设置:
#1、武器、特技、物品的施展动画直接在其备注填入动画id即可。如果为空即不显示施展动画。
#2、敌人普通攻击动画,在其备注里填写格式如下:
#a1=XX #施展动画id
#a2=XX #对方动画id
#如果为空即使用默认普通动画(画面震动).
#☆战斗图设置:
#3、角色战斗图的的命名方式是角色id后面加上_z,如1_z.存放在Battlers文件夹。
#4、默认待机图为两帧,只要在Battlers文件夹里放一个“战斗图名+待“的文件,就会自动循环播放
#这两个战斗图,如1_b待,没有则没待机动作。
#☆战斗背景设置:
#5、在Graphics目录下新建Battlebacks文件夹。
#6、战斗时先搜索文件夹内是否有与角色所在区域同名的战斗图,如果没有则搜索文件夹里是否
#存在与地图同名的图片。
#7、简而言之,你须储存与你地图同名的战斗背景在Battlebacks,如果想在同一幅地图实现不同地域
#战斗背景不同,就在Battlebacks文件夹里储存与这个地域同名的战斗背景.至少保证战斗的地图
#都有一幅该地图同名的战斗背景,不然战斗时会提示找不到地图.(可参考《拉尔夫战记》或朴素横版的范例)
#☆CP条设置:
#8、CP条:在system文件夹里储存一个命名为"cp条"的图片,默认长度为327,如果需要可在Scene_CP类里调整相
#关参数.
#9、角色cp图命名方式是"角色id+_cp",如:1_cp,角色活跃cp图命名方式是"角色id+_a_cp",如1_a_cp,
#敌人cp图命名方式是"敌人名 + _敌人cp",如史莱姆_敌人cp,敌人活跃cp图是"敌人名+_a_cp".
#亦可在system文件夹里储存名为"敌人cp"的图片,作为敌人的统一cp图,活跃图名为"a_敌人cp",默认如果找不到敌人相关cp图就直接
#用这张图片.
#☆选择光标设置
#10、在system文件夹里储存名为"光标"的图片作为选择光标.
#=============================================================================
#================================================
#★战斗者类
#================================================
class Game_Battler
attr_accessor :cp
attr_accessor :cp_total
attr_accessor :cp_turn #角色能不行动时,计算角色实际cp爆满次数,用以代替回合,计算状态解除时机
#=======================================
attr_accessor :animation2_id
attr_accessor :act_status
attr_accessor :damage
attr_accessor :damage_pop
attr_accessor :slip_damage
attr_accessor :auto_damage
#=========================================
alias oldinitializeinitialize
def initialize
@cp = 0
@cp_total = false
@cp_turn = 0
@damage = nil
@damage_pop = false
@act_status = 0
@slip_damage = 0
@auto_damage = 0
oldinitialize
end
def maxcp
return 100
end
#--------------------------------------------------------------------------
# ● 应用连续伤害效果
#--------------------------------------------------------------------------
def slip_damage_effect
if slip_damage? and @hp > 0
@hp_damage = apply_variance(maxhp / 10, 10)
@hp_damage = @hp - 1 if @hp_damage >= @hp
@slip_damage = @hp_damage
self.hp -= @hp_damage
end
end
end #class
#===============================================
#★角色队伍类
#===============================================
class Game_Party < Game_Unit
attr_accessor :actor_battler
alias oldinitialize initialize
def initialize
oldinitialize
@actor_battler = []
end
end #class
#================================================
#★敌人队伍类
#================================================
class Game_Troop < Game_Unit
attr_accessor :enemy_battler
aliasoldinitialize initialize
def initialize
oldinitialize
@enemy_battler = []
end
end#class
#================================================
#★cp条处理类
#================================================
class Scene_CP
attr_accessor :stop
attr_accessor :in_battler
attr_accessor :cp_battler
BATTLE_SPEED = 0.8
def initialize
@stop = false
@all_agi = 0
@v =Viewport.new(0, 0, 544, 90)
@count = 0
@cpline = Sprite.new(@v)
@cpline.bitmap = Bitmap.new(544,416)
bitmap = Bitmap.new("Graphics/system/cp条")
@cpline.bitmap.blt(105,8,bitmap,bitmap.rect)
@cp_battler = {}
for battler in $game_party.members + $game_troop.members
@all_agi += battler.agi
@cp_battler = Sprite_cpbattler.new
if battler.is_a?(Game_Actor)
@cp_battler.bitmap = Bitmap.new("Graphics/system/#{battler.id.to_s}_cp")
@cp_battler.bitmap.blt(80,60,@cp_battler.bitmap,@cp_battler.bitmap.rect)
else
name = battler.original_name + "_敌人cp"
if FileTest.exist?("Graphics/system/#{name}.jpg") or FileTest.exist?("Graphics/system/#{name}.png") or FileTest.exist?("Graphics/system/#{name}.bmp")
@cp_battler.bitmap = Bitmap.new("Graphics/system/#{name}")
else
@cp_battler.bitmap = Bitmap.new("Graphics/system/敌人cp")
end
@cp_battler.bitmap.blt(80,60, @cp_battler.bitmap,@cp_battler.bitmap.rect)
end
@cp_battler.z = 101
@cp_battler.visible = false
end
end
#===========================================
#===========================================
def update
#@cp_battler.each{|key,value|
#if value.disposed? or value.opacity == 0
#@cp_battler.delete(key)
#next
#end
#value.update}
return if @stop
for battler in $game_party.members + $game_troop.members
if (@cp_battler.disposed? or @cp_battler.opacity == 0) and battler.dead?
@cp_battler.delete(@cp_battler)
next
end
if battler.dead?
if@cp_battler.include?(battler)
@cp_battler.collapse = true
end
battler.cp = 0
next
end
battler.cp = [.max,battler.maxcp].min if battler.movable?
battler.cp_turn = [.max,battler.maxcp].min
if battler.cp == battler.maxcp
if battler.is_a?(Game_Actor)
@cp_battler.bitmap = Bitmap.new("Graphics/system/#{battler.id.to_s}_a_cp")
@cp_battler.bitmap.blt(80,60,@cp_battler.bitmap,@cp_battler.bitmap.rect)
else
name = battler.original_name + "_a_cp"
if FileTest.exist?("Graphics/system/#{name}.jpg") or FileTest.exist?("Graphics/system/#{name}.png") or FileTest.exist?("Graphics/system/#{name}.bmp")
@cp_battler.bitmap = Bitmap.new("Graphics/system/#{name}")
else
@cp_battler.bitmap = Bitmap.new("Graphics/system/a_敌人cp")
end
@cp_battler.bitmap.blt(80,60,@cp_battler.bitmap,@cp_battler.bitmap.rect)
end
@cp_battler.z = 101
battler.cp_total = true
elsif battler.cp_total == true
if battler.is_a?(Game_Actor)
@cp_battler.bitmap = Bitmap.new("Graphics/system/#{battler.id.to_s}_cp")
@cp_battler.bitmap.blt(80,60,@cp_battler.bitmap,@cp_battler.bitmap.rect)
else
name = battler.original_name + "_敌人cp"
if FileTest.exist?("Graphics/system/#{name}.jpg") or FileTest.exist?("Graphics/system/#{name}.png") or FileTest.exist?("Graphics/system/#{name}.bmp")
@cp_battler.bitmap = Bitmap.new("Graphics/system/#{name}")
else
@cp_battler.bitmap = Bitmap.new("Graphics/system/敌人cp")
end
@cp_battler.bitmap.blt(80,60, @cp_battler.bitmap, @cp_battler.bitmap.rect)
end
battler.cp_total = false
@cp_battler.z = 105
end
@cp_battler.visible = true if @cp_battler.visible == false
@cp_battler.opacity = 255
@cp_battler.y = 30
@cp_battler.x = 95+300*battler.cp/battler.maxcp
if battler.cp_turn == battler.maxcp
battler.remove_states_auto unless battler.movable?
battler.slip_damage_effect
battler.do_auto_recovery if battler.is_a?(Game_Actor)
battler.damage_pop = true if battler.slip_damage != 0 or battler.auto_damage != 0
battler.cp_turn = 0
end
if battler.cp == battler.maxcp
if battler.is_a?(Game_Actor)
$game_party.actor_battler.push(battler)
else
battler.make_action
$game_troop.enemy_battler.push(battler)
battler.make_action
end
else
next
end
end
end
def dispose
for j in 0..25
@cpline.opacity -= 10
for i in @cp_battler.values
unless i.disposed?
i.opacity -= 10
end
end
Graphics.update
end
@v.dispose
@cpline.dispose
for i in @cp_battler.values
i.dispose
end
end
end
class Sprite_cpbattler < Sprite
attr_accessor :collapse
def initialize (viewport = nil)
super (viewport)
@effect_duration = 0
@collapse = false
end
def update
super
if self.collapse == true and self.opacity != 0
@effect_type = 5
@effect_duration = 48
self.color.set(255, 128, 128, 128)
for i in 0..48
self.opacity = 256 - (48 - @effect_duration) * 6
if self.opacity == 0
break
end
Graphics.update
@effect_duration -= 1
end
self.collapse = false
self.color.set(255,255,255,5)
end
end
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
super
end
end
#==========================================================================
#
#==========================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● 開始処理
#--------------------------------------------------------------------------
def start
super
#======================
@select_input = true
#======================
$game_temp.in_battle = true
#=============================================
unless$BTEST
@battleback = nil
for area in$data_areas.values
if $game_player.in_area?(area)
name = area.name
@battleback = Cache.battleback("#{name}")if FileTest.exist?("Graphics/Battlebacks/#{name}.jpg") or FileTest.exist?("Graphics/Battlebacks/#{name}.jpg") or FileTest.exist?("Graphics/Battlebacks/#{name}.bmp")
break
end
end
if @battleback == nil
name = $game_map.name
@battleback = Cache.battleback("#{name}")
end
$game_temp.background_bitmap= @battleback
end
#==================================================
@spriteset = Spriteset_Battle.new
@message_window = Window_BattleMessage.new
@message_window.visible = false
@action_battlers = []
@cp_battle = Scene_CP.new
@cp_battle.stop = false
create_info_viewport
@select_icon = Sprite.new
@select_icon.z = 148
@select_icon.bitmap = Bitmap.new("Graphics/system/光标")
@select_icon.opacity = 240
@select_icon.visible = false
@c_c = 0
end
#==============================================================
#★ 定义光标刷新
#==============================================================
def select_icon_update(s_sw = false)
if s_sw == false
@select_icon.visible = false
else
@select_icon.visible = true
@select_icon.x = $game_troop.members[@target_enemy_window.enemy.index].screen_x
@select_icon.y = $game_troop.members[@target_enemy_window.enemy.index].screen_y - 30
if @c_c%2 == 0
@select_icon.opacity += 30
else
@select_icon.opacity -= 30
end
end
end
#=================================================
#★主刷新部分
#=================================================
def update
super
@c_c += 1
update_basic(true)
update_info_viewport
return if judge_win_loss
update_scene_change
if @target_enemy_window != nil
update_target_enemy_selection
elsif @target_actor_window != nil
update_target_actor_selection
elsif @skill_window != nil
update_skill_selection
elsif @item_window != nil
update_item_selection
elsif @actor_command_window.active
update_actor_command_selection
#=================================
elsif @cp_battle.stop ==false
active_battler_update
#=================================
else
process_battle_event
process_action
process_battle_event
end
#end
end
#================================================
#★战斗初始化
#===============================================
def start_party_command_selection
if $game_temp.in_battle
@status_window.refresh
@status_window.index = @actor_index = -1
@active_battler = nil
@actor_command_window.active = false
$game_party.clear_actions
for i in 0..$game_party.members.size-1
if $game_party.members.act_status != -1
$game_party.members.act_status = -1
end
end
if $game_troop.surprise or not $game_party.inputable?
start_main
end
end
end
#=============================================
#★角色回合的处理函数
#=============================================
def next_actor
for i in 0..$game_party.members.size-1
if $game_party.members.act_status != -1
$game_party.members.act_status = -1
end
end
@info_viewport.visible = true
@status_window.refresh
@now_face = -1
@actor_command_window.update
@status_window.update
loop do
if @actor_index == @actor_battler.size - 1
start_main
return
end
@actor_index += 1
index = 0
for battler in $game_party.members
if battler == @actor_battler[@actor_index]
break
else
index += 1
end
end
@status_window.index = index
if @active_battler != nil and @active_battler != @actor_battler[@actor_index] and @active_battler.is_a?(Game_Actor)
@active_battler.act_status = -1
end
@active_battler = @actor_battler[@actor_index]
@active_battler.act_status = 1
if @active_battler.auto_battle
@active_battler.make_action
next
end
break if @active_battler.inputable?
end
start_actor_command_selection
end
#===================================================
#★激活角色指令窗口
#===================================================
def start_actor_command_selection
@actor_command_window.setup(@active_battler)
@actor_command_window.active = true
@actor_command_window.index = 0
end
#==============================================
#★指令窗口刷新
#==============================================
def update_actor_command_selection
if Input.trigger?(Input::C)
case @actor_command_window.index
when 0# 攻击
Sound.play_decision
@active_battler.action.set_attack
start_target_enemy_selection
when 1# 特技
Sound.play_decision
start_skill_selection
when 2# 防御
Sound.play_decision
@active_battler.action.set_guard
next_actor
@active_battler.cp = 0
when 3# 物品
Sound.play_decision
start_item_selection
when 4 #逃跑
if $game_troop.can_escape == false
Sound.play_buzzer
return
end
Sound.play_decision
process_escape
end
end
end
#====================================
#★选择敌人
#====================================
def start_target_enemy_selection
if @skill_window != nil
@skill_window.visible = false
end
if @item_window != nil
@item_window.visible = false
end
@target_enemy_window = Window_TargetEnemy.new
@target_enemy_window.opacity = 0
@target_enemy_window.contents_opacity = 0
#@target_enemy_window.y = @info_viewport.rect.y
#@info_viewport.rect.x += @target_enemy_window.width
#@info_viewport.ox += @target_enemy_window.width
@actor_command_window.active = false
select_icon_update(true)
end
#===========================================================
#★结束敌人选择
#===========================================================
def end_target_enemy_selection
#@info_viewport.rect.x -= @target_enemy_window.width
#@info_viewport.ox -= @target_enemy_window.width
@target_enemy_window.dispose
@target_enemy_window = nil
select_icon_update
if @actor_command_window.index == 0
@actor_command_window.active = true
end
end
#=======================================================
#★敌人选择刷新
#=======================================================
def update_target_enemy_selection
@target_enemy_window.update
select_icon_update(true)
if Input.trigger?(Input::B)
Sound.play_cancel
if @skill_window != nil
@skill_window.visible = true
end
if @item_window != nil
@item_window.visible = true
end
end_target_enemy_selection
elsif Input.trigger?(Input::C)
Sound.play_decision
@active_battler.action.target_index = @target_enemy_window.enemy.index
end_target_enemy_selection
end_skill_selection
end_item_selection
next_actor
@active_battler.cp = 0
end
end
#======================================================
#★己方选择
#======================================================
def start_target_actor_selection
@target_actor_window = Window_BattleStatus.new
@target_actor_window.index = 0
@target_actor_window.active = true
@target_actor_window.y = @info_viewport.rect.y
@target_actor_window.draw_actorface($game_party.members[@target_actor_window.index])
@info_viewport.rect.x += @target_actor_window.width
@info_viewport.ox += @target_actor_window.width
@actor_command_window.active = false
#=====================
#☆减少刷新次数
#=====================
@last_index = -1
end
#==================================================
#★己方选择结束处理
#==================================================
def end_target_actor_selection
@info_viewport.rect.x -= @target_actor_window.width
@info_viewport.ox -= @target_actor_window.width
@target_actor_window.dispose
@target_actor_window = nil
#=====================
#☆减少刷新次数
#=====================
@last_index = -1
end
#===================================================
#★己方选择刷新
#===================================================
def update_target_actor_selection
if @last_index != @target_actor_window.index
@target_actor_window.refresh
@target_actor_window.draw_actorface($game_party.members[@target_actor_window.index])
@last_index = @target_actor_window.index
end
@target_actor_window.update
if Input.trigger?(Input::B)
Sound.play_cancel
end_target_actor_selection
elsif Input.trigger?(Input::C)
Sound.play_decision
@active_battler.action.target_index = @target_actor_window.index
end_target_actor_selection
end_skill_selection
end_item_selection
next_actor
@active_battler.cp = 0
end
end
#============================================
#★特技使用决定处理
#===========================================
def determine_skill
@active_battler.action.set_skill(@skill.id)
@skill_window.active = false
if @skill.need_selection?
if @skill.for_opponent?
start_target_enemy_selection
else
start_target_actor_selection
end
else
end_skill_selection
next_actor
@active_battler.cp = 0
end
end
#=========================================
#★物品使用决定处理
#=========================================
def determine_item
@active_battler.action.set_item(@item.id)
@item_window.active = false
if @item.need_selection?
if @item.for_opponent?
start_target_enemy_selection
else
start_target_actor_selection
end
else
end_item_selection
next_actor
@active_battler.cp = 0
end
end
#===============================================
#★各窗口视口生成
#===============================================
def create_info_viewport
@info_viewport = Viewport.new(0, 288, 544, 256)
@info_viewport.z = 100
@status_window = Window_BattleStatus.new
@actor_command_window = Window_ActorCommand.new
@status_window.viewport = @info_viewport
@actor_command_window.viewport = @info_viewport
@status_window.x = 0
@actor_command_window.x = 416
@status_window.y = 128
@actor_command_window.y = 128
@info_viewport.visible = false
#========================
#☆减少头像刷新用
#========================
@now_face = -1
end
#================================================
#★视口释放
#================================================
def dispose_info_viewport
@status_window.dispose
@actor_command_window.dispose
@info_viewport.dispose
#========================
#☆减少头像刷新用
#========================
@now_face = -1
if @window_egi != nil
@window_egi.dispose
end
end
#======================================================
#★视口刷新
#======================================================
def update_info_viewport
@actor_command_window.update
if @active_battler != nil and @active_battler.is_a?(Game_Actor) and @active_battler.id != @now_face
@status_window.draw_actorface(@active_battler)
@now_face = @active_battler.id
end
@status_window.update
if @actor_command_window.active and @actor_command_window.y > 0
@actor_command_window.y -= 8
@status_window.y -= 8
end
end
#================================================
#★战斗开始 处理
#================================================
def process_battle_start
if $game_troop.preemptive
for battler in $game_party.members
battler.cp = battler.maxcp
end
$game_troop.preemptive = false
elsif $game_troop.surprise
for battler in $game_troop.members
battler.cp = battler.maxcp
end
$game_troop.surprise = false
end
make_escape_ratio
process_battle_event
#===========================================
@status_window.refresh
@status_window.index = @actor_index = -1
#=====================
@cp_battle.stop = false
#=====================
end
#==========================================
#★逃走处理
#==========================================
def process_escape
@info_viewport.visible = false
if $game_troop.preemptive
success = true
else
success = (rand(100) < @escape_ratio)
end
Sound.play_escape
if success
#=============================
@cp_battle.dispose
#=============================
for battler in $game_party.members
battler.cp = 0
end
battle_end(1)
else
@escape_ratio += 10
@active_battler.cp = 0
@active_battler.action.clear
next_actor
end
end
#========================================
#★胜利处理
#========================================
def process_victory
@info_viewport.visible = false
RPG::BGM.stop
$game_system.battle_end_me.play
for battler in $game_troop.members
if battler.dead?
if@cp_battle.cp_battler.include?(battler)
@cp_battle.cp_battler.collapse = true
next
end
end
end
@cp_battle.cp_battler.each{|key,value|
if value.disposed?
@cp_battler.delete(key)
next
end
value.update}
#=============================
@cp_battle.dispose
#=============================
for battler in $game_party.members
battler.cp = 0
end
unless $BTEST
$game_temp.map_bgm.play
$game_temp.map_bgs.play
end
display_exp_and_gold
display_drop_items
display_level_up
battle_end(0)
end
#=================================
#★失败处理
#=================================
def process_defeat
@cp_battle.dispose
for battler in $game_party.members + $game_troop.members
battler.cp = 0
end
@info_viewport.visible = false
battle_end(2)
end
#=============================================================================
#★CP战斗的主要刷新★
#=============================================================================
def active_battler_update
#===================================
@actor_battler = []
@enemy_battler = []
$game_party.actor_battler = []
$game_troop.enemy_battler = []
#===================================
@cp_battle.update
@actor_battler = $game_party.actor_battler
@enemy_battler = $game_troop.enemy_battler
#for battler in $game_party.members + $game_troop.members
#end
if @actor_battler.size != 0
@cp_battle.stop = true
next_actor
Audio.se_play("Audio/SE/Jump2",100,100)
elsif @enemy_battler.size != 0
#================
@cp_battle.stop = true
start_main
#================
end
end
#=============================================================
#=============================================================
#====================================================
#★战斗主处理
#====================================================
def start_main
for i in 0..$game_party.members.size-1
if $game_party.members.act_status != 0
$game_party.members.act_status = 0
end
end
if @info_viewport.visible
@info_viewport.visible = false
@status_window.y = 128
@actor_command_window.y = 128
end
@actor_command_window.active = false
@status_window.index = @actor_index = -1
@active_battler = nil
make_action_orders
wait(20)
#=============================
while @action_battlers.size != 0 and judge_win_loss == false
process_action
end
@cp_battle.stop = false
#=============================
end
#=====================================
#★行动顺序生成
#=====================================
def make_action_orders
@action_battlers = []
unless $game_troop.surprise
@action_battlers += @actor_battler if @actor_battler.size != 0
end
unless $game_troop.preemptive
@action_battlers += @enemy_battler if @enemy_battler.size != 0
end
for battler in @action_battlers
battler.action.make_speed
end
@action_battlers.sort! do |a,b|
b.action.speed - a.action.speed
end
end
#====================================
#★战斗行动处理
#====================================
def process_action
return if judge_win_loss
return if $game_temp.next_scene != nil
set_next_active_battler
return if @active_battler == nil
return if @active_battler.dead?
@active_battler.white_flash = true
unless @active_battler.action.forcing
@active_battler.action.prepare
end
if @active_battler.action.valid?
execute_action
end
unless @active_battler.action.forcing
remove_states_auto
display_current_state
end
@active_battler.white_flash = false
end
#=================================
#★攻击行动 执行
#=================================
def execute_action_attack
targets = @active_battler.action.make_targets
display_attack_animation(targets)
wait(20)
for target in targets
target.attack_effect(@active_battler)
display_action_effects(target)
end
#=====================
@active_battler.cp = 0
#=====================
end
#===============================
#★防御行动 执行
#===============================
def execute_action_guard
wait(45)
#=====================
@active_battler.cp = 0
#=====================
end
#===============================
#★逃走执行
#===============================
def execute_action_escape
@active_battler.escape
Sound.play_escape
wait(45)
#=====================
@active_battler.cp = 0
#=====================
end
#====================================
#★待机执行
#====================================
def execute_action_wait
wait(45)
#=====================
@active_battler.cp = 0
#=====================
end
#============================
#★特技 执行
#============================
def execute_action_skill
skill = @active_battler.action.skill
targets = @active_battler.action.make_targets
user = @active_battler.action.skill_user
if skill.animation2_id != 0
display_animation(user,skill.animation2_id)
end
display_animation(targets, skill.animation_id)
wait_for_animation
@active_battler.mp -= @active_battler.calc_mp_cost(skill)
$game_temp.common_event_id = skill.common_event_id
for target in targets
target.skill_effect(@active_battler, skill)
display_action_effects(target, skill)
end
#=====================
@active_battler.cp = 0
#=====================
end
#==============================
#★物品行动 执行
#==============================
def execute_action_item
item = @active_battler.action.item
user = @active_battler.action.skill_user
if item.animation2_id != 0
display_animation(user,item.animation2_id)
end
targets = @active_battler.action.make_targets
display_animation(targets, item.animation_id)
wait_for_animation
$game_party.consume_item(item)
$game_temp.common_event_id = item.common_event_id
for target in targets
target.item_effect(@active_battler, item)
display_action_effects(target, item)
end
#=====================
@active_battler.cp = 0
#=====================
end
#===========================
#★行动动画显示
#animation_id :-1 为普通攻击
#===========================
def display_animation(targets, animation_id)
if animation_id < 0
display_attack_animation(targets)
else
display_normal_animation(targets, animation_id)
end
wait(20)
end
#====================================
#★普通攻击的动画显示
#====================================
def display_attack_animation(targets)
if @active_battler.is_a?(Game_Enemy)
user = @active_battler.action.skill_user
if @select_input == true
a1 = 0
a2 = 0
eval(@active_battler.note)
display_normal_animation(user,a1)if a1 != 0
display_normal_animation(targets,a2)ifa2 !=0
Sound.play_enemy_attack if a1 == 0 and a2 == 0
wait(15, true) ifa1 == 0 anda2 == 0
elsif @active_battler.animation1_id != 0 or @active_battler.animation2_id != 0
display_normal_animation(user,@active_battler.animation1_id)if @active_battler.animation1_id != 0
display_normal_animation(targets,@active_battler.animation2_id)if @active_battler.animation2_id != 0
Sound.play_enemy_attack if@active_battler.animation1_id == 0 and @active_battler.animation2_id == 0
wait(15, true) if@active_battler.animation1_id == 0 and @active_battler.animation2_id == 0
end
else
aid1 = @active_battler.atk_animation_id
aid2 = @active_battler.atk_animation_id2
user = @active_battler.action.skill_user
if @active_battler.act_animation_id != 0
display_normal_animation(user,@active_battler.act_animation_id)
end
display_normal_animation(targets, aid1, false)
display_normal_animation(targets, aid2, true)
end
wait_for_animation
end
#========================================
#★显示行动结果
#========================================
def display_action_effects(target, obj = nil)
unless target.skipped
wait(5)
#=======================
target.damage_pop = true
#=======================
display_critical(target, obj)
display_damage(target, obj)
display_state_changes(target, obj)
end
end
#======================================
#★显示HP伤害
#======================================
def display_hp_damage(target, obj = nil)
if target.hp_damage == 0
return if obj != nil and obj.damage_to_mp
return if obj != nil and obj.base_damage == 0
elsif target.absorbed # 吸収
#=====================================
@active_battler.damage_pop = true
@active_battler.damage = target.hp_damage
target.cp -= target.hp_damage/100
@cp_battle.cp_battler.x = .max
if target.dead?
@cp_battle.cp_battler.collapse = true
target.cp = 0
@cp_battle.cp_battler.update
end
#=====================================
elsif target.hp_damage > 0
if target.actor?
Sound.play_actor_damage
$game_troop.screen.start_shake(5, 5, 10)
else
Sound.play_enemy_damage
target.blink = true
end
#=====================================
target.cp -= target.hp_damage/100
@cp_battle.cp_battler.x = .max
if target.dead?
@cp_battle.cp_battler.collapse = true
target.cp = 0
@cp_battle.cp_battler.update
end
#wait(10)
#=====================================
else
Sound.play_recovery
end
end
#--------------------------------------------------------------------------
# ● MP 伤害表示
#--------------------------------------------------------------------------
def display_mp_damage(target, obj = nil)
return if target.dead?
return if target.mp_damage == 0
if target.absorbed # 吸收
#=====================================
@active_battler.damage_pop = true
@active_battler.damage = - target.mp_damage
target.cp -= target.mp_damage/100
@cp_battle.cp_battler.x = .max
#=====================================
elsif target.mp_damage > 0
#=====================================
target.cp -= target.mp_damage/100
@cp_battle.cp_battler.x = .max
#=====================================
else
Sound.play_recovery
end
end
#=======================================
#★重定义对话窗口刷新
#=======================================
def wait_for_message
wait(45)
end
#================================================
#★经验金钱获得物品提示窗口(原方法重定义)
#================================================
def display_exp_and_gold
exp=$game_troop.exp_total
gold=$game_troop.gold_total
$game_party.gain_gold(gold)
drop_items = $game_troop.make_drop_items
@window_egi = Window_egi.new(exp,gold,drop_items)
@window_egi.openness=0
wait(15)
loop do
if @window_egi.openness <= 255
@window_egi.openness+=48
end
if Input.trigger?(Input::C) or Input.trigger?(Input::B)
break
end
Graphics.update
Input.update
end
loop do
@window_egi.openness -= 48 if @window_egi.openness >= 0
Graphics.update
if @window_egi.openness <= 0
break
end
end #loop
end
alias oldstart_skill_selectionstart_skill_selection
def start_skill_selection
oldstart_skill_selection
@skill_window.z = 3000
@skill_window.help_window.z = 3000
end
alias oldstart_item_selectionstart_item_selection
def start_item_selection
oldstart_item_selection
@item_window.z=3000
@item_window.help_window.z = 3000
end
end #class
#=====================================================
#★战斗状态窗口类
#=====================================================
class Window_BattleStatus < Window_Selectable
def draw_item(index)
rect = item_rect(index)
rect.x += 4
rect.width -= 8
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
actor = $game_party.members
draw_actor_name(actor, 96, rect.y)
draw_actor_state(actor, 114+48, rect.y, 48)
draw_actor_hp(actor, 174, rect.y, 120)
draw_actor_mp(actor, 310, rect.y, 70)
end
#=======================================================================
#★定义角色头像的描绘
#=======================================================================
def draw_actorface(actor)
draw_face(actor.face_name, actor.face_index, 5, 5, size = 80)
end
#=========================================================================
def update_cursor
super
self.cursor_rect.width = self.width - 120
self.cursor_rect.x = 90
end
#========================================================================
end #class
#=================================================
#★战斗图处理的类
#=================================================
class Sprite_Battler < Sprite_Base
#=================================
#★刷新
#=================================
def update
super
if @battler == nil
self.bitmap = nil
else
@use_sprite = @battler.use_sprite?
if @use_sprite
self.x = @battler.screen_x
self.y = @battler.screen_y
self.z = @battler.screen_z
update_battler_bitmap
if @battler.act_status == 1
if self.opacity <280
self.opacity += 20
end
elsif @battler.act_status == -1
if self.opacity > 125
self.opacity -= 20
end
elsif(@battler.dead? or @battler.hidden) and @battler.collapse == false
else
self.opacity = 255
end
end
setup_new_effect
update_effect
end
end
#===============================
#
#===============================
def update_battler_bitmap
if @battler.battler_name != @battler_name or
@battler.battler_hue != @battler_hue
@battler_name = @battler.battler_name
@battler_hue = @battler.battler_hue
self.bitmap = Cache.battler(@battler_name, @battler_hue)
@width = bitmap.width
@height = bitmap.height
self.ox = @width / 2
self.oy = @height
if (@battler.dead? or @battler.hidden) and @battler.collapse == false
end
end
if @battler.is_a?(Game_Actor)
count = 40
else
count = 44
end
if Graphics.frame_count%count <= 19
self.bitmap = Cache.battler(@battler_name,@battler_hue)
@width = bitmap.width
@height = bitmap.height
self.ox = @width / 2
self.oy = @height
else
b_name = @battler_name + "待"
if FileTest.exist?("Graphics/Battlers/#{b_name}.png") or FileTest.exist?("Graphics/Battlers/#{b_name}.jpg")orFileTest.exist?("Graphics/Battlers/#{b_name}.bmp")
self.bitmap = Cache.battler(b_name,@battler_hue)
@width = bitmap.width
@height = bitmap.height
self.ox = @width/2
self.oy = @height
end
end
end
#==================================
#
#==================================
def setup_new_effect
if @battler.white_flash
@effect_type = WHITEN
@effect_duration = 16
@battler.white_flash = false
end
if @battler.blink
@effect_type = BLINK
@effect_duration = 20
@battler.blink = false
end
if not @battler_visible and @battler.exist?
@effect_type = APPEAR
@effect_duration = 16
@battler_visible = true
end
if @battler.damage_pop and not (@battler.collapse or @battler.hidden)
if @battler.damage != nil
s_1 = @battler.damage > 0 ? 0 : 1
@battler.damage = @battler.damage > 0 ? -@battler.damage : @battler.damage
end
damage(@battler.damage,@battler.critical,s_1) if @battler.damage != 0 and @battler.damage != nil
damage(@battler.hp_damage,@battler.critical,0) if @battler.hp_damage != 0
damage(@battler.mp_damage,@battler.critical,1) if @battler.mp_damage != 0
damage("失误",@battler.critical) if @battler.missed
damage("MISS",@battler.critical) if @battler.evaded
damage(@battler.slip_damage - @battler.auto_damage,@battler.critical) if @battler.slip_damage != 0 or @battler.auto_damage != 0
@battler.slip_damage = 0
@battler.auto_damage = 0
@battler.damage = nil
@battler.damage_pop = false
end
if @battler_visible and @battler.hidden
@effect_type = DISAPPEAR
@effect_duration = 32
@battler_visible = false
end
if @battler.collapse and self.opacity != 0
@effect_type = COLLAPSE
@effect_duration = 48
@battler.collapse = false
@battler_visible = false
end
if @battler.animation_id != 0 and @battler.collapse == false
self.opacity = 255
animation = $data_animations[@battler.animation_id]
mirror = @battler.animation_mirror
start_animation(animation, mirror)
@battler.animation_id = 0
end
end
#=========================================
#
#=========================================
end #class
#=================================================
#★处理战斗行动的类
#=================================================
class Game_BattleAction
def skill_user
targets = []
targets.push(battler)
return targets.compact
end
end#class
#=======================================================
#★处理敌人的类
#
#=======================================================
class Game_Enemy < Game_Battler
def note
return $data_enemies[@enemy_id].note
end
end#class
#======================================================
#★角色处理类
#======================================================
class Game_Actor < Game_Battler
def setup(actor_id)
actor = $data_actors
@actor_id = actor_id
@name = actor.name
#--------------------------------------------
#★添加战斗图名称,以便战斗中获取战斗图
#--------------------------------------------
@battler_name = actor_id.to_s + "_z"
@battler_hue = 0
@flash = false
@character_name = actor.character_name
@character_index = actor.character_index
@face_name = actor.face_name
@face_index = actor.face_index
@class_id = actor.class_id
@weapon_id = actor.weapon_id
@armor1_id = actor.armor1_id
@armor2_id = actor.armor2_id
@armor3_id = actor.armor3_id
@armor4_id = actor.armor4_id
@level = actor.initial_level
@exp_list = Array.new(101)
make_exp_list
@exp = @exp_list[@level]
@skills = []
for i in self.class.learnings
learn_skill(i.skill_id) if i.level <= @level
end
clear_extra_values
recover_all
end
#--------------------------------------------------------------------------
# ● 执行自动回复 (回合结束时调用)
#--------------------------------------------------------------------------
def do_auto_recovery
if auto_hp_recover and not dead?
self.hp += maxhp / 20
@auto_damage = maxhp / 20
end
end
#==========================================================================
#★ 定义武器的行动方动画id,默认为第一武器的id
#==========================================================================
def act_animation_id
return weapons == nil ? 0 : weapons.animation2_id
end
#==========================================================================
#==========================================================================
#==========================================================================
#★定义角色战斗图 X 坐标
#==========================================================================
def screen_x
if self.index != nil
case index
when 0
return 460
when 1
return 440
when 2
return 420
when 3
return 400
end
else
return 0
end
end
#========================================================================
#★定义角色战斗图 Y 坐标
#========================================================================
def screen_y
if self.index != nil
case index
when 0
return 245
when 1
return 215
when 2
return 185
when 3
return 155
end
else
return 230
end
end
#========================================================================
#★定义角色战斗图 Z 坐标
#========================================================================
def screen_z
if self.index != nil
return 4 - self.index
else
return 0
end
end
def use_sprite?
return true
end
end#class
#==========================================================
#★模块定义
#==========================================================
module RPG
class BaseItem
def animation2_id
return @note != nil ? @note.to_i : 0
end
end
class Enemy
def animation1_id
animation1_id = @note.split(/,/)
return animation1_id != nil ? animation1_id.to_i : 0
end
def animation2_id
animation2_id = @note.split(/,/)
return animation2_id != nil ? animation2_id.to_i : 0
end
end
end
#======================================================
#★精灵类主模块_伤害部分的添加
#======================================================
class Sprite_Base < Sprite
def initialize(viewport = nil)
super(viewport)
@use_sprite = true
@animation_duration = 0
#=============
@_damage_duration = 0
#=============
end
alias oldupdate update
def update
oldupdate
#================
damge_update
#================
end
alias olddispose dispose
def dispose
olddispose
#===============
dispose_damage
#===============
end
#==========================================================================
#★定义伤害处理
#==========================================================================
def damage(value, critical,type = 0)
dispose_damage
if value.is_a?(Numeric)
damage_string = value.abs.to_s
else
damage_string = value.to_s
end
bitmap = Bitmap.new(160, 48)
bitmap.font.name = "黑体"
bitmap.font.size = 25
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
if value.is_a?(Numeric) and value < 0
case type
when 0
bitmap.font.color.set(176, 255, 144)
when 1
bitmap.font.color.set(0,100,255)
end
else
case type
when 0
bitmap.font.color.set(255, 255, 255)
when 1
bitmap.font.color.set(200,0,185)
end
end
bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
if critical and type == 0
bitmap.font.size = 18
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
bitmap.font.color.set(255, 255, 255)
bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
end
@_damage_sprite = ::Sprite.new(self.viewport)
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = 80
@_damage_sprite.oy = 20
@_damage_sprite.x = self.x
@_damage_sprite.y = self.y - self.oy / 2
@_damage_sprite.z = 3000
@_damage_duration = 40
end
#===================================================
#
#===================================================
def dispose_damage
if @_damage_sprite != nil
@_damage_sprite.bitmap.dispose
@_damage_sprite.dispose
@_damage_sprite = nil
@_damage_duration = 0
end
end
#=============================================
#
#=============================================
def damge_update
if @_damage_duration > 0
@_damage_duration -= 1
case @_damage_duration
when 38..39
@_damage_sprite.y -= 4
when 36..37
@_damage_sprite.y -= 2
when 34..35
@_damage_sprite.y += 2
when 28..33
@_damage_sprite.y += 4
end
@_damage_sprite.opacity = 256 - (12 - @_damage_duration) * 32
if @_damage_duration == 0
dispose_damage
end
end
end
end#class
#=======================================================
#★战斗经验、金钱、物品提示窗口
#=======================================================
class Window_egi<Window_Base
#====================================
#●初始化
#====================================
def initialize(exp, gold,item)
@exp=exp
@gold=gold
@item=item
@item_name = {}
n=0
m=0
if @item != nil
for itn in @item
if @item_name==nil
@item_name=0
m+=1
end
end
end
if @gold>0
m+=1
end
super(200,100, 160,32*m+112 )
self.opacity = 150
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.size=19
if @exp > 0
self.contents.font.color = Color.new(255,255,0,255)
self.contents.draw_text(6,8,64,32,"获得经验:")
self.contents.font.color = Color.new(255,255,255,255)
self.contents.draw_text(80,8,32,32,sprintf("%4s",@exp))
elsif @exp == 0
self.contents.font.color = Color.new(255,0,0,0)
self.contents.draw_text(6,8,32,32,"没有获得经验!")
end
if @gold>0
self.contents.font.color = Color.new(255,255,0,255)
self.contents.draw_text(6,40,64,32,"获得金钱:")
self.contents.font.color = Color.new(255,255,255,255)
self.contents.draw_text(80,40,32,32,sprintf("%4s",@gold)+Vocab::gold)
end
if @item_name.size != 0
self.contents.font.size = 20
self.contents.font.color = Color.new(255,255,0)
self.contents.draw_text(25,72,64,32,"获得物品")
i=0
for itn in @item
if @item_name == 0
draw_icon(itn.icon_index ,6 ,106+i*32 , true)
i+=1
end
@item_name+=1
end
i=0
self.contents.font.size = 18
self.contents.font.color = Color.new(255,255,255,255)
for itn in @item_name
self.contents.draw_text(30,106+i*32,64,32,itn.to_s + " × "+itn.to_s)
i+=1
end
end
end
end#class
module Cache
def self.battleback(filename)
load_bitmap("Graphics/Battlebacks/", filename)
end
end
#=====================================================
#添加战斗背景的相关定义
#=====================================================
class Game_Map
attr_accessor :name
def setup(map_id)
@map_id = map_id
@map = load_data(sprintf("Data/Map%03d.rvdata", @map_id))
@mapinfo = load_data("Data/MapInfos.rvdata")
#============================
@name = @mapinfo[@map_id].name
#============================
@display_x = 0
@display_y = 0
@passages = $data_system.passages
referesh_vehicles
setup_events
setup_scroll
setup_parallax
@need_refresh = false
end #class
def area(old_name,new_name)
for area in$data_areas.values
if area.name == old_name and area.map_id == @map_id
area.name == new_name
end
end
end
end #class
class Spriteset_Battle
def create_battleback
source = $game_temp.background_bitmap
bitmap = Bitmap.new(640, 480)
bitmap.blt(0,0,source,source.rect)
@battleback_sprite = Sprite.new(@viewport1)
@battleback_sprite.bitmap = bitmap
@battleback_sprite.ox = 272
@battleback_sprite.oy = 208
@battleback_sprite.x = 260
@battleback_sprite.y = 208
end
alias oldcreate_battlefloor create_battlefloor
def create_battlefloor
oldcreate_battlefloor
@battlefloor_sprite.opacity = 0
end
end#class
得失物品
#==============================================================================
# 本腳本來自www.66RPG.com,使用和轉載請保留此信息
#==============================================================================
# 注意!!!在對話後得到物品,請在對話後先用事件等待3幀,否則對話框來不及消失。
# 開關定義:
$noshowgold = 41 # 不显示金钱得失
$noshowitem = 42 # 不显示物品得失
$noshowweapon = 43 # 不显示武器得失
$noshowarmor = 44 # 不显示防具得失
# 以上開關,當打開的時候,獲得物品將不會提示,比如默認打開41號開關,獲得金錢不再提示
# 不想提示等级升降时,就在事件命令直接选择是否显示就行了。
#——聲效,可以自己改
folder = "Audio/SE/"
$gain_gold_se = folder +"Shop" # 获得金钱声效
$loss_gold_se = folder +"Blow2" # 失去金钱声效
$gain_item_se = folder +"Item1" # 获得物品声效
$loss_item_se = folder +"Blow2" # 失去物品声效
$gain_weapon_se = folder +"Item1" # 获得武器声效
$loss_weapon_se = folder +"Blow2" # 失去武器声效
$gain_armor_se= folder +"Item1" # 获得防具声效
$loss_armor_se= folder +"Blow2" # 失去防具声效
$gain_lv_se = folder +"Item1" # 提升等级声效
$loss_lv_se = folder +"Blow2" # 降低等级声效
# ————————————————————————————————————
class Game_Interpreter
#--------------------------------------------------------------------------
# ● 增減金錢
#--------------------------------------------------------------------------
def command_125
value = operate_value(@params, @params, @params)
$game_party.gain_gold(value)
if $game_switches[$noshowgold]==false
show_gain_window(0, value)
end
return true
end
#--------------------------------------------------------------------------
# ● 增減物品
#--------------------------------------------------------------------------
def command_126
value = operate_value(@params, @params, @params)
$game_party.gain_item($data_items[@params], value)
if $game_switches[$noshowitem]==false
show_gain_window(1, value)
end
$game_map.need_refresh = true
return true
end
#--------------------------------------------------------------------------
# ● 增減武器
#--------------------------------------------------------------------------
def command_127
value = operate_value(@params, @params, @params)
if @params == 0
$game_party.gain_reini_item($base_weapons[@params], value.abs, @params)
else
$game_party.lose_reini_item($base_weapons[@params], value.abs, @params)
end
if $game_switches[$noshowweapon]==false
show_gain_window(2, value)
end
return true
end
#--------------------------------------------------------------------------
# ● 增減防具
#--------------------------------------------------------------------------
def command_128
value = operate_value(@params, @params, @params)
if @params == 0
$game_party.gain_reini_item($base_armors[@params], value.abs, @params)
else
$game_party.lose_reini_item($base_armors[@params], value.abs, @params)
end
if $game_switches[$noshowarmor]==false
show_gain_window(3, value)
end
return true
end
#--------------------------------------------------------------------------
# ● 等级増減
#--------------------------------------------------------------------------
def command_316
value = operate_value(@params, @params, @params)
iterate_actor_id(@params) do |actor|
actor.change_level(actor.level + value, false)
if @params
show_gain_level_window(actor,value)
end
end
return true
end
def show_gain_window(type, value)
snstar2006_66rpg_item = $data_armors[@params]
snstar2006_66rpg = Window_Base.new((640-300)/2,128,200,100)
snstar2006_66rpg.contents = Bitmap.new(snstar2006_66rpg.width - 32, snstar2006_66rpg.height - 32)
if value >= 0
gain_text = "獲得"
else
gain_text = "失去"
end
case type
when 0
gain_type = "金錢"
if value >=0
Audio.se_play($gain_gold_se,80,100)
else
Audio.se_play("Audio/SE/"+"Item1",80,100)
end
when 1
gain_type = "物品"
string = $data_items[@params]
if value >=0
Audio.se_play($gain_item_se,80,100)
else
Audio.se_play($loss_item_se,80,100)
end
when 2
gain_type = "武器"
string = $base_weapons[@params]
if value >=0
Audio.se_play($gain_weapon_se,80,100)
else
Audio.se_play($loss_weapon_se,80,100)
end
when 3
gain_type = "防具"
string = $base_armors[@params]
if value >=0
Audio.se_play($gain_armor_se,80,100)
else
Audio.se_play($loss_armor_se,80,100)
end
end
snstar2006_66rpg.contents.draw_text(0,0,160,32,gain_text+gain_type+":")
unless type == 0
snstar2006_66rpg.draw_item_name(string, 28, 32, true)
snstar2006_66rpg.contents.draw_text(0, 32, 150, 32, "×"+value.abs.to_s, 2)
else
snstar2006_66rpg.contents.draw_text(32,32,240,32,value.abs.to_s + ""+ Vocab::gold)
end
snstar2006_66rpg.opacity = 160
for i in 0..30
Graphics.update
end
for i in 0..10
snstar2006_66rpg.opacity -= 30
snstar2006_66rpg.contents_opacity -= 30
Graphics.update
end
snstar2006_66rpg.dispose
end
def show_gain_level_window(actor,value)
lvstring = Vocab::level
snstar2006_66rpg = Window_Base.new((640-300)/2,128,200,100)
snstar2006_66rpg.contents = Bitmap.new(snstar2006_66rpg.width - 32, snstar2006_66rpg.height - 32)
if value >= 0
gain_text = "提升"
Audio.se_play($gain_lv_se,80,100)
else
gain_text = "降低"
Audio.se_play($loss_lv_se,80,100)
end
snstar2006_66rpg.contents.draw_text(0, 0, 108, 32, actor.name)
string = lvstring+gain_text+value.abs.to_s+"级"
snstar2006_66rpg.contents.draw_text(32,32,160,32,string)
snstar2006_66rpg.opacity = 160
for i in 0..30
Graphics.update
end
for i in 0..10
snstar2006_66rpg.opacity -= 30
snstar2006_66rpg.contents_opacity -= 30
Graphics.update
end
snstar2006_66rpg.dispose
end
end #=============================================================================
# (测试)vx复杂装备系统之 装备升级功能 by 沉影不器
#-----------------------------------------------------------------------------
# 此版本侧重于捕捉bug,欢迎反馈.
#=============================================================================
# 参数设定如下
#=============================================================================
module Game_Equip
## 能力升级基数(倍数)
BaseAbility = 0.2
## 每级价格提高基数(倍数)
BasePrice = 0.3
## 是否保证成功
UpGrade_Absoluteness = false
## 每级成功率基数(百分比,用于逐级下降)
BaseSucceed = 1
## 最大等级
MaxLevel = 10
## 需金钱基数(与本身价格的倍数)
GoldNeed = 0.8
## 需物品id => 数量
ItemsNeed = {21=>1, 22=>2}
end
#=============================================================================
# 复杂装备模块
#=============================================================================
module Game_Equip
#--------------------------------------------------------------------------
# ● 处理价格
#--------------------------------------------------------------------------
def self.setup_price(item, price)
item.price = $base_weapons.price
item.price += [(item.price * BasePrice).round, 1].max
item.price += price
end
#--------------------------------------------------------------------------
# ● 升级是否成功?
#--------------------------------------------------------------------------
def self.upgradesucceed?(lv)
return true if UpGrade_Absoluteness
new_lv = lv.nil? ? 1 : lv + 1
return false if new_lv > MaxLevel
return BaseSucceed**new_lv > rand(0)
end
#--------------------------------------------------------------------------
# ● 装备重生
# equip:装备
#--------------------------------------------------------------------------
def self.reini(equip)
return if equip.nil?
result = Marshal.load(Marshal.dump(equip))
result.base_id = equip.id
setup_price(result, 0)
case result
when RPG::Weapon
result.id = $data_weapons.size
##result.name += result.id.to_s
$data_weapons.push result
when RPG::Armor
result.id = $data_armors.size
##result.name += result.id.to_s
$data_armors.push result
end
return result
end
#--------------------------------------------------------------------------
# ● 直接指定装备等级
# equip:装备
# lv:等级
#--------------------------------------------------------------------------
def self.level(equip, lv)
equip.level = 1 if equip.level.nil?
n = lv - equip.level
## 等级更低时返回
return if n < 0
n.times{equip = self.upgrade(equip, true)}
return equip
end
#--------------------------------------------------------------------------
# ● 装备升级
# equip:装备
#--------------------------------------------------------------------------
def self.upgrade(equip, abs = false)
return unless abs || upgradesucceed?(equip.level)
case equip
when RPG::Weapon
return if equip.level == MaxLevel
equip.level += 1
if equip.level == 2
equip.name.concat "(Lv.2)"
elsif equip.level > 2
equip.name.sub!(/\\(Lv\\.(+)\\)/) {"(Lv.#{equip.level})"}
end
equip.atk += [(equip.atk * BaseAbility).round, 1].max
setup_price(equip, 0)
when RPG::Armor
return if equip.level == MaxLevel
equip.level += 1
if equip.level == 2
equip.name.concat "(Lv.2)"
elsif equip.level > 2
equip.name.sub!(/\\(Lv\\.(+)\\)/) {"(Lv.#{equip.level})"}
end
equip.def += [(equip.def * BaseAbility).round, 1].max
setup_price(equip, 0)
end
return equip
end
end
#==============================================================================
# ■ RPG::BaseItem
#==============================================================================
module RPG
class BaseItem
def initialize
@id = 0
@name = ""
@icon_index = 0
@description = ""
@note = ""
@base_id = 0
@level = 1
end
attr_accessor :id
attr_accessor :name
attr_accessor :icon_index
attr_accessor :description
attr_accessor :note
attr_accessor :base_id
attr_accessor :level
end
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 设置
# actor_id : 角色 ID
#--------------------------------------------------------------------------
def setup(actor_id)
actor = $data_actors
@actor_id = actor_id
@name = actor.name
@character_name = actor.character_name
@character_index = actor.character_index
@face_name = actor.face_name
@face_index = actor.face_index
@class_id = actor.class_id
@weapon_id = actor.weapon_id
@armor1_id = actor.armor1_id
@armor2_id = actor.armor2_id
@armor3_id = actor.armor3_id
@armor4_id = actor.armor4_id
@level = actor.initial_level
@exp_list = Array.new(101)
make_exp_list
@exp = @exp_list[@level]
@skills = []
for i in self.class.learnings
learn_skill(i.skill_id) if i.level <= @level
end
clear_extra_values
recover_all
## 生成新装备id
reset_equip_id
end
#--------------------------------------------------------------------------
# ● 装备重设
#--------------------------------------------------------------------------
def reset_equip_id
if @weapon_id != 0
item = Game_Equip.reini($base_weapons[@weapon_id])
unless item.nil?
$data_weapons.push item
@weapon_id = item.id
end
end
if @armor1_id != 0
if two_swords_style####two_hands_legal?
item = Game_Equip.reini($base_weapons[@armor1_id])
unless item.nil?
$data_weapons.push item
@armor1_id = item.id
end
else
item = Game_Equip.reini($base_armors[@armor1_id])
unless item.nil?
$data_armors.push item
@armor1_id = item.id
end
end
end
if @armor2_id != 0
item = $base_armors[@armor2_id]
unless item.nil?
item = Game_Equip.reini(item)
$data_armors.push item
@armor2_id = item.id
end
end
if @armor3_id != 0
item = $base_armors[@armor3_id]
unless item.nil?
item = Game_Equip.reini(item)
$data_armors.push item
@armor3_id = item.id
end
end
if @armor4_id != 0
item = $base_armors[@armor4_id]
unless item.nil?
item = Game_Equip.reini(item)
$data_armors.push item
@armor4_id = item.id
end
end
end
#--------------------------------------------------------------------------
# ● 判断是否可以装备
# item : 物品
# base : 是否读取母版数据
#--------------------------------------------------------------------------
def equippable?(item, base = true)
id = base ? item.base_id : item.id
if item.is_a?(RPG::Weapon)
return self.class.weapon_set.include?(id)
elsif item.is_a?(RPG::Armor)
return false if two_swords_style and item.kind == 0
return self.class.armor_set.include?(id)
end
return false
end
end
#==============================================================================
# ■ Game_Party
#==============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# ● 判断持有的物品
# item : 物品
# include_equip : 包括装备品
#--------------------------------------------------------------------------
def has_item_by_base_id?(item, include_equip = false)
for i in items
return true if i.base_id == item.id
end
if include_equip
for actor in members
for e in actor.equips
return true if e.base_id == item.id
end
end
end
return false
end
#--------------------------------------------------------------------------
# ● 获得物品
# item : 物品
# n : 个数
#--------------------------------------------------------------------------
def gain_reini_item(item, n, include_equip = false)
if n < 0
lose_item(item, -n, include_equip = false)
else
case item
when RPG::Item
number = item_number(item)
@items = [.max, 99].min
when RPG::Weapon
for i in 0...n
w = Game_Equip.reini(item)
@weapons = 1
end
when RPG::Armor
for i in 0...n
a = Game_Equip.reini(item)
@armors = 1
end
end
end
end
#--------------------------------------------------------------------------
# ● 减少物品 (减少)
# item : 物品
# n : 个数
# include_equip : 包括装备品
#--------------------------------------------------------------------------
def lose_reini_item(item, n, include_equip = false)
number = item_number(item)
case item
when RPG::Item
@items = [.max, 99].min
when RPG::Weapon
@weapons = [.max, 99].min
when RPG::Armor
@armors = [.max, 99].min
end
n -= number
if include_equip and n > 0
for actor in members
while n > 0 and actor.equips.include?(item)
actor.discard_equip(item)
n -= 1
end
end
end
end
end
#==============================================================================
# ■ Game_Troop
#==============================================================================
class Game_Troop < Game_Unit
#--------------------------------------------------------------------------
# ● 敌人角色名称后的文字表
#--------------------------------------------------------------------------
LETTER_TABLE = [ 'A','B','C','D','E','F','G','H','I','J',
'K','L','M','N','O','P','Q','R','S','T',
'U','V','W','X','Y','Z']
#--------------------------------------------------------------------------
# ● 生成掉落物品队列
#--------------------------------------------------------------------------
def make_drop_items
drop_items = []
for enemy in dead_members
for di in
next if di.kind == 0
next if rand(di.denominator) != 0
if di.kind == 1
drop_items.push($data_items)
elsif di.kind == 2
drop_items.push($base_weapons)
elsif di.kind == 3
drop_items.push($base_armors)
end
end
end
return drop_items
end
end
#==============================================================================
# ■ Game_Interpreter
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# ● 计算操作的值
# operation : 操作 (0:增加 1:减少)
# operand_type : 运算域类型 (0:常量 1:变量)
# operand : 运算域 (数值为变量 ID)
#--------------------------------------------------------------------------
def operate_value(operation, operand_type, operand)
if operand_type == 0
value = operand
else
value = $game_variables
end
if operation == 1
value = -value
end
return value
end
#--------------------------------------------------------------------------
# ● 条件分歧
#--------------------------------------------------------------------------
def command_111
result = false
case @params
when 0# 开关
result = ($game_switches[@params] == (@params == 0))
when 1# 变量
value1 = $game_variables[@params]
if @params == 0
value2 = @params
else
value2 = $game_variables[@params]
end
case @params
when 0# 相等
result = (value1 == value2)
when 1# 大于等于
result = (value1 >= value2)
when 2# 小于等于
result = (value1 <= value2)
when 3# 大于
result = (value1 > value2)
when 4# 小于
result = (value1 < value2)
when 5# 不等于
result = (value1 != value2)
end
when 2# 自我开关
if @original_event_id > 0
key = [@map_id, @original_event_id, @params]
if @params == 0
result = ($game_self_switches == true)
else
result = ($game_self_switches != true)
end
end
when 3# 计时器
if $game_system.timer_working
sec = $game_system.timer / Graphics.frame_rate
if @params == 0
result = (sec >= @params)
else
result = (sec <= @params)
end
end
when 4# 角色
actor = $game_actors[@params]
if actor != nil
case @params
when 0# 是同伴
result = ($game_party.members.include?(actor))
when 1# 姓名
result = (actor.name == @params)
when 2# 特技
result = (actor.skill_learn?($data_skills[@params]))
when 3# 武器
## 判断是否符合母版id
actor.weapons.each do |weapon|
if weapon.base_id == @params
result = true
break
end
end
when 4# 防具
## 判断是否符合母版id
actor.armors.each do |armor|
if armor.base_id == @params
result = true
break
end
end
when 5# 状态
result = (actor.state?(@params))
end
end
when 5# 敌方角色
enemy = $game_troop.members[@params]
if enemy != nil
case @params
when 0# 出现
result = (enemy.exist?)
when 1# 状态
result = (enemy.state?(@params))
end
end
when 6# 角色
character = get_character(@params)
if character != nil
result = (character.direction == @params)
end
when 7# 金钱
if @params == 0
result = ($game_party.gold >= @params)
else
result = ($game_party.gold <= @params)
end
when 8# 物品
result = $game_party.has_item?($data_items[@params])
when 9# 武器
result = $game_party.has_item_by_base_id?($base_weapons[@params], @params)
when 10# 防具
result = $game_party.has_item_by_base_id?($base_armors[@params], @params)
when 11# 按钮
result = Input.press?(@params)
when 12# 脚本
result = eval(@params)
when 13# 交通工具
result = ($game_player.vehicle_type == @params)
end
@branch[@indent] = result # 将判断结果放置在缓存中
if @branch[@indent] == true
@branch.delete(@indent)
return true
end
return command_skip
end
#--------------------------------------------------------------------------
# ● 计算装备操作的值
# operand_type : 运算域类型 (0:常量 1:变量)
# operand : 运算域 (数值为变量 ID)
#--------------------------------------------------------------------------
def opera_equip_value(operation, operand_type, operand)
if operand_type == 0
value = operand
else
value = $game_variables
end
return value
end
#--------------------------------------------------------------------------
# ● 增减武器
#--------------------------------------------------------------------------
def command_127
value = operate_value(@params, @params, @params)
if @params == 0
$game_party.gain_reini_item($base_weapons[@params], value.abs, @params)
else
$game_party.lose_reini_item($base_weapons[@params], value.abs, @params)
end
return true
end
#--------------------------------------------------------------------------
# ● 增减防具
#--------------------------------------------------------------------------
def command_128
value = operate_value(@params, @params, @params)
if @params == 0
$game_party.gain_reini_item($base_armors[@params], value.abs, @params)
else
$game_party.lose_reini_item($base_armors[@params], value.abs, @params)
end
return true
end
#--------------------------------------------------------------------------
# ● 更改装备
#--------------------------------------------------------------------------
def command_319
actor = $game_actors[@params]
if actor != nil
actor.change_equip_by_id(@params, @params)
end
return true
end
end
#==============================================================================
# ■ Window_ShopBuy
#==============================================================================
class Window_ShopBuy < Window_Selectable
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
@data = []
for goods_item in @shop_goods
case goods_item
when 0
item = $base_items]
when 1
item = $base_weapons]
when 2
item = $base_armors]
end
if item != nil
@data.push(item)
end
end
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
end
#==============================================================================
# ■ Window_ShopStatus
#==============================================================================
class Window_ShopStatus < Window_Base
#--------------------------------------------------------------------------
# ● 描绘角色现在装备的能力值变化
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
#--------------------------------------------------------------------------
def draw_actor_parameter_change(actor, x, y)
return if @item.is_a?(RPG::Item)
enabled = actor.equippable?(@item, false)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(x, y, 200, WLH, actor.name)
if @item.is_a?(RPG::Weapon)
item1 = weaker_weapon(actor)
elsif actor.two_swords_style and @item.kind == 0
item1 = nil
else
item1 = actor.equips
end
if enabled
if @item.is_a?(RPG::Weapon)
atk1 = item1 == nil ? 0 : item1.atk
atk2 = @item == nil ? 0 : @item.atk
change = atk2 - atk1
else
def1 = item1 == nil ? 0 : item1.def
def2 = @item == nil ? 0 : @item.def
change = def2 - def1
end
self.contents.draw_text(x, y, 200, WLH, sprintf("%+d", change), 2)
end
draw_item_name(item1, x, y + WLH, enabled)
end
end
#==============================================================================
# ■ Window_ScrEquip
#==============================================================================
class Window_ScrEquip < Window_Selectable
attr_accessor :equip_only
#--------------------------------------------------------------------------
# ● 初始化对象
# x : 窗口的 X 坐标
# y : 窗口的 Y 坐标
# width: 窗口的宽
# height : 窗口的高
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
@column_max = 1
@equip_only = true
refresh
end
#--------------------------------------------------------------------------
# ● 取得物品
#--------------------------------------------------------------------------
def item
return @data
end
#--------------------------------------------------------------------------
# ● 显示是否可以使用物品
# item : 物品
#--------------------------------------------------------------------------
def enable?(item)
return true
end
#--------------------------------------------------------------------------
# ● 列表中包含的物品
# item : 物品
#--------------------------------------------------------------------------
def include?(item)
return true if item == nil
if @equip_only
return false if item.is_a? RPG::Item
else
return false unless item.is_a? RPG::Item
end
return true
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.index = 0
@data = []
for item in $game_party.items
next unless include?(item)
@data.push(item)
end
@data.push(nil) if include?(nil)
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data
if item != nil
number = $game_party.item_number(item)
rect.width -= 4
draw_item_name(item, rect.x, rect.y)
self.contents.draw_text(rect, sprintf(":%2d", number), 2)
end
end
#--------------------------------------------------------------------------
# ● 更新帮助文本
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(item == nil ? "" : item.description)
end
end
#==============================================================================
# ■ Window_DestEquip #equip add clear items
#==============================================================================
class Window_DestEquip < Window_Base
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :equip
attr_reader :items
#--------------------------------------------------------------------------
# ● 初始化对象
# x : 窗口的 X 坐标
# y : 窗口的 Y 坐标
# width: 窗口的宽
# height : 窗口的高
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
clear
end
#--------------------------------------------------------------------------
# ● 添加物品
#--------------------------------------------------------------------------
def add(item, n = 1)
$game_party.lose_item(item, n)
if @index == -1
@equip = item
else
number = @items.to_i
@items = [.max, 99].min
end
@index += 1
draw_item(item, n)
end
#--------------------------------------------------------------------------
# ● 清除物品
#--------------------------------------------------------------------------
def clear
@equip = nil
@items = {}
@index = -1
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0,0,self.contents.width-16,WLH,"请放入升级装备:")
self.contents.draw_text(0,WLH*2,self.contents.width-16,WLH,"请放入炼制物品:")
end
#--------------------------------------------------------------------------
# ● 归还物品
#--------------------------------------------------------------------------
def revert
$game_party.gain_item(@equip, 1)
@items.each{|i,n| $game_party.gain_item(i, n)}
clear
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(item, n)
rect = Rect.new(4,WLH+WLH*@index,self.contents.width-8, WLH)
rect.y += WLH if @index >0
##self.contents.clear_rect(rect)
if item != nil
##rect.width -= 4
draw_item_name(item, rect.x, rect.y)
self.contents.draw_text(rect, sprintf(":%2d", n), 2)
end
end
#--------------------------------------------------------------------------
# ● 更新帮助文本
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(item == nil ? "" : item.description)
end
end
#==============================================================================
# ■ Window_EquipNumber
#==============================================================================
class Window_EquipNumber < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对象
# x : 窗口的 X 坐标
# y : 窗口的 Y 坐标
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 272, 304)
@item = nil
@max = 1
@number = 1
end
#--------------------------------------------------------------------------
# ● 设置物品、最大个数
#--------------------------------------------------------------------------
def set(item, max)
@item = item
@max = max
@number = 1
refresh
end
#--------------------------------------------------------------------------
# ● 设置输入个数
#--------------------------------------------------------------------------
def number
return @number
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
y = 96
self.contents.clear
draw_item_name(@item, 0, y)
self.contents.font.color = normal_color
self.contents.draw_text(212-32, y, 20, WLH, "×")
self.contents.draw_text(248-32, y, 20, WLH, @number, 2)
self.cursor_rect.set(244-32, y, 28, WLH)
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
if self.active
last_number = @number
if Input.repeat?(Input::RIGHT) and @number < @max
@number += 1
end
if Input.repeat?(Input::LEFT) and @number > 1
@number -= 1
end
if Input.repeat?(Input::UP) and @number < @max
@number = [@number + 10, @max].min
end
if Input.repeat?(Input::DOWN) and @number > 1
@number = [@number - 10, 1].max
end
if @number != last_number
Sound.play_cursor
refresh
end
end
end
end
#==============================================================================
# ■ Scene_UpEquip
#==============================================================================
class Scene_UpEquip < Scene_Base
include Game_Equip
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
create_menu_background
create_command_window
@help_window = Window_Help.new
@gold_window = Window_Gold.new(96+16, 56)
@gold_window.opacity = 0
@scr_window = Window_ScrEquip.new(0,112,272,304)
@scr_window.active = true
@scr_window.help_window = @help_window
@dest_window = Window_DestEquip.new(272,56,272,304+56)
@number_window = Window_EquipNumber.new(0, 112)
@number_window.active = false
@number_window.visible = false
@result_window = Window_Base.new(56,56,384,80)
@result_window.active = false
@result_window.visible = false
end
#--------------------------------------------------------------------------
# ● 结束处理
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
dispose_command_window
@help_window.dispose
@gold_window.dispose
@scr_window.dispose
@dest_window.dispose
@number_window.dispose
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
update_menu_background
@help_window.update
@command_window.update
@gold_window.update
@scr_window.update
@dest_window.update
@number_window.update
if @command_window.active
@scr_window.contents_opacity = 128
@command_window.contents_opacity = 255
update_command_selection
elsif @scr_window.active
@scr_window.contents_opacity = 255
@command_window.contents_opacity = 128
update_item_selection
elsif @number_window.active
update_number_input
elsif @result_window.active
update_result_window
end
end
#--------------------------------------------------------------------------
# ● 生成指令窗口
#--------------------------------------------------------------------------
def create_command_window
s1 = "升级"
s2 = "退出"
@command_window = Window_Command.new(272, , 4, 0, 8)
@command_window.y = 56
@command_window.active = false
@command_window.contents_opacity = 128
end
#--------------------------------------------------------------------------
# ● 释放指令窗口
#--------------------------------------------------------------------------
def dispose_command_window
@command_window.dispose
end
#--------------------------------------------------------------------------
# ● 是否满足装备升级条件?
#--------------------------------------------------------------------------
def upgradeable?(equip)
return false if equip.nil?
if equip.is_a?(RPG::Weapon) || equip.is_a?(RPG::Armor) and equip.level.nil?
equip.level = 1
end
price = (equip.price * (GoldNeed ** equip.level)).round
return false if $game_party.gold < price
ItemsNeed.each do |id,n|
return false if @dest_window.items[$data_items].nil?
return false if @dest_window.items[$data_items] < n
end
## 扣钱
$game_party.lose_gold(price)
return true
end
#--------------------------------------------------------------------------
# ● 显示结果(包括处理金钱物品)
#--------------------------------------------------------------------------
def show_result
@result_window.active = true
@result_window.visible = true
###@scr_window.refresh
unless upgradeable?(@dest_window.equip)
@result_window.contents.clear
@result_window.contents.draw_text(0,0,352,24,"材料或金钱不足!", 1)
@result_window.contents.draw_text(0,24,352,24,"物品已自动归还.", 1)
@dest_window.revert
Sound.play_actor_collapse
## 直接返回
return
end
msg = Game_Equip.upgrade(@dest_window.equip)
case msg
when RPG::Weapon
s = "攻击力提升到(#{msg.atk})"
@result_window.contents.clear
@result_window.contents.draw_text(0, 0, 352, 24, "#{msg.name}升级成功!")
@result_window.contents.draw_text(4, 24, 352-4, 24, s)
$game_party.gain_item(msg, 1)
Sound.play_shop
when RPG::Armor
s = "防御力提升到(#{msg.def})"
@result_window.contents.clear
@result_window.contents.draw_text(0, 0, 352, 24, "#{msg.name}升级成功!")
@result_window.contents.draw_text(4, 24, 352-4, 24, s)
$game_party.gain_item(msg, 1)
Sound.play_shop
else
@result_window.contents.clear
@result_window.contents.draw_text(0,0,352,24,"升级失败, 物品已损坏!", 1)
Sound.play_actor_collapse
end
@dest_window.clear
end
#--------------------------------------------------------------------------
# ● 更新帮助文本
#--------------------------------------------------------------------------
def update_help(text)
@help_window.set_text(text)
end
#--------------------------------------------------------------------------
# ● 更新指令窗口
#--------------------------------------------------------------------------
def update_command_selection
case @command_window.index
when 0
update_help("确定键执行装备升级")
when 1
update_help("退出升级界面")
end
if Input.trigger?(Input::B)
## 重来
Sound.play_cancel
@scr_window.active = true
@command_window.active = false
elsif Input.trigger?(Input::C)
case @command_window.index
when 0# 升级
Sound.play_decision
@command_window.active = false
@scr_window.active = false
######### 显示升级结果,归还物品
show_result
when 1# 退出
Sound.play_decision
@dest_window.revert
$scene = Scene_Map.new
end
end
end
#--------------------------------------------------------------------------
# ● 更新选择物品
#--------------------------------------------------------------------------
def update_item_selection
if Input.trigger?(Input::B)
Sound.play_cancel
@command_window.active = true
@scr_window.active = false
###@help_window.set_text("")
return
end
if Input.trigger?(Input::C)
@item = @scr_window.item
number = $game_party.item_number(@item)
if @item == nil or number == 0
Sound.play_buzzer
else
Sound.play_decision
##### 传递物品给容器栏
if number > 1
@scr_window.active = false
@number_window.set(@item, number)
@number_window.active = true
@number_window.visible = true
else
Sound.play_shop
@dest_window.add(@scr_window.item, 1)
@scr_window.equip_only = false
@scr_window.refresh
end
end
end
end
#--------------------------------------------------------------------------
# ● 更新输入个数
#--------------------------------------------------------------------------
def update_number_input
if Input.trigger?(Input::B)
cancel_number_input
elsif Input.trigger?(Input::C)
decide_number_input
end
end
#--------------------------------------------------------------------------
# ● 更新结果窗体
#--------------------------------------------------------------------------
def update_result_window
if Input.trigger?(Input::B) or Input.trigger?(Input::C)
Sound.play_decision
@scr_window.equip_only = true
@scr_window.refresh
@scr_window.active = true
@result_window.active = false
@result_window.visible = false
end
end
#--------------------------------------------------------------------------
# ● 取消输入个数
#--------------------------------------------------------------------------
def cancel_number_input
Sound.play_cancel
@number_window.active = false
@number_window.visible = false
@scr_window.active = true
@scr_window.visible = true
end
#--------------------------------------------------------------------------
# ● 确定输入个数
#--------------------------------------------------------------------------
def decide_number_input
Sound.play_shop
@number_window.active = false
@number_window.visible = false
@dest_window.add(@item, @number_window.number)
@scr_window.equip_only = false
@scr_window.refresh
@scr_window.active = true
end
end
#==============================================================================
# ■ Scene_File
#==============================================================================
class Scene_File < Scene_Base
#--------------------------------------------------------------------------
# ● 写入存档数据
# file : 写入文件用对象 (已经打开)
#--------------------------------------------------------------------------
def write_save_data(file)
characters = []
for actor in $game_party.members
characters.push()
end
$game_system.save_count += 1
$game_system.version_id = $data_system.version_id
@last_bgm = RPG::BGM::last
@last_bgs = RPG::BGS::last
Marshal.dump(characters, file)
Marshal.dump(Graphics.frame_count, file)
Marshal.dump(@last_bgm, file)
Marshal.dump(@last_bgs, file)
Marshal.dump($game_system, file)
Marshal.dump($game_message, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches,file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
Marshal.dump($data_weapons, file)
Marshal.dump($data_armors, file)
end
#--------------------------------------------------------------------------
# ● 读取存档数据
# file : 读取文件用对象 (已经打开)
#--------------------------------------------------------------------------
def read_save_data(file)
characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)
@last_bgm = Marshal.load(file)
@last_bgs = Marshal.load(file)
$game_system = Marshal.load(file)
$game_message = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches= Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
$data_weapons = Marshal.load(file)
$data_armors = Marshal.load(file)
if $game_system.version_id != $data_system.version_id
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
end
end
#==============================================================================
# ■ Scene_Shop
#==============================================================================
class Scene_Shop < Scene_Base
#--------------------------------------------------------------------------
# ● 确定输入个数
#--------------------------------------------------------------------------
def decide_number_input
Sound.play_shop
@number_window.active = false
@number_window.visible = false
case @command_window.index
when 0# 购买
$game_party.lose_gold(@number_window.number * @item.price)
$game_party.gain_reini_item(@item, @number_window.number)
@gold_window.refresh
@buy_window.refresh
@status_window.refresh
@buy_window.active = true
@buy_window.visible = true
when 1# 卖出
$game_party.gain_gold(@number_window.number * (@item.price / 2))
$game_party.lose_reini_item(@item, @number_window.number)
@gold_window.refresh
@sell_window.refresh
@status_window.refresh
@sell_window.active = true
@sell_window.visible = true
@status_window.visible = false
end
end
end
#==============================================================================
# ■ Scene_Title
#==============================================================================
class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# ● 载入数据库
#--------------------------------------------------------------------------
def load_database
$data_actors = load_data("Data/Actors.rvdata")
$data_classes = load_data("Data/Classes.rvdata")
$data_skills = load_data("Data/Skills.rvdata")
$data_items = load_data("Data/Items.rvdata")
$base_weapons = load_data("Data/Weapons.rvdata")
$base_armors = load_data("Data/Armors.rvdata")
$data_enemies = load_data("Data/Enemies.rvdata")
$data_troops = load_data("Data/Troops.rvdata")
$data_states = load_data("Data/States.rvdata")
$data_animations = load_data("Data/Animations.rvdata")
$data_common_events = load_data("Data/CommonEvents.rvdata")
$data_system = load_data("Data/System.rvdata")
$data_areas = load_data("Data/Areas.rvdata")
$data_weapons =
$data_armors =
end
#--------------------------------------------------------------------------
# ● 载入战斗测试用的数据库
#--------------------------------------------------------------------------
def load_bt_database
$data_actors = load_data("Data/BT_Actors.rvdata")
$data_classes = load_data("Data/BT_Classes.rvdata")
$data_skills = load_data("Data/BT_Skills.rvdata")
$data_items = load_data("Data/BT_Items.rvdata")
$data_weapons = load_data("Data/BT_Weapons.rvdata")
$data_armors = load_data("Data/BT_Armors.rvdata")
$data_enemies = load_data("Data/BT_Enemies.rvdata")
$data_troops = load_data("Data/BT_Troops.rvdata")
$data_states = load_data("Data/BT_States.rvdata")
$data_animations = load_data("Data/BT_Animations.rvdata")
$data_common_events = load_data("Data/BT_CommonEvents.rvdata")
$data_system = load_data("Data/BT_System.rvdata")
$base_weapons = $data_weapons
$base_armors = $data_armors
end
end
页:
[1]