赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 511 |
最后登录 | 2012-11-15 |
在线时间 | 6 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 6 小时
- 注册时间
- 2012-10-3
- 帖子
- 19
|
本帖最后由 hcm 于 2012-10-19 13:05 编辑
- #============================================================================
- #宠物系统 By Iselia雪
- #数据库中可以捕捉的敌人格式这样写 敌人,捕捉后的职业
- #捕捉特技的属性下面设定。
- #敌人捕捉的几率和这个属性抵抗力反比,和使用者速度+敏捷与目标速度+敏捷比值成正比。
- #具体设置参考范例~
- #整合了chaochao的人物仓库(新建的宠物$game_party.actors.include?不认?!)
- #不过这个难不住我ORZ……^__________^
- #捕捉后敌人的行走图和战斗图名字相同,没有行走图则为空。
- #============================================================================
- $捕捉 = "抓宠物啦"
- module RPG
- class Skill
- def catch?
- return @element_set.include?($data_system.elements.index($捕捉))
- end
- end
- end
- module RPG
- class Enemy
- def name
- return @name.split(/,/)[0]
- end
- def mold
- return @name.split(/,/)[1]
- end
- end
- end
- class Game_Enemy < Game_Battler
- def mold
- return $data_enemies[@enemy_id].mold
- end
- def element_ranks
- return $data_enemies[@enemy_id].element_ranks
- end
- def make_pet
- pet = $data_actors[mold.to_i]
- pet.battler_name = self.battler_name
- pet.battler_hue = self.battler_hue
- begin
- RPG::Cache.character(self.battler_name,self.battler_hue)
- pet.character_name = self.battler_name
- pet.character_hue = self.battler_hue
- rescue Errno::ENOENT
-
- end
- pet.name = self.name
- $data_actors[$data_actors.size] = pet
- pet2 = Game_Actor.new($data_actors.size - 1)
- $game_actors.push(pet2)
- $data_actors.delete_at($data_actors.size)
- p $data_actors[$data_actors.size]
- if $game_party.actors.size == 4
- $game_party.add_actor($game_actors.size-1,2)
- else
- $game_party.add_actor($game_actors.size-1)
- end
- $scene.status_window.refresh
- end
- end
- class Game_Actors
- def push(val)
- if @data.size < 999
- @data.push(val)
- end
- end
- def size
- return @data.size
- end
- def [](actor_id)
- if actor_id > 999
- return nil
- end
- if @data[actor_id] == nil
- @data[actor_id] = Game_Actor.new(actor_id)
- end
- return @data[actor_id]
- end
- end
- class Game_Battler
- alias skill_effect_iselia :skill_effect
- def skill_effect(user,skill)
- if skill.element_set.include?($data_system.elements.index($捕捉))
- catch(user)
- return true
- end
- skill_effect_iselia(user,skill)
- end
- #捕捉
- def catch(user)
- percent = (user.agi + user.dex) / (self.agi + self.dex) * percent_base
- if self.can_catch and rand(100) < percent
- self.hidden = true
- self.current_action.kind = 3
- make_pet
- end
- end
- #可否捕捉
- def can_catch
- return self.is_a?(Game_Enemy) && self.mold != nil
- end
- #宠物资料
- def percent_base
- return 0 if self.is_a?(Game_Actor)
- return [100,80,60,40,20,10,5][self.element_ranks[$data_system.elements.index($捕捉)]]
- end
- end
- class Scene_Battle
- attr_accessor :status_window
- def make_skill_action_result
- # 获取特技
- @skill = $data_skills[@active_battler.current_action.skill_id]
- # 如果不是强制行动
- unless @active_battler.current_action.forcing
- # 因为 SP 耗尽而无法使用的情况下
- unless @active_battler.skill_can_use?(@skill.id)
- # 清除强制行动对像的战斗者
- $game_temp.forcing_battler = nil
- # 移至步骤 1
- @phase4_step = 1
- return
- end
- end
- # 消耗 SP
- @active_battler.sp -= @skill.sp_cost
- # 刷新状态窗口
- @status_window.refresh
- # 在帮助窗口显示特技名
- @help_window.set_text(@skill.name, 1)
- # 设置动画 ID
- @animation1_id = @skill.animation1_id
- @animation2_id = @skill.animation2_id
- # 设置公共事件 ID
- @common_event_id = @skill.common_event_id
- # 设置对像侧战斗者
- set_target_battlers(@skill.scope)
- if @skill.catch?
- @active_battler.animation_id = @animation1_id
- ($data_animations[@animation1_id].frame_max + 8).times do
- Graphics.update
- @spriteset.update
- end
- @target_battlers.each do |v|
- v.animation_id = @animation2_id
- end
- ($data_animations[@animation2_id].frame_max + 8).times do
- Graphics.update
- @spriteset.update
- end
- end
- # 应用特技效果
- for target in @target_battlers
- target.skill_effect(@active_battler, @skill)
- end
- if @skill.catch?
- @phase4_step = 5
- end
- end
- end
- ‘‘──史莱姆法师于2012-10-6 09:50补充以下内容:
- 人物仓库脚本
- #==============================================================================
- # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
- #==============================================================================
- #==============================================================================
- # ■ chaochao的人物仓库ver1.02正式版
- # 修改了Game_Party
- # 功能:
- # 用来存放角色的仓库……
- # 召唤画面用$scene = Chaochao_Scene_Party.new
- # 其它使用说明在代码里已经备注。
- #------------------------------------------------------------------------------
- # 作者:chaochao
- # [url]http://zhuchao.go1.icpcn.com[/url]
- #==============================================================================
- class Chaochao_Window_PartyLeft < Window_Selectable
- def initialize
- super(0, 0, 320, 224)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.index = 0
- refresh
- end
- def actor
- return @actors[self.index]
- end
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @actors = []
- for i in 0...$game_party.actors.size
- @actors.push($game_party.actors[i])
- end
-
- @item_max = 4
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, (row_max+1) * 32)
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- def draw_item(index)
- if @actors[index] != nil
- actor = @actors[index]
- text = @actors[index].name
- lv = @actors[index].level.to_s + " "
- if $game_party.chaochao.include?(actor.id) or $game_party.actors.size <= 1
- self.contents.font.color = Color.new(255, 0, 0) #不能被移动的颜色
- else
- self.contents.font.color = Color.new(0, 255, 0) #可以被移动的颜色
- end
- self.contents.draw_text(4, index * 32 + 32, 288, 32, text)
- self.contents.font.color = normal_color
- self.contents.font.size = 16
- self.contents.draw_text(4, index * 32 + 36, 288, 32, "Level: ", 2)
- colorx = [255.0000 - 255.0000/60 * @actors[index].level,0].max
- colory = [255.0000 / 60 * @actors[index].level,255].min
- self.contents.font.color = Color.new(colorx, colory, 0)
- self.contents.draw_text(4, index * 32 + 36, 288, 32, lv, 2)
- self.contents.font.color = normal_color
- self.contents.font.size = 22
- else
- self.contents.draw_text(4, index * 32 + 32, 288, 32, "米有人物!")
- end
- end
- def update_cursor_rect
- if @index < 0
- self.cursor_rect.empty
- return
- end
- row = @index / @column_max
- if row < self.top_row
- self.top_row = row
- end
- if row > self.top_row + (self.page_row_max - 1)
- self.top_row = row - (self.page_row_max - 1)
- end
- cursor_width = self.width / @column_max - 32
- x = @index % @column_max * (cursor_width + 32)
- y = @index / @column_max * 32 - self.oy + 32
- self.cursor_rect.set(x, y, cursor_width, 32)
- end
- def item_max
- return @item_max
- end
- def actor?(index)
- return @actors[index] == nil ? false : true
- end
- def set_index(x)
- @index = x
- end
- end
- #------------------------------------------------------------------------------
- class Chaochao_Window_PartyRight < Window_Selectable
- def initialize
- super(320, 0, 320, 224)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.index = -1
- refresh
- end
- def actor
- return @actors[self.index]
- end
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @actors = []
- for i in 0...$game_party.actors2.size
- @actors.push($game_party.actors2[i])
- end
-
- @item_max = $game_party.actors2.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- for i in 0...@item_max
- draw_item(i)
- end
- elsif @item_max == 0
-
- end
- end
- def draw_item(index)
- actor = @actors[index]
- text = @actors[index].name
- lv = @actors[index].level.to_s + " "
- if $game_party.chaochao2.include?(actor.id) or $game_party.actors.size >= 4
- self.contents.font.color = Color.new(255, 0, 0) #不能被移动的颜色
- else
- self.contents.font.color = Color.new(0, 255, 0) #可以被移动的颜色
- end
- self.contents.draw_text(4, index * 32, 288, 32, text)
- self.contents.font.color = normal_color
- self.contents.font.size = 16
- self.contents.draw_text(4, index * 32 + 4, 288, 32, "Level: ", 2)
- colorx = [255.0000 - 255.0000/60 * @actors[index].level,0].max
- colory = [255.0000 / 60 * @actors[index].level,255].min
- self.contents.font.color = Color.new(colorx, colory, 0)
- self.contents.draw_text(4, index * 32 + 4, 288, 32, lv, 2)
- self.contents.font.color = normal_color
- self.contents.font.size = 22
- end
- def update_cursor_rect
- if @index < 0
- self.cursor_rect.empty
- return
- end
- row = @index / @column_max
- if row < self.top_row
- self.top_row = row
- end
- if row > self.top_row + (self.page_row_max - 1)
- self.top_row = row - (self.page_row_max - 1)
- end
- cursor_width = self.width / @column_max - 32
- x = @index % @column_max * (cursor_width + 32)
- y = @index / @column_max * 32 - self.oy
- self.cursor_rect.set(x, y, cursor_width, 32)
- end
- def item_max
- return @item_max
- end
- def actor?(index)
- return @actors[index] == nil ? false : true
- end
- def set_index(x)
- @index = x
- end
- end
- #------------------------------------------------------------------------------
- class Chaochao_Window_PartyData < Window_Base
-
- def initialize
- super(0, 224, 640, 256)
- self.contents = Bitmap.new(width - 32, height - 32)
- @actor = nil
- end
-
- def set_actor(actor)
- self.contents.clear
- draw_actor_name(actor, 4, 0)
- draw_actor_state(actor, 140, 0)
- draw_actor_hp(actor, 284, 0)
- draw_actor_sp(actor, 460, 0)
- @actor = actor
- self.visible = true
- end
- def clear
- self.contents.clear
- end
- end
- #------------------------------------------------------------------------------
- class Game_Party
- attr_reader :actors2
- attr_reader :chaochao#不能从队伍向备用角色移动的角色ID
- attr_reader :chaochao2#不能从备用角色向队伍移动的角色ID
- def initialize
- @actors = []
- @gold = 0
- @steps = 0
- @items = {}
- @weapons = {}
- @armors = {}
- @actors2 = []
- @chaochao = []
- @chaochao2 = []
- end
- def add_actor(actor_id,type=1)#type为1是向队伍中添加,为2则相反。
- case type
- when 1
- if $game_actors[actor_id] != nil
- actor = $game_actors[actor_id]
- #如果队伍没有满和队伍中没有此角色
- if @actors.size < 4 and not @actors.include?(actor) and not @actors2.include?(actor)
- @actors.push(actor)
- $game_player.refresh
- end
- end
- when 2
- if $game_actors[actor_id] != nil
- actor = $game_actors[actor_id]
- #如果角色不在队伍中和不在备用角色队伍中的情况下
- #向备用角色中添加角色
- if not @actors.include?(actor) and not @actors2.include?(actor)
- @actors2.push(actor)
- $game_player.refresh
- end
- end
- end
- end
-
- def huanren(index,type=1)#type为1是从备用角色向队伍中移动,为2则相反。
- case type
- when 1
- id = @actors2[index].id
- actor = $game_actors[id]
- if @actors.size < 4 and not @chaochao2.include?(index) #and not @actors.include?(actor)
- @actors.push(actor)
- #@actors2.delete(actor)
- @actors2.each do |i|
- @actors2.delete(i) if i.id == actor.id
- end
- $game_system.se_play($data_system.decision_se)
- $game_player.refresh
- end
- when 2
- id = @actors[index].id
- actor = $game_actors[id]
- if actor != nil and not @chaochao.include?(index)
- @actors2.push(actor)
- @actors.each do |i|
- @actors.delete(i) if i.id == actor.id
- end
- $game_system.se_play($data_system.decision_se)
- $game_player.refresh
- end
- end
- end
-
- #type1,1是操作队伍中的角色能否向备用队伍移动,2则相反。
- #type2,1是添加不能移动的,2是删除不能移动的。
- def yidong(actor_id,type1,type2=1)
- case type2
- when 1
- case type1
- when 1
- @chaochao.push(actor_id)
- when 2
- @chaochao2.push(actor_id)
- end
- when 2
- case type1
- when 1
- @chaochao.delete(actor_id)
- when 2
- @chaochao2.delete(actor_id)
- end
- end
- end
-
- #type,1从队伍中离开,2从备用角色中离开,3从队伍和备用角色中离开。
- def remove_actor(actor_id,type=1)
- actor = $game_actors[actor_id]
- case type
- when 1
- @actors.delete(actor)
- $game_player.refresh
- when 2
- @actors2.delete(actor)
- $game_player.refresh
- when 3
- @actors.delete(actor)
- @actors2.delete(actor)
- $game_player.refresh
- end
- end
-
- def refresh
- new_actors = []
- new_actors2 = []
- for i in [email][email protected][/email]
- if $game_actors[@actors[i].id] != nil
- new_actors.push($game_actors[@actors[i].id])
- end
- end
- @actors = new_actors
- for i in [email][email protected][/email]
- if $game_actors[@actors2[i].id] != nil
- new_actors2.push($game_actors[@actors2[i].id])
- end
- end
- @actors2 = new_actors2
- end
- end
- #------------------------------------------------------------------------------
- class Chaochao_Scene_Party
- def main
- @left_temp_command = 0
- @right_temp_command = 0
- @temp = 0
- @left_window = Chaochao_Window_PartyLeft.new
- @left_window.active = true
- @right_window = Chaochao_Window_PartyRight.new
- @right_window.active = false
- @data_window = Chaochao_Window_PartyData.new
- update_data
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- Graphics.freeze
- @left_window.dispose
- @right_window.dispose
- @data_window.dispose
- end
-
- def update
- @left_window.update
- @right_window.update
- @data_window.update
- update_command
- update_data
- end
-
- def update_command
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- #画面切换
- $scene = Scene_Map.new
- return
- end
- if @left_window.active
- update_left
- return
- end
- if @right_window.active
- update_right
- return
- end
- end
-
- def update_left
- if Input.trigger?(Input::RIGHT)
- if @right_window.item_max > 0
- @left_temp_command = @left_window.index
- @left_window.set_index(-1)
- $game_system.se_play($data_system.cursor_se)
- @left_window.active = false
- @right_window.active = true
- @left_window.refresh
- @right_window.refresh
- @right_window.set_index(@right_temp_command)
- return
- else
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- end
- if Input.trigger?(Input::C)
- if @left_window.active and @left_window.actor?(@left_window.index) and $game_party.actors.size > 1 and not $game_party.chaochao.include?($game_party.actors[@left_window.index].id)
- $game_party.huanren(@left_window.index,2)#type为1是从备用角色向队伍中移动,为2则相反。
- @left_window.refresh
- @right_window.refresh
- else
- $game_system.se_play($data_system.buzzer_se)
- end
- end
- return
- end
-
- def update_right
- if Input.trigger?(Input::LEFT)
- if @left_window.item_max > 0
- @right_temp_command = @right_window.index
- @right_window.set_index(-1)
- $game_system.se_play($data_system.cursor_se)
- @left_window.active = true
- @right_window.active = false
- @left_window.refresh
- @right_window.refresh
- @left_window.set_index(@left_temp_command)
- return
- else
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- end
- if Input.trigger?(Input::C)
- if $game_party.actors.size >= 4
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- if @right_window.active and @right_window.actor?(@right_window.index) and not $game_party.chaochao2.include?($game_party.actors2[@right_window.index].id)
- $game_party.huanren(@right_window.index,1)#type为1是从备用角色向队伍中移动,为2则相反。
- if $game_party.actors2.size == 0
- @right_temp_command = @right_window.index
- @right_window.set_index(-1)
- $game_system.se_play($data_system.cursor_se)
- @left_window.active = true
- @right_window.active = false
- @left_window.refresh
- @right_window.refresh
- @left_window.set_index(@left_temp_command)
- end
- if @right_window.index > 0
- @right_window.set_index(@right_window.index-1)
- end
- @left_window.refresh
- @right_window.refresh
- else
- $game_system.se_play($data_system.buzzer_se)
- end
- end
- return
- end
-
- def update_data
- if @left_window.active
- if $game_party.actors[@left_window.index] != nil
- @data_window.set_actor($game_party.actors[@left_window.index])
- else
- @data_window.clear
- end
- return
- end
- if @right_window.active
- if $game_party.actors2[@right_window.index] != nil
- @data_window.set_actor($game_party.actors2[@right_window.index])
- else
- @data_window.clear
- end
- return
- end
- end
- end
- #==============================================================================
- # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
- #==============================================================================
- 人物仓库插件
- #==============================================================================
- # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
- #==============================================================================
- #==============================================================================
- # ■ Interpreter (分割定义 4)
- #------------------------------------------------------------------------------
- # 执行事件命令的解释器。本类在 Game_System 类
- # 和 Game_Event 类的内部使用。
- #==============================================================================
- class Interpreter
- #--------------------------------------------------------------------------
- # ● 角色的替换
- #--------------------------------------------------------------------------
- def command_129
- # 获取角色
- actor = $game_actors[@parameters[0]]
- # 角色有效的情况下
- if actor != nil
- # 操作分支
- if @parameters[1] == 0
- if @parameters[2] == 1
- $game_actors[@parameters[0]].setup(@parameters[0])
- end
- if $game_party.actors.size == 4
- $game_party.add_actor(@parameters[0],2)
- else
- $game_party.add_actor(@parameters[0])
- end
- else
- $game_party.remove_actor(@parameters[0],3)
- end
- end
- # 继续
- return true
- end
- end
- #==============================================================================
- # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
- #==============================================================================
- ’’
复制代码 |
|