设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1584|回复: 2
打印 上一主题 下一主题

[已经解决] RTAB魔法反射特效如何实现随机目标?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
60
在线时间
568 小时
注册时间
2012-9-7
帖子
611
1
发表于 2012-11-24 13:31:13 | 显示全部楼层
本帖最后由 wingzeroplus 于 2012-11-24 13:44 编辑
  1. #=============================================================================
  2. # ◇ 「魔法反射」ステート by 桜雅 在土
  3. #=============================================================================
  4. class Scene_Battle
  5.   #--------------------------------------------------------------------------
  6.   # ● スキルまたはアイテムの対象側バトラー設定
  7.   #--------------------------------------------------------------------------
  8.   alias xrxs_magic_refrex_set_target_battlers set_target_battlers
  9.   def set_target_battlers(scope,battler)
  10.     xrxs_magic_refrex_set_target_battlers(scope,battler)
  11.     # スキル使用時
  12.     if battler.current_action.kind == 1
  13.       # 魔法である場合
  14.       if skill_is_a_magic?(@skill)
  15.         element_id = get_refrex_penetration_id
  16.         # スキルに反射貫通が付加されているか。
  17.         skill_state_penetration(@skill, element_id, battler)
  18.         if battler.penetration != true
  19.           # 検索
  20.           for target in battler.target.dup
  21.             # 魔法反射ステートにかかっているか?
  22.             state_id = get_magical_refrex_id
  23.             if state_id != nil and target.state?(state_id)
  24.               # 反射---
  25.               target.refrexed = true
  26.               battler.target.delete(target)
  27. ################################
  28.              if battler.is_a?(Game_Enemy)
  29.                if @skill.scope==1
  30.                for enemy in $game_troop.enemies
  31.                  if enemy.exist?
  32.                   battler.target = [$game_troop.random_target_enemy]
  33.                  battler.target -=[battler] if battler.current_action.self_exclusion
  34.             battler.target = [battler.target[rand(battler.target.size)]]
  35.                 end
  36.                end
  37.                elsif @skill.scope==3 or @skill.scope==5
  38.                for actor in $game_party.actors
  39.                  if actor.exist?
  40.                    battler.target.push(actor)
  41.                    battler.target -=[battler] if battler.current_action.self_exclusion
  42.            battler.target = [battler.target[rand(battler.target.size)]]
  43.                 end
  44.                end
  45.                end
  46.              end
  47.             
  48.             if battler.is_a?(Game_Actor)
  49.               if @skill.scope==3 or @skill.scope==5
  50.                  for enemy in $game_troop.enemies
  51.                  if enemy.exist?
  52.                   battler.target = [$game_troop.random_target_enemy]
  53.                   battler.target -=[battler] if battler.current_action.self_exclusion
  54.         battler.target = [battler.target[rand(battler.target.size)]]
  55.                  end
  56.                 end
  57.               elsif @skill.scope==1
  58.                 for actor in $game_party.actors
  59.                  if actor.exist?
  60.                    battler.target.push(actor)
  61.                    battler.target -=[battler] if battler.current_action.self_exclusion
  62.            battler.target = [battler.target[rand(battler.target.size)]]
  63.                  end
  64.                 end
  65.               end
  66.             end
  67. #####################################           
  68.               # ---反射の設定完了
  69.             end
  70.           end
  71.         end
  72.       end
  73.     end
  74.   end
复制代码
把中间##那段替换相应的位置就可以
不过我把反射的定义改了,单体才能反射,全体魔法不能反射,下面是我自己改的定义
  def skill_is_a_magic?(skill)
    return false unless skill.is_a?(RPG::Skill)
   return (skill.atk_f ==0 and (skill.scope==1 or skill.scope==3 or skill.scope==5))  
end
end
LZ对何种技能才能反射的定义需要如何改的话,自己看着办吧,我只提供随机反射的效果

评分

参与人数 1梦石 +1 收起 理由
hcm + 1 认可答案

查看全部评分

FTM正式版已经发布,点击图片开启传送门
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-9 19:10

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表