赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 2557 |
最后登录 | 2013-10-5 |
在线时间 | 1 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 51
- 在线时间
- 1 小时
- 注册时间
- 2010-7-21
- 帖子
- 180
|
2楼
楼主 |
发表于 2010-7-22 13:16:37
|
只看该作者
- #=============================================================================
- #★Zhong RMVX 半即时战斗系统 1.03b版★
- #-----------------------------------------------------------------------------
- #★Scene_CP核心部分参考自 : 神思 《战斗真位移》战斗系统
- #★作者: Zhong_zw
- #★联系方式: 66rpg.com论坛短信 或 [email protected]
- #★游戏中如若引用本脚本,请保留以上信息,并作相关说明.
- #☆如若转载本脚本请联系本人☆
- #=============================================================================
- #=============================================================================
- #☆1.01版修正问题:
- #1、物品、特技窗口选择我方人物时,头像重叠
- #2、连续伤害及自动回复效果无效。
- #☆1.02版修正问题:
- #1、减少刷新次数,提高速度
- #2、修正被打击时有可能退到cp槽外
- #☆1.02a版修正问题:
- #1、复活问题.
- #2、头像刷新问题.
- #☆1.03版更新内容:
- #1、地图名称与战斗背景的对应关系可在哈希表中设置
- #2、如无相应战斗背景直接采用默认战斗背景
- #3、角色CP图缺失时,用角色相应行走图代替
- #☆1.03a版更新内容:
- #1、物品经验得失窗口有时图标显示错误的问题
- #★注:旧版本的只要把脚本中“class Window_egi<Window_Base”这个类完整的覆盖原来就行了。
- #☆1.03b版更新内容:
- #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文件夹里储存名为"光标"的图片作为选择光标.
- #11、B_B_CONFIG = true 时地图与战斗背景的命名关系写在BATTLE_BACK 这个数组里,
- #B_B_CONFIG = false时,和战斗背景和以前的命名方式相同。
- #12、战斗背景文件缺失时,用回默认战斗背景。
- #★队伍战斗事件的设置说明★:
- #13、除“回合”和“回合结束”条件外,其他事件条件设置与默认系统相同。
- #14、关于角色回合的定义:角色回合是指每个角色各自独有一个回合属性,角色CP值每满一次就增加一个回合,角色间的回合相互独立。
- #15、关于角色回合条件设置,参照工程目录下的“说明图片”文件夹的图片1、2,3对各个框进行设置,实现两种回合条件的设置
- # 步骤如下:
- # 一、一般回合条件设置,即当角色回合等于或大于小于某个数值时就在回合开始前或后执行
- # 事件。
- # 1. 参看“说明图片”文件夹中的图1对各个框的定义。
- # 2. 在事件条件设置窗口中勾上“回合结束”,即打开回合条件设置开关。
- # 3. 勾上“回合数”,在“回合关系参数”框里输入“回合关系参数”。★注:旁边的那个框值为0
- # 回合关系参数取值:
- # 0 为当 "角色回合"等于"回合参数"值时,回合开始前执行。
- # 1 为当 "角色回合"大于"回合参数"值时,回合开始前执行。
- # 2 为当 "角色回合"小于"回合参数"值时,回合开始前执行。
- # 3 为当 "角色回合"等于"回合参数"值时,回合进行后执行。
- # 4 为当 "角色回合"大于"回合参数"值时,回合进行后执行。
- # 5 为当 "角色回合"小于"回合参数"值时,回合进行后执行。
- #
- # 4.选择“回合对象”,勾上相应的"敌角色"或"角色",选择相应对象。
- # 5.在“回合参数”框上填入相关数值。
- # 二、循环回合条件设置,即当角色回合等于某个回合后执行事件,以后每隔N个回合在执行一次。
- # 1. 参看“说明图片”文件夹中的图2对各个框的定义。
- # 2.设置事件执行时机,即回合执行前或后。
- # 对“事件执行时机参数”进行设置,取值如下:
- # 0 为回合执行前。
- # 1 为回合执行后。
- # 3.设置"间隔参数",即当达到一定回合数后,每隔N个回合再执行事件的间隔。
- # 4.设置相应“回合对象”
- # 5.设置“回合参数”
- # 6.如图3设置,把“间隔”设为回合。
- #16、附赠角色显示动画函数:
- # $game_troop.interpreter.add_aa(动画对象,动画id)
- # "动画对象"取值:角色id或-1,-1时即全体动画
- # 在事件的"脚本"中调用就可以了!
- #
- #
- #=============================================================================
- #=============================================================================
- #★战斗背景设置及其他功能开关
- #=============================================================================
- BATTLE_BACK = {"汪洋"=>"草地","树林"=>"山岛森林"} #地图名称与战斗背景对应关系,命名方式:地图名或区域=>战斗背景名
- B_B_CONFIG = true #是否启用地图名称与战斗背景对应关系功能
- #"汪洋"=>"草地1",
- #================================================
- #★战斗者类
- #================================================
- class Game_Battler
- attr_accessor :cp
- attr_accessor :cp_total
- #================================================
- attr_accessor :Battler_turn #角色单独的回合数
- attr_accessor :turn_start #角色回合状态 0:回合结束或非角色回合 1:角色回合 3:角色回合准备
- #================================================
- 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 oldinitialize initialize
- def initialize
- @cp = 0
- @cp_total = false
- @cp_turn = 0
- @damage = nil
- @damage_pop = false
- @act_status = 0
- @slip_damage = 0
- @auto_damage = 0
- @Battler_turn = 0
- @turn_start = 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
- alias oldinitialize initialize
- def initialize
- oldinitialize
- @enemy_battler = []
- end
- #--------------------------------------------------------------------------
- # ● 判断是否符合战斗事件 (页) 条件
- # page : 战斗事件页
- #--------------------------------------------------------------------------
- def conditions_met?(page)
- c = page.condition
- if not c.turn_ending and not c.turn_valid and not c.enemy_valid and
- not c.actor_valid and not c.switch_valid
- return false # 未设置条件…不执行
- end
- if @event_flags
- return false # 已执行
- end
- if c.enemy_valid # 敌方角色
- enemy = $game_troop.members[c.enemy_index]
- return false if enemy == nil
- if c.turn_ending == false #
- return false if enemy.hp * 100.0 / enemy.maxhp > c.enemy_hp
- elsif c.turn_ending and not c.turn_valid
- return false if enemy.Battler_turn != c.enemy_hp or enemy.cp != 100
- elsif c.turn_ending and c.turn_valid
- a = c.turn_a
- b = c.turn_b
- if b>0
- return false if (a==0 and ( c.enemy_hp < 1 or enemy.Battler_turn < c.enemy_hp or enemy.Battler_turn % b != c.enemy_hp % b or enemy.cp != 100 or enemy.turn_start != 1))
- return false if (a==1 and ( c.enemy_hp < 1 or enemy.Battler_turn < c.enemy_hp or enemy.Battler_turn % b != c.enemy_hp % b or enemy.cp != 100 or enemy.turn_start != 0))
- else
- if a == 0 #回合开始时 等于
- return false if ( enemy.Battler_turn != c.enemy_hp or enemy.cp != 100 or enemy.turn_start != 1)
-
- elsif a == 1 # #回合开始时 回合数大于
- return false if (enemy.Battler_turn <= c.enemy_hp or enemy.cp != 100 or enemy.turn_start != 1)
- elsif a == 2 #回合开始时 回合数小于
- return false if (enemy.Battler_turn >= c.enemy_hp or enemy.cp != 100 or enemy.turn_start != 1)
- elsif a == 3 #回合结束时 回合数等于
- return false if (enemy.Battler_turn != c.enemy_hp or enemy.cp != 100 or enemy.turn_start != 0)
- elsif a == 4 #回合结束时 回合数大于
- return false if (enemy.Battler_turn <= c.enemy_hp or enemy.cp != 100 or enemy.turn_start != 0)
- elsif a == 5 # 回合结束时 回合数小于
- return false if (enemy.Battler_turn >= c.enemy_hp or enemy.cp != 100 or enemy.turn_start != 0)
- end
- end
- end
- end
- if c.actor_valid # 角色
- actor = $game_actors[c.actor_id]
- return false if actor == nil
- if c.turn_ending == false #
- return false if actor.hp * 100.0 / actor.maxhp > c.actor_hp
- elsif c.turn_ending and not c.turn_valid
- return false if actor.Battler_turn != c.actor_hp or actor.cp != 100
- elsif c.turn_ending and c.turn_valid
- a = c.turn_a
- b = c.turn_b
- if b > 0
- return false if (a== 0 and ( c.actor_hp < 1 or actor.Battler_turn < c.actor_hp or actor.Battler_turn % b != c.actor_hp % b or actor.cp != 100 or actor.turn_start != 1))
- return false if (a== 1 and ( c.actor_hp < 1 or actor.Battler_turn < c.actor_hp or actor.Battler_turn % b != c.actor_hp % b or actor.cp != 100 or actor.turn_start != 0))
- else
- if a == 0 # 等于
- return false if (actor.Battler_turn != c.actor_hp or actor.cp != 100 or actor.turn_start != 1)
-
- elsif a == 1 #回合开始时 回合数大于
- return false if (actor.Battler_turn <= c.actor_hp or actor.cp != 100 or actor.turn_start != 1)
- elsif a == 2 #回合开始时 回合数小于
- return false if (actor.Battler_turn >= c.actor_hp or actor.cp != 100 or actor.turn_start != 1)
- elsif a == 3 #回合结束时 回合数等于
- return false if (actor.Battler_turn != c.actor_hp or actor.cp != 100 or actor.turn_start != 0)
- elsif a == 4 #回合结束时 回合数大于
- return false if (actor.Battler_turn <= c.actor_hp or actor.cp != 100 or actor.turn_start != 0)
- elsif a == 5 #回合结束时 回合数小于
- return false if (actor.Battler_turn >= c.actor_hp or actor.cp != 100 or actor.turn_start != 0)
- end
- end
- end
-
- end
- if c.switch_valid # 开关
- return false if $game_switches[c.switch_id] == false
- end
- return true # 符合条件
- end
- #--------------------------------------------------------------------------
- # ● 增加回合
- #--------------------------------------------------------------------------
- def increase_turn
- for page in troop.pages
- if page.span == 1
- @event_flags= false
- end
- end
- #@turn_count += 1
- 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 = {}
- @walk_count = 0
- for battler in $game_party.members + $game_troop.members
- @all_agi += battler.agi
- @cp_battler[battler] = Sprite_cpbattler.new
- if battler.is_a?(Game_Actor)
- name = battler.id.to_s + "_cp"
- if FileTest.exist?("Graphics/system/#{name}.jpg") or FileTest.exist?("Graphics/system/#{name}.png") or FileTest.exist?("Graphics/system/#{name}.bmp")
- bitmap = Bitmap.new("Graphics/system/#{name}")
- rect = bitmap.rect
- @cp_battler[battler].bitmap = bitmap
- else
-
-
- bitmap = Bitmap.new("Graphics/Characters/#{battler.character_name}")
- sign = battler.character_name[/^[\!\$]./]
- if sign != nil and sign.include?(')
- cw = bitmap.width / 3
- ch = bitmap.height / 4
-
- else
- cw = bitmap.width / 12
- ch = bitmap.height / 8
-
- end
- n = battler.character_index
- rect = Rect.new((n%4*3+1)*cw, (n/4*4+2)*ch, cw, ch)
-
- @cp_battler[battler].bitmap = Bitmap.new(cw,ch)
- end
-
-
- @cp_battler[battler].bitmap.blt(0, 0,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[battler].bitmap = Bitmap.new("Graphics/system/#{name}")
- else
- @cp_battler[battler].bitmap = Bitmap.new("Graphics/system/敌人cp")
- end
- @cp_battler[battler].bitmap.blt(80,60, @cp_battler[battler].bitmap, @cp_battler[battler].bitmap.rect)
- end
- @cp_battler[battler].z = 101
- @cp_battler[battler].visible = false
-
- end
- end
-
- #===========================================
-
-
-
-
- #===========================================
-
-
- def update
-
- return if @stop
-
-
- for battler in $game_party.members + $game_troop.members
- if (@cp_battler[battler].disposed? or @cp_battler[battler].opacity == 0) and battler.dead?
- @cp_battler.delete(@cp_battler[battler])
- next
- end
- if battler.dead?
- if @cp_battler.include?(battler)
- @cp_battler[battler].collapse = true
- end
- battler.cp = 0
- next
- end
- next if @cp_battler[battler].disposed?
- battler.cp = [[battler.cp + BATTLE_SPEED*10*battler.agi / @all_agi,0].max,battler.maxcp].min if battler.movable?
- battler.cp_turn = [[battler.cp_turn+BATTLE_SPEED*10*battler.agi / @all_agi, 0].max,battler.maxcp].min
- if battler.cp == battler.maxcp
- #============================
- #☆设置战斗者处于回合准备状态
- #============================
- battler.turn_start = 3
- #============================
- if battler.is_a?(Game_Actor)
- name = battler.id.to_s + "_a_cp"
- if FileTest.exist?("Graphics/system/#{name}.jpg") or FileTest.exist?("Graphics/system/#{name}.png") or FileTest.exist?("Graphics/system/#{name}.bmp")
- bitmap = Bitmap.new("Graphics/system/#{name}")
- rect = bitmap.rect
- @cp_battler[battler].bitmap = bitmap
- else
-
- bitmap = Bitmap.new("Graphics/Characters/#{battler.character_name}")
- sign = battler.character_name[/^[\!\$]./]
- if sign != nil and sign.include?(')
- cw = bitmap.width / 3
- ch = bitmap.height / 4
- else
- cw = bitmap.width / 12
- ch = bitmap.height / 8
- end
- n = battler.character_index
-
- rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
-
- @cp_battler[battler].bitmap = Bitmap.new(cw,ch)
-
- end
-
- @cp_battler[battler].bitmap.blt(0,0,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[battler].bitmap = Bitmap.new("Graphics/system/#{name}")
- else
- @cp_battler[battler].bitmap = Bitmap.new("Graphics/system/a_敌人cp")
- end
- @cp_battler[battler].bitmap.blt(80,60, @cp_battler[battler].bitmap, @cp_battler[battler].bitmap.rect)
- end
- @cp_battler[battler].z = 101
- battler.cp_total = true
-
- elsif battler.cp_total == true
- if battler.is_a?(Game_Actor)
- name = battler.id.to_s + "_cp"
- if FileTest.exist?("Graphics/system/#{name}.jpg") or FileTest.exist?("Graphics/system/#{name}.png") or FileTest.exist?("Graphics/system/#{name}.bmp")
- bitmap = Bitmap.new("Graphics/system/#{name}")
- rect = bitmap.rect
- @cp_battler[battler].bitmap = bitmap
- else
-
- bitmap = Bitmap.new("Graphics/Characters/#{battler.character_name}")
- sign = battler.character_name[/^[\!\$]./]
- if sign != nil and sign.include?(')
- cw = bitmap.width / 3
- ch = bitmap.height / 4
- else
- cw = bitmap.width / 12
- ch = bitmap.height / 8
- end
- n = battler.character_index
- rect = Rect.new((n%4*3+1)*cw, (n/4*4+2)*ch, cw, ch)
-
- @cp_battler[battler].bitmap = Bitmap.new(cw,ch)
-
-
- end
-
- @cp_battler[battler].bitmap.blt(0,0,bitmap,rect)
-
-
- elsif
- 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[battler].bitmap = Bitmap.new("Graphics/system/#{name}")
-
- else
- @cp_battler[battler].bitmap = Bitmap.new("Graphics/system/敌人cp")
-
- end
-
- @cp_battler[battler].bitmap.blt(80,60, @cp_battler[battler].bitmap, @cp_battler[battler].bitmap.rect)
- end
- battler.cp_total = false
- @cp_battler[battler].z = 105
-
- end
-
- @cp_battler[battler].visible = true if @cp_battler[battler].visible == false
- @cp_battler[battler].opacity = 255
- @cp_battler[battler].y = 30
- @cp_battler[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 unless i.disposed?
- 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
- unless B_B_CONFIG
- @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
- else
- if BATTLE_BACK[name] != nil
- @battleback = Cache.battleback("#{BATTLE_BACK[name]}")if FileTest.exist?("Graphics/Battlebacks/#{BATTLE_BACK[name]}.jpg") or FileTest.exist?("Graphics/Battlebacks/#{BATTLE_BACK[name]}.jpg") or FileTest.exist?("Graphics/Battlebacks/#{BATTLE_BACK[name]}.bmp")
- end
- break
-
-
- end
- end
- end
- if @battleback == nil
- name = $game_map.name
- unless B_B_CONFIG
-
- @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")
- else
- if BATTLE_BACK[name] != nil
- @battleback = Cache.battleback("#{BATTLE_BACK[name]}")
- else
- @battleback = nil
- end
- end
- end
- $game_temp.background_bitmap = @battleback if @battleback != nil
- 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
- #=================================
-
- end
-
- #end
-
-
- end
- #--------------------------------------------------------------------------
- # ● 战斗事件处理
- #--------------------------------------------------------------------------
- def process_battle_event
- #============================
- if $game_message.texts != nil
- @message_window.visible = true
- end
- #=============================
- loop do
- return if judge_win_loss
- return if $game_temp.next_scene != nil
- $game_troop.interpreter.update
- $game_troop.setup_battle_event
- # wait_for_message
- process_action if $game_troop.forcing_battler != nil
- #======================================
- unless $game_troop.interpreter.running?
- if $game_message.texts != nil
- @message_window.clear
- @message_window.visible = false
- end
- return
- end
- #=======================================
- update_basic
- 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[i].act_status != -1
- $game_party.members[i].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[i].act_status != -1
- $game_party.members[i].act_status = -1
- end
- end
-
- @info_viewport.visible = true
- @status_window.refresh
- @now_face = -1
- @actor_command_window.index = 0
- @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
- #=================================
- #★角色回合事件处理
- #================================
- @active_battler.Battler_turn += 1
- @active_battler.turn_start = 1
- $game_troop.increase_turn
- process_battle_event
- 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
- #=========================================
- #★战斗结束cp条释放处理
- #=========================================
- def dispose_cp_battle
- #=============================
- @cp_battle.dispose
- #=============================
- for battler in $game_party.members + $game_troop.members
- battler.cp = 0
- #=========================
- battler.Battler_turn = 0
- battler.turn_start = 0
- #=========================
- end
-
- end
-
- #==========================================
- #★逃走处理
- #==========================================
- def process_escape
- @message_window.visible = false
- @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
- #=========================
- battler.Battler_turn = 0
- battler.turn_start = 0
- #=========================
- end
-
- battle_end(1)
- else
- @escape_ratio += 10
-
- #@active_battler.cp = 0
- @active_battler.action.clear
- next_actor
- end
- end
- #========================================
- #★胜利处理
- #========================================
- def process_victory
- @message_window.visible = false
- @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[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.Battler_turn = 0
- battler.turn_start = 0
- #=========================
- 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
- @message_window.visible = false
- @cp_battle.dispose
- for battler in $game_party.members + $game_troop.members
- #=========================
- battler.Battler_turn = 0
- battler.turn_start = 0
- #=========================
- battler.cp = 0
- end
- @info_viewport.visible = false
-
- battle_end(2)
-
- end
- #=====================================
- # ★ 执行画面转换
- #=====================================
- def update_scene_change
- case $game_temp.next_scene
- when "map"
- dispose_cp_battle
- call_map
- when "gameover"
- dispose_cp_battle
- call_gameover
- when "title"
- dispose_cp_battle
- call_title
- else
- $game_temp.next_scene = nil
- end
- 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
- #~ @active_battler.Battler_turn += 1
- #~ @active_battler.turn_start = 1
- #~ $game_troop.increase_turn
- #~ process_battle_event
- 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[i].act_status != 0
- $game_party.members[i].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.index = 0
- @actor_command_window.update
- @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
- #process_battle_event
- 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.is_a?(Game_Actor)
- @active_battler.Battler_turn += 1
- @active_battler.turn_start = 1
- $game_troop.increase_turn
- process_battle_event
- end
-
- 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
- @active_battler.turn_start = 0
- process_battle_event
- @active_battler.cp = 0
- 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)if a2 !=0
- Sound.play_enemy_attack if a1 == 0 and a2 == 0
- wait(15, true) if a1 == 0 and a2 == 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
- target.cp = [target.cp,0].max
- @cp_battle.cp_battler[target].x = [95+300*target.cp/target.maxcp,95].max
- if target.dead?
- @cp_battle.cp_battler[target].collapse = true
- target.cp = 0
- @cp_battle.cp_battler[target].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
- target.cp = [target.cp,0].max
- @cp_battle.cp_battler[target].x = [95 + 300*target.cp/target.maxcp,95].max
-
- if target.dead?
- @cp_battle.cp_battler[target].collapse = true
- target.cp = 0
- @cp_battle.cp_battler[target].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
- target.cp = [target.cp,0].max
- @cp_battle.cp_battler[target].x = [95+300*target.cp/target.maxcp,95].max
-
- #=====================================
- elsif target.mp_damage > 0
-
- #=====================================
- target.cp -= target.mp_damage/100
- target.cp = [target.cp,0].max
- @cp_battle.cp_battler[target].x = [95+300*target.cp/target.maxcp,95].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_selection start_skill_selection
- def start_skill_selection
- oldstart_skill_selection
- @skill_window.z = 3000
- @skill_window.help_window.z = 3000
-
- end
- alias oldstart_item_selection start_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[index]
- 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") or FileTest.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 ? [email protected] : @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 = 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[0] == nil ? 0 : weapons[0].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(/,/)[0]
- return animation1_id != nil ? animation1_id.to_i : 0
- end
- def animation2_id
- animation2_id = @note.split(/,/)[1]
- 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[itn.name]==nil
- @item_name[itn.name]=[0,""]
- @item_name[itn.name][1]=itn.icon_index
- m+=1
- end
- @item_name[itn.name][0] += 1
- 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
- i=0
- self.contents.font.size = 18
- self.contents.font.color = Color.new(255,255,255,255)
- for itn in @item_name
- draw_icon(itn[1][1] ,6 ,106+i*32 , true)
- self.contents.draw_text(30,106+i*32,64,32,itn[0] + " × "+ itn[1][0].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
- name = $game_map.name
- source = $game_temp.background_bitmap
- bitmap = Bitmap.new(640, 480)
- if BATTLE_BACK[name] != nil
-
- 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
- else
-
- bitmap.stretch_blt(bitmap.rect, source, source.rect)
- bitmap.radial_blur(90, 12)
- @battleback_sprite = Sprite.new(@viewport1)
- @battleback_sprite.bitmap = bitmap
- @battleback_sprite.ox = 320
- @battleback_sprite.oy = 240
- @battleback_sprite.x = 272
- @battleback_sprite.y = 176
- @battleback_sprite.wave_amp = 8
- @battleback_sprite.wave_length = 240
- @battleback_sprite.wave_speed = 120
- end
-
- end
- alias oldcreate_battlefloor create_battlefloor
- def create_battlefloor
- oldcreate_battlefloor
- @battlefloor_sprite.opacity = 0
- end
- end#class
- #==============================================================================
- # ■ Game_Interpreter
- #------------------------------------------------------------------------------
- # 执行事件命令的解释器。本类在 Game_Map 类、Game_Troop 类、
- # Game_Event 类的内部使用。
- #==============================================================================
- class Game_Interpreter
- #===========================================================================
- #☆角色显示动画方法
- #○range:动画影响范围,-1全体或相应角色id
- #●anim_id:动画id
- #===========================================================================
- def add_aa(range,anim_id)
- iterate_battler(1,range) do |battler|
- next unless battler.exist?
- battler.animation_id = anim_id
- end
-
- end #def
-
-
- end #class
-
复制代码 |
|