IceDragon200

FFVI - Collesseum (FFX)

Jul 19th, 2011
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 33.23 KB | None | 0 0
  1. =begin #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-# begin=
  2. #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
  3. Final Fantasy VI Colosseum
  4. Author of script to Credit: FenixFyreX
  5. Special Thanks and some credits go to:
  6. IceDragon
  7. Without him, this script might not have been created.
  8. He helped with the regular expressions, and threw the idea of the wondrous $
  9. at me. He also provided the knowledge of how to put a single enemy into a fake
  10. troop to battle.
  11. So, if you use this script, credit me (FenixFyreX) and IceDragon.
  12. Also, crediting Nintendo for Final Fantasy VI wouldn't be a bad idea either.
  13. TO USE THIS SCRIPT:
  14. Call the script by using
  15. call_colosseum
  16. with the Advanced...Script command.
  17. To create a Colosseum Item.
  18. You put <COLOSSEUM> in its notebox followed by <TROOP_MON enemy_id> where
  19. enemy_id is the id of the monster you wish to fight.
  20. <COLOSSEUM>
  21. <TROOP_MON enemy_id>
  22. #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
  23. =end #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-# end=
  24. module COLOSSEUM
  25.   #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
  26.   # TECHNICAL SETUP
  27.   #
  28.   # This is the main config for the colosseum script.
  29.   #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
  30.   module TECHNIKALZ
  31.     # This is the title of the scene when you open the scene in-game.
  32.     NAME_OF_SCENE = "Colosseum"
  33.     # These define what the confirm box shows when you are confirming your
  34.     # item selection in the Colosseum.
  35.     CONFIRM_CHOICE_1 = "Yes"
  36.     CONFIRM_CHOICE_2 = "No"
  37.     # What the message you wish to read at the end of the battle. The first
  38.     # %s is the name of the actor battling. the second %s is the item you
  39.     # recieved.
  40.     GET_ITEM_MSG = "For winning, %s's party recieved %s."
  41.     # What the help window reads in Scene_Colosseum when the item you select
  42.     # cannot be wagered.
  43.     BUZZER_MSG = "Can't wager that item."
  44.     # Defines what the help window reads as you choose which actor to fight
  45.     # in the colosseum. This is only if ONE_ON_ONE is true.
  46.     CHOOSE_ACTOR_TEXT = "Choose Your Actor"
  47.     # This is what the help window reads as you confirm the item you wish to
  48.     # wager.
  49.     CONFIRM_MESSAGE = "Are you sure?"
  50.     # This is what shows in the item window when selecting your actor.
  51.     WHAT_TO_GET_TXT = "You will get one " #make sure there is a space at the e
  52.     nd.
  53.     # This is what shows in the item window when the selected actor is dead.
  54.     DEAD_ACTOR_MSG = "That character is dead!"
  55.     # This defines the message in a colosseum battle when an enemy tries to
  56.     # escape. %s is the enemy's name.
  57.     NO_ESCAPE_MSG = "%s tried to escape!"
  58.     # This is the message when you have no items in your party. This
  59.     # sentence can only have one period in it o.0
  60.     NO_ITEMS_o_0 = "Come back when you have an item."
  61.     # Do you want the player to lose the selected item, as in a fee for
  62.     # participating in-game?
  63.     LOSE_ORIG_ITEM = true
  64.     # What battle system are you using? As of right now, this only includes
  65.     # the default battle system and tankentai, but melody should be supported
  66.     # soon.
  67.     BATTLE_SYSTEM = "default" # Must be "default", "tankentai", or "melody"
  68.     # Do you wish to have your actor auto-battle? If so, set this to true.
  69.     AUTO_BATTLE = true
  70.     # Do you wish to have one-on-one battles in the colosseum? This means that
  71.     # the player would select one party member to battle in the colosseum.
  72.     ONE_ON_ONE = false
  73.     # Which direction should the character face in the actor selection window?
  74.     CHAR_DIRECTION = 0
  75.     # Which direction should the character face in the area below the colosseum
  76.     # windows?
  77.     CHAR_POSE = 1
  78.     # Should the player gain experience and gold at the end of the colosseum
  79.     # battle?
  80.     GAIN_EXP_AND_GOLD = false
  81.     # Do you want the actor participating in the colosseum to have their HP, MP,
  82.     # and states restored / restored / removed before the battle?
  83.     B4_HP_FULL = true
  84.     # Do you want the actor participating in the colosseum to have their HP, MP,
  85.     # and states restored / restored / removed after the battle?
  86.     RESTORE_HEALTH = true
  87.     # This is the message the player gets when all of the members of the party
  88.     # are dead, and the colosseum is called.
  89.     CANT_CALL_SCNE = "None of you are fit to battle."
  90.     # This defines whether you want large battlers to be shrank by half when
  91.     # a colosseum battle ensues.
  92.     SHRINK_L_BAT = true
  93.     # This 'lil option defines whether you want to up the FPS when in a
  94.     # colosseum battle. Trust me, these battles get a bit draggy, unless
  95.     # you don't use AUTO_BATTLE.
  96.     USE_FPS_CHANGE = true
  97.     FPS_CHANGE_SPD = 100
  98.   end # module TECHNIKALZ
  99.   #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
  100.   # REGULAR EXPRESSIONS SETUP
  101.   #
  102.   # You prpbably shouldn't touch this if you don't know what you are doing.
  103.   #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
  104.   module REGEXP
  105.     # These define what to look for in the note tag of each item.
  106.     COLOSSEUM_USE = /<(?:COLOSSEUM)>/i # Item can be used for Colosseum?
  107.     TROOP_MON = /<(?:TROOP_MON􀀀troop mon)[ ]*(\d+)>/i # Monster to add to troop
  108.     ITEM_TYPE = /<(?:ITEM_TYPE􀀀item type)[ ]*(\w+)>/i # Item to get's type
  109.     ITEM_GET = /<(?:ITEM_GET􀀀item get)[ ]*(\d+)>/i # Item to get
  110.   end
  111. end
  112. ################################################################################
  113. # ##############################################################################
  114. # #
  115. # # END CONFIGURATION
  116. # #
  117. # # PLEASE DO NOT TOUCH BELOW
  118. # #
  119. # ##############################################################################
  120. ################################################################################
  121. $colosseum_battle = false
  122. $colosseum_item = nil
  123. $colosseum_troop_monster_id = nil
  124. $colosseum_item_get_type = nil
  125. $colosseum_item_get = nil
  126. $imported = {} if $imported == nil
  127. $imported["FxFyXColosseum"] = true
  128. class Scene_Base
  129.   include COLOSSEUM
  130. end
  131. class Window_Base
  132.   include COLOSSEUM
  133. end
  134. class Game_Troop < Game_Unit
  135.   include COLOSSEUM
  136. end
  137. ################################################################################
  138. # ##############################################################################
  139. # #
  140. # # END BEGINNING
  141. # #
  142. # # SCRIPT STARTS BELOW
  143. # #
  144. # ##############################################################################
  145. ################################################################################
  146. class Scene_Colosseum < Scene_Base
  147.   #--------------------------------------------------------------------------
  148.   # * Start processing
  149.   #--------------------------------------------------------------------------
  150.   def start
  151.     super
  152.     @viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
  153.     @help_window = Window_Help.new
  154.     @help_window.viewport = @viewport
  155.     @help_window.y = 56
  156.     @name_window = Window_Help.new
  157.     @name_window.viewport = @viewport
  158.     @name_window.set_text(TECHNIKALZ::NAME_OF_SCENE, 1)
  159.     @item_window = Window_Item.new(0, 112, Graphics.width, Graphics.height - 112
  160.     )
  161.     @item_window.viewport = @viewport
  162.     @item_window.help_window = @help_window
  163.     @item_window.active = true
  164.     @actor_window = Window_SelectActor.new(0, (@help_window.x + (@help_window.he
  165.                                                                  ight * 2)))
  166.     @actor_window.viewport = @viewport
  167.     @actor_window.visible = false
  168.     @actor_window.active = false
  169.     @help_window2 = Window_Help.new
  170.     @help_window2.viewport = @viewport
  171.     @help_window2.width = Graphics.width - @actor_window.width
  172.     @help_window2.height = @actor_window.height
  173.     @help_window2.x = @actor_window.width
  174.     @help_window2.y = @actor_window.y
  175.     @help_window2.visible = false
  176.     @bkgd_window = Window_ColosseumPic.new(-11, -11)
  177.     @bkgd_window.viewport = @viewport
  178.     @bkgd_window.visible = false
  179.     @bkgd_window.active = false
  180.     create_command_window
  181.   end
  182.   #--------------------------------------------------------------------------
  183.   # * Create Confirm Window
  184.   #--------------------------------------------------------------------------
  185.   def create_command_window
  186.     s1 = TECHNIKALZ::CONFIRM_CHOICE_1
  187.     s2 = TECHNIKALZ::CONFIRM_CHOICE_2
  188.     @command_window = Window_Command.new(128, [s1, s2])
  189.     @command_window.openness = 0
  190.     @command_window.active = false
  191.     @command_window.x = (Graphics.width / 2) - (@command_window.width / 2)
  192.     @command_window.y = (Graphics.height / 2) - (@command_window.height / 2)
  193.   end
  194.   #--------------------------------------------------------------------------
  195.   # * Termination Processing
  196.   #--------------------------------------------------------------------------
  197.   def terminate
  198.     super
  199.     @viewport.dispose
  200.     @help_window.dispose
  201.     @help_window2.dispose
  202.     @name_window.dispose
  203.     @item_window.dispose
  204.     @actor_window.dispose
  205.     @bkgd_window.dispose
  206.     @command_window.dispose
  207.   end
  208.   #--------------------------------------------------------------------------
  209.   # * Return to Original Screen
  210.   #--------------------------------------------------------------------------
  211.   def return_scene
  212.     $scene = Scene_Map.new
  213.   end
  214.   #--------------------------------------------------------------------------
  215.   # * Update Frame
  216.   #--------------------------------------------------------------------------
  217.   def update
  218.     super
  219.     @help_window.update
  220.     if not @actor_window.active
  221.       @item_window.update
  222.     end
  223.     @command_window.update
  224.     @actor_window.update
  225.     if @item_window.active
  226.       update_item_selection
  227.     elsif @command_window.active
  228.       update_command_selection
  229.     elsif @actor_window.active
  230.       update_actor_selection
  231.     end
  232.   end
  233.   #--------------------------------------------------------------------------
  234.   # * Update Item Selection
  235.   #--------------------------------------------------------------------------
  236.   def update_item_selection
  237.     if Input.trigger?(Input::B)
  238.       Sound.play_cancel
  239.       return_scene
  240.     elsif Input.trigger?(Input::C)
  241.       @item = $game_temp.lose_item = @item_window.item
  242.       $game_temp.item_type = @item.col_i_type
  243.       if @item != nil and @item.colosseum_use?
  244.         $game_temp.colosseum_item_id = @item.id
  245.         $colosseum_item_get_type = @item.colosseum_item_get_type
  246.         $colosseum_item_get = @item.colosseum_item_get
  247.         Sound.play_decision
  248.         open_command_window
  249.       else
  250.         @name_window.set_text(TECHNIKALZ::BUZZER_MSG, 1)
  251.         Sound.play_buzzer
  252.         Graphics.wait(40)
  253.         @name_window.set_text(TECHNIKALZ::NAME_OF_SCENE, 1)
  254.       end
  255.     end
  256.   end
  257.   #--------------------------------------------------------------------------
  258.   # * Update Yes/No Selection
  259.   #--------------------------------------------------------------------------
  260.   def update_command_selection
  261.     @command_window.update
  262.     if Input.trigger?(Input::UP)
  263.       Sound.play_cursor
  264.       if @command_window.index == 1
  265.         @command_window.index = 0
  266.       elsif @command_window.index == 0
  267.         @command_window.index = 1
  268.       end
  269.     elsif Input.trigger?(Input::DOWN)
  270.       Sound.play_cursor
  271.       if @command_window.index == 0
  272.         @command_window.index = 1
  273.       elsif @command_window.index == 1
  274.         @command_window.index = 0
  275.       end
  276.     elsif Input.trigger?(Input::B)
  277.       Sound.play_cancel
  278.       hide_command_window
  279.     elsif Input.trigger?(Input::C)
  280.       case @command_window.index
  281.         when 0
  282.         Sound.play_decision
  283.         setup_col_item
  284.         setup_actor_selection
  285.         when 1
  286.         Sound.play_cancel
  287.         hide_command_window
  288.       end
  289.     end
  290.   end
  291.   def setup_col_item
  292.     case $game_temp.item_type
  293.       when 0
  294.       $colosseum_item = $data_items[$game_temp.colosseum_item_id]
  295.       when 1
  296.       $colosseum_item = $data_weapons[$game_temp.colosseum_item_id]
  297.       when 2
  298.       $colosseum_item = $data_armors[$game_temp.colosseum_item_id]
  299.     end
  300.   end
  301.   def update_actor_selection
  302.     if Input.trigger?(Input::B)
  303.       Sound.play_cancel
  304.       $game_system.clear_colosseum
  305.       return_scene
  306.     end
  307.     if Input.trigger?(Input::C)
  308.       if TECHNIKALZ::ONE_ON_ONE
  309.         if $game_party.members[@actor_window.index].dead?
  310.           Sound.play_buzzer
  311.           @help_window.set_text(TECHNIKALZ::DEAD_ACTOR_MSG, 1)
  312.           Graphics.wait(35)
  313.           @help_window.set_text(TECHNIKALZ::CHOOSE_ACTOR_TEXT, 1)
  314.         else
  315.           Sound.play_decision
  316.           call_battle
  317.         end
  318.       else
  319.         Sound.play_decision
  320.         call_battle
  321.       end
  322.     end
  323.     if TECHNIKALZ::ONE_ON_ONE
  324.       if Input.repeat?(Input::RIGHT)
  325.         @bkgd_window.update
  326.         Sound.play_cursor
  327.         if @actor_window.index != $game_party.members.size - 1
  328.           @actor_window.index += 1
  329.           $game_temp.colosseum_actor_index += 1
  330.         else
  331.           @actor_window.index = 0
  332.           $game_temp.colosseum_actor_index = 0
  333.         end
  334.       end
  335.       if Input.repeat?(Input::LEFT)
  336.         Sound.play_cursor
  337.         @bkgd_window.update
  338.         if @actor_window.index != 0
  339.           @actor_window.index -= 1
  340.           $game_temp.colosseum_actor_index -= 1
  341.         else
  342.           @actor_window.index = $game_party.members.size - 1
  343.           $game_temp.colosseum_actor_index = $game_party.members.size - 1
  344.         end
  345.       end
  346.     end
  347.   end
  348.   #--------------------------------------------------------------------------
  349.   # * Open Command Window
  350.   #--------------------------------------------------------------------------
  351.   def open_command_window
  352.     @item_window.active = false
  353.     @command_window.open
  354.     @command_window.active = true
  355.     @help_window.set_text(TECHNIKALZ::CONFIRM_MESSAGE, 1)
  356.   end
  357.   #--------------------------------------------------------------------------
  358.   # * Hide Command Window
  359.   #--------------------------------------------------------------------------
  360.   def hide_command_window
  361.     @command_window.close
  362.     @item_window.active = true
  363.     @command_window.active = false
  364.     @command_window.update
  365.   end
  366.   #--------------------------------------------------------------------------
  367.   # * Setup Actor Selection
  368.   #--------------------------------------------------------------------------
  369.   def setup_actor_selection
  370.     Graphics.fadeout(10)
  371.     @item_window.active = false
  372.     @item_window.openness = 0
  373.     @command_window.active = false
  374.     @command_window.openness = 0
  375.     @help_window.set_text(TECHNIKALZ::CHOOSE_ACTOR_TEXT, 1)
  376.     @actor_window.active = true
  377.     @actor_window.index = 0
  378.     $game_temp.colosseum_actor_index = @actor_window.index
  379.     @bkgd_window.visible = true
  380.     @bkgd_window.update
  381.     @help_window2.visible = true
  382.     set_help_window2_text
  383.     @actor_window.visible = true
  384.     Graphics.fadein(10)
  385.   end
  386.   #--------------------------------------------------------------------------
  387.   # * Setup Actor Selection
  388.   #--------------------------------------------------------------------------
  389.   def set_help_window2_text
  390.     if $colosseum_item_get_type == "item" # change
  391.       item = $data_items[$colosseum_item_get].name.to_s
  392.       @help_window2.set_text(TECHNIKALZ::WHAT_TO_GET_TXT + item + ".", 1)
  393.     elsif $colosseum_item_get_type == "weapon"
  394.       item = $data_weapons[$colosseum_item_get].name.to_s
  395.       @help_window2.set_text(TECHNIKALZ::WHAT_TO_GET_TXT + item + ".", 1)
  396.     elsif $colosseum_item_get_type == "armor"
  397.       item = $data_armors[$colosseum_item_get].name.to_s
  398.       @help_window2.set_text(TECHNIKALZ::WHAT_TO_GET_TXT + item + ".", 1)
  399.     end
  400.   end
  401.   #--------------------------------------------------------------------------
  402.   # * Call Colosseum Battle
  403.   #--------------------------------------------------------------------------
  404.   def call_battle
  405.     if TECHNIKALZ::LOSE_ORIG_ITEM then $game_party.lose_item(@item, 1) end
  406.     $colosseum_battle = true
  407.     if $colosseum_battle == true and $colosseum_item != nil
  408.       if TECHNIKALZ::AUTO_BATTLE
  409.         if TECHNIKALZ::ONE_ON_ONE
  410.           $game_temp.orig_auto_battle = $data_actors[$game_party.members[@actor_
  411.           window.index].id].auto_battle
  412.           kept_member = $game_party.members[@actor_window.index].id
  413.           $game_temp.kept_member = kept_member
  414.           $data_actors[kept_member].auto_battle = true
  415.           memberz = $game_party.members
  416.           $game_temp.old_party = []
  417.           for actor in memberz
  418.             $game_temp.old_party.push actor.id
  419.           end
  420.           old_party = $game_temp.old_party
  421.           $game_party.remove_actor(old_party[0]) unless old_party.size < 1
  422.           $game_party.remove_actor(old_party[1]) unless old_party.size < 2
  423.           $game_party.remove_actor(old_party[2]) unless old_party.size < 3
  424.           $game_party.remove_actor(old_party[3]) unless old_party.size < 4
  425.           $game_party.add_actor(kept_member)
  426.         else
  427.           for actor in $game_party.members
  428.             actor_auto = $data_actors[actor.id].auto_battle
  429.             $game_temp.orig_auto_battle = []
  430.             $game_temp.orig_auto_battle.push actor_auto
  431.             $data_actors[actor.id].auto_battle = true
  432.           end
  433.         end
  434.       end
  435.       if TECHNIKALZ::B4_HP_FULL
  436.         for member in $game_party.members
  437.           member.recover_all
  438.         end
  439.       end
  440.       $game_troop.setup_colosseum_troop($colosseum_item)
  441.       $game_troop.can_escape = false
  442.       $game_troop.can_lose = true
  443.       $game_temp.map_bgm = RPG::BGM.last
  444.       $game_temp.map_bgs = RPG::BGS.last
  445.       RPG::BGM.stop
  446.       RPG::BGS.stop
  447.       Sound.play_battle_start
  448.       $game_system.battle_bgm.play
  449.       $game_temp.next_scene = nil
  450.       $game_temp.battle_proc = nil
  451.       $scene = Scene_Battle.new
  452.       if TECHNIKALZ::USE_FPS_CHANGE
  453.         Graphics.frame_rate = TECHNIKALZ::FPS_CHANGE_SPD
  454.       end
  455.     end
  456.   end
  457. end
  458. class Window_SelectActor < Window_Selectable
  459.   #--------------------------------------------------------------------------
  460.   # * Object Initialization
  461.   # x : window X coordinate
  462.   # y : window Y coordinate
  463.   #--------------------------------------------------------------------------
  464.   def initialize(x, y)
  465.     super(x, y, 224, 72)
  466.     refresh
  467.     self.active = false
  468.     self.index = -1
  469.   end
  470.   #--------------------------------------------------------------------------
  471.   # * Refresh
  472.   #--------------------------------------------------------------------------
  473.   def refresh
  474.     self.contents.clear
  475.     if TECHNIKALZ::ONE_ON_ONE
  476.       @index = $game_party.members.size
  477.       for actor in $game_party.members
  478.         if not actor.dead?
  479.           draw_actor_graphic(actor, (actor.index * 48) + 24, 34, dir = TECHNIKAL
  480.           Z::CHAR_DIRECTION)
  481.         else
  482.           draw_actor_graphic(actor, (actor.index * 48) + 24, 34, dir = 4)
  483.         end
  484.       end
  485.     else
  486.       @index = 0
  487.       for actor in $game_party.members
  488.         if not actor.dead?
  489.           draw_actor_graphic(actor, (actor.index * 48) + 24, 34, dir = TECHNIKAL
  490.           Z::CHAR_DIRECTION)
  491.         else
  492.           draw_actor_graphic(actor, (actor.index * 48) + 24, 34, dir = 4)
  493.         end
  494.       end
  495.     end
  496.   end
  497.   #--------------------------------------------------------------------------
  498.   # * Update cursor
  499.   #--------------------------------------------------------------------------
  500.   if not COLOSSEUM::TECHNIKALZ::ONE_ON_ONE
  501.     def update_cursor
  502.       if @index < 0 and TECHNIKALZ::ONE_ON_ONE # No cursor
  503.         self.cursor_rect.empty
  504.       elsif @index < @item_max
  505.         if TECHNIKALZ::ONE_ON_ONE
  506.           self.cursor_rect.set(@index * 48, -4, 48, 48)
  507.         else
  508.           self.cursor_rect.set(-4, -4, 200, 48)
  509.         end
  510.       elsif @index >= 100 and TECHNIKALZ::ONE_ON_ONE # Self
  511.         self.cursor_rect.set(@index * 48, -4, 48, 48)
  512.       else # All
  513.         self.cursor_rect.set(-4, -4, 200, 48)
  514.       end
  515.     end
  516.   else
  517.     def update_cursor
  518.       if @index < 0 # No cursor
  519.         self.cursor_rect.empty
  520.       elsif @index < @item_max # Normal
  521.         self.cursor_rect.set(@index * 48, -4, 48, 48)
  522.       elsif @index >= 100 # Self
  523.         self.cursor_rect.set(@index * 48, -4, 48, 48)
  524.       else # All
  525.         self.cursor_rect.set(@index * 48, -4, 48, 48)
  526.       end
  527.     end
  528.   end
  529. end
  530. class Window_ColosseumPic < Window_Selectable
  531.   #--------------------------------------------------------------------------
  532.   # * Object Initialization
  533.   # x : window X coordinate
  534.   # y : window Y coordinate
  535.   #--------------------------------------------------------------------------
  536.   def initialize(x, y)
  537.     super(x, y, Graphics.width + 128, Graphics.height + 128)
  538.     self.active = false
  539.     self.index = -1
  540.     self.opacity = 0
  541.     self.z = -1
  542.     draw_picture
  543.     refresh_stuffz
  544.   end
  545.   #--------------------------------------------------------------------------
  546.   # * Draw Picture
  547.   #--------------------------------------------------------------------------
  548.   def draw_picture
  549.     bitmap = Cache.picture("Colosseum_Bkgd")
  550.     rect = Rect.new(0, 0, 0, 0)
  551.     rect.x = 0
  552.     rect.y = 0
  553.     rect.width = Graphics.width + 64
  554.     rect.height = Graphics.height + 64
  555.     self.contents.blt(x, y, bitmap, rect)
  556.     bitmap.dispose
  557.   end
  558.   #--------------------------------------------------------------------------
  559.   # * Draw Actor Details
  560.   #--------------------------------------------------------------------------
  561.   def draw_actor_details
  562.     x = 390
  563.     y = 362
  564.     if TECHNIKALZ::ONE_ON_ONE
  565.       return unless $game_temp.colosseum_actor_index != nil
  566.       actor = $data_actors[$game_party.members[$game_temp.colosseum_actor_index]
  567.       .id]
  568.       if $game_party.members[$game_temp.colosseum_actor_index].dead?
  569.         text = sprintf("%s Can't Battle!", actor.name)
  570.         cx = contents.text_size(text).width
  571.         self.contents.draw_text(x - (cx / 2), y - 10, cx, WLH + 20, text, 1)
  572.       end
  573.       if !$game_party.members[$game_temp.colosseum_actor_index].dead?
  574.         draw_actor_graphic(actor, x, y, dir = TECHNIKALZ::CHAR_POSE)
  575.       else
  576.         draw_actor_graphic(actor, x, y, dir = 3)
  577.       end
  578.     else
  579.       for actor in $game_party.members
  580.         cy = y - (actor.index * 40) - 10
  581.         if actor.dead?
  582.           text = sprintf("%s Can't Battle!", actor.name)
  583.           cx = contents.text_size(text).width
  584.           dx = x + 26
  585.           draw_actor_graphic(actor, x, cy + 10, dir = 2)
  586.           self.contents.draw_text(dx, cy - 10, cx, WLH + 20, text, 1)
  587.         else
  588.           draw_actor_graphic(actor, x, cy + 10, dir = TECHNIKALZ::CHAR_POSE)
  589.         end
  590.       end
  591.     end
  592.   end
  593.   def draw_monster_details
  594.     for monster in $colosseum_item.colosseum_troop
  595.       i = $data_enemies[monster]
  596.       bitmap = Cache.battler(i.battler_name, i.battler_hue)
  597.       rect = Rect.new(0, 0, 0, 0)
  598.       rect.x = -100
  599.       rect.y = -300
  600.       rect.width = Graphics.width
  601.       rect.height = Graphics.height
  602.       self.contents.blt(x, y, bitmap, rect)
  603.       bitmap.dispose
  604.       text = i.name.to_s
  605.       cx = contents.text_size(text).width
  606.       self.contents.draw_text(-(rect.x), -(rect.y) - 50, cx, WLH + 20, text, 1)
  607.     end
  608.   end
  609.   alias updt update unless $@
  610.   def update
  611.     refresh_stuffz
  612.     updt
  613.   end
  614.   #--------------------------------------------------------------------------
  615.   # * Refresh
  616.   #--------------------------------------------------------------------------
  617.   def refresh_stuffz
  618.     self.contents.clear
  619.     draw_picture
  620.     if $colosseum_item != nil
  621.       draw_monster_details
  622.     end
  623.     draw_actor_details
  624.   end
  625. end
  626. class Window_Item
  627.   def enable?(item)
  628.     if $scene.is_a?(Scene_Colosseum)
  629.       return item.colosseum_use?
  630.     else
  631.       return $game_party.item_can_use?(item)
  632.     end
  633.   end
  634. end
  635. class Game_Temp
  636.   attr_accessor :colosseum_item_id
  637.   attr_accessor :colosseum_actor_index
  638.   attr_accessor :orig_auto_battle
  639.   attr_accessor :old_party
  640.   attr_accessor :kept_member
  641.   attr_accessor :item_type
  642.   attr_accessor :lose_item
  643.   alias colosseum_scene_init initialize unless $@
  644.   def initialize
  645.     colosseum_scene_init
  646.     @colosseum_item_id = nil
  647.     @colosseum_actor_index = nil
  648.     @orig_auto_battle = nil
  649.     @old_party = nil
  650.     @kept_member = nil
  651.     @item_type = nil
  652.     @lose_item = nil
  653.   end
  654. end
  655. class Game_Enemy
  656.   def escape
  657.     if !$colosseum_battle
  658.       @hidden = true
  659.       @action.clear
  660.     end
  661.   end
  662. end
  663. class Scene_Battle < Scene_Base
  664.   alias no_exc_act_escape execute_action_escape unless $@
  665.   def execute_action_escape
  666.     if not $colosseum_battle
  667.       no_exc_act_escape
  668.     else
  669.       text = sprintf(TECHNIKALZ::NO_ESCAPE_MSG, @active_battler.name)
  670.       @message_window.add_instant_text(text)
  671.       Sound.play_miss
  672.       wait(45)
  673.     end
  674.   end
  675.   alias colosseum_process_victory process_victory unless $@
  676.   def process_victory
  677.     if $colosseum_battle == true
  678.       @info_viewport.visible = false
  679.       @message_window.visible = true
  680.       RPG::BGM.stop
  681.       $game_system.battle_end_me.play
  682.       display_colosseum_drop_items
  683.       if TECHNIKALZ::GAIN_EXP_AND_GOLD
  684.         display_exp_and_gold
  685.         display_level_up
  686.       end
  687.       unless $BTEST
  688.         $game_temp.map_bgm.play
  689.         $game_temp.map_bgs.play
  690.       end
  691.       battle_end(0)
  692.     else
  693.       colosseum_process_victory
  694.     end
  695.   end
  696.   if not TECHNIKALZ::LOSE_ORIG_ITEM
  697.     alias colosseum_procs_dft process_defeat unless $@
  698.     def process_defeat
  699.       $game_party.lose_item($game_temp.lose_item, 1)
  700.       colosseum_procs_dft
  701.     end
  702.   end
  703.   def display_colosseum_drop_items
  704.     if $colosseum_item_get != nil or $colosseum_item_get_type != nil
  705.       party = $game_party.name
  706.       if $colosseum_item_get_type == "item"
  707.         item = $data_items[$colosseum_item_get]
  708.         $game_party.gain_item(item, 1)
  709.         text = sprintf(TECHNIKALZ::GET_ITEM_MSG, party, item.name)
  710.         $game_message.texts.push(text)
  711.       elsif $colosseum_item_get_type == "weapon"
  712.         item = $data_weapons[$colosseum_item_get]
  713.         $game_party.gain_item(item, 1)
  714.         text = sprintf(TECHNIKALZ::GET_ITEM_MSG, party, item.name)
  715.         $game_message.texts.push(text)
  716.       elsif $colosseum_item_get_type == "armor"
  717.         item = $data_armors[$colosseum_item_get]
  718.         $game_party.gain_item(item, 1)
  719.         text = sprintf(TECHNIKALZ::GET_ITEM_MSG, party, item.name)
  720.         $game_message.texts.push(text)
  721.       end
  722.       wait_for_message
  723.     end
  724.   end
  725.   alias colosseum_battle_end battle_end unless $@
  726.   def battle_end(*args)
  727.     colosseum_battle_end(*args)
  728.     if $colosseum_battle
  729.       if TECHNIKALZ::AUTO_BATTLE
  730.         if TECHNIKALZ::ONE_ON_ONE
  731.           if TECHNIKALZ::RESTORE_HEALTH
  732.             $game_party.members[0].recover_all
  733.           end
  734.           kept_member = $game_temp.kept_member
  735.           $data_actors[$game_temp.kept_member].auto_battle = $game_temp.orig_aut
  736.           o_battle
  737.           $game_party.remove_actor(kept_member)
  738.           $game_party.add_actor($game_temp.old_party[0]) unless $game_temp.old_p
  739.           arty.size < 1
  740.           $game_party.add_actor($game_temp.old_party[1]) unless $game_temp.old_p
  741.           arty.size < 2
  742.           $game_party.add_actor($game_temp.old_party[2]) unless $game_temp.old_p
  743.           arty.size < 3
  744.           $game_party.add_actor($game_temp.old_party[3]) unless $game_temp.old_p
  745.           arty.size < 4
  746.         else
  747.           for actor in $game_party.members
  748.             $data_actors[actor.id].auto_battle = $game_temp.orig_auto_battle[act
  749.             or.index]
  750.           end
  751.         end
  752.       end
  753.       $game_system.clear_colosseum
  754.       if TECHNIKALZ::USE_FPS_CHANGE
  755.         Graphics.frame_rate = 60
  756.       end
  757.     end
  758.   end
  759. end
  760. class Game_System
  761.   def clear_colosseum
  762.     $game_temp.old_party = nil
  763.     $game_temp.kept_member = nil
  764.     $game_temp.colosseum_item_id = nil
  765.     $game_temp.orig_auto_battle = nil
  766.     $game_temp.colosseum_actor_index = nil
  767.     $game_temp.lose_item = nil
  768.     $game_temp.item_type = nil
  769.     $colosseum_battle = false
  770.     $colosseum_item = nil
  771.     $colosseum_troop_monster_id = nil
  772.     $colosseum_item_get_type = nil
  773.     $colosseum_item_get = nil
  774.   end
  775. end
  776. if not $imported["FxFyX_CALL_IN"]
  777.   class Game_Battler
  778.     def recover_all(hp = true, mp = true, s = true)
  779.       if hp
  780.         if state?(1)
  781.           remove_state(1)
  782.         end
  783.         @hp = maxhp
  784.       end
  785.       @mp = maxmp if mp
  786.       if s
  787.         for i in @states.clone do remove_state(i) end
  788.       end
  789.     end
  790.   end
  791. end
  792. class Game_Troop < Game_Unit
  793.   def setup_colosseum_troop(item)
  794.     clear
  795.     @enemies = []
  796.     item_enemy_ids = item.colosseum_troop
  797.     for eny_id in item_enemy_ids
  798.       next if $data_enemies[eny_id] == nil
  799.       enemy = Game_Enemy.new(@enemies.size, eny_id)
  800.       if TECHNIKALZ::BATTLE_SYSTEM == "default"
  801.         enemy.screen_x = (Graphics.width / 2)
  802.         enemy.screen_y = (Graphics.height / 2)
  803.       elsif TECHNIKALZ::BATTLE_SYSTEM == "tankentai"
  804.         enemy.screen_x = (Graphics.width / 3).round
  805.         enemy.screen_y = (Graphics.height / 2)
  806.       elsif TECHNIKALZ::BATTLE_SYSTEM == "melody"
  807.         case $game_variables[YEM::BATTLE_ENGINE::VIEW_TYPE_VARIABLE]
  808.           when 0
  809.           enemy.screen_x = (Graphics.width / 2)
  810.           enemy.screen_y = (Graphics.height / 2)
  811.           when 1
  812.           enemy.screen_x = (Graphics.width / 2)
  813.           enemy.screen_y = (Graphics.height / 2)
  814.           when 2
  815.           enemy.screen_x = (Graphics.width / 3).round
  816.           enemy.screen_y = (Graphics.height / 2)
  817.           when 3
  818.           enemy.screen_x = (Graphics.width / 3).round
  819.           enemy.screen_y = (Graphics.height / 3).round
  820.         end
  821.       end
  822.       @enemies.push(enemy)
  823.     end
  824.     make_unique_names
  825.   end
  826.   alias colosseum_incr_turn increase_turn unless $@
  827.   def increase_turn
  828.     return if @troop_id == nil
  829.     colosseum_incr_turn
  830.   end
  831.   alias colosseum_setup_bat_event setup_battle_event unless $@
  832.   def setup_battle_event
  833.     return if @troop_id == nil
  834.     colosseum_setup_bat_event
  835.   end
  836. end
  837. class RPG::BaseItem
  838.   alias icy_col_basit_initialize initialize unless $@
  839.   def initialize(*args)
  840.     icy_col_basit_initialize(*args)
  841.     @col_cache_ready = false
  842.     icy_col_basit_cache
  843.   end
  844.   def icy_col_basit_cache
  845.     @colosseum = false
  846.     @troop_mons = []
  847.     self.note.split(/[\r\n]+/).each { 􀀀line􀀀
  848.       case line
  849.         when COLOSSEUM::REGEXP::COLOSSEUM_USE
  850.         @colosseum = true
  851.         when COLOSSEUM::REGEXP::TROOP_MON
  852.         $colosseum_troop_monster_id = $1.to_i
  853.         @troop_mons.push($colosseum_troop_monster_id)
  854.         when COLOSSEUM::REGEXP::ITEM_TYPE
  855.         @colosseum_item_get_type = $1.to_s
  856.         when COLOSSEUM::REGEXP::ITEM_GET
  857.         @colosseum_item_get = $1.to_i
  858.       end
  859.     } # End each
  860.     @col_cache_ready = true
  861.   end
  862.   def colosseum_use?
  863.     icy_col_basit_cache unless @col_cache_ready
  864.     return @colosseum
  865.   end
  866.   def colosseum_troop
  867.     icy_col_basit_cache unless @col_cache_ready
  868.     return @troop_mons
  869.   end
  870.   def colosseum_item_get_type
  871.     icy_col_basit_cache unless @col_cache_ready
  872.     return @colosseum_item_get_type
  873.   end
  874.   def colosseum_item_get
  875.     icy_col_basit_cache unless @col_cache_ready
  876.     return @colosseum_item_get
  877.   end
  878.   def col_i_type
  879.     if self.is_a?(RPG::Item)
  880.       return 0
  881.     elsif self.is_a?(RPG::Weapon)
  882.       return 1
  883.     elsif self.is_a?(RPG::Armor)
  884.       return 2
  885.     end
  886.   end
  887. end
  888. class Game_Party < Game_Unit
  889.   def party_hp
  890.     party_hp = 0
  891.     for member in $game_party.members
  892.       party_hp = party_hp + member.hp
  893.     end
  894.     return party_hp
  895.   end
  896. end
  897. if COLOSSEUM::TECHNIKALZ::SHRINK_L_BAT
  898.   class Sprite_Battler
  899.     alias colosseum_bat_shrink update_battler_bitmap unless $@
  900.     def update_battler_bitmap
  901.       colosseum_bat_shrink
  902.       if ($scene.is_a?(Scene_Battle) and $colosseum_battle)
  903.         onethd = (self.width > Graphics.width / 3) and (self.height > Graphics.hei
  904.                                                         ght / 3)
  905.         onehlf = (self.width > Graphics.width / 2) and (self.height > Graphics.hei
  906.                                                         ght / 2)
  907.         if onethd
  908.           self.zoom_x = 0.75
  909.           self.zoom_y = 0.75
  910.         elsif onehlf
  911.           self.zoom_x = 0.5
  912.           self.zoom_y = 0.5
  913.         else
  914.           self.zoom_x = 1
  915.           self.zoom_y = 1
  916.         end
  917.       else
  918.         self.zoom_x = 1
  919.         self.zoom_y = 1
  920.       end
  921.     end
  922.   end
  923. end
  924. class Game_Interpreter
  925.   def call_colosseum(bypass = false)
  926.     if not bypass
  927.       if $game_party.items.size < 1
  928.         if $game_party.party_hp < 1
  929.           text = COLOSSEUM::TECHNIKALZ::NO_ITEMS_o_0
  930.           text.gsub(/\./) {$1.to_s}
  931.           text2 = "and " + COLOSSEUM::TECHNIKALZ::CANT_CALL_SCNE.downcase
  932.           $game_message.texts.push(text + "\." + "." + "\." + "." + "\." + "." +
  933. "\.")
  934.           $game_message.texts.push(text2)
  935.         else
  936.           text = COLOSSEUM::TECHNIKALZ::NO_ITEMS_o_0
  937.           $game_message.texts.push(text)
  938.         end
  939.       elsif $game_party.party_hp < 1
  940.         text = COLOSSEUM::TECHNIKALZ::CANT_CALL_SCNE
  941.         $game_message.texts.push(text)
  942.       else
  943.         $scene = Scene_Colosseum.new
  944.       end
  945.     else
  946.       $scene = Scene_Colosseum.new
  947.     end
  948.   end
  949. end
Advertisement
Add Comment
Please, Sign In to add comment