赞 | 1 |
VIP | 0 |
好人卡 | 0 |
积分 | 4 |
经验 | 0 |
最后登录 | 2024-12-21 |
在线时间 | 89 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 392
- 在线时间
- 89 小时
- 注册时间
- 2023-7-26
- 帖子
- 16
|
- # =============================================================================
- # TheoAllen - 多属性技能
- # Version : 1.0
- # Contact : www.rpgmakerid.com
- # (This script documentation is written in informal indonesian language)
- # =============================================================================
- $imported = {} if $imported.nil?
- $imported[:Theo_MultiElements] = true
- # =============================================================================
- # CHANGE LOGS:
- # -----------------------------------------------------------------------------
- # 2013.05.05 - Started and Finished script
- # =============================================================================
- =begin
- 介绍 :
- 本脚本可以为技能设定多重属性,还可以选择计算所占比例.
-
- 使用方法:
- 如果技能有火属性,武器有斩切属性,则该技能已经有两种属性了。
- 使用技能/物品备注添加属性:
-
- <elements id: x>
- <elements id: x,x>
-
- 使用规定 :
- 署名脚本作者, TheoAllen. 你可以自由编辑此脚本,只要你不声明你是脚本的原作者
- 如果你想用此脚本于商业游戏,请和我共享收益.别忘了给我一份免费的游戏拷贝.
-
- 注意:
- 如果你对管理属性有想法,请联系我 http://theolized.blogspot.com
-
- =end
- # =============================================================================
- # 设定 :
- # =============================================================================
- module THEO
- module ELEMENTS
-
- # -----------------------------------------------------------------------
- PHYSICAL_ELEMENT = true
- # -----------------------------------------------------------------------
- # 如果你希望物理技能组合攻击属性(武器),设定为true.
- # -----------------------------------------------------------------------
-
- # -----------------------------------------------------------------------
- MAGICAL_ELEMENT = false
- # -----------------------------------------------------------------------
- # 如果你希望魔法技能组合攻击属性(武器),设定为true.
- # -----------------------------------------------------------------------
-
- # -----------------------------------------------------------------------
- CERT_HIT_ELEMENT = false
- # -----------------------------------------------------------------------
- # 如果你希望必定命中技能组合攻击属性(武器),设定为true.
- # -----------------------------------------------------------------------
-
- # -----------------------------------------------------------------------
- IGNORE_RECOVERY = true
- # -----------------------------------------------------------------------
- # 回复技能是否带属性. (回复带属性?)
- # -----------------------------------------------------------------------
-
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # 合并类型
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # 在这里设定属性的计算公式,如果这种计算方式局限性太大了,我很抱歉。
- # 如果你有建议,记得联系我:http://theolized.blogspot.com
- #
- # 嗯,如果一个技能同时拥有两种属性,且技能目标对这两种属性的抗性为50%, 100%,
- # -----------------------------------------------------------------------
- # 0 : 由最大的那个决定
- # -----------------------------------------------------------------------
- # --> 结果为 = 100%
- # -----------------------------------------------------------------------
- # 1 : 加法 / 添加
- # -----------------------------------------------------------------------
- # 公式 = 100 + (属性_1 - 100) + (属性_n - 100)
- # --> 100 + (50 - 100) + (100 - 100) = 50%
- # -----------------------------------------------------------------------
- # 2 : 平均值 / 取平均数
- # -----------------------------------------------------------------------
- # 公式 = 总抗性 / 数量
- # --> (50+100) / 2 = 75%
- # -----------------------------------------------------------------------
- # 3 : 乘法 / 相乘
- # -----------------------------------------------------------------------
- # 公式 = 100 * (属性_1/100) * (属性_n/100)
- # --> 100 * (50/100) * (100/100)
- # -----------------------------------------------------------------------
- MERGE_TYPE = 2
- # -----------------------------------------------------------------------
-
- end
- end
- # =============================================================================
- # 除非你理解否则以下勿动
- # =============================================================================
- module THEO
- module ELEMENTS
- module REGEXP
-
- ELEMENTS = /<(?:ELEMENTS_ID|elements id):[ ]*[ ]*(\d+(?:\s*,\s*\d+)*)>/i
-
- end
- end
- end
- module DataManager
-
- class << self
- alias pre_load_multiple_elements_database load_database
- end
-
- def self.load_database
- pre_load_multiple_elements_database
- load_multiple_elements
- end
-
- def self.load_multiple_elements
- [$data_skills, $data_items].each do |database|
- database.each do |obj|
- next unless obj
- obj.load_multiple_elements
- end
- end
- end
-
- end
- class RPG::UsableItem < RPG::BaseItem
- attr_accessor :elements_array
-
- def load_multiple_elements
- @elements_array = [self.damage.element_id]
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when THEO::ELEMENTS::REGEXP::ELEMENTS
- $1.scan(/\d+/).each { |num|
- @elements_array.push(num.to_i) if num.to_i > 0 }
- end
- }
- end
-
- end
- class Game_Battler < Game_BattlerBase
-
- def item_element_rate(user, item)
- return 1.0 if item.damage.recover? && THEO::ELEMENTS::IGNORE_RECOVERY
- array = make_elements_array(user, item)
- return 1.0 if array.empty?
- return calculate_element_rate(user, item, array)
- end
-
- def make_elements_array(user, item)
- array = item.elements_array.dup
- array = attack_elements_array(user, item, array)
- array
- end
-
- def attack_elements_array(user, item, array)
- return array if user.atk_elements.empty?
- array += user.atk_elements if item.physical? && THEO::ELEMENTS::PHYSICAL_ELEMENT
- array += user.atk_elements if item.magical? && THEO::ELEMENTS::MAGICAL_ELEMENT
- array += user.atk_elements if item.certain? && THEO::ELEMENTS::CERT_HIT_ELEMENT
- return array
- end
-
- def calculate_element_rate(user, item, array)
- case THEO::ELEMENTS::MERGE_TYPE
- when 0
- return elements_max_rate(array)
- when 1
- return calculate_addition_rate(array)
- when 2
- return calculate_average_rate(array)
- when 3
- return calculate_multiply_rate(array)
- else
- return 1.0
- end
- end
-
- def calculate_addition_rate(array)
- rate = 1.0
- array.each do |element|
- rate += element_rate(element) - 1.0
- end
- return rate
- end
-
- def calculate_average_rate(array)
- rate = 0.0
- array.each do |element|
- rate += element_rate(element)
- end
- puts array.size
- return rate / array.size
- end
-
- def calculate_multiply_rate(array)
- rate = 1.0
- array.each do |element|
- rate *= element_rate(element)
- end
- return rate
- end
-
- end
复制代码 |
|