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

Project1

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

[已经解决] 两个外站脚本出错,求指引

[复制链接]

Lv2.观梦者

梦石
0
星屑
719
在线时间
684 小时
注册时间
2009-5-29
帖子
461
跳转到指定楼层
1
发表于 2012-12-26 23:28:46 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
用了两个外站脚本:

第一个是被动效果:

RUBY 代码复制
  1. =begin
  2. ==============================================================================
  3.  ** FP Passive Effects
  4.  Author: Tsukihime
  5.  Date: May 31, 2012
  6. ------------------------------------------------------------------------------
  7.  ** Change log
  8.  May 31, 2012
  9.    - added some support for enemy passive states
  10.  May 20, 2012
  11.    - fixed a bug where parameter features were not being added
  12.  May 18, 2012
  13.    - Added support for "no floor damage"
  14.  May 17, 2012
  15.    - Added support for passive states
  16.    - Added support for nickname changes
  17.  May 16, 2012
  18.    - Added support for atk states
  19.    
  20.  May 14, 2012
  21.    -Initial release
  22. ------------------------------------------------------------------------------
  23.  This script adds passive effects
  24.  Currently it is used by the Select Skill system
  25.  to add passive effects to passive skills
  26.  
  27.  The general syntax for passive effects is
  28.    <fp:pe [type] [value]>
  29.    
  30.  Where type is one of
  31.    stype  (add/seal skill type)
  32.    skill  (add/seal skill)
  33.    wtype  (weapon type)
  34.    atype  (armor type)
  35.    etype  (equip type)
  36.    party  (party feature)
  37.    special (special feature)
  38.    tile   (tile feature)
  39.    state  (state ID)
  40.    
  41.  The type can also be one of the 28 parameters, like
  42.  mhp, mmp, atk, or def
  43.  
  44.  Do not use percent signs. Use multiplication if you
  45.  need percentages.
  46. ==============================================================================
  47. =end
  48. $imported = {} if $imported.nil?
  49. $imported["FP_PassiveEffects"] = true
  50. #==============================================================================
  51. # ** Extended configuration. Mainly for vocabulary. Try not to change any
  52. # contants
  53. #==============================================================================
  54. module Feature_Plus
  55.   module Passive_Effect
  56.  
  57.     # default features. Same as defined in Game_BattlerBase
  58.     FEATURE_ELEMENT_RATE  = 11              # Element Rate
  59.     FEATURE_DEBUFF_RATE   = 12              # Debuff Rate
  60.     FEATURE_STATE_RATE    = 13              # State Rate
  61.     FEATURE_STATE_RESIST  = 14              # State Resist
  62.     FEATURE_PARAM         = 21              # Parameter
  63.     FEATURE_XPARAM        = 22              # Ex-Parameter
  64.     FEATURE_SPARAM        = 23              # Sp-Parameter
  65.     FEATURE_ATK_ELEMENT   = 31              # Atk Element
  66.     FEATURE_ATK_STATE     = 32              # Atk State
  67.     FEATURE_ATK_SPEED     = 33              # Atk Speed
  68.     FEATURE_ATK_TIMES     = 34              # Atk Times+
  69.     FEATURE_STYPE_ADD     = 41              # Add Skill Type
  70.     FEATURE_STYPE_SEAL    = 42              # Disable Skill Type
  71.     FEATURE_SKILL_ADD     = 43              # Add Skill
  72.     FEATURE_SKILL_SEAL    = 44              # Disable Skill
  73.     FEATURE_EQUIP_WTYPE   = 51              # Equip Weapon
  74.     FEATURE_EQUIP_ATYPE   = 52              # Equip Armor
  75.     FEATURE_EQUIP_FIX     = 53              # Lock Equip  
  76.     FEATURE_EQUIP_SEAL    = 54              # Seal Equip
  77.     FEATURE_SLOT_TYPE     = 55              # Slot Type
  78.     FEATURE_ACTION_PLUS   = 61              # Action Times+
  79.     FEATURE_SPECIAL_FLAG  = 62              # Special Flag
  80.     FEATURE_COLLAPSE_TYPE = 63              # Collapse Effect
  81.     FEATURE_PARTY_ABILITY = 64              # Party Ability
  82.  
  83.     # Custom features
  84.     FEATURE_PARAM_BONUS   = 24 # default parameter bonus just multiplies...
  85.     FEATURE_SEAL_WTYPE    = 56
  86.     FEATURE_SEAL_ATYPE    = 57
  87.     FEATURE_PASSIVE_STATE = 105
  88.     FEATURE_NICKNAME_CHANGE = 106
  89.     FEATURE_TILE_EFFECT = 108
  90.  
  91.     Elements ={   "physical" => 0,
  92.                   "absorb"   => 1,
  93.                   "fire"     => 2,
  94.                   "ice"      => 3,
  95.                   "thunder"  => 4,
  96.                   "water"    => 5,
  97.                   "earth"    => 6,
  98.                   "wind"     => 7,
  99.                   "holy"     => 8,
  100.                   "dark"     => 9
  101.               }
  102.  
  103.     Param_List = { "mhp"    => 0,
  104.                    "mmp"    => 1,
  105.                    "atk"    => 2,
  106.                    "def"    => 3,
  107.                    "mat"    => 4,
  108.                    "mdf"    => 5,
  109.                    "agi"    => 6,
  110.                    "luk"    => 7
  111.                 }
  112.     XParam_List = {"hit"    => 0,
  113.                    "eva"    => 1,
  114.                    "cri"    => 2,
  115.                    "cev"    => 3,
  116.                    "mev"    => 4,
  117.                    "mrf"    => 5,
  118.                    "cnt"    => 6,
  119.                    "hrg"    => 7,
  120.                    "mrg"    => 8,
  121.                    "trg"    => 9
  122.                   }
  123.  
  124.     SParam_List = { "tgr"   => 0,
  125.                     "grd"   => 1,
  126.                     "rec"   => 2,
  127.                     "pha"   => 3,
  128.                     "mcr"   => 4,
  129.                     "tcr"   => 5,
  130.                     "pdr"   => 6,
  131.                     "mdr"   => 7,
  132.                     "fdr"   => 8,
  133.                     "exr"   => 9
  134.                   }
  135.  
  136.     Passive_Table =
  137.     { "enchalf"  => 0,          #half encounter rate
  138.       "encnone"  => 1,          #zero encounter rate
  139.       "noback"   => 2,          #no surprise attacks (enemy attacks first)
  140.       "preemp"   => 3,          #raise pre-emptive rate
  141.       "goldrate" => 4,          #doubles gold drop
  142.       "droprate" => 5,          #doubles item droprate
  143.  
  144.       "auto"  => 0,             # auto battle
  145.       "guard" => 1,             # always guard?
  146.       "sub"   => 2,             # substitute, not sure
  147.       "tp"    => 3,             # preserve TP
  148.  
  149.       "nodmg" => 0              # no damage from damage tiles
  150.      }
  151.  
  152.     Feature_Table =
  153.     {"+stype"  => FEATURE_STYPE_ADD,
  154.      "+skill"  => FEATURE_SKILL_ADD,
  155.      "+wtype"  => FEATURE_EQUIP_WTYPE,
  156.      "+atype"  => FEATURE_EQUIP_ATYPE,
  157.      "party"   => FEATURE_PARTY_ABILITY,
  158.      "special" => FEATURE_SPECIAL_FLAG,
  159.      "tile"    => FEATURE_TILE_EFFECT,
  160.  
  161.  
  162.      # Sealing features
  163.      "-stype" => FEATURE_STYPE_SEAL,
  164.      "-skill" => FEATURE_SKILL_SEAL,
  165.      "-etype" => FEATURE_EQUIP_SEAL
  166.     }
  167.  
  168.     # regex
  169.     Passive_Param = /<fp:pe:?\s*(\w+)\s*(.*)>/i
  170.     Passive_Feature = /<fp:pe:?\s*(\w*)\s*(\w*)\s*>/i
  171.     Passive_Nickname = /<fp:pe:?\s*title\s*(.*)>/i
  172.     Passive_Mod_Skill = /<fp:pe:?\s*skill\s*([+-])\s*(\d+)\s*>/i
  173.     Passive_Mod_Stype = /<fp:pe:?\s*stype\s*([+-])\s*(\d+)\s*>/i
  174.     Passive_Mod_Wtype = /<fp:pe:?\s*wtype\s*([+-])\s*(\d+)\s*>/i
  175.     Passive_Mod_Atype = /<fp:pe:?\s*atype\s*([+-])\s*(\d+)\s*>/i
  176.  
  177.     Passive_Atk_State = /<fp:pe:?\s*astate\s*(\d+)\s*>/i
  178.     Passive_State = /<fp:pe:?\s*state\s*(\d+)\s*>/i
  179.     Passive_Tile = /fp:pe:?\s*tile\s*(\d+)\s*>/i
  180.  
  181.     def add_param_feature(features, param, value)
  182.       list = [Param_List, XParam_List, SParam_List].select {|list| list.include?(param)}[0]
  183.       return unless list
  184.       data_id = list[param]
  185.       code = FEATURE_PARAM_BONUS if list == Param_List
  186.       code = FEATURE_XPARAM if list == XParam_List
  187.       code = FEATURE_SPARAM if list == SParam_List
  188.       return unless data_id
  189.       features << RPG::BaseItem::Feature.new(code, data_id, value)
  190.     end
  191.  
  192.     def add_op_feature(features, op, cmd)
  193.       code = Feature_Table[op << cmd]
  194.       return unless code
  195.       features << RPG::BaseItem::Feature.new(code, data_id)
  196.     end
  197.  
  198.     def add_passive_feature(features, cmd, value)
  199.       code = Feature_Table[cmd]
  200.       data_id = Passive_Table[value]
  201.       if not code
  202.         add_param_feature(features, cmd, value)
  203.       else
  204.         features << RPG::BaseItem::Feature.new(code, data_id)
  205.       end
  206.     end
  207.  
  208.     def add_passive_state(features, data_id)
  209.       code = FEATURE_PASSIVE_STATE
  210.       features << RPG::BaseItem::Feature.new(code, data_id)
  211.     end
  212.  
  213.     def add_nickname_feature(features, value)
  214.       code = FEATURE_NICKNAME_CHANGE
  215.       features << RPG::BaseItem::Feature.new(code, 0, value)
  216.     end
  217.  
  218.     def add_value_feature(features, code, data_id, value=0)
  219.       features << RPG::BaseItem::Feature.new(code, data_id, value)
  220.     end
  221.  
  222.     def add_atk_state_feature(state_id)
  223.       code = FEATURE_ATK_STATE
  224.       data_id = state_id
  225.       return unless data_id
  226.       add_feature(code, data_id, 100)
  227.     end
  228.   end
  229. end
  230.  
  231. module RPG
  232.   class BaseItem
  233.     include Feature_Plus::Passive_Effect
  234.  
  235.     alias :fp_pe_init_rpg_baseitems :initialize
  236.     def initialize
  237.       fp_pe_init_rpg_baseitems
  238.       load_notetags_passive_effects
  239.     end      
  240.  
  241.     def load_notetags_passive_effects
  242.       self.note.split(/[\r\n]+/).each do |line|
  243.         case line
  244.         when Passive_Mod_Skill
  245.         when Passive_Mod_Stype
  246.         when Passive_Mod_Wtype
  247.         when Passive_Mod_Atype
  248.           #format: [+/-, ID]
  249.           add_op_feature(@features, $1, $2.to_i)
  250.         when Passive_Atk_State
  251.           feature = add_atk_state_feature($1.to_i)
  252.           @features << feature unless feature.nil?
  253.         when Passive_State
  254.           add_passive_state(@features, $1.to_i)
  255.         when Passive_Nickname
  256.           add_nickname_feature(@features, $1)
  257.         when Passive_Feature
  258.           add_passive_feature(@features, $1.downcase, $2)
  259.         when Passive_Param
  260.           #format: [param, formula]
  261.           add_param_feature(@features, $1.downcase, $2)
  262.         end
  263.       end
  264.     end  
  265.   end
  266. end
  267.  
  268. module DataManager
  269.  
  270.   class << self
  271.     alias fp_pe_load_database load_database
  272.     alias fp_pe_init init
  273.   end
  274.  
  275.   def self.init
  276.     fp_pe_init
  277.     load_notetags_passive_effects
  278.   end
  279.  
  280.   def self.load_database
  281.     fp_pe_load_database
  282.     if $BTEST
  283.       load_notetags_passive_effects
  284.     end
  285.   end
  286.  
  287.   def self.load_notetags_passive_effects
  288.     groups = [$data_skills, $data_items, $data_weapons, $data_armors,
  289.               $data_actors, $data_classes, $data_states, $data_enemies]
  290.     for group in groups
  291.       for obj in group
  292.         next if obj.nil?
  293.         obj.load_notetags_passive_effects
  294.       end
  295.     end
  296.   end
  297. end
  298.  
  299. class Game_BattlerBase
  300.   include Feature_Plus::Passive_Effect
  301.  
  302.   alias :fp_pe_initialize_bbase :initialize
  303.   def initialize
  304.     @passive_states = []
  305.     fp_pe_initialize_bbase
  306.   end
  307.  
  308.   alias :fp_pe_refresh_bbase :refresh
  309.   def refresh
  310.     refresh_passive_states
  311.     fp_pe_refresh_bbase
  312.   end
  313.  
  314.   def refresh_passive_states
  315.     @passive_states = features_set(FEATURE_PASSIVE_STATE)
  316.     @passive_states.each do |state_id|
  317.       p state_id
  318.       add_state(state_id)
  319.     end
  320.   end
  321.  
  322.   # A special feature sum that calls eval
  323.   def eval_features_sum(code, id, a)
  324.     features_with_id(code, id).inject(0.0) {|r, ft|
  325.     r += eval(ft.value) rescue 0 }
  326.   end
  327.  
  328.   def get_passive_param(param_id)
  329.     eval_features_sum(FEATURE_PARAM_BONUS, param_id, self)
  330.   end
  331.  
  332.   def get_nickname
  333.     nicknames = features_with_id(FEATURE_NICKNAME_CHANGE, 0)
  334.     return "" if nicknames.empty?
  335.     return nicknames[0].value
  336.   end
  337. end
  338.  
  339. class Game_Battler < Game_BattlerBase
  340.   def clear_param_plus
  341.     super
  342.     @passive_params = [0] * 8
  343.   end
  344.  
  345.   def update_passive_params
  346.     8.times do |i|
  347.       @passive_params[i] = get_passive_param(i)
  348.     end
  349.   end
  350.  
  351.   def param_plus(param_id)
  352.     @passive_params[param_id] + super
  353.   end
  354. end
  355.  
  356. class Game_Actor < Game_Battler
  357.  
  358.   alias fe_actor_initialize initialize
  359.   def initialize(actor_id)
  360.     fe_actor_initialize(actor_id)
  361.     refresh
  362.   end
  363.  
  364.   alias fe_actor_refresh refresh
  365.   def refresh
  366.     update_passive_params
  367.     update_nickname
  368.     fe_actor_refresh
  369.   end
  370.  
  371.   def update_nickname
  372.     new_nick = get_nickname
  373.     @nickname = new_nick.empty? ? actor.nickname : new_nick
  374.   end
  375.  
  376.   # don't show message for passive states
  377.   def show_added_states
  378.     @result.added_state_objects.each do |state|
  379.       $game_message.add(name + state.message1) unless state.message1.empty? || @passive_states.include?(state.id)
  380.     end
  381.   end
  382.  
  383.   def no_floor_damage?
  384.     !features_with_id(FEATURE_TILE_EFFECT, 0).empty?
  385.   end
  386.  
  387.   alias fp_pe_execute_floor_damage execute_floor_damage
  388.   def execute_floor_damage
  389.     return if no_floor_damage?
  390.     fp_pe_execute_floor_damage
  391.   end
  392.  
  393.   #what limits
  394.   def param_max(param_id)
  395.     return 9999999
  396.   end
  397. end
  398.  
  399. class Game_Enemy
  400.  
  401.   alias :fp_pe_make_enemy_actions :make_actions
  402.   def make_actions
  403.     refresh_passive_states
  404.     fp_pe_make_enemy_actions
  405.   end
  406. end


第二个是技能选择:

RUBY 代码复制
  1. =begin
  2. ==============================================================================
  3.  ** Skill Select System
  4.  Author: Tsukihime
  5.  Date: Aug 7, 2012
  6. ------------------------------------------------------------------------------
  7.  ** Change log
  8.  Aug 7
  9.    -changed skill sets to store skill ID's rather than skill objects,
  10.     because the objects themselves are not the same when the game reloads
  11.  Jul 22
  12.    -fixed bug where drawing skill cost crashed
  13.    -fixed bug where skill slots were not updated upon level
  14.  May 29
  15.    -fixed bug where $import variables were not initialized
  16.  May 27
  17.    -fixed a bug where passive skill effects weren't working
  18.  May 24
  19.    -refactored code, removed unnecessary window definitions
  20.    -Initialized all RPG classes
  21.  May 18, 2012
  22.    -Added compatibility for Monster Hunter script so recruited enemies
  23.     have skillpoints and skill slots
  24.    -added skill icons
  25.  May 17, 2012
  26.    -added more "skill_conditions_met?" requirements
  27.    -added extra refresh calls when skills are assigned/unassigned
  28.    -fixed major bug where checking for free slots on the actor
  29.     was not performed correctly
  30.  May 14, 2012
  31.    -added support for skillpoint growth formulas
  32.    -separated passive effects code to another script
  33.    -fixed bug where added/removed skills were not
  34.     updated on access to battle setup sceene
  35.    -added passive support for all parameters
  36.    -added passive support for party features
  37.    -added passive support for special features
  38.    -added passive support for adding/sealing skill types
  39.    -added passive support for adding/sealing skills
  40.    -added passive support for adding weapon/armor types
  41.  May 8
  42.    -added simple passive effects for base parameters
  43.    -fixed a small bug where test battle crashes
  44.    -added option to turn off skillpoint system
  45.    -added skillpoint system
  46.    -added skillpoint cost for skills
  47.    -switched to notetags for "active" or "passive" skills
  48.    -"normal" skills do not need to be assigned by default
  49.  May 7, 2012
  50.    -initialize release
  51. ------------------------------------------------------------------------------
  52.  This script changes the default skill system by
  53.  allowing players to only select a certain number
  54.  of skills that they can bring into battle.
  55.  
  56.  In this system, there are three "selection types"
  57.  for skills
  58.  
  59.    1 - "normal" skills
  60.    2 - "active" skills
  61.    3 - "passive" skills
  62.    
  63.  To specify a select type, tag the skill with
  64.  
  65.     <select: type>
  66.    
  67.  Normal skills are the default select type for skills.
  68.  They can be used in battle as long as you have learned it
  69.    
  70.  Active skills are skills that require you to equip
  71.  in order to use in battle.
  72.  
  73.  Passive skills are skills whose effects will be activated
  74.  as long as the skill is equipped.
  75.  
  76.  The battle setup menu is accessed through the menu.
  77.  
  78.  The skills are grouped by skill type, and the equipped
  79.  skills are displayed on the left. The top window shows the
  80.  active skills, while the bottom window shows the passive
  81.  skills.
  82.  
  83.  If you have skill slots available, you can select a skill
  84.  by selecting it from the main skill list. To remove it
  85.  from the list, just select it again. Equipping a skill
  86.  requires a certain amount of skill points, and you can
  87.  only equip a skill if you have enough skill points.
  88.  
  89.  You can use the left-key or right-key move
  90.  between the battle skill lists and your main skill list.
  91.  
  92.  Selecting any of the skills in your battle skill list will
  93.  remove them from the list. While you're at the active
  94.  skill list, you can press pageup or pagedown to scroll
  95.  between the passive skill list.
  96.  
  97.  The max number of skills from either category is limited
  98.  by the max number of skills for your particular actor.
  99.  The max number of skills may grow depending on your
  100.  actor's level, specified by the amounts you write in
  101.  each actor's noteboxes.
  102.  
  103.  The syntax for this is
  104.    <max active>
  105.    1:1, 5:2, 10:3
  106.    16:4
  107.    23:5
  108.    </max active>
  109.  
  110.  The same applies for passive skills; simply replace "active"
  111.  with "passive".
  112.  
  113.  You define the skillpoint cost for each skill and the skill select type
  114.  through the Skills tab in the database.
  115.  
  116.  <select: active> - specifies the selection type
  117.  <sp: 2> - specifies the skillpoint cost
  118.  
  119.  To define the actor's skillpoint growth, you add the following
  120.  tag to the actor
  121.     <SP: level*3>
  122.     
  123.  To indicate that the amount of skillpoints received at each level
  124.  is three times the current level. You will need to use the exact
  125.  word "level" if you want to refer to the actor's level.
  126.  
  127.  In order to set up passive skills, you must tag your skills with the
  128.  appropriate passive effects defined in FP: Passive Effects script,
  129.  and then make sure that your skill is tagged as a passive select type.
  130. ==============================================================================
  131. =end
  132. $imported = {} if $imported.nil?
  133. $imported["Tsuki_SkillSelect"] = true
  134. #==============================================================================
  135. # ** Configuration
  136. #==============================================================================
  137. module Tsuki
  138.   module Battle_Skill
  139.     Command_Name = "Battle Skills"
  140.     Handler = :battle_skill
  141.     Enabled = true
  142.     Access = true
  143.  
  144.     #toggle whether skill points should be used
  145.     Use_SkillPoint_System = true
  146.     Use_SkillLimit_System = true
  147.  
  148.     # Number of skill sets you can have. Currently only one supported
  149.     Num_Skillsets = 5
  150.  
  151.     # Select type names #
  152.     # normal does not require assignment to use in battle
  153.     Normal_Name = "Normal"
  154.  
  155.     # these require assignment to use in battle
  156.     Active_Name = "Active"
  157.     Passive_Name = "Passive"
  158.  
  159.     # Number of skillpoints you can have at most
  160.     Skillpoint_Limit = 9999
  161.     Skillpoint_Growth = "level + 30"
  162.  
  163.     # The color that is used to highlight selected skills
  164.     Selected_Color = Color.new(255, 215, 0, 255)
  165.     Skillpoint_Color = Color.new(255, 128, 0, 255)
  166.  
  167.  
  168.     # skill regex
  169.     Select_Type = /<select\s*:\s*([^,]*)>/i
  170.     Skillpoint_Cost = /<sp\s*:\s*([^,]*)>/i
  171.  
  172.     # actor regex
  173.     Max_Active_On = /<(?:MAX_ACTIVE|max active)>/i
  174.     Max_Active_Off = /<\/(?:MAX_ACTIVE|max active)>/i
  175.     Max_Passive_On = /<(?:MAX_PASSIVE|max passive)>/i
  176.     Max_Passive_Off = /<\/(?:MAX_PASSIVE|max passive)>/i
  177.     Level_Value = /(\d+):\s*(\d+),*/
  178.     Skillpoint_Growth = /<SP:?\s*(.+)>/
  179.   end
  180. end
  181.  
  182. #==============================================================================
  183. # ** Rest of the script
  184. #==============================================================================
  185.  
  186. #==============================================================================
  187. # ** RPG::Skill
  188. #------------------------------------------------------------------------------
  189. #  Add skillpoint cost and selection type to Skill objects
  190. #==============================================================================
  191.  
  192. module RPG
  193.   class Skill < UsableItem
  194.     include Tsuki::Battle_Skill
  195.  
  196.     attr_accessor :select_type
  197.     attr_accessor :skillpoint_cost
  198.  
  199.     alias :th_skill_select_init_rpg_skill :initialize
  200.     def initialize
  201.       th_skill_select_init_rpg_skill
  202.       load_notetags_skill_select
  203.     end
  204.  
  205.     def skillpoint_cost
  206.       return @skillpoint_cost unless @skillpoint_cost.nil?
  207.       load_notetags_skill_select
  208.       return @skillpoint_cost
  209.     end
  210.  
  211.     def select_type
  212.       return @select_type unless @select_type.nil?
  213.       load_notetags_skill_select
  214.       return @select_type
  215.     end
  216.  
  217.     def load_notetags_skill_select
  218.       @skillpoint_cost = 0
  219.       @select_type = Normal_Name
  220.       self.note.split(/[\r\n]+/).each do |line|
  221.         case line
  222.         when Select_Type
  223.           case $1.upcase
  224.           when Active_Name.upcase
  225.             @select_type = Active_Name
  226.           when Passive_Name.upcase
  227.             @select_type = Passive_Name
  228.           end
  229.         when Skillpoint_Cost
  230.           @skillpoint_cost = $1.to_i
  231.         end
  232.       end
  233.     end  
  234.   end
  235.  
  236.   class Actor < BaseItem
  237.     include Tsuki::Battle_Skill
  238.  
  239.     attr_accessor :active_skill_levels
  240.     attr_accessor :passive_skill_levels
  241.     attr_accessor :skillpoint_growth
  242.  
  243.     alias :th_skill_select_init_rpg_actor :initialize
  244.     def initialize
  245.       th_skill_select_init_rpg_actor
  246.       load_notetags_skill_select
  247.     end
  248.  
  249.     def load_notetags_skill_select
  250.       @active_skill_levels = {}
  251.       @passive_skill_levels = {}
  252.       @skillpoint_growth = ""
  253.       self.note.split(/[\r\n]+/).each do |line|
  254.         case line
  255.         when Skillpoint_Growth
  256.           @skillpoint_growth = $1
  257.         when Max_Active_On
  258.           @max_active_on = true
  259.         when Max_Active_Off
  260.           @max_active_on = false
  261.         when Max_Passive_On
  262.           @max_passive_on = true
  263.         when Max_Active_Off
  264.           @max_passive_on = false
  265.         when Level_Value
  266.           next unless @max_active_on || @max_passive_on
  267.           line.scan(Level_Value).each do |match|
  268.             level = match[0].to_i
  269.             value = match[1].to_i
  270.             if @max_active_on
  271.               @active_skill_levels[level] = value
  272.             elsif @max_passive_on
  273.               @passive_skill_levels[level] = value
  274.             end
  275.           end
  276.         end
  277.       end
  278.     end
  279.   end
  280.  
  281.   class Enemy < BaseItem
  282.     include Tsuki::Battle_Skill
  283.  
  284.     attr_accessor :active_skill_levels
  285.     attr_accessor :passive_skill_levels
  286.     attr_accessor :skillpoint_growth
  287.  
  288.     alias :th_skill_select_init_rpg_enemy :initialize
  289.     def initialize
  290.       th_skill_select_init_rpg_enemy
  291.       load_notetags_skill_select
  292.     end
  293.  
  294.     def load_notetags_skill_select
  295.       @active_skill_levels = {}
  296.       @passive_skill_levels = {}
  297.       @skillpoint_growth = ""
  298.       self.note.split(/[\r\n]+/).each do |line|
  299.         case line
  300.         when Skillpoint_Growth
  301.           @skillpoint_growth = $1
  302.         when Max_Active_On
  303.           @max_active_on = true
  304.         when Max_Active_Off
  305.           @max_active_on = false
  306.         when Max_Passive_On
  307.           @max_passive_on = true
  308.         when Max_Active_Off
  309.           @max_passive_on = false
  310.         when Level_Value
  311.           next unless @max_active_on || @max_passive_on
  312.           line.scan(Level_Value).each do |match|
  313.             level = match[0].to_i
  314.             value = match[1].to_i
  315.             if @max_active_on
  316.               @active_skill_levels[level] = value
  317.             elsif @max_passive_on
  318.               @passive_skill_levels[level] = value
  319.             end
  320.           end
  321.         end
  322.       end
  323.     end
  324.   end
  325. end
  326.  
  327. #==============================================================================
  328. # ** DataManager
  329. #------------------------------------------------------------------------------
  330. #  Initialize custom notetags
  331. #==============================================================================
  332.  
  333. module DataManager
  334.  
  335.   class << self
  336.     alias tsuki_skill_select_load_database load_database
  337.     alias tsuki_skill_select_init init
  338.   end
  339.  
  340.   def self.init
  341.     tsuki_skill_select_init
  342.     load_notetags_skill_select
  343.   end
  344.  
  345.   def self.load_database
  346.     tsuki_skill_select_load_database
  347.     if $BTEST
  348.       load_notetags_skill_select
  349.     end
  350.   end
  351.  
  352.   def self.load_notetags_skill_select
  353.     groups = [$data_actors, $data_enemies]
  354.     for group in groups
  355.       for obj in group
  356.         next if obj.nil?
  357.         obj.load_notetags_skill_select
  358.       end
  359.     end
  360.   end
  361. end
  362.  
  363. #==============================================================================
  364. # ** Game_Skillset
  365. #------------------------------------------------------------------------------
  366. # A Skill Set object. This stores a set of skills that the actor
  367. # is currently using
  368. #==============================================================================
  369.  
  370. class Game_Skillset
  371.  
  372.   attr_reader :id
  373.   def initialize(index)
  374.     @id = index + 1
  375.     @skills = {}
  376.     setup
  377.     update_cost
  378.   end
  379.  
  380.   def setup
  381.     @skills[Tsuki::Battle_Skill::Passive_Name] = []
  382.     @skills[Tsuki::Battle_Skill::Active_Name] = []
  383.   end
  384.  
  385.   def [](type)
  386.     @skills[type] ||= []
  387.   end
  388.  
  389.   def include?(skill)
  390.     @skills[skill.select_type].include?(skill.id)
  391.   end
  392.  
  393.   def add_skill(skill)
  394.     @skills[skill.select_type] = [] if @skills[skill.select_type].nil?
  395.     @skills[skill.select_type] << skill.id
  396.     update_cost
  397.   end
  398.  
  399.   def remove_skill(skill)
  400.     index = @skills[skill.select_type].index(skill.id)
  401.     if index
  402.       @skills[skill.select_type].delete_at(index)
  403.       update_cost
  404.     end
  405.   end
  406.  
  407.   def update_skills(learned_skills)
  408.     @skills[Tsuki::Battle_Skill::Passive_Name] = @skills[Tsuki::Battle_Skill::Passive_Name].select{|skill| learned_skills.include?(skill.id)}
  409.     update_cost
  410.   end
  411.  
  412.   def passive_skills
  413.     @skills[Tsuki::Battle_Skill::Passive_Name]
  414.   end
  415.  
  416.   def active_skills
  417.     @skills[Tsuki::Battle_Skill::Active_Name]
  418.   end
  419.  
  420.   def update_cost
  421.     @total_cost = 0
  422.     skills.each do |skill|
  423.       @total_cost += skill.skillpoint_cost
  424.     end
  425.   end
  426.  
  427.   def skills
  428.     @skills.values.flatten.collect {|id| $data_skills[id]}
  429.   end
  430.  
  431.   def cost
  432.     @total_cost
  433.   end
  434.  
  435.   def size
  436.     @skills.size
  437.   end
  438. end
  439.  
  440. #==============================================================================
  441. # ** Game_Skillsets
  442. #------------------------------------------------------------------------------
  443. # This class holds a set of skills that the actor has. It manages skill sets
  444. # such as returning the current set and switching the current set
  445. #==============================================================================
  446. class Game_Skillsets
  447.  
  448.   attr_accessor :current
  449.   def initialize
  450.     @data = []
  451.     [url=home.php?mod=space&uid=94117]@current[/url] = 0
  452.     setup_skillsets
  453.   end
  454.  
  455.   def num_skillsets
  456.     Tsuki::Battle_Skill::Num_Skillsets
  457.   end
  458.  
  459.   def setup_skillsets
  460.     num_skillsets.times do |i|
  461.       @data << Game_Skillset.new(i)
  462.     end
  463.   end
  464.  
  465.   def next_skillset
  466.     @current = [@current + 1, num_skillsets - 1].min
  467.   end
  468.  
  469.   def prev_skillset
  470.     @current = [0, @current - 1].max
  471.   end
  472.  
  473.   def [](index)
  474.     @data[index]
  475.   end
  476.  
  477.   def current_skillset
  478.     @data[@current]
  479.   end
  480. end
  481.  
  482. #==============================================================================
  483. # ** Game_BattlerBase
  484. #------------------------------------------------------------------------------
  485. # Initialize skill parameter effects
  486. #==============================================================================
  487.  
  488. class Game_BattlerBase
  489.   include Tsuki::Battle_Skill
  490.  
  491.   alias tsuki_skill_select_bbase_initialize initialize
  492.   def initialize
  493.     tsuki_skill_select_bbase_initialize
  494.     @skillsets = Game_Skillsets.new
  495.   end
  496. end
  497.  
  498. #==============================================================================
  499. # ** Game_Actor
  500. #------------------------------------------------------------------------------
  501. #
  502. #==============================================================================
  503.  
  504. class Game_Actor < Game_Battler
  505.   include Tsuki::Battle_Skill
  506.  
  507.   attr_accessor :battle_skills        #list of skills for use in battle
  508.   attr_accessor :max_active_skills    #number of active skills actor can have
  509.   attr_accessor :max_passive_skills   #number of passive skills actor can have
  510.   attr_accessor :max_skillpoints
  511.   attr_accessor :current_skillpoints
  512.   attr_accessor :current_skillset
  513.  
  514.   alias tsuki_battleSkill_actor_setup setup
  515.   def setup(actor_id)
  516.     tsuki_battleSkill_actor_setup(actor_id)
  517.     @skillsets = Game_Skillsets.new
  518.     @max_active_skills = 1
  519.     @max_passive_skills = 1
  520.     @active_skill_levels = actor.active_skill_levels ? actor.active_skill_levels : {}
  521.     @passive_skill_levels = actor.passive_skill_levels ? actor.passive_skill_levels : {}
  522.     @sp_formula = actor.skillpoint_growth
  523.     @max_skillpoints = calculate_skillpoints
  524.     @current_skillpoints = @max_skillpoints
  525.     set_max_active
  526.     set_max_passive
  527.   end
  528.  
  529.   alias tsuki_skill_select_actor_features feature_objects
  530.   def feature_objects
  531.     current_skillset.passive_skills + tsuki_skill_select_actor_features
  532.   end
  533.  
  534.   def skill_conditions_met?(skill)
  535.     (skill.select_type == Normal_Name || current_skillset.active_skills.include?(skill.id)) && super
  536.   end
  537.  
  538.   def current_skillset
  539.     return unless @skillsets
  540.     @skillsets.current_skillset
  541.   end
  542.  
  543.   def set_max_active
  544.     active = 1
  545.     @active_skill_levels.each do |level, value|
  546.       active = value if [url=home.php?mod=space&uid=22147]@level[/url] >= level
  547.     end
  548.     @max_active_skills = active
  549.   end
  550.  
  551.   def set_max_passive
  552.     passive = 1
  553.     @passive_skill_levels.each do |level, value|
  554.       passive = value if @level >= level
  555.     end
  556.     @max_passive_skills = passive
  557.   end
  558.  
  559.   def gain_passive_slot
  560.     @max_passive_skills
  561.   end
  562.  
  563.   def gain_active_slot
  564.   end
  565.  
  566.   #already maxed out
  567.   def skillset_exceeded?(select_type)
  568.     case select_type
  569.     when Tsuki::Battle_Skill::Active_Name
  570.       current_skillset[select_type].size >= @max_active_skills
  571.     when Tsuki::Battle_Skill::Passive_Name
  572.       current_skillset[select_type].size >= @max_passive_skills
  573.     end
  574.   end
  575.  
  576.   def enough_skillpoints?(skill)
  577.     skill.skillpoint_cost <= @current_skillpoints
  578.   end
  579.  
  580.   #check if we can assign the skill
  581.   def can_assign?(skill)
  582.     return true unless Tsuki::Battle_Skill::Use_SkillLimit_System
  583.     return false unless skill
  584.     return false if current_skillset.skills.include?(skill)
  585.     return false if skillset_exceeded?(skill.select_type)
  586.     return false unless enough_skillpoints?(skill)
  587.     return true
  588.   end
  589.  
  590.   def assign_skill(skill)
  591.     current_skillset.add_skill(skill) if can_assign?(skill)
  592.     update_skillset
  593.     update_skillpoints
  594.     refresh
  595.   end
  596.  
  597.   def unassign_skill(skill)
  598.     current_skillset.remove_skill(skill)
  599.     update_skillset
  600.     update_skillpoints
  601.     refresh
  602.   end
  603.  
  604.   def update_skillset
  605.     current_skillset.update_skills(@skills | added_skills)
  606.   end
  607.  
  608.   def skillpoint_limit
  609.     Tsuki::Battle_Skill::Skillpoint_Limit
  610.   end
  611.  
  612.   def calculate_skillpoints(level=self.level)
  613.     [Kernel.eval(@sp_formula), 0].max rescue 0
  614.   end
  615.  
  616.   def gain_skillpoints(val)
  617.     @max_skillpoints = [[@max_skillpoints + val, skillpoint_limit].min, 0].max
  618.     update_skillpoints
  619.   end
  620.  
  621.   def lose_skillpoints(val)
  622.     gain_skillpoints(-val)
  623.   end
  624.  
  625.   def update_skillpoints   
  626.     @current_skillpoints = [@max_skillpoints - current_skillset.cost, 0].max
  627.   end
  628.  
  629.   def next_skillset
  630.     @skillsets.next_skillset
  631.     update_skillpoints
  632.   end
  633.  
  634.   def prev_skillset
  635.     @skillsets.prev_skillset
  636.     update_skillpoints
  637.   end
  638.  
  639.   def update_skill_slots
  640.     set_max_active
  641.     set_max_passive
  642.   end
  643.  
  644.   #add skillpoints when actor levels up
  645.   alias tsuki_skill_select_level_up level_up
  646.   def level_up
  647.     tsuki_skill_select_level_up
  648.     gain_skillpoints(calculate_skillpoints)
  649.     update_skill_slots
  650.   end
  651.  
  652.   #lose skillpoints when actor levels down
  653.   alias tsuki_skill_select_level_down level_down
  654.   def level_down
  655.     tsuki_skill_select_level_down
  656.     lose_skillpoints(calculate_skillpoints(self.level + 1))
  657.     update_skill_slots
  658.   end
  659. end
  660.  
  661. #==============================================================================
  662. # ** Update menu scene to add option and add some flags to game system
  663. #==============================================================================
  664.  
  665. class Game_System
  666.   attr_accessor :battleskill_disabled
  667.   attr_accessor :battleskill_noshow
  668.  
  669.   alias tsuki_skill_select_system_initialize initialize
  670.   def initialize
  671.     tsuki_skill_select_system_initialize
  672.     @battleskill_disabled = false
  673.     @battleskill_noshow = false
  674.   end
  675. end
  676.  
  677. #==============================================================================
  678. # ** Game_Interpreter
  679. #------------------------------------------------------------------------------
  680. # Convenience methods for the interpreter
  681. #==============================================================================
  682.  
  683. class Game_Interpreter
  684.  
  685.   def enable_skill_select
  686.     $game_system.battleskill_disabled = false
  687.   end
  688.  
  689.   def disable_skill_select
  690.     $game_system.battleskill_disabled = true
  691.   end
  692.  
  693.   def show_skill_select
  694.     $game_system.battleskill_noshow = false
  695.   end
  696.  
  697.   def hide_skill_select
  698.     $game_system.battleskill_noshow = true
  699.   end
  700.  
  701.   def gain_sp(index, val)
  702.     $game_party.all_members[index].gain_skillpoints(val)
  703.   end
  704.  
  705.   def lose_sp(index, val)
  706.     $game_party.all_members[index].lose_skillpoints(val)
  707.   end
  708. end
  709.  
  710. class Window_MenuCommand < Window_Command
  711.   #--------------------------------------------------------------------------
  712.   # * Add menu command to List
  713.   #--------------------------------------------------------------------------
  714.   alias tsuki_skill_select_commands add_main_commands
  715.   def add_main_commands
  716.     tsuki_skill_select_commands
  717.     if !$game_system.battleskill_noshow
  718.       add_command(Tsuki::Battle_Skill::Command_Name, Tsuki::Battle_Skill::Handler, !$game_system.battleskill_disabled)
  719.     end
  720.   end
  721. end
  722.  
  723. class Scene_Menu < Scene_MenuBase
  724.   #--------------------------------------------------------------------------
  725.   # * Add menu handler
  726.   #--------------------------------------------------------------------------
  727.   alias tsuki_skill_select_command_window create_command_window
  728.   def create_command_window
  729.     tsuki_skill_select_command_window
  730.     if !$game_system.battleskill_disabled
  731.       @command_window.set_handler(Tsuki::Battle_Skill::Handler, method(:command_personal))
  732.     end
  733.   end
  734.  
  735.   alias tsuki_skill_select_personal_ok on_personal_ok
  736.   def on_personal_ok
  737.     case @command_window.current_symbol
  738.     when Tsuki::Battle_Skill::Handler
  739.       SceneManager.call(Scene_Skill_Select)
  740.     end
  741.     tsuki_skill_select_personal_ok
  742.   end
  743. end
  744.  
  745. class Window_battleSkillHelp < Window_Base
  746.  
  747.   def initialize(x, y, width, height)
  748.     super(x, y, width, height)
  749.   end
  750.   #--------------------------------------------------------------------------
  751.   # * Set Text
  752.   #--------------------------------------------------------------------------
  753.   def set_text(text)
  754.     if text != @text
  755.       @text = text
  756.       refresh
  757.     end
  758.   end
  759.   #--------------------------------------------------------------------------
  760.   # * Clear
  761.   #--------------------------------------------------------------------------
  762.   def clear
  763.     set_text("")
  764.   end
  765.   #--------------------------------------------------------------------------
  766.   # * Set Item
  767.   #     item : Skills and items etc.
  768.   #--------------------------------------------------------------------------
  769.   def set_item(item)
  770.     set_text(item ? item.description : "")
  771.   end
  772.   #--------------------------------------------------------------------------
  773.   # * Refresh
  774.   #--------------------------------------------------------------------------
  775.   def refresh
  776.     contents.clear
  777.     draw_text_ex(4, 0, @text)
  778.   end
  779. end
  780.  
  781. #Displays actor info
  782. class Window_battleSkillStatus < Window_Base
  783.  
  784.   def initialize(x, y, width, height)
  785.     super(x, y, width, height)
  786.     [url=home.php?mod=space&uid=95897]@actor[/url] = nil
  787.   end
  788.  
  789.   def skillpoints_enabled?
  790.     Tsuki::Battle_Skill::Use_SkillPoint_System
  791.   end
  792.   #--------------------------------------------------------------------------
  793.   # * Set Actor
  794.   #--------------------------------------------------------------------------
  795.   def actor=(actor)
  796.     return if @actor == actor
  797.     @actor = actor
  798.     @actor.update_skillset
  799.     @actor.update_skillpoints
  800.     refresh
  801.     self.oy = 0
  802.   end
  803.  
  804.   def draw_skillset_number
  805.     return unless @actor
  806.     set_id = @actor.current_skillset.id
  807.     set_name = "Set %d" %set_id
  808.     text_width = text_size(set_name).width
  809.     change_color(normal_color)
  810.     draw_text(130 - text_width, 10, width, line_height, set_name)
  811.   end
  812.  
  813.   def draw_skillpoints
  814.     return unless @actor
  815.     text_width = text_size(@actor.current_skillpoints).width
  816.     change_color(Tsuki::Battle_Skill::Skillpoint_Color)
  817.     draw_text(130 - text_width, 50, width, line_height, @actor.current_skillpoints)
  818.   end
  819.   #--------------------------------------------------------------------------
  820.   # * Refresh
  821.   #--------------------------------------------------------------------------
  822.   def refresh
  823.     contents.clear
  824.     return unless @actor
  825.     draw_actor_face(@actor, 0, 0)
  826.     draw_skillpoints if skillpoints_enabled?
  827.     draw_skillset_number
  828.   end
  829. end
  830.  
  831. #==============================================================================
  832. # ** Update Window_BattleSkill to filter the skills
  833. #==============================================================================
  834. class Window_BattleSkill < Window_SkillList
  835.  
  836.   def include?(item)
  837.     item && item.stype_id == @stype_id && (item.select_type == Tsuki::Battle_Skill::Normal_Name || equipped?(item))
  838.   end
  839.  
  840.   def equipped?(item)
  841.     @actor.current_skillset.skills.include?(item) && item.select_type != Tsuki::Battle_Skill::Passive_Name
  842.   end
  843.  
  844.   def make_item_list
  845.     @data = @actor ? @actor.skills.select {|id| include?(id) } : []
  846.   end
  847. end
  848.  
  849. class Window_battleSkillCommand < Window_HorzCommand
  850.  
  851.   attr_accessor :window_width
  852.   def initialize(x, y)
  853.     @window_width = Graphics.width - x
  854.     super(x, y)
  855.     @actor = nil
  856.     update
  857.   end
  858.  
  859.   def window_width
  860.     @window_width
  861.   end
  862.  
  863.   def window_height
  864.     50
  865.   end
  866.  
  867.   def actor=(actor)
  868.     return if @actor == actor
  869.     @actor = actor
  870.     refresh
  871.   end
  872.  
  873.   #--------------------------------------------------------------------------
  874.   # * Get Digit Count
  875.   #--------------------------------------------------------------------------
  876.   def col_max
  877.     return 2
  878.   end
  879.  
  880.   #--------------------------------------------------------------------------
  881.   # * Get Number of Lines to Show
  882.   #--------------------------------------------------------------------------
  883.   def visible_line_number
  884.     return 4
  885.   end
  886.  
  887.   #--------------------------------------------------------------------------
  888.   # * Create Command List
  889.   #--------------------------------------------------------------------------
  890.   def make_command_list
  891.     return unless @actor
  892.     @actor.added_skill_types.sort.each do |stype_id|
  893.       name = $data_system.skill_types[stype_id]
  894.       add_command(name, :skill, true, stype_id)
  895.     end
  896.   end
  897.  
  898.   #--------------------------------------------------------------------------
  899.   # * Frame Update
  900.   #--------------------------------------------------------------------------
  901.   def update
  902.     super
  903.     @skill_window.stype_id = current_ext if @skill_window
  904.   end
  905.  
  906.   #--------------------------------------------------------------------------
  907.   # * Set Skill Window
  908.   #--------------------------------------------------------------------------
  909.   def skill_window=(skill_window)
  910.     @skill_window = skill_window
  911.     update
  912.   end
  913. end
  914.  
  915. #==============================================================================
  916. # ** Window_battleSkillBattleList
  917. #------------------------------------------------------------------------------
  918. # This class shows the skills that you have selected for battle. It is
  919. # the superclass for any selected skills list
  920. #==============================================================================
  921.  
  922. class Window_battleSkillSelectedList < Window_SkillList#Window_Selectable
  923.  
  924.   def filler_text
  925.     "---"
  926.   end
  927.  
  928.   def skill_limits_enabled?
  929.     Tsuki::Battle_Skill::Use_SkillLimit_System
  930.   end
  931.  
  932.   def draw_filler(rect)
  933.     draw_text(rect, filler_text)
  934.   end
  935.  
  936.   def add_fillers
  937.     (max_items - @data.size).times do |i|
  938.       @data << nil
  939.     end
  940.   end
  941.  
  942.   def col_max
  943.     1
  944.   end
  945.  
  946.   def window_width
  947.     120
  948.   end
  949.  
  950.   def include?(skill)
  951.     true
  952.   end
  953.  
  954.   def make_item_list
  955.     add_fillers if skill_limits_enabled?
  956.   end
  957.  
  958.   def draw_item(index)
  959.     id = @data[index]
  960.     rect = item_rect(index)
  961.     if id
  962.       item = $data_skills[id]
  963.       draw_icon(item.icon_index, rect.x, rect.y)
  964.       draw_skill_name(rect.x+24, rect.y, rect.width - 16, item.name)
  965.     else
  966.       draw_filler(rect)
  967.     end
  968.   end
  969.  
  970.   def draw_skill_name(x, y, width, name)
  971.     draw_text(x, y, width, line_height, name)
  972.   end
  973.  
  974.   def remove_item(item)
  975.     return unless item   
  976.     @actor.unassign_skill(item)
  977.     refresh
  978.   end
  979.  
  980.   def refresh
  981.     make_item_list
  982.     create_contents
  983.     draw_all_items
  984.   end
  985.  
  986.   def select_last
  987.     if @last_index && @data.size > 0 && @data[@last_index]
  988.       select(@last_index)
  989.     else
  990.       select(0)
  991.     end
  992.   end
  993.  
  994.   #--------------------------------------------------------------------------
  995.   # * Add additional handles to be more useful
  996.   #--------------------------------------------------------------------------
  997.   def process_handling
  998.     return unless open? && active
  999.     return process_dir4 if Input.trigger?(:LEFT) && handle?(:dir4)
  1000.     return process_dir6 if Input.trigger?(:RIGHT) && handle?(:dir6)
  1001.     return super
  1002.   end
  1003.  
  1004.   def process_dir4
  1005.     Sound.play_cursor
  1006.     Input.update
  1007.     deactivate
  1008.     call_handler(:dir4)
  1009.   end
  1010.  
  1011.   def process_dir6
  1012.     Sound.play_cursor
  1013.     Input.update
  1014.     deactivate
  1015.     call_handler(:dir6)
  1016.   end
  1017. end
  1018.  
  1019. class Window_battleSkillPassiveList < Window_battleSkillSelectedList
  1020.   #--------------------------------------------------------------------------
  1021.   # * Max number of passive skills the actor can choose
  1022.   #--------------------------------------------------------------------------
  1023.   def max_items
  1024.     @actor ? @actor.max_passive_skills : 0
  1025.   end
  1026.  
  1027.   def make_item_list
  1028.     @data = @actor ? @actor.current_skillset.passive_skills.clone : nil
  1029.     super
  1030.   end
  1031. end
  1032.  
  1033. class Window_battleSkillActiveList < Window_battleSkillSelectedList
  1034.  
  1035.   #--------------------------------------------------------------------------
  1036.   # * Max number of items you can select
  1037.   #--------------------------------------------------------------------------
  1038.   def max_items
  1039.     @actor ? @actor.max_active_skills : 0
  1040.   end
  1041.  
  1042.   def make_item_list
  1043.     @data = @actor ? @actor.current_skillset.active_skills.clone : nil
  1044.     super
  1045.   end
  1046. end
  1047.  
  1048. #==============================================================================
  1049. # ** Window_SkillList
  1050. #------------------------------------------------------------------------------
  1051. #  This window is for displaying a list of available skills on the skill window.
  1052. #==============================================================================
  1053.  
  1054. class Window_battleSkillList < Window_SkillList
  1055.  
  1056.   #--------------------------------------------------------------------------
  1057.   # * Get Skill Type ID
  1058.   #--------------------------------------------------------------------------
  1059.   def stype_id
  1060.     return @stype_id
  1061.   end
  1062.   #--------------------------------------------------------------------------
  1063.   # * Get Digit Count
  1064.   #--------------------------------------------------------------------------
  1065.   def col_max
  1066.     return 1
  1067.   end
  1068.   #--------------------------------------------------------------------------
  1069.   # * Include in Skill List?
  1070.   #--------------------------------------------------------------------------
  1071.   def include?(item)
  1072.     item && item.stype_id == @stype_id && item.select_type != normal_name
  1073.   end
  1074.  
  1075.   def normal_name
  1076.     Tsuki::Battle_Skill::Normal_Name
  1077.   end
  1078.  
  1079.   def skillpoint_cost_color
  1080.     Tsuki::Battle_Skill::Skillpoint_Color
  1081.   end
  1082.  
  1083.   def current_item_enabled?
  1084.     true
  1085.   end
  1086.  
  1087.   #--------------------------------------------------------------------------
  1088.   # * In actor's current skill?
  1089.   #--------------------------------------------------------------------------  
  1090.   def selected?(item)
  1091.     @actor.current_skillset.include?(item)
  1092.   end
  1093.  
  1094.   def selected_color
  1095.     Tsuki::Battle_Skill::Selected_Color
  1096.   end
  1097.  
  1098.   #--------------------------------------------------------------------------
  1099.   # * Create Skill List
  1100.   #--------------------------------------------------------------------------
  1101.   def make_item_list
  1102.     @data = @actor ? @actor.skills.select {|skill| include?(skill) } : []
  1103.   end
  1104.  
  1105.   def skillpoints_enabled?
  1106.     Tsuki::Battle_Skill::Use_SkillPoint_System
  1107.   end
  1108.   #--------------------------------------------------------------------------
  1109.   # * Draw Item
  1110.   #--------------------------------------------------------------------------
  1111.   def draw_item(index)
  1112.     skill = @data[index]
  1113.     if skill
  1114.       rect = item_rect(index)
  1115.       rect.width -= 4
  1116.  
  1117.       if selected?(skill)
  1118.         can_assign = true
  1119.         change_color(selected_color)
  1120.       else
  1121.         can_assign = @actor.can_assign?(skill)
  1122.         change_color(normal_color, can_assign)
  1123.       end
  1124.       draw_icon(skill.icon_index, rect.x, rect.y)
  1125.       draw_text(rect.x + 32, rect.y, width, line_height, skill.name)
  1126.  
  1127.       if skillpoints_enabled?
  1128.         draw_skillpoint_cost(rect, skill, can_assign)
  1129.       else
  1130.         draw_skill_cost(rect, skill)
  1131.       end
  1132.     end
  1133.   end
  1134.   #--------------------------------------------------------------------------
  1135.   # * Draw Skillpoint Use Cost
  1136.   #--------------------------------------------------------------------------
  1137.   def draw_skillpoint_cost(rect, skill, can_assign)
  1138.     change_color(skillpoint_cost_color, can_assign)
  1139.     draw_text(rect, skill.skillpoint_cost, 2)
  1140.   end
  1141.   #--------------------------------------------------------------------------
  1142.   # * Restore Previous Selection Position
  1143.   #--------------------------------------------------------------------------
  1144.   def select_last
  1145.     if @last_index && @data.size > 0 && @data[@last_index]
  1146.       select(@last_index)
  1147.     else
  1148.       select(0)
  1149.     end
  1150.   end
  1151.  
  1152.   def can_add?(item)
  1153.     @actor.can_assign?(item)
  1154.   end
  1155.  
  1156.   #--------------------------------------------------------------------------
  1157.   # * Rather than give an error when adding a duplicate item, we remove
  1158.   # if from the list instead
  1159.   #--------------------------------------------------------------------------
  1160.   def add_item(item)
  1161.     if can_add?(item)
  1162.       @actor.assign_skill(item)
  1163.     elsif selected?(item)
  1164.       remove_item(item)
  1165.       return
  1166.     else
  1167.       Sound.play_buzzer
  1168.     end
  1169.     refresh
  1170.   end
  1171.  
  1172.   def remove_item(item)
  1173.     return unless item
  1174.     @actor.unassign_skill(item)
  1175.     refresh
  1176.   end
  1177.  
  1178.   def process_handling
  1179.     return unless open? && active
  1180.     return process_dir4 if Input.trigger?(:LEFT) && handle?(:dir4)
  1181.     return process_dir6 if Input.trigger?(:RIGHT) && handle?(:dir6)
  1182.     return super
  1183.   end
  1184.  
  1185.   def process_dir4
  1186.     Sound.play_cursor
  1187.     Input.update
  1188.     deactivate
  1189.     call_handler(:dir4)
  1190.   end
  1191.  
  1192.   def process_dir6
  1193.     Sound.play_cursor
  1194.     Input.update
  1195.     deactivate
  1196.     call_handler(:dir6)
  1197.   end
  1198. end
  1199.  
  1200. #==============================================================================
  1201. # ** Battle Skill scene
  1202. #==============================================================================
  1203.  
  1204. class Scene_Skill_Select < Scene_MenuBase
  1205.  
  1206.   def start
  1207.     super
  1208.     create_all_windows
  1209.     @category_window.activate
  1210.   end
  1211.  
  1212.   def create_all_windows
  1213.     create_actor_window
  1214.     create_help_window
  1215.     create_category_window
  1216.     create_active_skills_window
  1217.     create_passive_skills_window
  1218.     create_skills_window
  1219.   end
  1220.  
  1221.   #draw actor in the top-left corner
  1222.   def create_actor_window
  1223.     @actor_window = Window_battleSkillStatus.new(0,0, 160, 100)
  1224.     @actor_window.actor = @actor
  1225.   end
  1226.  
  1227.   #draw help window to the right of actor window
  1228.   def create_help_window
  1229.     wx = @actor_window.width
  1230.     @help_window = Window_battleSkillHelp.new(wx, 0, Graphics.width - wx, 100)
  1231.     @help_window.viewport = @viewport
  1232.   end
  1233.  
  1234.   #draw category window under the help window
  1235.   def create_category_window
  1236.     wx = @help_window.x
  1237.     wy = @help_window.height
  1238.     @category_window = Window_battleSkillCommand.new(wx, wy)
  1239.     @category_window.viewport = @viewport
  1240.     @category_window.help_window = @help_window
  1241.     @category_window.actor = @actor
  1242.     @category_window.set_handler(:skill,    method(:command_skill))
  1243.     @category_window.set_handler(:cancel,   method(:return_scene))
  1244.     @category_window.set_handler(:pagedown, method(:next_actor))
  1245.     @category_window.set_handler(:pageup,   method(:prev_actor))
  1246.   end
  1247.  
  1248.   #draw passive skills window under actor window
  1249.   def create_active_skills_window
  1250.     wx = @actor_window.x
  1251.     wy = @actor_window.height
  1252.     width = @actor_window.width
  1253.     @askill_window = Window_battleSkillActiveList.new(wx, wy, width, 200)
  1254.     @askill_window.viewport = @viewport
  1255.     @askill_window.help_window = @help_window
  1256.     @askill_window.actor = @actor
  1257.     @askill_window.set_handler(:ok,       method(:on_askill_ok))
  1258.     @askill_window.set_handler(:cancel,   method(:on_askill_cancel))
  1259.     @askill_window.set_handler(:pagedown,   method(:activate_pskill_window))
  1260.     @askill_window.set_handler(:pageup,   method(:activate_pskill_window))
  1261.     @askill_window.set_handler(:dir4,   method(:activate_skills_window))
  1262.     @askill_window.set_handler(:dir6,   method(:activate_skills_window))
  1263.   end
  1264.  
  1265.   #draw active skills window under passive skills
  1266.   def create_passive_skills_window
  1267.     wx = @askill_window.x
  1268.     wy = @askill_window.y + @askill_window.height
  1269.     width = @askill_window.width
  1270.     height = Graphics.height - wy
  1271.     @pskill_window = Window_battleSkillPassiveList.new(wx, wy, width, height)
  1272.     @pskill_window.viewport = @viewport
  1273.     @pskill_window.help_window = @help_window
  1274.     @pskill_window.actor = @actor
  1275.     @pskill_window.set_handler(:ok,       method(:on_pskill_ok))
  1276.     @pskill_window.set_handler(:cancel,   method(:on_pskill_cancel))
  1277.     @pskill_window.set_handler(:pagedown,   method(:activate_askill_window))
  1278.     @pskill_window.set_handler(:pageup,   method(:activate_askill_window))
  1279.     @pskill_window.set_handler(:dir4,   method(:activate_skills_window))
  1280.     @pskill_window.set_handler(:dir6,   method(:activate_skills_window))
  1281.   end
  1282.   #--------------------------------------------------------------------------
  1283.   # * Displays all the items available to choose from
  1284.   #--------------------------------------------------------------------------
  1285.   def create_skills_window
  1286.     wx = @category_window.x
  1287.     wy = @category_window.y + @category_window.height
  1288.     width = @category_window.width
  1289.     height = Graphics.height - wy
  1290.     @skills_window = Window_battleSkillList.new(wx, wy, width, height)
  1291.     @skills_window.help_window = @help_window
  1292.     @skills_window.actor = @actor
  1293.     @skills_window.set_handler(:ok,     method(:on_skills_ok))
  1294.     @skills_window.set_handler(:cancel, method(:on_skills_cancel))
  1295.     @skills_window.set_handler(:pageup,   method(:next_skillset))
  1296.     @skills_window.set_handler(:pagedown,   method(:prev_skillset))
  1297.     @skills_window.set_handler(:dir4,   method(:activate_askill_window))
  1298.     @skills_window.set_handler(:dir6,   method(:activate_askill_window))
  1299.     @category_window.skill_window = @skills_window
  1300.     update_selected_skills
  1301.   end
  1302.  
  1303.   def skill
  1304.     @skills_window.item
  1305.   end
  1306.  
  1307.   def next_skillset
  1308.     @actor.next_skillset
  1309.     update_selected_skills
  1310.     activate_skills_window
  1311.   end
  1312.  
  1313.   def prev_skillset
  1314.     @actor.prev_skillset
  1315.     update_selected_skills
  1316.     activate_skills_window
  1317.   end
  1318.  
  1319.   def activate_askill_window
  1320.     @skills_window.unselect
  1321.     @pskill_window.unselect
  1322.     @askill_window.activate
  1323.     @askill_window.select(0)
  1324. #~     @askill_window.select_last
  1325.   end
  1326.  
  1327.   def activate_pskill_window
  1328.     @skills_window.unselect
  1329.     @askill_window.unselect
  1330.     @pskill_window.activate
  1331.     @pskill_window.select(0)
  1332. #~     @pskill_window.select_last
  1333.   end
  1334.  
  1335.   def activate_skills_window
  1336.     @pskill_window.unselect
  1337.     @askill_window.unselect
  1338.     #@skills_window.select_last
  1339.     @skills_window.activate
  1340.   end
  1341.  
  1342.   def activate_category_window
  1343.     @askill_window.unselect
  1344.     @pskill_window.unselect
  1345.     @skills_window.unselect
  1346.     @category_window.activate
  1347.   end
  1348.  
  1349.   def command_skill
  1350.     @skills_window.activate
  1351.     @skills_window.select_last
  1352.   end
  1353.  
  1354.   def on_skills_ok
  1355.     determine_skill
  1356.     update_selected_skills
  1357.     activate_skills_window
  1358.   end
  1359.  
  1360.   def on_skills_cancel
  1361.     activate_category_window
  1362.   end
  1363.  
  1364.   def on_askill_ok
  1365.     @askill_window.remove_item(@askill_window.item)
  1366.     update_selected_skills
  1367.     activate_askill_window
  1368.   end
  1369.  
  1370.   def on_askill_cancel
  1371.     activate_category_window
  1372.   end
  1373.  
  1374.   def on_pskill_ok
  1375.     @pskill_window.remove_item(@pskill_window.item)
  1376.     update_selected_skills
  1377.     activate_pskill_window
  1378.   end
  1379.  
  1380.   def on_pskill_cancel
  1381.     activate_category_window
  1382.   end
  1383.  
  1384.   def determine_skill
  1385.     @skills_window.add_item(skill)
  1386.     update_selected_skills
  1387.     activate_skills_window
  1388.   end
  1389.  
  1390.   def on_actor_change
  1391.     @actor_window.actor = @actor
  1392.     @category_window.actor = @actor
  1393.     @skills_window.actor = @actor
  1394.     @askill_window.actor = @actor
  1395.     @pskill_window.actor = @actor
  1396.     @category_window.activate
  1397.   end
  1398.  
  1399.   def update_selected_skills
  1400.     @askill_window.refresh
  1401.     @pskill_window.refresh
  1402.     @actor_window.refresh
  1403.     @skills_window.refresh
  1404.   end
  1405. end
  1406.  
  1407. if $imported["Tsuki_MonsterHunter"]
  1408.   module Monster_Hunter
  1409.  
  1410.     class << self
  1411.       alias skill_select_setup_extra setup_extra
  1412.     end
  1413.  
  1414.     def self.setup_extra(actor, enemy)
  1415.       skill_select_setup_extra(actor, enemy)
  1416.       actor.skillpoint_growth = enemy.skillpoint_growth
  1417.       actor.passive_skill_levels = enemy.passive_skill_levels
  1418.       actor.active_skill_levels = enemy.active_skill_levels
  1419.     end
  1420.   end
  1421. end


然后,如果在第N号技能设置了标签:<select: passive> 和 <fp:pe mhp 200> 选择该技能装备的时候会提示错误:

BattlerBase 197行 找不到方法,没有为第N号技能定义"features"

出错语句是这一句:
  #--------------------------------------------------------------------------
  # ● 获取所有特性实例的数组
  #--------------------------------------------------------------------------
  def all_features
    feature_objects.inject([]) {|r, obj| r + obj.features }
  end

求指点……

Lv1.梦旅人

梦石
0
星屑
50
在线时间
616 小时
注册时间
2010-10-29
帖子
463
2
发表于 2012-12-27 08:58:40 | 只看该作者
首先,你也许应该报告的问题,tsukihime的博客。你也可以问这个问题RGSS3 script support在rmva.net论坛中。 第二个脚本有一个DEMO,这可能会帮助。

我不知道你做错了什么。你应该张贴技能的截图,你的2个脚本的位置。

如果你想的话,我可以帮你。

一直在等待有人知道如何使用tsukihime的脚本!
我命令你给我点下面的东西!

LBQ Works
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
687 小时
注册时间
2012-10-29
帖子
1543
3
发表于 2012-12-27 10:27:01 | 只看该作者
本帖最后由 j433463 于 2012-12-27 10:28 编辑

被动技能:

用法

要添加一个被动的效果,只需标记notebox :

<fp:pe [option] [value]>

例如:

<fp:pe skill 2> #允许你使用技能2
<fp:pe wtype 4> #允许装备武器类型 4
<fp:pe mhp 10> #增加最大HP 10

您可以使用复杂的公式在统计增加/减少 :

<fp:pe [stat] [formula]>

<fp:pe mat mat*0.1> #10%增加魔法攻击
<fp:pe atk a.level*20 + 400> #根据你的等级水平增加

需要注意的是,如果你要访问角色属性,你必须使用关键字 “a” 和确切的属性名。

访问您公式中一个角色的 def 的唯一方法是在公式中使用 “a.def”

此外,虽然是一样的东西,避免递回公式:

atk = atk * 5

重要提示:不要使用百分比符号。如果你需要用到百分比只能使用小数乘法来做。

例如:20%的攻击力

<fp:pe atk atk*0.2>

技能选择系统:

介绍

此系统扩展默认技能系统,通过限制角色只能选择一些他们可以携带战斗的技能,限制仅限于战斗方面的,您可以使用任何您想要的战斗之外技能。

有两种类型的选择技能:
主动
被动

实际上,只要它们都配置了,你使用主动的技能时是有效的,而被动技能则是不断在影响着。

被动效果影响目前没有实现,你唯一可以做的是装备它们,并且什么也不能做。

特点:

- 技能选择设置
- 主动/被动技能是可选的,正常的技能可以在战斗中被默认为被动技能效果:激活时,被动技能装备。
- 多种技能选择,更容易设定你的角色,而不是重新装备你的所有技能,视情况而定,这消极被动影响可以改变所有参数,状态的改变和特殊效果。

注意:在使用被动技能效果,你必须有 "FP Passive Effects" 脚本提供的被动消极影响功能。

用法

将脚本复制。
如果必要进行一些配置的改变设定

对于每一个技能需要的技能选择,你必须添加在notebox

<select: type>
<sp: 20>

其中,type是一个不带引号的“被动”或“主动”。
SP指定技能点的该技能使用成本,是可选的。

在每个角色的notebox,使用下面的语法,你可以设置增长等级水平的最大数量的主动或被动技能

   <max active>
   1:1, 5:2, 10:3
   16:4
   23:5
   </max active>

其中每一对值,表示等级水平和 max_skills,您可以应用,这同样适用于被动技能,除了它的 "max passive".

您可以指定多少数量的技能点数开始,以及每一等级水平技能点的数量。

<SP: (level * 3) + 23>

注意,这 "SP" 必须在最前面,而 "level" 必须为小写。

被动技能效果影响是消极性的,如果你使用了这脚本的选项,否则他们基本上什么都不做。

更多的说明在脚本的最上方。


==============================================================
好在我之前曾经见过并且翻译过这个脚本的官方使用说明,贴出给你参考,但我是被加粗的那一句:被动技能效果实际没有作用吓到,就没去尝试了。

虽然没有真的试过,从该站的使用说明来看,似乎是您没有做好对您选择的技能特点功能设置,怎么设置,是脚本还是数据库我就不知道了。

评分

参与人数 1星屑 +100 收起 理由
Mic_洛洛 + 100 精品文章

查看全部评分

修改劇本中,仔細審查原來的劇情大綱,覺得有點不太滿意,嘗試編寫不同主角不同主線的劇情,希望能寫得出來。
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-15 02:44

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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