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

Project1

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

[已经解决] 如何使一些装备可以增减tp上限?

[复制链接]

Lv4.逐梦者

梦石
0
星屑
7028
在线时间
878 小时
注册时间
2015-2-10
帖子
248
跳转到指定楼层
1
发表于 2020-8-31 11:59:02 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
50星屑
tp上限默认是100,虽然可以在脚本里直接修改上限,但我想制作的是可以增减tp上限的装备,这需要用到别的脚本了吧?本人脚本盲,完全不懂啊。请大佬们帮忙解决一下。

Lv5.捕梦者

梦石
0
星屑
24317
在线时间
5050 小时
注册时间
2016-3-8
帖子
1620
2
发表于 2020-8-31 13:01:51 | 只看该作者
本帖最后由 alexncf125 于 2020-9-1 10:45 编辑

先插入Hime的Feature Manager和Max TP
http://himeworks.com/2012/10/feature-manager/
https://www.rpgmakercentral.com/topic/7649-max-tp/

之后在装备的备注栏写上
<ft: max_tp x>

P.S. 我没实际测试过, 不知是不是你要的效果, 也不知 x 能不能是负数

RUBY 代码复制
  1. =begin
  2. #===============================================================================
  3.  ** Feature Manager
  4.  Author: Hime
  5.  Date: Oct 3, 2013
  6. --------------------------------------------------------------------------------
  7.  ** Change log
  8.  2.0 Oct 3, 2013
  9.    - implemented the extended regex for feature note-tags
  10.  1.32 Nov 18, 2012
  11.    - added convenience wrapper for data elements
  12.  1.31 Nov 9, 2012
  13.    - fixed bug where item features didn't have conditions
  14.  1.3 Nov 8, 2012
  15.    - Added conditional features.
  16.    - Aliased default features for use with conditional features
  17.  Oct 22, 2012
  18.    - No longer overwrites any methods
  19.  Oct 21, 2012
  20.    - features_value_set should return set of values, not data_id's
  21.  Oct 18, 2012
  22.    - added item_feature_set to collect all features for a given item
  23.  Oct 14, 2012
  24.    - added max/min feature value collection
  25.  Oct 13, 2012
  26.    - added some feature collection to check features of specific item
  27.    - re-wrote `equippable?` to do negative-checking
  28.  Oct 12, 2012
  29.    - initial release
  30. --------------------------------------------------------------------------------  
  31.  ** Terms of Use
  32.  * Free to use in non-commercial projects
  33.  * Contact me for commercial use
  34.  * No real support. The script is provided as-is
  35.  * Will do bug fixes, but no compatibility patches
  36.  * Features may be requested but no guarantees, especially if it is non-trivial
  37.  * Preserve this header
  38. --------------------------------------------------------------------------------
  39.  ** Compatibility
  40.  
  41.  This script does not overwrite any methods and aliases one method.
  42.  Most features should not have conflicts with the following systems
  43.  
  44.  -Tankentai SBS
  45.  -Yanfly Ace Battle Engine
  46. --------------------------------------------------------------------------------
  47.  ** Description
  48.  
  49.  This is a plugin-based feature system that allows you to define your own
  50.  features easily and add them to database objects.
  51.  
  52.  Register a feature using an idstring to identify your feature. Recommended
  53.  strings or symbols, but anything hashable is valid.
  54.  
  55.  You will use the idstring throughout your script, such as in notetags
  56.  and also initializing the feature (optional).
  57.  
  58.  If your script will be using params, xparams, or sparams, you should use
  59.  standard data ID's that the rest of the script uses. These are defined in
  60.  the tables below.
  61.  
  62.  You should use data ID 0 for weapons, 1 for armors, and 2 for items.
  63. --------------------------------------------------------------------------------
  64.  ** Usage
  65.  
  66.  To add a feature to a feature object, simply note-tag with a feature tag.
  67.  The general syntax for a feature tag is
  68.  
  69.     <ft: name arg1 arg2 ... >
  70.     
  71.  Where
  72.    `name` is the name of the feature you wish to add
  73.    `arg1 arg2 ...` are a list of arguments that the plugin requires
  74.    
  75.  You may specify conditional features as well, using the following note-tag
  76.  
  77.     <cond_ft: name "cond" arg1 arg2 ... >
  78.     
  79.  Where
  80.    `cond` is a ruby expression that evaluates to true or false. The condition
  81.           must be surrounded by quotation marks.
  82.           
  83.  Conditional features can be applied to any feature that is supported by this
  84.  system.
  85.  
  86.  If you need more control over the note-tag, you can use the extended note-tag
  87.  
  88.    <ft: FEATURE_NAME>
  89.      option1: value1
  90.      option2: value2
  91.      ...
  92.    </ft>
  93.    
  94.  You can define any option name that you want. All options will be passed to
  95.  your `add_feature` method as a hash, where the keys are the option names and
  96.  the values are the corresponding values. For example, the above example
  97.  would create a hash that looks like
  98.  
  99.    {
  100.      :option1 => value1,
  101.      :option2 => value2
  102.    }
  103.    
  104.  Which you can then use to grab values.
  105.  To work with your extended note-tag, you need to define the following method
  106.  in BaseItem or its child classes:
  107.  
  108.    def add_feature_FEATURE_NAME_ext(code, data_id, args)
  109.     
  110.      # do something with your args
  111.      value = ...
  112.      add_feature(code, data_id, value)
  113.    end
  114.  
  115. #===============================================================================
  116. =end
  117. $imported = {} if $imported.nil?
  118. $imported["Feature_Manager"] = 2.0
  119. #===============================================================================
  120. # ** Rest of the script
  121. #===============================================================================
  122. module FeatureManager
  123.  
  124.   # Format for all note tags
  125.   Feature_Regex = /<ft: (\w+)(.*)>/i
  126.   Cond_Feature_Regex = /<cond_ft: (\w+) ['"](.*)['"](.*)>/i
  127.  
  128.   Ext_Regex = /<feature: (\w+)>(.*?)<\/feature>/im
  129.  
  130.   # Default features.
  131.   FEATURE_ELEMENT_RATE  = 11              # Element Rate
  132.   FEATURE_DEBUFF_RATE   = 12              # Debuff Rate
  133.   FEATURE_STATE_RATE    = 13              # State Rate
  134.   FEATURE_STATE_RESIST  = 14              # State Resist
  135.   FEATURE_PARAM         = 21              # Parameter
  136.   FEATURE_XPARAM        = 22              # Ex-Parameter
  137.   FEATURE_SPARAM        = 23              # Sp-Parameter
  138.   FEATURE_ATK_ELEMENT   = 31              # Atk Element
  139.   FEATURE_ATK_STATE     = 32              # Atk State
  140.   FEATURE_ATK_SPEED     = 33              # Atk Speed
  141.   FEATURE_ATK_TIMES     = 34              # Atk Times+
  142.   FEATURE_STYPE_ADD     = 41              # Add Skill Type
  143.   FEATURE_STYPE_SEAL    = 42              # Disable Skill Type
  144.   FEATURE_SKILL_ADD     = 43              # Add Skill
  145.   FEATURE_SKILL_SEAL    = 44              # Disable Skill
  146.   FEATURE_EQUIP_WTYPE   = 51              # Equip Weapon
  147.   FEATURE_EQUIP_ATYPE   = 52              # Equip Armor
  148.   FEATURE_EQUIP_FIX     = 53              # Lock Equip
  149.   FEATURE_EQUIP_SEAL    = 54              # Seal Equip
  150.   FEATURE_SLOT_TYPE     = 55              # Slot Type
  151.   FEATURE_ACTION_PLUS   = 61              # Action Times+
  152.   FEATURE_SPECIAL_FLAG  = 62              # Special Flag
  153.   FEATURE_COLLAPSE_TYPE = 63              # Collapse Effect
  154.   FEATURE_PARTY_ABILITY = 64              # Party Ability
  155.  
  156.   # Data ID's for consistency with the rest of the scripts
  157.   Weapon_ID = 0
  158.   Armor_ID = 1
  159.   Item_ID = 2
  160.  
  161.   # Data ID's for basic parameters. Use this if you are going to
  162.   # use params in note tags
  163.   Param_Table = {
  164.     "mhp" => 0,
  165.     "mmp" => 1,
  166.     "atk" => 2,
  167.     "def" => 3,
  168.     "mat" => 4,
  169.     "mdf" => 5,
  170.     "agi" => 6,
  171.     "luk" => 7
  172.   }
  173.  
  174.   # Data ID's for extra parameters.
  175.   XParam_Table = {
  176.     "hit" => 0,
  177.     "eva" => 1,
  178.     "cri" => 2,
  179.     "cev" => 3,
  180.     "mev" => 4,
  181.     "mrf" => 5,
  182.     "cnt" => 6,
  183.     "hrg" => 7,
  184.     "mrg" => 8,
  185.     "trg" => 9
  186.   }
  187.  
  188.   # Data ID's for special parameters
  189.   SParam_Table = {
  190.     "tgr" => 0,
  191.     "grd" => 1,
  192.     "rec" => 2,
  193.     "pha" => 3,
  194.     "mcr" => 4,
  195.     "tcr" => 5,
  196.     "pdr" => 6,
  197.     "mdr" => 7,
  198.     "fdr" => 8,
  199.     "exr" => 9,
  200.   }
  201.  
  202.   def self.register(idstring, api_version=1.0)
  203.     idstring = idstring.to_s
  204.     key = idstring.to_sym
  205.     if $imported["Feature_Manager"] < api_version
  206.       outdated_api_warn(idstring, api_version)
  207.     elsif @feature_table.include?(key)
  208.       dupe_entry_warn(key, @feature_table[key])
  209.     else
  210.       @feature_table[key] = idstring
  211.     end
  212.   end
  213.  
  214.   def self.api_version(version)
  215.  
  216.   end
  217.  
  218.   # Each feature maps to a code, which is stored in the feature.
  219.   # It should be a symbol. Notice that this table is only used for
  220.   # mapping and is never referenced after an object has been setup.
  221.   def self.initialize_tables
  222.     @feature_table = {
  223.       FEATURE_ELEMENT_RATE  => 11,              # Element Rate
  224.       FEATURE_DEBUFF_RATE   => 12,              # Debuff Rate
  225.       FEATURE_STATE_RATE    => 13,              # State Rate
  226.       FEATURE_STATE_RESIST  => 14,              # State Resist
  227.       FEATURE_PARAM         => 21,              # Parameter
  228.       FEATURE_XPARAM        => 22,              # Ex-Parameter
  229.       FEATURE_SPARAM        => 23,              # Sp-Parameter
  230.       FEATURE_ATK_ELEMENT   => 31,              # Atk Element
  231.       FEATURE_ATK_STATE     => 32,              # Atk State
  232.       FEATURE_ATK_SPEED     => 33,              # Atk Speed
  233.       FEATURE_ATK_TIMES     => 34,              # Atk Times+
  234.       FEATURE_STYPE_ADD     => 41,              # Add Skill Type
  235.       FEATURE_STYPE_SEAL    => 42,              # Disable Skill Type
  236.       FEATURE_SKILL_ADD     => 43,              # Add Skill
  237.       FEATURE_SKILL_SEAL    => 44,              # Disable Skill
  238.       FEATURE_EQUIP_WTYPE   => 51,              # Equip Weapon
  239.       FEATURE_EQUIP_ATYPE   => 52,              # Equip Armor
  240.       FEATURE_EQUIP_FIX     => 53,              # Lock Equip
  241.       FEATURE_EQUIP_SEAL    => 54,              # Seal Equip
  242.       FEATURE_SLOT_TYPE     => 55,              # Slot Type
  243.       FEATURE_ACTION_PLUS   => 61,              # Action Times+
  244.       FEATURE_SPECIAL_FLAG  => 62,              # Special Flag
  245.       FEATURE_COLLAPSE_TYPE => 63,              # Collapse Effect
  246.       FEATURE_PARTY_ABILITY => 64,              # Party Ability
  247.  
  248.       # Aliasing the above features with custom names to support conditionals
  249.       :element_rate         => "element_rate",
  250.       :debuff_rate          => "debuff_rate",
  251.       :state_rate           => "state_rate",
  252.       :state_resist         => "state_resist",
  253.       :param                => "param",
  254.       :xparam               => "xparam",
  255.       :sparam               => "sparam",
  256.       :atk_element          => "atk_element",
  257.       :atk_state            => "atk_state",
  258.       :atk_speed            => "atk_speed",
  259.       :atk_times            => "atk_times",
  260.       :stype_add            => "stype_add",
  261.       :stype_seal           => "stype_seal",
  262.       :skill_add            => "skill_add",
  263.       :skill_seal           => "skill_seal",
  264.       :equip_wtype          => "equip_wtype",
  265.       :equip_atype          => "equip_atype",
  266.       :equip_fix            => "equip_fix",
  267.       :equip_seal           => "equip_seal",
  268.       :slot_type            => "slot_type",
  269.       :action_plus          => "action_plus",
  270.       :special_flag         => "special_flag",
  271.       :collapse_type        => "collapse_type",
  272.       :party_ability        => "party_ability"
  273.     }
  274.  
  275.     @element_tables = {}
  276.  
  277.   end
  278.  
  279.   # Returns the feature code for the particular string.
  280.   def self.get_feature_code(sym)
  281.     @feature_table[sym]
  282.   end
  283.  
  284.   def self.dupe_entry_warn(your_id, existing_name)
  285.     msgbox("Warning: %s has already been reserved" %[existing_name.to_s])
  286.   end
  287.  
  288.   def self.outdated_api_warn(idstring, version)
  289.     msgbox("Warning: `%s` feature requires version %.2f of the script" %[idstring, version])
  290.   end
  291.  
  292.   def self.feature_table
  293.     @feature_table
  294.   end
  295.  
  296.   # Table of elements, mapped to their ID's.
  297.   def self.element_table
  298.     return @element_table unless @element_table.nil?
  299.     @element_table = {}
  300.     $data_system.elements.each_with_index {|element, i|
  301.       next if element.empty?
  302.       @element_table[element.downcase] = i
  303.     }
  304.     return @element_table
  305.   end
  306.  
  307.   # start things up
  308.   initialize_tables
  309. end
  310.  
  311. module RPG
  312.  
  313.   class BaseItem::Feature
  314.     attr_accessor :condition
  315.   end
  316.  
  317.   class BaseItem
  318.     def features
  319.       load_notetag_feature_manager unless @feature_checked
  320.       return @features
  321.     end
  322.  
  323.     # Go through each line looking for custom features. Note that the data id
  324.     # is currently hardcoded to 0 since we don't really need it.
  325.     def load_notetag_feature_manager
  326.       @feature_checked = true
  327.  
  328.       #check for features
  329.       results = self.note.scan(FeatureManager::Feature_Regex)
  330.       results.each { |code, args|
  331.         code = FeatureManager.get_feature_code(code.to_sym)
  332.         if code
  333.           check_feature(code, args)
  334.         end
  335.       }
  336.  
  337.       # check for conditional features
  338.       results = self.note.scan(FeatureManager::Cond_Feature_Regex)
  339.       results.each {|code, cond, args|
  340.         code = FeatureManager.get_feature_code(code.to_sym)
  341.         if code
  342.           check_feature(code, args)
  343.           @features[-1].condition = cond
  344.         end
  345.       }
  346.  
  347.       # check for features using extended regex.
  348.       results = self.note.scan(FeatureManager::Ext_Regex)
  349.       results.each do |res|
  350.         args = {}
  351.         code = FeatureManager.get_feature_code(res[0].to_sym)
  352.         if code
  353.           data = res[1].strip.split("\r\n")
  354.           data.each do |option|
  355.             name, value = option.split(":")
  356.             args[name.strip.to_sym] = value.strip
  357.           end
  358.           check_feature_ext(code, args)
  359.         end
  360.       end
  361.     end
  362.  
  363.     def check_feature(code, args)
  364.       ft_code = code.is_a?(Fixnum) ? code : code.to_sym
  365.       if respond_to?("add_feature_#{code}")
  366.         send("add_feature_#{code}", ft_code, 0, args.split)
  367.       else
  368.         add_feature(ft_code, 0, args.split)
  369.       end
  370.     end
  371.  
  372.     def check_feature_ext(code, args)
  373.       ft_code = code.is_a?(Fixnum) ? code : code.to_sym
  374.       if respond_to?("add_feature_#{code}_ext")
  375.         send("add_feature_#{code}_ext", ft_code, 0, args)
  376.       else
  377.         add_feature(ft_code, 0, args)
  378.       end
  379.     end
  380.  
  381.     def add_feature(code, data_id, args)
  382.       @features.push(RPG::BaseItem::Feature.new(code, data_id, args))
  383.     end
  384.  
  385.     # Register default features. Redundant, but the editor hardcodes values
  386.     # so we must do the same
  387.  
  388.     # Args: element name (case-sensitive) or ID, float percentage
  389.     def add_feature_element_rate(code, data_id, args)
  390.       data_id = Integer(args[0]) rescue $data_system.elements.index(args[0])
  391.       add_feature(11, data_id, args[1].to_f)
  392.     end
  393.  
  394.     # Args: param name, float percentage
  395.     def add_feature_debuff_rate(code, data_id, args)
  396.       data_id = FeatureManager::Param_Table[args[0].downcase]
  397.       add_feature(12, data_id, args[1].to_f)
  398.     end
  399.  
  400.     # Args: state ID, float percentage
  401.     def add_feature_state_rate(code, data_id, args)
  402.       data_id = Integer(args[0])
  403.       add_feature(13, data_id, args[1].to_f)
  404.     end
  405.  
  406.     # Args: state ID, float percentage
  407.     def add_feature_state_resist(code, data_id, args)
  408.       data_id = Integer(args[0])
  409.       add_feature(14, data_id, args[1].to_f)
  410.     end
  411.  
  412.     # Args: param name, float percentage
  413.     def add_feature_param(code, data_id, args)
  414.       data_id = FeatureManager::Param_Table[args[0].downcase]
  415.       add_feature(21, data_id, args[1].to_f)
  416.     end
  417.  
  418.     # Args: sparam name, float percentage
  419.     def add_feature_xparam(code, data_id, args)
  420.       data_id = FeatureManager::XParam_Table[args[0].downcase]
  421.       add_feature(22, data_id, args[1].to_f)
  422.     end
  423.  
  424.     # Args: xparam name, float percentage
  425.     def add_feature_sparam(code, data_id, args)
  426.       data_id = FeatureManager::SParam_Table[args[0].downcase]
  427.       add_feature(23, data_id, args[1].to_f)
  428.     end
  429.  
  430.     # Args: param name, float percentage
  431.     def add_feature_atk_element(code, data_id, args)
  432.       data_id = Integer(args[0]) rescue $data_system.elements.index(args[0])
  433.       add_feature(31, data_id, args[1].to_f)
  434.     end
  435.  
  436.     # Args: state ID, float percentage
  437.     def add_feature_atk_state(code, data_id, args)
  438.       data_id = Integer(args[0])
  439.       add_feature(32, data_id, args[1].to_f)
  440.     end
  441.  
  442.     # Args: float attack speed
  443.     def add_feature_atk_speed(code, data_id, args)
  444.       add_feature(33, 0, args[1].to_f)
  445.     end
  446.  
  447.     # Args: float attack times
  448.     def add_feature_atk_times(code, data_id, args)
  449.       add_feature(34, 0, args[1].to_f)
  450.     end
  451.  
  452.     # Args: stype ID or name
  453.     def add_feature_stype_add(code, data_id, args)
  454.       data_id = Integer(args[0]) rescue $data_system.skill_types.index(args[0])
  455.       add_feature(41, data_id, 0)
  456.     end
  457.  
  458.     def add_feature_stype_seal(code, data_id, args)
  459.       data_id = Integer(args[0]) rescue $data_system.skill_types.index(args[0])
  460.       add_feature(42, data_id, 0.0)
  461.     end
  462.  
  463.     def add_feature_skill_add(code, data_id, args)
  464.       add_feature(43, args[0].to_i, 0.0)
  465.     end
  466.  
  467.     def add_feature_skill_seal(code, data_id, args)
  468.       add_feature(44, args[0].to_i, 0.0)
  469.     end
  470.  
  471.     def add_feature_equip_wtype(code, data_id, args)
  472.       data_id = Integer(args[0]) rescue $data_system.weapon_types.index(args[0])
  473.       add_feature(51, data_id, 0)
  474.     end
  475.  
  476.     def add_feature_equip_atype(code, data_id, args)
  477.       data_id = Integer(args[0]) rescue $data_system.armor_types.index(args[0])
  478.       add_feature(52, data_id, 0)
  479.     end
  480.  
  481.     # args: etype_id
  482.     def add_feature_equip_fix(code, data_id, args)
  483.       add_feature(53, args[0].to_i, 0)
  484.     end
  485.  
  486.     # args: etype_id
  487.     def add_feature_equip_seal(code, data_id, args)
  488.       add_feature(54, args[0].to_i, 0)
  489.     end
  490.  
  491.     # args: slot type (1 for dual wield)
  492.     def add_feature_slot_type(code, data_id, args)
  493.       add_feature(55, args[0].to_i, 0)
  494.     end
  495.  
  496.     def add_feature_action_plus(code, data_id, args)
  497.       add_feature(61, 0, args[0].to_f)
  498.     end
  499.  
  500.     # args: flag_ID
  501.     def add_feature_special_flag(code, data_id, args)
  502.       add_feature(62, args[0].to_i, 0)
  503.     end
  504.  
  505.     # args: collapse type ID
  506.     def add_feature_collapse_type(code, data_id, args)
  507.       add_feature(63, args[0].to_i, 0)
  508.     end
  509.  
  510.     # args: party ability ID
  511.     def add_feature_party_ability(code, data_id, args)
  512.       add_feature(64, args[0].to_i, 0)
  513.     end
  514.   end
  515. end
  516.  
  517. class Game_BattlerBase
  518.  
  519.   #-----------------------------------------------------------------------------
  520.   # * Feature collection methods
  521.   #-----------------------------------------------------------------------------
  522.  
  523.   def eval_feature_condition(condition, a, v=$game_variables, s=$game_switches)
  524.     eval(condition) rescue false
  525.   end
  526.  
  527.   def feature_condition_met?(ft)
  528.     return true unless ft.condition
  529.     eval_feature_condition(ft.condition, self)
  530.   end
  531.  
  532.   # May be inefficient since this method is called all the time
  533.   alias :th_feature_manager_all_features :all_features
  534.   def all_features
  535.     th_feature_manager_all_features.select {|ft| feature_condition_met?(ft)}
  536.   end
  537.  
  538.   # Returns features for item filtered by code
  539.   def item_features(item, code)
  540.     item.features.select {|ft| ft.code == code && feature_condition_met?(ft)}
  541.   end
  542.  
  543.   # Returns a set of all values for the given feature code
  544.   def features_value_set(code)
  545.     features(code).inject([]) {|r, ft| r |= [ft.value] }
  546.   end
  547.  
  548.   # Returns a set of all values for the given feature code, filtered by data ID
  549.   def features_value_set_with_id(code, data_id)
  550.     features_with_id(code, data_id).inject([]) {|r, ft| r |= [ft.value]}
  551.   end
  552.  
  553.   # Returns features for item filtered by code and data ID
  554.   def item_features_with_id(item, code, data_id)
  555.     item.features.select {|ft| ft.code == code && ft.data_id == data_id}
  556.   end
  557.  
  558.   def item_features_set(item, code, data_id)
  559.     item_features_with_id(item, code, data_id).inject([]) {|r, ft| r |= [ft.value]}
  560.   end
  561.  
  562.   # Returns sum of all features for item, by code and data ID
  563.   def item_features_sum(item, code, data_id)
  564.     item_features_with_id(item, code, data_id).inject(0.0) {|r, ft| r += ft.value }
  565.   end
  566.  
  567.   # Returns the max value for the code
  568.   def features_max(code)
  569.     features(code).collect {|ft| ft.value}.max
  570.   end
  571.  
  572.   # Returns the max value for the code, filtered by ID
  573.   def features_max_with_id(code, data_id)
  574.     features_with_id(code, data_id).collect {|ft| ft.value}.max
  575.   end
  576.  
  577.   # Returns the min value for the given code
  578.   def features_min(code)
  579.     features(code).collect {|ft| ft.value}.min
  580.   end
  581.  
  582.   # Returns the min value for the given code, filtered by ID
  583.   def features_min_with_id(code, data_id)
  584.     features_with_id(code, data_id).collect {|ft| ft.value}.min
  585.   end
  586.  
  587.   # Returns the max value of features for item, filtered by code and ID
  588.   def item_features_max(item, code, data_id)
  589.     item_features_with_id(item, code, data_id).collect {|ft| ft.value}.max
  590.   end
  591.  
  592.   # Returns the min value of features for item, filtered by code and ID
  593.   def item_features_min(item, code, data_id)
  594.     item_features_with_id(item, code, data_id).collect {|ft| ft.value}.min
  595.   end
  596.   #-----------------------------------------------------------------------------
  597.   # * Equip conditions
  598.   #-----------------------------------------------------------------------------
  599.  
  600.   alias :feature_manager_equippable? :equippable?
  601.   def equippable?(item)
  602.     return false unless feature_manager_equippable?(item)
  603.     return false if item.is_a?(RPG::Weapon) && !feature_equip_weapon_ok?(item)
  604.     return false if item.is_a?(RPG::Armor) && !feature_equip_armor_ok?(item)
  605.     return true
  606.   end
  607.  
  608.   def feature_equip_weapon_ok?(item)
  609.     return true
  610.   end
  611.  
  612.   def feature_equip_armor_ok?(item)
  613.     return true
  614.   end
  615. end
  616.  
  617. class Game_Party
  618.   attr_accessor :actors
  619. end

RUBY 代码复制
  1. =begin
  2. #==============================================================================
  3.  ** Feature: Max TP
  4.  Author: Hime
  5.  Date: Oct 13, 2012
  6. ------------------------------------------------------------------------------
  7.  ** Change log
  8.  Oct 13, 2012
  9.    - initial release
  10. ------------------------------------------------------------------------------   
  11.  ** Terms of Use
  12.  * Free to use in non-commercial projects
  13.  * Contact me for commercial use
  14.  * No real support. The script is provided as-is
  15.  * Will do bug fixes, but no compatibility patches
  16.  * Features may be requested but no guarantees, especially if it is non-trivial
  17.  * Preserve this header
  18. ------------------------------------------------------------------------------
  19.  ** Required
  20.  -Feature Manager
  21.  ([url]http://xtsukihime.com/2012/10/13/feature-manager/[/url])
  22.  
  23.  -Core: Damage Processing
  24.  ([url]http://xtsukihime.com/2012/10/13/core-damage-processing/[/url])
  25. ------------------------------------------------------------------------------
  26.  Increases your max TP by some value
  27.  
  28.  Tag objects with
  29.     <ft: max_tp x>
  30.     
  31.  For some integer x. Your max TP will be increased by x.
  32. #==============================================================================
  33. =end
  34. $imported = {} if $imported.nil?
  35. $imported["Feature_MaxTP"] = true
  36. #==============================================================================
  37. # ** Rest of the script
  38. #==============================================================================
  39. module Features
  40.   module Max_TP
  41.     FeatureManager.register(:max_tp)
  42.   end
  43. end
  44.  
  45. class RPG::BaseItem
  46.  
  47.   def add_feature_max_tp(code, data_id, args)
  48.     data_id = 0
  49.     value = args[0].to_i
  50.     add_feature(code, data_id, value)
  51.   end
  52. end
  53.  
  54. class Game_BattlerBase
  55.  
  56.   def tp_rate
  57.     #@tp.to_f / 100
  58.     max_tp > 0 ? @tp.to_f / max_tp : 0
  59.   end
  60.  
  61.   alias :ft_max_tp_max :max_tp
  62.   def max_tp
  63.     return [ft_max_tp_max + features_sum(:max_tp, 0), 0].max
  64.   end
  65. end
回复

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7028
在线时间
878 小时
注册时间
2015-2-10
帖子
248
3
 楼主| 发表于 2020-9-1 09:11:15 | 只看该作者
alexncf125 发表于 2020-8-31 13:01
先插入Hime的Feature Manager和Max TP
http://himeworks.com/2012/10/feature-manager/
https://www.rpgmak ...

这两个网页我打不开啊。
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-29 04:42

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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