Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- Patch by estriole
- This helps you define a current actor and make a custom cost eval for
- user-based costs. More or less it helps you use a custom formula to use for
- displaying the skill cost. Only function is geared towards user-related stats.
- ==========================================================
- Requires Yanfly's Skill Cost Manager above it to function
- ==========================================================
- Use this notetag format in the skill
- <custom_cost_eval: formula>
- Replace formula with a formula
- EXAMPLE!
- <custom_cost_eval: cur_actor.level * 5>
- In the skills window, it will display the new skill cost. e.g. 5 at Lv1, 10 at Lv2
- =end
- def cur_actor
- SceneManager.scene.is_a?(Scene_Battle) ? BattleManager.actor : $game_party.menu_actor
- end
- class RPG::Skill < RPG::UsableItem
- attr_accessor :custom_cost_text_eval
- def load_notetags_scm
- @hp_cost = 0
- @gold_cost = 0
- @hp_cost_percent = 0.0
- @mp_cost_percent = 0.0
- @tp_cost_percent = 0.0
- @gold_cost_percent = 0.0
- @custom_cost_text = ""
- @custom_cost_colour = 0
- @custom_cost_size = 20
- @custom_cost_icon = 0
- @custom_cost_requirement = ""
- @custom_cost_perform = ""
- @use_custom_cost = false
- @custom_cost_req_on = false
- @custom_cost_per_on = false
- #---
- self.note.split(/[\r\n]+/).each { |line|
- case line
- #---
- when YEA::REGEXP::SKILL::MP_COST_SET
- @mp_cost = $1.to_i
- when YEA::REGEXP::SKILL::MP_COST_PER
- @mp_cost_percent = $1.to_i * 0.01
- when YEA::REGEXP::SKILL::TP_COST_SET
- @tp_cost = $1.to_i
- when YEA::REGEXP::SKILL::TP_COST_PER
- @tp_cost_percent = $1.to_i * 0.01
- when YEA::REGEXP::SKILL::HP_COST_SET
- @hp_cost = $1.to_i
- when YEA::REGEXP::SKILL::HP_COST_PER
- @hp_cost_percent = $1.to_i * 0.01
- when YEA::REGEXP::SKILL::GOLD_COST_SET
- @gold_cost = $1.to_i
- when YEA::REGEXP::SKILL::GOLD_COST_PER
- @gold_cost_percent = $1.to_i * 0.01
- #---
- when YEA::REGEXP::SKILL::HP_COST_MIN
- @hp_cost_min = $1.to_i
- when YEA::REGEXP::SKILL::HP_COST_MAX
- @hp_cost_max = $1.to_i
- when YEA::REGEXP::SKILL::MP_COST_MIN
- @mp_cost_min = $1.to_i
- when YEA::REGEXP::SKILL::MP_COST_MAX
- @mp_cost_max = $1.to_i
- when YEA::REGEXP::SKILL::TP_COST_MIN
- @tp_cost_min = $1.to_i
- when YEA::REGEXP::SKILL::TP_COST_MAX
- @tp_cost_max = $1.to_i
- when YEA::REGEXP::SKILL::GOLD_COST_MIN
- @gold_cost_min = $1.to_i
- when YEA::REGEXP::SKILL::GOLD_COST_MAX
- @gold_cost_max = $1.to_i
- #---
- when YEA::REGEXP::SKILL::CUSTOM_COST_TEXT
- @custom_cost_text = $1.to_s
- when /<(?:CUSTOM_COST_EVAL|custom cost eval):[ ](.*)>/i
- @custom_cost_text_eval = $1.to_s
- when YEA::REGEXP::SKILL::CUSTOM_COST_COLOUR
- @custom_cost_colour = $1.to_i
- when YEA::REGEXP::SKILL::CUSTOM_COST_SIZE
- @custom_cost_size = $1.to_i
- when YEA::REGEXP::SKILL::CUSTOM_COST_ICON
- @custom_cost_icon = $1.to_i
- when YEA::REGEXP::SKILL::CUSTOM_COST_REQUIREMENT_ON
- @custom_cost_req_on = true
- @use_custom_cost = true
- when YEA::REGEXP::SKILL::CUSTOM_COST_REQUIREMENT_OFF
- @custom_cost_req_on = false
- @use_custom_cost = true
- when YEA::REGEXP::SKILL::CUSTOM_COST_PERFORM_ON
- @custom_cost_per_on = true
- @use_custom_cost = true
- when YEA::REGEXP::SKILL::CUSTOM_COST_PERFORM_OFF
- @custom_cost_per_on = false
- @use_custom_cost = true
- else
- @custom_cost_requirement += line.to_s if @custom_cost_req_on
- @custom_cost_perform += line.to_s if @custom_cost_per_on
- #---
- end
- } # self.note.split
- #---
- end
- end
- class Window_SkillList < Window_Selectable
- def draw_custom_skill_cost(rect, skill)
- return unless skill.use_custom_cost
- change_color(text_color(skill.custom_cost_colour), enable?(skill))
- icon = skill.custom_cost_icon
- if icon > 0
- draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
- rect.width -= 24
- end
- contents.font.size = skill.custom_cost_size
- text = eval(skill.custom_cost_text_eval).to_i.to_s + skill.custom_cost_text
- draw_text(rect, text, 2)
- cx = text_size(text).width + 4
- rect.width -= cx
- reset_font_settings
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment