Guest User

Custom Parameter Test

a guest
Dec 30th, 2016
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.65 KB | None | 0 0
  1. class RPG::Skill < RPG::UsableItem
  2.  
  3.   attr_accessor :bp_cost
  4.   attr_accessor :burst_skill
  5.  
  6.   alias recall_init initialize
  7.   def initialize
  8.     @bp_cost = 0
  9.     @burst_skill = false
  10.   end
  11.  
  12.   def check_notetag
  13.     if @note == "<final burst>"
  14.       @burst_skill = true
  15.       @bp_cost = 600
  16.     end
  17.   end
  18.  
  19. end
  20.  
  21. class Game_BattlerBase
  22.   attr_reader :bp
  23.  
  24.   def initialize
  25.     @hp = @mp = @tp = 0
  26.     @bp = 0
  27.     @hidden = false
  28.     clear_param_plus
  29.     clear_states
  30.     clear_buffs
  31.   end
  32.  
  33.   def bp=(bp)
  34.     @bp = bp
  35.     refresh
  36.   end
  37.  
  38.   def bp_max
  39.     @bp_max = mhp / 2
  40.   end
  41.  
  42.   def skill_bp_cost(skill)
  43.     skill.bp_cost
  44.   end
  45.  
  46.   def skill_cost_payable?(skill)
  47.     #unless skill.burst_skill
  48.     #  tp >= skill_tp_cost(skill) &&
  49.     #  mp >= skill_mp_cost(skill)
  50.     #else
  51.     #end
  52.    
  53.     tp >= skill_tp_cost(skill) &&
  54.     mp >= skill_mp_cost(skill) &&
  55.     bp >= skill_bp_cost(skill)
  56.  
  57.   end
  58.  
  59.   def pay_skill_cost(skill)
  60.     self.mp -= skill_mp_cost(skill)
  61.     self.tp -= skill_tp_cost(skill)
  62.     self.bp -= skill_bp_cost(skill)
  63.   end
  64. end
  65.  
  66. class Window_SkillList < Window_Selectable
  67.     def draw_skill_cost(rect, skill)
  68.     if @actor.skill_tp_cost(skill) > 0
  69.       change_color(tp_cost_color, enable?(skill))
  70.       draw_text(rect, @actor.skill_tp_cost(skill), 2)
  71.     elsif @actor.skill_mp_cost(skill) > 0
  72.       change_color(mp_cost_color, enable?(skill))
  73.       draw_text(rect, @actor.skill_mp_cost(skill), 2)
  74.     elsif skill.burst_skill && @actor.skill_bp_cost(skill) > 0
  75.         change_color(gold_color, enable?(skill))
  76.         draw_text(rect, @actor.skill_bp_cost(skill), 2)
  77.     end
  78.   end
  79. end
Advertisement
Add Comment
Please, Sign In to add comment