Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2011
407
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.69 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # Shanghai Simple Script - Hospital Fees Retain State Add-on
  4. # Last Date Updated: 2010.09.17
  5. # Level: Normal
  6. # Original Script by: Shanghai
  7. # Add-on by: Jet Kobayashi Zala
  8. #
  9. # This script is an add-on for Shanghai Simple Script - Hospital Fees. It
  10. # adds functionality to retain states that you don't want removed from
  11. # characters when the hospital is used.
  12. #
  13. # As an add-on, this script requires that you have
  14. # Shanghai Simple Script - Hospital Fees already installed.
  15. #
  16. # This was not made by Shanghai, but by Jet Kobayashi Zala and without
  17. # Shanghai's consent and so he may end up flayed for this. If you need
  18. # help regarding this add-on, contact Jet about it, not Shanghai.
  19. #
  20. #===============================================================================
  21. # Instructions
  22. # -----------------------------------------------------------------------------
  23. # To install this script, open up your script editor and copy/paste this script
  24. # to an open slot below Shanghai Simple Script - Hospital Fees
  25. # but above ▼ Main. Remember to save.
  26. #
  27. # To launch the hospital scene, have a script call in an event with
  28. #    $scene = Scene_Hospital.new
  29. #
  30. # New notebox tag:
  31. #
  32. # <hospital retain>
  33. # Add this to any state that should not be removed when the hospital works its
  34. # magical healy ways. Tingly.
  35. #===============================================================================
  36.  
  37. $imported = {} if $imported == nil
  38. $imported["HospitalFeesRetainStateAddon"] = true
  39.  
  40. #==============================================================================
  41. # ** RPG::State
  42. #==============================================================================
  43.  
  44. class RPG::State
  45.   #--------------------------------------------------------------------------
  46.   # hospital_keep_state
  47.   #--------------------------------------------------------------------------
  48.   def hospital_keep_state
  49.     self.note.split(/[\r\n]+/).each { |line|
  50.       case line
  51.       when /<(?:HOSPITAL_RETAIN|hospital retain)>/i
  52.         return true
  53.       end
  54.     }
  55.     return false
  56.   end
  57. end
  58.  
  59. #==============================================================================
  60. # ** Scene_Hospital
  61. #==============================================================================
  62.  
  63. class Scene_Hospital < Scene_Base
  64.   #--------------------------------------------------------------------------
  65.   # * Update Hospital Selection
  66.   #--------------------------------------------------------------------------
  67.   def update_hospital_selection
  68.     @hospital_window.update
  69.     if Input.trigger?(Input::B)
  70.       Sound.play_cancel
  71.       @command_window.active = true
  72.       @hospital_window.active = false
  73.     elsif Input.trigger?(Input::C)
  74.       actor = @hospital_window.actor
  75.       if $game_party.gold < actor.heal_cost or actor.heal_cost == 0
  76.         Sound.play_buzzer
  77.       else
  78.         Sound.play_recovery
  79.         $game_party.lose_gold(actor.heal_cost)
  80.         @gold_window.refresh
  81.         for state in actor.states
  82.           actor.remove_state(state.id) unless state.hospital_keep_state
  83.         end
  84.         actor.hp = actor.maxhp
  85.         actor.mp = actor.maxmp
  86.         @hospital_window.draw_item(@hospital_window.index)
  87.         text = sprintf(SSS::HOSPITAL_HELP_TEXT, $game_party.heal_cost)
  88.         text = SSS::HOSPITAL_HELP_HEALTHY if $game_party.heal_cost == 0
  89.         @help_window.set_text(text, 1)
  90.       end
  91.     end
  92.   end
  93. end
  94.  
  95. #===============================================================================
  96. #
  97. # END OF FILE
  98. #
  99. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement