赞 | 11 |
VIP | 94 |
好人卡 | 57 |
积分 | 39 |
经验 | 47770 |
最后登录 | 2024-11-12 |
在线时间 | 1582 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 3852
- 在线时间
- 1582 小时
- 注册时间
- 2006-5-5
- 帖子
- 2743
|
本帖最后由 步兵中尉 于 2010-9-13 10:53 编辑
楼主应该多用搜索,以前有人发过的。- #==============================================================================
- # 武器决定技能 by 沉影不器
- #------------------------------------------------------------------------------
- # 开放式RPG用
- # 每种武器都有特定的技能,必须装备该种武器才能使用
- # 角色的职业是开放性的,能够使用多种类型的武器,比如可以拿剑也可以拿枪或者弓
- # 同样的,角色能学习多种技能,比如剑技 枪技等
- # 当然也包括不受武器限制的技能,比如 盗帅冬瓜 的 犯贱 技能这类
- #------------------------------------------------------------------------------
- # 使用方法:
- # ① 数据库中设定属性,让相关联的武器和技能同时选用该属性
- # 例: 数据库中设定"剑"属性,所有剑类的武器都选此属性;所有剑类的技能都选此属性
- # 比如:[武器]玄铁重剑 钩选"剑"属性,[技能]独孤九剑 钩选"剑"属性
- # 未钩选任何武器和技能关联的属性,即是不受武器限制的技能
- # ② 复制脚本,插入到main之前
- # ③ 脚本第23行 设定武器和技能关联的属性id
- # 比如范例中,从第17号属性开始到24号属性都是武器关联技能的属性,依次填入
- # ④ 数据库中设定名为"全体化"的属性,凡带此属性的武器,其普通攻击变为攻击敌全体
- #==============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- SW_SET = [17,18,19,20,21,22,23,24] # 此处设定武器和技能关联的属性id
- #--------------------------------------------------------------------------
- def skill_can_use?(skill_id)
- if self.is_a?(Game_Actor)
- $data_weapons[0] = RPG::Weapon.new
- $data_weapons[0].element_set =[]
- sw_boolean = false # 判断武器和技能关联
- s = SW_SET & $data_skills[skill_id].element_set
- if s.empty?
- sw_boolean = true
- else
- for i in s
- if $data_weapons[self.weapon_id].element_set.include?(i)
- sw_boolean = true
- break
- end
- end
- end
- $data_weapons[0] = nil
- if sw_boolean == false
- return false
- end
- end
- if $data_skills[skill_id].sp_cost > self.sp
- return false
- end
- if dead?
- return false
- end
- if $data_skills[skill_id].atk_f == 0 and self.restriction == 1
- return false
- end
- occasion = $data_skills[skill_id].occasion
- if $game_temp.in_battle
- return (occasion == 0 or occasion == 1)
- else
- return (occasion == 0 or occasion == 2)
- end
- end
- end
- #==============================================================================
- class Window_Skill < Window_Selectable
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- for i in [email protected]
- skill = $data_skills[@actor.skills[i]]
- if skill != nil and @actor.skill_can_use?(skill.id) # 排除无法使用的技能
- @data.push(skill)
- end
- end
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- end
- #==============================================================================
- class Scene_Battle
- #--------------------------------------------------------------------------
- def scope_id
- scope = 0
- for i in 1...$data_system.elements.size
- if $data_system.elements[i] =~ /全体化/
- scope = i
- break
- end
- end
- return scope
- end
- #--------------------------------------------------------------------------
- def update_phase3_basic_command
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- phase3_prior_actor
- return
- end
- if Input.trigger?(Input::C)
- case @actor_command_window.index
- when 0 # 攻击
- $game_system.se_play($data_system.decision_se)
- @active_battler.current_action.kind = 0
- @active_battler.current_action.basic = 0
- # 开始选择敌人
- if @active_battler.weapon_id > 0 and
- $data_weapons[@active_battler.weapon_id].element_set.include?(scope_id)
- phase3_next_actor
- else
- start_enemy_select
- end
- when 1 # 特技
- $game_system.se_play($data_system.decision_se)
- @active_battler.current_action.kind = 1
- start_skill_select
- when 2 # 防御
- $game_system.se_play($data_system.decision_se)
- @active_battler.current_action.kind = 0
- @active_battler.current_action.basic = 1
- phase3_next_actor
- when 3 # 物品
- $game_system.se_play($data_system.decision_se)
- @active_battler.current_action.kind = 2
- start_item_select
- end
- return
- end
- end
- #--------------------------------------------------------------------------
- def make_basic_action_result # 改写自 随机全体化的武器装备(柳柳)
- if @active_battler.current_action.basic == 0
- @animation1_id = @active_battler.animation1_id
- @animation2_id = @active_battler.animation2_id
- if @active_battler.is_a?(Game_Enemy)
- if @active_battler.restriction == 3
- target = $game_troop.random_target_enemy
- elsif @active_battler.restriction == 2
- target = $game_party.random_target_actor
- else
- index = @active_battler.current_action.target_index
- target = $game_party.smooth_target_actor(index)
- end
- end
- if @active_battler.is_a?(Game_Actor)
- if @active_battler.restriction == 3
- target = $game_party.random_target_actor
- elsif @active_battler.restriction == 2
- target = $game_troop.random_target_enemy
- else
- # 武器带[全体化]属性时
- if @active_battler.weapon_id > 0 and
- $data_weapons[@active_battler.weapon_id].element_set.include?(scope_id)
- for enemy in $game_troop.enemies
- if enemy.exist?
- @target_battlers.push(enemy)
- end
- end
- end
- index = @active_battler.current_action.target_index
- target = $game_troop.smooth_target_enemy(index)
- end
- end
- if @target_battlers == []
- # 设置对像方的战斗者序列
- @target_battlers = [target]
- end
- for target in @target_battlers
- target.attack_effect(@active_battler)
- end
- return
- end
- if @active_battler.current_action.basic == 1
- @help_window.set_text($data_system.words.guard, 1)
- return
- end
- if @active_battler.is_a?(Game_Enemy) and
- @active_battler.current_action.basic == 2
- @help_window.set_text("逃跑", 1)
- @active_battler.escape
- return
- end
- if @active_battler.current_action.basic == 3
- $game_temp.forcing_battler = nil
- @phase4_step = 1
- return
- end
- end
- end
复制代码 |
|