Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Monster Breeding System 1.1
- # by nhojyer07
- # 1.1 Fixed a major bug
- $imported = {} if $imported == nil
- $imported["SowSMonsBreedSys"] = true
- module SOWS_MBS
- TYPE_ARRAY = [ # [ child, type 1, type 2]
- [3, 1, 2],
- [12, 10, 11]
- ]
- SPECIFIC_ARRAY = [ # [ child, monster 1, monster 2]
- [6, 4, 5],
- [9, 7, 8]
- ]
- end
- class Window_BreedHelp < Window_Base
- def initialize
- super(0, 0, Graphics.width, WLH + 32)
- refresh
- end
- def refresh(text = "")
- self.contents.clear
- self.contents.draw_text(0, 0, Graphics.width - 32, WLH, text)
- end
- end
- class Window_BreedStatus < Window_Base
- def initialize
- super(Graphics.width / 2, 56, Graphics.width / 2, Graphics.height - (2 * WLH + 32) - 56)
- refresh
- end
- def refresh(main = "None", sub = "None", result = "None")
- self.contents.clear
- self.contents.draw_text(0, 0, Graphics.width / 2 - 32, WLH, "Main:")
- self.contents.draw_text(0, WLH, Graphics.width / 2 - 32, WLH, main, 2)
- self.contents.draw_text(0, WLH * 3, Graphics.width / 2 - 32, WLH, "Sub:")
- self.contents.draw_text(0, WLH * 4, Graphics.width / 2 - 32, WLH, sub, 2)
- self.contents.draw_text(0, WLH * 7, Graphics.width / 2 - 32, WLH, "Result:")
- self.contents.draw_text(0, WLH * 8, Graphics.width / 2 - 32, WLH, result, 2)
- end
- end
- class Window_ActorList < Window_Selectable
- attr_accessor :i
- def initialize
- super(0, 56, Graphics.width / 2, Graphics.height / 2)
- @i = 0
- refresh
- self.index = 0
- end
- def refresh(main = -1, sub = -1)
- self.contents.clear
- @item_max = $game_party.members.size
- for actor in $game_party.members
- y = actor.index * WLH
- if sub == -1
- self.contents.font.color.alpha = main == actor.index ? 128 : 255
- elsif sub > -1
- self.contents.font.color.alpha = main == actor.index ? 128 : sub == actor.index ? 128 : 255
- end
- self.contents.draw_text(x, y, 108, WLH, actor.name)
- end
- end
- end
- class Window_ActorStat < Window_Base
- def initialize
- super(0, 56 + Graphics.height / 2, Graphics.width / 2, Graphics.height / 2 - 56)
- refresh($game_party.members[0])
- end
- def refresh(actor)
- self.contents.clear
- draw_actor_face(actor, 2, 2, 92)
- x = 104
- y = WLH / 2
- draw_actor_name(actor, x, y)
- draw_actor_class(actor, x, y + WLH)
- end
- end
- class Scene_Breed < Scene_Base
- include SOWS_MBS
- def start
- super
- create_menu_background
- @help = Window_BreedHelp.new
- @help.refresh("Choose the first monster.")
- @actorlist = Window_ActorList.new
- @actorstat = Window_ActorStat.new
- @breedstat = Window_BreedStatus.new
- @breedcomm = Window_Command.new(Graphics.width / 2, ["Combine","Cancel"])
- @breedcomm.x = Graphics.width / 2
- @breedcomm.y = Graphics.height - @breedcomm.height
- @breedcomm.active = false
- @index = @actorlist.index
- @main = -1
- @sub = -1
- @counter = 0
- end
- def update
- super
- update_menu_background
- @help.update
- @actorlist.update
- @actorstat.update
- @breedstat.update
- @breedcomm.update
- @win_msg.update if !@win_msg.nil?
- if @actorlist.active
- update_actor_selection
- elsif @breedcomm.active
- update_command_selection
- end
- if !@win_msg.nil?
- if @counter == 180 # 3 secs
- @win_msg.visible = false
- @win_msg = nil
- @actorlist.active = true
- @help.refresh("Choose the first monster.")
- @counter = 0
- else
- @counter += 1
- end
- end
- end
- def terminate
- super
- dispose_menu_background
- @help.dispose
- @actorlist.dispose
- @actorstat.dispose
- @breedstat.dispose
- @breedcomm.dispose
- @win_msg.dispose if !@win_msg.nil?
- end
- def return_scene
- $scene = Scene_Map.new
- end
- def update_actor_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- if @main == -1 and @sub == -1
- return_scene
- elsif @main > -1 and @sub > -1
- @sub = -1
- @breedstat.refresh($game_party.members[@main].name)
- @actorlist.refresh(@main)
- @help.refresh("Choose the second monster.")
- elsif @main > -1 and @sub == -1
- @main = -1
- @breedstat.refresh
- @actorlist.refresh
- @help.refresh("Choose the first monster.")
- end
- elsif Input.trigger?(Input::C)
- if @main == -1 and @sub == -1
- Sound.play_decision
- @main = @actorlist.index
- @breedstat.refresh($game_party.members[@main].name)
- @actorlist.refresh(@main)
- @help.refresh("Choose the second monster.")
- elsif @main > -1 and @sub == -1
- if @main == @actorlist.index
- Sound.play_buzzer
- else
- Sound.play_decision
- @sub = @actorlist.index
- @actorlist.refresh(@main, @sub)
- @breedstat.refresh($game_party.members[@main].name, $game_party.members[@sub].name)
- spec = false
- for i in 0...SPECIFIC_ARRAY.length - 1
- if $game_party.members[@main].id == SPECIFIC_ARRAY[i][1] and $game_party.members[@sub].id == SPECIFIC_ARRAY[i][2]
- @breedstat.refresh($game_party.members[@main].name, $game_party.members[@sub].name, $data_actors[SPECIFIC_ARRAY[i][0]].name)
- spec = true
- break
- end
- end
- if !spec
- for i in 0...TYPE_ARRAY.length - 1
- if $game_party.members[@main].class.id == TYPE_ARRAY[i][1] and $game_party.members[@sub].class.id == TYPE_ARRAY[i][2]
- @breedstat.refresh($game_party.members[@main].name, $game_party.members[@sub].name, $data_actors[TYPE_ARRAY[i][0]].name)
- p "meron"
- break
- end
- end
- end
- @help.refresh("Proceed?")
- @actorlist.active = false
- @breedcomm.active = true
- end
- end
- end
- if @index != @actorlist.index
- @actorstat.refresh($game_party.members[@actorlist.index])
- @index = @actorlist.index
- end
- end
- def update_command_selection
- if Input.trigger?(Input::B)
- comm_cancel
- elsif Input.trigger?(Input::C)
- if @breedcomm.index == 0
- @breedcomm.active = false
- check_breedlist
- else
- comm_cancel
- end
- end
- end
- def comm_cancel
- Sound.play_cancel
- @breedcomm.index = 0
- @breedcomm.active = false
- @actorlist.active = true
- @sub = -1
- @actorlist.refresh(@main)
- @breedstat.refresh($game_party.members[@main].name)
- @help.refresh("Choose the second monster.")
- end
- def check_breedlist
- child_found = false
- for i in 0...SPECIFIC_ARRAY.length - 1
- if $game_party.members[@main].id == SPECIFIC_ARRAY[i][1] and $game_party.members[@sub].id == SPECIFIC_ARRAY[i][2]
- @result = SPECIFIC_ARRAY[i][0]
- string = "Breeding completed!"
- @win_msg = Window_Base.new((Graphics.width - Graphics.width / 3 * 2) / 2, (Graphics.height - 24) / 2, Graphics.width / 3 * 2, 56)
- @win_msg.contents.draw_text(0, 0, @win_msg.contents.width, 24, string, 1)
- $game_party.remove_actor(SPECIFIC_ARRAY[i][1])
- $game_party.remove_actor(SPECIFIC_ARRAY[i][2])
- $game_party.remove_actor(@result)
- @actorlist.refresh
- @actorlist.index = 0
- @actorlist.active = false
- @actorstat.refresh($game_party.members[0])
- @breedstat.refresh
- @main = @sub = -1
- child_found = true
- break
- end
- end
- if !child_found
- for i in 0...TYPE_ARRAY.length - 1
- if $game_party.members[@main].class == $data_classes[TYPE_ARRAY[i][1]] and $game_party.members[@sub].class == $data_classes[TYPE_ARRAY[i][2]]
- @result = TYPE_ARRAY[i][0]
- string = "Breeding completed!"
- @win_msg = Window_Base.new((Graphics.width - Graphics.width / 3 * 2) / 2, (Graphics.height - 24) / 2, Graphics.width / 3 * 2, 56)
- @win_msg.contents.draw_text(0, 0, @win_msg.contents.width, 24, string, 1)
- $game_party.remove_actor(TYPE_ARRAY[i][1])
- $game_party.remove_actor(TYPE_ARRAY[i][2])
- $game_party.add_actor(@result)
- @actorlist.refresh
- @actorlist.index = 0
- @actorlist.active = false
- @actorstat.refresh($game_party.members[0])
- @breedstat.refresh
- @main = @sub = -1
- child_found = true
- break
- end
- end
- end
- if !child_found
- string = "Breeding failed!"
- @win_msg = Window_Base.new((Graphics.width - Graphics.width / 3 * 2) / 2, (Graphics.height - 24) / 2, Graphics.width / 3 * 2, 56)
- @win_msg.contents.draw_text(0, 0, @win_msg.contents.width, 24, string, 1)
- @actorlist.refresh
- @actorlist.index = 0
- @actorlist.active = false
- @actorstat.refresh($game_party.members[0])
- @breedstat.refresh
- @main = @sub = -1
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement