赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 6720 |
最后登录 | 2015-10-21 |
在线时间 | 211 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 211 小时
- 注册时间
- 2011-10-2
- 帖子
- 35
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
要么只显示伤害没有npc名字,掉个位子情况就反过来了……
不知道是哪位大神的脚本,
npc名称:- #==============================================================================
- # 显示NPC名
- #------------------------------------------------------------------------------
- # 跟原版一样,EV开头的不显示,逗号后加颜色代码
- # 修改某事件名的方法:
- # set_npc_name("新名", 事件ID, 地图ID, 是否永久生效)
- # 事件ID 为空时表示当前事件
- # 地图ID 为空时表示当前地图
- # 是否永久生效 默认永久,否则只允许修改当前地图
- #==============================================================================
- # 参数设定
- #==============================================================================
- module NPC
- NAME_FONT = "黑体"
- NAME_SIZE = 16
- NAME_SHADOW = false
- NAME_WIDTH = 120
- end
- #==============================================================================
- # 重定事件名
- #==============================================================================
- def set_npc_name(name, event_id = nil, map_id = nil, forever = true)
- # 处理事件 ID
- if event_id == nil
- event_id = $game_map.interpreter.event_id
- end
- # 处理地图 ID
- if map_id == nil
- $game_map.events[event_id].name = name
- map_id = $game_map.map_id
- else
- map_id = map_id
- end
- return unless forever
- data = load_data(sprintf("Data/Map%03d.rvdata", map_id))
- # 更改名
- data.events[event_id].name = name
- save_data(data, sprintf("Data/Map%03d.rvdata", map_id))
- end
- #==============================================================================
- # ■ Game_Character
- #==============================================================================
- class Game_Character
- #--------------------------------------------------------------------------
- # ◎ 定义实例变量
- #--------------------------------------------------------------------------
- attr_accessor :name # 名称
- #--------------------------------------------------------------------------
- # ◎ 初始化对象
- #--------------------------------------------------------------------------
- alias character_ini initialize
- def initialize
- character_ini
- @name = ""
- end
- end
- #==============================================================================
- # ■ Game_Event
- #==============================================================================
- class Game_Event < Game_Character
- #--------------------------------------------------------------------------
- # ◎ 定义实例变量
- #--------------------------------------------------------------------------
- attr_reader :erased
- #--------------------------------------------------------------------------
- # ◎ 初始化对像
- # map_id : 地图 ID
- # event : 事件 (RPG::Event)
- #--------------------------------------------------------------------------
- alias event_ini initialize
- def initialize(map_id, event)
- event_ini(map_id, event)
- @name = @event.name
- end
- end
- #==============================================================================
- # ■ Game_Player
- #==============================================================================
- class Game_Player < Game_Character
- #--------------------------------------------------------------------------
- # ◎ 获取角色名
- #--------------------------------------------------------------------------
- def name
- return $game_party.members[0].name
- end
- end
- #==============================================================================
- # ■ Game_Interpreter
- #==============================================================================
- class Game_Interpreter
- #--------------------------------------------------------------------------
- # ◎ 定义实例变量
- #--------------------------------------------------------------------------
- attr_reader :event_id
- end
- #==============================================================================
- # ■ Sprite_Character
- #==============================================================================
- class Sprite_Character < Sprite_Base
- #--------------------------------------------------------------------------
- # ◎ 初始化对象
- # viewport : 视区
- # character : 角色 (Game_Character)
- #--------------------------------------------------------------------------
- def initialize(viewport, character = nil)
- super(viewport)
- @character = character
- @balloon_duration = 0
- ## 名称
- @name = @character.name
- set_name_sprite
- update
- end
- #--------------------------------------------------------------------------
- # ◎ 释放
- #--------------------------------------------------------------------------
- def dispose
- dispose_balloon
- super
- ##
- return if @name_sprite == nil
- @name_sprite.bitmap.dispose
- @name_sprite.dispose
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- super
- update_bitmap
- self.visible = (not @character.transparent)
- update_src_rect
- self.x = @character.screen_x
- self.y = @character.screen_y
- self.z = @character.screen_z
- self.opacity = @character.opacity
- self.blend_type = @character.blend_type
- self.bush_depth = @character.bush_depth
- update_balloon
- if @character.animation_id != 0
- animation = $data_animations[@character.animation_id]
- start_animation(animation)
- @character.animation_id = 0
- end
- if @character.balloon_id != 0
- @balloon_id = @character.balloon_id
- start_balloon
- @character.balloon_id = 0
- end
- ## 名称可视和跟随
- unless @name_sprite == nil or @name_sprite.disposed?
- if @character.is_a?(Game_Event) and @character.erased
- @name_sprite.visible = false
- return
- else
- @name_sprite.visible = true
- end
- if @character.is_a?(Game_Player) and @character.in_vehicle?
- @name_sprite.visible = false
- return
- else
- @name_sprite.visible = true
- end
- if @name != @character.name
- @name = @character.name
- refresh_name_sprite
- end
- @name_sprite.x = self.x - 80
- @name_sprite.y = self.y - self.height - NPC::NAME_SIZE+2
- @name_sprite.z = self.z+1
- end
- end
- #--------------------------------------------------------------------------
- # ○ 设定 NPC 名称
- #--------------------------------------------------------------------------
- def set_name_sprite
- return if @character.name[0, 2] == "EV"
- return if @character.name == ""
- return if @character.character_name == ""
- return if @character.is_a?(Game_Event) and @character.erased
- @color_board = Window_Base.new(0,0,33,33)
- @color_board.visible = false
- @name_sprite = Sprite.new
- @name_sprite.bitmap = Bitmap.new(NPC::NAME_WIDTH, NPC::NAME_SIZE+2)
- @name_sprite.bitmap.font.name = NPC::NAME_FONT
- @name_sprite.bitmap.font.size = NPC::NAME_SIZE
- @name_sprite.bitmap.font.shadow = NPC::NAME_SHADOW
- refresh_name_sprite
- end
- #--------------------------------------------------------------------------
- # ○ 更新 NPC 名称
- #--------------------------------------------------------------------------
- def refresh_name_sprite
- name,color_index = @name.split(/,/)
- color_index = 0 if color_index == ""
- @name_sprite.bitmap.font.color = @color_board.text_color(color_index.to_i)
- @name_sprite.bitmap.clear
- @name_sprite.bitmap.draw_text(0,0,160,NPC::NAME_SIZE+2,name,1)
- end
- end
复制代码 然后是arpg:- #==============================================================================
- # 显示NPC名
- #------------------------------------------------------------------------------
- # 跟原版一样,EV开头的不显示,逗号后加颜色代码
- # 修改某事件名的方法:
- # set_npc_name("新名", 事件ID, 地图ID, 是否永久生效)
- # 事件ID 为空时表示当前事件
- # 地图ID 为空时表示当前地图
- # 是否永久生效 默认永久,否则只允许修改当前地图
- #==============================================================================
- # 参数设定
- #==============================================================================
- module NPC
- NAME_FONT = "黑体"
- NAME_SIZE = 16
- NAME_SHADOW = false
- NAME_WIDTH = 120
- end
- #==============================================================================
- # 重定事件名
- #==============================================================================
- def set_npc_name(name, event_id = nil, map_id = nil, forever = true)
- # 处理事件 ID
- if event_id == nil
- event_id = $game_map.interpreter.event_id
- end
- # 处理地图 ID
- if map_id == nil
- $game_map.events[event_id].name = name
- map_id = $game_map.map_id
- else
- map_id = map_id
- end
- return unless forever
- data = load_data(sprintf("Data/Map%03d.rvdata", map_id))
- # 更改名
- data.events[event_id].name = name
- save_data(data, sprintf("Data/Map%03d.rvdata", map_id))
- end
- #==============================================================================
- # ■ Game_Character
- #==============================================================================
- class Game_Character
- #--------------------------------------------------------------------------
- # ◎ 定义实例变量
- #--------------------------------------------------------------------------
- attr_accessor :name # 名称
- #--------------------------------------------------------------------------
- # ◎ 初始化对象
- #--------------------------------------------------------------------------
- alias character_ini initialize
- def initialize
- character_ini
- @name = ""
- end
- end
- #==============================================================================
- # ■ Game_Event
- #==============================================================================
- class Game_Event < Game_Character
- #--------------------------------------------------------------------------
- # ◎ 定义实例变量
- #--------------------------------------------------------------------------
- attr_reader :erased
- #--------------------------------------------------------------------------
- # ◎ 初始化对像
- # map_id : 地图 ID
- # event : 事件 (RPG::Event)
- #--------------------------------------------------------------------------
- alias event_ini initialize
- def initialize(map_id, event)
- event_ini(map_id, event)
- @name = @event.name
- end
- end
- #==============================================================================
- # ■ Game_Player
- #==============================================================================
- class Game_Player < Game_Character
- #--------------------------------------------------------------------------
- # ◎ 获取角色名
- #--------------------------------------------------------------------------
- def name
- return $game_party.members[0].name
- end
- end
- #==============================================================================
- # ■ Game_Interpreter
- #==============================================================================
- class Game_Interpreter
- #--------------------------------------------------------------------------
- # ◎ 定义实例变量
- #--------------------------------------------------------------------------
- attr_reader :event_id
- end
- #==============================================================================
- # ■ Sprite_Character
- #==============================================================================
- class Sprite_Character < Sprite_Base
- #--------------------------------------------------------------------------
- # ◎ 初始化对象
- # viewport : 视区
- # character : 角色 (Game_Character)
- #--------------------------------------------------------------------------
- def initialize(viewport, character = nil)
- super(viewport)
- @character = character
- @balloon_duration = 0
- ## 名称
- @name = @character.name
- set_name_sprite
- update
- end
- #--------------------------------------------------------------------------
- # ◎ 释放
- #--------------------------------------------------------------------------
- def dispose
- dispose_balloon
- super
- ##
- return if @name_sprite == nil
- @name_sprite.bitmap.dispose
- @name_sprite.dispose
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- super
- update_bitmap
- self.visible = (not @character.transparent)
- update_src_rect
- self.x = @character.screen_x
- self.y = @character.screen_y
- self.z = @character.screen_z
- self.opacity = @character.opacity
- self.blend_type = @character.blend_type
- self.bush_depth = @character.bush_depth
- update_balloon
- if @character.animation_id != 0
- animation = $data_animations[@character.animation_id]
- start_animation(animation)
- @character.animation_id = 0
- end
- if @character.balloon_id != 0
- @balloon_id = @character.balloon_id
- start_balloon
- @character.balloon_id = 0
- end
- ## 名称可视和跟随
- unless @name_sprite == nil or @name_sprite.disposed?
- if @character.is_a?(Game_Event) and @character.erased
- @name_sprite.visible = false
- return
- else
- @name_sprite.visible = true
- end
- if @character.is_a?(Game_Player) and @character.in_vehicle?
- @name_sprite.visible = false
- return
- else
- @name_sprite.visible = true
- end
- if @name != @character.name
- @name = @character.name
- refresh_name_sprite
- end
- @name_sprite.x = self.x - 80
- @name_sprite.y = self.y - self.height - NPC::NAME_SIZE+2
- @name_sprite.z = self.z+1
- end
- end
- #--------------------------------------------------------------------------
- # ○ 设定 NPC 名称
- #--------------------------------------------------------------------------
- def set_name_sprite
- return if @character.name[0, 2] == "EV"
- return if @character.name == ""
- return if @character.character_name == ""
- return if @character.is_a?(Game_Event) and @character.erased
- @color_board = Window_Base.new(0,0,33,33)
- @color_board.visible = false
- @name_sprite = Sprite.new
- @name_sprite.bitmap = Bitmap.new(NPC::NAME_WIDTH, NPC::NAME_SIZE+2)
- @name_sprite.bitmap.font.name = NPC::NAME_FONT
- @name_sprite.bitmap.font.size = NPC::NAME_SIZE
- @name_sprite.bitmap.font.shadow = NPC::NAME_SHADOW
- refresh_name_sprite
- end
- #--------------------------------------------------------------------------
- # ○ 更新 NPC 名称
- #--------------------------------------------------------------------------
- def refresh_name_sprite
- name,color_index = @name.split(/,/)
- color_index = 0 if color_index == ""
- @name_sprite.bitmap.font.color = @color_board.text_color(color_index.to_i)
- @name_sprite.bitmap.clear
- @name_sprite.bitmap.draw_text(0,0,160,NPC::NAME_SIZE+2,name,1)
- end
- end
复制代码 和- #===============================================================================
- #** VX Input Module#输入脚本,没有什么需要更改的地方,54
- #===============================================================================
- module Input
- @keys = []
- @pressed = []
- Mouse_Left = 1
- Mouse_Right = 2
- Mouse_Middle = 4
- Back= 8
- Tab = 9
- Enter = 13
- Shift = 16
- Ctrl = 17
- Alt = 18
- Esc = 0x1B
- LT = 0x25
- UPs = 0x26
- RT = 0x27
- DN = 0x28
- Space = 32
- Numberkeys = {}
- Numberkeys[0] = 48
- Numberkeys[1] = 49
- Numberkeys[2] = 50
- Numberkeys[3] = 51
- Numberkeys[4] = 52
- Numberkeys[5] = 53
- Numberkeys[6] = 54
- Numberkeys[7] = 55
- Numberkeys[8] = 56
- Numberkeys[9] = 57
- Numberpad = {}
- Numberpad[0] = 45
- Numberpad[1] = 35
- Numberpad[2] = 40
- Numberpad[3] = 34
- Numberpad[4] = 37
- Numberpad[5] = 12
- Numberpad[6] = 39
- Numberpad[7] = 36
- Numberpad[8] = 38
- Numberpad[9] = 33
- Letters = {}
- Letters["A"] = 65
- Letters["B"] = 66
- Letters["C"] = 67
- Letters["D"] = 68
- Letters["E"] = 69
- Letters["F"] = 70
- Letters["G"] = 71
- Letters["H"] = 72
- Letters["I"] = 73
- Letters["J"] = 74
- Letters["K"] = 75
- Letters["L"] = 76
- Letters["M"] = 77
- Letters["N"] = 78
- Letters["O"] = 79
- Letters["P"] = 80
- Letters["Q"] = 81
- Letters["R"] = 82
- Letters["S"] = 83
- Letters["T"] = 84
- Letters["U"] = 85
- Letters["V"] = 86
- Letters["W"] = 87
- Letters["X"] = 88
- Letters["Y"] = 89
- Letters["Z"] = 90
- Fkeys = {}
- Fkeys[1] = 112
- Fkeys[2] = 113
- Fkeys[3] = 114
- Fkeys[4] = 115
- Fkeys[5] = 116
- Fkeys[6] = 117
- Fkeys[7] = 118
- Fkeys[8] = 119
- Fkeys[9] = 120
- Fkeys[10] = 121
- Fkeys[11] = 122
- Fkeys[12] = 123
- Collon = 186
- Equal = 187
- Comma = 188
- Underscore = 189
- Dot = 190
- Backslash = 191
- Lb = 219
- Rb = 221
- Quote = 222
- State = Win32API.new('user32','GetKeyState',['i'],'i')
- Key = Win32API.new('user32','GetAsyncKeyState',['i'],'i')
- #-------------------------------------------------------------------------------
- USED_KEYS = [Mouse_Left, Mouse_Right, Mouse_Middle]
- #-------------------------------------------------------------------------------
- module_function
- #--------------------------------------------------------------------------
- def Input.getstate(key)
- return true unless State.call(key).between?(0, 1)
- return false
- end
- #--------------------------------------------------------------------------
- def Input.testkey(key)
- Key.call(key) & 0x01 == 1
- end
- #--------------------------------------------------------------------------
- def Input.update
- @keys = []
- @keys.push(Input::Mouse_Left) if Input.testkey(Input::Mouse_Left)
- @keys.push(Input::Mouse_Right) if Input.testkey(Input::Mouse_Right)
- @keys.push(Input::Back) if Input.testkey(Input::Back)
- @keys.push(Input::Tab) if Input.testkey(Input::Tab)
- @keys.push(Input::Enter) if Input.testkey(Input::Enter)
- @keys.push(Input::Shift) if Input.testkey(Input::Shift)
- @keys.push(Input::Ctrl) if Input.testkey(Input::Ctrl)
- @keys.push(Input::Alt) if Input.testkey(Input::Alt)
- @keys.push(Input::Esc) if Input.testkey(Input::Esc)
- for key in Input::Letters.values
- @keys.push(key) if Input.testkey(key)
- end
- for key in Input::Numberkeys.values
- @keys.push(key) if Input.testkey(key)
- end
- for key in Input::Numberpad.values
- @keys.push(key) if Input.testkey(key)
- end
- for key in Input::Fkeys.values
- @keys.push(key) if Input.testkey(key)
- end
- @keys.push(Input::Collon) if Input.testkey(Input::Collon)
- @keys.push(Input::Equal) if Input.testkey(Input::Equal)
- @keys.push(Input::Comma) if Input.testkey(Input::Comma)
- @keys.push(Input::Underscore) if Input.testkey(Input::Underscore)
- @keys.push(Input::Dot) if Input.testkey(Input::Dot)
- @keys.push(Input::Backslash) if Input.testkey(Input::Backslash)
- @keys.push(Input::Lb) if Input.testkey(Input::Lb)
- @keys.push(Input::Rb) if Input.testkey(Input::Rb)
- @keys.push(Input::Quote) if Input.testkey(Input::Quote)
- @keys.push(Input::Space) if Input.testkey(Input::Space)
- @keys.push(Input::LT) if Input.testkey(Input::LT)
- @keys.push(Input::UPs) if Input.testkey(Input::UPs)
- @keys.push(Input::RT) if Input.testkey(Input::RT)
- @keys.push(Input::DN) if Input.testkey(Input::DN)
- @pressed = []
- @pressed.push(Input::Space) if Input.getstate(Input::Space)
- @pressed.push(Input::Mouse_Left) if Input.getstate(Input::Mouse_Left)
- @pressed.push(Input::Mouse_Right) if Input.getstate(Input::Mouse_Right)
- @pressed.push(Input::Back) if Input.getstate(Input::Back)
- @pressed.push(Input::Tab) if Input.getstate(Input::Tab)
- @pressed.push(Input::Enter) if Input.getstate(Input::Enter)
- @pressed.push(Input::Shift) if Input.getstate(Input::Shift)
- @pressed.push(Input::Ctrl) if Input.getstate(Input::Ctrl)
- @pressed.push(Input::Alt) if Input.getstate(Input::Alt)
- @pressed.push(Input::Esc) if Input.getstate(Input::Esc)
- @pressed.push(Input::LT) if Input.getstate(Input::LT)
- @pressed.push(Input::UPs) if Input.getstate(Input::UPs)
- @pressed.push(Input::RT) if Input.getstate(Input::RT)
- @pressed.push(Input::DN) if Input.getstate(Input::DN)
- for key in Input::Numberkeys.values
- @pressed.push(key) if Input.getstate(key)
- end
- for key in Input::Numberpad.values
- @pressed.push(key) if Input.getstate(key)
- end
- for key in Input::Letters.values
- @pressed.push(key) if Input.getstate(key)
- end
- for key in Input::Fkeys.values
- @pressed.push(key) if Input.getstate(key)
- end
- @pressed.push(Input::Collon) if Input.getstate(Input::Collon)
- @pressed.push(Input::Equal) if Input.getstate(Input::Equal)
- @pressed.push(Input::Comma) if Input.getstate(Input::Comma)
- @pressed.push(Input::Underscore) if Input.getstate(Input::Underscore)
- @pressed.push(Input::Dot) if Input.getstate(Input::Dot)
- @pressed.push(Input::Backslash) if Input.getstate(Input::Backslash)
- @pressed.push(Input::Lb) if Input.getstate(Input::Lb)
- @pressed.push(Input::Rb) if Input.getstate(Input::Rb)
- @pressed.push(Input::Quote) if Input.getstate(Input::Quote)
- end
- #--------------------------------------------------------------------------
- def Input.triggerd?(key)
- return true if @keys.include?(key)
- return false
- end
- #--------------------------------------------------------------------------
- def Input.pressed?(key)
- return true if @pressed.include?(key)
- return false
- end
- #--------------------------------------------------------------------------
- # * 4 Diraction
- #--------------------------------------------------------------------------
- def Input.dir4
- return 2 if Input.pressed?(Input::DN)
- return 4 if Input.pressed?(Input::LT)
- return 6 if Input.pressed?(Input::RT)
- return 8 if Input.pressed?(Input::UPs)
- return 0
- end
- #--------------------------------------------------------------------------
- # * Trigger (key)
- #--------------------------------------------------------------------------
- def trigger?(key)
- keys = []
- case key
- when Input::DOWN
- keys.push(Input::DN)
- when Input::UP
- keys.push(Input::UPs)
- when Input::LEFT
- keys.push(Input::LT)
- when Input::RIGHT
- keys.push(Input::RT)
- when Input::A
- keys.push(Input::Shift)
- when Input::B
- keys.push(Input::Esc, Input::Numberpad[0])
- when Input::C
- keys.push(Input::Space, Input::Enter)
- when Input::L
- keys.push(Input::Letters["Q"])
- when Input::R
- keys.push(Input::Letters["W"])
- when Input::X
- keys.push(Input::Letters["A"])
- when Input::Y
- keys.push(Input::Letters["S"])
- when Input::Z
- keys.push(Input::Letters["D"])
- when Input::F5
- keys.push(Input::Fkeys[5])
- when Input::F6
- keys.push(Input::Fkeys[6])
- when Input::F7
- keys.push(Input::Fkeys[7])
- when Input::F8
- keys.push(Input::Fkeys[8])
- when Input::F9
- keys.push(Input::Fkeys[9])
- when Input::CTRL
- keys.push(Input::Ctrl)
- when Input::ALT
- keys.push(Input::Alt)
- else
- keys.push(key)
- end
- for k in keys
- if Input.triggerd?(k)
- return true
- end
- end
- return false
- end
- #--------------------------------------------------------------------------
- # * Repeat (key)
- #--------------------------------------------------------------------------
- def repeat?(key)
- keys = []
- case key
- when Input::DOWN
- keys.push(Input::DN)
- when Input::UP
- keys.push(Input::UPs)
- when Input::LEFT
- keys.push(Input::LT)
- when Input::RIGHT
- keys.push(Input::RT)
- when Input::A
- keys.push(Input::Shift)
- when Input::B
- keys.push(Input::Esc, Input::Numberpad[0])
- when Input::C
- keys.push(Input::Space, Input::Enter)
- when Input::L
- keys.push(Input::Letters["Q"])
- when Input::R
- keys.push(Input::Letters["W"])
- when Input::X
- keys.push(Input::Letters["A"])
- when Input::Y
- keys.push(Input::Letters["S"])
- when Input::Z
- keys.push(Input::Letters["D"])
- when Input::F5
- keys.push(Input::Fkeys[5])
- when Input::F6
- keys.push(Input::Fkeys[6])
- when Input::F7
- keys.push(Input::Fkeys[7])
- when Input::F8
- keys.push(Input::Fkeys[8])
- when Input::F9
- keys.push(Input::Fkeys[9])
- when Input::CTRL
- keys.push(Input::Ctrl)
- when Input::ALT
- keys.push(Input::Alt)
- else
- keys.push(key)
- end
- for k in keys
- if Input.triggerd?(k)
- return true
- end
- end
- return false
- end
- #--------------------------------------------------------------------------
- # * Press (key)
- #--------------------------------------------------------------------------
- def press?(key)
- keys = []
- case key
- when Input::DOWN
- keys.push(Input::DN)
- when Input::UP
- keys.push(Input::UPs)
- when Input::LEFT
- keys.push(Input::LT)
- when Input::RIGHT
- keys.push(Input::RT)
- when Input::A
- keys.push(Input::Shift)
- when Input::B
- keys.push(Input::Esc, Input::Numberpad[0])
- when Input::C
- keys.push(Input::Space, Input::Enter)
- when Input::L
- keys.push(Input::Letters["Q"])
- when Input::R
- keys.push(Input::Letters["W"])
- when Input::X
- keys.push(Input::Letters["A"])
- when Input::Y
- keys.push(Input::Letters["S"])
- when Input::Z
- keys.push(Input::Letters["D"])
- when Input::F5
- keys.push(Input::Fkeys[5])
- when Input::F6
- keys.push(Input::Fkeys[6])
- when Input::F7
- keys.push(Input::Fkeys[7])
- when Input::F8
- keys.push(Input::Fkeys[8])
- when Input::F9
- keys.push(Input::Fkeys[9])
- when Input::CTRL
- keys.push(Input::Ctrl)
- when Input::ALT
- keys.push(Input::Alt)
- else
- keys.push(key)
- end
- for k in keys
- if Input.pressed?(k)
- return true
- end
- end
- return false
- end
- #--------------------------------------------------------------------------
- # * Check (key)
- #--------------------------------------------------------------------------
- def check(key)
- Win32API.new("user32","GetAsyncKeyState",['i'],'i').call(key) & 0x01 == 1 # key 0
- end
- #--------------------------------------------------------------------------
- # * Mouse Update
- #--------------------------------------------------------------------------
- def mouse_update
- @used_i = []
- for i in USED_KEYS
- x = check(i)
- if x == true
- @used_i.push(i)
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Short Write C
- #--------------------------------------------------------------------------
- def Input.C
- Input.trigger?(C)
- end
- #--------------------------------------------------------------------------
- # * Short Write B
- #--------------------------------------------------------------------------
- def Input.B
- Input.trigger?(B)
- end
- #--------------------------------------------------------------------------
- # * Short Write A
- #--------------------------------------------------------------------------
- def Input.A
- Input.trigger?(A)
- end
- #--------------------------------------------------------------------------
- # * Short Write Down
- #--------------------------------------------------------------------------
- def Input.Down
- Input.trigger?(DOWN)
- end
- #--------------------------------------------------------------------------
- # * Short Write Up
- #--------------------------------------------------------------------------
- def Input.Up
- Input.trigger?(UP)
- end
- #--------------------------------------------------------------------------
- # * Short Write Right
- #--------------------------------------------------------------------------
- def Input.Right
- Input.trigger?(RIGHT)
- end
- #--------------------------------------------------------------------------
- # * Short Write Left
- #--------------------------------------------------------------------------
- def Input.Left
- Input.trigger?(LEFT)
- end
- #--------------------------------------------------------------------------
- # * Anykey pressed? ( A or B or C or Down or Up or Right or Left )
- #--------------------------------------------------------------------------
- def Input.Anykey
- if A or B or C or Down or Up or Right or Left
- return true
- else
- return false
- end
- end
- def Input.name?(num)
- return "MOUSE PRIMARY" if num==1
- return "MOUSE SECONDARY" if num==2
- return "MOUSE MIDDLE" if num==4
- return "MOUSE 4TH" if num==5
- return "MOUSE 5TH" if num==6
- return "BACKSPACE" if num==8
- return "TAB" if num==9
- return "RETURN" if num==13
- return "SHIFT" if num==16
- return "CTLR" if num==17
- return "ALT" if num==18
- return "CAPS LOCK" if num==20
- return "ESCAPE" if num==27
- return "SPACE" if num==32
- return "PGUP" if num==33
- return "PGDN" if num==34
- return "END" if num==35
- return "HOME" if num==36
- return "LEFT" if num==37
- return "UP" if num==38
- return "RIGHT" if num==39
- return "DOWN" if num==40
- return "SNAPSHOT" if num==44
- return "INSERT" if num==45
- return "DELETE" if num==46
- return "0" if num==48
- return "1" if num==49
- return "2" if num==50
- return "3" if num==51
- return "4" if num==52
- return "5" if num==53
- return "6" if num==54
- return "7" if num==55
- return "8" if num==56
- return "9" if num==57
- return "A" if num==65
- return "B" if num==66
- return "C" if num==67
- return "D" if num==68
- return "E" if num==69
- return "F" if num==70
- return "G" if num==71
- return "H" if num==72
- return "I" if num==73
- return "J" if num==74
- return "K" if num==75
- return "L" if num==76
- return "M" if num==77
- return "N" if num==78
- return "O" if num==79
- return "P" if num==80
- return "Q" if num==81
- return "R" if num==82
- return "S" if num==83
- return "T" if num==84
- return "U" if num==85
- return "V" if num==86
- return "W" if num==87
- return "X" if num==88
- return "Y" if num==89
- return "Z" if num==90
- return "LWIN" if num==91
- return "RWIN" if num==92
- return "APPS" if num==93
- return "0" if num==96
- return "1" if num==97
- return "2" if num==98
- return "3" if num==99
- return "4" if num==100
- return "5" if num==101
- return "6" if num==102
- return "7" if num==103
- return "8" if num==104
- return "9" if num==105
- return "*" if num==106
- return "+" if num==107
- return "-" if num==109
- return "." if num==110
- return "/" if num==111
- return "F1" if num==112
- return "F2" if num==113
- return "F3" if num==114
- return "F4" if num==115
- return "F5" if num==116
- return "F6" if num==117
- return "F7" if num==118
- return "F8" if num==119
- return "F9" if num==120
- return "F10" if num==121
- return "F11" if num==122
- return "F12" if num==123
- return "NUM LOCK" if num==144
- return "SCROLL LOCK" if num==145
- return "LEFT SHIFT" if num==160
- return "RIGHT SHIFT" if num==161
- return "LEFT CTRL" if num==162
- return "RIGHT CTRL" if num==163
- return "LEFT ALT" if num==164
- return "RIGHT ALT" if num==165
- return ";" if num==186
- return "=" if num==187
- return "," if num==188
- return "_" if num==189
- return "." if num==190
- return "/" if num==191
- return "`" if num==192
- return "[" if num==219
- return " \\ " if num==220
- return "]" if num==221
- return "'" if num==222
- return "??? - " + "#{num}"
- end
- end
复制代码 和- #==============================================================================
- # BlueFireGames ABS
- #原作者BlueFireGames
- #汉化by偶尔杀人越货
- #版权说明:
- #==============================================================================
- #------------------------------------------------------------------------------
- # Credits everything Done by BlueFireGames,
- #------------------------------------------------------------------------------
- # Para Criar um Inimigo, coloque os seguintes comentários:
- # Enemy ID - 敌人#编号-I D是的怪物数据库编号;比如1就是斯莱姆
- # Die Erase - Apaga o inimigo quando ele morrer morrer;
- # Die Switch Local A - 死亡事件对应打开的开关:A;
- # Die Switch Local B - 死亡事件对应打开的开关:B;
- # Die Switch Local C - 死亡事件对应打开的开关:C;
- # Die Switch Local D - 死亡事件对应打开的开关:D
- # Die Switch X - 怪物死后四否删除;1-删除 2-能复活的,比如那个开关
- # Die Variable X - 死亡变量,怪物死亡后关联的变量
- # Follow X - 跟随模式,是否跟随
- # Kill Weapon ID - 被杀武器,比如是某怪只能被某武器剑杀
- # Kill Skill ID - 被杀技能id,比如火怪只能被水球这个技能杀
- # Kill Item ID - 杀怪物的物品id:比如不死只能被召唤书杀
- #翻译by偶尔杀人越货,保留了原有注释
- #一些变量的注释:@animate_wait = 30和@ANIME = true是技能延时相关,可以自行添加近距武器延时
- #由于我不懂西班牙问,所以都是摸索出来的,大部分正确,少量错误的,见谅
- #------------------------------------------------------------------------------
- # CONFIGURAÇÃO GERAL
- #------------------------------------------------------------------------------
- module Crissaegrim_ABS
- #------------------------------------------------------------------------------
- #左攻击键位设定
- Right_Attack_Button = Input::Letters["A"]
- #------------------------------------------------------------------------------
- #右攻击键位设定
- Left_Attack_and_Shield_Button = Input::Letters["S"]
- #------------------------------------------------------------------------------
- # 1,2,3技能键位设定Input::Numberkeys方法继承input
- Skill_Button = {Input::Numberkeys[1] => 0,
- Input::Numberkeys[2] => 0,
- Input::Numberkeys[3] => 0,}
- #------------------------------------------------------------------------------
- # 4,5,6物品键位设定
- Item_Button = {Input::Numberkeys[4] => 0,
- Input::Numberkeys[5] => 0,
- Input::Numberkeys[6] => 0,}
- #------------------------------------------------------------------------------
- # Armas com animação
- # 近距武器攻击动画,这里可以改4/8向
- Animate_Weapons = {}
- Animate_Weapons[0] = ["_Attacking", 0]
- #------------------------------------------------------------------------------
- # 远距武器
- # Para criar uma arma de distância, copie: Distance_Weapons[S] = [T, U, V, W, X, Y, Z] e mude:
- # 远距离武器对应相应精灵行走图
- Distance_Weapons = {}
- Distance_Weapons[13] = ["$Arrow", 0, 6, 5, 30, 21, 22]
- Distance_Weapons[14] = ["$Arrow", 0, 6, 5, 30, 21, 22]
- Distance_Weapons[15] = ["$Arrow", 0, 6, 5, 30, 21, 22]
- Distance_Weapons[16] = ["$Arrow", 0, 6, 5, 30, 21, 22]
- Distance_Weapons[17] = ["$Arrow", 0, 6, 5, 30, 21, 22]
- Distance_Weapons[18] = ["$Arrow", 0, 6, 5, 30, 21, 22]
- Distance_Weapons[19] = ["$Arrow", 0, 6, 5, 30, 21, 22]
- Distance_Weapons[20] = ["$Arrow", 0, 6, 5, 30, 21, 22]
- Distance_Weapons[24] = ["Energy Ball", 0, 4, 5, 60,22]
- Distance_Weapons[25] = ["Energy Ball", 1, 4, 5, 60,22]
- #Distance_Weapons[26] = ["Energy Ball", 2, 4, 5, 60,22]
- #Distance_Weapons[27] = ["Energy Ball", 0, 4, 5, 60,22]
- #Distance_Weapons[28] = ["Energy Ball", 5, 4, 5, 60,22]
- #Distance_Weapons[29] = ["Energy Ball", 5, 4, 5, 60,22]
- #Distance_Weapons[24] = ["Energy Ball", 0, 4, 5, 60]
- Distance_Weapons[25] = ["Energy Ball", 1, 4, 5, 60,32,32]
- Distance_Weapons[26] = ["Energy Ball", 2, 4, 5, 60,32,32]
- Distance_Weapons[27] = ["Energy Ball", 0, 4, 5, 60,32,32]
- Distance_Weapons[28] = ["Energy Ball", 5, 4, 5, 60,32,32]#这里硬着头皮修改了一下
- Distance_Weapons[40] = ["$Arrow", 0, 6, 5, 30, 21, 22]
- #------------------------------------------------------------------------------
- # Skills com animação
- # 技能声音,就是嘴难听的那个,建议取消
- Animate_Skills = {}
- Animate_Skills[0] = ["_casting", 0]
- #------------------------------------------------------------------------------
- # 远距技能id对应魔法球精灵行走图
- # Para criar uma skill de distância, copie: Distance_Skills[U] = [V, W, X, Y, Z] e mude:
- # U:ID da skill, V:Char, W:Index do Char, X:Velocidade, Y:Distância, Z:Tempo de espera para atacar
- Distance_Skills = {}
- Distance_Skills[59] = ["Energy Ball", 0, 4, 5, 60]
- Distance_Skills[63] = ["Energy Ball", 7, 4, 5, 60]
- Distance_Skills[67] = ["Energy Ball", 3, 4, 5, 60]
- Distance_Skills[71] = ["Energy Ball", 2, 4, 5, 60]
- Distance_Skills[73] = ["Energy Ball", 1, 4, 5, 60]
- Distance_Skills[75] = ["Energy Ball", 4, 4, 5, 60]
- Distance_Skills[77] = ["Energy Ball", 3, 4, 5, 60]
- Distance_Skills[79] = ["Energy Ball", 5, 4, 5, 60]
- Distance_Skills[86] = ["Energy Ball", 7, 4, 5, 60]
- Distance_Skills[110] = ["Energy Ball", 7, 4, 5, 60]
- Distance_Skills[111] = ["$S_Light01", 0, 5, 20, 60]
- Distance_Skills[87] = ["$S_Slash01", 0, 6, 4, 60]
- Distance_Skills[131] = ["$S_Slash01", 0, 6, 4, 60]
- #------------------------------------------------------------------------------
- # 物品
- # Para criar um ítem com animação, copie: Animate_Weapons[X] = ["Y", Z] e mude X para o id da arma no database e Y para o prefixo do nome do char atacando, e Z para o Index do Char
- Animate_Items = {}
- Animate_Items[0] = ["_usingitem", 0]
- #------------------------------------------------------------------------------
- # 远距武器id对应精灵
- # Para criar um ítem de distância, copie: Distance_Items[T] = [U, V, W, X, Y, Z] e mude:
- # T:ID do item, U:Char, V:Index do Char, W:Velocidade, X:Distância, Y:Munição, Z:Tempo de espera para atacar
- Distance_Items = {}
- Distance_Items[16] = ["Energy Ball", 0, 6, 5, 16, 30]
- Distance_Items[18] = ["Energy Ball", 7, 6, 5, 18, 30]
- Distance_Items[20] = ["Energy Ball", 3, 6, 5, 20, 30]
- #------------------------------------------------------------------------------
- # Escudos, para que o herói use o escudo para se defender.
- # Para criar um escudo, copie: Shields[X] = ["Y"] e mude X para o id do escudo no database e Y para o nome do char usando o escudo
- # PS: O gráfico do char com escudo DEVE SER um gráfico sozinho.
- Shields = {}
- Shields[1] = ["_Shield", 0]
- #------------------------------------------------------------------------------
- # Animação qando o Herói passa de Level.
- # 升级动画
- LevelUp_Animation = 40
- #------------------------------------------------------------------------------
- # Animação do ataque do inimigo, copie Enemy_atk_animation[X] = Y
- #怪物攻击动画设定
- # e mude o X para o ID do inimigo, e Y para o ID da animação.
- Enemy_atk_animation = {}
- Enemy_atk_animation[2] = 13
- Enemy_atk_animation[3] = 19
- #------------------------------------------------------------------------------
- end
- #==============================================================================
- #------------------------------------------------------------------------------
- # Game Character
- #------------------------------------------------------------------------------
- class Game_Character
- attr_accessor :life
- attr_accessor :mana
- attr_accessor :damage
- attr_accessor :show_droped_items
- attr_accessor :critical
- attr_accessor :wait_action
- attr_accessor :wait_action2
- attr_reader :enemy_id
- attr_reader :erase
- attr_reader :switch_local_a
- attr_reader :switch_local_b
- attr_reader :switch_local_c
- attr_reader :switch_local_d
- attr_reader :switch
- attr_reader :variable
- attr_reader :kill_weapon
- attr_reader :kill_skill
- attr_reader :kill_item
- attr_reader :ENEMY_DEFFEND
- alias crissaegrim_abs_gchar_initialize initialize
- alias crissaegrim_abs_gchar_update update
- def initialize
- @enemy_id = 0
- [url=home.php?mod=space&uid=86492]@life[/url] = 0
- @mana = 0
- @erase = false
- @switch_local_a = false
- @switch_local_b = false
- @switch_local_c = false
- @switch_local_d = false
- @switch = 0
- @variable = 0
- @kill_weapon = 0
- @kill_skill = 0
- @kill_item = 0
- @wait_action = 0
- @wait_action2 = 0
- @damage = nil
- show_droped_items = nil
- @critical = false
- @ENEMY_DEFFEND = false
- @drop1_display_wait = 0
- @drop1 = nil
- @drop2_display_wait = 0
- @drop2 = nil
- @drop3_display_wait = 0
- @drop3 = nil
- crissaegrim_abs_gchar_initialize
- end
- def update
- if @drop1_display_wait > 0
- @drop1_display_wait -= 1
- elsif @drop1_display_wait <= 0
- @drop1 = nil
- end
- if @drop2_display_wait > 0
- @drop2_display_wait -= 1
- elsif @drop2_display_wait <= 0
- @drop2 = nil
- end
- if @drop3_display_wait > 0
- @drop3_display_wait -= 1
- elsif @drop3_display_wait <= 0
- @drop3 = nil
- end
- crissaegrim_abs_gchar_update
- end
- #------------------------------------------------------------------------------
- def recive_atk_right(attacker)
- attacker_status = (attacker.is_a?(Game_Event) ? attacker.enemy_status : $game_party.members[0])
- receptor_status = (self.is_a?(Game_Event) ? self.enemy_status : $game_party.members[0])
- dmg = receptor_status.make_attack_damage_value(attacker_status)
- if self.is_a?(Game_Player)
- $game_player.damage = dmg
- receptor_status.attack_effect(attacker_status)
- $scene = Scene_Gameover.new if $game_party.members[0].hp <= 0
- elsif self.is_a?(Game_Event)
- if @kill_weapon <= 0 and @kill_item <= 0 and @kill_skill <= 0
- if self.ENEMY_DEFFEND == false
- self.damage = dmg
- receptor_status.apply_state_changes(attacker_status)
- #receptor_status.attack_effect(attacker_status)
- self.life -= dmg
- elsif self.ENEMY_DEFFEND == true
- self.damage ="Guard"
- end
- elsif @kill_weapon > 0 and $game_party.members[0].weapon_id == @kill_weapon
- self.damage = dmg
- receptor_status.apply_state_changes(attacker_status)
- #receptor_status.attack_effect(attacker_status)
- self.life -= dmg
- end
- self.kill_enemy if self.life <= 0
- end
- end
- #------------------------------------------------------------------------------
- def recive_atk_left(attacker)
- attacker_status = (attacker.is_a?(Game_Event) ? attacker.enemy_status : $game_party.members[0])
- receptor_status = (self.is_a?(Game_Event) ? self.enemy_status : $game_party.members[0])
- dmg = receptor_status.make_attack_damage_value(attacker_status)
- if self.is_a?(Game_Player)
- $game_player.damage = dmg
- receptor_status.attack_effect(attacker_status)
- $scene = Scene_Gameover.new if $game_party.members[0].hp <= 0
- elsif self.is_a?(Game_Event)
- if @kill_weapon <= 0 and @kill_item <= 0 and @kill_skill <= 0
- self.damage = dmg
- receptor_status.apply_state_changes(attacker_status)
- #receptor_status.attack_effect(attacker_status)
- self.life -= dmg
- elsif @kill_weapon > 0 and $game_party.members[0].armor1_id == @kill_weapon
- self.damage = dmg
- receptor_status.apply_state_changes(attacker_status)
- #receptor_status.attack_effect(attacker_status)
- self.life -= dmg
- end
- self.kill_enemy if self.life <= 0
- end
- end
- #------------------------------------------------------------------------------
- def recive_skill(attacker, skill)
- attacker_status = (attacker.is_a?(Game_Event) ? attacker.enemy_status : $game_party.members[0])
- receptor_status = (self.is_a?(Game_Event) ? self.enemy_status : $game_party.members[0])
- dmg = receptor_status.make_obj_damage_value(receptor_status, $data_skills[skill])
- if self.is_a?(Game_Player)
- $game_player.damage = dmg
- receptor_status.skill_effect(attacker_status, $data_skills[skill])
- $scene = Scene_Gameover.new if $game_party.members[0].hp <= 0
- elsif self.is_a?(Game_Event)
- if @kill_weapon <= 0 and @kill_item <= 0 and @kill_skill <= 0
- #receptor_status.skill_effect(attacker_status, $data_skills[skill])
- self.damage = dmg
- receptor_status.apply_state_changes(attacker_status)
- self.life -= dmg
- elsif @kill_skill > 0 and $data_skills[skill].id == @kill_skill
- #receptor_status.skill_effect(attacker_status, $data_skills[skill])
- self.damage = dmg
- receptor_status.apply_state_changes(attacker_status)
- self.life -= dmg
- end
- self.kill_enemy if self.life <= 0
- end
- end
- #------------------------------------------------------------------------------
- def recive_itemeffect(attacker, item)
- attacker_status = (attacker.is_a?(Game_Event) ? attacker.enemy_status : $game_party.members[0])
- receptor_status = (self.is_a?(Game_Event) ? self.enemy_status : $game_party.members[0])
- dmg = receptor_status.make_obj_damage_value(receptor_status, $data_items[item])
- if self.is_a?(Game_Player)
- $game_player.damage = dmag
- receptor_status.item_effect(attacker_status, $data_items[item])
- $scene = Scene_Gameover.new if $game_party.members[0].hp <= 0
- elsif self.is_a?(Game_Event)
- if @kill_weapon <= 0 and @kill_item <= 0 and @kill_skill <= 0
- self.damage = dmg
- receptor_status.apply_state_changes(attacker_status)
- #receptor_status.item_effect(attacker_status, $data_items[item])
- self.life -= dmg
- elsif @kill_item > 0 and $data_items[item].id == @kill_item
- self.damage = dmg
- receptor_status.apply_state_changes(attacker_status)
- #receptor_status.item_effect(attacker_status, $data_items[item])
- self.life -= dmg
- end
- self.kill_enemy if self.life <= 0
- end
- end
- #------------------------------------------------------------------------------
- def kill_enemy
- $game_party.members[0].gain_exp(self.enemy_status.exp, 1)
- make_drop
- if @erase == true
- self.erase
- elsif @switch_local_a == true
- key = [$game_map.map_id, self.id, "A"]
- if $game_self_switches[key] == false
- $game_self_switches[key] = true
- elsif $game_self_switches[key] == true
- $game_self_switches[key] = false
- end
- elsif @switch_local_b == true
- key = [$game_map.map_id, self.id, "B"]
- if $game_self_switches[key] == false
- $game_self_switches[key] = true
- elsif $game_self_switches[key] == true
- $game_self_switches[key] = false
- end
- elsif @switch_local_c == true
- key = [$game_map.map_id, self.id, "C"]
- if $game_self_switches[key] == false
- $game_self_switches[key] = true
- elsif $game_self_switches[key] == true
- $game_self_switches[key] = false
- end
- elsif @switch_local_d == true
- key = [$game_map.map_id, self.id, "D"]
- if $game_self_switches[key] == false
- $game_self_switches[key] = true
- elsif $game_self_switches[key] == true
- $game_self_switches[key] = false
- end
- elsif @switch > 0 and
- if $game_switches[@switch] == false
- $game_switches[@switch] = true
- elsif $game_switches[@switch] == true
- $game_switches[@switch] = false
- end
- elsif @variable > 0
- $game_variables[@variable] += 1
- end
- $game_map.need_refresh = true
- @automove = false
- refresh
- end
- def make_drop
- for item in make_items1
- $game_party.gain_item(item, 1)
- @drop1 = Sprite.new
- @drop1.bitmap = Bitmap.new(200, 28)
- @drop1.x = 0
- @drop1.y = 150
- @drop1.bitmap.font.size = 16
- @drop1.bitmap.clear
- @drop1.bitmap.font.color = Color.new(0,0,0)
- @drop1.bitmap.draw_text(1,1,200,28, "#{item.name} 找到!")
- @drop1.bitmap.font.color = Color.new(255,255,255)
- @drop1.bitmap.draw_text(0,0,200,28, "#{item.name} 找到!")
- @drop1_display_wait = 120
- end
- for item in make_items2
- $game_party.gain_item(item, 1)
- @drop2 = Sprite.new
- @drop2.bitmap = Bitmap.new(200, 28)
- @drop2.x = 0
- @drop2.y = 178
- @drop2.bitmap.font.size = 16
- @drop2.bitmap.clear
- @drop2.bitmap.font.color = Color.new(0,0,0)
- @drop2.bitmap.draw_text(1,1,200,28, "#{item.name} 找到!")
- @drop2.bitmap.font.color = Color.new(255,255,255)
- @drop2.bitmap.draw_text(0,0,200,28, "#{item.name} 找到!")
- @drop2_display_wait = 120
- end
- if self.enemy_status.gold > 0
- $game_party.gain_gold(self.enemy_status.gold)
- @drop3 = Sprite.new
- @drop3.bitmap = Bitmap.new(200, 28)
- @drop3.x = 0
- @drop3.y = 206
- @drop3.bitmap.font.size = 16
- @drop3.bitmap.clear
- @drop3.bitmap.font.color = Color.new(0,0,0)
- @drop3.bitmap.draw_text(1,1,200,28, "$ #{self.enemy_status.gold} 找到!")
- @drop3.bitmap.font.color = Color.new(255,255,255)
- @drop3.bitmap.draw_text(0,0,200,28, "$ #{self.enemy_status.gold} 找到!")
- @drop3_display_wait = 120
- end
- end
- def make_items1
- drop_items = []
- for di in [self.enemy_status.drop_item1]
- next if di.kind == 0
- next if rand(di.denominator) != 0
- index = [self.enemy_status.drop_item1, self.enemy_status.drop_item2].index(di)
- if di.kind == 1
- drop_items.push($data_items[di.item_id])
- elsif di.kind == 2
- drop_items.push($data_weapons[di.weapon_id])
- elsif di.kind == 3
- drop_items.push($data_armors[di.armor_id])
- end
- end
- return drop_items
- end
- def make_items2
- drop_items = []
- for di in [self.enemy_status.drop_item2]
- next if di.kind == 0
- next if rand(di.denominator) != 0
- index = [self.enemy_status.drop_item1, self.enemy_status.drop_item2].index(di)
- if di.kind == 1
- drop_items.push($data_items[di.item_id])
- elsif di.kind == 2
- drop_items.push($data_weapons[di.weapon_id])
- elsif di.kind == 3
- drop_items.push($data_armors[di.armor_id])
- end
- end
- return drop_items
- end
- end
- #------------------------------------------------------------------------------
- # Game Event
- #------------------------------------------------------------------------------
- class Game_Event < Game_Character
- attr_reader :enemy_id
- attr_reader :inimigo
- attr_reader :enemy_status
- attr_accessor :move_speed
- attr_accessor :through
- alias crissaegrim_abs_gevent_initialize initialize
- alias crissaegrim_abs_gevent_update update
- alias crissaegrim_abs_gevent_refresh refresh
- def initialize(map_id, event)
- @inimigo = false
- @automove = false
- @life = 0
- @mana = 0
- @ENEMY_DEFFEND = false
- @enemy_die_animation = 0
- crissaegrim_abs_gevent_initialize(map_id, event)
- end
- def update
- crissaegrim_abs_gevent_update
- if self.wait_action > 0
- self.wait_action -= 1
- end
- if @inimigo
- new_x = (@x + (@direction == 4 ? -1 : @direction == 6 ? 1 : 0))
- new_y = (@y + (@direction == 8 ? -1 : @direction == 2 ? 1 : 0))
- if $game_player.x == new_x and $game_player.y == new_y and self.wait_action <= 0
- for action in $data_enemies[@enemy_id].actions
- next unless enemy_status.conditions_met?(action)
- case action.kind
- when 0
- case action.basic
- when 0
- p = $game_player.direction
- e = self.direction
- if $game_player.DEFFEND == true and p == 2 and e == 8
- $game_player.damage = "格挡!"
- elsif $game_player.DEFFEND == true and p == 4 and e == 6
- $game_player.damage = "格挡!"
- elsif $game_player.DEFFEND == true and p == 6 and e == 4
- $game_player.damage = "格挡!"
- elsif $game_player.DEFFEND == true and p == 8 and e == 2
- $game_player.damage = "格挡!"
- else
- $game_player.recive_atk_right(self)
- $game_player.animation_id = (Crissaegrim_ABS::Enemy_atk_animation[@enemy_id] ? Crissaegrim_ABS::Enemy_atk_animation[@enemy_id] : 1)
- $game_player.jump(0,0)
- end
- when 1
- e = self.direction
- p = $game_player.direction
- if e == 2 and p == 8
- @ENEMY_DEFFEND = true
- elsif e == 4 and p == 6
- @ENEMY_DEFFEND = true
- elsif e == 6 and p == 4
- @ENEMY_DEFFEND = true
- elsif e == 8 and p == 2
- @ENEMY_DEFFEND = true
- else
- @ENEMY_DEFFEND = false
- end
- when 2..3
- return
- end
- when 1
- case $data_skills[action.skill_id].scope
- when 1..6
- if $data_enemies[@enemy_id].maxmp >= $data_skills[action.skill_id].mp_cost
- $data_enemies[@enemy_id].maxmp -= $data_skills[action.skill_id].mp_cost
- p = $game_player.direction
- e = self.direction
- if $game_player.DEFFEND == true and p == 2 and e == 8
- $game_player.damage = "格挡!"#格挡
- elsif $game_player.DEFFEND == true and p == 4 and e == 6
- $game_player.damage = "格挡!"
- elsif $game_player.DEFFEND == true and p == 6 and e == 4
- $game_player.damage = "格挡!"
- elsif $game_player.DEFFEND == true and p == 8 and e == 2
- $game_player.damage = "格挡!"
- else
- $game_player.animation_id = $data_skills[action.skill_id].animation_id
- $game_player.jump(0,0)
- $game_player.recive_skill(self, action.skill_id)
- end
- end
- when 7..11
- if self.mana >= $data_skills[action.skill_id].mp_cost
- self.mana -= $data_skills[action.skill_id].mp_cost
- $game_temp.common_event_id = $data_skills[action.skill_id].common_event_id if $data_skills[action.skill_id].common_event_id > 0
- # @enemy_status.skill_effect(@enemy_status, $data_skills[action.skill_id])
- rec = @enemy_status.make_obj_damage_value(@enemy_status, $data_skills[action.skill_id])
- self.life -= rec
- self.life = $data_enemies[@enemy_id].maxhp if self.life > $data_enemies[@enemy_id].maxhp
- self.damage = rec
- self.animation_id = $data_skills[action.skill_id].animation_id
- end
- end
- end
- end
- speed = $data_enemies[@enemy_id].agi / 100
- self.wait_action = 60 - speed
- end
- end
- if @automove
- unless moving?
- if in_range?(self, $game_player, @follow_distance)
- self.move_toward_player
- end
- end
- end
- end
- def refresh
- crissaegrim_abs_gevent_refresh
- @inimigo = false
- @enemy_id = check_comment("Enemy")
- @follow_distance = check_comment("Follow")
- @erase = check_com("Die Erase")
- @switch_local_a = check_com("Die Switch Local A")
- @switch_local_b = check_com("Die Switch Local B")
- @switch_local_c = check_com("Die Switch Local C")
- @switch_local_d = check_com("Die Switch Local D")
- @switch = check_comment("Die Switch")
- @variable = check_comment("Die Variable")
- @kill_weapon = check_comment("Kill Weapon")
- @kill_skill = check_comment("Kill Skill")
- @kill_item = check_comment("Kill Item")
- @automove = true if @follow_distance > 0
- if @enemy_id > 0
- @inimigo = true
- @enemy_status = GameABS_Enemy.new(@enemy_id)
- @life = $data_enemies[@enemy_id].maxhp if @life <= 0
- @mana = $data_enemies[@enemy_id].maxmp if @mana <= 0
- end
- end
- def check_comment(comentario)
- com = comentario.downcase
- return 0 if @list.nil? or @list.size <= 0
- for item in @list
- if item.code == 108 or item.code == 408
- if item.parameters[0].downcase =~ /#{com}[ ]?(\d+)?/
- return $1.to_i
- end
- end
- end
- return 0
- end
- def check_com(comentario)
- return false if @list.nil? or @list.size <= 0
- for item in @list
- if item.code == 108 or item.code == 408
- if item.parameters[0].downcase.include?(comentario.downcase)
- return true
- end
- end
- end
- end
- def in_range?(event, target, distance)
- x = (event.x - target.x) * (event.x - target.x)
- y = (event.y - target.y) * (event.y - target.y)
- r = x + y
- return true if r <= (distance * distance)
- return false
- end
- end
- #------------------------------------------------------------------------------
- # Game Player
- #------------------------------------------------------------------------------
- class Game_Player < Game_Character
- attr_accessor :ATAQUE_RIGHT
- attr_accessor :ATAQUE_LEFT
- attr_accessor :SKILL
- attr_accessor :ITEM
- attr_accessor :DEFFEND
- attr_accessor :step_anime
- alias crissaegrim_abs_gplayer_initialize initialize
- alias crissaegrim_abs_gplayer_update update
- def initialize
- crissaegrim_abs_gplayer_initialize
- @ATAQUE_RIGHT = false
- @ATAQUE_LEFT = false
- @SKILL = false
- @ITEM = false
- @DEFFEND = false
- @ANIME = false
- @animate_wait = 0
- end
- def update
- crissaegrim_abs_gplayer_update
- if self.wait_action > 0
- self.wait_action -= 1
- end
- if self.wait_action2 > 0
- self.wait_action2 -= 1
- end
- if @animate_wait > 0
- @animate_wait -= 1
- end
- if @animate_wait <= 0
- $game_player.set_graphic($game_actors[$game_party.members[0].id].character_name, $game_actors[$game_party.members[0].id].character_index)
- $game_player.step_anime = false
- @ANIME = false
- end
- #------------------------------------------------------------------------------
- if Input.trigger?(Crissaegrim_ABS::Right_Attack_Button) and self.wait_action <= 0 and @DEFFEND == false
- @atk = $game_party.members[0].weapon_id
- if $game_party.members[0].weapon_id != 0 and Crissaegrim_ABS::Animate_Weapons[@atk] != nil and Crissaegrim_ABS::Animate_Weapons[@atk] != 0 and Crissaegrim_ABS::Animate_Weapons[@atk][0] != nil and Crissaegrim_ABS::Animate_Weapons[@atk][0] != "" and @animate_wait <= 0
- $game_player.set_graphic(self.character_name + Crissaegrim_ABS::Animate_Weapons[@atk][0], Crissaegrim_ABS::Animate_Weapons[@atk][1])
- $game_player.step_anime = true
- @animate_wait = 30
- @ANIME = true
- end
- if Crissaegrim_ABS::Distance_Weapons.has_key?(@atk)
- @ATAQUE_RIGHT = true
- hero_x = ($game_player.x + ($game_player.direction == 4 ? -1 : $game_player.direction == 6 ? 1 : 0))
- hero_y = ($game_player.y + ($game_player.direction == 8 ? -1 : $game_player.direction == 2 ? 1 : 0))
- if $game_party.has_item?($data_items[Crissaegrim_ABS::Distance_Weapons[@atk][5]])
- $game_range.call($game_player.x,$game_player.y,Crissaegrim_ABS::Distance_Weapons[@atk][0],Crissaegrim_ABS::Distance_Weapons[@atk][1],Crissaegrim_ABS::Distance_Weapons[@atk][2],Crissaegrim_ABS::Distance_Weapons[@atk][3])
- $game_party.consume_item($data_items[Crissaegrim_ABS::Distance_Weapons[@atk][5]])
- end
- self.wait_action = Crissaegrim_ABS::Distance_Weapons[@atk][4]
- else
- new_x = (@x + ($game_player.direction == 4 ? -1 : $game_player.direction == 6 ? 1 : 0))
- new_y = (@y + ($game_player.direction == 8 ? -1 : $game_player.direction == 2 ? 1 : 0))
- for event in $game_map.events.values
- if event.inimigo
- if event.x == new_x and event.y == new_y
- event.recive_atk_right(self)
- event.animation_id = $game_party.members[0].atk_animation_id
- event.jump(0,0)
- speed = $game_party.members[0].agi / 100
- self.wait_action = 60 - speed
- break
- end
- end
- end
- end
- if Input.trigger?(Crissaegrim_ABS::Right_Attack_Button) and @animate_wait <= 0 and @DEFFEND == false and Crissaegrim_ABS::Distance_Weapons.has_key?(@atk)
- @animate_wait = 30
- @ANIME = true
- $refreshon=1#hud刷新判断by杀人越货
- ##开枪动画,需要的自己在这里放一个
- end#按下武器按键的时候显示动画
- end
- #------------------------------------------------------------------------------
- if not $game_party.members[0].two_swords_style and $game_party.members[0].armor1_id > 0
- if Input.press?(Crissaegrim_ABS::Left_Attack_and_Shield_Button)
- @DEFFEND = true
- if Crissaegrim_ABS::Shields[$game_party.members[0].armor1_id] != nil and Crissaegrim_ABS::Shields[$game_party.members[0].armor1_id] != 0 and Crissaegrim_ABS::Shields[$game_party.members[0].armor1_id][0] != nil and Crissaegrim_ABS::Shields[$game_party.members[0].armor1_id][0] != ""
- $game_player.set_graphic(self.character_name + Crissaegrim_ABS::Shields[$game_party.members[0].armor1_id][0], Crissaegrim_ABS::Shields[$game_party.members[0].armor1_id][1])
- end
- else
- @DEFFEND = false
- if @ANIME == false
- $game_player.set_graphic($game_actors[$game_party.members[0].id].character_name, $game_actors[$game_party.members[0].id].character_index)
- end
- end
- elsif not $game_party.members[0].two_hands_legal? and $game_party.members[0].weapon_id > 0
- if Input.press?(Crissaegrim_ABS::Left_Attack_and_Shield_Button)
- @DEFFEND = true
- if Crissaegrim_ABS::Shields[$game_party.members[0].armor1_id] != nil and Crissaegrim_ABS::Shields[$game_party.members[0].armor1_id] != 0 and Crissaegrim_ABS::Shields[$game_party.members[0].armor1_id][0] != nil and Crissaegrim_ABS::Shields[$game_party.members[0].armor1_id][0] != ""
- $game_player.set_graphic(self.character_name + Crissaegrim_ABS::Shields[$game_party.members[0].armor1_id][0], Crissaegrim_ABS::Shields[$game_party.members[0].armor1_id][1])
- end
- else
- @DEFFEND = false
- if @ANIME == false
- $game_player.set_graphic($game_actors[$game_party.members[0].id].character_name, $game_actors[$game_party.members[0].id].character_index)
- end
- end
- elsif Input.trigger?(Crissaegrim_ABS::Left_Attack_and_Shield_Button) and self.wait_action2 <= 0
- if $game_party.members[0].two_hands_legal?
- @latk = $game_party.members[0].weapon_id
- else
- @latk = $game_party.members[0].armor1_id
- end
- if $game_party.members[0].weapon_id != 0 and Crissaegrim_ABS::Animate_Weapons[@latk] != nil and Crissaegrim_ABS::Animate_Weapons[@latk][0] != "" and @animate_wait <= 0
- $game_player.set_graphic(self.character_name + Crissaegrim_ABS::Animate_Weapons[@latk][0], Crissaegrim_ABS::Animate_Weapons[@latk][1])
- $game_player.step_anime = true
- @animate_wait = 30
- @ANIME = true
- elsif $game_party.members[0].armor1_id != 0 and Crissaegrim_ABS::Animate_Weapons[@latk] != nil and Crissaegrim_ABS::Animate_Weapons[@latk][0] != "" and @animate_wait <= 0
- $game_player.set_graphic(self.character_name + Crissaegrim_ABS::Animate_Weapons[@latk][0], Crissaegrim_ABS::Animate_Weapons[@latk][1])
- $game_player.step_anime = true
- @animate_wait = 30
- @ANIME = true
- end
-
-
-
- if Crissaegrim_ABS::Distance_Weapons.has_key?(@latk)
- @ATAQUE_LEFT = true
- $refreshon=1
- hero_x = ($game_player.x + ($game_player.direction == 4 ? -1 : $game_player.direction == 6 ? 1 : 0))
- hero_y = ($game_player.y + ($game_player.direction == 8 ? -1 : $game_player.direction == 2 ? 1 : 0))
- if $game_map.passable?(hero_x, hero_y) or $game_map.passable?(hero_x, hero_y, 0x02)
- if $game_party.has_item?($data_items[Crissaegrim_ABS::Distance_Weapons[@latk][6]])
- $game_range.call($game_player.x,$game_player.y,Crissaegrim_ABS::Distance_Weapons[@atk][0],Crissaegrim_ABS::Distance_Weapons[@atk][1],Crissaegrim_ABS::Distance_Weapons[@atk][2],Crissaegrim_ABS::Distance_Weapons[@atk][3])
- $game_party.consume_item($data_items[Crissaegrim_ABS::Distance_Weapons[@latk][6]])
- end
- self.wait_action2 = Crissaegrim_ABS::Distance_Weapons[@latk][4]
- end
- else
- new_x = (@x + ($game_player.direction == 4 ? -1 : $game_player.direction == 6 ? 1 : 0))
- new_y = (@y + ($game_player.direction == 8 ? -1 : $game_player.direction == 2 ? 1 : 0))
- for event in $game_map.events.values
- if event.inimigo
- if event.x == new_x and event.y == new_y
- if $game_party.members[0].two_swords_style
- event.animation_id = $game_party.members[0].atk_animation_id2
- event.recive_atk_left(self)
- event.jump(0,0)
- end
- speed = $game_party.members[0].agi / 100
- self.wait_action2 = 60 - speed
- break
- end
- end
- end
- end
- end
- #------------------------------------------------------------------------------
- for button in Crissaegrim_ABS::Skill_Button.keys
- if Input.trigger?(button) and Crissaegrim_ABS::Skill_Button[button] != nil and Crissaegrim_ABS::Skill_Button[button] != 0 and $game_party.members[0].mp >= $data_skills[Crissaegrim_ABS::Skill_Button[button]].mp_cost and self.wait_action <= 0
- @skl = Crissaegrim_ABS::Skill_Button[button]
- if Crissaegrim_ABS::Animate_Skills[@skl] != nil and Crissaegrim_ABS::Animate_Skills[@skl] != 0 and Crissaegrim_ABS::Animate_Skills[@skl][0] != nil and Crissaegrim_ABS::Animate_Skills[@skl][0] != ""
- $game_player.set_graphic(self.character_name + Crissaegrim_ABS::Animate_Skills[@skl][0], Crissaegrim_ABS::Animate_Skills[@skl][1])
- $game_player.step_anime = true
- @animate_wait = 30
- @ANIME = true
- end
- $game_temp.common_event_id = $data_skills[@skl].common_event_id if $data_skills[@skl].common_event_id > 0
- Sound.play_use_skill
- if Crissaegrim_ABS::Distance_Skills.has_key?(@skl)
- @SKILL = true
- hero_x = ($game_player.x + ($game_player.direction == 4 ? -1 : $game_player.direction == 6 ? 1 : 0))
- hero_y = ($game_player.y + ($game_player.direction == 8 ? -1 : $game_player.direction == 2 ? 1 : 0))
- if $game_map.passable?(hero_x, hero_y) or $game_map.passable?(hero_x, hero_y, 0x02)
- if $game_party.members[0].mp >= $data_skills[@skl].mp_cost
- $game_range.call($game_player.x,$game_player.y,Crissaegrim_ABS::Distance_Skills[@skl][0],Crissaegrim_ABS::Distance_Skills[@skl][1],Crissaegrim_ABS::Distance_Skills[@skl][2],Crissaegrim_ABS::Distance_Skills[@skl][3])
- $game_party.members[0].mp -= $game_party.members[0].calc_mp_cost($data_skills[@skl])
- end
- self.wait_action = Crissaegrim_ABS::Distance_Skills[@skl][4]
- end
- else
- case $data_skills[@skl].scope
- when 1..6
- new_x = (@x + ($game_player.direction == 4 ? -1 : $game_player.direction == 6 ? 1 : 0))
- new_y = (@y + ($game_player.direction == 8 ? -1 : $game_player.direction == 2 ? 1 : 0))
- for event in $game_map.events.values
- if event.inimigo
- if event.x == new_x and event.y == new_y
- $game_party.members[0].mp -= $game_party.members[0].calc_mp_cost($data_skills[@skl])
- event.recive_skill(self, @skl)
- event.animation_id = $data_skills[@skl].animation_id
- event.jump(0,0)
- end
- end
- end
- when 7..11
- $game_party.members[0].mp -= $game_party.members[0].calc_mp_cost($data_skills[@skl])
- $game_party.members[0].skill_effect($game_party.members[0], $data_skills[@skl])
- rec = $game_party.members[0].make_obj_damage_value($game_party.members[0], $data_skills[@skl])
- self.damage = rec
- $game_player.animation_id = $data_skills[@skl].animation_id
- end
- speed = $game_party.members[0].agi / 100
- self.wait_action = 60 - speed
- break
- end
- end
- end
- #------------------------------------------------------------------------------
- for button in Crissaegrim_ABS::Item_Button.keys
- if Input.trigger?(button) and Crissaegrim_ABS::Item_Button[button] != nil and Crissaegrim_ABS::Item_Button[button] != 0 and $game_party.item_number($data_items[Crissaegrim_ABS::Item_Button[button]]) > 0 and self.wait_action <= 0
- @itm = Crissaegrim_ABS::Item_Button[button]
- $refreshon==1#这里做了修改,by偶尔杀人越货
- #$game_player.animation_id = 动画
- if Crissaegrim_ABS::Animate_Items[@itm] != nil and Crissaegrim_ABS::Animate_Items[@itm] != 0 and Crissaegrim_ABS::Animate_Items[@itm][0] != nil and Crissaegrim_ABS::Animate_Items[@itm][0] != ""
- $game_player.set_graphic(self.character_name + Crissaegrim_ABS::Animate_Items[@itm][0], Crissaegrim_ABS::Animate_Items[@itm][1])
- $game_player.step_anime = true
- @animate_wait = 30
- @ANIME = true
- end
- $game_temp.common_event_id = $data_items[@itm].common_event_id if $data_items[@itm].common_event_id > 0
- Sound.play_use_item
- if Crissaegrim_ABS::Distance_Items.has_key?(@itm)
- @ITEM = true
- hero_x = ($game_player.x + ($game_player.direction == 4 ? -1 : $game_player.direction == 6 ? 1 : 0))
- hero_y = ($game_player.y + ($game_player.direction == 8 ? -1 : $game_player.direction == 2 ? 1 : 0))
- if $game_map.passable?(hero_x, hero_y) or $game_map.passable?(hero_x, hero_y, 0x02)
- if $game_party.has_item?($data_items[Crissaegrim_ABS::Distance_Items[@itm][4]])
- $game_range.call($game_player.x,$game_player.y,Crissaegrim_ABS::Distance_Items[@itm][0],Crissaegrim_ABS::Distance_Items[@itm][1],Crissaegrim_ABS::Distance_Items[@itm][2],Crissaegrim_ABS::Distance_Items[@itm][3])
- $game_party.consume_item($data_items[Crissaegrim_ABS::Distance_Items[@itm][4]])
- end
- self.wait_action = Crissaegrim_ABS::Distance_Items[@itm][5]
- end
- else
- case $data_items[@itm].scope
- when 1..6
- new_x = (@x + ($game_player.direction == 4 ? -1 : $game_player.direction == 6 ? 1 : 0))
- new_y = (@y + ($game_player.direction == 8 ? -1 : $game_player.direction == 2 ? 1 : 0))
- for event in $game_map.events.values
- if event.inimigo
- if event.x == new_x and event.y == new_y
- event.recive_itemeffect(self, @itm)
- event.animation_id = $data_items[@itm].animation_id
- $game_party.consume_item($data_items[@itm])
- event.jump(0,0)
- end
- end
- end
- when 7..11
- $game_player.animation_id = $data_items[@itm].animation_id
- $game_party.members[0].item_effect($game_party.members[0], $data_items[@itm])
- $game_party.consume_item($data_items[@itm])
- $game_temp.common_event_id = $data_items[@itm].common_event_id if $data_items[@itm].common_event_id > 0
- end
- speed = $game_party.members[0].agi / 100
- self.wait_action = 60 - speed
- end
- end
- end
- #------------------------------------------------------------------------------
- for event in $game_map.events.values
- if event.inimigo
- new_x = (event.x + ($game_range.direction == 4 ? 1 : $game_range.direction == 6 ? -1 : 0))
- new_y = (event.y + ($game_range.direction == 8 ? 1 : $game_range.direction == 2 ? -1 : 0))
- if $game_range.x == new_x and $game_range.y == new_y
- if @ATAQUE_RIGHT == true
- if $game_party.members[0].two_swords_style
- if Crissaegrim_ABS::Distance_Weapons.has_key?($game_party.members[0].weapon_id)
- event.animation_id = $data_items[Crissaegrim_ABS::Distance_Weapons[$game_party.members[0].weapon_id][5]].animation_id
- else
- event.animation_id = $game_party.members[0].atk_animation_id2
- end
- else
- if Crissaegrim_ABS::Distance_Weapons.has_key?($game_party.members[0].armor1_id)
- event.animation_id = $data_items[Crissaegrim_ABS::Distance_Weapons[$game_party.members[0].armor_1_id][5]].animation_id
- else
- event.animation_id = $game_party.members[0].atk_animation_id
- end
- end
- event.recive_atk_right(self)
- elsif @ATAQUE_LEFT == true
- if $game_party.members[0].two_swords_style
- if Crissaegrim_ABS::Distance_Weapons.has_key?($game_party.members[0].weapon_id)
- event.animation_id = $data_items[Crissaegrim_ABS::Distance_Weapons[$game_party.members[0].weapon_id][6]].animation_id
- else
- event.animation_id = $game_party.members[0].atk_animation_id2
- end
- elsif $game_party.members[0].two_hands_legal?
- if Crissaegrim_ABS::Distance_Weapons.has_key?($game_party.members[0].weapon_id)
- event.animation_id = $data_items[Crissaegrim_ABS::Distance_Weapons[$game_party.members[0].weapon_id][6]].animation_id
- else
- event.animation_id = $game_party.members[0].atk_animation_id
- end
- end
- event.recive_atk_left(self)
- elsif @SKILL == true
- event.animation_id = $data_skills[@skl].animation_id
- event.recive_skill(self, @skl)
- elsif @ITEM == true
- event.animation_id = $data_items[@itm].animation_id
- event.recive_itemeffect(self, @itm)
- end
- $game_range.destroy
- event.jump(0,0)
- @ATAQUE_RIGHT = false
- @SKILL = false
- @ITEM = false
- end
- end
- end
- end
- end
- #------------------------------------------------------------------------------
- # Game Actor
- #------------------------------------------------------------------------------
- class Game_Actor
- alias crissaegrim_abs_change_exp change_exp
- def change_exp(exp, show)
- last_level = @level
- last_skills = skills
- @exp = [[exp, 9999999].min, 0].max
- while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
- level_up
- end
- while @exp < @exp_list[@level]
- level_down
- end
- @hp = [@hp, maxhp].min
- @mp = [@mp, maxmp].min
- if show and @level > last_level
- show_level_up
- end
- crissaegrim_abs_change_exp(exp,show)
- end
- def show_level_up
- $game_player.animation_id = Crissaegrim_ABS::LevelUp_Animation
- $game_party.members[0].hp = $game_party.members[0].maxhp
- $game_party.members[0].mp = $game_party.members[0].maxmp
- $game_player.damage = "Level Up"
- end
- end
- #------------------------------------------------------------------------------
- # Game ABS Enemy
- #------------------------------------------------------------------------------
- class GameABS_Enemy < Game_Battler
- attr_reader :enemy_id
- def initialize(enemy_id)
- super()
- @enemy_id = enemy_id
- enemy = $data_enemies[@enemy_id]
- @hp = maxhp
- @mp = maxmp
- end
- def actor?
- return false
- end
- def enemy
- return $data_enemies[@enemy_id]
- end
- def base_maxhp
- return enemy.maxhp
- end
- def base_maxmp
- return enemy.maxmp
- end
- def base_atk
- return enemy.atk
- end
- def base_def
- return enemy.def
- end
- def base_spi
- return enemy.spi
- end
- def base_agi
- return enemy.agi
- end
- def hit
- return enemy.hit
- end
- def eva
- return enemy.eva
- end
- def cri
- return enemy.has_critical ? 10 : 0
- end
- def odds
- return 1
- end
- def element_rate(element_id)
- rank = enemy.element_ranks[element_id]
- result = [0,200,150,100,50,0,-100][rank]
- for state in states
- result /= 2 if state.element_set.include?(element_id)
- end
- return result
- end
- def state_probability(state_id)
- if $data_states[state_id].nonresistance
- return 100
- else
- rank = enemy.state_ranks[state_id]
- return [0,100,80,60,40,20,0][rank]
- end
- end
- def exp
- return enemy.exp
- end
- def gold
- return enemy.gold
- end
- def drop_item1
- return enemy.drop_item1
- end
- def drop_item2
- return enemy.drop_item2
- end
- def use_sprite?
- return true
- end
- def perform_collapse
- if $game_temp.in_battle and dead?
- @collapse = true
- Sound.play_enemy_collapse
- end
- end
- def escape
- @hidden = true
- @action.clear
- end
- def transform(enemy_id)
- @enemy_id = enemy_id
- if enemy.name != @original_name
- @original_name = enemy.name
- @letter = ''
- @plural = false
- end
- @battler_name = enemy.battler_name
- @battler_hue = enemy.battler_hue
- make_action
- end
- def conditions_met?(action)
- case action.condition_type
- when 1
- n = $game_troop.turn_count
- a = action.condition_param1
- b = action.condition_param2
- return false if (b == 0 and n != a)
- return false if (b > 0 and (n < 1 or n < a or n % b != a % b))
- when 2
- hp_rate = hp * 100.0 / maxhp
- return false if hp_rate < action.condition_param1
- return false if hp_rate > action.condition_param2
- when 3
- mp_rate = mp * 100.0 / maxmp
- return false if mp_rate < action.condition_param1
- return false if mp_rate > action.condition_param2
- when 4
- return false unless state?(action.condition_param1)
- when 5
- return false if $game_party.max_level < action.condition_param1
- when 6
- switch_id = action.condition_param1
- return false if $game_switches[switch_id] == false
- end
- return true
- end
- def make_action
- @action.clear
- return unless movable?
- available_actions = []
- rating_max = 0
- for action in enemy.actions
- next unless conditions_met?(action)
- if action.kind == 1
- next unless skill_can_use?($data_skills[action.skill_id])
- end
- available_actions.push(action)
- rating_max = [rating_max, action.rating].max
- end
- ratings_total = 0
- rating_zero = rating_max - 3
- for action in available_actions
- next if action.rating <= rating_zero
- ratings_total += action.rating - rating_zero
- end
- return if ratings_total == 0
- value = rand(ratings_total)
- for action in available_actions
- next if action.rating <= rating_zero
- if value < action.rating - rating_zero
- @action.kind = action.kind
- @action.basic = action.basic
- @action.skill_id = action.skill_id
- @action.decide_random_target
- return
- else
- value -= action.rating - rating_zero
- end
- end
- end
- end
- #------------------------------------------------------------------------------
- # Game Range
- #------------------------------------------------------------------------------
- class Game_Range < Game_Character
- def initialize
- super
- @start_x = 0
- @start_y = 0
- @character_name = ""
- @character_index = 0
- @speed = 0
- @distance = 0
- @step = 0
- end
- def call(start_x,start_y,chara_name="",chara_index=0,speed=4,distance=0)
- @start_x = start_x
- @start_y = start_y
- @character_name = chara_name
- @character_index = chara_index
- @speed = speed
- @distance = distance
- @step = 0
- @direction = $game_player.direction
- case $game_player.direction
- when 2
- moveto(@start_x,@start_y+1)
- when 4
- moveto(@start_x-1,@start_y)
- when 6
- moveto(@start_x+1,@start_y)
- when 8
- moveto(@start_x,@start_y-1)
- end
- end
- def destroy
- @start_x = 0
- @start_y = 0
- @dist_x = 0
- @dist_y = 0
- @character_name = ""
- @character_index = 0
- @distance = 0
- @step = 0
- moveto(0,0)
- end
- def move_route
- return unless movable?
- return if $game_map.interpreter.running?
- @move_speed = @speed
- case @direction
- when 2
- move_down
- when 4
- move_left
- when 6
- move_right
- when 8
- move_up
- end
- @step += 1
- end
- def update
- return destroy if @step >= @distance
- move_route
- super
- end
- def movable?
- return false if moving?
- return false if @move_route_forcing
- return true
- end
- def check_event_trigger_touch(x, y)
- end
- end
- #------------------------------------------------------------------------------
- # Sprite Base
- #------------------------------------------------------------------------------
- class Sprite_Base
- alias animation animation_set_sprites
- def animation_set_sprites(frame)
- cell_data = frame.cell_data
- for i in 0..15
- sprite = @animation_sprites[i]
- next if sprite == nil
- pattern = cell_data[i, 0]
- if pattern == nil or pattern == -1
- sprite.visible = false
- next
- end
- if pattern < 100
- sprite.bitmap = @animation_bitmap1
- else
- sprite.bitmap = @animation_bitmap2
- end
- sprite.visible = true
- sprite.src_rect.set(pattern % 5 * 192,
- pattern % 100 / 5 * 192, 192, 192)
- if @animation_mirror
- sprite.x = @animation_ox - cell_data[i, 1] / 2
- sprite.y = @animation_oy - cell_data[i, 2] / 2
- sprite.angle = (360 - cell_data[i, 4])
- sprite.mirror = (cell_data[i, 5] == 0)
- else
- sprite.x = @animation_ox + cell_data[i, 1] / 2
- sprite.y = @animation_oy + cell_data[i, 2] / 2
- sprite.angle = cell_data[i, 4]
- sprite.mirror = (cell_data[i, 5] == 1)
- end
- sprite.z = self.z + 300
- sprite.ox = 96
- sprite.oy = 96
- sprite.zoom_x = cell_data[i, 3] / 200.0
- sprite.zoom_y = cell_data[i, 3] / 200.0
- sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
- sprite.blend_type = cell_data[i, 7]
- end
- end
- end
- #------------------------------------------------------------------------------
- # Sprite Character
- #------------------------------------------------------------------------------
- class Sprite_Character < Sprite_Base
- alias crissaegrim_abs_spchar_update update
- def initialize(viewport, character = nil)
- super(viewport)
- @character = character
- @balloon_duration = 0
- @_damage_duration = 0
- update
- end
- def update
- super
- if @_damage_duration > 0
- @_damage_duration -=1
- @_damage_sprite.x = self.x
- if @_damage_duration <= 0
- dispose_damage
- end
- end
- if @character != nil and @character.damage != nil
- damage(@character.damage, @character.critical)
- @character.damage = nil
- @character.critical = false
- end
- crissaegrim_abs_spchar_update
- end
- def damage(value, critical)
- dispose_damage
- if value.is_a?(Numeric)
- damage_string = value.abs.to_s
- else
- damage_string = value.to_s
- end
- bitmap = Bitmap.new(160, 48)
- bitmap.font.name = "Georgia"
- bitmap.font.size = 22
- bitmap.font.italic = true
- if value.is_a?(Numeric) and value <= 0
- bitmap.font.color.set(255, 255, 128)
- else
- bitmap.font.color.set(255, 255, 255)
- end
- bitmap.draw_text(1, 13, 160, 36, damage_string, 1)
- bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
- if critical
- bitmap.font.color.set(0, 0, 0)
- bitmap.draw_text(1, 6, 160, 20, "Critical", 1)
- bitmap.font.color.set(255, 245, 155)
- bitmap.draw_text(0, 5, 160, 20, "Critical", 1)
- end
- @_damage_sprite = ::Sprite.new(self.viewport)
- @_damage_sprite.bitmap = bitmap
- @_damage_sprite.ox = 80
- @_damage_sprite.oy = 20
- @_damage_sprite.x = self.x
- @_damage_sprite.y = self.y - self.oy / 2 - 40
- @_damage_sprite.z += 99999
- @_damage_duration = 30
- end
- def show_text(string, size=16, color=0)
- dispose_damage
- damage_string = string
- if string.is_a?(Array)
- array = true
- else
- array = false
- end
- bitmap = Bitmap.new(160, 48)
- bitmap.font.name = "Georgia"
- bitmap.font.size = size
- bitmap.font.italic = true
- if array
- for i in 0..string.size
- next if damage_string[i] == nil
- bitmap.font.color.set(96, 96-20, 0) if color == 0
- bitmap.font.color.set(0, 0, 0) if color != 0
- bitmap.draw_text(-1, (12+(16*i)-1)-16, 160, 36, damage_string[i], 1)
- bitmap.draw_text(+1, (12+(16*i)-1)-16, 160, 36, damage_string[i], 1)
- bitmap.draw_text(-1, (12+(16*i)+1)-16, 160, 36, damage_string[i], 1)
- bitmap.draw_text(+1, (12+(16*i)+1)-16, 160, 36, damage_string[i], 1)
- bitmap.font.color.set(255, 245, 155) if color == 0
- bitmap.font.color.set(144, 199, 150) if color == 1
- bitmap.font.color.set(197, 147, 190)if color == 2
- bitmap.font.color.set(138, 204, 198)if color == 3
- bitmap.draw_text(0, (12+(16*i))-16, 160, 36, damage_string[i], 1)
- end
- else
- bitmap.font.color.set(96, 96-20, 0) if color == 0
- bitmap.font.color.set(0, 0, 0) if color != 0
- bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
- bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
- bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
- bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
- bitmap.font.color.set(255, 245, 155) if color == 0
- bitmap.font.color.set(144, 199, 150) if color == 1
- bitmap.font.color.set(197, 147, 190)if color == 2
- bitmap.font.color.set(138, 204, 198)if color == 3
- bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
- end
- @_damage_sprite = ::Sprite.new(self.viewport)
- @_damage_sprite.bitmap = bitmap
- @_damage_sprite.ox = 80
- @_damage_sprite.oy = 20
- @_damage_sprite.x = self.x
- @_damage_sprite.y = self.y - self.oy / 2
- @_damage_sprite.z = 3000
- @_damage_duration = 30
- end
- def dispose_damage
- if @_damage_sprite != nil
- @_damage_sprite.dispose
- @_damage_sprite = nil
- end
- end
- end
- #------------------------------------------------------------------------------
- # Spriteset Map
- #------------------------------------------------------------------------------
- class Spriteset_Map
- alias crissaegrim_abs_spmap_create_characters create_characters
- alias crissaegrim_abs_spmap_update update
- def create_characters
- crissaegrim_abs_spmap_create_characters
- @character_sprites.push(Sprite_Character.new(@viewport1, $game_range))
- end
- def update
- crissaegrim_abs_spmap_update
- $game_range.update
- end
- end
- #------------------------------------------------------------------------------
- # Window Skill
- #------------------------------------------------------------------------------
- class Window_Skill < Window_Selectable
- alias crissaegrim_abs_wskill_initialize initialize
- def initialize(x, y, width, height, actor)
- crissaegrim_abs_wskill_initialize(x, y, width, height, actor)
- $wait_skill = 0
- end
- def update_help
- if $wait_skill <= 0
- @help_window.set_text(skill == nil ? "" : skill.description)
- else
- @help_window.set_text(skill == nil ? "" : "技能设置完毕!")
- end
- end
- end
- class Scene_Skill
- alias crissaegrim_abs_sskill_start start
- alias crissaegrim_abs_sskill_update update
- alias crissaegrim_abs_sskill_update_skill_selection update_skill_selection
- def start
- crissaegrim_abs_sskill_start
- $wait_skill = 0
- end
- def update
- crissaegrim_abs_sskill_update
- $wait_skill -= 1 if $wait_skill > 0
- end
- def update_skill_selection
- crissaegrim_abs_sskill_update_skill_selection
- for button in Crissaegrim_ABS::Skill_Button.keys
- if Input.trigger?(button)
- Sound.play_decision
- Crissaegrim_ABS::Skill_Button[button] = @skill_window.skill.id
- $wait_skill = 100
- end
- end
- end
- end
- #------------------------------------------------------------------------------
- # Window Item
- #------------------------------------------------------------------------------
- class Window_Item < Window_Selectable
- alias crissaegrim_abs_witem_initialize initialize
- def initialize(x, y, width, height)
- crissaegrim_abs_witem_initialize(x, y, width, height)
- $wait_item = 0
- end
- def update_help
- if $wait_item <= 0
- @help_window.set_text(item == nil ? "" : item.description)
- else
- @help_window.set_text(item == nil ? "" : "物品设置完毕!")
- end
- end
- end
- class Scene_Item
- alias crissaegrim_abs_sitem_start start
- alias crissaegrim_abs_sitem_update update
- alias crissaegrim_abs_sitem_update_item_selection update_item_selection
- def start
- crissaegrim_abs_sitem_start
- $wait_item = 0
- end
- def update
- crissaegrim_abs_sitem_update
- $wait_item -= 1 if $wait_item > 0
- end
- def update_item_selection
- crissaegrim_abs_sitem_update_item_selection
- for button in Crissaegrim_ABS::Item_Button.keys
- if Input.trigger?(button)
- Sound.play_decision
- Crissaegrim_ABS::Item_Button[button] = @item_window.item.id
- $wait_item = 100
- end
- end
- end
- end
- #------------------------------------------------------------------------------
- # Scene Title
- #------------------------------------------------------------------------------
- class Scene_Title < Scene_Base
- alias crissaegrim_abs_stitle_command_new_game command_new_game
- def command_new_game
- $game_range = Game_Range.new
- crissaegrim_abs_stitle_command_new_game
- end
- end
- #------------------------------------------------------------------------------
- # Fim do ABS
- #------------------------------------------------------------------------------
复制代码 以及以及最后是- #==============================================================================
- # ** Scene_File
- #------------------------------------------------------------------------------
- # This class performs the save and load screen processing.
- #==============================================================================
- class Scene_File < Scene_Base
- #--------------------------------------------------------------------------
- # * Write Save Data
- # file : write file object (opened)
- #--------------------------------------------------------------------------
- def write_save_data(file)
- characters = []
- for actor in $game_party.members
- characters.push([actor.character_name, actor.character_index])
- end
- $game_system.save_count += 1
- $game_system.version_id = $data_system.version_id
- @last_bgm = RPG::BGM::last
- @last_bgs = RPG::BGS::last
- Marshal.dump(characters, file)
- Marshal.dump(Graphics.frame_count, file)
- Marshal.dump(@last_bgm, file)
- Marshal.dump(@last_bgs, file)
- Marshal.dump($game_system, file)
- Marshal.dump($game_message, file)
- Marshal.dump($game_switches, file)
- Marshal.dump($game_variables, file)
- Marshal.dump($game_self_switches, file)
- Marshal.dump($game_actors, file)
- Marshal.dump($game_party, file)
- Marshal.dump($game_troop, file)
- Marshal.dump($game_map, file)
- Marshal.dump($game_player, file)
- Marshal.dump($game_range, file)
-
- end
- #--------------------------------------------------------------------------
- # * Read Save Data
- # file : file object for reading (opened)
- #--------------------------------------------------------------------------
- def read_save_data(file)
- characters = Marshal.load(file)
- Graphics.frame_count = Marshal.load(file)
- @last_bgm = Marshal.load(file)
- @last_bgs = Marshal.load(file)
- $game_system = Marshal.load(file)
- $game_message = Marshal.load(file)
- $game_switches = Marshal.load(file)
- $game_variables = Marshal.load(file)
- $game_self_switches = Marshal.load(file)
- $game_actors = Marshal.load(file)
- $game_party = Marshal.load(file)
- $game_troop = Marshal.load(file)
- $game_map = Marshal.load(file)
- $game_player = Marshal.load(file)
- $game_range = Marshal.load(file)
- if $game_system.version_id != $data_system.version_id
- $game_map.setup($game_map.map_id)
- $game_player.center($game_player.x, $game_player.y)
- end
- end
- end
复制代码 谢谢了! |
|