赞 | 1 |
VIP | 16 |
好人卡 | 23 |
积分 | 0 |
经验 | 49509 |
最后登录 | 2016-1-9 |
在线时间 | 2459 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 48
- 在线时间
- 2459 小时
- 注册时间
- 2011-12-18
- 帖子
- 1484
|
不是我写的,我从外站扒来的- #==============================================================================
- # Luck Stat
- # Version: 1.0a
- # Author: modern algebra (rmrk.net)
- # Date: Easter Sunday, 2011
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Description:
- #
- # Chances are you've never thought about this, but there are a lot of random
- # things going on in RMVX. Which items drop when you kill monsters; if states
- # are applied or released; whether you hit or miss or evade or land a critical
- # hit, all of these things are random. This script adds a new statistic which
- # is intended to modify the chances of these various things happening: Luck!
- # It also makes gold drop amounts random and affects that as well.
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Instructions:
- #
- # In order to add this script to your game, simply paste it into it its own
- # slot in the Script Editor (F11) above Main but below other custom scripts.
- #
- # Roll on down to line 77 for more detailed configuration, but in brief:
- # line 79 is where you change the label for the stat. You can set whether it
- # is shown in the Status scene at line 80 (and where at lines 81 and 83). To
- # see it in the Equip scene, you can set line 88 to true. The most important
- # one is at line 91, where you set the growth for the luck stat of each actor.
- #
- # There are also a number of note tags you can use. For any item or state,
- # you can use the following codes (where x and y are integers):
- # \luck[x]
- # \luck[y%]
- # The first adds x directly to the actor's luck, while the second adds that
- # percentage of the actor's total current luck to itself. For weapons and
- # armors, this will happen immediately and only for as long as the armor is
- # equipped. They can also be combined and then the equipment will add (y% + x)
- # luck to the actor when it is equipped. For items, the luck will be added
- # permanently once the item us used, just like for the regular stats. For
- # states, the luck changes will only apply so long as the state is applied. As
- # well for states, you can set a tag to identify whether the state has a
- # positive or negative effect. This is so your luck stat can make it more
- # likely to contract the positive states and less likely to contract the
- # negative ones. In order to identify a state as positive, use this:
- # \positive
- # If not identified as positive, it will assume the state is negative.
- #
- # In terms of how this stat should affect how you plan out the game, the stat
- # is intended to be used at lower values - it can work for higher values as
- # well, but it will generally become less effective. The easiest way to think
- # of the stat is as the chance to get more chances. So, if an actor has 50
- # luck and a 4% chance to critical, the Luck stat is a 50% chance to get
- # another 4% chance to critical if you miss the first time. When your luck
- # goes over 100, then you will automatically get a second chance and the
- # remainder is the chance to have a third chance (or fourth, fifth, etc...).
- # So if luck is 225, then it would be three chances at 4% and a 25% chance to
- # have a fourth chance. It affects gold differently. For that, it simply takes
- # the mean average of the party's luck and you randomly get somewhere between
- # 0 and that percentage extra gold. So if the gold drop would be 70 and your
- # party has an average luck of 50, then you would get anywhere between 70 and
- # 105 gold.
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Compatibility:
- # TDS Weapon Unleash - This script should function and modify the chance to
- # unleash. Must place Luck below Weapon Unleash though
- # MA Note Editor - this will work with the Note Editor as long as you have
- # the note editor's general compatibility patch and it's above this script
- # MA FSCMS - The Luck Stat will show up in the Status window
- # YEM Status Menu - You can set the icon at line 124 and the stat should
- # show up in the scene, but it will be cut off if there isn't room for it.
- # YEM Equipment Overhaul - You can set the icon at line 124 and the luck
- # stat should show up, but it will be cut off if there isn't room for it.
- # Others - There shouldn't be errors as long as the Luck script is below
- # them, but it might not function exactly as expected if those scripts
- # vastly alter battles or change the status or equip scenes. If you notice
- # anything odd, please post in my topic and I will try to help.
- #==============================================================================
- #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- # EDITABLE REGION
- #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- MALS_VOCAB_LUCK = "运气" # The label to identify the stat in Status and Equip
- MALS_STATUS_SHOW = false # Whether to show Luck in Status
- MALS_STATUS_X = -1 # The x position of luck in the status window. When -1,
- # it will be at the same x as the other parameters
- MALS_STATUS_Y = -1 # The y position of luck in the status window. When -1,
- # it will be just below other stats. If more negative,
- # it will be below the other stats + the absolute value
- # of this. This is so you can reposition it if you have
- # other added stats.
- MALS_EQUIP_SHOW = false # Whether to show Luck in the Equip Scene. This will
- # likely not work with anything but the default scene
- # and YEM Equip Menu
- MALS_LUCK_GROWTH = { # <- Do not touch
- # MALS_LUCK_GROWTH - this is where you can set the level growth of the luck
- # for every actor. You can do it in a few ways: either by an array where you
- # set it individually for each level, or by a formula encapsulated in quotation
- # marks. The 0 => line will be the default growth if you don't set a specific
- # one for the actor, while each subsequent line (1 =>; 2 =>) will be the growth
- # for the actor with that ID. Remember to put a comma at the end of each.
- # EXAMPLES:
- # 0 => "4 * level / 3",
- # This is the default growth and it will mean the actor gains 1 luck
- # every level and 2 every third level.
- # 8 => "3 + (level*2)",
- # This would be the growth for Actor 8 and he or she would start out with
- # 5 luck and gain 2 more every level.
- # 5 => [5, 6, 8, 9, 10, 12, 13, 14, 16, 17, 18, 20, 22, 23, 25, 26, 28, 29,
- # 30, 32, 33, 35, 36, 38, 39, 41, 42, 44, 45, 47, 47, 48, 50, 51, 52,
- # 54, 55, 56, 58, 59, 61, 62, 64, 65, 67, 68, 69, 71, 73, 74, 75, 76,
- # 77, 79, 80, 81, 82, 84, 86, 87, 88, 90, 91, 92, 94, 95, 96, 98, 100,
- # 101, 102, 104, 105, 107, 110, 111, 112, 114, 116, 117, 118, 120,
- # 121, 121, 124, 126, 127, 128, 129, 131, 132, 134, 136, 139, 140,
- # 142, 143, 145, 148],
- # This would be the growth for actor 5 and he or she would start with 5
- # luck at level 1 and would have the set amount at each level (so 6 at
- # level 2, 8 at level 3, 9 at level 4, etc...)
- 0 => "1*0",
- 2 => "1*0",
- 8 => "1*0",
- } # <- DO not touch
- MALS_LUCK_ICON = 103 # This is icon for Luck if you are using YEM scripts
- #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- # END EDITABLE REGION
- #//////////////////////////////////////////////////////////////////////////////
- MALS_LUCK_GROWTH.default = MALS_LUCK_GROWTH[0] # <- Do not touch
- $imported = {} unless $imported
- $imported["LuckStat"] = true
- #==============================================================================
- # *** RPG
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # modified classes - BaseItem; State; Actor; Enemy
- #==============================================================================
- module RPG
- #============================================================================
- # ** BaseItem
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # new method - luck; luck_rate
- #============================================================================
- class BaseItem
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Luck
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def luck
- [url=home.php?mod=space&uid=213401]@luck[/url] = (self.note[/\\LUCK\[(-?\d+)\]/i] != nil ? $1.to_i : 0) if !@luck
- return @luck
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Luck Rate
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def luck_rate
- @luck_rate = (self.note[/\\LUCK\[(-?\d+)%\]/i] != nil ? $1.to_f / 100.0 : 0) if !@luck_rate
- return @luck_rate
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Compatibility with Note Editor
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- if self.method_defined? (:ma_reset_note_values)
- alias mlg_luk_rstnotes_4rf2 ma_reset_note_values
- def ma_reset_note_values (*args)
- mlg_luk_rstnotes_4rf2 (*args)
- @luck = nil
- @luck_rate = nil
- end
- end
- end
- #============================================================================
- # ** State
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # new method - luck; luck_rate
- # aliased method - auto_release_prob
- #============================================================================
- class State
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Luck
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def luck
- @luck = (self.note[/\\LUCK\[(-?\d+)\]/i] != nil ? $1.to_i : 0) if !@luck
- return @luck
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Luck Rate
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def luck_rate
- @luck_rate = (self.note[/\\LUCK\[(-?\d+)%\]/i] != nil ? $1.to_f / 100.0 : 0) if !@luck_rate
- return @luck_rate
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Positive State?
- # This allows you to specify some states as positive, thus meaning luck
- # will favourably influence its application instead of unfavourably
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def positive_state?
- @positivity = self.note[/\\POSITIVE/i] != nil if @positivity == nil
- return @positivity
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Auto Release Probability
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias ma_lk_autorel_5tc7 auto_release_prob unless self.method_defined? (:ma_lk_autorel_5tc7)
- def auto_release_prob (*args)
- prob = ma_lk_autorel_5tc7 (*args)
- if $game_temp && positive_state?
- prob = 2*prob - $game_temp.luck_prob (prob)
- else
- prob = $game_temp.luck_prob (prob)
- end
- return prob
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Compatibility with Note Editor
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- if self.method_defined? (:ma_reset_note_values)
- alias mlg_luk_rstnotes_4rf2 ma_reset_note_values
- def ma_reset_note_values (*args)
- mlg_luk_rstnotes_4rf2 (*args)
- @luck = nil
- @luck_rate = nil
- @positivity = nil
- end
- end
- end
- #==============================================================================
- # ** Actor
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # new method - luck
- #==============================================================================
- class Actor
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Luck
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def luck (level)
- @luck_base = [] if !@luck_base
- if @luck_base[level] == nil
- growth = MALS_LUCK_GROWTH[self.id]
- if growth.is_a? (Array)
- @luck_base[level] = growth[[level - 1, growth.size - 1].min]
- else
- eval ("@luck_base[level] = #{growth}")
- end
- end
- return @luck_base[level]
- end
- end
- #==============================================================================
- # ** Enemy
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # new method - luck
- # modified class - DropItem
- #==============================================================================
- class Enemy
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Luck
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def luck
- @luck = (self.note[/\\LUCK\[(-?\d+)\]/i] != nil ? $1.to_i : 0) if @luck == nil
- return @luck
- end
-
- #==========================================================================
- # ** DropItem
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # aliased method - denominator
- #==========================================================================
-
- class DropItem
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Denominator
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias mlgb_luk_denmn_4rt2 denominator unless self.method_defined? (:mlgb_luk_denmn_4rt2)
- def denominator (*args)
- denom = mlgb_luk_denmn_4rt2 (*args) # Run Original Method
- percent = $game_temp.luck_prob (100 / denom)
- return (100.0 / percent).round
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Compatibility with Note Editor
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- if self.method_defined? (:ma_reset_note_values)
- alias mlg_luk_rstnotes_4rf2 ma_reset_note_values
- def ma_reset_note_values (*args)
- mlg_luk_rstnotes_4rf2 (*args)
- @luck_base = []
- end
- end
- end
- #==============================================================================
- # TDS Weapon Unleash Compatibility
- #==============================================================================
- class Weapon
- if self.method_defined? (:unleash_info)
- alias ma_luk_com_wpnunls_8ib3 unleash_info
- def unleash_info (*args)
- array = ma_luk_com_wpnunls_8ib3 (*args)
- array[1] = $game_temp.luck_prob (array[1]) if array && $game_temp
- return array
- end
- end
- end
- end
- #==============================================================================
- # *** Vocab
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # new method - luck
- #==============================================================================
- module Vocab
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Luck
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def self.luck
- return MALS_VOCAB_LUCK
- end
- end
- #==============================================================================
- # ** Game_Temp
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # new accessor - luck_mod
- # aliased method - initialize
- #==============================================================================
- class Game_Temp
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Public Instance Variables
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- attr_accessor :luck_mod
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Object Initialization
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias mrgb_lc_iniz_1wd9 initialize
- def initialize (*args)
- mrgb_lc_iniz_1wd9 (*args) # Run Original Method
- @luck_mod = 0
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Luck Probability
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def luck_prob (prob, luck = @luck_mod)
- return prob if prob == 100 || luck <= 0
- t = luck / 100
- t += 1 if rand (100) < (luck % 100)
- return t == 0 ? prob : ((1.0 - (((100 - prob).to_f / 100.0)**(t + 1))) * 100).to_i
- end
- end
- #==============================================================================
- # ** Game_Battler
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # aliased methods - clear_extra_values; item_growth_effect; item_test;
- # remove_states_auto; make_attack_damage_value; calc_hit; calc_eva
- # new method - luck; luck=
- #==============================================================================
- class Game_Battler
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Object Initialization
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias malg_luck_clrexvals_5yq1 clear_extra_values
- def clear_extra_values (*args)
- malg_luck_clrexvals_5yq1 (*args) # Run Original Method
- @luck_plus = 0
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Item Growth Effect Application
- # user : Item user
- # item : item
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias modrna_itmgrowth_eff_6yh4 item_growth_effect
- def item_growth_effect(user, item, *args)
- modrna_itmgrowth_eff_6yh4 (user, item, *args)
- @luck_plus += item.luck + (item.luck_rate*self.luck)
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Item Test
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias mdlg_luc_itmtst_5rx2 item_test
- def item_test(user, item, *args)
- return true if item.luck != 0 || item.luck_rate != 0
- return mdlg_luc_itmtst_5rx2 (user, item, *args)
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Auto Remove States
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias odagb_lck_rmvautostt_6jn2 remove_states_auto
- def remove_states_auto (*args)
- $game_temp.luck_mod = self.luck
- odagb_lck_rmvautostt_6jn2 (*args) # Auto Remove States
- $game_temp.luck_mod = 0
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Make Attack Damage Value
- # do luck_mod here instead of cri so as not to corrupt the general stat
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias mlg_luck_dmg_atk_9uc4 make_attack_damage_value
- def make_attack_damage_value (attacker, *args)
- $game_temp.luck_mod = attacker.luck
- mlg_luck_dmg_atk_9uc4 (attacker, *args) # Run Original Method
- $game_temp.luck_mod = 0
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Calculation of Final Hit Ratio
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias maba_luk_htclc_7uz3 calc_hit
- def calc_hit (user, *args)
- hit = maba_luk_htclc_7uz3 (user, *args)
- return $game_temp.luck_prob (hit, user.luck)
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Calculate Final Evasion Rate
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias malgbr_lck_clceva_3da7 calc_eva
- def calc_eva(user, *args)
- eva = malgbr_lck_clceva_3da7 (user, *args)
- return $game_temp.luck_prob (eva, self.luck)
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Luck
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def luck
- n = [[base_luck + @luck_plus, 1].max, 9999].min
- floats = 1.0
- for state in states
- floats += state.luck_rate
- n += state.luck_rate
- end
- n *= floats
- n = [[Integer(n), 1].max, 9999].min
- return n
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Set Luck
- # new_luck : the new value of luck
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def luck= (new_luck)
- @luck_plus += new_luck - self.luck
- @luck_plus = [[@luck_plus, -9999].max, 9999].min
- end
- #==========================================================================
- # TDS Weapon Unleash Compatibility
- #==========================================================================
- if self.method_defined? (:weapon_unleash?)
- alias ma_lk_cmp_tdswu_5th1 weapon_unleash?
- def weapon_unleash? (*args)
- $game_temp.luck_mod = luck
- v = ma_lk_cmp_tdswu_5th1 (*args)
- $game_temp.luck_mod = 0
- return v
- end
- end
- end
- #==============================================================================
- # ** Game_Actor
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # aliased method - state_probability; cri
- # new method - base_luck
- #==============================================================================
- class Game_Actor
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Get Basic Luck
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def base_luck
- n = actor.luck (@level)
- floats = 1.0
- for equip in equips.compact
- # floats += equip.luck_rate
- n += equip.luck
- end
- n = (n*floats).to_i
- return n
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * State Probability
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias mag_luck_probstate_8id2 state_probability
- def state_probability (state_id, *args)
- default = mag_luck_probstate_8id2 (state_id, *args)
- $game_temp.luck_mod = luck
- if $data_states[state_id].positive_state?
- return $game_temp.luck_prob (default)
- else
- return 2*default - ($game_temp.luck_prob (default))
- end
- $game_temp.luck_mod = 0
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Critical
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # alias malg_luk_cri_7uk9 cri
- #def cri (*args)
- # return $game_temp.luck_prob (malg_luk_cri_7uk9 (*args))
- #end
- end
- #==============================================================================
- # ** Game_Enemy
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # aliased method - state_probability
- # new method - base_luck
- #==============================================================================
- class Game_Enemy
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Get Basic Luck
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def base_luck
- return enemy.luck
- end
- end
- =begin
- class Game_Enemy
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Get Basic Luck
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def base_luck
- return enemy.luck
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * State Probability
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias mag_luck_stateprob_4tg2 state_probability
- def state_probability (state_id, *args)
- default = mag_luck_stateprob_4tg2 (state_id, *args)
- $game_temp.luck_mod = luck
- if $data_states[state_id].positive_state?
- return $game_temp.luck_prob (default)
- else
- return 2*default - ($game_temp.luck_prob (default))
- end
- $game_temp.luck_mod = 0
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Critical
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias malg_lck_crit_2wq1 cri
- def cri (*args)
- return $game_temp.luck_prob (malg_lck_crit_2wq1 (*args))
- end
- end
- =end
- #==============================================================================
- # ** Game_Unit
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # new method - luck_average
- #==============================================================================
- class Game_Unit
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Average Luck
- # This takes the mean of the party member's luck for gold & item drop %
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def luck_average
- luck = 0
- existing_members.each { |actor| luck += actor.luck }
- return (luck / [1, existing_members.size].max)
- end
- end
- #==============================================================================
- # ** Game Troop
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # aliased methods - gold_total; make_drop_items
- #==============================================================================
- class Game_Troop
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Gold Total
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias mrgba_luk_glddrop_7uj1 gold_total
- def gold_total (*args)
- total = mrgba_luk_glddrop_7uj1 (*args)
- total += rand (1 + (total * ($game_party.luck_average / 100.0)).to_i)
- return total
- end
-
- alias mrgba_luk_glddrop_9uj1 exp_total
- def exp_total (*args)
- total = mrgba_luk_glddrop_9uj1 (*args)
- total += rand (1 + (total * ($game_party.luck_average / 100.0)).to_i)
- return total
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Make Drop Items
- # luck_mod done here to avoid corrupting denominator
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias mgba_luk_dropitms_8fv2 make_drop_items
- def make_drop_items (*args)
- $game_temp.luck_mod = $game_party.luck_average
- v = mgba_luk_dropitms_8fv2 (*args)
- $game_temp.luck_mod = 0
- return v
- end
- end
- #==============================================================================
- # ** Window_Status
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # aliased method - draw_parameters
- #==============================================================================
- if MALS_STATUS_SHOW
- class Window_Status
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Draw Parameters
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias ma_luk_drwparams_2fg4 draw_parameters
- def draw_parameters (x, y, *args)
- ma_luk_drwparams_2fg4 (x, y, *args)
- x = MALS_STATUS_X if MALS_STATUS_X != -1
- y = (MALS_STATUS_Y != -1 ? MALS_STATUS_Y : y + WLH*4 + MALS_STATUS_Y.abs - 1)
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 120, WLH, Vocab::luck)
- self.contents.font.color = normal_color
- self.contents.draw_text(x + 120, y, 36, WLH, @actor.luck, 2)
- end
- end
- end
- if MALS_EQUIP_SHOW
- #============================================================================
- # ** Window_EquipStatus
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # modified_constant - WLH
- # aliased method - refresh
- # new method - set_luck
- #============================================================================
- class Window_EquipStatus
- WLH = 20
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Set Luck
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def set_luck (new_luck)
- if @new_luck != new_luck
- @new_luck = new_luck
- refresh
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Refresh
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias mdrn_luk_eqpref_7us6 refresh
- def refresh (*args)
- if self.contents.height < 120
- self.height = 152
- create_contents
- end
- mdrn_luk_eqpref_7us6 (*args)
- self.contents.font.color = system_color
- self.contents.draw_text(4, WLH*5, 80, WLH, Vocab::luck)
- self.contents.font.color = normal_color
- self.contents.draw_text(90, WLH*5, 30, WLH, @actor.luck, 2)
- self.contents.font.color = system_color
- self.contents.draw_text(122, WLH*5, 20, WLH, ">", 1)
- if @new_luck != nil
- self.contents.font.color = new_parameter_color(@actor.luck, @new_luck)
- self.contents.draw_text(142, WLH*5, 30, WLH, @new_luck, 2)
- end
- end
- end
-
- #============================================================================
- # ** Scene Equip
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # aliased method
- #============================================================================
-
- class Scene_Equip
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Update Status Window
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias malg_luck_updstatwin_6yh3 update_status_window
- def update_status_window (*args)
- if @equip_window.active
- @status_window.set_luck (nil)
- elsif @item_window.active
- temp_actor = @actor.clone
- temp_actor.change_equip(@equip_window.index, @item_window.item, true)
- @status_window.set_luck (temp_actor.luck)
- end
- malg_luck_updstatwin_6yh3 (*args)
- end
- end
- end
- #==============================================================================
- # YEM COMPATIBILITY
- #==============================================================================
- # Status Menu Melody
- if $imported["StatusMenuMelody"] && MALS_STATUS_SHOW
- #==========================================================================
- # ** Window Status General
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # aliased method - draw_parameters
- #==========================================================================
- class Window_Status_General
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Draw Parameters
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias mlgb_luk_drwparams_6yv2 draw_parameters
- def draw_parameters (x, y, *args)
- mlgb_luk_drwparams_6yv2 (x, y, *args)
- x += 24
- x = MALS_STATUS_X if MALS_STATUS_X != -1
- y = (MALS_STATUS_Y != -1 ? MALS_STATUS_Y : y + (WLH*(2 + YEM::STATUS::SHOWN_STATS.size)) + MALS_STATUS_Y.abs - 1)
- draw_icon(MALS_LUCK_ICON, x, y)
- self.contents.font.color = system_color
- self.contents.draw_text(x + 24, y, 48, WLH, Vocab::luck)
- self.contents.font.color = normal_color
- self.contents.draw_text(x + 72, y, 84, WLH, @actor.luck, 2)
- end
- end
- end
- # Equipment Overhaul
- if $imported["EquipmentOverhaul"] && MALS_EQUIP_SHOW
- #==========================================================================
- # ** Window EquipStat
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # Summary of Changes:
- # aliased methods - draw_actor_stats; draw_clone_stats
- #==========================================================================
- class Window_EquipStat
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Draw Actor Stats
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias modrn_yemequip_drwactrstats_8uf2 draw_actor_stats
- def draw_actor_stats (*args)
- modrn_yemequip_drwactrstats_8uf2 (*args) # Run Original Method
- dy = WLH*YEM::EQUIP::SHOWN_STATS.size
- draw_icon(MALS_LUCK_ICON, 0, dy)
- self.contents.font.size = YEM::EQUIP::STAT_FONT_SIZE
- self.contents.font.color = system_color
- self.contents.draw_text(24, dy, 60, WLH, Vocab.luck, 0)
- self.contents.font.color = normal_color
- self.contents.draw_text(84, dy, 45, WLH, @actor.luck, 2)
- self.contents.font.color = system_color
- self.contents.font.size = Font.default_size
- self.contents.draw_text(129, dy, 30, WLH, YEM::EQUIP::VOCAB[:arrow], 1)
- if @equip_index == nil or (@equip != nil and [email protected]?(@equip))
- self.contents.font.size = YEM::EQUIP::STAT_FONT_SIZE
- self.contents.font.color = normal_color
- self.contents.draw_text(159, dy, 45, WLH, @actor.luck, 2)
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * Draw Clone Stats
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias modrn_yemequip_luk_clnst_5tb9 draw_clone_stats
- def draw_clone_stats (*args)
- modrn_yemequip_luk_clnst_5tb9 (*args) # Run Original Method
- dy = WLH*YEM::EQUIP::SHOWN_STATS.size
- if @clone.luck > @actor.luck
- self.contents.font.color = power_up_color
- elsif @clone.luck < @actor.luck
- self.contents.font.color = power_down_color
- else
- self.contents.font.color = normal_color
- end
- self.contents.font.size = YEM::EQUIP::STAT_FONT_SIZE
- self.contents.draw_text(159, dy, 45, WLH, @clone.luck, 2)
- end
- end
- end
复制代码 有些我不用的功能被我注释掉了,你需要就自己改回来吧。
唔,用法很简单的 |
评分
-
查看全部评分
|