Advertisement
roninator2

Estriole, Yanfly victory aftermath subclass patch

Dec 7th, 2024
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.04 KB | None | 0 0
  1. #==============================================================================
  2. #
  3. # ▼ EST - YEA - SUBCLASS ADD ON - Yanfly Engine Ace - Victory Aftermath - Patch
  4. # -- Last Updated: 2019.10.12
  5. # -- Requires: Yanfly Victory Aftermath
  6. # -- addon created by: Roninator2
  7. #==============================================================================
  8. # ▼ Updates
  9. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  10. # 2019.10.12 - Started Script & finished
  11. #==============================================================================
  12. # ▼ Introduction
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # Corrects a bug where the tick counter resets for the subclass
  15. # Adds in position adjustments for the gauge and text
  16. #==============================================================================
  17.  
  18. class Game_Actor < Game_Battler
  19.   def sub_exp
  20.     return @exp[@subclass_id]
  21.   end
  22. end
  23.  
  24. class Window_VictoryEXP_Back < Window_Selectable
  25.  
  26.   def draw_exp_gain(actor, rect)
  27.     dw = rect.width - (rect.width - [rect.width, 96].min) / 2
  28.     dy = rect.y + line_height * 3 + 96
  29.     fmt = YEA::VICTORY_AFTERMATH::VICTORY_EXP
  30.     text = sprintf(fmt, actor_exp_gain(actor).group)
  31.     contents.font.size = YEA::VICTORY_AFTERMATH::FONTSIZE_EXP
  32.     change_color(power_up_color)
  33.     draw_text(rect.x, dy, dw, line_height, text, 2)
  34.   end
  35.  
  36.   def draw_sub_exp_gain(actor, rect)
  37.     return if !actor_sub_exp_gain(actor)
  38.     return if YEA::CLASS_SYSTEM::MAINTAIN_LEVELS
  39.     dw = rect.width - (rect.width - [rect.width, 96].min) / 2
  40.     dy = rect.y + line_height * 5 + 96
  41.     fmt = ESTRIOLE::VICTORY_AFTERMATH::VICTORY_SUB_EXP
  42.     text = sprintf(fmt, actor_sub_exp_gain(actor).group)
  43.     contents.font.size = YEA::VICTORY_AFTERMATH::FONTSIZE_EXP
  44.     change_color(power_up_color)
  45.     draw_text(rect.x, dy, dw, line_height, text, 2)
  46.   end
  47. end
  48.  
  49. class Window_VictoryEXP_Front < Window_VictoryEXP_Back  
  50.  
  51.   def draw_actor_sub_exp(actor, rect)
  52.     return if !actor.subclass
  53.     return if YEA::CLASS_SYSTEM::MAINTAIN_LEVELS
  54.     rect.y += line_height * 2
  55.     if actor.subclass_level == actor.subclass_max_level
  56.       draw_sub_exp_gauge(actor, rect, 1.0)
  57.       return
  58.     end
  59.     total_ticks = YEA::VICTORY_AFTERMATH::EXP_TICKS
  60.     bonus_exp = actor_sub_exp_gain(actor) * @ticks / total_ticks
  61.     now_exp = (actor.sub_exp - actor.subclass.exp_for_level(actor.subclass_level) + bonus_exp)
  62.     next_exp = actor.subclass.exp_for_level(actor.subclass_level+1) - actor.subclass.exp_for_level(actor.subclass_level)
  63.     rate = now_exp * 1.0 / next_exp
  64.     draw_sub_exp_gauge(actor, rect, rate)
  65.   end
  66.  
  67.   def draw_exp_gauge(actor, rect, rate)
  68.     rate = [[rate, 1.0].min, 0.0].max
  69.     dx = (rect.width - [rect.width, 96].min) / 2 + rect.x
  70.     dy = rect.y + line_height * 2 + 96
  71.     dw = [rect.width, 96].min
  72.     colour1 = rate >= 1.0 ? lvl_gauge1 : exp_gauge1
  73.     colour2 = rate >= 1.0 ? lvl_gauge2 : exp_gauge2
  74.     draw_gauge(dx, dy, dw, rate, colour1, colour2)
  75.     fmt = YEA::VICTORY_AFTERMATH::EXP_PERCENT
  76.     text = sprintf(fmt, [rate * 100, 100.00].min)
  77.     if [rate * 100, 100.00].min == 100.00
  78.       text = YEA::VICTORY_AFTERMATH::LEVELUP_TEXT
  79.       text = YEA::VICTORY_AFTERMATH::MAX_LVL_TEXT if actor.max_level?
  80.     end
  81.     draw_text(dx, dy, dw, line_height, text, 1)
  82.   end
  83.  
  84.   def draw_sub_exp_gauge(actor, rect, rate)
  85.     rate = [[rate, 1.0].min, 0.0].max
  86.     dx = (rect.width - [rect.width, 96].min) / 2 + rect.x
  87.     dy = rect.y + line_height * 2 + 96
  88.     dw = [rect.width, 96].min
  89.     colour1 = rate >= 1.0 ? lvl_gauge1 : exp_gauge1
  90.     colour2 = rate >= 1.0 ? lvl_gauge2 : exp_gauge2
  91.     draw_gauge(dx, dy, dw, rate, colour1, colour2)
  92.     fmt = YEA::VICTORY_AFTERMATH::EXP_PERCENT
  93.     text = sprintf(fmt, [rate * 100, 100.00].min)
  94.     if [rate * 100, 100.00].min == 100.00
  95.       text = YEA::VICTORY_AFTERMATH::LEVELUP_TEXT
  96.       text = YEA::VICTORY_AFTERMATH::MAX_LVL_TEXT if actor.subclass_level == actor.subclass_max_level
  97.     end
  98.     draw_text(dx, dy, dw, line_height, text, 1)
  99.   end
  100.  
  101. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement