查看: 2700|回复: 1

[原创发布] 【低创】将抗性降到0以下的插件

[复制链接]
梦石
0
星屑
635
在线时间
24 小时
注册时间
2020-4-22
回帖
23
发表于 2020-11-14 21:58:04 | 显示全部楼层 |阅读模式

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

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

×
抗性降到0以下,也就是越打血越多
这种抖m行为不符合大众的价值观,于是就被禁止了
  1. =begin
  2. 伤害吸收插件
  3. by 炽天裁决
  4. 挨打回血,天子快乐插件
  5. 使用说明
  6. 在备注栏填入<dam_absorb: 属性:抗性数值(,+)>
  7. 例如<dam_absorb: 3:-0.5,1:0.2>
  8. 属性中 -1 代表普通攻击,0,代表无属性
  9. 填入低于 -1 的值可以适用于所有伤害
  10. 游戏中,持有此装备/状态/职业/角色ID的角色会用备注中的抗性结算(会覆盖掉原有的设定)
  11. 所有抗性会在全部抗性中取最优(这一点和预设是相反的,不然无法实现效果)
  12. =end

  13. class RPG::BaseItem

  14.   def dam_absorb
  15.     if @dam_absorb.nil?
  16.           @dam_absorb = []
  17.           if @note =~ /<dam_absorb:[ ](.*)>/i
  18.             for x in $1.split(",")
  19.         a = []
  20.         for y in x.split(":")
  21.           a += [y.to_f]
  22.         end
  23.                   @dam_absorb += [a]
  24.             end
  25.           end
  26.     end
  27.     @dam_absorb
  28.   end

  29. end
  30. class Game_Battler
  31.   alias absorb_element_rate element_rate
  32.   def element_rate(i)
  33.     r = e_absorb_value(i)
  34.     er = absorb_element_rate(i)
  35.     if r != nil
  36.       er = r if r < er
  37.     end
  38.    
  39.     return er
  40.   end
  41.   
  42.   def item_element_rate(user, item)
  43.     r = nil
  44.     a = element_absorb
  45.     a.each{|x|
  46.     if x[0] < -1
  47.       r = x[1] if r == nil
  48.       r = x[1] if x[1] <= r
  49.     end
  50.     }
  51.     if item.damage.element_id < 0
  52.       if user.atk_elements.empty?
  53.         er = element_rate(-1)
  54.       else
  55.         er = elements_max_rate(user.atk_elements)
  56.       end
  57.     else
  58.       er = element_rate(item.damage.element_id)
  59.     end
  60.     if r != nil
  61.       er = r if r < er
  62.     end
  63.    
  64.     return er
  65.   end

  66.   def elements_max_rate(elements)
  67.     r = elements.inject([]) {|r, i| r.push(element_rate(i)) }.min
  68.     r = 1.0 if r == nil
  69.     return r
  70.   end
  71.   
  72.   def element_absorb
  73.     return []
  74.   end
  75.   def e_absorb_value(id)
  76.     r = nil
  77.     absorb = element_absorb
  78.     absorb.each{|i|
  79.       if i[0] == id
  80.         r = i[1] if r == nil
  81.         r = i[1] if i[1] < r
  82.       end
  83.       }
  84.     return r
  85.   end
  86.   
  87. end
  88. class Game_Actor < Game_Battler
  89.   def element_absorb
  90.     absorb = self.class.dam_absorb + actor.dam_absorb
  91.     equips.each do |eq|
  92.           absorb += eq.dam_absorb unless eq.nil?
  93.     end
  94.     states.each do |st|
  95.           absorb += st.dam_absorb
  96.     end
  97.     absorb  = absorb .uniq
  98.     return absorb
  99.   end
  100. end

  101. class Game_Enemy < Game_Battler
  102.   def element_absorb
  103.     absorb = enemy.dam_absorb
  104.     states.each do |st|
  105.           absorb += st.dam_absorb
  106.     end
  107.     absorb  = absorb .uniq
  108.     return absorb
  109.   end
  110. end
复制代码


无技术含量,权当是记录生活吧





梦石
0
星屑
30103
在线时间
5741 小时
注册时间
2016-3-8
回帖
1662
发表于 2020-11-14 22:34:32 | 显示全部楼层
本帖最后由 alexncf125 于 2020-11-15 21:15 编辑

https://www.rpgmakercentral.com/ ... b-elemental-damage/

如何吸收元素伤害

在数据库编辑器中,您将找到一个称为“元素率”的功能。

因此,如果我们将百分比视为乘数,我们将得到

0%= 0#乘以0,即:无损坏
50%= 0.5#乘以0.5,即:一半伤害
100%= 1.0#乘以1.0,即:完全伤害
200%= 2.0#乘以2.0,即:双倍伤害

但是,具有负元素率意味着什么呢?

-50%= -0.5

这意味着伤害将乘以负数,这意味着目标实际上得到了治愈。

数据库编辑器不支持负值。但是,使用功能管理器(http://himeworks.com/2012/10/13/feature-manager/),这不是问题。

点击展开/收起
  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. This script does not overwrite any methods and aliases one method.
  41. Most features should not have conflicts with the following systems

  42. -Tankentai SBS
  43. -Yanfly Ace Battle Engine
  44. --------------------------------------------------------------------------------
  45. ** Description

  46. This is a plugin-based feature system that allows you to define your own
  47. features easily and add them to database objects.

  48. Register a feature using an idstring to identify your feature. Recommended
  49. strings or symbols, but anything hashable is valid.

  50. You will use the idstring throughout your script, such as in notetags
  51. and also initializing the feature (optional).

  52. If your script will be using params, xparams, or sparams, you should use
  53. standard data ID's that the rest of the script uses. These are defined in
  54. the tables below.

  55. You should use data ID 0 for weapons, 1 for armors, and 2 for items.
  56. --------------------------------------------------------------------------------
  57. ** Usage

  58. To add a feature to a feature object, simply note-tag with a feature tag.
  59. The general syntax for a feature tag is

  60.     <ft: name arg1 arg2 ... >
  61.    
  62. Where
  63.    `name` is the name of the feature you wish to add
  64.    `arg1 arg2 ...` are a list of arguments that the plugin requires
  65.    
  66. You may specify conditional features as well, using the following note-tag

  67.     <cond_ft: name "cond" arg1 arg2 ... >
  68.    
  69. Where
  70.    `cond` is a ruby expression that evaluates to true or false. The condition
  71.           must be surrounded by quotation marks.
  72.          
  73. Conditional features can be applied to any feature that is supported by this
  74. system.

  75. If you need more control over the note-tag, you can use the extended note-tag

  76.    <ft: FEATURE_NAME>
  77.      option1: value1
  78.      option2: value2
  79.      ...
  80.    </ft>
  81.    
  82. You can define any option name that you want. All options will be passed to
  83. your `add_feature` method as a hash, where the keys are the option names and
  84. the values are the corresponding values. For example, the above example
  85. would create a hash that looks like

  86.    {
  87.      :option1 => value1,
  88.      :option2 => value2
  89.    }
  90.    
  91. Which you can then use to grab values.
  92. To work with your extended note-tag, you need to define the following method
  93. in BaseItem or its child classes:

  94.    def add_feature_FEATURE_NAME_ext(code, data_id, args)
  95.      
  96.      # do something with your args
  97.      value = ...
  98.      add_feature(code, data_id, value)
  99.    end

  100. #===============================================================================
  101. =end
  102. $imported = {} if $imported.nil?
  103. $imported["Feature_Manager"] = 2.0
  104. #===============================================================================
  105. # ** Rest of the script
  106. #===============================================================================
  107. module FeatureManager

  108.   # Format for all note tags
  109.   Feature_Regex = /<ft: (\w+)(.*)>/i
  110.   Cond_Feature_Regex = /<cond_ft: (\w+) ['"](.*)['"](.*)>/i
  111.   
  112.   Ext_Regex = /<feature: (\w+)>(.*?)<\/feature>/im
  113.   
  114.   # Default features.
  115.   FEATURE_ELEMENT_RATE  = 11              # Element Rate
  116.   FEATURE_DEBUFF_RATE   = 12              # Debuff Rate
  117.   FEATURE_STATE_RATE    = 13              # State Rate
  118.   FEATURE_STATE_RESIST  = 14              # State Resist
  119.   FEATURE_PARAM         = 21              # Parameter
  120.   FEATURE_XPARAM        = 22              # Ex-Parameter
  121.   FEATURE_SPARAM        = 23              # Sp-Parameter
  122.   FEATURE_ATK_ELEMENT   = 31              # Atk Element
  123.   FEATURE_ATK_STATE     = 32              # Atk State
  124.   FEATURE_ATK_SPEED     = 33              # Atk Speed
  125.   FEATURE_ATK_TIMES     = 34              # Atk Times+
  126.   FEATURE_STYPE_ADD     = 41              # Add Skill Type
  127.   FEATURE_STYPE_SEAL    = 42              # Disable Skill Type
  128.   FEATURE_SKILL_ADD     = 43              # Add Skill
  129.   FEATURE_SKILL_SEAL    = 44              # Disable Skill
  130.   FEATURE_EQUIP_WTYPE   = 51              # Equip Weapon
  131.   FEATURE_EQUIP_ATYPE   = 52              # Equip Armor
  132.   FEATURE_EQUIP_FIX     = 53              # Lock Equip
  133.   FEATURE_EQUIP_SEAL    = 54              # Seal Equip
  134.   FEATURE_SLOT_TYPE     = 55              # Slot Type
  135.   FEATURE_ACTION_PLUS   = 61              # Action Times+
  136.   FEATURE_SPECIAL_FLAG  = 62              # Special Flag
  137.   FEATURE_COLLAPSE_TYPE = 63              # Collapse Effect
  138.   FEATURE_PARTY_ABILITY = 64              # Party Ability
  139.   
  140.   # Data ID's for consistency with the rest of the scripts
  141.   Weapon_ID = 0
  142.   Armor_ID = 1
  143.   Item_ID = 2
  144.   
  145.   # Data ID's for basic parameters. Use this if you are going to
  146.   # use params in note tags
  147.   Param_Table = {
  148.     "mhp" => 0,
  149.     "mmp" => 1,
  150.     "atk" => 2,
  151.     "def" => 3,
  152.     "mat" => 4,
  153.     "mdf" => 5,
  154.     "agi" => 6,
  155.     "luk" => 7
  156.   }
  157.    
  158.   # Data ID's for extra parameters.
  159.   XParam_Table = {
  160.     "hit" => 0,
  161.     "eva" => 1,
  162.     "cri" => 2,
  163.     "cev" => 3,
  164.     "mev" => 4,
  165.     "mrf" => 5,
  166.     "cnt" => 6,
  167.     "hrg" => 7,
  168.     "mrg" => 8,
  169.     "trg" => 9
  170.   }
  171.   
  172.   # Data ID's for special parameters
  173.   SParam_Table = {
  174.     "tgr" => 0,
  175.     "grd" => 1,
  176.     "rec" => 2,
  177.     "pha" => 3,
  178.     "mcr" => 4,
  179.     "tcr" => 5,
  180.     "pdr" => 6,
  181.     "mdr" => 7,
  182.     "fdr" => 8,
  183.     "exr" => 9,
  184.   }
  185.   
  186.   def self.register(idstring, api_version=1.0)
  187.     idstring = idstring.to_s
  188.     key = idstring.to_sym
  189.     if $imported["Feature_Manager"] < api_version
  190.       outdated_api_warn(idstring, api_version)
  191.     elsif @feature_table.include?(key)
  192.       dupe_entry_warn(key, @feature_table[key])
  193.     else
  194.       @feature_table[key] = idstring
  195.     end
  196.   end
  197.   
  198.   def self.api_version(version)
  199.    
  200.   end
  201.   
  202.   # Each feature maps to a code, which is stored in the feature.
  203.   # It should be a symbol. Notice that this table is only used for
  204.   # mapping and is never referenced after an object has been setup.
  205.   def self.initialize_tables
  206.     @feature_table = {
  207.       FEATURE_ELEMENT_RATE  => 11,              # Element Rate
  208.       FEATURE_DEBUFF_RATE   => 12,              # Debuff Rate
  209.       FEATURE_STATE_RATE    => 13,              # State Rate
  210.       FEATURE_STATE_RESIST  => 14,              # State Resist
  211.       FEATURE_PARAM         => 21,              # Parameter
  212.       FEATURE_XPARAM        => 22,              # Ex-Parameter
  213.       FEATURE_SPARAM        => 23,              # Sp-Parameter
  214.       FEATURE_ATK_ELEMENT   => 31,              # Atk Element
  215.       FEATURE_ATK_STATE     => 32,              # Atk State
  216.       FEATURE_ATK_SPEED     => 33,              # Atk Speed
  217.       FEATURE_ATK_TIMES     => 34,              # Atk Times+
  218.       FEATURE_STYPE_ADD     => 41,              # Add Skill Type
  219.       FEATURE_STYPE_SEAL    => 42,              # Disable Skill Type
  220.       FEATURE_SKILL_ADD     => 43,              # Add Skill
  221.       FEATURE_SKILL_SEAL    => 44,              # Disable Skill
  222.       FEATURE_EQUIP_WTYPE   => 51,              # Equip Weapon
  223.       FEATURE_EQUIP_ATYPE   => 52,              # Equip Armor
  224.       FEATURE_EQUIP_FIX     => 53,              # Lock Equip
  225.       FEATURE_EQUIP_SEAL    => 54,              # Seal Equip
  226.       FEATURE_SLOT_TYPE     => 55,              # Slot Type
  227.       FEATURE_ACTION_PLUS   => 61,              # Action Times+
  228.       FEATURE_SPECIAL_FLAG  => 62,              # Special Flag
  229.       FEATURE_COLLAPSE_TYPE => 63,              # Collapse Effect
  230.       FEATURE_PARTY_ABILITY => 64,              # Party Ability
  231.       
  232.       # Aliasing the above features with custom names to support conditionals
  233.       :element_rate         => "element_rate",
  234.       :debuff_rate          => "debuff_rate",
  235.       :state_rate           => "state_rate",
  236.       :state_resist         => "state_resist",
  237.       :param                => "param",
  238.       :xparam               => "xparam",
  239.       :sparam               => "sparam",
  240.       :atk_element          => "atk_element",
  241.       :atk_state            => "atk_state",
  242.       :atk_speed            => "atk_speed",
  243.       :atk_times            => "atk_times",
  244.       :stype_add            => "stype_add",
  245.       :stype_seal           => "stype_seal",
  246.       :skill_add            => "skill_add",
  247.       :skill_seal           => "skill_seal",
  248.       :equip_wtype          => "equip_wtype",
  249.       :equip_atype          => "equip_atype",
  250.       :equip_fix            => "equip_fix",
  251.       :equip_seal           => "equip_seal",
  252.       :slot_type            => "slot_type",
  253.       :action_plus          => "action_plus",
  254.       :special_flag         => "special_flag",
  255.       :collapse_type        => "collapse_type",
  256.       :party_ability        => "party_ability"
  257.     }
  258.    
  259.     @element_tables = {}
  260.    
  261.   end
  262.   
  263.   # Returns the feature code for the particular string.
  264.   def self.get_feature_code(sym)
  265.     @feature_table[sym]
  266.   end
  267.   
  268.   def self.dupe_entry_warn(your_id, existing_name)
  269.     msgbox("Warning: %s has already been reserved" %[existing_name.to_s])
  270.   end
  271.   
  272.   def self.outdated_api_warn(idstring, version)
  273.     msgbox("Warning: `%s` feature requires version %.2f of the script" %[idstring, version])
  274.   end
  275.   
  276.   def self.feature_table
  277.     @feature_table
  278.   end
  279.   
  280.   # Table of elements, mapped to their ID's.
  281.   def self.element_table
  282.     return @element_table unless @element_table.nil?
  283.     @element_table = {}
  284.     $data_system.elements.each_with_index {|element, i|
  285.       next if element.empty?
  286.       @element_table[element.downcase] = i
  287.     }
  288.     return @element_table
  289.   end
  290.   
  291.   # start things up
  292.   initialize_tables
  293. end

  294. module RPG
  295.   
  296.   class BaseItem::Feature
  297.     attr_accessor :condition
  298.   end

  299.   class BaseItem
  300.     def features
  301.       load_notetag_feature_manager unless @feature_checked
  302.       return @features
  303.     end
  304.    
  305.     # Go through each line looking for custom features. Note that the data id
  306.     # is currently hardcoded to 0 since we don't really need it.
  307.     def load_notetag_feature_manager
  308.       @feature_checked = true
  309.       
  310.       #check for features
  311.       results = self.note.scan(FeatureManager::Feature_Regex)
  312.       results.each { |code, args|
  313.         code = FeatureManager.get_feature_code(code.to_sym)
  314.         if code
  315.           check_feature(code, args)
  316.         end
  317.       }
  318.       
  319.       # check for conditional features
  320.       results = self.note.scan(FeatureManager::Cond_Feature_Regex)
  321.       results.each {|code, cond, args|
  322.         code = FeatureManager.get_feature_code(code.to_sym)
  323.         if code
  324.           check_feature(code, args)
  325.           @features[-1].condition = cond
  326.         end
  327.       }
  328.       
  329.       # check for features using extended regex.
  330.       results = self.note.scan(FeatureManager::Ext_Regex)
  331.       results.each do |res|
  332.         args = {}
  333.         code = FeatureManager.get_feature_code(res[0].to_sym)
  334.         if code
  335.           data = res[1].strip.split("\r\n")
  336.           data.each do |option|
  337.             name, value = option.split(":")
  338.             args[name.strip.to_sym] = value.strip
  339.           end
  340.           check_feature_ext(code, args)
  341.         end
  342.       end
  343.     end
  344.    
  345.     def check_feature(code, args)
  346.       ft_code = code.is_a?(Fixnum) ? code : code.to_sym
  347.       if respond_to?("add_feature_#{code}")
  348.         send("add_feature_#{code}", ft_code, 0, args.split)
  349.       else
  350.         add_feature(ft_code, 0, args.split)
  351.       end
  352.     end
  353.    
  354.     def check_feature_ext(code, args)
  355.       ft_code = code.is_a?(Fixnum) ? code : code.to_sym
  356.       if respond_to?("add_feature_#{code}_ext")
  357.         send("add_feature_#{code}_ext", ft_code, 0, args)
  358.       else
  359.         add_feature(ft_code, 0, args)
  360.       end
  361.     end
  362.    
  363.     def add_feature(code, data_id, args)
  364.       @features.push(RPG::BaseItem::Feature.new(code, data_id, args))
  365.     end
  366.    
  367.     # Register default features. Redundant, but the editor hardcodes values
  368.     # so we must do the same
  369.    
  370.     # Args: element name (case-sensitive) or ID, float percentage
  371.     def add_feature_element_rate(code, data_id, args)
  372.       data_id = Integer(args[0]) rescue $data_system.elements.index(args[0])
  373.       add_feature(11, data_id, args[1].to_f)
  374.     end
  375.    
  376.     # Args: param name, float percentage
  377.     def add_feature_debuff_rate(code, data_id, args)
  378.       data_id = FeatureManager::Param_Table[args[0].downcase]
  379.       add_feature(12, data_id, args[1].to_f)
  380.     end
  381.    
  382.     # Args: state ID, float percentage
  383.     def add_feature_state_rate(code, data_id, args)
  384.       data_id = Integer(args[0])
  385.       add_feature(13, data_id, args[1].to_f)
  386.     end
  387.    
  388.     # Args: state ID, float percentage
  389.     def add_feature_state_resist(code, data_id, args)
  390.       data_id = Integer(args[0])
  391.       add_feature(14, data_id, args[1].to_f)
  392.     end
  393.    
  394.     # Args: param name, float percentage
  395.     def add_feature_param(code, data_id, args)
  396.       data_id = FeatureManager::Param_Table[args[0].downcase]
  397.       add_feature(21, data_id, args[1].to_f)
  398.     end
  399.    
  400.     # Args: sparam name, float percentage
  401.     def add_feature_xparam(code, data_id, args)
  402.       data_id = FeatureManager::XParam_Table[args[0].downcase]
  403.       add_feature(22, data_id, args[1].to_f)
  404.     end
  405.    
  406.     # Args: xparam name, float percentage
  407.     def add_feature_sparam(code, data_id, args)
  408.       data_id = FeatureManager::SParam_Table[args[0].downcase]
  409.       add_feature(23, data_id, args[1].to_f)
  410.     end
  411.    
  412.     # Args: param name, float percentage
  413.     def add_feature_atk_element(code, data_id, args)
  414.       data_id = Integer(args[0]) rescue $data_system.elements.index(args[0])
  415.       add_feature(31, data_id, args[1].to_f)
  416.     end
  417.    
  418.     # Args: state ID, float percentage
  419.     def add_feature_atk_state(code, data_id, args)
  420.       data_id = Integer(args[0])
  421.       add_feature(32, data_id, args[1].to_f)
  422.     end
  423.    
  424.     # Args: float attack speed
  425.     def add_feature_atk_speed(code, data_id, args)
  426.       add_feature(33, 0, args[1].to_f)
  427.     end

  428.     # Args: float attack times
  429.     def add_feature_atk_times(code, data_id, args)
  430.       add_feature(34, 0, args[1].to_f)
  431.     end
  432.    
  433.     # Args: stype ID or name
  434.     def add_feature_stype_add(code, data_id, args)
  435.       data_id = Integer(args[0]) rescue $data_system.skill_types.index(args[0])
  436.       add_feature(41, data_id, 0)
  437.     end
  438.    
  439.     def add_feature_stype_seal(code, data_id, args)
  440.       data_id = Integer(args[0]) rescue $data_system.skill_types.index(args[0])
  441.       add_feature(42, data_id, 0.0)
  442.     end
  443.       
  444.     def add_feature_skill_add(code, data_id, args)
  445.       add_feature(43, args[0].to_i, 0.0)
  446.     end
  447.    
  448.     def add_feature_skill_seal(code, data_id, args)
  449.       add_feature(44, args[0].to_i, 0.0)
  450.     end
  451.    
  452.     def add_feature_equip_wtype(code, data_id, args)
  453.       data_id = Integer(args[0]) rescue $data_system.weapon_types.index(args[0])
  454.       add_feature(51, data_id, 0)
  455.     end
  456.    
  457.     def add_feature_equip_atype(code, data_id, args)
  458.       data_id = Integer(args[0]) rescue $data_system.armor_types.index(args[0])
  459.       add_feature(52, data_id, 0)
  460.     end
  461.    
  462.     # args: etype_id
  463.     def add_feature_equip_fix(code, data_id, args)
  464.       add_feature(53, args[0].to_i, 0)
  465.     end
  466.    
  467.     # args: etype_id
  468.     def add_feature_equip_seal(code, data_id, args)
  469.       add_feature(54, args[0].to_i, 0)
  470.     end
  471.    
  472.     # args: slot type (1 for dual wield)
  473.     def add_feature_slot_type(code, data_id, args)
  474.       add_feature(55, args[0].to_i, 0)
  475.     end
  476.    
  477.     def add_feature_action_plus(code, data_id, args)
  478.       add_feature(61, 0, args[0].to_f)
  479.     end
  480.    
  481.     # args: flag_ID
  482.     def add_feature_special_flag(code, data_id, args)
  483.       add_feature(62, args[0].to_i, 0)
  484.     end
  485.    
  486.     # args: collapse type ID
  487.     def add_feature_collapse_type(code, data_id, args)
  488.       add_feature(63, args[0].to_i, 0)
  489.     end
  490.    
  491.     # args: party ability ID
  492.     def add_feature_party_ability(code, data_id, args)
  493.       add_feature(64, args[0].to_i, 0)
  494.     end
  495.   end
  496. end

  497. class Game_BattlerBase
  498.   
  499.   #-----------------------------------------------------------------------------
  500.   # * Feature collection methods
  501.   #-----------------------------------------------------------------------------
  502.   
  503.   def eval_feature_condition(condition, a, v=$game_variables, s=$game_switches)
  504.     eval(condition) rescue false
  505.   end
  506.   
  507.   def feature_condition_met?(ft)
  508.     return true unless ft.condition
  509.     eval_feature_condition(ft.condition, self)
  510.   end
  511.   
  512.   # May be inefficient since this method is called all the time
  513.   alias :th_feature_manager_all_features :all_features
  514.   def all_features
  515.     th_feature_manager_all_features.select {|ft| feature_condition_met?(ft)}
  516.   end
  517.   
  518.   # Returns features for item filtered by code
  519.   def item_features(item, code)
  520.     item.features.select {|ft| ft.code == code && feature_condition_met?(ft)}
  521.   end
  522.   
  523.   # Returns a set of all values for the given feature code
  524.   def features_value_set(code)
  525.     features(code).inject([]) {|r, ft| r |= [ft.value] }
  526.   end
  527.   
  528.   # Returns a set of all values for the given feature code, filtered by data ID
  529.   def features_value_set_with_id(code, data_id)
  530.     features_with_id(code, data_id).inject([]) {|r, ft| r |= [ft.value]}
  531.   end
  532.   
  533.   # Returns features for item filtered by code and data ID
  534.   def item_features_with_id(item, code, data_id)
  535.     item.features.select {|ft| ft.code == code && ft.data_id == data_id}
  536.   end
  537.   
  538.   def item_features_set(item, code, data_id)
  539.     item_features_with_id(item, code, data_id).inject([]) {|r, ft| r |= [ft.value]}
  540.   end
  541.   
  542.   # Returns sum of all features for item, by code and data ID
  543.   def item_features_sum(item, code, data_id)
  544.     item_features_with_id(item, code, data_id).inject(0.0) {|r, ft| r += ft.value }
  545.   end
  546.   
  547.   # Returns the max value for the code
  548.   def features_max(code)
  549.     features(code).collect {|ft| ft.value}.max
  550.   end
  551.   
  552.   # Returns the max value for the code, filtered by ID
  553.   def features_max_with_id(code, data_id)
  554.     features_with_id(code, data_id).collect {|ft| ft.value}.max
  555.   end
  556.   
  557.   # Returns the min value for the given code
  558.   def features_min(code)
  559.     features(code).collect {|ft| ft.value}.min
  560.   end
  561.   
  562.   # Returns the min value for the given code, filtered by ID
  563.   def features_min_with_id(code, data_id)
  564.     features_with_id(code, data_id).collect {|ft| ft.value}.min
  565.   end
  566.   
  567.   # Returns the max value of features for item, filtered by code and ID
  568.   def item_features_max(item, code, data_id)
  569.     item_features_with_id(item, code, data_id).collect {|ft| ft.value}.max
  570.   end
  571.   
  572.   # Returns the min value of features for item, filtered by code and ID
  573.   def item_features_min(item, code, data_id)
  574.     item_features_with_id(item, code, data_id).collect {|ft| ft.value}.min
  575.   end
  576.   #-----------------------------------------------------------------------------
  577.   # * Equip conditions
  578.   #-----------------------------------------------------------------------------
  579.   
  580.   alias :feature_manager_equippable? :equippable?
  581.   def equippable?(item)
  582.     return false unless feature_manager_equippable?(item)
  583.     return false if item.is_a?(RPG::Weapon) && !feature_equip_weapon_ok?(item)
  584.     return false if item.is_a?(RPG::Armor) && !feature_equip_armor_ok?(item)
  585.     return true
  586.   end
  587.    
  588.   def feature_equip_weapon_ok?(item)
  589.     return true
  590.   end
  591.   
  592.   def feature_equip_armor_ok?(item)
  593.     return true
  594.   end
  595. end

  596. class Game_Party
  597.   attr_accessor :actors
  598. end
复制代码


只需标记一个对象

<ft:element_rate element_id rate>

其中element_id是与每个元素相对应的ID,您可以在“条款”标签中查找。

比率只是百分比,指定为浮点数。

例如,如果您希望演员吸收100%的火焰元素伤害,则可以查找元素表,然后使用

<ft:element_rate 3 -1.0>

您将需要适当地设置技能或物品的伤害元素,或确保正确设置了突袭元素的功能。 Tsukihime编辑于2015年3月20日
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部