赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 0 |
经验 | 0 |
最后登录 | 2011-9-2 |
在线时间 | 1 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 150
- 在线时间
- 1 小时
- 注册时间
- 2011-9-1
- 帖子
- 1
|
本帖最后由 亿万星辰 于 2011-9-1 15:21 编辑
进入战斗时弹出:脚本'Sprite_Battler' 的347 行 发生了 NoMethodError undefined method -' for nil:NiClass
其中347行是: @sprite_contens.x = @battler.screen_x - 20
整个Sprite_Battler是:- #==============================================================================
- # ■ Sprite_Battler
- #------------------------------------------------------------------------------
- # 战斗显示用活动块。Game_Battler 类的实例监视、
- # 活动块的状态的监视。
- #==============================================================================
- class Sprite_Battler < RPG::Sprite
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_accessor :battler # 战斗者
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # 添加跳跃记录
- #--------------------------------------------------------------------------
- def initialize(viewport, battler = nil)
- super(viewport)
- @battler = battler
- @battler_visible = false
- @flash_shake_switch = true
- #........................................................................
- @once = 0
- @frame_index = -1
- @last_frame = 0
- #........................................................................
- @sprite_contens = Sprite.new#(viewport)
- @sprite_contens.x = 0
- @sprite_contens.y = 0
- @sprite_contens.bitmap = Bitmap.new(72,48)
- @battler_hp = 0
- @battler_sp = 0
- @name = ""
-
- end
- #--------------------------------------------------------------------------
- # ● 释放
- #--------------------------------------------------------------------------
- def dispose
- if self.bitmap != nil
- self.bitmap.dispose
- end
- #血条法条图形精灵
- if @sprite_contens != nil
- @sprite_contens.bitmap.dispose
- @sprite_contens.dispose
- @sprite_contens = nil
- end
- super
- end
- #..........................................................................
- #--------------------------------------------------------------------------
- # ● 胜利图
- #--------------------------------------------------------------------------
- def win
- if @battler_name != nil and not @battler.hidden and not @battler.dead?
- @battler.setup_battler_ani(@battler_name.split(/★/)[6], 1)
- end
- end
- #..........................................................................
- # 战斗中血条系列★★★★★★★★★★★★★★★★★★★★★★★★★★★
- #--------------------------------------------------------------------------
- # ● 战斗血条描绘
- #--------------------------------------------------------------------------
- def draw_battle_hp(actor, x, y)
- # 底图描绘
- battle_hp_bitmap = RPG::Cache.picture("战斗条框")
- src_rect = Rect.new(0, 0, battle_hp_bitmap.width, battle_hp_bitmap.height)
- @sprite_contens.bitmap.blt(x, y, battle_hp_bitmap, src_rect)
- # 血条显示
- battle_hp_bitmap = RPG::Cache.picture("战斗血条")
- hp_width = battle_hp_bitmap.width * actor.hp / actor.maxhp
- src_rect = Rect.new(0, 0, hp_width, battle_hp_bitmap.height)
- @sprite_contens.bitmap.blt(x, y, battle_hp_bitmap, src_rect)
- end
- #--------------------------------------------------------------------------
- # ● 战斗法条描绘
- #--------------------------------------------------------------------------
- def draw_battle_sp(actor, x, y)
- # 底图描绘
- battle_sp_bitmap = RPG::Cache.picture("战斗条框")
- src_rect = Rect.new(0, 0, battle_sp_bitmap.width, battle_sp_bitmap.height)
- @sprite_contens.bitmap.blt(x, y, battle_sp_bitmap, src_rect)
- # 法条显示
- battle_sp_bitmap = RPG::Cache.picture("战斗法条")
- sp_width = battle_sp_bitmap.width * actor.sp / actor.maxsp
- src_rect = Rect.new(0, 0, sp_width, battle_sp_bitmap.height)
- @sprite_contens.bitmap.blt(x, y, battle_sp_bitmap, src_rect)
- end
- #--------------------------------------------------------------------------
- # ● 战斗中名字的描绘
- #--------------------------------------------------------------------------
- def draw_actor_name(actor, x, y)
- @sprite_contens.bitmap.font.color = Color.new(0, 230, 50, 255)
- @sprite_contens.bitmap.font.size = 16
- @sprite_contens.bitmap.draw_text(x, y, 60, 32, actor.name,1)
- end
- # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- #★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- #检测在击中的瞬间
- def check_baby_skill
- if @battler.who_attack_me != nil
- #技能毒检测
- if @battler.who_attack_me.skill_learn?(88)
- if rand(100) < 15
- @battler.add_state(24,false)
- end
- end
- #技能反震检测
- if @battler.skill_learn?(95)#高级反震
- if @battler.who_attack_me.skill_learn?(56) or @battler.who_attack_me.skill_learn?(56)
-
- else
- if rand(100) < 50
- @battler.who_attack_me.damage = @battler.damage / 2
- @battler.who_attack_me.hp -= @battler.who_attack_me.damage
- @battler.who_attack_me.show_damage(@battler.who_attack_me.damage)
- @battler.who_attack_me.damage = nil
- end
- end
- elsif @battler.skill_learn?(94)#反震
- if @battler.who_attack_me.skill_learn?(56) or @battler.who_attack_me.skill_learn?(56)
-
- else
- if rand(100) < 30
- @battler.who_attack_me.damage = @battler.damage / 4
- @battler.who_attack_me.hp -= @battler.who_attack_me.damage
- @battler.who_attack_me.show_damage(@battler.who_attack_me.damage)
- @battler.who_attack_me.damage = nil
- end
- end
- end
- #技能吸血检测
- if @battler.who_attack_me.skill_learn?(50)
- if @battler.who_attack_me.hp < @battler.who_attack_me.maxhp
- @battler.who_attack_me.damage = [email][email protected][/email] / 2
- @battler.who_attack_me.hp -= @battler.who_attack_me.damage
- @battler.who_attack_me.show_damage_animation = false
- @battler.who_attack_me.show_damage(@battler.who_attack_me.damage)
- @battler.who_attack_me.damage = nil
- end
- elsif @battler.who_attack_me.skill_learn?(49)
- if @battler.who_attack_me.hp < @battler.who_attack_me.maxhp
- @battler.who_attack_me.damage = [email][email protected][/email] / 4
- @battler.who_attack_me.hp -= @battler.who_attack_me.damage
- @battler.who_attack_me.show_damage_animation = false
- @battler.who_attack_me.show_damage(@battler.who_attack_me.damage)
- @battler.who_attack_me.damage = nil
- end
- end
- #清空谁打了我.
- @battler.who_attack_me = nil
- end
- end
- #★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- #--------------------------------------------------------------------------
- # ● 处理角色动作
- #--------------------------------------------------------------------------
- def update_actor_animation
- if @battler.is_a?(Game_Actor)
- #角色也受伤害的情况下显示受击(反震,横扫...)
- if @battler.show_damage_value != nil
- self.damage(@battler.show_damage_value, false)
- @battler.show_damage(nil)
- @last_hits = 0
- @hits = 0
- #当6号开关为true时,不显示挨打动画
- if $game_switches.[](6) or @battler.show_damage_animation == false
- $game_switches.[]=(6,false)
- @battler.show_damage_animation = true
- else
- @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
- @battler.setup_battler_hurt_ani(1)
- end
- end
- if @battler.current_action.kind == 0 and @battler.current_action.basic == 1
- #修正防御时加血后会多显示一次受击动画的BUG
- if @last_hits == 1 and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage <= 0
- @battler.setup_battler_hurt_ani(1)
- @last_hits = 0
- #最后一击并且角色未死亡的情况下
- elsif @last_hits == 1 and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0
- check_baby_skill
- @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
- @battler.setup_battler_hurt_ani(1)
- @last_hits = 0
- #连击数!=上一次连击记录数,不是只有一次攻击,伤害值为数字,伤害值为正,当前帧!=最后一次闪光帧数
- elsif @hits != @temp_hits and @last_hits != 1 and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and @frame_index < @last_frame
- check_baby_skill
- @temp_hits+=1
- @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
- @battler.setup_battler_hurt_ani(1)
- end
- else
- #修正非正常状态伤害后的显示多次受击动画的BUG
- if @last_hits == 1 and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage <= 0 and $fangyu != 1
- @last_hits = 0
- #@battler.setup_battler_hurt_ani(1)
- # 单回合只有一次攻击
- elsif @last_hits == 1 and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and $fangyu != 1
- check_baby_skill
- ############ #小改动
- @last_hits = 0
- ############
- @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
- @battler.setup_battler_hurt_ani(1)
- #################################################################
- # 单回合多次攻击
- elsif @hits > @temp_hits and @frame_index != @last_frame and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and $fangyu != 1
- check_baby_skill
- ############ #小改动
- @temp_hits+=1
- ############
- @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
- @battler.setup_battler_hurt_ani(1)
- ########################################################################
- # 死亡之前攻击
- elsif @hits > @temp_hits and @frame_index != @last_frame and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and $fangyu != 1 and @battler.dead? and @battler.battler_dead_ani != 1
- check_baby_skill
- ############ #小改动
- @temp_hits+=1
- ############
- @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
- @battler.setup_battler_hurt_ani(1)
- #################################################################
- # 闪避的回合
- elsif !@battler_damage.is_a?(Numeric) and @last_hits == 1 and @frame_index == @last_frame
- @last_hits = 0
- #################################################################
- # 无伤害的攻击
- elsif @battler_damage.is_a?(Numeric) and @battler.damage == 0 and @last_hits == 1 and @frame_index == @last_frame
- @last_hits = 0
- #################################################################
- # 死亡判定(修正了异常死亡时不显示死亡动画的BUG)
- elsif @battler.dead?
- if @last_hits == 1 and @frame_index == @last_frame and @battler.dead? #and @battler.battler_dead_ani != 1
- @last_hits = 0
- @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
- @battler.setup_battler_dead_ani(1)
- @battler_visible = false
- elsif @battler.errorDead and @battler.dead?
- @battler.errorDead = false
- @last_hits = 0
- @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
- @battler.setup_battler_dead_ani(1)
- @battler_visible = false
- end
- #################################################################
- # 胜利判定
- elsif $scene.phase == 5 and @once == 0 and @battler_name != nil and not @battler.hidden and not @battler.dead? and $game_temp.battle_proc == nil
- @once = 1
- @battler.setup_battler_ani(@battler_name.split(/★/)[6], 1)
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 处理敌人动作
- #--------------------------------------------------------------------------
- def update_enemy_animation
- if @battler.is_a?(Game_Enemy)
- if @battler.show_damage_value != nil
- self.damage(@battler.show_damage_value, false)
- @battler.show_damage(nil)
- @last_hits = 0
- @hits = 0
- #当6号开关为true时,不显示挨打动画
- if $game_switches.[](6) or @battler.show_damage_animation == false
- $game_switches.[]=(6,false)
- @battler.show_damage_animation = true
- else
- @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
- @battler.setup_battler_hurt_ani(1)
- end
- end
- if @battler.current_action.kind == 0 and @battler.current_action.basic == 1
- else
- #修正加血后BUG
- if @last_hits == 1 and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage <= 0 and $fangyu != 1
- @last_hits = 0
- @battler.setup_battler_hurt_ani(1)
- # 单回合只有一次攻击
- elsif @last_hits == 1 and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0
- check_baby_skill
- ############ #小改动
- @last_hits = 0
- ############
- @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
- @battler.setup_battler_hurt_ani(1)
- #################################################################
- # 单回合多次攻击
- elsif @hits > @temp_hits and @frame_index != @last_frame and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0
- check_baby_skill
- ############ #小改动
- @temp_hits+=1
- ############
- @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
- @battler.setup_battler_hurt_ani(1)
- #################################################################
- # 死亡之前攻击
- elsif @hits > @temp_hits and @frame_index != @last_frame and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and @battler.dead? and @battler.battler_dead_ani != 1
- check_baby_skill
- ############ #小改动
- @temp_hits+=1
- ############
- @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
- @battler.setup_battler_hurt_ani(1)
- #################################################################
- # 无伤害的攻击
- elsif !@battler_damage.is_a?(Numeric) and @last_hits == 1 and @frame_index == @last_frame
- @last_hits = 0
- #################################################################
- # 闪避的回合
- elsif @battler_damage.is_a?(Numeric) and @battler.damage == 0 and @last_hits == 1 and @frame_index == @last_frame
- @last_hits = 0
- #################################################################
- # 死亡判定
- elsif @last_hits == 1 and @frame_index == @last_frame and @battler.dead? and @battler.battler_dead_ani != 1
- @last_hits = 0
- @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
- @battler.setup_battler_dead_ani(1)
- @battler_visible = false
- collapse
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- # 增添跳跃功能
- #--------------------------------------------------------------------------
- def update
- super
- # 战斗者为 nil 的情况下
- if @battler == nil
- @battler_name = ""
- self.bitmap = nil
- loop_animation(nil)
- loop_animation1(nil)
- return
- end
- #刷新战斗血条
- if @battler.is_a?(Game_Actor)
- if not @sprite_contens.disposed?
- if @battler_hp == 0 and not @battler.dead?
- @sprite_contens.bitmap.clear
- @sprite_contens.x = @battler.screen_x - 20
- @sprite_contens.y = @battler.screen_y - 30
- draw_actor_name(@battler, 0, 0)
- draw_battle_sp(@battler, 0, 27)
- draw_battle_hp(@battler, 0, 35)
- @battler_hp = @battler.hp
- elsif @battler_hp != @battler.hp and $scene.phase4_step == 6
- @sprite_contens.bitmap.clear
- @sprite_contens.x = @battler.screen_x - 30
- @sprite_contens.y = @battler.screen_y - 20
- draw_actor_name(@battler, 0, 0)
- draw_battle_sp(@battler, 0, 27)
- draw_battle_hp(@battler, 0, 35)
- @battler_hp = @battler.hp
- elsif @battler_sp != @battler.sp and $scene.phase4_step == 6
- @sprite_contens.bitmap.clear
- @sprite_contens.x = @battler.screen_x - 30
- @sprite_contens.y = @battler.screen_y - 20
- draw_actor_name(@battler, 0, 0)
- draw_battle_sp(@battler, 0, 27)
- draw_battle_hp(@battler, 0, 35)
- @battler_sp = @battler.sp
- end
- if @wait_count.to_i != 0
- @sprite_contens.visible = false
- else
- @sprite_contens.visible = true
- end
- end
- elsif @battler.is_a?(Game_Enemy)
- unless @sprite_contens.disposed?
- if @battler.hp0?
- @sprite_contens.bitmap.clear
- end
- if @wait_count.to_i != 0
- @sprite_contens.visible = false
- else
- @sprite_contens.visible = true
- end
- end
- end
- #如果战斗结束则释放图形
- if $scene.phase == 5
- @sprite_contens.bitmap.dispose
- @sprite_contens.dispose
- end
- # 文件名和色相与当前情况有差异的情况下
- if @battler.battler_name != @battler_name or
- @battler.battler_hue != @battler_hue or @battler.name != @name
- @name = @battler.name
- # 获取、设置位图
- @battler_name = @battler.battler_name
- @battler_hue = @battler.battler_hue
- #self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
- @flash_shake_switch = true
- #.......................................................................
- if not @battler.hidden and not @battler.dead?
- @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
- end
- #.......................................................................
- #@width = bitmap.width
- #@height = bitmap.height
- #self.ox = @width / 2
- #self.oy = @height
- self.ox = 0
- self.oy = 50
- end
- #.......................................................................
- update_actor_animation
- update_enemy_animation
- #.......................................................................
- # 动画 ID 与当前的情况有差异的情况下
- #.........................................................................
- if @battler.is_a?(Game_Enemy)
- if @once == 1 and @loop_animation_once == 1 and
- @battler.battler_dead_ani == 1
- @battler.setup_battler_ani(@battler.battler_name.split(/★/)[5])
- elsif @once == 1 and @loop_animation_once == 1 and $scene.phase != 5
- @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
- end
- end
- if @battler.is_a?(Game_Actor)
- ####################################################################
- if @once == 1 and @loop_animation_once == 1 and $scene.phase != 5 and
- @battler.battler_dead_ani == 1 and @battler.dead?
- @battler.setup_battler_ani(@battler.battler_name.split(/★/)[5])
- #######################################################################
- elsif @once == 1 and @loop_animation_once == 1 and $scene.phase != 5
- @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
- #################################################################
- $fangyu = 0
- @battler.setup_battler_dead_ani(0)
- ########################################################
- elsif @once == 1 and @loop_animation_once == 1 and $scene.phase == 5 and
- not @battler.dead?
- @battler.setup_battler_ani(@battler.battler_name.split(/★/)[7])
- ######################################################
- $fangyu = 0
- @battler.setup_battler_dead_ani(0)
- ######################################################
- end
- end
-
- #加入了判断状态动画出现时机判断
- if @state_animation_id != @battler.state_animation_id and ($scene.phase4_step == 6 or
- @battler.state_animation_id == nil or (@state_animation_id != nil and
- @battler.state_animation_id != nil and @battler.state_animation_id.size < @state_animation_id.size))
- @state_animation_id = @battler.state_animation_id
- @state_animation_array = nil
- if @state_animation_id == nil
-
- else
- @state_animation_array = []
- for animation_id in @state_animation_id
- @state_animation_array.push($data_animations[animation_id])
- end
- end
- loop_animation1(@state_animation_array)
- end
-
-
- if @battler.battler_ani != @battler_ani
- @battler_ani = @battler.battler_ani
- @once = @battler.battler_ani_once
- loop_animation($data_animations[@battler_ani.to_i])
- end
- #.........................................................................
- # 明灭
- if @battler.blink
- blink_on
- else
- blink_off
- end
- # 不可见的情况下
- unless @battler_visible
- # 出现
- if not @battler.hidden and not @battler.dead? #and
- #(@battler.damage == nil or @battler.damage_pop)
- #.......................................................................
- if @battler.is_a?(Game_Enemy)
- @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
- #appear
- else
- @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
- end
- #.......................................................................
- @battler_visible = true
- end
- end
- # 可见的情况下
- if @battler_visible
- # 逃跑
- if @battler.hidden
- $game_system.se_play($data_system.escape_se)
- escape
- @battler_visible = false
- end
- # 白色闪烁
- if @battler.white_flash
- whiten
- @battler.white_flash = false
- end
- # 动画
- if @battler.animation_id != 0
- animation = $data_animations[@battler.animation_id]
- animation(animation, @battler.animation_hit,@battler.damage, @battler.critical)
- # animation(animation, @battler.animation_hit)
- @battler.animation_id = 0
- end
- # 伤害
- if @battler.damage_pop
- @battler.damage = nil
- @battler.critical = false
- @battler.damage_pop = false
- end
- # korapusu
- if @battler.damage == nil and @battler.dead?
- if @battler.is_a?(Game_Enemy)
- if @battler.battler_dead_ani != 1
- #p "Battler Death Error"
- $game_system.se_play($data_system.enemy_collapse_se)
- @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
- @battler.setup_battler_dead_ani(1)
- end
- #.....................................................................
- collapse
- #.....................................................................
- else
- #.....................................................................
- if @battler.battler_dead_ani != 1
- if @battler.id == 6
- end
- @last_hits = 0
- @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
- @battler.setup_battler_dead_ani(1)
- end
- #.....................................................................
- end
- @battler_visible = false
- end
- end
- # 设置活动块的坐标
- if @flash_shake_switch == true
- self.x = @battler.screen_x
- self.y = @battler.screen_y
- self.z = @battler.screen_z
- @flash_shake_switch = false
- if @battler.is_a?(Game_Actor)
- @sprite_contens.bitmap.clear
- @sprite_contens.x = @battler.screen_x - 30
- @sprite_contens.y = @battler.screen_y - 20
- draw_actor_name(@battler, 0, 0)
- draw_battle_sp(@battler, 0, 27)
- draw_battle_hp(@battler, 0, 35)
- elsif @battler.is_a?(Game_Enemy)
- @sprite_contens.bitmap.clear
- @sprite_contens.x = @battler.screen_x - 30
- @sprite_contens.y = @battler.screen_y - 20
- draw_actor_name(@battler, 0, 0)
- end
- end
- if @flash_shake != 0 and @battler.damage != nil and RPG::BATTLER_JUMP
- if @battler.is_a?(Game_Enemy)
- case @flash_shake
- when 9..10
- self.x -=4
- self.y -=4
- self.z = @battler.screen_z
- when 6..8
- self.x -=2
- self.y -=2
- self.z = @battler.screen_z
- when 3..5
- self.x +=2
- self.y +=2
- self.z = @battler.screen_z
- when 1..2
- self.x +=4
- self.y +=4
- self.z = @battler.screen_z
- end
- end
- if @battler.is_a?(Game_Actor)
- case @flash_shake
- when 9..10
- self.x +=4
- self.y +=4
- self.z = @battler.screen_z
- when 6..8
- self.x +=2
- self.y +=2
- self.z = @battler.screen_z
- when 3..5
- self.x -=2
- self.y -=2
- self.z = @battler.screen_z
- when 1..2
- self.x -=4
- self.y -=4
- self.z = @battler.screen_z
- end
- end
- @flash_shake -= 1
- end
- end
- end
复制代码 有办法解吗 因为我的游戏已经改动过了,如果再用工程模式 游戏里的改动会不会变? |
|