#位移BY:SOULSAGA
#使用方法:打开RMXP备注编辑器RXDataEditor.exe
#在技能备注写
#X移动:+:位移植
#X移动:-:位移植
#向左移是-向右移是+敌人打我方则相反
#Y移动:+:位移植
#Y移动:-:位移植
#等待:帧数值 最大是动画总帧数+14 超过不会有效
#受伤动作:战斗图用星号隔开的编号..
#X持续移动:+或-:位移值:持续帧数 每1帧进行X位移持续指定帧数
#Y持续移动:+或-:位移值:持续帧数 每1帧进行Y位移持续指定帧数
#20170816新增版边限制
class Game_Battler
alias item_effectsoulsaga item_effect
def item_effect(item)
$skill_id = 1
$skillmoveflag = "OFF"
$wait_count = 0
@wait_skill = false
$i = 0
$battler_damage = 3
$xmove_time = 0
$xmove = 0
$ymove_time = 0
$ymove = 0
return item_effectsoulsaga(item)
end
#--------------------------------------------------------------------------
# ● 应用通常攻击效果
# attacker : 攻击者 (battler)
#--------------------------------------------------------------------------
alias attack_effect20170814 attack_effect
def attack_effect(attacker)
$activebattler = attacker if attacker.is_a?(Game_Actor)#如果攻击者是角色就代入到变量里
$skill_id = 1
$skillmoveflag = "OFF"
$wait_count = 0
@wait_skill = false
$i = 0
$battler_damage = 3
$xmove_time = 0
$xmove = 0
$ymove_time = 0
$ymove = 0
return attack_effect20170814(attacker)
end
#--------------------------------------------------------------------------
# ● 应用特技效果
# user : 特技的使用者 (battler)
# skill : 特技
#--------------------------------------------------------------------------
alias skill_effect20170814 skill_effect
def skill_effect(user, skill)
$skill_id = skill.id
$skillmoveflag = "OFF"
$wait_count = 0
@wait_skill = false
$i = 0
$battler_damage = 3
$xmove_time = 0
$xmove = 0
$ymove_time = 0
$ymove = 0
$activebattler = user if user.is_a?(Game_Actor)#如果攻击者是角色就代入到变量里
return skill_effect20170814(user, skill)
end
end
module RPG
class Sprite < ::Sprite
#位移BY:SOULSAGA
#..........................................................................
def update_animation
if @_animation_duration > 0
frame_index = @_animation.frame_max - @_animation_duration
@frame_index = frame_index
cell_data = @_animation.frames[frame_index].cell_data
position = @_animation.position
animation_set_sprites(@_animation_sprites, cell_data, position)
if $xmove_time > 0 and @battler.damage != "Miss" and @battler.damage != nil
case $xmoveif
when "-"
self.x -= $xmove if @battler.is_a?(Game_Enemy)
self.x += $xmove if @battler.is_a?(Game_Actor)
when "+"
self.x += $xmove if @battler.is_a?(Game_Enemy)
self.x -= $xmove if @battler.is_a?(Game_Actor)
end
$xmove_time -= 1
end
if $ymove_time > 0 and @battler.damage != "Miss" and @battler.damage != nil
case $ymoveif
when "-"
self.y -= $ymove if @battler.is_a?(Game_Enemy)
self.y += $ymove if @battler.is_a?(Game_Actor)
when "+"
self.y += $ymove if @battler.is_a?(Game_Enemy)
self.y -= $ymove if @battler.is_a?(Game_Actor)
end
$ymove_time -= 1
end
$ox = self.x if !$ox or $ox.nil?
$oy = self.y if !$oy or $oy.nil?
$wait_count -= 1 if $wait_count >= 1
if $skillmoveflag == "OFF"
@skill_xmove = []
skill = $data_skills[$skill_id]
skill_xymove = skill.note.split(/\r\n/)
if $wait_count <= 0 and @battler.damage != "Miss" and @battler.damage != nil
while $i < skill_xymove.length
if $wait_count <= 0 and @battler.damage != "Miss" and @battler.damage != nil
@skill_xmove = skill_xymove[$i].split(/:/)
if skill_xymove[$i].include?("X移动")
case @skill_xmove[1]
when "-"
self.x -= @skill_xmove[2].to_i if @battler.is_a?(Game_Enemy)
self.x += @skill_xmove[2].to_i if @battler.is_a?(Game_Actor)
when "+"
self.x += @skill_xmove[2].to_i if @battler.is_a?(Game_Enemy)
self.x -= @skill_xmove[2].to_i if @battler.is_a?(Game_Actor)
end
end
if skill_xymove[$i].include?("Y移动")
case @skill_xmove[1]
when "+"
self.y += @skill_xmove[2].to_i if @battler.is_a?(Game_Enemy)
self.y += @skill_xmove[2].to_i if @battler.is_a?(Game_Actor)
when "-"
self.y -= @skill_xmove[2].to_i if @battler.is_a?(Game_Enemy)
self.y -= @skill_xmove[2].to_i if @battler.is_a?(Game_Actor)
end
end
end
if skill_xymove[$i].include?("X持续移动")
case @skill_xmove[1]
when "-"
self.x -= @skill_xmove[2].to_i if @battler.is_a?(Game_Enemy)
self.x += @skill_xmove[2].to_i if @battler.is_a?(Game_Actor)
$xmoveif = @skill_xmove[1]
$xmove = @skill_xmove[2].to_i
$xmove_time = @skill_xmove[3].to_i
when "+"
self.x += @skill_xmove[2].to_i if @battler.is_a?(Game_Enemy)
self.x -= @skill_xmove[2].to_i if @battler.is_a?(Game_Actor)
$xmoveif = @skill_xmove[1]
$xmove = @skill_xmove[2].to_i
$xmove_time = @skill_xmove[3].to_i
end
end
if skill_xymove[$i].include?("Y持续移动")
case @skill_xmove[1]
when "-"
self.y -= @skill_xmove[2].to_i if @battler.is_a?(Game_Enemy)
self.y += @skill_xmove[2].to_i if @battler.is_a?(Game_Actor)
$ymoveif = @skill_xmove[1]
$ymove = @skill_xmove[2].to_i
$ymove_time = @skill_xmove[3].to_i
when "+"
self.y += @skill_xmove[2].to_i if @battler.is_a?(Game_Enemy)
self.y -= @skill_xmove[2].to_i if @battler.is_a?(Game_Actor)
$ymoveif = @skill_xmove[1]
$ymove = @skill_xmove[2].to_i
$ymove_time = @skill_xmove[3].to_i
end
end
if skill_xymove[$i].include?("受伤动作")
$battler_damage = @skill_xmove[1].to_i
end
if skill_xymove[$i].include?("等待")
$wait_count = @skill_xmove[1].to_i
$skillmoveflag = "OFF"
end
$i += 1
break if $wait_count > 0
$skillmoveflag = "ON"
end
end
end
if frame_index == $fanime_frame_max-1
self.x = $ox
self.y = $oy
$ox = nil
$oy = nil
end
self.x = 640640-self.ox if self.x > 640-self.ox #if @battler.is_a?(Game_Enemy)
self.x = 0+self.ox if self.x < 0+self.ox #if @battler.is_a?(Game_Actor)
#=======================================
# 修改:弹出伤害,权重计算
#=======================================
for timing in @_animation.timings
if timing.frame == frame_index
t = 1.0 * animation_process_timing(timing, @_animation_hit)
#p t,"当前权重", @all_quanzhong,"总权重"
if @battler_damage.is_a?(Numeric) and t != 0
t *= @battler_damage
t /= @all_quanzhong
t = t.to_i
#在闪光不是最后一次的情况下,把这次伤害加入到已经发生的伤害中★★★★★★★★★★★★★★★★★★★★★★★★★★
if frame_index != @_last_frame
@p_dam+= t
end
#p @p_dam,"已发生伤害",@battler_damage,"总伤害"(调试用)★★★★★★★★★★★★★★★★★★★★★★★★★★
#闪光为最后一次的情况下,改变这次伤害的计算方法(总伤害-已经发生伤害)★★★★★★★★★★★★★★★★★★★★★★★★★★
if frame_index == @_last_frame
t= @battler_damage-@p_dam
end
#p t,"当前伤害",@battler_damage,"总伤害"
# 最后一次闪光的话,伤害修正
if frame_index == @_last_frame
@_total_damage = @battler_damage - t
@p_dam=0 #已经发生的伤害归0★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
end
#p t,@battler_damage,@all_quanzhong
damage(t,@battler_critical) if timing.flash_scope != 3
#连击次数归0★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
if frame_index == @_last_frame
############ #小改动
@last_hits=1
@temp_hits=0
############
@hits=0
end
# 防止重复播放miss
elsif !@battler_damage.is_a?(Numeric) and timing.flash_scope != 0
damage(@battler_damage,@battler_critical)
end
end
end
else
dispose_animation
end
end
end
end
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# ● 处理角色动作
#--------------------------------------------------------------------------
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)
@battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 1)
@battler.setup_battler_hurt_ani(1)
end
@last_frame = $fanime_frame_max if $fanime_frame_max > @last_frame
if @battler.current_action.kind == 0 and @battler.current_action.basic == 1 and @battler.show_damage_value != nil
# 防御的时候
if @hits > @temp_hits and not @battler.dead?
############ #小改动
@temp_hits+=1
############
@battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
@battler.setup_battler_hurt_ani(1)
#################################################################
elsif @last_hits == 1 and not @battler.dead?
############ #小改动
@last_hits = 0
############
@battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
@battler.setup_battler_hurt_ani(1)
#################################################################
elsif @frame_index != -1 and @frame_index != @last_frame and not @battler.dead? and !@battler.damage.is_a?(Numeric)
@battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
@battler.setup_battler_hurt_ani(1)
#################################################################
elsif @last_hits == 1 and not @battler.dead? and !@battler.damage.is_a?(Numeric)
############ #小改动
@last_hits = 0
############
@battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
@battler.setup_battler_hurt_ani(1)
#################################################################
end
else
# 单回合只有一次攻击
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_ani(@battler.battler_name.split(/★/)[$battler_damage], 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
############ #小改动
@temp_hits+=1
############
@battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 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
############ #小改动
@temp_hits+=1
############
@battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 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 @frame_index == @last_frame and @battler.dead? and @battler.battler_dead_ani != 1
#p 111
#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)
#################################################################
# 胜利判定
elsif $scene.phase == 5 and [url=home.php?mod=space&uid=2659152]@oNCE[/url] == 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
@battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 1) if @frame_index < @last_frame and @frame_index > 0 and @battler.battler_dead_ani != 1 and $battler_damage != 3 and @battler.damage.is_a?(Numeric)
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)
@battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 1)
@battler.setup_battler_hurt_ani(1)
end
@last_frame = $fanime_frame_max if $fanime_frame_max > @last_frame
if @battler.current_action.kind == 0 and @battler.current_action.basic == 1
else
# 单回合只有一次攻击
if @last_hits == 1 and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0
############ #小改动
#p 222
@last_hits = 0
############
@battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 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
############ #小改动
#p 111
@temp_hits+=1
############
@battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 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
############ #小改动
#p 333
@temp_hits+=1
############
@battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 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 @frame_index == @last_frame and @battler.dead? and @battler.battler_dead_ani != 1
#p $fanime_frame_max
#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)
collapse
end
end
@battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 1) if @frame_index < @last_frame and @frame_index > 0 and @battler.battler_dead_ani != 1 and $battler_damage != 3 and @battler.damage.is_a?(Numeric)
end
end
end