赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 0 |
最后登录 | 2014-12-16 |
在线时间 | 18 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 1269
- 在线时间
- 18 小时
- 注册时间
- 2014-1-19
- 帖子
- 3
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
无语了,游戏中设定了一个事件,关于开关门的,当开关1为ON时一个图片消失,当选择是的时候,开关1开启,看当我按下空格键时,就出现了这个错误,求解~~
下面是出错的脚本:
#by pudding
#------------------------------------------------------------------------------
# 地图显示生命和地图显示伤害。
#==============================================================================
class Sprite_Character < RPG::Sprite
attr_accessor :character
def initialize(viewport, character = nil)
super(viewport)
@character = character
@hpspsprite = Sprite.new(viewport)
@hpspsprite.bitmap = Bitmap.new(160, 480)
@hpspsprite.z = 0
@hp = 0
@maxhp = 0
@sp = $game_party.actors[0].sp
@maxsp = $game_party.actors[0].maxsp
@damage = 0
@level = $game_party.actors[0].level
end #initialize
#------------------------------------------------------------------------------
# 刷新
#------------------------------------------------------------------------------
alias :old_update :update
def update
old_update
event = $game_map.events[@character.id] if @character.id != 0
if @character.id != 0 and (@character.return_erased2 or @character.list[0].code != 108 or @character.list[0].parameters[0] != "全部")
@hpspsprite.bitmap.clear
old_update
return
end
#------------------------------------------------------------------------------
#
#------------------------------------------------------------------------------
if @character.id == 0
@hp = $game_party.actors[0].hp
@maxhp = $game_party.actors[0].maxhp
else
@damage -= @character.damage if @character.id != 0 and @character.damage
@hp = @character.list[4].parameters[0].to_i + @damage
@maxhp = @character.list[5].parameters[0].to_i
@exp = @character.list[6].parameters[0].to_i
end
#------------------------------------------------------------------------------
# 描绘敌人HP
#------------------------------------------------------------------------------
if @character.id != 0 and (@character.return_erased2 or @character.list[0].code != 108 or @character.list[2].parameters[0] != "特殊")
p2 = 21 * @hp/[@maxhp].max
@hpspsprite.bitmap.fill_rect(90,98,31,6,Color.new(0,0,0))
@hpspsprite.bitmap.fill_rect(99,99,21,4,Color.new(255,255,255))
@hpspsprite.bitmap.fill_rect(99,99,p2,4,Color.new(255,0,0))
@hpspsprite.bitmap.font.size = 7
@hpspsprite.bitmap.font.color.set(255, 255, 255)
@hpspsprite.bitmap.draw_text(0, 0, 190, 202, "HP", 1)
else
p2 = 21 * @hp/[@maxhp].max
@hpspsprite.bitmap.fill_rect(90,98,31,6,Color.new(0,0,0))
@hpspsprite.bitmap.fill_rect(99,99,21,4,Color.new(255,255,255))
@hpspsprite.bitmap.fill_rect(99,99,p2,4,Color.new(0,255,0))
@hpspsprite.bitmap.font.size = 7
@hpspsprite.bitmap.font.color.set(255, 255, 255)
@hpspsprite.bitmap.draw_text(0, 0, 190, 202, "HP", 1)
end
#------------------------------------------------------------------------------
# 描绘角色HP
#------------------------------------------------------------------------------
if @character.id == 0
p2 = 21 * @hp/[@maxhp].max
@hpspsprite.bitmap.fill_rect(90,98,31,6,Color.new(0,0,0))
@hpspsprite.bitmap.fill_rect(99,99,21,4,Color.new(255,255,255))
@hpspsprite.bitmap.fill_rect(99,99,p2,4,Color.new(255,0,0))
@hpspsprite.bitmap.font.size = 7
@hpspsprite.bitmap.font.color.set(255, 255, 255)
@hpspsprite.bitmap.draw_text(0, 0, 190, 202, "HP", 1)
end
#------------------------------------------------------------------------------
# 敌人的名字显示
#------------------------------------------------------------------------------
if @character.id != 0 and @ccd == nil
@ccd = 1
@hpspsprite.bitmap.font.size = 12
@hpspsprite.bitmap.font.color.set(0, 0, 0)
@hpspsprite.bitmap.draw_text(-1, -1, 215, 220, "#{@character.name}", 1)
@hpspsprite.bitmap.draw_text(+1, -1, 215, 220, "#{@character.name}", 1)
@hpspsprite.bitmap.draw_text(-1, +1, 215, 220, "#{@character.name}", 1)
@hpspsprite.bitmap.draw_text(+1, +1, 215, 220, "#{@character.name}", 1)
if @character.return_erased2 or @character.list[0].code != 108 or @character.list[2].parameters[0] != "特殊"
@hpspsprite.bitmap.font.color.set(255, 0, 0)
else
@hpspsprite.bitmap.font.color.set(0, 255, 0)
end
@hpspsprite.bitmap.draw_text(0, 0, 215, 220, "#{@character.name}", 1)
end
#------------------------------------------------------------------------------
# 角色名字
#------------------------------------------------------------------------------
if @character.id == 0 and @kk == nil
@kk = 1
p3 = 21 * @sp/[@maxsp].max
@hpspsprite.bitmap.fill_rect(90,104,31,5,Color.new(0,0,0))
@hpspsprite.bitmap.fill_rect(99,104,21,4,Color.new(255,255,255))
@hpspsprite.bitmap.fill_rect(99,104,p3,4,Color.new(0,135,255))
@hpspsprite.bitmap.draw_text(0, 0, 190, 213, "SP", 1)
@hpspsprite.bitmap.font.size = 12
@hpspsprite.bitmap.font.color.set(0, 0, 0)
@hpspsprite.bitmap.draw_text(-1, -1, 215, 230, "Lv"+"#{$game_party.actors[0].level.to_i}"+" "+"#{$game_party.actors[0].name}", 1)
@hpspsprite.bitmap.draw_text(+1, -1, 215, 230, "Lv"+"#{$game_party.actors[0].level.to_i}"+" "+"#{$game_party.actors[0].name}", 1)
@hpspsprite.bitmap.draw_text(-1, +1, 215, 230, "Lv"+"#{$game_party.actors[0].level.to_i}"+" "+"#{$game_party.actors[0].name}", 1)
@hpspsprite.bitmap.draw_text(+1, +1, 215, 230, "Lv"+"#{$game_party.actors[0].level.to_i}"+" "+"#{$game_party.actors[0].name}", 1)
@hpspsprite.bitmap.font.color.set(0, 170, 250)
@hpspsprite.bitmap.draw_text(0, 0, 215, 230, "Lv"+"#{$game_party.actors[0].level.to_i}"+" "+"#{$game_party.actors[0].name}", 1)
end
#------------------------------------------------------------------------------
# 描绘SP
#------------------------------------------------------------------------------
if @character.id == 0
if @sp != $game_party.actors[0].sp
@sp = $game_party.actors[0].sp
@maxsp = $game_party.actors[0].maxsp
p3 = 21 * @sp/[@maxsp].max
@hpspsprite.bitmap.fill_rect(90,104,31,5,Color.new(0,0,0))
@hpspsprite.bitmap.fill_rect(99,104,21,4,Color.new(255,255,255))
@hpspsprite.bitmap.fill_rect(99,104,p3,4,Color.new(0,135,255))
@hpspsprite.bitmap.draw_text(0, 0, 190, 213, "SP", 1)
end
#------------------------------------------------------------------------------
# 显示名字和等级
#------------------------------------------------------------------------------
if @level != $game_party.actors[0].level
@level = $game_party.actors[0].level
@hpspsprite.bitmap.clear
@hpspsprite.bitmap.font.size = 12
@hpspsprite.bitmap.font.color.set(0, 0, 0)
@hpspsprite.bitmap.draw_text(-1, -1, 215, 230, "Lv"+"#{$game_party.actors[0].level.to_i}"+" "+"#{$game_party.actors[0].name}", 1)
@hpspsprite.bitmap.draw_text(+1, -1, 215, 230, "Lv"+"#{$game_party.actors[0].level.to_i}"+" "+"#{$game_party.actors[0].name}", 1)
@hpspsprite.bitmap.draw_text(-1, +1, 215, 230, "Lv"+"#{$game_party.actors[0].level.to_i}"+" "+"#{$game_party.actors[0].name}", 1)
@hpspsprite.bitmap.draw_text(+1, +1, 215, 230, "Lv"+"#{$game_party.actors[0].level.to_i}"+" "+"#{$game_party.actors[0].name}", 1)
@hpspsprite.bitmap.font.color.set(0, 170, 250)
@hpspsprite.bitmap.draw_text(0, 0, 215, 230, "Lv"+"#{$game_party.actors[0].level.to_i}"+" "+"#{$game_party.actors[0].name}", 1)
end
end
#------------------------------------------------------------------------------
# 设置坐标
#------------------------------------------------------------------------------
@hpspsprite.x = self.x-106
@hpspsprite.y = self.y-98
#------------------------------------------------------------------------------
# 地图显示伤害一部分
#------------------------------------------------------------------------------
if @character.damage_pop
damage(@character.damage, @character.critical)
@character.damage = nil
@character.critical = false
@character.damage_pop = false
end
#------------------------------------------------------------------------------
# 当敌人生命值小于0时。
#------------------------------------------------------------------------------
if @hp <= 0 and @character.id != 0 and [email protected]_erased2 and @character.list[0].code == 108 and @character.list[0].parameters[0] == "全部"
@character.erase2
end
#------------------------------------------------------------------------------
# 角色死亡设置
#------------------------------------------------------------------------------
if $game_party.actors[0].hp <= 1
$scene = Scene_Gameover.new
Mess_Text.clear
end
#------------------------------------------------------------------------------
# 敌人死亡设置
#------------------------------------------------------------------------------
if @character.id != 0 and @character.return_erased2 == true and @asd == nil
@asd = 1
$game_party.actors[0].exp += @exp
Mess_Text.write ("#{@character.name}被消灭了。")
Mess_Text.write ("获得#{@exp.to_i}点经验值。")
@character.erase
end
end #update
end#class
#------------------------------------------------------------------------------
#
#------------------------------------------------------------------------------
class Game_Event
def return_erased2
return @erased2
end
def erase2
@erased2 = true
end
end
class Game_Event < Game_Character
#——————————————————————————————————————
# 用来返回名称
#——————————————————————————————————————
def name
return @event.name
end
def name=(newname)
@event.name = newname
end
end
#------------------------------------------------------------------------------
#地图显示伤害一部分
#------------------------------------------------------------------------------
class Game_Character
attr_writer :opacity
attr_accessor :through
attr_accessor :character_name
attr_accessor :white_flash
attr_accessor :damage_pop
attr_accessor :damage
attr_accessor :critical
attr_accessor :move_speed
alias carol3_66RPG_damage_pop_initialize initialize
def initialize
@damage_pop = false
@damage = 0
@critical = false
@white_flash=false
carol3_66RPG_damage_pop_initialize
end
end
#------------------------------------------------------------------------------
# 播放动画时,不能移动(角色)
#==============================================================================
class Game_Player
attr_accessor :sprite
alias hzhj_update update
def update
return if @sprite != nil and @sprite.effect?
hzhj_update
end
end
module RPG
class Sprite < ::Sprite
def effect?
@_whiten_duration > 0 or
@_appear_duration > 0 or
@_escape_duration > 0 or
@_collapse_duration > 0 or
@_animation_duration > 0
end
end
end
class Sprite_Character < RPG::Sprite
alias hzhj_initialize initialize
def initialize(viewport, character = nil)
hzhj_initialize(viewport, character)
if @character.class == Game_Player
@character.sprite = self
end
end
end
#------------------------------------------------------------------------------
# 处理地图画面的类。
#------------------------------------------------------------------------------
$enemy_S = 0
$friend_S = 0
#------------------------------------------------------------------------------
class Scene_Map
alias update_kc update
def update
update_kc
@ppp = $game_party.actors[0]
#〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓
#▲△▲▲△▲▲△▲▲△▲▲△★ 敌人攻击 ★△▲▲△▲▲△▲▲△▲▲△▲▲△▲
#〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓
for enemy in $game_map.events.values
next if enemy.return_erased2
next if enemy.list == nil
next if enemy.list[0].code != 108
next if enemy.list[1].parameters[0] != "敌人"
for friend in $game_map.events.values
next if friend.return_erased2
next if friend.list == nil
next if friend.list[0].code != 108
next if friend.list[1].parameters[0] != "队友"
#--------------------------设置注释----------------------------------------------
#敌人的攻击力
@enemy_attack = enemy.list[7].parameters[0].to_i
#敌人物理防御
@enemy_pdef = enemy.list[8].parameters[0].to_i
#敌人显示的动画
@enemy_animation = enemy.list[9].parameters[0].to_i
#敌人攻击速度
@enemy_S = enemy.list[10].parameters[0].to_i
#------------------------------------------------------------------------------
#角色的攻击
@ppp_attack = @ppp.atk/2 + @ppp.str
#角色的攻击减去敌人的防御
@ppp_damage = @ppp_attack - @enemy_pdef.to_i
#普通箭的伤害
@arrow_damage = (@ppp_damage + @ppp.dex) * @ppp.agi
#技能箭的伤害
@arrow_skill_damage = ((@ppp_damage + @ppp.dex + @ppp.int) * @ppp.agi) *2
#------------------------------------------------------------------------------
#队友的攻击力
@friend_attack = friend.list[7].parameters[0].to_i
#队友的防御力
@friend_pdef = friend.list[8].parameters[0].to_i
#队友显示的动画
@friend_animation_id = friend.list[9].parameters[0].to_i
#队友攻击速度
@friend_S = friend.list[10].parameters[0].to_i
#------------------------------------------------------------------------------
# △敌人面向下,设置攻击△ (队友)
#------------------------------------------------------------------------------
if friend.x == enemy.x and friend.y - enemy.y == 1 and enemy.direction == 2
$enemy_S += 1
case rand(5) #减少攻击次数
when 2
if $enemy_S >= @enemy_S #延迟攻击速度
enemy.animation_id = @enemy_animation
if @friend_pdef >= @enemy_attack #当敌人攻击少于队友防御
$game_switches[31] = true #显示MISS
friend.damage_pop = true
$enemy_S = 0
Mess_Text.write ("#{friend.name}没有受到伤害。")
else
friend.damage = @enemy_attack - @friend_pdef
friend.damage_pop = true
$enemy_S = 0
Mess_Text.write ("#{friend.name}受到#{friend.damage.to_i}点伤害。")
end #if
end #if
end #case
end #if
#------------------------------------------------------------------------------
# △敌人面向左,设置攻击△(队友)
#------------------------------------------------------------------------------
if friend.x - enemy.x == -1 and friend.y == enemy.y and enemy.direction == 4
$enemy_S += 1
case rand(5) #减少攻击次数
when 2
if $enemy_S >= @enemy_S #延迟攻击速度
enemy.animation_id = @enemy_animation + 1
if @friend_pdef >= @enemy_attack #当敌人攻击少于队友防御
$game_switches[31] = true #显示MISS
friend.damage_pop = true
$enemy_S = 0
Mess_Text.write ("#{friend.name}没有受到伤害。")
else
friend.damage = @enemy_attack - @friend_pdef
friend.damage_pop = true
$enemy_S = 0
Mess_Text.write ("#{friend.name}受到#{friend.damage.to_i}点伤害。")
end #if
end #if
end #case
end #if
#------------------------------------------------------------------------------
# △敌人面向右,设置攻击△(队友)
#------------------------------------------------------------------------------
if friend.x - enemy.x == 1 and friend.y == enemy.y and enemy.direction == 6
$enemy_S += 1
case rand(5) #减少攻击次数
when 2
if $enemy_S >= @enemy_S #延迟攻击速度
enemy.animation_id = @enemy_animation + 2
if @friend_pdef >= @enemy_attack #当敌人攻击少于队友防御
$game_switches[31] = true #显示MISS
friend.damage_pop = true
$enemy_S = 0
Mess_Text.write ("#{friend.name}没有受到伤害。")
else
friend.damage = @enemy_attack - @friend_pdef
friend.damage_pop = true
$enemy_S = 0
Mess_Text.write ("#{friend.name}受到#{friend.damage.to_i}点伤害。")
end #if
end #if
end #case
end #if
#------------------------------------------------------------------------------
# △敌人面向上,设置攻击△(队友)
#------------------------------------------------------------------------------
if friend.x == enemy.x and friend.y - enemy.y == -1 and enemy.direction == 8
$enemy_S += 1
case rand(5) #减少攻击次数
when 2
if $enemy_S >= @enemy_S #延迟攻击速度
enemy.animation_id = @enemy_animation + 3
if @friend_pdef >= @enemy_attack #当敌人攻击少于队友防御
$game_switches[31] = true #显示MISS
friend.damage_pop = true
$enemy_S = 0
Mess_Text.write ("#{friend.name}没有受到伤害。")
else
friend.damage = @enemy_attack - @friend_pdef
friend.damage_pop = true
$enemy_S = 0
Mess_Text.write ("#{friend.name}受到#{friend.damage.to_i}点伤害。")
end #if
end #if
end #case
end #if
end #for
end #for
#------------------------------------------------------------------------------
# ▲敌人面向下,设置攻击▲ (角色)
#------------------------------------------------------------------------------
for enemy in $game_map.events.values
next if enemy.return_erased2
next if enemy.list == nil
next if enemy.list[0].code != 108
next if enemy.list[1].parameters[0] != "敌人"
if $game_player.x == enemy.x and $game_player.y - enemy.y == 1 and enemy.direction == 2
$enemy_S += 1
case rand(5) #减少攻击次数
when 2
if $enemy_S >= @enemy_S #延迟攻击速度
enemy.animation_id = @enemy_animation
if @ppp.pdef >= @enemy_attack #当敌人攻击少于角色防御
$game_switches[31] = true #显示MISS
$game_player.damage_pop = true
$enemy_S = 0
Mess_Text.write ("#{@ppp.name}没有受到伤害。")
else
$game_player.damage = @enemy_attack - @ppp.pdef
$game_player.damage_pop = true
@ppp.hp -= $game_player.damage
$enemy_S = 0
Mess_Text.write ("#{@ppp.name}受到#{$game_player.damage.to_i}点伤害。")
end #if
end #if
end #case
end #if
#------------------------------------------------------------------------------
# ▲敌人面向左,设置攻击▲ (角色)
#------------------------------------------------------------------------------
if $game_player.x - enemy.x == -1 and $game_player.y == enemy.y and enemy.direction == 4
$enemy_S += 1
case rand(5) #减少攻击次数
when 2
if $enemy_S >= @enemy_S #延迟攻击速度
enemy.animation_id = @enemy_animation + 1
if @ppp.pdef >= @enemy_attack #当敌人攻击少于角色防御
$game_switches[31] = true #显示MISS
$game_player.damage_pop = true
$enemy_S = 0
Mess_Text.write ("#{@ppp.name}没有受到伤害。")
else
$game_player.damage = @enemy_attack - @ppp.pdef
$game_player.damage_pop = true
@ppp.hp -= $game_player.damage
$enemy_S = 0
Mess_Text.write ("#{@ppp.name}受到#{$game_player.damage.to_i}点伤害。")
end #if
end #if
end #case
end #if
#------------------------------------------------------------------------------
# ▲敌人面向右,设置攻击▲ (角色)
#------------------------------------------------------------------------------
if $game_player.x - enemy.x == 1 and $game_player.y == enemy.y and enemy.direction == 6
$enemy_S += 1
case rand(5) #减少攻击次数
when 2
if $enemy_S >= @enemy_S #延迟攻击速度
enemy.animation_id = @enemy_animation + 2
if @ppp.pdef >= @enemy_attack #当敌人攻击少于角色防御
$game_switches[31] = true #显示MISS
$game_player.damage_pop = true
$enemy_S = 0
Mess_Text.write ("#{@ppp.name}没有受到伤害。")
else
$game_player.damage = @enemy_attack - @ppp.pdef
$game_player.damage_pop = true
@ppp.hp -= $game_player.damage
$enemy_S = 0
Mess_Text.write ("#{@ppp.name}受到#{$game_player.damage.to_i}点伤害。")
end #if
end #if
end #case
end #if
#------------------------------------------------------------------------------
# ▲敌人面向上,设置攻击▲ (角色)
#------------------------------------------------------------------------------
#角色
if $game_player.x == enemy.x and $game_player.y - enemy.y == -1 and enemy.direction == 8
$enemy_S += 1
case rand(5) #减少攻击次数
when 2
if $enemy_S >= @enemy_S #延迟攻击速度
enemy.animation_id = @enemy_animation + 3
if @ppp.pdef >= @enemy_attack #当敌人攻击少于角色防御
$game_switches[31] = true #显示MISS
$game_player.damage_pop = true
$enemy_S = 0
Mess_Text.write ("#{@ppp.name}没有受到伤害。")
else
$game_player.damage = @enemy_attack - @ppp.pdef
$game_player.damage_pop = true
@ppp.hp -= $game_player.damage
$enemy_S = 0
Mess_Text.write ("#{@ppp.name}受到#{$game_player.damage.to_i}点伤害。")
end #if
end #if
end #case
end #if
#-------
end#for
#〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓
#▲△▲▲△▲▲△▲▲△▲▲△★ 角色攻击 ★△▲▲△▲▲△▲▲△▲▲△▲▲△▲
#〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓
if Input.trigger?(Input::L) and $game_player.sprite.effect? == false
case $game_player.direction
when 2 #角色向面下的动画
$game_player.animation_id = 101
when 4 #角色向面左的动画
$game_player.animation_id = 102
when 6 #角色向面右的动画
$game_player.animation_id = 103
when 8 #角色向面上的动画
$game_player.animation_id = 104
end
#------------------------------------------------------------------------------
for event in $game_map.events.values
next if event.return_erased2
next if event.list == nil
next if event.list[0].code != 108
next if event.list[1].parameters[0] != "敌人"
#------------------------------------------------------------------------------
# ▲角色面向下,设置攻击▲
#------------------------------------------------------------------------------
if $game_player.x == event.x and event.y - $game_player.y == 1 and $game_player.direction == 2
event.animation_id = 7
if @ppp_attack <= @enemy_pdef #当角色攻击小于敌人防御就显示Miss
$game_switches[31] = true #显示MISS
event.damage_pop = true
Mess_Text.write ("#{event.name}没有受到伤害。")
else
event.damage = @ppp_damage
event.damage_pop = true
event.jump(0,3)
Mess_Text.write ("#{event.name}受到#{@ppp_damage.to_i}点伤害。")
end
end
#------------------------------------------------------------------------------
# ▲角色面向左,设置攻击▲
#------------------------------------------------------------------------------
if $game_player.x - event.x == 1 and event.y == $game_player.y and $game_player.direction == 4
event.animation_id = 7
if @ppp_attack <= @enemy_pdef #当角色攻击小于敌人防御就显示Miss
$game_switches[31] = true #显示MISS
event.damage_pop = true
Mess_Text.write ("#{event.name}没有受到伤害。")
else
event.damage = @ppp_damage
event.damage_pop = true
event.jump(-3,0)
Mess_Text.write ("#{event.name}受到#{@ppp_damage.to_i}点伤害。")
end
end
#------------------------------------------------------------------------------
# ▲角色面向右,设置攻击▲
#------------------------------------------------------------------------------
if $game_player.x - event.x == -1 and event.y == $game_player.y and $game_player.direction == 6
event.animation_id = 7
if @ppp_attack <= @enemy_pdef #当角色攻击小于敌人防御就显示Miss
$game_switches[31] = true #显示MISS
event.damage_pop = true
Mess_Text.write ("#{event.name}没有受到伤害。")
else
event.damage = @ppp_damage
event.damage_pop = true
event.jump(3,0)
Mess_Text.write ("#{event.name}受到#{@ppp_damage.to_i}点伤害。")
end
end
#------------------------------------------------------------------------------
# ▲角色面向上,设置攻击▲
#------------------------------------------------------------------------------
if $game_player.x == event.x and event.y - $game_player.y == -1 and $game_player.direction == 8
event.animation_id = 7
if @ppp_attack <= @enemy_pdef #当角色攻击小于敌人防御就显示Miss
$game_switches[31] = true #显示MISS
event.damage_pop = true
Mess_Text.write ("#{event.name}没有受到伤害。")
else
event.damage = @ppp_damage
event.damage_pop = true
event.jump(0,-3)
Mess_Text.write ("#{event.name}受到#{@ppp_damage.to_i}点伤害。")
end
end
#------
end#for
end#if
#〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓
#▲△▲▲△▲▲△▲▲△▲▲△★ 队友攻击 ★△▲▲△▲▲△▲▲△▲▲△▲▲△▲
#〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓
for enemy in $game_map.events.values
next if enemy.return_erased2
next if enemy.list == nil
next if enemy.list[0].code != 108
next if enemy.list[1].parameters[0] != "敌人"
for friend in $game_map.events.values
next if friend.return_erased2
next if friend.list == nil
next if friend.list[0].code != 108
next if friend.list[1].parameters[0] != "队友"
#------------------------------------------------------------------------------
# ▲队友面向下,设置攻击▲
#------------------------------------------------------------------------------
if friend.x == enemy.x and enemy.y - friend.y == 1 and friend.direction == 2
$friend_S += 1
case rand(5) #减少攻击次数
when 2
if $friend_S >= @friend_S #延迟攻击速度
friend.animation_id = @friend_animation_id
if @enemy_pdef >= @friend_attack #当队友攻击少于敌人防御
$game_switches[31] = true #显示MISS
enemy.damage_pop = true
$friend_S = 0
Mess_Text.write ("#{enemy.name}没有受到伤害。")
else
enemy.damage = @friend_attack
enemy.damage_pop = true
enemy.jump(0,1)
$friend_S = 0
Mess_Text.write ("#{enemy.name}受到#{@friend_attack.to_i}点伤害。")
end #if
end #if
end #case
end #if
#------------------------------------------------------------------------------
# ▲队友面向左,设置攻击▲
#------------------------------------------------------------------------------
if friend.x - enemy.x == 1 and enemy.y == friend.y and friend.direction == 4
$friend_S += 1
case rand(5) #减少攻击次数
when 2
if $friend_S >= @friend_S #延迟攻击速度
friend.animation_id = @friend_animation_id + 1
if @enemy_pdef >= @friend_attack #当队友攻击少于敌人防御
$game_switches[31] = true #显示MISS
enemy.damage_pop = true
$friend_S = 0
Mess_Text.write ("#{enemy.name}没有受到伤害。")
else
enemy.damage = @friend_attack
enemy.damage_pop = true
enemy.jump(0,1)
$friend_S = 0
Mess_Text.write ("#{enemy.name}受到#{@friend_attack.to_i}点伤害。")
end #if
end #if
end #case
end #if
#------------------------------------------------------------------------------
# ▲队友面向右,设置攻击▲
#------------------------------------------------------------------------------
if friend.x - enemy.x == -1 and enemy.y == friend.y and friend.direction == 6
$friend_S += 1
case rand(5) #减少攻击次数
when 2
if $friend_S >= @friend_S #延迟攻击速度
friend.animation_id = @friend_animation_id + 2
if @enemy_pdef >= @friend_attack #当队友攻击少于敌人防御
$game_switches[31] = true #显示MISS
enemy.damage_pop = true
$friend_S = 0
Mess_Text.write ("#{enemy.name}没有受到伤害。")
else
enemy.damage = @friend_attack
enemy.damage_pop = true
enemy.jump(0,1)
$friend_S = 0
Mess_Text.write ("#{enemy.name}受到#{@friend_attack.to_i}点伤害。")
end #if
end #if
end #case
end #if
#------------------------------------------------------------------------------
# ▲队友面向上,设置攻击▲
#------------------------------------------------------------------------------
if friend.x == enemy.x and enemy.y - friend.y == -1 and friend.direction == 8
$friend_S += 1
case rand(5) #减少攻击次数
when 2
if $friend_S >= @friend_S #延迟攻击速度
friend.animation_id = @friend_animation_id + 3
if @enemy_pdef >= @friend_attack #当队友攻击少于敌人防御
$game_switches[31] = true #显示MISS
enemy.damage_pop = true
$friend_S = 0
Mess_Text.write ("#{enemy.name}没有受到伤害。")
else
enemy.damage = @friend_attack
enemy.damage_pop = true
enemy.jump(0,1)
$friend_S = 0
Mess_Text.write ("#{enemy.name}受到#{@friend_attack.to_i}点伤害。")
end #if
end #if
end #case
end #if
end#for
end#for
#------------------------------------------------------------------------------
#普通箭的判断
#------------------------------------------------------------------------------
for arr in $game_map.events.values
next if arr.return_erased2
next if arr.list == nil
next if arr.list[0].code != 108
next if arr.list[0].parameters[0] != "箭"
for event in $game_map.events.values
next if event.return_erased2
next if event.list == nil
next if event.list[0].code != 108
next if event.list[1].parameters[0] != "敌人"
if arr.x == event.x and arr.y == event.y
if @arrow_damage <= @enemy_pdef #当角色攻击小于敌人防御就显示Miss
$game_switches[31] = true #显示MISS
event.damage_pop = true
Mess_Text.write ("#{event.name}没有受到伤害。")
else
event.damage = @arrow_damage
event.damage_pop = true
arr.moveto(0,0)
arr.opacity = 0
Mess_Text.write ("#{event.name}受到#{@arrow_damage.to_i}点伤害。")
end
end
end
end
#------------------------------------------------------------------------------
#技能箭的判断
#------------------------------------------------------------------------------
for brr in $game_map.events.values
next if brr.return_erased2
next if brr.list == nil
next if brr.list[0].code != 108
next if brr.list[0].parameters[0] != "冰箭"
for event in $game_map.events.values
next if event.return_erased2
next if event.list == nil
next if event.list[0].code != 108
next if event.list[1].parameters[0] != "敌人"
if brr.x == event.x and brr.y == event.y
if @arrow_skill_damage <= @enemy_pdef #当角色攻击小于敌人防御就显示Miss
$game_switches[31] = true #显示MISS
event.damage_pop = true
Mess_Text.write ("#{event.name}没有受到伤害。")
else
event.damage = @arrow_skill_damage
event.damage_pop = true
brr.moveto(0,0)
brr.opacity = 0
Mess_Text.write ("#{event.name}受到#{@arrow_skill_damage.to_i}点伤害。")
end
end
end
end
end#update
#--------------------------------------------------------------------------
# ● 物品炸弹
#--------------------------------------------------------------------------
def item_bomb
for bomb in $game_map.events.values
next if bomb.list == nil
next if bomb.list[0].code != 108
next if bomb.list[0].parameters[0] != "bomb"
bomb.animation_id = 99
for event in $game_map.events.values
next if event.return_erased2
next if event.list == nil
next if event.list[0].code != 108
next if event.list[1].parameters[0] != "敌人"
if (bomb.x - event.x).abs <= 1 and (bomb.y - event.y).abs <= 2
event.damage = (@ppp_attack + @ppp.int/2)*2 + 500
event.damage_pop = true
case $game_player.direction
when 2
event.jump(0, 1)
when 4
event.jump(-1, 0)
when 6
event.jump(1, 0)
when 8
event.jump(0, -1)
end
Mess_Text.write ("#{event.name}受到#{event.damage.to_i}点伤害")
end
end
end
end #def item_bomb
end#class
|
|