Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ################################################################################
- # SKILL MAKER
- # By: Ixfuru
- ################################################################################
- # This script creates a scene by which a player can create a new skill at
- # game time. All the options available when creating a skill from the database
- # is also at the disposal of the player in this new scene, including animation_id,
- # icon, damage, mp_cost, elements and states, etc.
- #
- # To call the scene in a game, just go to the third page of the event commands
- # and enter the following into a 'script' call:
- #
- # $scene = Scene_SkillMaker.new
- #
- ################################################################################
- # There are many some settings which can be altered in the module below, just
- # follow the directions for each part and you shouldn't have any trouble with it.
- ################################################################################
- #
- # If you use this script, you must credit Ixfuru. Also, the script is available
- # for non-commercial projects, but for commercial types, please contact Ixfuru
- # on any of the following sites:
- #
- # www.rpgmakervx.net
- # www.rmrk.net
- # www.rpgmakerweb.com
- # www.rpgmaker.net
- #
- # The script is licensed under Creative Commons
- ################################################################################
- module Ixfuru
- module SkillMaker
- #===========================================================================
- #
- # SECTION 1
- #
- # Property Costs
- #
- # During the scene, the skill being created will be given a price. This price
- # is equal to how much gold the party must have in their possession to
- # successufully create the skill. In addition, each skill is given a
- # mp_cost. Both of these things are dependent upon the properties the player
- # elects to endow their new skill with. In each of the following sub-sections,
- # you decide what specific properties are valued at. Prices are given as
- # two-element arrays:
- #
- # [gold_price, mp_cost]
- #
- # Read through the description of each sub-section so that you understand
- # what the property in question does so that you can set the price and cost
- # wisely.
- #
- # 1a. SCOPE
- #
- # Scope tells who is impacted by the skill. There are 12 different options
- # for the scope property. It is important to understand what each of them
- # represent:
- #
- # scope_amount
- #
- # 0 : none
- # 1 : one enemy
- # 2 : all enemies
- # 3 : one enemy dual
- # 4 : one random enemy
- # 5 : 2 random enemies
- # 6 : 3 random enemies
- # 7 : one ally
- # 8 : all allies
- # 9 : one dead ally
- # 10 : all dead allies
- # 11 : user
- SCOPE_COST = {
- 0 => [50, 2],
- 1 => [250, 5],
- 2 => [1000, 10],
- 3 => [500, 3],
- 4 => [150, 1],
- 5 => [350, 2],
- 6 => [650, 4],
- 7 => [250, 2],
- 8 => [1000, 10],
- 9 => [200, 1],
- 10 => [900, 5],
- 11 => [100, 1],
- }
- # 1b. OCCASION
- #
- # Occasion is the property which tells when the skill can be used
- #
- # occasion_amount
- #
- # 0 : always
- # 1 : used in battle only
- # 2 : used from menu only
- # 3 : never used
- OCCASION_COST = {
- 0 => [250, 5],
- 1 => [100, 3],
- 2 => [100, 3],
- 3 => [50, 1],
- }
- # 1c. PRICE PER POINT
- #
- # The following parameters are decided by giving the price/cost given in the
- # array for every point of the property the skill has. For instance, if a
- # if you set the parameter "speed" => [5, 0], you are saying that for
- # every point of 'speed' the skill is given, the price of it will rise
- # by five gold.
- PER_POINT_COST = {
- "speed" => [5, 0], # How fast the skill is when selected to use in battle
- "base_damage" => [25, 1], # How much damage/heal the skill does when used
- "variance" => [12, 0], # a random variable amount added to or subtracted
- # from the base damage when used
- "atk_f" => [10, 0], # The random amount to add based on the user's ATK parameter
- "spi_f" => [10, 0], # The random amount to add based on the user's SPI parameter
- }
- # 1d. BOOLEANS
- #
- # These properties are either true or false. The price adjustment given
- # attributed to these properties are therefor only in effect if the player
- # chooses to set these properties to true in the creator.
- BOOLEAN_COST = {
- "damage_to_mp" => [50, 1],
- "absorb_damage" => [500, 5],
- "ignore_defense" => [250, 3],
- "physical_attack" => [0, 0]
- }
- # 1e. PRICE FOR EACH
- #
- # These properties are those which are a group of selections made from a list.
- # This includes both states and elements defined for the skill being made.
- # These values are therefor added to the price/cost for each one of the
- # selections which the player has selected during creation phase.
- FOR_EACH_COST = {
- "element_set" => [100, 1],
- "plus_state_set" => [200, 2],
- "minus_state_set" => [200, 2],
- }
- # 1f. COMMON EVENT PRICE
- #
- # The following hash allows you to assign a value to every selectable common
- # event in the game. That is, those which can be assigned to run when the
- # skill being created is used. If the player links the common event to the
- # skill when it is created, the costs of the skill will rise by the
- # amount which is assigned to the common_event's id in the following hash.
- COMMON_EVENT_COST = {
- }
- #===========================================================================
- # SECTION 3
- #
- # MISCELLANEOUS
- #
- #===========================================================================
- # When using the system, all skills will be given costs. If you choose
- # to place this at true, then all skills will be given a price by running
- # them each through the pricing system from Section 1.
- REPRICE_ALL_SKILL_COSTS = true
- MAX_PER_POINT_CAP = 125
- #===========================================================================
- # SECTION 4
- #
- # ELEMENTS
- #
- # Ths following hash ties each element (based on it's ID in the database) to
- # an icon_index. The icon_index points to a specific icon found on the
- # Iconset graphics picture.
- ############################################################################
- ELEMENT_ICONS = {
- 1 => 13,
- 2 => 10,
- 3 => 5,
- 4 => 14,
- 5 => 16,
- 6 => 12,
- 7 => 129,
- 8 => 128,
- 9 => 104,
- 10 => 105,
- 11 => 106,
- 12 => 107,
- 13 => 108,
- 14 => 109,
- 15 => 110,
- 16 => 111,
- }
- # This value tells the system how many icons to make visible to the player when
- # creating the skill. It goes 0 through the value you set here. So by placing
- # it at 255, you can cover every element on the Iconset graphic by its index.
- MAX_ICON_ID = 255
- end
- end
- ################################################################################
- # RPG::SKILL
- ################################################################################
- class RPG::Skill
- #-----------------------------------------------------------------------------
- # Skill Cost
- #
- # cost_type : "gold", "mp"
- #
- #-----------------------------------------------------------------------------
- def skill_cost(cost_type)
- case cost_type
- when "gold"
- ct = 0
- when "mp"
- ct = 1
- end
- c = Ixfuru::SkillMaker::SCOPE_COST[self.scope][ct]
- c += Ixfuru::SkillMaker::OCCASION_COST[self.occasion][ct]
- Ixfuru::SkillMaker::PER_POINT_COST.each { |tag, cost|
- case tag
- when "Speed"
- c += cost[ct] * self.speed
- when "BaseDamage"
- c += cost[ct] * self.base_damage
- when "Variance"
- c += cost[ct] * self.variance
- when "atk_f"
- c += cost[ct]
- when "spi_f"
- end
- }
- Ixfuru::SkillMaker::BOOLEAN_COST.each { |tag, cost|
- case tag
- when "damage_to_mp"
- c += cost[ct] if self.damage_to_mp
- when "absorb_damage"
- c += cost[ct] if self.absorb_damage
- when "ignore_defense"
- c += cost[ct] if self.ignore_defense
- when "physical_attack"
- c += cost[ct] if self.physical_attack
- end
- }
- Ixfuru::SkillMaker::FOR_EACH_COST.each { |tag, cost|
- case tag
- when "element_set"
- c += cost[ct] * self.element_set.size
- when "plus_state_set"
- c += cost[ct] * self.plus_state_set.size
- when "minus_state_set"
- c += cost[ct] * self.minus_state_set.size
- end
- }
- unless Ixfuru::SkillMaker::COMMON_EVENT_COST.empty?
- Ixfuru::SkillMaker::COMMON_EVENT_COST.each { |ce_id, cost|
- c += cost[ct] if @common_event_id == ce_id
- }
- end
- return c
- end
- #-----------------------------------------------------------------------------
- # Initialize (Aliased)
- #-----------------------------------------------------------------------------
- alias ixsklmkrrpgsklinitialize initialize unless $@
- def initialize
- if Ixfuru::SkillMaker::REPRICE_ALL_SKILL_COSTS
- super
- @scope = 1
- @mp_cost = skill_cost("mp")
- @hit = 100
- @message1 = ""
- @message2 = ""
- else
- ixsklmkrrpgsklinitialize
- end
- end
- end
- ################################################################################
- # GAME SYSTEM
- ################################################################################
- class Game_System
- attr_accessor :last_custom_skill_id
- attr_accessor :custom_skills
- #-----------------------------------------------------------------------------
- # Initialize (Aliased)
- #-----------------------------------------------------------------------------
- alias ixsklmkrgmsysinitialize initialize unless $@
- def initialize
- ixsklmkrgmsysinitialize
- @last_custom_skill_id = -1
- @custom_skills = {}
- end
- end
- ################################################################################
- # GAME BATTLEACTION
- ################################################################################
- class Game_BattleAction
- #--------------------------------------------------------------------------
- # * Get Skill Object (Aliased)
- #--------------------------------------------------------------------------
- alias ixsklmkrgmbaskill skill unless $@
- def skill
- if @skill_id < 0
- return skill? ? $game_system.custom_skills[@skill_id] : nil
- else
- ixsklmkrgmbaskill
- end
- end
- end
- ################################################################################
- # GAME ACTOR
- ################################################################################
- class Game_Actor < Game_Battler
- #~ #--------------------------------------------------------------------------
- #~ # * Get Skill Object Array
- #~ #--------------------------------------------------------------------------
- #~ def skills
- #~ result = []
- #~ for i in @skills
- #~ result.push($data_skills[i])
- #~ end
- #~ return result
- #~ end
- #--------------------------------------------------------------------------
- # * Get Skill Object Array (Overwritten)
- #--------------------------------------------------------------------------
- def skills
- result = []
- for i in @skills
- #~ p "@skills i", i
- if i < 0
- result.push($game_system.custom_skills[i])
- else
- result.push($data_skills[i])
- end
- end
- return result
- end
- #--------------------------------------------------------------------------
- # * Learn Skill (OVERWRITTEN)
- # skill_id : skill ID
- #--------------------------------------------------------------------------
- def learn_skill(skill_id)
- if skill_id < 0
- unless skill_learn?($game_system.custom_skills[skill_id])
- @skills.push(skill_id)
- @skills.sort!
- end
- else
- unless skill_learn?($data_skills[skill_id])
- @skills.push(skill_id)
- @skills.sort!
- end
- end
- end
- end
- ################################################################################
- # GAME INTERPRETER
- ################################################################################
- class Game_Interpreter
- #--------------------------------------------------------------------------
- # * Conditional Branch (OVERWRITTEN)
- #--------------------------------------------------------------------------
- def command_111
- result = false
- case @params[0]
- when 0 # Switch
- result = ($game_switches[@params[1]] == (@params[2] == 0))
- when 1 # Variable
- value1 = $game_variables[@params[1]]
- if @params[2] == 0
- value2 = @params[3]
- else
- value2 = $game_variables[@params[3]]
- end
- case @params[4]
- when 0 # value1 is equal to value2
- result = (value1 == value2)
- when 1 # value1 is greater than or equal to value2
- result = (value1 >= value2)
- when 2 # value1 is less than or equal to value2
- result = (value1 <= value2)
- when 3 # value1 is greater than value2
- result = (value1 > value2)
- when 4 # value1 is less than value2
- result = (value1 < value2)
- when 5 # value1 is not equal to value2
- result = (value1 != value2)
- end
- when 2 # Self switch
- if @original_event_id > 0
- key = [@map_id, @original_event_id, @params[1]]
- if @params[2] == 0
- result = ($game_self_switches[key] == true)
- else
- result = ($game_self_switches[key] != true)
- end
- end
- when 3 # Timer
- if $game_system.timer_working
- sec = $game_system.timer / Graphics.frame_rate
- if @params[2] == 0
- result = (sec >= @params[1])
- else
- result = (sec <= @params[1])
- end
- end
- when 4 # Actor
- actor = $game_actors[@params[1]]
- if actor != nil
- case @params[2]
- when 0 # in party
- result = ($game_party.members.include?(actor))
- when 1 # name
- result = (actor.name == @params[3])
- when 2 # skill
- if @params[3] < 0
- result = (actor.skill_learn?($game_system.custom_skills[@params[3]]))
- else
- result = (actor.skill_learn?($data_skills[@params[3]]))
- end
- when 3 # weapon
- result = (actor.weapons.include?($data_weapons[@params[3]]))
- when 4 # armor
- result = (actor.armors.include?($data_armors[@params[3]]))
- when 5 # state
- result = (actor.state?(@params[3]))
- end
- end
- when 5 # Enemy
- enemy = $game_troop.members[@params[1]]
- if enemy != nil
- case @params[2]
- when 0 # appear
- result = (enemy.exist?)
- when 1 # state
- result = (enemy.state?(@params[3]))
- end
- end
- when 6 # Character
- character = get_character(@params[1])
- if character != nil
- result = (character.direction == @params[2])
- end
- when 7 # Gold
- if @params[2] == 0
- result = ($game_party.gold >= @params[1])
- else
- result = ($game_party.gold <= @params[1])
- end
- when 8 # Item
- result = $game_party.has_item?($data_items[@params[1]])
- when 9 # Weapon
- result = $game_party.has_item?($data_weapons[@params[1]], @params[2])
- when 10 # Armor
- result = $game_party.has_item?($data_armors[@params[1]], @params[2])
- when 11 # Button
- result = Input.press?(@params[1])
- when 12 # Script
- result = eval(@params[1])
- when 13 # Vehicle
- result = ($game_player.vehicle_type == @params[1])
- end
- @branch[@indent] = result # Store determination results in hash
- if @branch[@indent] == true
- @branch.delete(@indent)
- return true
- end
- return command_skip
- end
- end
- ################################################################################
- # SKILL MAKER
- ################################################################################
- class SkillMaker
- attr_accessor :skill
- #-----------------------------------------------------------------------------
- # Initialize
- #-----------------------------------------------------------------------------
- def initialize
- @skill = RPG::Skill.new
- @skill.id = $game_system.last_custom_skill_id
- end
- #-----------------------------------------------------------------------------
- # Mp Cost
- #-----------------------------------------------------------------------------
- def set_mp_cost
- @skill.mp_cost = @skill.skill_cost("mp")
- end
- #-----------------------------------------------------------------------------
- # Create Price
- #-----------------------------------------------------------------------------
- def create_price
- return @skill.skill_cost("gold")
- end
- #-----------------------------------------------------------------------------
- # Finish Skill Creation
- #-----------------------------------------------------------------------------
- def finish_skill_creation
- $game_system.custom_skills[@skill.id] = @skill
- $game_system.last_custom_skill_id -= 1
- end
- end
- ################################################################################
- # WINDOW BOOLEAN
- ################################################################################
- class Window_Boolean < Window_Selectable
- attr_accessor :result
- def initialize(x, y, start_true = false)
- super(x, y, 140, 56)
- @result = start_true
- c1 = "True"
- c2 = "False"
- @commands = [c1, c2]
- @item_max = @commands.size
- refresh
- self.index = 0
- self.visible = false
- self.active = false
- end
- def refresh
- create_contents
- for i in 0...@item_max
- draw_command(i)
- end
- end
- def draw_command(index)
- rect = item_rect(index)
- rect.width += 4
- rect.x -= 8
- self.contents.font.color = normal_color
- case index
- when 0
- self.contents.font.color = system_color if @result
- when 1
- self.contents.font.color = system_color if !@result
- end
- self.contents.draw_text(rect, @commands[index], 1)
- end
- end
- ################################################################################
- # WINDOW VALUE
- ################################################################################
- class Window_Value < Window_Selectable
- attr_accessor :current_value
- attr_accessor :max_value
- attr_accessor :string
- attr_accessor :min_value
- def initialize(current, max, string, multisymbol = false, min = 0)
- super(180, 100, 220, 56)
- @current_value = current
- @max_value = max
- @min_value = min
- @string = string
- @multisymbol = multisymbol
- @item_max = 1
- refresh
- self.index = 0
- self.visible = false
- self.active = false
- end
- def refresh
- create_contents
- for i in 0...@item_max
- draw_value(i)
- end
- end
- def draw_value(index)
- rect = item_rect(index)
- rect.width += 8
- rect.x -= 4
- if @multisymbol
- self.contents.draw_text(rect, @string + " x " + @current_value.to_s, 1)
- else
- self.contents.draw_text(rect, @string + " " + @current_value.to_s, 1)
- end
- end
- end
- ################################################################################
- # WINDOW STATE SELECT
- ################################################################################c
- class Window_StateSelect < Window_Selectable
- attr_accessor :states
- attr_accessor :selected_states
- def initialize(x, y)
- super(x, y, 180, 280)
- @selected_states = []
- refresh
- self.index = 0
- self.visible = false
- self.active = false
- end
- def included_states
- result = []
- for i in 1...$data_states.size
- next if $data_states[i].nil? || $data_states[i].name == ""
- result.push(i)
- end
- return result
- end
- def refresh
- @states = included_states
- @item_max = @states.size
- create_contents
- for i in 0...@item_max
- draw_state_display(i)
- end
- end
- def draw_state_display(index)
- rect = item_rect(index)
- if @selected_states.include?(@states[index])
- self.contents.font.color = power_up_color
- else
- self.contents.font.color = normal_color
- end
- draw_icon($data_states[@states[index]].icon_index, rect.x, rect.y)
- self.contents.draw_text(rect, $data_states[@states[index]].name, 2)
- end
- end
- ################################################################################
- # WINDOW ELEMENT SELECT
- ################################################################################
- class Window_ElementSelect < Window_Selectable
- attr_accessor :selected_elements
- attr_accessor :elements
- def initialize(x, y)
- super(x, y, 180, 280)
- @selected_elements = []
- refresh
- self.index = 0
- self.active = false
- self.visible = false
- end
- def included_elements
- result = []
- for i in 0...$data_system.elements.size
- next if $data_system.elements[i] == ""
- result.push(i)
- end
- return result
- end
- def refresh
- @elements = included_elements
- @item_max = @elements.size
- create_contents
- for i in 0...@item_max
- draw_element_display(i)
- end
- end
- def draw_element_display(index)
- rect = item_rect(index)
- if @selected_elements.include?(@elements[index])
- self.contents.font.color = power_up_color
- else
- self.contents.font.color = power_down_color
- end
- draw_icon(rect.x, rect.y, Ixfuru::SkillMaker::ELEMENT_ICONS[@elements[index]])
- self.contents.draw_text(rect, $data_system.elements[@elements[index]], 2)
- end
- end
- ################################################################################
- # WINDOW ICONS
- ################################################################################
- class Window_Icons < Window_Selectable
- attr_accessor :icons
- def initialize
- super(0, 0, 544, 416)
- @spacing = 0
- refresh
- self.index = 0
- self.active = false
- self.visible = false
- end
- def refresh
- @icons = []
- @item_max = Ixfuru::SkillMaker::MAX_ICON_ID
- @column_max = 16
- for i in 0..item_max
- @icons.push(i)
- draw_window_icon(i)
- end
- end
- def draw_window_icon(index)
- rect = item_rect(index)
- rect.x += 4
- rect.width -= 8
- draw_icon(@icons[index], rect.x, rect.y)
- end
- end
- ################################################################################
- # WINDOW LETTERS
- ################################################################################
- class Window_Letters < Window_Selectable
- SHIFT_LETTERS = {
- 0 => ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
- "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
- "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "_", "'", "-",
- " ", "cancel", "done"],
- 1 => ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
- "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
- "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "_", "'", "-",
- " ", "CANCEL", "DONE"],
- }
- TYPE_LETTER_SE = ["Close2", 80, 150]
- SHIFT_SE = ["Open2", 80, 150]
- DELETE_SE = ["Water1", 80, 50]
- FINISHED_SE = ["Decision2", 80, 50]
- attr_accessor :shift_index
- attr_accessor :letters
- def initialize
- super(0, 56, 544, 416)
- @shift_index = 0
- refresh
- self.active = false
- self.visible = false
- self.index = 0
- end
- def play_letter
- se = TYPE_LETTER_SE
- RPG::SE.new(se[0], se[1], se[2]).play
- end
- def play_shift
- se = SHIFT_SE
- RPG::SE.new(se[0], se[1], se[2]).play
- end
- def play_delete
- se = DELETE_SE
- RPG::SE.new(se[0], se[1], se[2]).play
- end
- def play_finished
- se = FINISHED_SE
- RPG::SE.new(se[0], se[1], se[2]).play
- end
- def refresh
- @letters = SHIFT_LETTERS[@shift_index]
- @item_max = @letters.size
- @column_max = 5
- create_contents
- for i in 0...@item_max
- draw_letter(i)
- end
- end
- def draw_letter(index)
- rect = item_rect(index)
- rect.x += 4
- rect.width -= 8
- self.contents.draw_text(rect, @letters[index], 1)
- end
- end
- ################################################################################
- # WINDOW STRING EDIT
- ################################################################################
- class Window_StringEdit < Window_Selectable
- attr_accessor :max_characters
- attr_accessor :string
- def initialize(max_characters)
- super(0, 0, 544, 56)
- @max_characters = max_characters
- @column_max = @max_characters
- @string = ""
- @spacing = 0
- refresh
- self.active = false
- self.visible = false
- end
- def refresh
- @item_max = @string.size
- create_contents
- return if @item_max < 1
- for i in 0...@item_max
- draw_string_letter(i)
- end
- end
- def draw_string_letter(index)
- rect = item_rect(index)
- rect.x += 4
- rect.width -= 8
- letter = @string.slice(index, 1)
- self.contents.draw_text(rect, letter, 1)
- end
- def delete_a_letter
- @string.slice!(index, 1)
- self.index -= 1
- refresh
- end
- def add_a_letter(letter_to_add)
- @string.concat(letter_to_add)
- self.index += 1
- refresh
- end
- end
- ################################################################################
- # WINDOW CONFIRMATION
- ################################################################################
- class Window_Confirmation < Window_Selectable
- COMPLETION_SE = ["Magic", 80, 50]
- def initialize(c1, c2, starting_index = 1)
- super(180, 100, 180, 80)
- @commands = [c1, c2]
- @item_max = @commands.size
- refresh
- self.index = starting_index
- self.active = false
- self.visible = false
- end
- def refresh
- create_contents
- for i in 0...@item_max
- draw_command(i)
- end
- end
- def play_completion
- se = COMPLETION_SE
- RPG::SE.new(se[0], se[1], se[2]).play
- end
- def draw_command(index)
- rect = item_rect(index)
- rect.x += 4
- rect.width -= 8
- self.contents.draw_text(rect, @commands[index], 1)
- end
- end
- ################################################################################
- # RESULT WINDOW
- ################################################################################
- class Window_Result < Window_Base
- attr_accessor :result_string
- attr_accessor :icon_id
- ACCOMPANY_ME = ["Victory1", 80, 100]
- def initialize(result_string = "", icon_id = nil)
- super(22, 180, 500, 56)
- @result_string = result_string
- @icon_id = icon_id
- refresh
- self.visible = false
- end
- def play_accompany
- se = ACCOMPANY_SE
- RPG::SE.new(se[0], se[1], se[2]).play
- end
- def refresh
- self.contents.clear
- rect = Rect.new(0, 0, self.width - 32, WLH)
- if @icon_id.nil?
- self.contents.draw_text(rect, @result_string, 1)
- else
- x = (rect.width / 2) - (self.contents.text_size(@result_string).width / 2)
- draw_icon(@icon_id, x, rect.y)
- self.contents.draw_text(x + 26, rect.y, rect.width, rect.height, @result_string)
- end
- end
- end
- ################################################################################
- # WINDOW CUSTOM SKILL MAKER
- ################################################################################
- class Window_SkillMaker < Window_Selectable
- #-----------------------------------------------------------------------------
- # Initialize
- #-----------------------------------------------------------------------------
- def initialize
- super(0, 56, 544, 248)
- c1 = "Edit Name"
- c2 = "Edit Icon"
- c3 = "Edit Description"
- c4 = "Set Scope"
- c5 = "Set Occasion"
- c6 = "Set Speed"
- c7 = "Edit Animation"
- c8 = "Edit Common Event"
- c9 = "Set Base Damage"
- c10 = "Set Variance"
- c11 = "Set Attack Factor"
- c12 = "Set Spirit Factor"
- c13 = "Decide Physical Attack"
- c14 = "Decide Damage To MP"
- c15 = "Decide Absorb Damage"
- c16 = "Decide Ignore Defense"
- c17 = "Choose Elements"
- c18 = "Choose Plus States"
- c19 = "Choose Minus States"
- c20 = "Edit Message 1"
- c21 = "Edit Message 2"
- c22 = "Set Hit"
- c23 = "FINALIZE!"
- @commands = [c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14,
- c15, c16, c17, c18, c19, c20, c21, c22, c23]
- @item_max = @commands.size
- #~ p @item_max,"item_max"
- refresh
- self.index = 0
- end
- #-----------------------------------------------------------------------------
- # Refresh
- #-----------------------------------------------------------------------------
- def refresh
- @skill = $scene.maker.skill
- create_contents
- for i in 0...@item_max
- draw_command(i)
- end
- $scene.set_costs
- end
- #-----------------------------------------------------------------------------
- # Draw Command
- #-----------------------------------------------------------------------------
- def draw_command(index)
- rect = item_rect(index)
- self.contents.font.color = system_color
- self.contents.draw_text(rect, @commands[index])
- self.contents.font.color = normal_color
- case index
- when 0 # name
- self.contents.font.color = crisis_color
- self.contents.draw_text(rect, @skill.name, 2)
- when 1 # Icon
- draw_icon(@skill.icon_index, (rect.x + rect.width - 26), rect.y)
- when 2 # Description
- self.contents.draw_text(rect, @skill.description, 2)
- when 3 # Scope
- case @skill.scope
- when 0
- scp = "None"
- when 1
- scp = "One Enemy"
- when 2
- scp = "All Enemies"
- when 3
- scp = "One Enemy Dual"
- when 4
- scp = "One Enemy Random"
- when 5
- scp = "Two Random Enemies"
- when 6
- scp = "Three Random Enemies"
- when 7
- scp = "One Ally"
- when 8
- scp = "All Allies"
- when 9
- scp = "One Dead Ally"
- when 10
- scp = "All Dead Allies"
- when 11
- scp = "User"
- end
- self.contents.draw_text(rect, "(" + @skill.scope.to_s + ") " + scp, 2)
- when 4 # Occasion
- case @skill.occasion
- when 0 #always
- occ = "Always"
- when 1 #Only in Battle
- occ = "Battle Only"
- when 2 # Menu Only
- occ = "Menu Only"
- when 3 # Never
- occ = "Never"
- end
- self.contents.draw_text(rect, "(" + @skill.occasion.to_s + ") " + occ, 2)
- when 5 # Speed
- self.contents.draw_text(rect, @skill.speed.to_s, 2)
- when 6 # Animation
- #~ p "Skill", @skill
- #~ p "Skill's Animation ID", @skill.animation_id
- if !@skill.animation_id.nil? && @skill.animation_id > 0
- self.contents.draw_text(rect, $data_animations[@skill.animation_id].name, 2)
- else
- self.contents.draw_text(rect, "NONE", 2)
- end
- when 7 # Common Event
- if !@skill.common_event_id.nil? && @skill.common_event_id > 0
- self.contents.draw_text(rect, $data_common_events[@skill.common_event_id.name], 2)
- else
- self.contents.draw_text(rect, "NONE", 2)
- end
- when 8 # Base Damage
- self.contents.draw_text(rect, @skill.base_damage.to_s, 2)
- when 9 # Variance
- self.contents.draw_text(rect, @skill.variance.to_s, 2)
- when 10 # Atk F
- self.contents.draw_text(rect, @skill.atk_f.to_s, 2)
- when 11 # Spi F
- self.contents.draw_text(rect, @skill.spi_f.to_s, 2)
- when 12 # Physical Attack?
- self.contents.font.color = @skill.physical_attack ? power_up_color : power_down_color
- self.contents.draw_text(rect, @skill.physical_attack.to_s, 2)
- when 13 # Damage To MP?
- self.contents.font.color = @skill.damage_to_mp ? power_up_color : power_down_color
- self.contents.draw_text(rect, @skill.damage_to_mp.to_s, 2)
- when 14 # Absorb Damage?
- self.contents.font.color = @skill.absorb_damage ? power_up_color : power_down_color
- self.contents.draw_text(rect, @skill.absorb_damage.to_s, 2)
- when 15 # Ignore Defense?
- self.contents.font.color = @skill.ignore_defense ? power_up_color : power_down_color
- self.contents.draw_text(rect, @skill.ignore_defense.to_s, 2)
- when 16 # Elements
- unless @skill.element_set.empty?
- x = (rect.x + rect.width) - (@skill.element_set.size * 24)
- elements = Ixfuru::SkillMaker::ELEMENT_ICONS
- for element_id in @skill.element_set
- draw_icon(elements[element_id], x, rect.y)
- x += 24
- end
- end
- when 17 # Plus States
- unless @skill.plus_state_set.empty?
- state_icons = []
- for state_id in @skill.plus_state_set
- icon_id = $data_states[state_id].icon_index
- state_icons.push(icon_id)
- end
- x = (rect.x + rect.width) - (state_icons.size * 24)
- for s in state_icons
- draw_icon(s, x, rect.y)
- x += 24
- end
- end
- when 18 # Minus States
- unless @skill.minus_state_set.empty?
- state_icons = []
- for state_id in @skill.minus_state_set
- icon_id = $data_states[state_id].icon_index
- state_icons.push(icon_id)
- end
- x = (rect.x + rect.width) - (state_icons.size * 24)
- for s in state_icons
- draw_icon(s, x, rect.y)
- x += 24
- end
- end
- when 19 # Message 1
- self.contents.draw_text(rect, @skill.message1, 2)
- when 20 # Message 2
- self.contents.draw_text(rect, @skill.message2, 2)
- when 21 # Hit Pct
- self.contents.draw_text(rect, @skill.hit.to_s, 2)
- end
- end
- end
- ################################################################################
- # WINDOW COST PREVIEW
- ################################################################################
- class Window_CostPreview < Window_Base
- attr_accessor :cost_type # 0 for mp cost, 1 for gold price
- attr_accessor :cost
- COST_TYPE_INITIALS = ["G", "MP"]
- def initialize(cost_type, x, y)
- super(x, y, 272, 56)
- @cost_type = cost_type
- @cost = 0
- refresh
- end
- def refresh
- self.contents.clear
- self.contents.font.color = system_color
- self.contents.draw_text(0, 0, self.width - 32, WLH, COST_TYPE_INITIALS[@cost_type])
- self.contents.draw_text(0, 0, self.width - 32, WLH, @cost.to_s, 2)
- end
- end
- ################################################################################
- # WINDOW ANIMATOR
- ################################################################################
- class Window_Animator < Window_Base
- attr_accessor :anisprite
- attr_accessor :viewport
- def initialize
- super(200, 0, 344, 416)
- @viewport = Viewport.new(200, 0, 344, 416)
- @viewport.z = 150
- refresh
- self.visible = false
- end
- def refresh
- self.contents.clear
- create_anisprite
- end
- def create_anisprite
- unless @anisprite.nil? || @anisprite.disposed?
- @anisprite.dispose
- end
- @anisprite = Sprite_Base.new(@viewport)
- @anisprite.x = 172
- @anisprite.y = 208
- end
- def update_animation
- unless @anisprite.nil? || @anisprite.disposed?
- if @anisprite.animation?
- @anisprite.update
- @viewport.update
- end
- end
- end
- def dispose
- unless @anisprite.nil? || @anisprite.disposed?
- @anisprite.dispose
- end
- @viewport.dispose
- super
- end
- end
- ################################################################################
- # WINDOW SELECTION
- ################################################################################
- class Window_Selection < Window_Selectable
- attr_accessor :selection_ids
- def initialize(selection_type) # 0 for animations, 1 for common events
- super(0, 0, 200, 416)
- @selection_type = selection_type
- @selection_ids = []
- case @selection_type
- when 0 # animations
- for i in $data_animations
- next if i.nil?
- next if i.name == ""
- @selection_ids.push(i.id)
- end
- when 1 #common events
- for i in $data_common_events
- next if i.nil?
- next if i.name == ""
- @selection_ids.push(i.id)
- end
- end
- @item_max = @selection_ids.size
- refresh
- self.index = 0
- self.active = false
- self.visible = false
- end
- def refresh
- create_contents
- for i in 0...@item_max
- draw_selection(i)
- end
- end
- def draw_selection(index)
- rect = item_rect(index)
- rect.x += 4
- rect.width -= 8
- case @selection_type
- when 0 # animations
- self.contents.draw_text(rect, $data_animations[@selection_ids[index]].name, 1)
- when 1 # common events
- self.contents.draw_text(rect, $data_common_events[@selection_ids[index]].name, 1)
- end
- end
- end
- ################################################################################
- # WINDOW SCENE HELP
- ################################################################################
- class Window_SceneHelp < Window_Base
- attr_accessor :string
- def initialize
- super(0, 304, 544, 56)
- @string = ""
- refresh
- end
- def refresh
- self.contents.clear
- self.contents.draw_text(0, 0, self.width - 32, WLH, @string, 1)
- end
- end
- ################################################################################
- # WINDOW HEADER
- ################################################################################
- class Window_SkillMaker_Header < Window_Base
- def initialize
- super(0, 0, 544, 56)
- @string = "************CREATE A SKILL************"
- refresh
- end
- def refresh
- self.contents.clear
- self.contents.font.color = system_color
- self.contents.draw_text(0, 0, self.width - 32, WLH, @string, 1)
- end
- end
- ################################################################################
- # SCENE SKILL MAKER
- ################################################################################
- class Scene_SkillMaker < Scene_Base
- attr_accessor :maker
- attr_accessor :win_animation_select
- #-----------------------------------------------------------------------------
- # Initialize
- #-----------------------------------------------------------------------------
- def initialize(actor = $game_party.members[0])
- @maker = SkillMaker.new
- @letters_window = nil
- @object_of_string = 0
- @actor = actor
- end
- #-----------------------------------------------------------------------------
- # Start
- #-----------------------------------------------------------------------------
- def start
- super
- create_menu_background
- @win_mp_cost = Window_CostPreview.new(1, 0, 360)
- @win_create_cost = Window_CostPreview.new(0, 272, 360)
- @win_skillmaker = Window_SkillMaker.new
- @win_help = Window_SceneHelp.new
- @win_header = Window_SkillMaker_Header.new
- @win_name_preview = Window_StringEdit.new(12)
- @win_letters = Window_Letters.new
- @win_icons = Window_Icons.new
- @win_description_preview = Window_StringEdit.new(12)
- @win_scope = Window_Value.new(0, 11, "Scope", false)
- @win_occasion = Window_Value.new(0, 3, "Occasion", false)
- @win_speed = Window_Value.new(0, 100, "Speed")
- @win_animation_select = Window_Selection.new(0)
- @win_animation_preview = Window_Animator.new
- @win_common_event_select = Window_Selection.new(1)
- @max_cap = Ixfuru::SkillMaker::MAX_PER_POINT_CAP
- @win_base_damage = Window_Value.new(0, @max_cap, "Damage", false, -999)
- @win_variance = Window_Value.new(0, @max_cap, "Variance")
- @win_atk_f = Window_Value.new(0, @max_cap, "Atk Factor")
- @win_spi_f = Window_Value.new(0, @max_cap, "Spi Factor")
- @win_physical_attack = Window_Boolean.new(180, 100)
- @win_damage_to_mp = Window_Boolean.new(180, 100)
- @win_absorb_damage = Window_Boolean.new(180, 100)
- @win_ignore_defense = Window_Boolean.new(180, 100)
- @win_elements = Window_ElementSelect.new(180, 100)
- @win_plus_state_set = Window_StateSelect.new(180, 100)
- @win_minus_state_set = Window_StateSelect.new(180, 100)
- @win_message1 = Window_StringEdit.new(12)
- @win_message2 = Window_StringEdit.new(12)
- @win_hit = Window_Value.new(100, 100, "Hit Pct")
- @win_confirm = Window_Confirmation.new("Create the Skill", "Cancel")
- @win_result = Window_Result.new
- end
- #-----------------------------------------------------------------------------
- # Update Scene Help
- #-----------------------------------------------------------------------------
- def update_scene_help
- case @win_skillmaker.index
- when 0
- s = "Skill must have a name before it can be finalized!"
- when 1
- s = "Choose the icon which represents the skill in windows."
- when 2
- s = "Write information about what the skill does."
- when 3
- s = "Determine who is effected by the skill."
- when 4
- s = "Determine when the skill can be used."
- when 5
- s = "Determine how quickly the skill is during battle."
- when 6
- s = "Decide what the skill will look like when it's used."
- when 7
- s = "Decide what kind of event you want to link the skill with."
- when 8
- s = "For attacks use positive numbers; to heal used negatives."
- when 9
- s = "Adjust how far from the actual base figure the damage/heal can be."
- when 10
- s = "Adjust the bonus given based on the user's strength."
- when 11
- s = "Adjust the bonus given based on the user's intelligence."
- when 12
- s = "Is the skill a physical attack?"
- when 13
- s = "Does the skill damage MP instead of HP?"
- when 14
- s = "Does the user of the spell absorb some of the damage/heal?"
- when 15
- s = "Is the damage/heal dealt bypassing the defense of the target?"
- when 16
- s = "What elements are associated with the skill?"
- when 17
- s = "What states are given to the target as a result of the skill?"
- when 18
- s = "What states are removed from the target as a result of the skill?"
- when 19
- s = "Write an explanatory message which tells the skill has been used in battle."
- when 20
- s = "Write an extra message which can be anything really."
- when 21
- s = "Determine the percentage of chance the user has at performing the skill successfully."
- when 22
- s = "Finalize and Complete the New skill!"
- end
- if @win_help.string != s
- @win_help.string = s
- @win_help.refresh
- end
- end
- #-----------------------------------------------------------------------------
- # Update
- #-----------------------------------------------------------------------------
- def update
- super
- update_scene_help
- if @win_result.visible
- update_result
- elsif @win_confirm.active
- update_confirm
- elsif @win_hit.active
- update_hit
- elsif @win_minus_state_set.active
- update_minus_state_set
- elsif @win_plus_state_set.active
- update_plus_state_set
- elsif @win_elements.active
- update_elements
- elsif @win_ignore_defense.active
- update_ignore_defense
- elsif @win_absorb_damage.active
- update_absorb_damage
- elsif @win_damage_to_mp.active
- update_damage_to_mp
- elsif @win_physical_attack.active
- update_physical_attack
- elsif @win_spi_f.active
- update_spi_f
- elsif @win_atk_f.active
- update_atk_f
- elsif @win_variance.active
- update_variance
- elsif @win_base_damage.active
- update_base_damage
- elsif @win_common_event_select.active
- update_common_event_select
- elsif @win_animation_select.active
- update_animation_select
- elsif @win_speed.active
- update_speed
- elsif @win_occasion.active
- update_occasion
- elsif @win_scope.active
- update_scope
- elsif @win_icons.active
- update_icons
- elsif @win_letters.active
- update_letters
- elsif @win_skillmaker.active
- update_skillmaker
- end
- end
- #-----------------------------------------------------------------------------
- # Update SkillMaker
- #-----------------------------------------------------------------------------
- def update_skillmaker
- @win_skillmaker.update
- if Input.trigger?(Input::C)
- Sound.play_decision
- @win_skillmaker.active = false
- case @win_skillmaker.index
- when 0 # name
- @letter_window = @win_name_preview
- activate_letters(16, 0)
- when 1 # icon
- @win_icons.visible = true
- @win_icons.index = 0
- @win_icons.refresh
- @win_icons.active = true
- when 2 # description
- @letter_window = @win_description_preview
- activate_letters(60, 1)
- when 3 # scope
- @win_scope.visible = true
- @win_scope.active = true
- when 4 # occasion
- @win_occasion.visible = true
- @win_occasion.active = true
- when 5 # speed
- @win_speed.visible = true
- @win_speed.active = true
- when 6 # Animation
- @win_animation_preview.visible = true
- @win_animation_select.visible = true
- @win_animation_select.index = 0
- @win_animation_select.active = true
- when 7 # Common Event
- @win_common_event_select.visible = true
- @win_common_event_select.visible = true
- @win_common_event_select.index = 0
- @win_common_event_select.active = true
- when 8 # Base Damage
- @win_base_damage.visible = true
- @win_base_damage.active = true
- when 9 # Variance
- @win_variance.visible = true
- @win_variance.active = true
- when 10 # Atk F
- @win_atk_f.visible = true
- @win_atk_f.active = true
- when 11 # Spi F
- @win_spi_f.visible = true
- @win_spi_f.active = true
- when 12 # physical attack?
- @win_physical_attack.visible = true
- @win_physical_attack.active = true
- when 13 # Damage to MP
- @win_damage_to_mp.visible = true
- @win_damage_to_mp.active = true
- when 14 # Absorb Damage
- @win_absorb_damage.visible = true
- @win_absorb_damage.active = true
- when 15 # Ignore Defense
- @win_ignore_defense.visible = true
- @win_ignore_defense.active = true
- when 16 # Choose Elements
- @win_elements.visible = true
- @win_elements.active = true
- when 17 # Choose Plus State Set
- @win_plus_state_set.visible = true
- @win_plus_state_set.active = true
- when 18 # Minus State Set
- @win_minus_state_set.visible = true
- @win_minus_state_set.active = true
- when 19 # Message 1
- @letter_window = @win_message1
- activate_letters(40, 2)
- when 20 # Message 2
- @letter_window = @win_message2
- activate_letters(40, 3)
- when 21 # Hit
- @win_hit.visible = true
- @win_hit.active = true
- when 22 # Finalize
- @win_confirm.visible = true
- @win_confirm.active = true
- end
- elsif Input.trigger?(Input::B)
- Sound.play_cancel
- $scene = Scene_Map.new
- elsif Input.trigger?(Input::Y)
- Sound.play_decision
- p @maker
- p @maker.skill
- end
- end
- #-----------------------------------------------------------------------------
- # Set Costs
- #-----------------------------------------------------------------------------
- def set_costs
- @maker.set_mp_cost
- @maker.create_price
- @win_mp_cost.cost = @maker.skill.mp_cost
- @win_create_cost.cost = @maker.skill.skill_cost("gold")
- refresh_costs
- end
- #-----------------------------------------------------------------------------
- # Activate Letters
- #-----------------------------------------------------------------------------
- def activate_letters(max_chars, object_of_string)
- @letter_window.string = ""
- @letter_window.max_characters = max_chars
- @letter_window.refresh
- @object_of_string = object_of_string
- @win_letters.active = true
- @letter_window.visible = true
- @win_letters.visible = true
- end
- #-----------------------------------------------------------------------------
- # Alter Letter String
- #-----------------------------------------------------------------------------
- def alter_letter_string
- str = @letter_window.string.to_s
- case @object_of_string
- when 0 # Name
- @maker.skill.name = str
- when 1 # Description
- @maker.skill.description = str
- when 2 # Message1
- @maker.skill.message1 = str
- when 3 # Message2
- @maker.skill.message2 = str
- end
- end
- #-----------------------------------------------------------------------------
- # Update Letters
- #-----------------------------------------------------------------------------
- def update_letters
- @win_letters.update
- @letter_window.refresh
- if Input.trigger?(Input::A) # Shift
- @win_letters.play_shift
- case @win_letters.shift_index
- when 0
- @win_letters.shift_index = 1
- when 1
- @win_letters.shift_index = 0
- end
- @win_letters.refresh
- elsif Input.trigger?(Input::B) # Delete
- if @letter_window.index > 0
- @win_letters.play_delete
- @letter_window.delete_a_letter
- else
- Sound.play_buzzer
- end
- elsif Input.trigger?(Input::C) # Select
- if @letter_window.index < @letter_window.max_characters
- if @win_letters.index == 41
- @win_letters.play_finished
- alter_letter_string
- @win_letters.active = false
- @letter_window.visible = false
- @win_letters.visible = false
- @win_skillmaker.refresh
- @win_skillmaker.active = true
- elsif @win_letters.index == 40
- Sound.play_cancel
- @win_letters.active = false
- @letter_window.visible = false
- @win_letters.visible = false
- @win_skillmaker.active = true
- else
- @win_letters.play_letter
- l = @win_letters.letters[@win_letters.index]
- @letter_window.add_a_letter(l)
- end
- else
- Sound.play_buzzer
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Update Icons
- #-----------------------------------------------------------------------------
- def update_icons
- @win_icons.update
- @win_icons.refresh
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @win_icons.visible = false
- @win_skillmaker.active = true
- @win_icons.active = false
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- icon_id = @win_icons.icons[@win_icons.index]
- @maker.skill.icon_index = icon_id
- @win_skillmaker.refresh
- @win_icons.visible = false
- @win_skillmaker.active = true
- @win_icons.active = false
- end
- end
- #-----------------------------------------------------------------------------
- # Update Scope
- #-----------------------------------------------------------------------------
- def update_scope
- @win_scope.update
- @win_scope.refresh
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @win_scope.visible = false
- @win_scope.active = false
- @win_skillmaker.active = true
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- @maker.skill.scope = @win_scope.current_value
- @win_scope.visible = false
- @win_scope.active = false
- @win_skillmaker.refresh
- @win_skillmaker.active = true
- elsif Input.trigger?(Input::RIGHT)
- if @win_scope.current_value < @win_scope.max_value
- Sound.play_cursor
- @win_scope.current_value += 1
- else
- @win_scope.current_value = @win_scope.max_value
- Sound.play_buzzer
- end
- elsif Input.trigger?(Input::LEFT)
- if @win_scope.current_value > @win_scope.min_value
- Sound.play_cursor
- @win_scope.current_value -= 1
- else
- @win_scope.current_value = @win_scope.min_value
- Sound.play_buzzer
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Update Occasion
- #-----------------------------------------------------------------------------
- def update_occasion
- @win_occasion.update
- @win_occasion.refresh
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @win_occasion.visible = false
- @win_occasion.active = false
- @win_skillmaker.active = true
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- @maker.skill.occasion = @win_occasion.current_value
- @win_occasion.visible = false
- @win_occasion.active = false
- @win_skillmaker.refresh
- @win_skillmaker.active = true
- elsif Input.trigger?(Input::RIGHT)
- if @win_occasion.current_value < @win_occasion.max_value
- Sound.play_cursor
- @win_occasion.current_value += 1
- else
- @win_occasion.current_value = @win_occasion.max_value
- Sound.play_buzzer
- end
- elsif Input.trigger?(Input::LEFT)
- if @win_occasion.current_value > @win_occasion.min_value
- Sound.play_cursor
- @win_occasion.current_value -= 1
- else
- @win_occasion.current_value = @win_occasion.min_value
- Sound.play_buzzer
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Update Speed
- #-----------------------------------------------------------------------------
- def update_speed
- @win_speed.update
- @win_speed.refresh
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @win_speed.visible = false
- @win_speed.active = false
- @win_skillmaker.active = true
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- @maker.skill.speed = @win_speed.current_value
- @win_speed.visible = false
- @win_speed.active = false
- @win_skillmaker.refresh
- @win_skillmaker.active = true
- elsif Input.trigger?(Input::RIGHT)
- if @win_speed.current_value < @win_speed.max_value
- Sound.play_cursor
- @win_speed.current_value += 1
- else
- @win_speed.current_value = @win_speed.max_value
- Sound.play_buzzer
- end
- elsif Input.trigger?(Input::LEFT)
- if @win_speed.current_value > @win_speed.min_value
- Sound.play_cursor
- @win_speed.current_value -= 1
- else
- @win_speed.current_value = @win_speed.min_value
- Sound.play_buzzer
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Update Animation Select
- #-----------------------------------------------------------------------------
- def update_animation_select
- @win_animation_select.update
- @win_animation_preview.update_animation
- selection_id = @win_animation_select.selection_ids[@win_animation_select.index]
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @win_animation_select.visible = false
- @win_animation_preview.visible = false
- @win_animation_select.active = false
- @win_skillmaker.active = true
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- #~ p "Selection_ID", selection_id
- #~ p "Selections", @win_animation_select.selection_ids
- @maker.skill.animation_id = selection_id
- @win_animation_select.visible = false
- @win_animation_preview.visible = false
- @win_skillmaker.refresh
- @win_skillmaker.active = true
- @win_animation_select.active = false
- elsif Input.trigger?(Input::Y)
- Sound.play_decision
- @win_animation_preview.anisprite.start_animation($data_animations[selection_id])
- end
- end
- #-----------------------------------------------------------------------------
- # Update Common Event Select
- #-----------------------------------------------------------------------------
- def update_common_event_select
- @win_common_event_select.update
- selection_id = @win_common_event_select.selection_ids[@win_common_event_select.index]
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @win_common_event_select.visible = false
- @win_common_event_select.active = false
- @win_skillmaker.active = true
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- @maker.skill.common_event_id = selection_id
- @win_common_event_select.visible = false
- @win_common_event_select.active = false
- @win_skillmaker.refresh
- @win_skillmaker.active = true
- end
- end
- #-----------------------------------------------------------------------------
- # Update Base Damage
- #-----------------------------------------------------------------------------
- def update_base_damage
- @win_base_damage.update
- @win_base_damage.refresh
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @win_base_damage.visible = false
- @win_base_damage.active = false
- @win_skillmaker.active = true
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- @maker.skill.base_damage = @win_base_damage.current_value
- @win_base_damage.visible = false
- @win_base_damage.active = false
- @win_skillmaker.refresh
- @win_skillmaker.active = true
- elsif Input.trigger?(Input::RIGHT)
- if @win_base_damage.current_value < @win_base_damage.max_value
- Sound.play_cursor
- @win_base_damage.current_value += 1
- else
- @win_base_damage.current_value = @win_base_damage.max_value
- Sound.play_buzzer
- end
- elsif Input.trigger?(Input::LEFT)
- if @win_base_damage.current_value > @win_base_damage.min_value
- Sound.play_cursor
- @win_base_damage.current_value -= 1
- else
- @win_base_damage.current_value = @win_base_damage.min_value
- Sound.play_buzzer
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Update Variance
- #-----------------------------------------------------------------------------
- def update_variance
- @win_variance.update
- @win_variance.refresh
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @win_variance.visible = false
- @win_variance.active = false
- @win_skillmaker.active = true
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- @maker.skill.variance = @win_variance.current_value
- @win_variance.visible = false
- @win_variance.active = false
- @win_skillmaker.refresh
- @win_skillmaker.active = true
- elsif Input.trigger?(Input::RIGHT)
- if @win_variance.current_value < @win_variance.max_value
- Sound.play_cursor
- @win_variance.current_value += 1
- else
- @win_variance.current_value = @win_variance.max_value
- Sound.play_buzzer
- end
- elsif Input.trigger?(Input::LEFT)
- if @win_variance.current_value > @win_variance.min_value
- Sound.play_cursor
- @win_variance.current_value -= 1
- else
- @win_variance.current_value = @win_variance.min_value
- Sound.play_buzzer
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Update Atk F
- #-----------------------------------------------------------------------------
- def update_atk_f
- @win_atk_f.update
- @win_atk_f.refresh
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @win_atk_f.visible = false
- @win_atk_f.active = false
- @win_skillmaker.active = true
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- @maker.skill.atk_f = @win_atk_f.current_value
- @win_atk_f.visible = false
- @win_atk_f.active = false
- @win_skillmaker.refresh
- @win_skillmaker.active = true
- elsif Input.trigger?(Input::RIGHT)
- if @win_atk_f.current_value < @win_atk_f.max_value
- Sound.play_cursor
- @win_atk_f.current_value += 1
- else
- @win_atk_f.current_value = @win_atk_f.max_value
- Sound.play_buzzer
- end
- elsif Input.trigger?(Input::LEFT)
- if @win_atk_f.current_value > @win_atk_f.min_value
- Sound.play_cursor
- @win_atk_f.current_value -= 1
- else
- @win_atk_f.current_value = @win_atk_f.min_value
- Sound.play_buzzer
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Update Spi_F
- #-----------------------------------------------------------------------------
- def update_spi_f
- @win_spi_f.update
- @win_spi_f.refresh
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @win_spi_f.visible = false
- @win_spi_f.active = false
- @win_skillmaker.active = true
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- @maker.skill.spi_f = @win_spi_f.current_value
- @win_spi_f.visible = false
- @win_spi_f.active = false
- @win_skillmaker.refresh
- @win_skillmaker.active = true
- elsif Input.trigger?(Input::RIGHT)
- if @win_spi_f.current_value < @win_spi_f.max_value
- Sound.play_cursor
- @win_spi_f.current_value += 1
- else
- @win_spi_f.current_value = @win_spi_f.max_value
- Sound.play_buzzer
- end
- elsif Input.trigger?(Input::LEFT)
- if @win_spi_f.current_value > @win_spi_f.min_value
- Sound.play_cursor
- @win_spi_f.current_value -= 1
- else
- @win_spi_f.current_value = @win_spi_f.min_value
- Sound.play_buzzer
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Update Physical Attack
- #-----------------------------------------------------------------------------
- def update_physical_attack
- @win_physical_attack.update
- @win_physical_attack.refresh
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @win_physical_attack.visible = false
- @win_physical_attack.active = false
- @win_skillmaker.active = true
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- case @win_physical_attack.index
- when 0
- @maker.skill.physical_attack = true
- when 1
- @maker.skill.physical_attack = false
- end
- @win_physical_attack.visible = false
- @win_physical_attack.active = false
- @win_skillmaker.refresh
- @win_skillmaker.active = true
- end
- end
- #-----------------------------------------------------------------------------
- # Update Damage To Mp
- #-----------------------------------------------------------------------------
- def update_damage_to_mp
- @win_damage_to_mp.update
- @win_damage_to_mp.refresh
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @win_damage_to_mp.visible = false
- @win_damage_to_mp.active = false
- @win_skillmaker.active = true
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- case @win_damage_to_mp.index
- when 0
- @maker.skill.damage_to_mp = true
- when 1
- @maker.skill.damage_to_mp = false
- end
- @win_damage_to_mp.visible = false
- @win_damage_to_mp.active = false
- @win_skillmaker.refresh
- @win_skillmaker.active = true
- end
- end
- #-----------------------------------------------------------------------------
- # Update Absorb Damage
- #-----------------------------------------------------------------------------
- def update_absorb_damage
- @win_absorb_damage.update
- @win_absorb_damage.refresh
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @win_absorb_damage.visible = false
- @win_absorb_damage.active = false
- @win_skillmaker.active = true
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- case @win_absorb_damage.index
- when 0
- @maker.skill.absorb_damage = true
- when 1
- @maker.skill.absorb_damage = false
- end
- @win_absorb_damage.visible = false
- @win_absorb_damage.active = false
- @win_skillmaker.refresh
- @win_skillmaker.active = true
- end
- end
- #-----------------------------------------------------------------------------
- # Update Ignore Defense
- #-----------------------------------------------------------------------------
- def update_ignore_defense
- @win_ignore_defense.update
- @win_ignore_defense.refresh
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @win_ignore_defense.visible = false
- @win_ignore_defense.active = false
- @win_skillmaker.active = true
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- case @win_ignore_defense.index
- when 0
- @maker.skill.ignore_defense = true
- when 1
- @maker.skill.ignore_defense = false
- end
- @win_ignore_defense.visible = false
- @win_ignore_defense.active = false
- @win_skillmaker.refresh
- @win_skillmaker.active = true
- end
- end
- #-----------------------------------------------------------------------------
- # Update Elements
- #-----------------------------------------------------------------------------
- def update_elements
- @win_elements.update
- @win_elements.refresh
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @win_elements.visible = false
- @win_elements.active = false
- @maker.skill.element_set = @win_elements.selected_elements
- @win_skillmaker.refresh
- @win_skillmaker.active = true
- elsif Input.trigger?(Input::A)
- unless !@win_elements.selected_elements.include?(@win_elements.elements[@win_elements.index])
- Sound.play_decision
- @win_elements.selected_elements.delete(@win_elements.elements[@win_elements.index])
- end
- elsif Input.trigger?(Input::C)
- unless @win_elements.selected_elements.include?(@win_elements.elements[@win_elements.index])
- Sound.play_decision
- @win_elements.selected_elements.push(@win_elements.elements[@win_elements.index])
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Update Plus State Set
- #-----------------------------------------------------------------------------
- def update_plus_state_set
- @win_plus_state_set.update
- @win_plus_state_set.refresh
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @win_plus_state_set.visible = false
- @win_plus_state_set.active = false
- @maker.skill.plus_state_set = @win_plus_state_set.selected_states
- @win_skillmaker.refresh
- @win_skillmaker.active = true
- elsif Input.trigger?(Input::A)
- unless !@win_plus_state_set.selected_states.include?(@win_plus_state_set.states[@win_plus_state_set.index])
- Sound.play_decision
- @win_plus_state_set.selected_states.delete(@win_plus_state_set.states[@win_plus_state_set.index])
- end
- elsif Input.trigger?(Input::C)
- unless @win_plus_state_set.selected_states.include?(@win_plus_state_set.states[@win_plus_state_set.index])
- Sound.play_decision
- @win_plus_state_set.selected_states.push(@win_plus_state_set.states[@win_plus_state_set.index])
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Update Minus State Set
- #-----------------------------------------------------------------------------
- def update_minus_state_set
- @win_minus_state_set.update
- @win_minus_state_set.refresh
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @win_minus_state_set.visible = false
- @win_minus_state_set.active = false
- @maker.skill.minus_state_set = @win_minus_state_set.selected_states
- @win_skillmaker.refresh
- @win_skillmaker.active = true
- elsif Input.trigger?(Input::A)
- unless !@win_minus_state_set.selected_states.include?(@win_minus_state_set.states[@win_minus_state_set.index])
- Sound.play_decision
- @win_minus_state_set.selected_states.delete(@win_minus_state_set.states[@win_minus_state_set.index])
- end
- elsif Input.trigger?(Input::C)
- unless @win_minus_state_set.selected_states.include?(@win_minus_state_set.states[@win_minus_state_set.index])
- Sound.play_decision
- @win_minus_state_set.selected_states.push(@win_minus_state_set.states[@win_minus_state_set.index])
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Update Hit
- #-----------------------------------------------------------------------------
- def update_hit
- @win_hit.update
- @win_hit.refresh
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @win_hit.visible = false
- @win_hit.active = false
- @win_skillmaker.active = true
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- @maker.skill.hit = @win_hit.current_value
- @win_hit.visible = false
- @win_hit.active = false
- @win_skillmaker.refresh
- @win_skillmaker.active = true
- elsif Input.trigger?(Input::RIGHT)
- if @win_hit.current_value <= @win_hit.max_value
- Sound.play_cursor
- @win_hit.current_value += 1
- else
- @win_hit.current_value = @win_hit.max_value
- Sound.play_buzzer
- end
- elsif Input.trigger?(Input::LEFT)
- if @win_hit.current_value > @win_hit.min_value
- Sound.play_cursor
- @win_hit.current_value -= 1
- else
- @win_hit.current_value = @win_hit.min_value
- Sound.play_buzzer
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Update Confirm
- #-----------------------------------------------------------------------------
- def update_confirm
- @win_confirm.update
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @win_confirm.visible = false
- @win_skillmaker.active = true
- @win_confirm.active = false
- elsif Input.trigger?(Input::C)
- if @maker.skill.name == ""
- Sound.play_buzzer
- elsif $game_party.gold < @win_create_cost.cost
- Sound.play_buzzer
- else
- $game_party.lose_gold(@win_create_cost.cost)
- @win_confirm.play_completion
- @maker.finish_skill_creation
- #~ p "maker skill id", maker.skill.id
- @actor.learn_skill(maker.skill.id)
- show_result_window
- @win_confirm.visible = false
- @win_confirm.active = false
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Show Result Window
- #-----------------------------------------------------------------------------
- def show_result_window
- @win_result.result_string = "New Skill, " + @maker.skill.name + ", was created!"
- @win_result.icon_id = @maker.skill.icon_index
- @win_result.refresh
- @win_result.visible = true
- end
- #-----------------------------------------------------------------------------
- # Update Result
- #-----------------------------------------------------------------------------
- def update_result
- if Input.trigger?(Input::C) || Input.trigger?(Input::B)
- Sound.play_decision
- $scene = Scene_Map.new
- end
- end
- #-----------------------------------------------------------------------------
- # Refresh Costs
- #-----------------------------------------------------------------------------
- def refresh_costs
- @win_create_cost.refresh
- @win_mp_cost.refresh
- end
- #-----------------------------------------------------------------------------
- # Terminate
- #-----------------------------------------------------------------------------
- def terminate
- super
- dispose_menu_background
- windows = [@win_create_cost, @win_mp_cost, @win_message1, @win_message2,
- @win_minus_state_set, @win_plus_state_set, @win_elements, @win_ignore_defense,
- @win_absorb_damage, @win_damage_to_mp, @win_physical_attack, @win_atk_f,
- @win_spi_f, @win_variance, @win_base_damage, @win_common_event_select,
- @win_animation_preview, @win_animation_select, @win_speed, @win_occasion,
- @win_scope, @win_description_preview, @win_icons, @win_letters,
- @win_name_preview, @win_skillmaker, @win_hit, @win_confirm, @win_result,
- @win_help, @win_header]
- for window in windows
- window.dispose
- Graphics.update
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment