Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #=============================================================================#
- # Extended Equipment Comparsion Info #
- # Version: 1.0.0 #
- # Author: Compeador #
- # Last update: 2018.10.21 #
- #=============================================================================#
- $imported = {} if $imported.nil?
- $imported["COMP_EECI"] = true
- #=============================================================================#
- # ** Update log ** #
- #-----------------------------------------------------------------------------#
- # #
- # -- 2018.10.21: First release #
- # #
- #=============================================================================#
- # ** End-User License Agreement ** #
- #-----------------------------------------------------------------------------#
- # 1. Copyright and Redistribution: #
- # All codes were written by me(Compeador), and you(the user) may edit #
- # the code for your own need without permission (duh). #
- # Redistribute this script must agreed by VaiJack8, who commissioned this #
- # script, and you must share the original version released by the author #
- # without edits. #
- # #
- # 2. Service Information: #
- # I only responsible for the edits requested by VaiJack8(the client). #
- # If you got this script from the redistribution, I'm not responsible for any #
- # bug and malfunction occurred in your project. #
- # #
- # *You can still try to request me tho, but I won't 100% guaranteed for reply #
- #=============================================================================#
- # ** User Manual ** #
- #-----------------------------------------------------------------------------#
- # > Introduction: #
- # This script will change the display of original parameter comparsion #
- # in Equip Scene when changing the equipments, instead of showing default #
- # paramters, this script will only show changed parameters, including crit. #
- # evasion...etc. #
- #=============================================================================#
- # ** Compatibility ** #
- #-----------------------------------------------------------------------------#
- # > Require keyboard input script created By Cidiomar R. Dias Junior #
- # > Compatible with YEA Equip Engine #
- # > Support comparsion with 'Equipment Set Bonuses' by Modern Algebra #
- # #
- # ** Place this script below the scripts mentioned above ** #
- #=============================================================================#
- # > Code compatibility details of classes and methods
- #
- # - Window_EquipStatus
- # .contents_height [overwrite]
- # .refresh [overwrite]
- # .draw_item [overwrite]
- # .initialize [alias] as: init_ecci
- # .update [alias] as: update_ecci
- # .update_scroll [new]
- # .compare_diff [new]
- #=============================================================================
- #------------------------------------------------------------------------------
- # * Check whether Keyboard input script imported, raise inforamtion and disable
- # the script if none.
- #------------------------------------------------------------------------------
- COMP_EECI_Enable = false
- begin
- _ = Input::KEYMAP
- rescue => NameError
- info = "Keymap is not detected, please make sure you have keyboard input" +
- " script in your project and placed in right place!\n" +
- "The EECI script will be disabled."
- msgbox(info)
- COMP_EECI_Enable = false
- end
- if COMP_EECI_Enable
- #=============================================================================
- # * Module of this script
- #=============================================================================
- module COMP
- #-------------------------------------------------------------------------
- # Abbr. of Extended Equipment Comparsion Information
- module EECI
- #--------------------------------------------------------------------------
- # * Constants (Features) from Game_BattlerBase
- # * Don't edit this unless you know what you're doing
- #--------------------------------------------------------------------------
- FEATURE_ELEMENT_RATE = Game_BattlerBase::FEATURE_ELEMENT_RATE # Element Rate
- FEATURE_DEBUFF_RATE = Game_BattlerBase::FEATURE_DEBUFF_RATE # Debuff Rate
- FEATURE_STATE_RATE = Game_BattlerBase::FEATURE_STATE_RATE # State Rate
- FEATURE_STATE_RESIST = Game_BattlerBase::FEATURE_STATE_RESIST # State Resist
- FEATURE_PARAM = Game_BattlerBase::FEATURE_PARAM # Parameter
- FEATURE_XPARAM = Game_BattlerBase::FEATURE_XPARAM # Ex-Parameter
- FEATURE_SPARAM = Game_BattlerBase::FEATURE_SPARAM # Sp-Parameter
- FEATURE_ATK_ELEMENT = Game_BattlerBase::FEATURE_ATK_ELEMENT # Atk Element
- FEATURE_ATK_STATE = Game_BattlerBase::FEATURE_ATK_STATE # Atk State
- FEATURE_ATK_SPEED = Game_BattlerBase::FEATURE_ATK_SPEED # Atk Speed
- FEATURE_ATK_TIMES = Game_BattlerBase::FEATURE_ATK_TIMES # Atk Times+
- FEATURE_STYPE_ADD = Game_BattlerBase::FEATURE_STYPE_ADD # Add Skill Type
- FEATURE_STYPE_SEAL = Game_BattlerBase::FEATURE_STYPE_SEAL # Disable Skill Type
- FEATURE_SKILL_ADD = Game_BattlerBase::FEATURE_SKILL_ADD # Add Skill
- FEATURE_SKILL_SEAL = Game_BattlerBase::FEATURE_SKILL_SEAL # Disable Skill
- FEATURE_EQUIP_WTYPE = Game_BattlerBase::FEATURE_EQUIP_WTYPE # Equip Weapon
- FEATURE_EQUIP_ATYPE = Game_BattlerBase::FEATURE_EQUIP_ATYPE # Equip Armor
- FEATURE_EQUIP_FIX = Game_BattlerBase::FEATURE_EQUIP_FIX # Lock Equip
- FEATURE_EQUIP_SEAL = Game_BattlerBase::FEATURE_EQUIP_SEAL # Seal Equip
- FEATURE_SLOT_TYPE = Game_BattlerBase::FEATURE_SLOT_TYPE # Slot Type
- FEATURE_ACTION_PLUS = Game_BattlerBase::FEATURE_ACTION_PLUS # Action Times+
- FEATURE_SPECIAL_FLAG = Game_BattlerBase::FEATURE_SPECIAL_FLAG # Special Flag
- FEATURE_COLLAPSE_TYPE = Game_BattlerBase::FEATURE_COLLAPSE_TYPE # Collapse Effect
- FEATURE_PARTY_ABILITY = Game_BattlerBase::FEATURE_PARTY_ABILITY # Party Ability
- # ---Feature Flags---
- FLAG_ID_AUTO_BATTLE = Game_BattlerBase::FLAG_ID_AUTO_BATTLE # auto battle
- FLAG_ID_GUARD = Game_BattlerBase::FLAG_ID_GUARD # guard
- FLAG_ID_SUBSTITUTE = Game_BattlerBase::FLAG_ID_SUBSTITUTE # substitute
- FLAG_ID_PRESERVE_TP = Game_BattlerBase::FLAG_ID_PRESERVE_TP # preserve TP
- #=====================================================================
- # * The scroll-up and scroll-down keybind, edit the value for your own
- # need. For example, if you want 'I' and 'K' for scroll up/down,
- # edit the
- # 'Input::KEYMAP[:LETTER_R]' to 'Input::KEYMAP[:LETTER_I]' and
- # 'Input::KEYMAP[:LETTER_F]' to 'Input::KEYMAP[:LETTER_K]'.
- # Take a look at the keyboard script for all supported key and symbol
- #=====================================================================
- Key_scrollup = Input::KEYMAP[:LETTER_R]
- Key_scrolldown = Input::KEYMAP[:LETTER_F]
- #---------------------------------------------------------------------
- # * Text displayed when showing the comparsion of set equipment bonus
- SetEquipmentText = "Set bonus:"
- #---------------------------------------------------------------------
- # * Scrolling speed, aka the delta-y per frame
- Scrollspeed = 4
- #---------------------------------------------------------------------
- # * How many lines of comparsion should be listed at most? If the
- # differences between two equipments are more than this number, the
- # surplus won't be displayed.
- MaxDrawLine = 30
- #---------------------------------------------------------------------
- # * The param/feature considered to compare
- ComparsionTable = {
- # symbol => [id, display text showed in comparsion]
- :param => [-1, ''], # Basic parameter
- :xparam => [FEATURE_XPARAM, ''], # Ex-Parameter
- :sparam => [FEATURE_SPARAM, ''], # Sp-Parameter
- :param_rate => [FEATURE_PARAM, 'Param multipler'], # Parameter
- :special_flag => [FEATURE_SPECIAL_FLAG, 'Special'], # Special feature flag
- :element_rate => [FEATURE_ELEMENT_RATE, 'Element Rate'], # Element Rate
- :debuff_rate => [FEATURE_DEBUFF_RATE, 'Debuff Rate'], # Debuff Rate
- :state_rate => [FEATURE_STATE_RATE, 'State Rate'], # State Rate
- :state_resist => [FEATURE_STATE_RESIST, 'State Resist'], # State Resist
- :atk_element => [FEATURE_ATK_ELEMENT, 'Atk Element'], # Atk Element
- :atk_state => [FEATURE_ATK_STATE, 'Atk State'], # Atk State
- :atk_speed => [FEATURE_ATK_SPEED, 'Atk Speed'], # Atk Speed
- :atk_times => [FEATURE_ATK_TIMES, 'Atk Times+'], # Atk Times+
- :stype_add => [FEATURE_STYPE_ADD, 'Add Skill Type'], # Add Skill Type
- :stype_seal => [FEATURE_STYPE_SEAL, 'Disable Skill Type'],# Disable Skill Type
- :skill_add => [FEATURE_SKILL_ADD, 'Add Skill'], # Add Skill
- :skill_seal => [FEATURE_SKILL_SEAL, 'Disable Skill'], # Disable Skill
- :equip_wtype => [FEATURE_EQUIP_WTYPE, 'Equip Weapon'], # Equip Weapon
- :equip_atype => [FEATURE_EQUIP_ATYPE, 'Equip Armor'], # Equip Armor
- :equip_fix => [FEATURE_EQUIP_FIX, 'Lock Equip'], # Lock Equip
- :equip_seal => [FEATURE_EQUIP_SEAL, 'Seal Equip'], # Seal Equip
- :slot_type => [FEATURE_SLOT_TYPE, 'Slot Type'], # Slot Type
- :action_plus => [FEATURE_ACTION_PLUS, 'Action Times+'], # Action Times+
- :party_ability => [FEATURE_PARTY_ABILITY, 'Party ability'], # Party ability
- # --- Special Feature Flags ---
- :flag_id_auto_battle => [FLAG_ID_AUTO_BATTLE, 'Special'], # auto battle
- :flag_id_guard => [FLAG_ID_GUARD, 'Special'], # guard
- :flag_id_substitute => [FLAG_ID_SUBSTITUTE, 'Special'], # substitute
- :flag_id_preserve_tp => [FLAG_ID_PRESERVE_TP, 'Special'], # preserve TP
- }
- #---------------------------------------------------------------------
- # * Display order of compastion text,
- MISC_text = 'Other'
- TextDisplayOrder = [
- '', # suggestion: better not touch this line
- 'Feature',
- 'Special',
- 'Param multipler',
- 'Element Rate',
- 'Debuff Rate',
- 'State Rate',
- 'State Resist',
- 'Atk Element',
- 'Atk State',
- 'Atk Speed',
- 'Atk Times+',
- 'Add Skill Type',
- 'Disable Skill Type',
- 'Add Skill',
- 'Disable Skill',
- 'Equip Weapon',
- 'Equip Armor',
- 'Lock Equip',
- 'Seal Equip',
- 'Slot Type',
- 'Action Times+',
- 'Party ability',
- MISC_text,
- ]
- #---------------------------------------------------------------------
- # * Name display for each xparam
- XParamName = {
- 0 => "HIT", # HIT rate
- 1 => "EVA", # EVAsion rate
- 2 => "CRI", # CRItical rate
- 3 => "CEV", # Critical EVasion rate
- 4 => "MEV", # Magic EVasion rate
- 5 => "MRF", # Magic ReFlection rate
- 6 => "CNT", # CouNTer attack rate
- 7 => "HRG", # Hp ReGeneration rate
- 8 => "MRG", # Mp ReGeneration rate
- 9 => "TRG", # Tp ReGeneration rate
- }
- #---------------------------------------------------------------------
- # * Name display for each sparam
- SParamName = {
- 0 => "TGR", # TarGet Rate
- 1 => "GRD", # GuaRD effect rate
- 2 => "REC", # RECovery effect rate
- 3 => "PHA", # PHArmacology
- 4 => "MCR", # Mp Cost Rate
- 5 => "TCR", # Tp Charge Rate
- 6 => "PDR", # Physical Damage Rate
- 7 => "MDR", # Magical Damage Rate
- 8 => "FDR", # Floor Damage Rate
- 9 => "EXR", # EXperience Rate
- }
- #---------------------------------------------------------------------
- # * Name display for party ability
- PartyAbilityName = {
- 0 => "Encounter Half", # halve encounters
- 1 => "Encounter None", # disable encounters
- 2 => "Cancel Surprise", # disable surprise
- 3 => "Raise Preemptive", # increase preemptive strike rate
- 4 => "Gold Double", # double money earned
- 5 => "Item Drop Rate Double", # double item acquisition rate
- }
- #---------------------------------------------------------------------
- # * Name display for special feature
- SpecialFeatureName = {
- 0 => "Auto Battle",
- 1 => "Guard",
- 2 => "Substitute",
- 3 => "Preserve TP",
- }
- #---------------------------------------------------------------------
- # * prefix of single feature comparsion
- FeatureAddText = "+ %s"
- FeatureRemoveText = "- %s"
- FeatureEnableText = "√ %s"
- FeatureDisableText = "X %s"
- #---------------------------------------------------------------------
- InverseColorFeature = [FEATURE_STYPE_SEAL, FEATURE_SKILL_SEAL]
- PercentageFeaure = [
- FEATURE_ELEMENT_RATE, FEATURE_DEBUFF_RATE, FEATURE_STATE_RATE,
- FEATURE_PARAM, FEATURE_XPARAM, FEATURE_SPARAM, FEATURE_ATK_STATE,
- FEATURE_ACTION_PLUS,
- ]
- #=====================================================================#
- # Please don't edit anything below unless you know what you're doing! #
- #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^#
- # Strcuture holds compare result of each difference
- DiffInfo = Struct.new(:feature_id, :data_id, :value, :display_str)
- # :feature_id > what do you expect me to say?
- # :data_id > data id in grouped feature, such as param
- # :delta > value changed of that feature, in certain feature id is:
- # true/false = add/remove after equip
- # :display_str > Other text displayed
- #--------------------------------------------------------------------------
- # * Feature needn't iterated, show in one line
- SingularFeature = [
- FEATURE_ATK_SPEED,
- FEATURE_ATK_TIMES,
- FEATURE_ACTION_PLUS,
- ]
- #--------------------------------------------------------------------------
- # * Mapping table for easier query
- StringTable = {}
- DisplayOrder = {}
- ComparsionTable.each{|k, v| StringTable[v[0]] = v[1]}
- TextDisplayOrder.each_with_index{|v,i| DisplayOrder[v] = i}
- end
- end
- #==============================================================================
- # ** Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
- end
- #==============================================================================
- # ** Window_EquipStatus
- #------------------------------------------------------------------------------
- # This window displays actor parameter changes on the equipment screen.
- #==============================================================================
- class Window_EquipStatus < Window_Base
- include COMP::EECI
- EQS_Enable = $imported[:MA_EquipmentSetBonuses]
- #---------------------------------------------------------------------------
- # * Instance variables
- #---------------------------------------------------------------------------
- attr_reader :difference
- attr_reader :set_difference if EQS_Enable
- #---------------------------------------------------------------------------
- # * Alias method: initialize
- #---------------------------------------------------------------------------
- alias init_eeci initialize
- def initialize(*args)
- @bottom_oy = 1
- @difference = {}
- init_eeci(*args)
- @visible_height = height - standard_padding * 2
- end
- #---------------------------------------------------------------------------
- # * Overwrite methods: contents height
- #---------------------------------------------------------------------------
- def contents_height
- @bottom_oy
- end
- #---------------------------------------------------------------------------
- # * Alias method: update
- #---------------------------------------------------------------------------
- alias update_eeci update
- def update
- update_eeci
- update_scroll
- end
- #---------------------------------------------------------------------------
- # * New method: update scroll
- #---------------------------------------------------------------------------
- def update_scroll
- return unless self.arrows_visible
- delta = Scrollspeed
- delta *= 3 if Input.press?(Input::SHIFT)
- if Input.trigger?(Key_scrollup) || Input.press?(Key_scrollup)
- self.oy = [self.oy - delta, 0].max if self.oy > 0
- elsif Input.trigger?(Key_scrolldown) || Input.press?(Key_scrolldown)
- by = [@bottom_oy + 4 - @visible_height, 0].max
- self.oy = [self.oy + delta, by].min if self.oy < by
- end
- end
- #---------------------------------------------------------------------------
- # * Overwrite method: refresh
- #---------------------------------------------------------------------------
- def refresh
- contents.clear
- self.oy = 0
- @bottom_oy = 1
- self.arrows_visible = false
- @difference.clear
- return unless @temp_actor && @actor
- compare_diffs
- line_number = @difference.keys.count{|k| (@difference[k] || []).size > 0 && StringTable[k].length > 0}
- line_number += @difference.values.flatten.size
- @bottom_oy = ([line_number, MaxDrawLine].min) * line_height
- create_contents
- self.arrows_visible = @bottom_oy > @visible_height
- draw_comapre_result
- end
- #---------------------------------------------------------------------------
- def compare_diffs
- en_prefix = [FeatureDisableText, FeatureEnableText]
- ComparsionTable.each do |symbol, info|
- feature_id = info[0]
- display_str = info[1]
- case symbol
- when :param; compare_param();
- when :param_rate; compare_valued_feature(feature_id, true)
- when :xparam; compare_features_sum(feature_id);
- when :sparam; compare_features_pi(feature_id);
- when :skill_add; compare_features_set(feature_id);
- when :skill_seal; compare_features_set(feature_id, en_prefix.reverse);
- when :element_rate; compare_features_pi(feature_id);
- when :atk_element; compare_features_set(feature_id);
- when :atk_state; compare_valued_feature(feature_id, false);
- when :state_rate; compare_features_pi(feature_id);
- when :state_resist; compare_features_set(feature_id);
- when :stype_seal; compare_features_set(feature_id, en_prefix.reverse);
- when :stype_add; compare_features_set(feature_id, en_prefix);
- when :atk_speed; compare_features_sum(feature_id);
- when :atk_times; compare_features_sum(feature_id);
- when :action_plus; compare_action_plus(feature_id);
- when :special_flag; compare_special_flag(feature_id);
- when :party_ability;compare_party_ability(feature_id);
- end
- end # ComparsionTable.each
- end
- #---------------------------------------------------------------------------
- def compare_param(feature_id = FEATURE_PARAM)
- ar = get_feature_array(feature_id)
- len = ar.size
- len.times do |i|
- a = @temp_actor.param(i)
- b = @actor.param(i)
- next if a - b == 0
- str = get_feature_name(feature_id, i)
- (@difference[-1] ||= []) << DiffInfo.new(-1, i, [a,b], str)
- end
- end
- #---------------------------------------------------------------------------
- def compare_features_sum(feature_id)
- ar = get_feature_array(feature_id); len = ar.size;
- if len == 0
- a = @temp_actor.features_sum_all(feature_id)
- b = @actor.features_sum_all(feature_id)
- delta = (a - b)
- delta = delta.round(2) if delta.is_a?(Float)
- return if delta == 0
- str = get_feature_name(feature_id)
- (@difference[feature_id] ||= []) << DiffInfo.new(feature_id, 0, [a,b], str)
- else
- len.times do |i|
- a = @temp_actor.features_sum(feature_id, i)
- b = @actor.features_sum(feature_id, i)
- delta = (a - b)
- delta = delta.round(2) if delta.is_a?(Float)
- next if delta == 0
- str = get_feature_name(feature_id, i)
- (@difference[feature_id] ||= []) << DiffInfo.new(feature_id, i, [a,b], str)
- end
- end
- end
- #---------------------------------------------------------------------------
- def compare_features_pi(feature_id)
- ar = get_feature_array(feature_id); len = ar.size;
- len.times do |i|
- a = @temp_actor.features_pi(feature_id, i)
- b = @actor.features_pi(feature_id, i)
- delta = (a - b)
- delta = delta.round(2) if delta.is_a?(Float)
- next if delta == 0
- str = get_feature_name(feature_id, i)
- (@difference[feature_id] ||= []) << DiffInfo.new(feature_id, i, [a,b], str)
- end
- end
- #---------------------------------------------------------------------------
- def compare_features_set(feature_id, prefix = [FeatureRemoveText, FeatureAddText])
- before = @actor.features_set(feature_id)
- after = @temp_actor.features_set(feature_id)
- after.select{|id| !before.include?(id)}.each do |id|
- str = sprintf(prefix[1], get_feature_name(feature_id, id))
- (@difference[feature_id] ||= []) << DiffInfo.new(feature_id, id, true, str)
- end
- before.select{|id| !after.include?(id)}.each do |id|
- str = sprintf(prefix[0], get_feature_name(feature_id, id))
- (@difference[feature_id] ||= []) << DiffInfo.new(feature_id, id, false, str)
- end
- end
- #---------------------------------------------------------------------------
- def compare_valued_feature(feature_id, pi)
- before = @actor.features_set(feature_id)
- after = @temp_actor.features_set(feature_id)
- prefix = [FeatureRemoveText, FeatureAddText]
- (after + before).uniq.sort.each do |id|
- a = pi ? @temp_actor.features_pi(feature_id, id) : @temp_actor.features_sum(feature_id, id)
- b = pi ? @actor.features_pi(feature_id, id) : @actor.features_sum(feature_id, id)
- next if a - b == 0
- str = get_feature_name(feature_id, id)
- (@difference[feature_id] ||= []) << DiffInfo.new(feature_id, id, [a,b], str)
- end
- end
- #---------------------------------------------------------------------------
- def compare_action_plus(feature_id)
- end
- #---------------------------------------------------------------------------
- def compare_special_flag(feature_id)
- end
- #---------------------------------------------------------------------------
- def compare_party_ability(feature_id)
- end
- #---------------------------------------------------------------------------
- def get_feature_name(feature_id, index = nil)
- case feature_id
- when FEATURE_ATK_ELEMENT; return $data_system.elements[index];
- when FEATURE_ELEMENT_RATE; return $data_system.elements[index];
- when FEATURE_PARAM; return Vocab.param(index);
- when FEATURE_XPARAM; return XParamName[index];
- when FEATURE_SPARAM; return SParamName[index];
- when FEATURE_SKILL_ADD; return $data_skills[index].name;
- when FEATURE_SKILL_SEAL; return $data_skills[index].name;
- when FEATURE_STATE_RATE; return $data_states[index].name;
- when FEATURE_STATE_RESIST; return $data_states[index].name;
- when FEATURE_ATK_STATE; return $data_states[index].name;
- when FEATURE_EQUIP_WTYPE; return $data_system.weapon_types[index];
- when FEATURE_EQUIP_WTYPE; return $data_system.armor_types[index];
- when FEATURE_STYPE_ADD; return $data_system.skill_types[index];
- when FEATURE_STYPE_SEAL; return $data_system.skill_types[index];
- else
- return ""
- end
- end
- #---------------------------------------------------------------------------
- def get_feature_array(feature_id)
- case feature_id
- when FEATURE_ATK_ELEMENT; return $data_system.elements;
- when FEATURE_ELEMENT_RATE; return $data_system.elements;
- when FEATURE_PARAM; return Array.new($data_system.terms.params.size, 0);
- when FEATURE_XPARAM; return Array.new(XParamName.size, 0);
- when FEATURE_SPARAM; return Array.new(SParamName.size);
- when FEATURE_SKILL_ADD; return $data_skills;
- when FEATURE_SKILL_SEAL; return $data_skills;
- when FEATURE_STATE_RATE; return $data_states;
- when FEATURE_STATE_RESIST; return $data_states;
- when FEATURE_ATK_STATE; return $data_states;
- when FEATURE_EQUIP_WTYPE; return $data_system.weapon_types;
- when FEATURE_EQUIP_WTYPE; return $data_system.armor_types;
- when FEATURE_STYPE_ADD; return $data_system.skill_types;
- when FEATURE_STYPE_SEAL; return $data_system.skill_types;
- else
- return []
- end
- end
- #---------------------------------------------------------------------------
- def draw_comapre_result
- counter = 0
- diff = @difference.sort_by{|k, dar|
- DisplayOrder[StringTable[dar.first.feature_id]] ? DisplayOrder[StringTable[dar.first.feature_id]] : DisplayOrder[MISC_text]
- }.collect{|p| p[1]}
- last_display_group = ''
- diff.each do |infos|
- feature_id = infos.first.feature_id
- group_text = StringTable[feature_id]
- if last_display_group != group_text && group_text.length > 0
- last_display_group = group_text
- rect = Rect.new(0, counter * line_height, contents_width, line_height)
- draw_text(rect, group_text)
- counter += 1
- end
- infos.each do |info|
- dy = counter * line_height
- break if dy > @bottom_oy + 1
- draw_item(0, dy, info)
- counter += 1
- end
- end
- end
- #---------------------------------------------------------------------------
- # * Overwrite: draw_item
- #---------------------------------------------------------------------------
- def draw_item(dx, dy, info)
- # YEA Equip Engine code
- if $imported["YEA-AceEquipEngine"]
- self.contents.font.size = YEA::EQUIP::STATUS_FONT_SIZE
- draw_background_colour(dx, dy)
- end
- # Draw feature add/remove
- if info.value == true || info.value == false
- # Inverse the color effect if feature is not good
- inverse = (InverseColorFeature.include?(info.feature_id)) ? 1 : 0
- a = (info.value ? 1 : 0) ^ inverse
- b = (info.value ? 0 : 1) ^ inverse
- change_color(param_change_color(a - b))
- # draw skill change with the icon
- if [FEATURE_SKILL_ADD, FEATURE_SKILL_SEAL].include?(info.feature_id)
- info.value ^= inverse
- draw_skill_change(dx + 8, dy, info)
- else
- draw_info_change(dx + 8, dy, info.display_str)
- end
- change_color(normal_color)
- else
- draw_info_name(dx + 4, dy, info.display_str)
- draw_info_diff(dx + 8, dy, info.value, PercentageFeaure.include?(info.feature_id))
- end
- reset_font_settings if $imported["YEA-AceEquipEngine"]
- end
- #---------------------------------------------------------------------------
- def draw_info_change(dx, dy, str)
- rect = Rect.new(0, dy, contents.width-4, line_height)
- draw_text(rect, str, 2)
- end
- #---------------------------------------------------------------------------
- def draw_skill_change(dx, dy, info)
- str = info.display_str
- return draw_info_change(dx, dy, str) unless (info.data_id || 0) > 0
- text_width = self.contents.text_size(str).width
- dx = contents.width - text_width - 34
- prefix = str[0]; str = str[1...str.length];
- rect = Rect.new(dx, dy, self.contents.text_size(prefix).width + 3, line_height)
- draw_text(rect, prefix)
- offset = rect.width + 24
- draw_icon($data_skills[info.data_id].icon_index, dx + rect.width, dy, info.value)
- rect.x += offset; rect.width = text_width;
- draw_text(rect, str)
- end
- #---------------------------------------------------------------------------
- def draw_info_name(dx, dy, str)
- change_color(system_color)
- draw_text(dx, dy, contents.width, line_height, str)
- change_color(normal_color)
- end
- #---------------------------------------------------------------------------
- def draw_info_diff(dx, dy, value, is_percent = false)
- dw = (contents.width + 22) / 2
- crect = Rect.new(0, dy, dw, line_height)
- nrect = Rect.new(0, dy, contents.width-4, line_height)
- drx = (contents.width + 22) / 2
- draw_diff_value(crect, value[1], is_percent)
- draw_right_arrow(drx, dy)
- change_color(param_change_color(value[0] - value[1]))
- draw_diff_value(nrect, value[0], is_percent)
- change_color(normal_color)
- end
- #---------------------------------------------------------------------------
- def draw_diff_value(rect, value, is_percent)
- str = value.to_s
- str = sprintf("%s\%", (value * 100).to_i) if is_percent
- draw_text(rect, str, 2)
- end
- #---------------------------------------------------------------------------
- end # class Window_EQ status
- end # enable
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement