赞 | 0 |
VIP | 0 |
好人卡 | 1 |
积分 | 1 |
经验 | 1672 |
最后登录 | 2015-6-28 |
在线时间 | 7 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 7 小时
- 注册时间
- 2014-5-3
- 帖子
- 14
|
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- #==============================================================================
- #冲突脚本:宠物脚本1.2版(66主页拿的宠物脚本应该都会冲突)
- #注意:以下一共有两个脚本,插入后就能达到战斗动画。
- #插入脚本后先进入游戏进行战斗一下,然后就会明白素材问题了
- #素材问题:脚本采用了战斗图自动选择行走图~~~
- #使用方法:插入main前即可
- #==============================================================================
- #==============================================================================
- # ■ Sprite_Battler
- #==============================================================================
- class Sprite_Battler < RPG::Sprite
- #--------------------------------------------------------------------------
- # ● instance变量
- #--------------------------------------------------------------------------
- attr_accessor :battler # butler
- #--------------------------------------------------------------------------
- # ● 初始化
- # viewport : viewport
- # battler : butler(Game_Battler)
- #--------------------------------------------------------------------------
- def initialize(viewport, battler = nil)
- super(viewport)
- [url=home.php?mod=space&uid=133701]@battler[/url] = battler
- @battler_visible = false
- # 定义动画用变量
- @hoko_wait = 0
- @hoko_pattern = 0
- end
- #--------------------------------------------------------------------------
- # ● 解放
- #--------------------------------------------------------------------------
- def dispose
- if self.bitmap != nil
- self.bitmap.dispose
- end
- super
- end
- #--------------------------------------------------------------------------
- # ● 更新
- #--------------------------------------------------------------------------
- def update
- super
- # butler nil 的场合
- if @battler == nil
- self.bitmap = nil
- loop_animation(nil)
- return
- end
- # 如果文件名或者色相与现在的东西不同
- if @battler.battler_name != @battler_name or
- @battler.battler_hue != @battler_hue
- # 取得位图设定
- @battler_name = @battler.battler_name
- @battler_hue = @battler.battler_hue
- # battler→character变更
- #self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
- self.bitmap = RPG::Cache.character(@battler_name, @battler_hue)
- # width→宽度 height→高度
- @width = bitmap.width / 4
- @height = bitmap.height / 4
- self.ox = @width / 2
- self.oy = @height
- self.src_rect.set(@hoko_pattern * @width, 0, @width, @height)
- # 战斗不能再隐藏要是状态把不透明度做为 0
- if @battler.dead? or @battler.hidden
- self.opacity = 0
- end
- end
- # 如果动画ID与现在的东西有差异
- if @battler.damage == nil and
- @battler.state_animation_id != @state_animation_id
- @state_animation_id = @battler.state_animation_id
- loop_animation($data_animations[@state_animation_id])
- end
- # 应该被表示actor的场合
- if @battler.is_a?(Game_Actor) and @battler_visible
- # 不是主要阶段的时候把不透明度稍稍下降
- if $game_temp.battle_main_phase
- self.opacity += 3 if self.opacity < 255
- else
- self.opacity -= 3 if self.opacity > 207
- end
- 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)
- appear
- @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.animation_id = 0
- end
- # 损坏
- if @battler.damage_pop
- damage(@battler.damage, @battler.critical)
- @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)
- $game_system.se_play($data_system.enemy_collapse_se)
- else
- $game_system.se_play($data_system.actor_collapse_se)
- end
- collapse
- @battler_visible = false
- end
- # 行走动画
- hoko_anime()
- # p @hoko_pattern
- end
- # 设定行走图位置的坐标
- self.x = @battler.screen_x
- self.y = @battler.screen_y - 43
- self.z = @battler.screen_z
- end
- #--------------------------------------------------------------------------
- # ● 行走动画(@hoko_pattern * @width, 0, @width, @height)能设置行走图方向
- #--------------------------------------------------------------------------
- def hoko_anime()
- @hoko_wait += 1
- if @hoko_wait > 6 # wait 等待
- @hoko_wait = 0
- @hoko_pattern += 1
- if @hoko_pattern > 3
- @hoko_pattern = 0
- # p "0"
- end #pattern图案/width宽度/height高度
- self.src_rect.set(@hoko_pattern * @width, @height * 2, @width, @height)
- if battler.is_a?(Game_Actor)
- self.src_rect.set(@hoko_pattern * @width, @height, @width, @height)
- end
- end
- end
- end #enemy敌人
- #==============================================================================
- #冲突脚本:宠物脚本1.2版(66主页拿的宠物脚本应该都会冲突)
- #注意:以下一共有两个脚本,插入后就能达到战斗动画。
- #插入脚本后先进入游戏进行战斗一下,然后就会明白素材问题了
- #素材问题:脚本采用了战斗图自动选择行走图~~~
- #==============================================================================
- #==============================================================================
- # ■ Game_BattleAction
- #------------------------------------------------------------------------------
- #是处理动作 (战斗中的行动)的级。这个级 在 Game_Battler kura# su内部被使用。
- #==============================================================================
- class Game_BattleAction
- #--------------------------------------------------------------------------
- # ● instance变量
- #--------------------------------------------------------------------------
- attr_accessor :speed # 速度
- attr_accessor :kind # 类别(基本/ 技艺 / 物品)
- attr_accessor :basic # 基本(攻击/防御/逃跑)
- attr_accessor :skill_id # 特技ID
- attr_accessor :item_id # 物品ID
- attr_accessor :target_index # 对象禁书目录
- attr_accessor :forcing # 强制标志
- #--------------------------------------------------------------------------
- # ● 初始化
- #--------------------------------------------------------------------------
- def initialize
- clear
- end
- #--------------------------------------------------------------------------
- # ● clearness
- #--------------------------------------------------------------------------
- def clear
- @speed = 0
- @kind = 0
- @basic = 3
- @skill_id = 0
- @item_id = 0
- @target_index = -1
- @forcing = false
- end
- #--------------------------------------------------------------------------
- # ● 判断
- #--------------------------------------------------------------------------
- def valid?
- return (not (@kind == 0 and @basic == 3))
- end
- #--------------------------------------------------------------------------
- # ● 单体判断
- #--------------------------------------------------------------------------
- def for_one_friend?
- # 类别特技,效果范围包含伙伴单体(HP 0 的)场合
- if @kind == 1 and [3, 5].include?($data_skills[@skill_id].scope)
- return true
- end
- # 类别以条款,效果范围包含伙伴单体(HP 0 的)场合
- if @kind == 2 and [3, 5].include?($data_items[@item_id].scope)
- return true
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● 单体用(HP 0)判断
- #--------------------------------------------------------------------------
- def for_one_friend_hp0?
- # 特技效果范围单体(HP 0 )的场合
- if @kind == 1 and [5].include?($data_skills[@skill_id].scope)
- return true
- end
- # 物品效果范围单体(HP 0 )的场合
- if @kind == 2 and [5].include?($data_items[@item_id].scope)
- return true
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● random目标 (actor用)
- #--------------------------------------------------------------------------
- def decide_random_target_for_actor
- # 效果范围分歧
- if for_one_friend_hp0?
- battler = $game_party.random_target_actor_hp0
- elsif for_one_friend?
- battler = $game_party.random_target_actor
- else
- battler = $game_troop.random_target_enemy
- end
- # 如果对象存在取得禁书目录,
- # 对象不存在的情况clearness动作
- if battler != nil
- @target_index = battler.index
- else
- clear
- end
- end
- #--------------------------------------------------------------------------
- # ● random目标 (enemy用)
- #--------------------------------------------------------------------------
- def decide_random_target_for_enemy
- # 效果范围分歧
- if for_one_friend_hp0?
- battler = $game_troop.random_target_enemy_hp0
- elsif for_one_friend?
- battler = $game_troop.random_target_enemy
- else
- battler = $game_party.random_target_actor
- end
- # 如果对象存在取得禁书目录,
- # 对象不存在的情况clearness动作
- if battler != nil
- @target_index = battler.index
- else
- clear
- end
- end
- #--------------------------------------------------------------------------
- # ● 最后目标 (actor)
- #--------------------------------------------------------------------------
- def decide_last_target_for_actor
- # 单体actor效果范围,(enemy)
- if @target_index == -1
- battler = nil
- elsif for_one_friend?
- battler = $game_party.actors[@target_index]
- else
- battler = $game_troop.enemies[@target_index]
- end
- # 对象不存在的情况clearness动作
- if battler == nil or not battler.exist?
- clear
- end
- end
- #--------------------------------------------------------------------------
- # ● 最后目标 (enemy)
- #--------------------------------------------------------------------------
- def decide_last_target_for_enemy
- # 单体enemy效果范围 (actor)
- if @target_index == -1
- battler = nil
- elsif for_one_friend?
- battler = $game_troop.enemies[@target_index]
- else
- battler = $game_party.actors[@target_index]
- end
- # 对象不存在的情况clearness动作
- if battler == nil or not battler.exist?
- clear
- end
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
复制代码 |
|