查看: 1727|回复: 2

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

[复制链接]
梦石
0
星屑
724
在线时间
685 小时
注册时间
2009-5-29
回帖
332
发表于 2012-12-26 23:28:46 | 显示全部楼层 |阅读模式

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

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

×
用了两个外站脚本:

第一个是被动效果:

  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. The general syntax for passive effects is
  27.    <fp:pe [type] [value]>
  28.    
  29. Where type is one of
  30.    stype  (add/seal skill type)
  31.    skill  (add/seal skill)
  32.    wtype  (weapon type)
  33.    atype  (armor type)
  34.    etype  (equip type)
  35.    party  (party feature)
  36.    special (special feature)
  37.    tile   (tile feature)
  38.    state  (state ID)
  39.    
  40. The type can also be one of the 28 parameters, like
  41. mhp, mmp, atk, or def

  42. Do not use percent signs. Use multiplication if you
  43. need percentages.
  44. ==============================================================================
  45. =end
  46. $imported = {} if $imported.nil?
  47. $imported["FP_PassiveEffects"] = true
  48. #==============================================================================
  49. # ** Extended configuration. Mainly for vocabulary. Try not to change any
  50. # contants
  51. #==============================================================================
  52. module Feature_Plus
  53.   module Passive_Effect
  54.   
  55.     # default features. Same as defined in Game_BattlerBase
  56.     FEATURE_ELEMENT_RATE  = 11              # Element Rate
  57.     FEATURE_DEBUFF_RATE   = 12              # Debuff Rate
  58.     FEATURE_STATE_RATE    = 13              # State Rate
  59.     FEATURE_STATE_RESIST  = 14              # State Resist
  60.     FEATURE_PARAM         = 21              # Parameter
  61.     FEATURE_XPARAM        = 22              # Ex-Parameter
  62.     FEATURE_SPARAM        = 23              # Sp-Parameter
  63.     FEATURE_ATK_ELEMENT   = 31              # Atk Element
  64.     FEATURE_ATK_STATE     = 32              # Atk State
  65.     FEATURE_ATK_SPEED     = 33              # Atk Speed
  66.     FEATURE_ATK_TIMES     = 34              # Atk Times+
  67.     FEATURE_STYPE_ADD     = 41              # Add Skill Type
  68.     FEATURE_STYPE_SEAL    = 42              # Disable Skill Type
  69.     FEATURE_SKILL_ADD     = 43              # Add Skill
  70.     FEATURE_SKILL_SEAL    = 44              # Disable Skill
  71.     FEATURE_EQUIP_WTYPE   = 51              # Equip Weapon
  72.     FEATURE_EQUIP_ATYPE   = 52              # Equip Armor
  73.     FEATURE_EQUIP_FIX     = 53              # Lock Equip  
  74.     FEATURE_EQUIP_SEAL    = 54              # Seal Equip
  75.     FEATURE_SLOT_TYPE     = 55              # Slot Type
  76.     FEATURE_ACTION_PLUS   = 61              # Action Times+
  77.     FEATURE_SPECIAL_FLAG  = 62              # Special Flag
  78.     FEATURE_COLLAPSE_TYPE = 63              # Collapse Effect
  79.     FEATURE_PARTY_ABILITY = 64              # Party Ability
  80.    
  81.     # Custom features
  82.     FEATURE_PARAM_BONUS   = 24 # default parameter bonus just multiplies...
  83.     FEATURE_SEAL_WTYPE    = 56
  84.     FEATURE_SEAL_ATYPE    = 57
  85.     FEATURE_PASSIVE_STATE = 105
  86.     FEATURE_NICKNAME_CHANGE = 106
  87.     FEATURE_TILE_EFFECT = 108
  88.    
  89.     Elements ={   "physical" => 0,
  90.                   "absorb"   => 1,
  91.                   "fire"     => 2,
  92.                   "ice"      => 3,
  93.                   "thunder"  => 4,
  94.                   "water"    => 5,
  95.                   "earth"    => 6,
  96.                   "wind"     => 7,
  97.                   "holy"     => 8,
  98.                   "dark"     => 9
  99.               }
  100.   
  101.     Param_List = { "mhp"    => 0,
  102.                    "mmp"    => 1,
  103.                    "atk"    => 2,
  104.                    "def"    => 3,
  105.                    "mat"    => 4,
  106.                    "mdf"    => 5,
  107.                    "agi"    => 6,
  108.                    "luk"    => 7
  109.                 }
  110.     XParam_List = {"hit"    => 0,
  111.                    "eva"    => 1,
  112.                    "cri"    => 2,
  113.                    "cev"    => 3,
  114.                    "mev"    => 4,
  115.                    "mrf"    => 5,
  116.                    "cnt"    => 6,
  117.                    "hrg"    => 7,
  118.                    "mrg"    => 8,
  119.                    "trg"    => 9
  120.                   }
  121.                   
  122.     SParam_List = { "tgr"   => 0,
  123.                     "grd"   => 1,
  124.                     "rec"   => 2,
  125.                     "pha"   => 3,
  126.                     "mcr"   => 4,
  127.                     "tcr"   => 5,
  128.                     "pdr"   => 6,
  129.                     "mdr"   => 7,
  130.                     "fdr"   => 8,
  131.                     "exr"   => 9
  132.                   }
  133.                   
  134.     Passive_Table =
  135.     { "enchalf"  => 0,          #half encounter rate
  136.       "encnone"  => 1,          #zero encounter rate
  137.       "noback"   => 2,          #no surprise attacks (enemy attacks first)
  138.       "preemp"   => 3,          #raise pre-emptive rate
  139.       "goldrate" => 4,          #doubles gold drop
  140.       "droprate" => 5,          #doubles item droprate
  141.                      
  142.       "auto"  => 0,             # auto battle
  143.       "guard" => 1,             # always guard?
  144.       "sub"   => 2,             # substitute, not sure
  145.       "tp"    => 3,             # preserve TP
  146.       
  147.       "nodmg" => 0              # no damage from damage tiles
  148.      }
  149.                   
  150.     Feature_Table =
  151.     {"+stype"  => FEATURE_STYPE_ADD,
  152.      "+skill"  => FEATURE_SKILL_ADD,
  153.      "+wtype"  => FEATURE_EQUIP_WTYPE,
  154.      "+atype"  => FEATURE_EQUIP_ATYPE,
  155.      "party"   => FEATURE_PARTY_ABILITY,
  156.      "special" => FEATURE_SPECIAL_FLAG,
  157.      "tile"    => FEATURE_TILE_EFFECT,
  158.      
  159.      
  160.      # Sealing features
  161.      "-stype" => FEATURE_STYPE_SEAL,
  162.      "-skill" => FEATURE_SKILL_SEAL,
  163.      "-etype" => FEATURE_EQUIP_SEAL
  164.     }
  165.      
  166.     # regex
  167.     Passive_Param = /<fp:pe:?\s*(\w+)\s*(.*)>/i
  168.     Passive_Feature = /<fp:pe:?\s*(\w*)\s*(\w*)\s*>/i
  169.     Passive_Nickname = /<fp:pe:?\s*title\s*(.*)>/i
  170.     Passive_Mod_Skill = /<fp:pe:?\s*skill\s*([+-])\s*(\d+)\s*>/i
  171.     Passive_Mod_Stype = /<fp:pe:?\s*stype\s*([+-])\s*(\d+)\s*>/i
  172.     Passive_Mod_Wtype = /<fp:pe:?\s*wtype\s*([+-])\s*(\d+)\s*>/i
  173.     Passive_Mod_Atype = /<fp:pe:?\s*atype\s*([+-])\s*(\d+)\s*>/i
  174.    
  175.     Passive_Atk_State = /<fp:pe:?\s*astate\s*(\d+)\s*>/i
  176.     Passive_State = /<fp:pe:?\s*state\s*(\d+)\s*>/i
  177.     Passive_Tile = /fp:pe:?\s*tile\s*(\d+)\s*>/i
  178.      
  179.     def add_param_feature(features, param, value)
  180.       list = [Param_List, XParam_List, SParam_List].select {|list| list.include?(param)}[0]
  181.       return unless list
  182.       data_id = list[param]
  183.       code = FEATURE_PARAM_BONUS if list == Param_List
  184.       code = FEATURE_XPARAM if list == XParam_List
  185.       code = FEATURE_SPARAM if list == SParam_List
  186.       return unless data_id
  187.       features << RPG::BaseItem::Feature.new(code, data_id, value)
  188.     end
  189.    
  190.     def add_op_feature(features, op, cmd)
  191.       code = Feature_Table[op << cmd]
  192.       return unless code
  193.       features << RPG::BaseItem::Feature.new(code, data_id)
  194.     end
  195.    
  196.     def add_passive_feature(features, cmd, value)
  197.       code = Feature_Table[cmd]
  198.       data_id = Passive_Table[value]
  199.       if not code
  200.         add_param_feature(features, cmd, value)
  201.       else
  202.         features << RPG::BaseItem::Feature.new(code, data_id)
  203.       end
  204.     end
  205.    
  206.     def add_passive_state(features, data_id)
  207.       code = FEATURE_PASSIVE_STATE
  208.       features << RPG::BaseItem::Feature.new(code, data_id)
  209.     end
  210.    
  211.     def add_nickname_feature(features, value)
  212.       code = FEATURE_NICKNAME_CHANGE
  213.       features << RPG::BaseItem::Feature.new(code, 0, value)
  214.     end
  215.    
  216.     def add_value_feature(features, code, data_id, value=0)
  217.       features << RPG::BaseItem::Feature.new(code, data_id, value)
  218.     end
  219.    
  220.     def add_atk_state_feature(state_id)
  221.       code = FEATURE_ATK_STATE
  222.       data_id = state_id
  223.       return unless data_id
  224.       add_feature(code, data_id, 100)
  225.     end
  226.   end
  227. end

  228. module RPG
  229.   class BaseItem
  230.     include Feature_Plus::Passive_Effect
  231.    
  232.     alias :fp_pe_init_rpg_baseitems :initialize
  233.     def initialize
  234.       fp_pe_init_rpg_baseitems
  235.       load_notetags_passive_effects
  236.     end      
  237.    
  238.     def load_notetags_passive_effects
  239.       self.note.split(/[\r\n]+/).each do |line|
  240.         case line
  241.         when Passive_Mod_Skill
  242.         when Passive_Mod_Stype
  243.         when Passive_Mod_Wtype
  244.         when Passive_Mod_Atype
  245.           #format: [+/-, ID]
  246.           add_op_feature(@features, $1, $2.to_i)
  247.         when Passive_Atk_State
  248.           feature = add_atk_state_feature($1.to_i)
  249.           @features << feature unless feature.nil?
  250.         when Passive_State
  251.           add_passive_state(@features, $1.to_i)
  252.         when Passive_Nickname
  253.           add_nickname_feature(@features, $1)
  254.         when Passive_Feature
  255.           add_passive_feature(@features, $1.downcase, $2)
  256.         when Passive_Param
  257.           #format: [param, formula]
  258.           add_param_feature(@features, $1.downcase, $2)
  259.         end
  260.       end
  261.     end  
  262.   end
  263. end

  264. module DataManager
  265.   
  266.   class << self
  267.     alias fp_pe_load_database load_database
  268.     alias fp_pe_init init
  269.   end
  270.   
  271.   def self.init
  272.     fp_pe_init
  273.     load_notetags_passive_effects
  274.   end
  275.   
  276.   def self.load_database
  277.     fp_pe_load_database
  278.     if $BTEST
  279.       load_notetags_passive_effects
  280.     end
  281.   end
  282.    
  283.   def self.load_notetags_passive_effects
  284.     groups = [$data_skills, $data_items, $data_weapons, $data_armors,
  285.               $data_actors, $data_classes, $data_states, $data_enemies]
  286.     for group in groups
  287.       for obj in group
  288.         next if obj.nil?
  289.         obj.load_notetags_passive_effects
  290.       end
  291.     end
  292.   end
  293. end

  294. class Game_BattlerBase
  295.   include Feature_Plus::Passive_Effect
  296.   
  297.   alias :fp_pe_initialize_bbase :initialize
  298.   def initialize
  299.     @passive_states = []
  300.     fp_pe_initialize_bbase
  301.   end
  302.   
  303.   alias :fp_pe_refresh_bbase :refresh
  304.   def refresh
  305.     refresh_passive_states
  306.     fp_pe_refresh_bbase
  307.   end
  308.   
  309.   def refresh_passive_states
  310.     @passive_states = features_set(FEATURE_PASSIVE_STATE)
  311.     @passive_states.each do |state_id|
  312.       p state_id
  313.       add_state(state_id)
  314.     end
  315.   end
  316.   
  317.   # A special feature sum that calls eval
  318.   def eval_features_sum(code, id, a)
  319.     features_with_id(code, id).inject(0.0) {|r, ft|
  320.     r += eval(ft.value) rescue 0 }
  321.   end
  322.   
  323.   def get_passive_param(param_id)
  324.     eval_features_sum(FEATURE_PARAM_BONUS, param_id, self)
  325.   end
  326.   
  327.   def get_nickname
  328.     nicknames = features_with_id(FEATURE_NICKNAME_CHANGE, 0)
  329.     return "" if nicknames.empty?
  330.     return nicknames[0].value
  331.   end
  332. end

  333. class Game_Battler < Game_BattlerBase
  334.   def clear_param_plus
  335.     super
  336.     @passive_params = [0] * 8
  337.   end
  338.   
  339.   def update_passive_params
  340.     8.times do |i|
  341.       @passive_params[i] = get_passive_param(i)
  342.     end
  343.   end

  344.   def param_plus(param_id)
  345.     @passive_params[param_id] + super
  346.   end
  347. end

  348. class Game_Actor < Game_Battler
  349.   
  350.   alias fe_actor_initialize initialize
  351.   def initialize(actor_id)
  352.     fe_actor_initialize(actor_id)
  353.     refresh
  354.   end
  355.   
  356.   alias fe_actor_refresh refresh
  357.   def refresh
  358.     update_passive_params
  359.     update_nickname
  360.     fe_actor_refresh
  361.   end
  362.   
  363.   def update_nickname
  364.     new_nick = get_nickname
  365.     @nickname = new_nick.empty? ? actor.nickname : new_nick
  366.   end
  367.   
  368.   # don't show message for passive states
  369.   def show_added_states
  370.     @result.added_state_objects.each do |state|
  371.       $game_message.add(name + state.message1) unless state.message1.empty? || @passive_states.include?(state.id)
  372.     end
  373.   end
  374.   
  375.   def no_floor_damage?
  376.     !features_with_id(FEATURE_TILE_EFFECT, 0).empty?
  377.   end
  378.   
  379.   alias fp_pe_execute_floor_damage execute_floor_damage
  380.   def execute_floor_damage
  381.     return if no_floor_damage?
  382.     fp_pe_execute_floor_damage
  383.   end
  384.   
  385.   #what limits
  386.   def param_max(param_id)
  387.     return 9999999
  388.   end
  389. end

  390. class Game_Enemy
  391.   
  392.   alias :fp_pe_make_enemy_actions :make_actions
  393.   def make_actions
  394.     refresh_passive_states
  395.     fp_pe_make_enemy_actions
  396.   end
  397. end
复制代码


第二个是技能选择:

  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. In this system, there are three "selection types"
  56. for skills

  57.    1 - "normal" skills
  58.    2 - "active" skills
  59.    3 - "passive" skills
  60.    
  61. To specify a select type, tag the skill with

  62.     <select: type>
  63.    
  64. Normal skills are the default select type for skills.
  65. They can be used in battle as long as you have learned it
  66.    
  67. Active skills are skills that require you to equip
  68. in order to use in battle.

  69. Passive skills are skills whose effects will be activated
  70. as long as the skill is equipped.

  71. The battle setup menu is accessed through the menu.

  72. The skills are grouped by skill type, and the equipped
  73. skills are displayed on the left. The top window shows the
  74. active skills, while the bottom window shows the passive
  75. skills.

  76. If you have skill slots available, you can select a skill
  77. by selecting it from the main skill list. To remove it
  78. from the list, just select it again. Equipping a skill
  79. requires a certain amount of skill points, and you can
  80. only equip a skill if you have enough skill points.

  81. You can use the left-key or right-key move
  82. between the battle skill lists and your main skill list.

  83. Selecting any of the skills in your battle skill list will
  84. remove them from the list. While you're at the active
  85. skill list, you can press pageup or pagedown to scroll
  86. between the passive skill list.

  87. The max number of skills from either category is limited
  88. by the max number of skills for your particular actor.
  89. The max number of skills may grow depending on your
  90. actor's level, specified by the amounts you write in
  91. each actor's noteboxes.

  92. The syntax for this is
  93.    <max active>
  94.    1:1, 5:2, 10:3
  95.    16:4
  96.    23:5
  97.    </max active>

  98. The same applies for passive skills; simply replace "active"
  99. with "passive".

  100. You define the skillpoint cost for each skill and the skill select type
  101. through the Skills tab in the database.

  102. <select: active> - specifies the selection type
  103. <sp: 2> - specifies the skillpoint cost

  104. To define the actor's skillpoint growth, you add the following
  105. tag to the actor
  106.     <SP: level*3>
  107.    
  108. To indicate that the amount of skillpoints received at each level
  109. is three times the current level. You will need to use the exact
  110. word "level" if you want to refer to the actor's level.

  111. In order to set up passive skills, you must tag your skills with the
  112. appropriate passive effects defined in FP: Passive Effects script,
  113. and then make sure that your skill is tagged as a passive select type.
  114. ==============================================================================
  115. =end
  116. $imported = {} if $imported.nil?
  117. $imported["Tsuki_SkillSelect"] = true
  118. #==============================================================================
  119. # ** Configuration
  120. #==============================================================================
  121. module Tsuki
  122.   module Battle_Skill
  123.     Command_Name = "Battle Skills"
  124.     Handler = :battle_skill
  125.     Enabled = true
  126.     Access = true
  127.    
  128.     #toggle whether skill points should be used
  129.     Use_SkillPoint_System = true
  130.     Use_SkillLimit_System = true
  131.    
  132.     # Number of skill sets you can have. Currently only one supported
  133.     Num_Skillsets = 5
  134.    
  135.     # Select type names #
  136.     # normal does not require assignment to use in battle
  137.     Normal_Name = "Normal"
  138.    
  139.     # these require assignment to use in battle
  140.     Active_Name = "Active"
  141.     Passive_Name = "Passive"
  142.    
  143.     # Number of skillpoints you can have at most
  144.     Skillpoint_Limit = 9999
  145.     Skillpoint_Growth = "level + 30"
  146.    
  147.     # The color that is used to highlight selected skills
  148.     Selected_Color = Color.new(255, 215, 0, 255)
  149.     Skillpoint_Color = Color.new(255, 128, 0, 255)
  150.    
  151.    
  152.     # skill regex
  153.     Select_Type = /<select\s*:\s*([^,]*)>/i
  154.     Skillpoint_Cost = /<sp\s*:\s*([^,]*)>/i
  155.    
  156.     # actor regex
  157.     Max_Active_On = /<(?:MAX_ACTIVE|max active)>/i
  158.     Max_Active_Off = /<\/(?:MAX_ACTIVE|max active)>/i
  159.     Max_Passive_On = /<(?:MAX_PASSIVE|max passive)>/i
  160.     Max_Passive_Off = /<\/(?:MAX_PASSIVE|max passive)>/i
  161.     Level_Value = /(\d+):\s*(\d+),*/
  162.     Skillpoint_Growth = /<SP:?\s*(.+)>/
  163.   end
  164. end

  165. #==============================================================================
  166. # ** Rest of the script
  167. #==============================================================================

  168. #==============================================================================
  169. # ** RPG::Skill
  170. #------------------------------------------------------------------------------
  171. #  Add skillpoint cost and selection type to Skill objects
  172. #==============================================================================

  173. module RPG
  174.   class Skill < UsableItem
  175.     include Tsuki::Battle_Skill
  176.    
  177.     attr_accessor :select_type
  178.     attr_accessor :skillpoint_cost
  179.    
  180.     alias :th_skill_select_init_rpg_skill :initialize
  181.     def initialize
  182.       th_skill_select_init_rpg_skill
  183.       load_notetags_skill_select
  184.     end
  185.    
  186.     def skillpoint_cost
  187.       return @skillpoint_cost unless @skillpoint_cost.nil?
  188.       load_notetags_skill_select
  189.       return @skillpoint_cost
  190.     end
  191.    
  192.     def select_type
  193.       return @select_type unless @select_type.nil?
  194.       load_notetags_skill_select
  195.       return @select_type
  196.     end
  197.    
  198.     def load_notetags_skill_select
  199.       @skillpoint_cost = 0
  200.       @select_type = Normal_Name
  201.       self.note.split(/[\r\n]+/).each do |line|
  202.         case line
  203.         when Select_Type
  204.           case $1.upcase
  205.           when Active_Name.upcase
  206.             @select_type = Active_Name
  207.           when Passive_Name.upcase
  208.             @select_type = Passive_Name
  209.           end
  210.         when Skillpoint_Cost
  211.           @skillpoint_cost = $1.to_i
  212.         end
  213.       end
  214.     end  
  215.   end

  216.   class Actor < BaseItem
  217.     include Tsuki::Battle_Skill
  218.    
  219.     attr_accessor :active_skill_levels
  220.     attr_accessor :passive_skill_levels
  221.     attr_accessor :skillpoint_growth
  222.    
  223.     alias :th_skill_select_init_rpg_actor :initialize
  224.     def initialize
  225.       th_skill_select_init_rpg_actor
  226.       load_notetags_skill_select
  227.     end
  228.    
  229.     def load_notetags_skill_select
  230.       @active_skill_levels = {}
  231.       @passive_skill_levels = {}
  232.       @skillpoint_growth = ""
  233.       self.note.split(/[\r\n]+/).each do |line|
  234.         case line
  235.         when Skillpoint_Growth
  236.           @skillpoint_growth = $1
  237.         when Max_Active_On
  238.           @max_active_on = true
  239.         when Max_Active_Off
  240.           @max_active_on = false
  241.         when Max_Passive_On
  242.           @max_passive_on = true
  243.         when Max_Active_Off
  244.           @max_passive_on = false
  245.         when Level_Value
  246.           next unless @max_active_on || @max_passive_on
  247.           line.scan(Level_Value).each do |match|
  248.             level = match[0].to_i
  249.             value = match[1].to_i
  250.             if @max_active_on
  251.               @active_skill_levels[level] = value
  252.             elsif @max_passive_on
  253.               @passive_skill_levels[level] = value
  254.             end
  255.           end
  256.         end
  257.       end
  258.     end
  259.   end
  260.   
  261.   class Enemy < BaseItem
  262.     include Tsuki::Battle_Skill
  263.    
  264.     attr_accessor :active_skill_levels
  265.     attr_accessor :passive_skill_levels
  266.     attr_accessor :skillpoint_growth
  267.    
  268.     alias :th_skill_select_init_rpg_enemy :initialize
  269.     def initialize
  270.       th_skill_select_init_rpg_enemy
  271.       load_notetags_skill_select
  272.     end
  273.    
  274.     def load_notetags_skill_select
  275.       @active_skill_levels = {}
  276.       @passive_skill_levels = {}
  277.       @skillpoint_growth = ""
  278.       self.note.split(/[\r\n]+/).each do |line|
  279.         case line
  280.         when Skillpoint_Growth
  281.           @skillpoint_growth = $1
  282.         when Max_Active_On
  283.           @max_active_on = true
  284.         when Max_Active_Off
  285.           @max_active_on = false
  286.         when Max_Passive_On
  287.           @max_passive_on = true
  288.         when Max_Active_Off
  289.           @max_passive_on = false
  290.         when Level_Value
  291.           next unless @max_active_on || @max_passive_on
  292.           line.scan(Level_Value).each do |match|
  293.             level = match[0].to_i
  294.             value = match[1].to_i
  295.             if @max_active_on
  296.               @active_skill_levels[level] = value
  297.             elsif @max_passive_on
  298.               @passive_skill_levels[level] = value
  299.             end
  300.           end
  301.         end
  302.       end
  303.     end
  304.   end
  305. end

  306. #==============================================================================
  307. # ** DataManager
  308. #------------------------------------------------------------------------------
  309. #  Initialize custom notetags
  310. #==============================================================================

  311. module DataManager
  312.   
  313.   class << self
  314.     alias tsuki_skill_select_load_database load_database
  315.     alias tsuki_skill_select_init init
  316.   end
  317.   
  318.   def self.init
  319.     tsuki_skill_select_init
  320.     load_notetags_skill_select
  321.   end
  322.   
  323.   def self.load_database
  324.     tsuki_skill_select_load_database
  325.     if $BTEST
  326.       load_notetags_skill_select
  327.     end
  328.   end
  329.    
  330.   def self.load_notetags_skill_select
  331.     groups = [$data_actors, $data_enemies]
  332.     for group in groups
  333.       for obj in group
  334.         next if obj.nil?
  335.         obj.load_notetags_skill_select
  336.       end
  337.     end
  338.   end
  339. end

  340. #==============================================================================
  341. # ** Game_Skillset
  342. #------------------------------------------------------------------------------
  343. # A Skill Set object. This stores a set of skills that the actor
  344. # is currently using
  345. #==============================================================================

  346. class Game_Skillset
  347.   
  348.   attr_reader :id
  349.   def initialize(index)
  350.     @id = index + 1
  351.     @skills = {}
  352.     setup
  353.     update_cost
  354.   end
  355.   
  356.   def setup
  357.     @skills[Tsuki::Battle_Skill::Passive_Name] = []
  358.     @skills[Tsuki::Battle_Skill::Active_Name] = []
  359.   end
  360.   
  361.   def [](type)
  362.     @skills[type] ||= []
  363.   end
  364.   
  365.   def include?(skill)
  366.     @skills[skill.select_type].include?(skill.id)
  367.   end
  368.   
  369.   def add_skill(skill)
  370.     @skills[skill.select_type] = [] if @skills[skill.select_type].nil?
  371.     @skills[skill.select_type] << skill.id
  372.     update_cost
  373.   end
  374.   
  375.   def remove_skill(skill)
  376.     index = @skills[skill.select_type].index(skill.id)
  377.     if index
  378.       @skills[skill.select_type].delete_at(index)
  379.       update_cost
  380.     end
  381.   end
  382.   
  383.   def update_skills(learned_skills)
  384.     @skills[Tsuki::Battle_Skill::Passive_Name] = @skills[Tsuki::Battle_Skill::Passive_Name].select{|skill| learned_skills.include?(skill.id)}
  385.     update_cost
  386.   end
  387.   
  388.   def passive_skills
  389.     @skills[Tsuki::Battle_Skill::Passive_Name]
  390.   end
  391.   
  392.   def active_skills
  393.     @skills[Tsuki::Battle_Skill::Active_Name]
  394.   end
  395.   
  396.   def update_cost
  397.     @total_cost = 0
  398.     skills.each do |skill|
  399.       @total_cost += skill.skillpoint_cost
  400.     end
  401.   end
  402.   
  403.   def skills
  404.     @skills.values.flatten.collect {|id| $data_skills[id]}
  405.   end
  406.   
  407.   def cost
  408.     @total_cost
  409.   end
  410.   
  411.   def size
  412.     @skills.size
  413.   end
  414. end

  415. #==============================================================================
  416. # ** Game_Skillsets
  417. #------------------------------------------------------------------------------
  418. # This class holds a set of skills that the actor has. It manages skill sets
  419. # such as returning the current set and switching the current set
  420. #==============================================================================
  421. class Game_Skillsets
  422.   
  423.   attr_accessor :current
  424.   def initialize
  425.     @data = []
  426.     [url=home.php?mod=space&uid=94117]@current[/url] = 0
  427.     setup_skillsets
  428.   end
  429.   
  430.   def num_skillsets
  431.     Tsuki::Battle_Skill::Num_Skillsets
  432.   end
  433.   
  434.   def setup_skillsets
  435.     num_skillsets.times do |i|
  436.       @data << Game_Skillset.new(i)
  437.     end
  438.   end
  439.   
  440.   def next_skillset
  441.     @current = [@current + 1, num_skillsets - 1].min
  442.   end
  443.   
  444.   def prev_skillset
  445.     @current = [0, @current - 1].max
  446.   end
  447.   
  448.   def [](index)
  449.     @data[index]
  450.   end
  451.   
  452.   def current_skillset
  453.     @data[@current]
  454.   end
  455. end

  456. #==============================================================================
  457. # ** Game_BattlerBase
  458. #------------------------------------------------------------------------------
  459. # Initialize skill parameter effects
  460. #==============================================================================

  461. class Game_BattlerBase
  462.   include Tsuki::Battle_Skill

  463.   alias tsuki_skill_select_bbase_initialize initialize
  464.   def initialize
  465.     tsuki_skill_select_bbase_initialize
  466.     @skillsets = Game_Skillsets.new
  467.   end
  468. end

  469. #==============================================================================
  470. # ** Game_Actor
  471. #------------------------------------------------------------------------------
  472. #
  473. #==============================================================================
  474.   
  475. class Game_Actor < Game_Battler
  476.   include Tsuki::Battle_Skill
  477.   
  478.   attr_accessor :battle_skills        #list of skills for use in battle
  479.   attr_accessor :max_active_skills    #number of active skills actor can have
  480.   attr_accessor :max_passive_skills   #number of passive skills actor can have
  481.   attr_accessor :max_skillpoints
  482.   attr_accessor :current_skillpoints
  483.   attr_accessor :current_skillset
  484.   
  485.   alias tsuki_battleSkill_actor_setup setup
  486.   def setup(actor_id)
  487.     tsuki_battleSkill_actor_setup(actor_id)
  488.     @skillsets = Game_Skillsets.new
  489.     @max_active_skills = 1
  490.     @max_passive_skills = 1
  491.     @active_skill_levels = actor.active_skill_levels ? actor.active_skill_levels : {}
  492.     @passive_skill_levels = actor.passive_skill_levels ? actor.passive_skill_levels : {}
  493.     @sp_formula = actor.skillpoint_growth
  494.     @max_skillpoints = calculate_skillpoints
  495.     @current_skillpoints = @max_skillpoints
  496.     set_max_active
  497.     set_max_passive
  498.   end
  499.   
  500.   alias tsuki_skill_select_actor_features feature_objects
  501.   def feature_objects
  502.     current_skillset.passive_skills + tsuki_skill_select_actor_features
  503.   end

  504.   def skill_conditions_met?(skill)
  505.     (skill.select_type == Normal_Name || current_skillset.active_skills.include?(skill.id)) && super
  506.   end
  507.    
  508.   def current_skillset
  509.     return unless @skillsets
  510.     @skillsets.current_skillset
  511.   end
  512.   
  513.   def set_max_active
  514.     active = 1
  515.     @active_skill_levels.each do |level, value|
  516.       active = value if [url=home.php?mod=space&uid=22147]@level[/url] >= level
  517.     end
  518.     @max_active_skills = active
  519.   end
  520.    
  521.   def set_max_passive
  522.     passive = 1
  523.     @passive_skill_levels.each do |level, value|
  524.       passive = value if @level >= level
  525.     end
  526.     @max_passive_skills = passive
  527.   end
  528.   
  529.   def gain_passive_slot
  530.     @max_passive_skills
  531.   end
  532.   
  533.   def gain_active_slot
  534.   end
  535.    
  536.   #already maxed out
  537.   def skillset_exceeded?(select_type)
  538.     case select_type
  539.     when Tsuki::Battle_Skill::Active_Name
  540.       current_skillset[select_type].size >= @max_active_skills
  541.     when Tsuki::Battle_Skill::Passive_Name
  542.       current_skillset[select_type].size >= @max_passive_skills
  543.     end
  544.   end
  545.   
  546.   def enough_skillpoints?(skill)
  547.     skill.skillpoint_cost <= @current_skillpoints
  548.   end
  549.   
  550.   #check if we can assign the skill
  551.   def can_assign?(skill)
  552.     return true unless Tsuki::Battle_Skill::Use_SkillLimit_System
  553.     return false unless skill
  554.     return false if current_skillset.skills.include?(skill)
  555.     return false if skillset_exceeded?(skill.select_type)
  556.     return false unless enough_skillpoints?(skill)
  557.     return true
  558.   end
  559.   
  560.   def assign_skill(skill)
  561.     current_skillset.add_skill(skill) if can_assign?(skill)
  562.     update_skillset
  563.     update_skillpoints
  564.     refresh
  565.   end
  566.   
  567.   def unassign_skill(skill)
  568.     current_skillset.remove_skill(skill)
  569.     update_skillset
  570.     update_skillpoints
  571.     refresh
  572.   end
  573.   
  574.   def update_skillset
  575.     current_skillset.update_skills(@skills | added_skills)
  576.   end
  577.   
  578.   def skillpoint_limit
  579.     Tsuki::Battle_Skill::Skillpoint_Limit
  580.   end
  581.   
  582.   def calculate_skillpoints(level=self.level)
  583.     [Kernel.eval(@sp_formula), 0].max rescue 0
  584.   end
  585.   
  586.   def gain_skillpoints(val)
  587.     @max_skillpoints = [[@max_skillpoints + val, skillpoint_limit].min, 0].max
  588.     update_skillpoints
  589.   end
  590.   
  591.   def lose_skillpoints(val)
  592.     gain_skillpoints(-val)
  593.   end
  594.   
  595.   def update_skillpoints   
  596.     @current_skillpoints = [@max_skillpoints - current_skillset.cost, 0].max
  597.   end
  598.   
  599.   def next_skillset
  600.     @skillsets.next_skillset
  601.     update_skillpoints
  602.   end
  603.   
  604.   def prev_skillset
  605.     @skillsets.prev_skillset
  606.     update_skillpoints
  607.   end
  608.   
  609.   def update_skill_slots
  610.     set_max_active
  611.     set_max_passive
  612.   end

  613.   #add skillpoints when actor levels up
  614.   alias tsuki_skill_select_level_up level_up
  615.   def level_up
  616.     tsuki_skill_select_level_up
  617.     gain_skillpoints(calculate_skillpoints)
  618.     update_skill_slots
  619.   end
  620.   
  621.   #lose skillpoints when actor levels down
  622.   alias tsuki_skill_select_level_down level_down
  623.   def level_down
  624.     tsuki_skill_select_level_down
  625.     lose_skillpoints(calculate_skillpoints(self.level + 1))
  626.     update_skill_slots
  627.   end
  628. end

  629. #==============================================================================
  630. # ** Update menu scene to add option and add some flags to game system
  631. #==============================================================================

  632. class Game_System
  633.   attr_accessor :battleskill_disabled
  634.   attr_accessor :battleskill_noshow
  635.   
  636.   alias tsuki_skill_select_system_initialize initialize
  637.   def initialize
  638.     tsuki_skill_select_system_initialize
  639.     @battleskill_disabled = false
  640.     @battleskill_noshow = false
  641.   end
  642. end

  643. #==============================================================================
  644. # ** Game_Interpreter
  645. #------------------------------------------------------------------------------
  646. # Convenience methods for the interpreter
  647. #==============================================================================

  648. class Game_Interpreter
  649.   
  650.   def enable_skill_select
  651.     $game_system.battleskill_disabled = false
  652.   end
  653.   
  654.   def disable_skill_select
  655.     $game_system.battleskill_disabled = true
  656.   end
  657.   
  658.   def show_skill_select
  659.     $game_system.battleskill_noshow = false
  660.   end
  661.   
  662.   def hide_skill_select
  663.     $game_system.battleskill_noshow = true
  664.   end
  665.   
  666.   def gain_sp(index, val)
  667.     $game_party.all_members[index].gain_skillpoints(val)
  668.   end
  669.   
  670.   def lose_sp(index, val)
  671.     $game_party.all_members[index].lose_skillpoints(val)
  672.   end
  673. end

  674. class Window_MenuCommand < Window_Command
  675.   #--------------------------------------------------------------------------
  676.   # * Add menu command to List
  677.   #--------------------------------------------------------------------------
  678.   alias tsuki_skill_select_commands add_main_commands
  679.   def add_main_commands
  680.     tsuki_skill_select_commands
  681.     if !$game_system.battleskill_noshow
  682.       add_command(Tsuki::Battle_Skill::Command_Name, Tsuki::Battle_Skill::Handler, !$game_system.battleskill_disabled)
  683.     end
  684.   end
  685. end

  686. class Scene_Menu < Scene_MenuBase
  687.   #--------------------------------------------------------------------------
  688.   # * Add menu handler
  689.   #--------------------------------------------------------------------------
  690.   alias tsuki_skill_select_command_window create_command_window
  691.   def create_command_window
  692.     tsuki_skill_select_command_window
  693.     if !$game_system.battleskill_disabled
  694.       @command_window.set_handler(Tsuki::Battle_Skill::Handler, method(:command_personal))
  695.     end
  696.   end
  697.   
  698.   alias tsuki_skill_select_personal_ok on_personal_ok
  699.   def on_personal_ok
  700.     case @command_window.current_symbol
  701.     when Tsuki::Battle_Skill::Handler
  702.       SceneManager.call(Scene_Skill_Select)
  703.     end
  704.     tsuki_skill_select_personal_ok
  705.   end
  706. end

  707. class Window_battleSkillHelp < Window_Base
  708.   
  709.   def initialize(x, y, width, height)
  710.     super(x, y, width, height)
  711.   end
  712.   #--------------------------------------------------------------------------
  713.   # * Set Text
  714.   #--------------------------------------------------------------------------
  715.   def set_text(text)
  716.     if text != @text
  717.       @text = text
  718.       refresh
  719.     end
  720.   end
  721.   #--------------------------------------------------------------------------
  722.   # * Clear
  723.   #--------------------------------------------------------------------------
  724.   def clear
  725.     set_text("")
  726.   end
  727.   #--------------------------------------------------------------------------
  728.   # * Set Item
  729.   #     item : Skills and items etc.
  730.   #--------------------------------------------------------------------------
  731.   def set_item(item)
  732.     set_text(item ? item.description : "")
  733.   end
  734.   #--------------------------------------------------------------------------
  735.   # * Refresh
  736.   #--------------------------------------------------------------------------
  737.   def refresh
  738.     contents.clear
  739.     draw_text_ex(4, 0, @text)
  740.   end
  741. end

  742. #Displays actor info
  743. class Window_battleSkillStatus < Window_Base
  744.   
  745.   def initialize(x, y, width, height)
  746.     super(x, y, width, height)
  747.     [url=home.php?mod=space&uid=95897]@actor[/url] = nil
  748.   end
  749.   
  750.   def skillpoints_enabled?
  751.     Tsuki::Battle_Skill::Use_SkillPoint_System
  752.   end
  753.   #--------------------------------------------------------------------------
  754.   # * Set Actor
  755.   #--------------------------------------------------------------------------
  756.   def actor=(actor)
  757.     return if @actor == actor
  758.     @actor = actor
  759.     @actor.update_skillset
  760.     @actor.update_skillpoints
  761.     refresh
  762.     self.oy = 0
  763.   end
  764.   
  765.   def draw_skillset_number
  766.     return unless @actor
  767.     set_id = @actor.current_skillset.id
  768.     set_name = "Set %d" %set_id
  769.     text_width = text_size(set_name).width
  770.     change_color(normal_color)
  771.     draw_text(130 - text_width, 10, width, line_height, set_name)
  772.   end
  773.   
  774.   def draw_skillpoints
  775.     return unless @actor
  776.     text_width = text_size(@actor.current_skillpoints).width
  777.     change_color(Tsuki::Battle_Skill::Skillpoint_Color)
  778.     draw_text(130 - text_width, 50, width, line_height, @actor.current_skillpoints)
  779.   end
  780.   #--------------------------------------------------------------------------
  781.   # * Refresh
  782.   #--------------------------------------------------------------------------
  783.   def refresh
  784.     contents.clear
  785.     return unless @actor
  786.     draw_actor_face(@actor, 0, 0)
  787.     draw_skillpoints if skillpoints_enabled?
  788.     draw_skillset_number
  789.   end
  790. end

  791. #==============================================================================
  792. # ** Update Window_BattleSkill to filter the skills
  793. #==============================================================================
  794. class Window_BattleSkill < Window_SkillList
  795.   
  796.   def include?(item)
  797.     item && item.stype_id == @stype_id && (item.select_type == Tsuki::Battle_Skill::Normal_Name || equipped?(item))
  798.   end
  799.   
  800.   def equipped?(item)
  801.     @actor.current_skillset.skills.include?(item) && item.select_type != Tsuki::Battle_Skill::Passive_Name
  802.   end
  803.   
  804.   def make_item_list
  805.     @data = @actor ? @actor.skills.select {|id| include?(id) } : []
  806.   end
  807. end

  808. class Window_battleSkillCommand < Window_HorzCommand
  809.    
  810.   attr_accessor :window_width
  811.   def initialize(x, y)
  812.     @window_width = Graphics.width - x
  813.     super(x, y)
  814.     @actor = nil
  815.     update
  816.   end
  817.   
  818.   def window_width
  819.     @window_width
  820.   end
  821.   
  822.   def window_height
  823.     50
  824.   end
  825.   
  826.   def actor=(actor)
  827.     return if @actor == actor
  828.     @actor = actor
  829.     refresh
  830.   end
  831.    
  832.   #--------------------------------------------------------------------------
  833.   # * Get Digit Count
  834.   #--------------------------------------------------------------------------
  835.   def col_max
  836.     return 2
  837.   end
  838.   
  839.   #--------------------------------------------------------------------------
  840.   # * Get Number of Lines to Show
  841.   #--------------------------------------------------------------------------
  842.   def visible_line_number
  843.     return 4
  844.   end
  845.   
  846.   #--------------------------------------------------------------------------
  847.   # * Create Command List
  848.   #--------------------------------------------------------------------------
  849.   def make_command_list
  850.     return unless @actor
  851.     @actor.added_skill_types.sort.each do |stype_id|
  852.       name = $data_system.skill_types[stype_id]
  853.       add_command(name, :skill, true, stype_id)
  854.     end
  855.   end
  856.   
  857.   #--------------------------------------------------------------------------
  858.   # * Frame Update
  859.   #--------------------------------------------------------------------------
  860.   def update
  861.     super
  862.     @skill_window.stype_id = current_ext if @skill_window
  863.   end
  864.   
  865.   #--------------------------------------------------------------------------
  866.   # * Set Skill Window
  867.   #--------------------------------------------------------------------------
  868.   def skill_window=(skill_window)
  869.     @skill_window = skill_window
  870.     update
  871.   end
  872. end

  873. #==============================================================================
  874. # ** Window_battleSkillBattleList
  875. #------------------------------------------------------------------------------
  876. # This class shows the skills that you have selected for battle. It is
  877. # the superclass for any selected skills list
  878. #==============================================================================

  879. class Window_battleSkillSelectedList < Window_SkillList#Window_Selectable
  880.    
  881.   def filler_text
  882.     "---"
  883.   end
  884.   
  885.   def skill_limits_enabled?
  886.     Tsuki::Battle_Skill::Use_SkillLimit_System
  887.   end

  888.   def draw_filler(rect)
  889.     draw_text(rect, filler_text)
  890.   end
  891.   
  892.   def add_fillers
  893.     (max_items - @data.size).times do |i|
  894.       @data << nil
  895.     end
  896.   end
  897.   
  898.   def col_max
  899.     1
  900.   end
  901.   
  902.   def window_width
  903.     120
  904.   end
  905.   
  906.   def include?(skill)
  907.     true
  908.   end
  909.    
  910.   def make_item_list
  911.     add_fillers if skill_limits_enabled?
  912.   end
  913.   
  914.   def draw_item(index)
  915.     id = @data[index]
  916.     rect = item_rect(index)
  917.     if id
  918.       item = $data_skills[id]
  919.       draw_icon(item.icon_index, rect.x, rect.y)
  920.       draw_skill_name(rect.x+24, rect.y, rect.width - 16, item.name)
  921.     else
  922.       draw_filler(rect)
  923.     end
  924.   end
  925.   
  926.   def draw_skill_name(x, y, width, name)
  927.     draw_text(x, y, width, line_height, name)
  928.   end
  929.   
  930.   def remove_item(item)
  931.     return unless item   
  932.     @actor.unassign_skill(item)
  933.     refresh
  934.   end
  935.   
  936.   def refresh
  937.     make_item_list
  938.     create_contents
  939.     draw_all_items
  940.   end
  941.   
  942.   def select_last
  943.     if @last_index && @data.size > 0 && @data[@last_index]
  944.       select(@last_index)
  945.     else
  946.       select(0)
  947.     end
  948.   end

  949.   #--------------------------------------------------------------------------
  950.   # * Add additional handles to be more useful
  951.   #--------------------------------------------------------------------------
  952.   def process_handling
  953.     return unless open? && active
  954.     return process_dir4 if Input.trigger?(:LEFT) && handle?(:dir4)
  955.     return process_dir6 if Input.trigger?(:RIGHT) && handle?(:dir6)
  956.     return super
  957.   end
  958.   
  959.   def process_dir4
  960.     Sound.play_cursor
  961.     Input.update
  962.     deactivate
  963.     call_handler(:dir4)
  964.   end
  965.   
  966.   def process_dir6
  967.     Sound.play_cursor
  968.     Input.update
  969.     deactivate
  970.     call_handler(:dir6)
  971.   end
  972. end

  973. class Window_battleSkillPassiveList < Window_battleSkillSelectedList
  974.   #--------------------------------------------------------------------------
  975.   # * Max number of passive skills the actor can choose
  976.   #--------------------------------------------------------------------------
  977.   def max_items
  978.     @actor ? @actor.max_passive_skills : 0
  979.   end
  980.   
  981.   def make_item_list
  982.     @data = @actor ? @actor.current_skillset.passive_skills.clone : nil
  983.     super
  984.   end
  985. end

  986. class Window_battleSkillActiveList < Window_battleSkillSelectedList

  987.   #--------------------------------------------------------------------------
  988.   # * Max number of items you can select
  989.   #--------------------------------------------------------------------------
  990.   def max_items
  991.     @actor ? @actor.max_active_skills : 0
  992.   end
  993.   
  994.   def make_item_list
  995.     @data = @actor ? @actor.current_skillset.active_skills.clone : nil
  996.     super
  997.   end
  998. end

  999. #==============================================================================
  1000. # ** Window_SkillList
  1001. #------------------------------------------------------------------------------
  1002. #  This window is for displaying a list of available skills on the skill window.
  1003. #==============================================================================

  1004. class Window_battleSkillList < Window_SkillList
  1005.   
  1006.   #--------------------------------------------------------------------------
  1007.   # * Get Skill Type ID
  1008.   #--------------------------------------------------------------------------
  1009.   def stype_id
  1010.     return @stype_id
  1011.   end
  1012.   #--------------------------------------------------------------------------
  1013.   # * Get Digit Count
  1014.   #--------------------------------------------------------------------------
  1015.   def col_max
  1016.     return 1
  1017.   end
  1018.   #--------------------------------------------------------------------------
  1019.   # * Include in Skill List?
  1020.   #--------------------------------------------------------------------------
  1021.   def include?(item)
  1022.     item && item.stype_id == @stype_id && item.select_type != normal_name
  1023.   end
  1024.   
  1025.   def normal_name
  1026.     Tsuki::Battle_Skill::Normal_Name
  1027.   end
  1028.   
  1029.   def skillpoint_cost_color
  1030.     Tsuki::Battle_Skill::Skillpoint_Color
  1031.   end
  1032.   
  1033.   def current_item_enabled?
  1034.     true
  1035.   end
  1036.   
  1037.   #--------------------------------------------------------------------------
  1038.   # * In actor's current skill?
  1039.   #--------------------------------------------------------------------------  
  1040.   def selected?(item)
  1041.     @actor.current_skillset.include?(item)
  1042.   end
  1043.   
  1044.   def selected_color
  1045.     Tsuki::Battle_Skill::Selected_Color
  1046.   end

  1047.   #--------------------------------------------------------------------------
  1048.   # * Create Skill List
  1049.   #--------------------------------------------------------------------------
  1050.   def make_item_list
  1051.     @data = @actor ? @actor.skills.select {|skill| include?(skill) } : []
  1052.   end
  1053.   
  1054.   def skillpoints_enabled?
  1055.     Tsuki::Battle_Skill::Use_SkillPoint_System
  1056.   end
  1057.   #--------------------------------------------------------------------------
  1058.   # * Draw Item
  1059.   #--------------------------------------------------------------------------
  1060.   def draw_item(index)
  1061.     skill = @data[index]
  1062.     if skill
  1063.       rect = item_rect(index)
  1064.       rect.width -= 4
  1065.       
  1066.       if selected?(skill)
  1067.         can_assign = true
  1068.         change_color(selected_color)
  1069.       else
  1070.         can_assign = @actor.can_assign?(skill)
  1071.         change_color(normal_color, can_assign)
  1072.       end
  1073.       draw_icon(skill.icon_index, rect.x, rect.y)
  1074.       draw_text(rect.x + 32, rect.y, width, line_height, skill.name)
  1075.       
  1076.       if skillpoints_enabled?
  1077.         draw_skillpoint_cost(rect, skill, can_assign)
  1078.       else
  1079.         draw_skill_cost(rect, skill)
  1080.       end
  1081.     end
  1082.   end
  1083.   #--------------------------------------------------------------------------
  1084.   # * Draw Skillpoint Use Cost
  1085.   #--------------------------------------------------------------------------
  1086.   def draw_skillpoint_cost(rect, skill, can_assign)
  1087.     change_color(skillpoint_cost_color, can_assign)
  1088.     draw_text(rect, skill.skillpoint_cost, 2)
  1089.   end
  1090.   #--------------------------------------------------------------------------
  1091.   # * Restore Previous Selection Position
  1092.   #--------------------------------------------------------------------------
  1093.   def select_last
  1094.     if @last_index && @data.size > 0 && @data[@last_index]
  1095.       select(@last_index)
  1096.     else
  1097.       select(0)
  1098.     end
  1099.   end

  1100.   def can_add?(item)
  1101.     @actor.can_assign?(item)
  1102.   end
  1103.    
  1104.   #--------------------------------------------------------------------------
  1105.   # * Rather than give an error when adding a duplicate item, we remove
  1106.   # if from the list instead
  1107.   #--------------------------------------------------------------------------
  1108.   def add_item(item)
  1109.     if can_add?(item)
  1110.       @actor.assign_skill(item)
  1111.     elsif selected?(item)
  1112.       remove_item(item)
  1113.       return
  1114.     else
  1115.       Sound.play_buzzer
  1116.     end
  1117.     refresh
  1118.   end
  1119.   
  1120.   def remove_item(item)
  1121.     return unless item
  1122.     @actor.unassign_skill(item)
  1123.     refresh
  1124.   end
  1125.   
  1126.   def process_handling
  1127.     return unless open? && active
  1128.     return process_dir4 if Input.trigger?(:LEFT) && handle?(:dir4)
  1129.     return process_dir6 if Input.trigger?(:RIGHT) && handle?(:dir6)
  1130.     return super
  1131.   end
  1132.   
  1133.   def process_dir4
  1134.     Sound.play_cursor
  1135.     Input.update
  1136.     deactivate
  1137.     call_handler(:dir4)
  1138.   end
  1139.   
  1140.   def process_dir6
  1141.     Sound.play_cursor
  1142.     Input.update
  1143.     deactivate
  1144.     call_handler(:dir6)
  1145.   end
  1146. end

  1147. #==============================================================================
  1148. # ** Battle Skill scene
  1149. #==============================================================================

  1150. class Scene_Skill_Select < Scene_MenuBase
  1151.   
  1152.   def start
  1153.     super
  1154.     create_all_windows
  1155.     @category_window.activate
  1156.   end
  1157.   
  1158.   def create_all_windows
  1159.     create_actor_window
  1160.     create_help_window
  1161.     create_category_window
  1162.     create_active_skills_window
  1163.     create_passive_skills_window
  1164.     create_skills_window
  1165.   end
  1166.   
  1167.   #draw actor in the top-left corner
  1168.   def create_actor_window
  1169.     @actor_window = Window_battleSkillStatus.new(0,0, 160, 100)
  1170.     @actor_window.actor = @actor
  1171.   end
  1172.   
  1173.   #draw help window to the right of actor window
  1174.   def create_help_window
  1175.     wx = @actor_window.width
  1176.     @help_window = Window_battleSkillHelp.new(wx, 0, Graphics.width - wx, 100)
  1177.     @help_window.viewport = @viewport
  1178.   end
  1179.   
  1180.   #draw category window under the help window
  1181.   def create_category_window
  1182.     wx = @help_window.x
  1183.     wy = @help_window.height
  1184.     @category_window = Window_battleSkillCommand.new(wx, wy)
  1185.     @category_window.viewport = @viewport
  1186.     @category_window.help_window = @help_window
  1187.     @category_window.actor = @actor
  1188.     @category_window.set_handler(:skill,    method(:command_skill))
  1189.     @category_window.set_handler(:cancel,   method(:return_scene))
  1190.     @category_window.set_handler(:pagedown, method(:next_actor))
  1191.     @category_window.set_handler(:pageup,   method(:prev_actor))
  1192.   end
  1193.   
  1194.   #draw passive skills window under actor window
  1195.   def create_active_skills_window
  1196.     wx = @actor_window.x
  1197.     wy = @actor_window.height
  1198.     width = @actor_window.width
  1199.     @askill_window = Window_battleSkillActiveList.new(wx, wy, width, 200)
  1200.     @askill_window.viewport = @viewport
  1201.     @askill_window.help_window = @help_window
  1202.     @askill_window.actor = @actor
  1203.     @askill_window.set_handler(:ok,       method(:on_askill_ok))
  1204.     @askill_window.set_handler(:cancel,   method(:on_askill_cancel))
  1205.     @askill_window.set_handler(:pagedown,   method(:activate_pskill_window))
  1206.     @askill_window.set_handler(:pageup,   method(:activate_pskill_window))
  1207.     @askill_window.set_handler(:dir4,   method(:activate_skills_window))
  1208.     @askill_window.set_handler(:dir6,   method(:activate_skills_window))
  1209.   end
  1210.   
  1211.   #draw active skills window under passive skills
  1212.   def create_passive_skills_window
  1213.     wx = @askill_window.x
  1214.     wy = @askill_window.y + @askill_window.height
  1215.     width = @askill_window.width
  1216.     height = Graphics.height - wy
  1217.     @pskill_window = Window_battleSkillPassiveList.new(wx, wy, width, height)
  1218.     @pskill_window.viewport = @viewport
  1219.     @pskill_window.help_window = @help_window
  1220.     @pskill_window.actor = @actor
  1221.     @pskill_window.set_handler(:ok,       method(:on_pskill_ok))
  1222.     @pskill_window.set_handler(:cancel,   method(:on_pskill_cancel))
  1223.     @pskill_window.set_handler(:pagedown,   method(:activate_askill_window))
  1224.     @pskill_window.set_handler(:pageup,   method(:activate_askill_window))
  1225.     @pskill_window.set_handler(:dir4,   method(:activate_skills_window))
  1226.     @pskill_window.set_handler(:dir6,   method(:activate_skills_window))
  1227.   end
  1228.   #--------------------------------------------------------------------------
  1229.   # * Displays all the items available to choose from
  1230.   #--------------------------------------------------------------------------
  1231.   def create_skills_window
  1232.     wx = @category_window.x
  1233.     wy = @category_window.y + @category_window.height
  1234.     width = @category_window.width
  1235.     height = Graphics.height - wy
  1236.     @skills_window = Window_battleSkillList.new(wx, wy, width, height)
  1237.     @skills_window.help_window = @help_window
  1238.     @skills_window.actor = @actor
  1239.     @skills_window.set_handler(:ok,     method(:on_skills_ok))
  1240.     @skills_window.set_handler(:cancel, method(:on_skills_cancel))
  1241.     @skills_window.set_handler(:pageup,   method(:next_skillset))
  1242.     @skills_window.set_handler(:pagedown,   method(:prev_skillset))
  1243.     @skills_window.set_handler(:dir4,   method(:activate_askill_window))
  1244.     @skills_window.set_handler(:dir6,   method(:activate_askill_window))
  1245.     @category_window.skill_window = @skills_window
  1246.     update_selected_skills
  1247.   end
  1248.    
  1249.   def skill
  1250.     @skills_window.item
  1251.   end
  1252.   
  1253.   def next_skillset
  1254.     @actor.next_skillset
  1255.     update_selected_skills
  1256.     activate_skills_window
  1257.   end
  1258.   
  1259.   def prev_skillset
  1260.     @actor.prev_skillset
  1261.     update_selected_skills
  1262.     activate_skills_window
  1263.   end
  1264.   
  1265.   def activate_askill_window
  1266.     @skills_window.unselect
  1267.     @pskill_window.unselect
  1268.     @askill_window.activate
  1269.     @askill_window.select(0)
  1270. #~     @askill_window.select_last
  1271.   end
  1272.   
  1273.   def activate_pskill_window
  1274.     @skills_window.unselect
  1275.     @askill_window.unselect
  1276.     @pskill_window.activate
  1277.     @pskill_window.select(0)
  1278. #~     @pskill_window.select_last
  1279.   end
  1280.   
  1281.   def activate_skills_window
  1282.     @pskill_window.unselect
  1283.     @askill_window.unselect
  1284.     #@skills_window.select_last
  1285.     @skills_window.activate
  1286.   end
  1287.   
  1288.   def activate_category_window
  1289.     @askill_window.unselect
  1290.     @pskill_window.unselect
  1291.     @skills_window.unselect
  1292.     @category_window.activate
  1293.   end
  1294.   
  1295.   def command_skill
  1296.     @skills_window.activate
  1297.     @skills_window.select_last
  1298.   end
  1299.   
  1300.   def on_skills_ok
  1301.     determine_skill
  1302.     update_selected_skills
  1303.     activate_skills_window
  1304.   end
  1305.   
  1306.   def on_skills_cancel
  1307.     activate_category_window
  1308.   end
  1309.   
  1310.   def on_askill_ok
  1311.     @askill_window.remove_item(@askill_window.item)
  1312.     update_selected_skills
  1313.     activate_askill_window
  1314.   end
  1315.   
  1316.   def on_askill_cancel
  1317.     activate_category_window
  1318.   end
  1319.   
  1320.   def on_pskill_ok
  1321.     @pskill_window.remove_item(@pskill_window.item)
  1322.     update_selected_skills
  1323.     activate_pskill_window
  1324.   end
  1325.   
  1326.   def on_pskill_cancel
  1327.     activate_category_window
  1328.   end
  1329.   
  1330.   def determine_skill
  1331.     @skills_window.add_item(skill)
  1332.     update_selected_skills
  1333.     activate_skills_window
  1334.   end
  1335.   
  1336.   def on_actor_change
  1337.     @actor_window.actor = @actor
  1338.     @category_window.actor = @actor
  1339.     @skills_window.actor = @actor
  1340.     @askill_window.actor = @actor
  1341.     @pskill_window.actor = @actor
  1342.     @category_window.activate
  1343.   end
  1344.   
  1345.   def update_selected_skills
  1346.     @askill_window.refresh
  1347.     @pskill_window.refresh
  1348.     @actor_window.refresh
  1349.     @skills_window.refresh
  1350.   end
  1351. end

  1352. if $imported["Tsuki_MonsterHunter"]
  1353.   module Monster_Hunter
  1354.    
  1355.     class << self
  1356.       alias skill_select_setup_extra setup_extra
  1357.     end
  1358.    
  1359.     def self.setup_extra(actor, enemy)
  1360.       skill_select_setup_extra(actor, enemy)
  1361.       actor.skillpoint_growth = enemy.skillpoint_growth
  1362.       actor.passive_skill_levels = enemy.passive_skill_levels
  1363.       actor.active_skill_levels = enemy.active_skill_levels
  1364.     end
  1365.   end
  1366. end
复制代码


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

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

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

求指点……
梦石
0
星屑
50
在线时间
616 小时
注册时间
2010-10-29
回帖
411
发表于 2012-12-27 08:58:40 | 显示全部楼层
首先,你也许应该报告的问题,tsukihime的博客。你也可以问这个问题RGSS3 script support在rmva.net论坛中。 第二个脚本有一个DEMO,这可能会帮助。

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

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

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

LBQ Works
回复

使用道具 举报

梦石
0
星屑
50
在线时间
687 小时
注册时间
2012-10-29
回帖
1526
发表于 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 精品文章

查看全部评分

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

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部