赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 7947 |
最后登录 | 2014-12-28 |
在线时间 | 60 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 60 小时
- 注册时间
- 2014-7-12
- 帖子
- 539
|
这个或许更适合,但是还是有一些局限性而且可能和你正在用的其他脚本冲突- #==============================================================================
- #☆ 特技多体对象选择(随机 + 选定)
- #------------------------------------------------------------------------------
- # by -> 芯☆淡如水
- #==============================================================================
- # ● 介绍:
- #
- # 该特技多体攻击可实现特技对象的多体选择(介于单体和全体之间)。选择多体的
- #方式有随机选择和手动指定选择。
- #
- # 该多体攻击,理论上可以随机或选定 1~无限 个攻击对象。但由于数据库敌人队伍
- #的敌人数量最多只能设置 8 个,所以只可以 1~7 个攻击对象。如果 数据库-特技 设置
- #的对象个数超过 7 个,效果等于是全体攻击。
- #==============================================================================
- # ● 使用方法:1,复制该脚本,插入到 main 前。
- #
- # 2,数据库 - 特技 设置:先将需要多体的特技的 效果范围 设为 无。
- # 然后在特技名后写上分隔符号半角逗号“,”
- # 接着写该特技的对象个数。其他设置与
- # 一般特技相同。(详见范例特技设置)
- #
- # 3,随机多体特技只需完成上面的设置即可,选定多体对象特技再在下面
- # 的设置项里照格式添加特技 ID 。
- #==============================================================================
- # ● 设置
- #------------------------------------------------------------------------------
- # 选定多体对象的特技 ID 。
- N_TARGET_SKILLS = [2, 8, 17, 37, 39, 82, 83]
- #-----------------------------------------------------------------------------
- # 选中的敌人播放的循环动画 ID
- BE_ANIMATION_ID = 101
- #----------------------------------------------------------------------------
- # 增益状态的特技 ID
- UP_STATE_SKILL = [82, 83]
- #----------------------------------------------------------------------------
- # 不良状态的特技 ID
- DOWN_STATE_SKILL = [37, 39]
- #==============================================================================
- ###############################################################################
- # 选中提示
- #==============================================================================
- module RPG
- class Sprite < ::Sprite
- def dispose
- dispose_damage
- dispose_animation
- dispose_loop_animation
- dispose_be_animation
- super
- end
- def be_animation(animation)
- return if animation == @_be_animation
- dispose_be_animation
- @_be_animation = animation
- return if @_be_animation == nil
- @_be_animation_index = 0
- animation_name = @_be_animation.animation_name
- animation_hue = @_be_animation.animation_hue
- bitmap = RPG::Cache.animation(animation_name, animation_hue)
- if @@_reference_count.include?(bitmap)
- @@_reference_count[bitmap] += 1
- else
- @@_reference_count[bitmap] = 1
- end
- @_be_animation_sprites = []
- for i in 0..15
- sprite = ::Sprite.new(self.viewport)
- sprite.bitmap = bitmap
- sprite.visible = false
- @_be_animation_sprites.push(sprite)
- end
- update_be_animation
- end
- def dispose_be_animation
- if @_be_animation_sprites != nil
- sprite = @_be_animation_sprites[0]
- if sprite != nil
- @@_reference_count[sprite.bitmap] -= 1
- if @@_reference_count[sprite.bitmap] == 0
- sprite.bitmap.dispose
- end
- end
- for sprite in @_be_animation_sprites
- sprite.dispose
- end
- @_be_animation_sprites = nil
- @_be_animation = nil
- end
- end
- alias xdrs update
- def update
- if @_be_animation != nil and (Graphics.frame_count % 2 == 0)
- update_be_animation
- @_be_animation_index += 1
- @_be_animation_index %= @_be_animation.frame_max
- end
- xdrs
- end
- def update_be_animation
- frame_index = @_be_animation_index
- cell_data = @_be_animation.frames[frame_index].cell_data
- position = @_be_animation.position
- animation_set_sprites(@_be_animation_sprites, cell_data, position)
- for timing in @_be_animation.timings
- if timing.frame == frame_index
- animation_process_timing(timing, true)
- end
- end
- end
- end
- end
- ###############################################################################
- #==============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- attr_accessor :target_n
- attr_accessor :command_on
- #--------------------------------------------------------------------------
- alias add_initialize_xdrs initialize
- def initialize
- @target_n = []
- @command_on = false
- add_initialize_xdrs
- end
- end
- ###############################################################################
- class Game_Actor < Game_Battler
- #---------------------------------------------------------------------------
- def set_skills(skill_id)
- @skills.delete(skill_id)
- @skills.unshift(skill_id)
- end
- end
- ###############################################################################
- # 定义特技名和对象数量
- #==============================================================================
- class Game_Party
- #--------------------------------------------------------------------------
- def skill_name(skill_id)
- return $data_skills[skill_id].name.split(/,/)[0]
- end
- #--------------------------------------------------------------------------
- def skill_tn(skill_id)
- n = $data_skills[skill_id].name.split(/,/)[1].to_i
- return n != nil ? n : 0
- end
- end
- ###############################################################################
- #==============================================================================
- class Sprite_Battler < RPG::Sprite
- #--------------------------------------------------------------------------
- def update
- super
- # 战斗者为 nil 的情况下
- if [url=home.php?mod=space&uid=133701]@battler[/url] == 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
- self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
- @width = bitmap.width
- [url=home.php?mod=space&uid=291977]@height[/url] = bitmap.height
- self.ox = @width / 2
- self.oy = @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
- # 应该被显示的角色的情况下
- 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.command_on
- be_animation($data_animations[BE_ANIMATION_ID])
- else
- be_animation(nil)
- end
- # 逃跑
- 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
- end
- # 设置活动块的坐标
- self.x = @battler.screen_x
- self.y = @battler.screen_y
- self.z = @battler.screen_z
- end
- end
- #==============================================================================
- class Scene_Battle
- #--------------------------------------------------------------------------
- def phase3_next_actor
- # 循环
- begin
- # 角色的明灭效果 OFF
- if @active_battler != nil
- @active_battler.blink = false
- end
- # 最后的角色的情况
- if @actor_index == $game_party.actors.size-1
- # 开始主回合
- start_phase4
- return
- end
- # 推进角色索引
- @actor_index += 1
- @active_battler = $game_party.actors[@actor_index]
- @active_battler.blink = true
- @active_battler.target_n.clear
- # 如果角色是在无法接受指令的状态就再试
- end until @active_battler.inputable?
- # 设置角色的命令窗口
- phase3_setup_command_window
- end
- #--------------------------------------------------------------------------
- def phase3_prior_actor
- # 循环
- begin
- # 角色的明灭效果 OFF
- if @active_battler != nil
- @active_battler.blink = false
- end
- # 最初的角色的情况下
- if @actor_index == 0
- # 开始同伴指令回合
- start_phase2
- return
- end
- # 返回角色索引
- @actor_index -= 1
- @active_battler = $game_party.actors[@actor_index]
- @active_battler.blink = true
- @active_battler.target_n.clear
- # 如果角色是在无法接受指令的状态就再试
- end until @active_battler.inputable?
- # 设置角色的命令窗口
- phase3_setup_command_window
- end
- #--------------------------------------------------------------------------
- def update_phase3_skill_select
- # 设置特技窗口为可视状态
- @skill_window.visible = true
- # 刷新特技窗口
- @skill_window.update
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 结束特技选择
- end_skill_select
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 获取特技选择窗口现在选择的特技的数据
- [url=home.php?mod=space&uid=260100]@skill[/url] = @skill_window.skill
- # 无法使用的情况下
- if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- @active_battler.set_skills(@skill.id)
- # 设置行动
- @active_battler.current_action.skill_id = @skill.id
- # 设置特技窗口为不可见状态
- @skill_window.visible = false
- if @skill.scope == 0
- skill_select
- # 效果范围是敌单体的情况下
- elsif @skill.scope == 1
- # 开始选择敌人
- start_enemy_select
- # 效果范围是我方单体的情况下
- elsif @skill.scope == 3 or @skill.scope == 5
- # 开始选择角色
- start_actor_select
- # 效果范围不是单体的情况下
- else
- # 选择特技结束
- end_skill_select
- # 转到下一位角色的指令输入
- phase3_next_actor
- end
- return
- end
- end
- #--------------------------------------------------------------------------
- def skill_select
- if UP_STATE_SKILL.include?(@skill.id)
- start_actor_select
- elsif DOWN_STATE_SKILL.include?(@skill.id)
- start_enemy_select
- elsif ! N_TARGET_SKILLS.include?(@skill.id)
- end_skill_select
- phase3_next_actor
- elsif @skill.power < 0
- start_actor_select
- elsif @skill.power > 0
- start_enemy_select
- else
- phase3_next_actor
- end
- end
- #--------------------------------------------------------------------------
- alias add_update_phase3_enemy_select_xdrs update_phase3_enemy_select
- def update_phase3_enemy_select
- if @active_battler.current_action.kind == 1
- if $data_skills[@active_battler.current_action.skill_id].scope == 0
- update_phase3_enemy_select_opt
- return
- end
- end
- add_update_phase3_enemy_select_xdrs
- end
- #--------------------------------------------------------------------------
- alias add_update_phase3_actor_select_xdrs update_phase3_actor_select
- def update_phase3_actor_select
- if @active_battler.current_action.kind == 1
- if $data_skills[@active_battler.current_action.skill_id].scope == 0
- update_phase3_actor_select_opt
- return
- end
- end
- add_update_phase3_actor_select_xdrs
- end
- #--------------------------------------------------------------------------
- def update_phase3_enemy_select_opt
- @enemy_arrow.update
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- if not @active_battler.target_n.empty?
- for enemy in @active_battler.target_n
- enemy.command_on = false
- end
- @active_battler.target_n.clear
- end
- end_enemy_select
- return
- end
- if Input.trigger?(Input::A)
- if @active_battler.target_n.empty?
- $game_system.se_play($data_system.buzzer_se)
- else
- $game_system.se_play($data_system.decision_se)
- for enemy in @active_battler.target_n
- enemy.command_on = false
- end
- end_skill_select
- end_enemy_select
- phase3_next_actor
- return
- end
- end
- if Input.trigger?(Input::C)
- skill = $data_skills[@active_battler.current_action.skill_id]
- enemy = $game_troop.enemies[@enemy_arrow.index]
- date = []
- for n in $game_troop.enemies
- date.push(n) if n.exist?
- end
- if $game_party.skill_tn(skill.id) > date.size
- target_n = date.size
- else
- target_n = $game_party.skill_tn(skill.id)
- end
- if @active_battler.target_n.include?(enemy)
- $game_system.se_play($data_system.cancel_se)
- @active_battler.target_n.delete(enemy)
- enemy.command_on = false
- else
- if @active_battler.target_n.size < target_n
- $game_system.se_play($data_system.decision_se)
- @active_battler.target_n.push(enemy)
- enemy.command_on = true
- if @active_battler.target_n.size == target_n
- for enemy in @active_battler.target_n
- enemy.command_on = false
- end
- end_skill_select
- end_enemy_select
- phase3_next_actor
- end
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- def update_phase3_actor_select_opt
- @actor_arrow.update
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- if not @active_battler.target_n.empty?
- for actor in @active_battler.target_n
- actor.command_on = false
- end
- @active_battler.target_n.clear
- end
- end_actor_select
- return
- end
- if Input.trigger?(Input::A)
- if @active_battler.target_n.empty?
- $game_system.se_play($data_system.buzzer_se)
- else
- $game_system.se_play($data_system.decision_se)
- for actor in @active_battler.target_n
- actor.command_on = false
- end
- end_skill_select
- end_actor_select
- phase3_next_actor
- return
- end
- end
- if Input.trigger?(Input::C)
- skill = $data_skills[@active_battler.current_action.skill_id]
- actor = $game_party.actors[@actor_arrow.index]
- unless [5, 6].include?(skill.scope) and actor.exist?
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- date = []
- for n in $game_party.actors
- date.push(n) if n.exist?
- end
- if $game_party.skill_tn(skill.id) > date.size
- target_n = date.size
- else
- target_n = $game_party.skill_tn(skill.id)
- end
- if @active_battler.target_n.include?(actor)
- $game_system.se_play($data_system.cancel_se)
- @active_battler.target_n.delete(actor)
- actor.command_on = false
- else
- if @active_battler.target_n.size < target_n
- $game_system.se_play($data_system.decision_se)
- @active_battler.target_n.push(actor)
- actor.command_on = true
- if @active_battler.target_n.size == target_n
- for actor in @active_battler.target_n
- actor.command_on = false
- end
- end_skill_select
- end_actor_select
- phase3_next_actor
- end
- end
- end
- end
- end
- #===========================================================================
- def set_n_targets
- if $game_party.skill_tn(@skill.id) > 0
- data = []
- if @active_battler.is_a?(Game_Actor)
- for enemy in $game_troop.enemies
- data.push(enemy) if enemy.exist?
- end
- else
- for actor in $game_party.actors
- data.push(actor) if actor.exist?
- end
- end
- if $game_party.skill_tn(@skill.id) >= data.size
- @target_battlers = data
- else
- loop do
- break if @target_battlers.size >= $game_party.skill_tn(@skill.id)
- target = data[rand (data.size)]
- if not @target_battlers.include?(target)
- @target_battlers.push(target)
- end
- end
- end
- end
- end
- #############################################################################
- #--------------------------------------------------------------------------
- # ● 生成特技行动结果
- #--------------------------------------------------------------------------
- def make_skill_action_result
- # 获取特技
- @skill = $data_skills[@active_battler.current_action.skill_id]
- # 如果不是强制行动
- unless @active_battler.current_action.forcing
- # 因为 SP 耗尽而无法使用的情况下
- unless @active_battler.skill_can_use?(@skill.id)
- # 清除强制行动对像的战斗者
- $game_temp.forcing_battler = nil
- # 移至步骤 1
- @phase4_step = 1
- return
- end
- end
- # 消耗 SP
- @active_battler.sp -= @skill.sp_cost
- # 刷新状态窗口
- @status_window.refresh
- # 在帮助窗口显示特技名
- @help_window.set_text($game_party.skill_name(@skill.id), 1)
- # 设置动画 ID
- @animation1_id = @skill.animation1_id
- @animation2_id = @skill.animation2_id
- # 设置公共事件 ID
- @common_event_id = @skill.common_event_id
- # 设置对像侧战斗者
- ###########################################################################
- # 更改特技对象的选择
- #==========================================================================
- if N_TARGET_SKILLS.include?(@skill.id)
- if @active_battler.is_a?(Game_Actor)
- @target_battlers = @active_battler.target_n
- @active_battler.target_n = []
- else
- set_n_targets
- end
- else
- if @skill.scope == 0
- set_n_targets
- else
- set_target_battlers(@skill.scope)
- end
- end
- ###########################################################################
- # 应用特技效果
- for target in @target_battlers
- target.skill_effect(@active_battler, @skill)
- end
- end
- end
- ###############################################################################
- # 重新描绘特技名
- #==============================================================================
- class Window_Skill < Window_Selectable
- #--------------------------------------------------------------------------
- def draw_item(index)
- skill = @data[index]
- if @actor.skill_can_use?(skill.id)
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- x = 4 + index % 2 * (288 + 32)
- y = index / 2 * 32
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(skill.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- name = $game_party.skill_name(skill.id)
- self.contents.draw_text(x + 28, y, 204, 32, name, 0)
- self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
- end
- end
- #==============================================================================
- ###############################################################################
复制代码
特技多体rmxp.rar
(280.94 KB, 下载次数: 432)
里面有随机2体、随机3体、选择2体、选择3体之类的攻击目标 |
评分
-
查看全部评分
|