Advertisement
estriole

EST - SUIKODEN BRIBE RUN

Dec 13th, 2012
1,028
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.25 KB | None | 0 0
  1. =begin
  2. EST - SUIKODEN BRIBE RUN
  3. request by Deenos from RMID
  4. simulate bribe run suikoden style
  5. 100% success running by paying enemy gold
  6.  
  7. enemy have their own price to pay by setting notetags
  8. <bribe_cost 1000>
  9. will set the cost to 1000
  10. if not given notetags it will use default in module ESTRIOLE
  11.  
  12. Cannot bribe if escape is disabled (boss battle etc)
  13.  
  14. =end
  15.  
  16. $imported = {} if $imported.nil?
  17. $imported["EST - SUIKODEN BRIBE RUN"] = true
  18.  
  19. module ESTRIOLE
  20.   BRIBE_RUN_COMMAND_VOCAB = "Bribe"
  21.   BRIBE_RUN_START_ESCAPE_VOCAB = "%s's party bribe enemies by paying %d %s!"
  22.   BRIBE_RUN_DEFAULT_COST = 100
  23. end
  24.  
  25. class Window_PartyCommand < Window_Command
  26.   alias bribe_run_make_command_list make_command_list
  27.   def make_command_list
  28.     bribe_run_make_command_list
  29.     bribe_vocab = ESTRIOLE::BRIBE_RUN_COMMAND_VOCAB
  30.     add_command(bribe_vocab, :bribe, BattleManager.can_bribe?)
  31.   end
  32. end
  33.  
  34. class Scene_Battle < Scene_Base
  35.  
  36.   alias bribe_run_create_party_command_window create_party_command_window
  37.   def create_party_command_window
  38.     bribe_run_create_party_command_window
  39.     @party_command_window.set_handler(:bribe, method(:command_bribe))
  40.     @party_command_window.unselect    
  41.   end
  42.  
  43.   def command_bribe
  44.     turn_start unless BattleManager.process_bribe
  45.   end
  46.  
  47. end
  48.  
  49.  
  50. module BattleManager
  51.   def self.process_bribe
  52.     bribe_text = ESTRIOLE::BRIBE_RUN_START_ESCAPE_VOCAB
  53.     bribe_cost = $game_troop.bribe_cost
  54.     $game_message.add(sprintf(bribe_text, $game_party.name,bribe_cost,Vocab.currency_unit))
  55.     success = true
  56.     Sound.play_escape
  57.     process_abort
  58.     wait_for_message
  59.     return success
  60.   end
  61.   def self.can_bribe?
  62.     @can_escape and $game_party.gold >= $game_troop.bribe_cost
  63.   end
  64. end
  65.  
  66. class RPG::Enemy
  67.   def bribe_cost
  68.     if @bribe_cost.nil?
  69.       if @note =~ /<bribe_cost (.*)>/i
  70.         @bribe_cost = $1.to_i
  71.       else
  72.         @bribe_cost = ESTRIOLE::BRIBE_RUN_DEFAULT_COST.to_i
  73.       end
  74.     end
  75.     @bribe_cost.to_i
  76.   end    
  77. end
  78.  
  79. class Game_Enemy < Game_Battler
  80.   def bribe_cost
  81.     enemy.bribe_cost.to_i
  82.   end  
  83. end
  84.  
  85. class Game_Troop < Game_Unit
  86.   def bribe_cost
  87.     bribe_cost = 0
  88.     for member in alive_members
  89.     bribe_cost += member.bribe_cost
  90.     end
  91.     return bribe_cost
  92.   end    
  93. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement