Advertisement
neonblack

Yanfly JP Fix Victory

Jun 5th, 2013
759
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.42 KB | None | 0 0
  1. ##------
  2. ## This snippet fixes a compatibility issue between CP's Grade Victory Screen
  3. ## and Yanfly's JP Manager.  The proper ordering of these scripts is Grade
  4. ## Victory, JP Manager, then this patch.
  5. ##   - Neon Black - 12.30.2012
  6. ##------
  7.  
  8. if $imported["YEA-JPManager"] && $imported["CP_VICTORY"]  ## Checks imported.
  9. module BattleManager  ## Alias the exp event.
  10.   class << self; alias cp_yanfly_jp_fix_gain_exp gain_exp; end
  11.   def self.gain_exp
  12.     gain_jp  ## Give classes JP.
  13.     cp_yanfly_jp_fix_gain_exp
  14.   end
  15.  
  16.   def self.gain_jp  ## Shortened JP gain portion.
  17.     amount = $game_troop.jp_total
  18.     for member in $game_party.members
  19.       member.earn_jp(amount)
  20.     end
  21.   end
  22. end
  23.  
  24. class Window_VictoryMain < Window_Selectable
  25.   alias cp_yanfly_basic_draw_item draw_item
  26.   def draw_item(index)  ## Adds an additional text drawing segment.
  27.     actor = $game_party.members[index]
  28.     rect = item_rect(index)
  29.     cp_yanfly_basic_draw_item(index)
  30.     draw_actor_ap_add(actor, rect.x, rect.y + (104 - line_height * 0.8).to_i,
  31.                       rect.width)
  32.   end
  33.  
  34.   def draw_actor_ap_add(actor, x, y, width)  ## Draws the gained JP value.
  35.     i = ($game_troop.jp_total * actor.jpr).to_i
  36.     return if i <= 0
  37.     vocab = sprintf(YEA::JP::VICTORY_AFTERMATH, i, Vocab.jp)
  38.     change_color(power_up_color)
  39.     draw_text(x, y, width, line_height, vocab, 1)
  40.     change_color(normal_color)
  41.   end
  42. end
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement