赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 2 |
经验 | 13028 |
最后登录 | 2018-6-30 |
在线时间 | 339 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 195
- 在线时间
- 339 小时
- 注册时间
- 2012-7-16
- 帖子
- 148
|
本帖最后由 hys111111 于 2012-9-30 20:51 编辑
- # ☆★☆ 提取放置物脚本(强化) ☆★☆
- #------------------------------------------------------------------------------
- # - 美兽
- # - 2007.4.12
- #------------------------------------------------------------------------------
- # 爱护环境,人人有责,现实中切勿乱丢垃圾。
- #------------------------------------------------------------------------------
- #------------------------------------------------------------------------------
- # 脚本原理:
- # 是从仓库地图中提取事件,将其拷贝放入指定的位置,
- # 依此达成随时随地生成新事件的功能,如此可节省大量用RGSS编写事件所消耗的体力,很多地方写的
- # 很保守,尽量减少冲突几率。。
- # 此为强化版,可实现新事件的保存,但代价是冲突的随之增大,若只想单纯实现ARPG
- # 一类的物品掉落,场所移动后便清除,请使用简洁版。
- #------------------------------------------------------------------------------
- =begin
- Note:
-
- 一:生成物品主方法:
- Drop_Item.make_events(map_id,event_id,item_x,item_y,save=false)
- map_id : 仓库地图的ID。
- event_id : 仓库中对应事件的ID。
- item_x、item_y :新事件的X与Y坐标
- save : 是否存储标志;
- 默认为false,即不存储,场所移动等转换场景后事件会消失;
- true 为存储,取档、关机、登火星,返回后事件仍存在。
-
- 二:删除事件方法:
- 事件名若包含"delete"字段,则执行完毕会立即自我清除;
- 注:任何事件皆如此。
- 三:必掌握语句:
- $game_map.events[@event_id]
- $game_player
- 事件的脚本使用,表示“本事件”和“角色”,主要为取得事件的坐标,
- 取得“本事件”X与Y坐标:$game_map.events[@event_id].event.x
- $game_map.events[@event_id].event.y
- 取得“角色”X与Y坐标:$game_player.x
- $game_player.y
- 例如,在某事件左侧生成2号地图的2号事件并永久存储,写法如下。
- x = $game_map.events[@event_id].event.x
- y = $game_map.events[@event_id].event.y
- Drop_Item.make_events(2,2,x-1,y,true)
- 四:备注:
- 此脚本用法十分灵活,种植、建设、舍弃、掉宝等功能都可用以达成。
- =end
- #==============================================================================
- #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- # Spriteset_Map ###!!!!!!!!!
- module Drop_Item
- def self.make_events(map_id,event_id,item_x,item_y,save=false)
- return unless self.is_map?
- map = self.map_data_load(map_id)
- temp = Marshal.load(Marshal.dump(map))
- if !$game_system.map_events_number
- $game_system.map_events_number = {}
- end
- sum = $game_system.map_events_number
- m_id = $game_map.map_id
- sum[m_id] == nil ? sum[m_id] = 2000 : sum[m_id] += 1
- new_event_id = sum[m_id]
- temp.events[event_id].id = new_event_id
- temp.events[event_id].x,temp.events[event_id].y = item_x,item_y
- $game_map.events[new_event_id] = Game_Event.new(m_id,temp.events[event_id])
- if save
- now_map = self.map_data_load(m_id)
- now_map.events[new_event_id] = temp.events[event_id]
- self.map_data_save(m_id,now_map)
- end
- $scene.spriteset.push_actor(new_event_id)
- #refresh_map
- end
- def self.map_data_init
- for i in 1..999
- begin
- map = load_data(sprintf("Data/Map%03d.rxdata", i))
- rescue Errno::ENOENT
- next
- end
- $game_system.map_data[i] = Marshal.load(Marshal.dump(map))
- end
- end
- def self.map_data_save(map_id,event)
- $game_system.map_data[$game_map.map_id] = event
- end
- def self.map_data_load(map_id)
- if !$game_system.map_data
- $game_system.map_data = {}
- self.map_data_init
- end
- return $game_system.map_data[map_id]
- end
- def self.delete_events(event_id)
- return unless self.is_map?
- $game_map.events.delete(event_id)
- #self.refresh_map
- $scene.spriteset.delete_actor(event_id)
- end
- def self.refresh_map
- return unless self.is_map?
- $scene.refresh = true
- end
- def self.is_map?
- (return true) if $scene.is_a?(Scene_Map)
- return false
- end
- end
- class Game_Map
- def setup(map_id)
- @map_id = map_id
- @map = Drop_Item.map_data_load(@map_id)
- tileset = $data_tilesets[@map.tileset_id]
- @tileset_name = tileset.tileset_name
- @autotile_names = tileset.autotile_names
- @panorama_name = tileset.panorama_name
- @panorama_hue = tileset.panorama_hue
- @fog_name = tileset.fog_name
- @fog_hue = tileset.fog_hue
- @fog_opacity = tileset.fog_opacity
- @fog_blend_type = tileset.fog_blend_type
- @fog_zoom = tileset.fog_zoom
- @fog_sx = tileset.fog_sx
- @fog_sy = tileset.fog_sy
- @battleback_name = tileset.battleback_name
- @passages = tileset.passages
- @priorities = tileset.priorities
- @terrain_tags = tileset.terrain_tags
- @display_x = 0
- @display_y = 0
- @need_refresh = false
- @events = {}
- for i in @map.events.keys
- @events[i] = Game_Event.new(@map_id, @map.events[i])
- end
- @common_events = {}
- for i in 1...$data_common_events.size
- @common_events[i] = Game_CommonEvent.new(i)
- end
- @fog_ox = 0
- @fog_oy = 0
- @fog_tone = Tone.new(0, 0, 0, 0)
- @fog_tone_target = Tone.new(0, 0, 0, 0)
- @fog_tone_duration = 0
- @fog_opacity_duration = 0
- @fog_opacity_target = 0
- @scroll_direction = 2
- @scroll_rest = 0
- @scroll_speed = 4
- end
- end
- begin
- class Interpreter
- def command_end
- @list = nil
- if @main and @event_id > 0
- if $game_map.events[@event_id].event.name["delete"].nil?
- $game_map.events[@event_id].unlock
- else
- if $scene.is_a?(Scene_Map)
- Drop_Item.delete_events(@event_id)
- now_map = Drop_Item.map_data_load($game_map.map_id)
- now_map.events.delete(@event_id)
- Drop_Item.map_data_save($game_map.map_id,now_map)
- end
- end
- end
- end
- end
- class Game_System
- attr_accessor :map_events_number
- attr_accessor :map_data
- end
- class Scene_Map
- attr_accessor :refresh
- end
复制代码 下一个- #==============================================================================
- # ■ ARPG_BATTLE
- #------------------------------------------------------------------------------
- # 处理ARPG 战斗的类。
- # 如果事件的第一个内容是注释的话就会被认为是敌人....所以如果只是NPC的话~
- # 事件的内容的第一行一定不能是注释``不然会有一大堆问题-________-~||||
- #==============================================================================
- class ARPG_BATTLE
- HP_BAR_DISP_TIME = 500000 # 敌人血条消失时间
- ENEMY_HP = 1 # 敌人回血的技能ID #-___-无视这个`要敌人会加血的话直接在敌人的技能数组里加上恢复HP的技能就好了``
- YC = false # 敌人被攻击是否增加延迟
- KEYS = {
- "A"=>$R_Key_A,
- "S"=>$R_Key_S,
- "D"=>$R_Key_D,
- "F"=>$R_Key_F,
- "G"=>$R_Key_G}#Kboard.trigger?
- LVUP_ME = "Audio/SE/h寒气.wav" # 升级音效
- $refresh = {} # 全局化一个刷新列表
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize
- @actor = $game_party.actors[0]
- @x = $game_player.x
- @y = $game_player.y
- @d = $game_player.direction
- # 血条消失的时间
- @hp_disp_time = 0
- # 攻击延迟
- @actor_atktime = 0
- #
- @bullets = []
- # 敌人攻击延迟
- # 事件ID->延迟时间
- @event_atk = {}
- for event in $game_map.events.values
- next if !event.is_enemy?
- @event_atk[event.id] = 0
- end
- end
- #--------------------------------------------------------------------------
- # ● 释放
- #--------------------------------------------------------------------------
- def dispose
- @sprite.dispose if [email protected]?
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def update
- if @hp_disp_time >= 0
- @hp_disp_time -= 1
- if @hp_disp_time <= 0
- @attev = nil
- end
- end
- if @actor_atktime > 0
- @actor_atktime -= 1
- end
- update_actor
- update_event
- end
- #--------------------------------------------------------------------------
- # ● 刷新事件
- #--------------------------------------------------------------------------
- def update_event
- for event in $game_map.events.values
- next if !event.is_enemy?
- if @event_atk[event.id] > 0
- @event_atk[event.id] -= 1
- end
- new_x = event.x + (event.direction == 6 ? 1 : event.direction == 4 ? -1 : 0)
- new_y = event.y + (event.direction == 2 ? 1 : event.direction == 8 ? -1 : 0)
- if event.hp <= event.maxhp*0.4 and rand(101)>100-event.escape_rand and event.escape? and event.sp >= $game_skills[ENEMY_HP].sp_cost
- if (event.x - $game_player.x).abs < 64 and
- (event.y - $game_player.y).abs < 64
- for i in 0..randg(2,3)
- break if rand(100) < 10
- event.move_away_from_player
- end
- end
- damage_skill_enemy(event, $game_skills[ENEMY_HP])
- break
- end
- if new_x == @x and new_y == @y and @event_atk[event.id] <= 0
- if event.skill.size > 0 and rand(101)>100-event.skill_rand
- skill = event.skill[rand(event.skill.size)]
- damage_skill_enemy(event, $game_skills[skill])
- break
- end
- dagame_acon_actor(@actor,event_damage(event,@actor),event.animation2_id,event)
- break
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 判断可否移动
- #--------------------------------------------------------------------------
- def move?
- if @actor.states.size == 0
- return true
- end
- for i in @actor.states
- if $data_states[i].restriction == 4
- return false
- end
- end
- return true
- end
- #--------------------------------------------------------------------------
- # ● 是否可以用技能
- #--------------------------------------------------------------------------
- def skill?
- if @actor.states.size == 0
- return true
- end
- for i in @actor.states
- if $data_states[i].restriction == 1
- return false
- end
- end
- return true
- end
- #--------------------------------------------------------------------------
- # ● 刷新角色
- #--------------------------------------------------------------------------
- def update_actor
- refresh(0) if @x != $game_player.x
- refresh(1) if @y != $game_player.y
- refresh(2) if @d != $game_player.direction
- update_actor_attk if move?
- update_actor_skill if move? and skill?
- update_actor_item
- update_bullet if @bullets.size > 0
- end
- #--------------------------------------------------------------------------
- # ● 刷按下物品键时
- #--------------------------------------------------------------------------
- def update_actor_item
- if Kboard.trigger?($R_Key_Z)
- item = $data_items[@actor.item_key["Z"]]
- return if item.nil?
- item_effect(item)
- if item.common_event_id > 0
- $game_temp.common_event_id = item.common_event_id
- end
- end
- if Kboard.trigger?($R_Key_X)
- item = $data_items[@actor.item_key["X"]]
- return if item.nil?
- item_effect(item)
- if item.common_event_id > 0
- $game_temp.common_event_id = item.common_event_id
- end
- end
- if Kboard.trigger?($R_Key_C)
- item = $data_items[@actor.item_key["C"]]
- return if item.nil?
- item_effect(item)
- if item.common_event_id > 0
- $game_temp.common_event_id = item.common_event_id
- end
- end
- def item_effect(item)
- damage = @actor.item_effect(item)
- $game_player.animation_id = item.animation2_id
- $game_system.se_play(item.menu_se)
- if item.consumable
- $game_party.lose_item(item.id,1)
- end
- $refresh["item"] = true
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新按下技能键时
- #--------------------------------------------------------------------------
- def update_actor_skill
- if @actor_atktime <= 0
- if Kboard.trigger?(KEYS["A"])
- skill = $game_skills[@actor.key["A"]]
- return if skill.nil?
- if skill.scope == 2
- rangs = ARPG_Rangs.new($game_player, skill.rang).rangs
- damage_skill(@actor, skill, rangs, skill.dop?)
- elsif skill.scope == 1 or skill.scope == 3
- damage_skill(@actor, skill)
- $game_temp.common_event_id = skill.common_event_id
- end
- end
- if Kboard.trigger?(KEYS["S"])
- skill = $game_skills[@actor.key["S"]]
- return if skill.nil?
- if skill.scope == 2
- rangs = ARPG_Rangs.new($game_player, skill.rang).rangs
- damage_skill(@actor, skill, rangs,skill.dop?)
- elsif skill.scope == 1 or skill.scope == 3
- damage_skill(@actor, skill)
- $game_temp.common_event_id = skill.common_event_id
- end
- end
- if Kboard.trigger?(KEYS["D"])
- skill = $game_skills[@actor.key["D"]]
- return if skill.nil?
- if skill.scope == 2
- rangs = ARPG_Rangs.new($game_player, skill.rang).rangs
- damage_skill(@actor, skill, rangs,skill.dop?)
- elsif skill.scope == 1 or skill.scope == 3
- damage_skill(@actor, skill)
- $game_temp.common_event_id = skill.common_event_id
- end
- end
- if Kboard.trigger?(KEYS["F"])
- skill = $game_skills[@actor.key["F"]]
- return if skill.nil?
- if skill.scope == 2
- rangs = ARPG_Rangs.new($game_player, skill.rang).rangs
- damage_skill(@actor, skill, rangs,skill.dop?)
- elsif skill.scope == 1 or skill.scope == 3
- damage_skill(@actor, skill)
- $game_temp.common_event_id = skill.common_event_id
- end
- end
- if Kboard.trigger?(KEYS["G"])
- skill = $game_skills[@actor.key["G"]]
- return if skill.nil?
- if skill.scope == 2
- rangs = ARPG_Rangs.new($game_player, skill.rang).rangs
- damage_skill(@actor, skill, rangs,skill.dop?)
- elsif skill.scope == 1 or skill.scope == 3
- damage_skill(@actor, skill)
- $game_temp.common_event_id = skill.common_event_id
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新角色普通攻击行为
- #--------------------------------------------------------------------------
- def update_actor_attk
- # C按下时
- if ((Kboard.trigger?($R_Key_SPACE) or Kboard.trigger?($R_Key_RETURN)) or S[1])and @actor_atktime <= 0
- if @actor.weapon_id.between?(50,35) # and $data_weapons[@actor.weapon_id].rang >= 1
- new_x = @x + (@d == 6 ? 5 : @d == 4 ? -5 : 0)
- new_y = @y + (@d == 2 ? 5 : @d == 8 ? -5 : 0)
- event = $game_map.events[$game_map.check_event(new_x,new_y)]
- return if !event.nil? and !event.is_enemy?
- rang_atk#(@actor.animation1_id)
- return
- end
- new_x = @x + (@d == 6 ? 1 : @d == 4 ? -1 : 0)
- new_y = @y + (@d == 2 ? 1 : @d == 8 ? -1 : 0)
- event = $game_map.events[$game_map.check_event(new_x,new_y)]
- show_ain(@actor.animation1_id,true)
- if $data_weapons[@actor.weapon_id].element_set.include?(17)
- tag = []
- rang = ARPG_Rangs.new($game_player, 2).rangs
- for xy in rang
- event = $game_map.events[$game_map.check_event(xy[0],xy[1])]
- if !event.nil? and event.maxhp > 0
- tag.push(event)
- end
- end
- tag.each{|t|dagame_acon(t,event_damage(@actor, t),@actor.animation2_id)}
- end
- if $data_weapons[@actor.weapon_id].element_set.include?(18)
- tag = []
- rang = ARPG_Rangs.new($game_player, 4).rangs
- for xy in rang
- event = $game_map.events[$game_map.check_event(xy[0],xy[1])]
- if !event.nil? and event.maxhp > 0
- tag.push(event)
- end
- end
- tag.each{|t|dagame_acon(t,event_damage(@actor, t),@actor.animation2_id)}
- end
- if !event.nil? and event.maxhp > 0 and @actor_atktime <= 0
- @attev = event
- dagame_acon(event,event_damage(@actor, event),@actor.animation2_id)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新精灵的移动以及接触判断
- #--------------------------------------------------------------------------
- def update_bullet
- for bullet in @bullets
- bullet.update
- case bullet.hit_event
- when String
- if bullet.opacity <= 10
- $scene.spriteset.delete_bullet(bullet)
- @bullets.delete(bullet)
- end
- when Game_Event
- event = bullet.hit_event
- next if !event.is_enemy?
- @attev = event
- dagame_acon(event,event_damage(@actor, event),@actor.animation2_id)
- $scene.spriteset.delete_bullet(bullet)
- @bullets.delete(bullet)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 生成远程攻击的精灵
- #--------------------------------------------------------------------------
- def rang_atk
- bullet = ARPG_Bullet.new("Arrow", @x, @y, @d)
- $scene.spriteset.add_bullet(bullet)
- @bullets.push(bullet)
- @actor_atktime = $data_weapons[@actor.weapon_id].time
- end
- #--------------------------------------------------------------------------
- # ● 获取被攻击中的事件
- #--------------------------------------------------------------------------
- def target
- return @attev
- end
- #--------------------------------------------------------------------------
- # ● 敌人死亡处理
- #--------------------------------------------------------------------------
- def chae_deal(event)
- if event.hp <= 0
- $game_system.enemy_cun += 1
- list_level = @actor.level
- list_maxhp = @actor.maxhp
- list_maxsp = @actor.maxsp
- list_skill = @actor.skills.dup
- list_hp = @actor.hp
- list_sp = @actor.sp
- list_str = @actor.str
- list_dex = @actor.dex
- list_agi = @actor.agi
- list_int = @actor.int
- @actor.exp += event.exp
- Mess_Text.write("#{@actor.name}击败了#{event.name}")
- Mess_Text.write("#{@actor.name}获得#{event.exp}经验值")
- if event.item.size > 0
- for item in event.item
- if rand(101) > 100-item[1]
- Mess_Text.write("#{event.name}掉落了#{$data_items[item[0]].name}")
- $game_party.gain_item(item[0], 1)
- end
- end
- end
- if event.weapon.size > 0
- for weapon in event.weapon
- if rand(101) > 100-weapon[1]
- Mess_Text.write("#{event.name}掉落了#{$data_weapons[weapon[0]].name}")
- $game_party.gain_weapon(weapon[0], 1)
- end
- end
- end
- if event.armor.size > 0
- for armor in event.armor
- if rand(101) > 100-armor[1]
- Mess_Text.write("#{event.name}掉落了#{$data_armors[armor[0]].name}")
- $game_party.gain_armor(armor[0], 1)
- end
- end
- end
- if @actor.level > list_level
- @actor.hp = list_hp
- @actor.sp = list_sp
- Audio.me_play(LVUP_ME)
- Mess_Text.write("#{@actor.name}等级提升:")
- Mess_Text.write("#{@actor.name}HP最大值 上升 #{@actor.maxhp - list_maxhp}")
- Mess_Text.write("#{@actor.name}SP最大值 上升 #{@actor.maxsp - list_maxsp}")
- end
- ls = []
- if list_skill != @actor.skills
- for s in @actor.skills
- if !list_skill.include?(s)
- ls.push s
- end
- end
- end
- ls.each{|skill|
- Mess_Text.write("#{@actor.name}领悟:#{$game_skills[skill].name}")
- }
- $refresh["item"] = true
- delete_event(event)
- @attev = nil
- end
- end
- #--------------------------------------------------------------------------
- # ● 删除事件
- #--------------------------------------------------------------------------
- def delete_event(event)
- # 生成独立开关键
- key = [$game_map.map_id, event.id, 'A']
- # 更改独立开关
- $game_self_switches[key] = true
- $game_map.need_refresh = true
- #$game_map.events.delete(event.id)
- #$scene.spriteset.dispose
- #$scene.spriteset = Spriteset_Map.new
- end
- #--------------------------------------------------------------------------
- # ● 敌人被攻击伤害处理(也就是角色的攻击)
- #--------------------------------------------------------------------------
- def dagame_acon(event,damage,ani_id)
- event.hp -= damage.to_i
- event.animation_id = ani_id
- @hp_disp_time = HP_BAR_DISP_TIME
- @actor_atktime = $data_weapons[@actor.weapon_id].time
- if YC
- @event_atk[event.id] = [[@event_atk[event.id]+randg(5,8), event.atk_time*3].min, 0].max
- end
- event.damage = damage
- event.damage_pop = true
- if rand(2)==1
- #event.turn_toward_player
- if randg(1,4) == 2
- @event_atk[event.id] += randg(5,8)
- end
- end
- if event.move_type == 1
- event.move_type = 2
- event.move_speed = 3
- event.move_frequency = 6
- end
-
- if event.damage == "Miss"
- Mess_Text.write("#{event.name}没有受到伤害")
- else
- Mess_Text.write("#{event.name}受到了#{event.damage}点伤害")
- end
-
- chae_deal(event)
- if $game_party.all_dead?
- $scene = Scene_Gameover.new
- end
- end
- #--------------------------------------------------------------------------
- # ● 角色被攻击伤害处理(也就是敌人的攻击)
- #--------------------------------------------------------------------------
- def dagame_acon_actor(actor,damage,ani_id,event)
- event.white_flash = true
- actor.hp -= damage.to_i
- if YC
- @actor_atktime = [[@actor_atktime+randg(5,8), $data_weapons[@actor.weapon_id].time*3].min, 0].max
- end
-
- if event.attk_states[0] > 0 and rand(100) > 100-event.attk_states[1]
- unless @actor.state_guard?(event.attk_states[0])
- @actor.add_state(event.attk_states[0])
- end
- end
-
- $game_player.animation_id = ani_id
- @event_atk[event.id] = event.atk_time
- $game_player.damage = damage
- $game_player.damage_pop = true
-
- if damage != "Miss"
- Mess_Text.write("#{@actor.name}受到了#{$game_player.damage}点伤害")
- else
- Mess_Text.write("#{actor.name}没有受到伤害")
- end
-
- if $game_party.all_dead?
- $scene = Scene_Gameover.new
- end
- end
- #--------------------------------------------------------------------------
- # ● 敌人使用技能处理
- #--------------------------------------------------------------------------
- def damage_skill_enemy(user, skill, skill_rang=[])
- return if user.sp < skill.sp_cost
- if skill.scope == 1 or skill.scope == 2
- user.animation_id = skill.animation1_id
- Mess_Text.write("#{user.name}使用了#{skill.name}")
- damage = event_damage_skill(user,@actor,skill)
- dagame_acon_actor(@actor,damage,skill.animation2_id,user)
- user.sp -= skill.sp_cost
- elsif skill.scope == 3
- user.animation_id = skill.animation1_id
- user.animation_id = skill.animation2_id
- #damage = event_damage(user,user)
- damage = event_damage_skill(user,user,skill)
- user.hp -= damage.to_i
- user.sp -= skill.sp_cost
- @event_atk[user.id] = user.atk_time
- Mess_Text.write("#{user.name}使用了#{skill.name}恢复了#{damage.abs}HP")
- end
- end
- #--------------------------------------------------------------------------
- # ● 角色使用技能处理
- #--------------------------------------------------------------------------
- def damage_skill(user, skill, skill_rang=[],d = false)
- if user.sp < skill.sp_cost
- Mess_Text.write("SP不足")
- return
- end
- if skill.scope == 1
- new_x = @x + (@d == 6 ? 1 : @d == 4 ? -1 : 0)
- new_y = @y + (@d == 2 ? 1 : @d == 8 ? -1 : 0)
- event = $game_map.events[$game_map.check_event(new_x,new_y)]
- if !event.nil? and event.maxhp > 0 and @actor_atktime <= 0
- Mess_Text.write("#{user.name}使用了#{skill.name}")
- @attev = event
- $game_player.animation_id = skill.animation1_id
- damage = event_damage_skill(user, event, skill)
- dagame_acon(event,damage,skill.animation2_id)
- user.sp -= skill.sp_cost
- @actor_atktime = skill.time
- $game_skills[skill.id].exp += (damage/5).abs+(randg(damage*0.8,damage*1.2)/10)
- end
- elsif skill.scope == 2
- tag = []
- for xy in skill_rang
- event = $game_map.events[$game_map.check_event(xy[0],xy[1])]
- if !event.nil? and event.maxhp > 0
- tag.push(event)
- end
- end
- if tag.size == 0
- show_ain(skill.animation1_id ,d)
- user.sp -= skill.sp_cost
- @actor_atktime = skill.time#$data_weapons[@actor.weapon_id].time
- return
- end
- Mess_Text.write("#{user.name}使用了#{skill.name}")
- for e in tag
- @attev = e
- damage = event_damage_skill(user, e, skill)
- dagame_acon(e,damage,skill.animation2_id)
- @hp_disp_time = 0 if tag.size > 1
- end
- show_ain(skill.animation1_id,d)
- @actor_atktime = skill.time
- if tag != []
- user.sp -= skill.sp_cost
- $game_skills[skill.id].exp += (damage/5).abs+(randg(damage*0.8,damage*1.2)/10)
- end
- elsif skill.scope == 3
- $game_player.animation_id = skill.animation1_id
- $game_player.animation_id = skill.animation2_id
- damage = @actor.skill_effect(@actor,skill)#event_damage_skill(user, @actor, skill)
- #user.hp -= damage
- #user.sp -= skill.sp_cost
- $game_player.damage = damage.to_i
- $game_player.damage_pop = true
- #Mess_Text.write("#{user.name}使用了#{skill.name}恢复了#{damage.abs}HP")
- @actor_atktime = skill.time#$data_weapons[@actor.weapon_id].time
- end
- end
- #--------------------------------------------------------------------------
- # ● 获取普通攻击伤害
- #--------------------------------------------------------------------------
- def event_damage(attk,event)
- hit_result = (rand(100) < attk.hit)
- if hit_result
- atk = [attk.atk - event.pdef / 2, 0].max
- damage = atk * (20 + attk.str) / 20
- amp = [damage.abs * 15 / 100, 1].max
- damage += rand(amp+1) + rand(amp+1) - amp
- damage = damage.abs
-
- if attk.plus_state_set.size > 0
- if rand(100) > randg(85,100)
- event.add_state(attk.plus_state_set[0])
- end
- end
-
- else
- damage = "Miss"
- end
- return damage
- end
- #--------------------------------------------------------------------------
- # ● 获取技能攻击伤害
- #--------------------------------------------------------------------------
- def event_damage_skill(user,event,skill)
- # 计算威力
- power = skill.power + user.atk * skill.atk_f / 100
- if power > 0
- power -= event.pdef * skill.pdef_f / 200
- power -= event.mdef * skill.mdef_f / 200
- power = [power, 0].max
- end
- # 计算倍率
- rate = 20
- rate += (user.str * skill.str_f / 100)
- rate += (user.dex * skill.dex_f / 100)
- rate += (user.agi * skill.agi_f / 100)
- rate += (user.int * skill.int_f / 100)
- # 计算基本伤害
- damage = power * rate / 20
- # 分散
- if skill.variance > 0 and damage.abs > 0
- amp = [damage.abs * skill.variance / 100, 1].max
- damage += rand(amp+1) + rand(amp+1) - amp
- end
- if skill.plus_state_set.size > 0
- if rand(100) > 100-rand(skill.hit)
- event.add_state(skill.plus_state_set[0])
- end
- end
- return damage
- end
- #--------------------------------------------------------------------------
- # ● 更新一下坐标
- #--------------------------------------------------------------------------
- def refresh(type)
- case type
- when 0 then @x = $game_player.x
- when 1 then @y = $game_player.y
- when 2 then @d = $game_player.direction
- end
- end
- #--------------------------------------------------------------------------
- # ● 角色显示动画#skill.animation1_id
- #--------------------------------------------------------------------------
- def show_ain(ain_id,d)
- if d
- case @d
- when 2 then $game_player.animation_id = ain_id
- when 4 then $game_player.animation_id = ain_id + 1
- when 6 then $game_player.animation_id = ain_id + 2
- when 8 then $game_player.animation_id = ain_id + 3
- end
- else
- $game_player.animation_id = ain_id
- end
- end
- end
复制代码 就这俩脚本...每次都冲突.... 提取放置物178行出错... ...好吧..我傻了
我试过把 if @event_atk[event.id] > 0
@event_atk[event.id] -= 1
end
这段注释掉.. 可惜最后还是错了..谁能帮我解决
代码框有点问题..没用.. |
评分
-
查看全部评分
|