Advertisement
Fomar0153

Fomar0153 - AP System II

Jan 24th, 2012
2,676
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.30 KB | None | 0 0
  1. =begin
  2. AP System Script II
  3. by Fomar0153
  4. Version 1.0
  5. ----------------------
  6. Notes
  7. ----------------------
  8. No requirements
  9. Implements an ap system for you to use when creating skill
  10. systems that utilise AP.
  11. ----------------------
  12. Instructions
  13. ----------------------
  14. Notetag <ap x> e.g. <ap 4> <ap 100>
  15. ----------------------
  16. Known bugs
  17. ----------------------
  18. None
  19. =end
  20. module Vocab
  21.   ObtainAp         = "%s AP was obtained!"
  22. end
  23.  
  24. class Game_Actor < Game_Battler
  25.   #--------------------------------------------------------------------------
  26.   # ● New Method gain_ap
  27.   #--------------------------------------------------------------------------
  28.   def gain_ap(ap)
  29.     # your code goes here
  30.   end
  31. end
  32.  
  33. module BattleManager
  34.   #--------------------------------------------------------------------------
  35.   # ● Rewrote self.display_exp
  36.   #--------------------------------------------------------------------------
  37.   def self.display_exp
  38.     if $game_troop.exp_total > 0
  39.       text = sprintf(Vocab::ObtainExp, $game_troop.exp_total)
  40.       $game_message.add('\.' + text)
  41.     end
  42.     if $game_troop.ap_total > 0
  43.       text = sprintf(Vocab::ObtainAp, $game_troop.ap_total)
  44.       $game_message.add('\.' + text)
  45.     end
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # ● Rewrote self.gain_exp
  49.   #--------------------------------------------------------------------------
  50.   def self.gain_exp
  51.     $game_party.all_members.each do |actor|
  52.         actor.gain_exp($game_troop.exp_total)
  53.     end
  54.     wait_for_message
  55.     $game_party.all_members.each do |actor|
  56.     actor.gain_ap($game_troop.ap_total)
  57.     end
  58.     wait_for_message
  59.   end
  60. end
  61.  
  62. class Game_Troop < Game_Unit
  63.   #--------------------------------------------------------------------------
  64.   # ● New Method ap_total
  65.   #--------------------------------------------------------------------------
  66.   def ap_total
  67.     dead_members.inject(0) {|r, enemy| r += enemy.ap }
  68.   end
  69. end
  70.  
  71. class Game_Enemy < Game_Battler
  72.   #--------------------------------------------------------------------------
  73.   # ● New Method ap_total
  74.   #--------------------------------------------------------------------------
  75.   def ap
  76.     if enemy.note =~ /<ap (.*)>/i
  77.       return $1.to_i
  78.     else
  79.       return 0
  80.     end
  81.   end
  82. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement