Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2011
351
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. # E-mail: jetkobayashizala@gmail.com
  21. #===============================================================================
  22. # Instructions
  23. # -----------------------------------------------------------------------------
  24. # To install this script, open up your script editor and copy/paste this script
  25. # to an open slot below Shanghai Simple Script - Hospital Fees
  26. # but above ▼ Main. Remember to save.
  27. #
  28. # To launch the hospital scene, have a script call in an event with
  29. #    $scene = Scene_Hospital.new
  30. #
  31. # New notebox tag:
  32. #
  33. # <hospital retain>
  34. # Add this to any state that should not be removed when the hospital works its
  35. # magical healy ways. Tingly.
  36. #===============================================================================
  37.  
  38. $imported = {} if $imported == nil
  39. $imported["HospitalFeesRetainStateAddon"] = true
  40.  
  41. #==============================================================================
  42. # ** RPG::State
  43. #==============================================================================
  44.  
  45. class RPG::State
  46.   #--------------------------------------------------------------------------
  47.   # hospital_keep_state
  48.   #--------------------------------------------------------------------------
  49.   def hospital_keep_state
  50.     self.note.split(/[\r\n]+/).each { |line|
  51.       case line
  52.       when /<(?:HOSPITAL_RETAIN|hospital retain)>/i
  53.         return true
  54.       end
  55.     }
  56.     return false
  57.   end
  58. end
  59.  
  60. #==============================================================================
  61. # ** Scene_Hospital
  62. #==============================================================================
  63.  
  64. class Scene_Hospital < Scene_Base
  65.   #--------------------------------------------------------------------------
  66.   # * Update Hospital Selection
  67.   #--------------------------------------------------------------------------
  68.   def update_hospital_selection
  69.     @hospital_window.update
  70.     if Input.trigger?(Input::B)
  71.       Sound.play_cancel
  72.       @command_window.active = true
  73.       @hospital_window.active = false
  74.     elsif Input.trigger?(Input::C)
  75.       actor = @hospital_window.actor
  76.       if $game_party.gold < actor.heal_cost or actor.heal_cost == 0
  77.         Sound.play_buzzer
  78.       else
  79.         Sound.play_recovery
  80.         $game_party.lose_gold(actor.heal_cost)
  81.         @gold_window.refresh
  82.         for state in actor.states
  83.           actor.remove_state(state.id) unless state.hospital_keep_state
  84.         end
  85.         actor.hp = actor.maxhp
  86.         actor.mp = actor.maxmp
  87.         @hospital_window.draw_item(@hospital_window.index)
  88.         text = sprintf(SSS::HOSPITAL_HELP_TEXT, $game_party.heal_cost)
  89.         text = SSS::HOSPITAL_HELP_HEALTHY if $game_party.heal_cost == 0
  90.         @help_window.set_text(text, 1)
  91.       end
  92.     end
  93.   end
  94. end
  95.  
  96. #===============================================================================
  97. #
  98. # END OF FILE
  99. #
  100. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement