Project1
标题:
关于攻击两名敌人
[打印本页]
作者:
an1ji1er1
时间:
2012-1-28 23:34
标题:
关于攻击两名敌人
有能攻击两名敌人或者三名敌人的脚本吗,就好像大话西游里仙族秒3秒4秒5,人族混3混4混5这样的 dsu_plus_rewardpost_czw
作者:
yagami
时间:
2012-1-28 23:51
class Scene_Battle
#------------------------------------
# ● 设置物品或特技对像方的战斗者
# scope : 特技或者是物品的范围
#------------------------------------
def set_target_battlers(scope)
# 行动方的战斗者是敌人的情况下
if @active_battler.is_a?(Game_Enemy)
# 效果范围分支
case scope
when 1 # 敌单体
index = @active_battler.current_action.target_index
@target_battlers.push($game_party.smooth_target_actor(index))
dr_ac
when 2 # 敌全体
for actor in $game_party.actors
if actor.exist?
@target_battlers.push(actor)
end
end
when 3 # 我方单体
index = @active_battler.current_action.target_index
@target_battlers.push($game_troop.smooth_target_enemy(index))
dr_dr
when 4 # 我方全体
for enemy in $game_troop.enemies
if enemy.exist?
@target_battlers.push(enemy)
end
end
when 5 # 我方单体 (HP 0)
index = @active_battler.current_action.target_index
enemy = $game_troop.enemies[index]
if enemy != nil and enemy.hp0?
@target_battlers.push(enemy)
end
when 6 # 我方全体 (HP 0)
for enemy in $game_troop.enemies
if enemy != nil and enemy.hp0?
@target_battlers.push(enemy)
end
end
when 7 # 使用者
@target_battlers.push(@active_battler)
end
end
# 行动方的战斗者是角色的情况下
if @active_battler.is_a?(Game_Actor)
# 效果范围分支
case scope
when 1 # 敌单体
index = @active_battler.current_action.target_index
@target_battlers.push($game_troop.smooth_target_enemy(index))
ac_dr
when 2 # 敌全体
for enemy in $game_troop.enemies
if enemy.exist?
@target_battlers.push(enemy)
end
end
when 3 # 我方单体
index = @active_battler.current_action.target_index
@target_battlers.push($game_party.smooth_target_actor(index))
ac_ac
when 4 # 我方全体
for actor in $game_party.actors
if actor.exist?
@target_battlers.push(actor)
end
end
when 5 # 我方单体 (HP 0)
index = @active_battler.current_action.target_index
actor = $game_party.actors[index]
if actor != nil and actor.hp0?
@target_battlers.push(actor)
end
when 6 # 我方全体 (HP 0)
for actor in $game_party.actors
if actor != nil and actor.hp0?
@target_battlers.push(actor)
end
end
when 7 # 使用者
@target_battlers.push(@active_battler)
end
end
end
end
module RPG
class Sprite < ::Sprite
@@_animations = []
@@_reference_count = {}
def initialize(viewport = nil)
super(viewport)
@_whiten_duration = 0
@_appear_duration = 0
@_escape_duration = 0
@_collapse_duration = 0
@_damage_duration = 0
@_animation_duration = 0
@_blink = false
end
def dispose
dispose_damage
dispose_animation
dispose_loop_animation
super
end
def xiaoshi=(xiaoshi)
@xiaoshi = xiaoshi
return @xiaoshi
end
def xiaoshi
return @xiaoshi
end
def whiten
self.blend_type = 0
self.color.set(255, 255, 255, 128)
self.opacity = 255
@_whiten_duration = 16
@_appear_duration = 0
@_escape_duration = 0
@_collapse_duration = 0
end
def appear
self.blend_type = 0
self.color.set(0, 0, 0, 0)
self.opacity = 0
@_appear_duration = 16
@_whiten_duration = 0
@_escape_duration = 0
@_collapse_duration = 0
end
def escape
self.blend_type = 0
self.color.set(0, 0, 0, 0)
self.opacity = 255
@_escape_duration = 32
@_whiten_duration = 0
@_appear_duration = 0
@_collapse_duration = 0
end
def collapse
self.blend_type = 1
self.color.set(255, 64, 64, 255)
self.opacity = 255
@_collapse_duration = 48
@_whiten_duration = 0
@_appear_duration = 0
@_escape_duration = 0
end
def animation(animation, hit)
dispose_animation
@_animation = animation
return if @_animation == nil
@_animation_hit = hit
@_animation_duration = @_animation.frame_max
animation_name = @_animation.animation_name
animation_hue = @_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
@_animation_sprites = []
if @_animation.position != 3 or not @@_animations.include?(animation)
for i in 0..15
sprite = ::Sprite.new(self.viewport)
sprite.bitmap = bitmap
sprite.visible = false
@_animation_sprites.push(sprite)
end
unless @@_animations.include?(animation)
@@_animations.push(animation)
end
end
update_animation
end
def loop_animation(animation)
return if animation == @_loop_animation
dispose_loop_animation
@_loop_animation = animation
return if @_loop_animation == nil
@_loop_animation_index = 0
animation_name = @_loop_animation.animation_name
animation_hue = @_loop_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
@_loop_animation_sprites = []
for i in 0..15
sprite = ::Sprite.new(self.viewport)
sprite.bitmap = bitmap
sprite.visible = false
@_loop_animation_sprites.push(sprite)
end
update_loop_animation
end
def dispose_damage
if @_damage_sprite != nil
@_damage_sprite.bitmap.dispose
@_damage_sprite.dispose
@_damage_sprite = nil
@_damage_duration = 0
end
end
def dispose_animation
if @_animation_sprites != nil
sprite = @_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 @_animation_sprites
sprite.dispose
end
@_animation_sprites = nil
@_animation = nil
end
end
def dispose_loop_animation
if @_loop_animation_sprites != nil
sprite = @_loop_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 @_loop_animation_sprites
sprite.dispose
end
@_loop_animation_sprites = nil
@_loop_animation = nil
end
end
def blink_on
unless @_blink
@_blink = true
@_blink_count = 0
end
end
def blink_off
if @_blink
@_blink = false
self.color.set(0, 0, 0, 0)
end
end
def blink?
@_blink
end
def effect?
@_whiten_duration > 0 or
@_appear_duration > 0 or
@_escape_duration > 0 or
@_collapse_duration > 0 or
@_damage_duration > 0 or
@_animation_duration > 0
end
def update
super
if @_whiten_duration > 0
@_whiten_duration -= 1
self.color.alpha = 128 - (16 - @_whiten_duration) * 10
end
if @_appear_duration > 0
@_appear_duration -= 1
self.opacity = (16 - @_appear_duration) * 16
end
if @_escape_duration > 0
@_escape_duration -= 1
self.opacity = 256 - (32 - @_escape_duration) * 10
end
if @_collapse_duration > 0
@_collapse_duration -= 1
self.opacity = 256 - (48 - @_collapse_duration) * 6
end
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
if @_animation != nil and (Graphics.frame_count % 2 == 0)
@_animation_duration -= 1
update_animation
end
if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
update_loop_animation
@_loop_animation_index += 1
@_loop_animation_index %= @_loop_animation.frame_max
end
if @_blink
@_blink_count = (@_blink_count + 1) % 32
if @_blink_count < 16
alpha = (16 - @_blink_count) * 6
else
alpha = (@_blink_count - 16) * 6
end
self.color.set(255, 255, 255, alpha)
end
@@_animations.clear
end
def update_animation
if @_animation_duration > 0
frame_index = @_animation.frame_max - @_animation_duration
cell_data = @_animation.frames[frame_index].cell_data
position = @_animation.position
animation_set_sprites(@_animation_sprites, cell_data, position)
for timing in @_animation.timings
if timing.frame == frame_index
animation_process_timing(timing, @_animation_hit)
end
end
else
dispose_animation
end
end
def update_loop_animation
if @xiaoshi2 != nil and @xiaoshi2 > 0
@xiaoshi2 -= 1
frame_index = @_loop_animation_index
cell_data = @_loop_animation.frames[frame_index].cell_data
position = @_loop_animation.position
animation_set_sprites(@_loop_animation_sprites, cell_data, position,true)
else
frame_index = @_loop_animation_index
cell_data = @_loop_animation.frames[frame_index].cell_data
position = @_loop_animation.position
animation_set_sprites(@_loop_animation_sprites, cell_data, position)
for timing in @_loop_animation.timings
if timing.frame == frame_index
animation_process_timing(timing, true)
end
end
end
end
def animation_set_sprites(sprites, cell_data, position,kds = false)
if kds
for i in 0..15
sprites[i].visible = false
end
return
end
for i in 0..15
sprite = sprites[i]
pattern = cell_data[i, 0]
if sprite == nil or pattern == nil or pattern == -1
sprite.visible = false if sprite != nil
next
end
sprite.visible = true
sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
if position == 3
if self.viewport != nil
sprite.x = self.viewport.rect.width / 2
sprite.y = self.viewport.rect.height - 160
else
sprite.x = 320
sprite.y = 240
end
else
sprite.x = self.x - self.ox + self.src_rect.width / 2
sprite.y = self.y - self.oy + self.src_rect.height / 2
sprite.y -= self.src_rect.height / 4 if position == 0
sprite.y += self.src_rect.height / 4 if position == 2
end
sprite.x += cell_data[i, 1]
sprite.y += cell_data[i, 2]
sprite.z = self.z#2000
sprite.ox = 96
sprite.oy = 96
sprite.zoom_x = cell_data[i, 3] / 100.0
sprite.zoom_y = cell_data[i, 3] / 100.0
sprite.angle = cell_data[i, 4]
sprite.mirror = (cell_data[i, 5] == 1)
sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
sprite.blend_type = cell_data[i, 7]
end
end
def animation_process_timing(timing, hit)
if (timing.condition == 0) or
(timing.condition == 1 and hit == true) or
(timing.condition == 2 and hit == false)
if timing.se.name != ""
se = timing.se
Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
end
case timing.flash_scope
when 1
self.flash(timing.flash_color, timing.flash_duration * 2)
when 2
if self.viewport != nil
self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
end
when 3
self.flash(nil, timing.flash_duration * 2)
@xiaoshi2 = timing.flash_duration
@xiaoshi = timing.flash_duration
end
end
end
def x=(x)
sx = x - self.x
if sx != 0
if @_animation_sprites != nil
for i in 0..15
@_animation_sprites[i].x += sx
end
end
if @_loop_animation_sprites != nil
for i in 0..15
@_loop_animation_sprites[i].x += sx
end
end
end
super
end
def y=(y)
sy = y - self.y
if sy != 0
if @_animation_sprites != nil
for i in 0..15
@_animation_sprites[i].y += sy
end
end
if @_loop_animation_sprites != nil
for i in 0..15
@_loop_animation_sprites[i].y += sy
end
end
end
super
end
end
end
module RPG
class Skill
def name
name = @name.split(/◆/)[0]
return name != nil ? name : ""
end
def kds_miao
name = @name.split(/◆/)[1]
return name != nil ? name.to_i.abs : 0
end
end
end
class Scene_Battle
def tg_xiuzheng(s)
for kds_dui in $data_skills[@active_battler.current_action.skill_id].plus_state_set
if $game_party.smooth_target_actor(s).states.include?(kds_dui)
return true
end
end
return false
end
def tg_xiuzheng2(s)
for kds_dui in $data_skills[@active_battler.current_action.skill_id].plus_state_set
if $game_troop.smooth_target_enemy(s).states.include?(kds_dui)
return true
end
end
return false
end
def dr_ac
index = @active_battler.current_action.target_index
$miao = 1
if @active_battler.current_action.kind == 1
@skill = $data_skills[@active_battler.current_action.skill_id]
if $data_skills[@skill.id].kds_miao > 1
@sudu = []
@guang = []
for s in 0..$game_party.actors.size-1
if $game_party.actors[s].hp != 0
@sudu.push($game_party.smooth_target_actor(s).agi)
@guang.push(s)
end
end
for a in
[email protected]
for s in
[email protected]
if s < @sudu.size-1 and @sudu[s] < @sudu[s+1]
elsif s < @sudu.size-1 and @sudu[s] > @sudu[s+1]
@abc = @sudu[s]
@sudu[s] = @sudu[s+1]
@sudu[s+1] = @abc
@bcd = @guang[s]
@guang[s] = @guang[s+1]
@guang[s+1] = @bcd
end
end
end
for s in
[email protected]
if @guang[@sudu.size-1-s] == index
else
$miao += 1
@target_battlers.push($game_party.smooth_target_actor(@guang[@sudu.size-1 - s]))
end
if $miao == $data_skills[@skill.id].kds_miao
break
end
end
end
end
end
def dr_dr
index = @active_battler.current_action.target_index
$miao = 1
if @active_battler.current_action.kind == 1
@skill = $data_skills[@active_battler.current_action.skill_id]
if $data_skills[@skill.id].kds_miao > 1
@sudu = []
@guang = []
for s in 0..$game_troop.enemies.size-1
if $game_troop.enemies[s].hp != 0 and @active_battler.current_action.kind == 1 and tg_xiuzheng2(s) == false
@sudu.push($game_troop.smooth_target_enemy(s).agi)
@guang.push(s)
end
end
for a in
[email protected]
for s in
[email protected]
if s < @sudu.size-1 and @sudu[s] < @sudu[s+1]
elsif s < @sudu.size-1 and @sudu[s] > @sudu[s+1]
@abc = @sudu[s]
@sudu[s] = @sudu[s+1]
@sudu[s+1] = @abc
@bcd = @guang[s]
@guang[s] = @guang[s+1]
@guang[s+1] = @bcd
end
end
end
for s in
[email protected]
if @guang[@sudu.size-1-s] == index
else
$miao += 1
@target_battlers.push($game_troop.smooth_target_enemy(@guang[@sudu.size-1 - s]))
end
if $miao == $data_skills[@skill.id].kds_miao
break
end
end
end
end
end
def ac_dr
index = @active_battler.current_action.target_index
if @active_battler.current_action.kind == 1
@skill = $data_skills[@active_battler.current_action.skill_id]
$miao = 1
if $data_skills[@skill.id].kds_miao > 1
@sudu = []
@guang = []
for s in 0..$game_troop.enemies.size-1
if $game_troop.enemies[s].hp != 0
@sudu.push($game_troop.smooth_target_enemy(s).agi)
@guang.push(s)
end
end
for a in
[email protected]
for s in
[email protected]
if s < @sudu.size-1 and @sudu[s] < @sudu[s+1]
elsif s < @sudu.size-1 and @sudu[s] > @sudu[s+1]
@abc = @sudu[s]
@sudu[s] = @sudu[s+1]
@sudu[s+1] = @abc
@bcd = @guang[s]
@guang[s] = @guang[s+1]
@guang[s+1] = @bcd
end
end
end
for s in
[email protected]
if @guang[@sudu.size-1-s] == index
else
$miao += 1
@target_battlers.push($game_troop.smooth_target_enemy(@guang[@sudu.size-1 - s]))
end
if $miao == $data_skills[@skill.id].kds_miao
break
end
end
end
end
end
def ac_ac
index = @active_battler.current_action.target_index
if @active_battler.current_action.kind == 1
@skill = $data_skills[@active_battler.current_action.skill_id]
$miao = 1
if $data_skills[@skill.id].kds_miao > 1
@sudu = []
@guang = []
for s in 0..$game_party.actors.size-1
if $game_party.actors[s].hp != 0 and @active_battler.current_action.kind == 1 and tg_xiuzheng(s) == false
@sudu.push($game_party.smooth_target_actor(s).agi)
@guang.push(s)
end
end
for a in
[email protected]
for s in
[email protected]
if s < @sudu.size-1 and @sudu[s] < @sudu[s+1]
elsif s < @sudu.size-1 and @sudu[s] > @sudu[s+1]
@abc = @sudu[s]
@sudu[s] = @sudu[s+1]
@sudu[s+1] = @abc
@bcd = @guang[s]
@guang[s] = @guang[s+1]
@guang[s+1] = @bcd
end
end
end
for s in
[email protected]
if @guang[@sudu.size-1-s] == index
else
$miao += 1
@target_battlers.push($game_party.smooth_target_actor(@guang[@sudu.size-1 - s]))
end
if $miao == $data_skills[@skill.id].kds_miao
break
end
end
end
end
end
end
复制代码
使用方法 技能名后加◆XX XX代表攻击数量
比如火箭◆2 就是打2个敌人
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1