Jump to content
Rpg²S Forum

-Support System FF9


Valentino
 Share

Recommended Posts

Support System FF9


Descrizione

Questo script emula il sistema di supporto delle abilità passive presente in FF9. In pratica si possono attivare varie abilità passive con delle pietre magiche che si ottengono attraverso il level up. Molte abilità presenti in FF9 sono state implementate nel sistema più qualche extra.



Autore

Avon Valentino (Io)



Allegati
Script:

#-------------------------------Support System FF9-------------------------- #script creato da Valentino Avon#Queste sono solo alcune delle possibili abilità, per personalizzarlo rivolgetevi #pure a me su rpg2s forum.net#Se usate questo script per favore creditatemi ;) #------------------------------CONFIGURAZIONE---------------------------------module Pietre#pietre iniziali per ogni personaggio#devono essere stabilite per ogni personaggio  o darà errore.#Il costo delle abilità in pietre viene semplicemente dato dal costo in Mp#della abilità passiva. # ID EROE => N° PIETRE,PIETRE_INIZIALI = {1 => 18, 2 => 15, 3 => 13, 4 => 16, 5 => 19, 6 => 10, 7 => 13, 8 => 15}end  PIETRA_ATTIVA = "Sfera" #pictures della pietra attivaPIETRA_NONATTIVA = "Sfera_dis"#pictures della pietra inattiva #Livelli nei quali si aquisirà una pietra.PIETRE_LV = [3,5,8,10,13,15,18,20,23,25,28,30,33,35,38,40,43,45,48,50,53,55,58,60,63,65,68,70,73,75,78,80,83,85,88,90,93,95,98,100] #numero pietre prese raggiunto il lv di PIETRE_LVN_PIETRE = 1 #Id armature che al lv di PIETRE_LV permettono l'aquisizione del doppio di pietreARMATURA_PIETRE = [1,5]  #id di tutte le skill passiveSKILL_PASSIVE = [81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127] #di delle skill passive che conferiscono elementi (fuoco, ghiaccio, besticida...)ELMNT = [81,82,83,84,85,86,87,88] #Id della skill autoprotectAUTO_PROTECT = 89PROTECT_STATE_ID = 14 #Id dello status protect #Id della skill autoshellAUTO_SHELL = 90SHELL_STATE_ID = 15 #ID dello status Shell #ID della skill per salire piu velocemente di livelloLEVEL_UP = 91LEVEL_UP_FATTORE = 1.5 #esperienza ottenuta moltiplicata per 2 #ID della skill di contrattaccoCONTRATTACCO = 92 #ID della skill di occhio x occhioOCCHI_X_OCCHI = 93 #ID della skill di HP + 10%HP_10 = 94 #ID della skill di HP + 20%HP_20 = 95 #ID della skill di HP + 30%HP_30 = 96 #ID della skill di HP + 40%HP_40 = 97 #ID della skill di MP + 10%SP_10 = 98 #ID della skill di MP + 20%SP_20 = 99 #ID della skill di MP + 30%SP_30 = 100 #ID della skill di MP + 40%SP_40 = 101 #ID della skill Siero (protegge dal veleno)SIERO = 102VELENO_STATE_ID = 3 #Id dello status veleno #ID della skill Megafono (protegge dal mutismo)MEGAFONO = 103MUTISMO_STATE_ID = 5 #Id dello status mutismo #ID della skill Anti-Caos (protegge dal caos)ANTI_CAOS = 104CAOS_STATE_ID = 6 #Id dello status caos #ID della skill Insonnia (protegge dal sonno)INSONNIA = 105SONNO_STATE_ID = 7 #Id dello status sonno #ID della skill Distenebra (protegge dalla cecità)DISTENEBRA = 106CECITA_STATE_ID = 10 #Id dello status cecità #ID della skill Provvidenza (Auto-risveglio)PROVVIDENZA = 107RISVEGLIO_STATE_ID = 17 #Id dello status risveglioRISVEGLIO_ANIM = 25 #Id animazione risveglio #ID della skill auto-rigene (recupero hp costante)AUTO_RIGENE = 108RIGENE_STATE_ID = 18 #Id dello status rigeneRIGENE_FATTORE = 30 #ogni turno viene recuperato un trentesimo di vita. #ID della skill auto-levita (si evitano colpi di terra)AUTO_LEVITA = 109LEVITA_STATE_ID = 19 #Id dello status levitaTERRA = 5 #id elemento Terra #ID della skill auto-reflex (si riflettono le magie)AUTO_REFLEX = 110REFLEX_STATE_ID = 20 #id status reflexREFLEX_ANIM = 65 #animazione di reflex#id skill possibili da riflettereREFLEX_SKILL = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32] #ID della skill Licenza Medica (Raddoppia effetto medicine)LICENZA_MEDICA = 111 #ID della skill 50% MP (consumo mp dimezzato)MP_DIMEZZA = 112 #Id della skill auto-haste (aumenta velocità d'azione)AUTO_HASTE = 113HASTE_STATE_ID = 21#id status Haste #Id della skill applicazione (aumenta effetto magie)APPLICAZIONE = 114#id skill potenziateAPPLICAZIONE_SKILL = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32]APPLICAZIONE_FORZA = 2 #danno moltiplicato per 2 #Id skill WILHELM_TELL (aumenta la destrezza)WILHELM_TELL = 115WILHELM_TELL_FATTORE = 10  #percentuale della destrezza di base che viene aggiunta #Id della skill MP x Attacco (usa mp per potenziare l'attacco)MP_X_ATTACCO = 116MP_X_ATTACCO_FATTORE = 10 #percentuale del danno effettuato che verrà sottratta agli MPATK_FATTORE = 20 #Aumenta l'attacco in percentuale #Id della skill Auto-pozione (usa pozione appena colpiti)AUTO_POZIONE = 117POZIONE_ID = 1 #id pozione e megapozioneMEGAPOZIONE_ID = 2 #Id della skill contramagia (contrattacca se colpito da una magia dannosa)CONTRAMAGIA = 118 #id delle magie che verranno contrattaccate#Inserire solo magie che colpiscono 1 eroe.CONTRAMAGIA_SKILL = [7,8,10,11,13,14,16,17,19,20,22,23,25,26,28,29,31,32] #id skill sinergia (abilita i cambi di status delle armi)SINERGIA = 119 #id della skill MP = 1 (consuma 1 mp)MP_1 = 120 #id della skill assorbire (attaccando si recupera vita)ASSORBIRE = 121#cosi il danno sara assorbito per un ventesimo, a valori piu grandi corrisponde#un assorbimento minore. con 1 il danno verrà assorbito interamente.ASSORBIRE_FATTORE = 20  #id della skill DANNO MP (il danno viene ridotto a metà ma vengono colpiti anche #gli Mp)DANNO_MP = 122 DANNO_MP_FATTORE = 20 #danno in proporzione agli mp (1 ventesimo default) #id della skill doppio colpo (attacca due volte il nemico)DOPPIO_COLPO = 123 DOPPIO_COLPO_FATTORE = 2 #Toglie la metà per ogni attacco.  #id della skill critico(aumenta la possibilità di fare un colpo critico)CRITICO = 124 #percentuale che aumenta la probabilità del colpo critico.#normalmente viene preso un numero a caso tra 1 e cento e viene comparato#con la destrezza di chi attacca e la agilità di chi subisce. Se il numero a caso#è minore della destrezza * 4 / l'agilità, avviene il colpo critico.#questo numero viene sottratto al numero massimo che viene scelto a caso, cosi#come default se è 10, invece che scegliere un numero tra 1 e 100 verrà scelto#tra 1 e 90 rendendo più facile il colpo critico.CRITICO_FATTORE = 10 #id della skill potenziamento critico (se esegue un colpo critico esso#infligge ancora più danni.)CRITICO_POT = 125CRITICO_POT_FATTORE = 2.5 #fattore che moltiplica la potenza del colpo critico.#il colpo critico infliggerà due volte e mezzo i danni di un attacco normale.  #id della skill assorbire (attaccando si recupera vita)ASSORBIRE_MP = 126#cosi il danno sara assorbito per un ventesimo, a valori piu grandi corrisponde#un assorbimento minore. con 1 il danno verrà assorbito interamente.ASSORBIRE_FATTORE_MP = 30 #Id della skill Incontri 0INCONTRI_0 = 127 #==============================================================================# ** Window_Selectable#------------------------------------------------------------------------------#  This window class contains cursor movement and scroll functions.#============================================================================== class Window_Selectable_Passive < Window_Base  #--------------------------------------------------------------------------  # * Public Instance Variables  #--------------------------------------------------------------------------  attr_reader   :index                    # cursor position  attr_reader   :help_window              # help window  #--------------------------------------------------------------------------  # * Object Initialization  #     x      : window x-coordinate  #     y      : window y-coordinate  #     width  : window width  #     height : window height  #--------------------------------------------------------------------------  def initialize(x, y, width, height)    super(x, y, width, height)    @item_max = 1    @column_max = 1    @index = -1  end  #--------------------------------------------------------------------------  # * Set Cursor Position  #     index : new cursor position  #--------------------------------------------------------------------------  def index=(index)    @index = index    # Update Help Text (update_help is defined by the subclasses)    if self.active and @help_window != nil      update_help    end    # Update cursor rectangle    update_cursor_rect  end  #--------------------------------------------------------------------------  # * Get Row Count  #--------------------------------------------------------------------------  def row_max    # Compute rows from number of items and columns    return (@item_max + @column_max - 1) / @column_max  end  #--------------------------------------------------------------------------  # * Get Top Row  #--------------------------------------------------------------------------  def top_row    # Divide y-coordinate of window contents transfer origin by 1 row    # height of 32    return self.oy / 32  end  #--------------------------------------------------------------------------  # * Set Top Row  #     row : row shown on top  #--------------------------------------------------------------------------  def top_row=(row)    # If row is less than 0, change it to 0    if row < 0      row = 0    end    # If row exceeds row_max - 1, change it to row_max - 1    if row > row_max - 1      row = row_max - 1    end    # Multiply 1 row height by 32 for y-coordinate of window contents    # transfer origin    self.oy = row * 32  end  #--------------------------------------------------------------------------  # * Get Number of Rows Displayable on 1 Page  #--------------------------------------------------------------------------  def page_row_max    # Subtract a frame height of 32 from the window height, and divide it by    # 1 row height of 32    return (self.height - 32) / 32  end  #--------------------------------------------------------------------------  # * Get Number of Items Displayable on 1 Page  #--------------------------------------------------------------------------  def page_item_max    # Multiply row count (page_row_max) times column count (@column_max)    return page_row_max * @column_max  end  #--------------------------------------------------------------------------  # * Set Help Window  #     help_window : new help window  #--------------------------------------------------------------------------  def help_window=(help_window)    @help_window = help_window    # Update help text (update_help is defined by the subclasses)    if self.active and @help_window != nil      update_help    end  end  #--------------------------------------------------------------------------  # * Update Cursor Rectangle  #--------------------------------------------------------------------------  def update_cursor_rect    # If cursor position is less than 0    if @index < 0      self.cursor_rect.empty      return    end    # Get current row    row = @index / @column_max    # If current row is before top row    if row < self.top_row      # Scroll so that current row becomes top row      self.top_row = row    end    # If current row is more to back than back row    if row > self.top_row + (self.page_row_max - 1)      # Scroll so that current row becomes back row      self.top_row = row - (self.page_row_max - 1)    end    # Calculate cursor width    cursor_width = self.width / @column_max - 32    # Calculate cursor coordinates    x = @index % @column_max * (cursor_width + 32)    y = @index / @column_max * 32 - self.oy    # Update cursor rectangle    self.cursor_rect.set(x, y, cursor_width, 32)  end  #--------------------------------------------------------------------------  # * Frame Update  #--------------------------------------------------------------------------  def update    super    # If cursor is movable    if self.active and @item_max > 0 and @index >= 0      # If pressing down on the directional buttons      if Input.repeat?(Input::DOWN)        # If column count is 1 and directional button was pressed down with no        # repeat, or if cursor position is more to the front than        # (item count - column count)        if (@column_max == 1 and Input.trigger?(Input::DOWN)) or           @index < @item_max - @column_max          # Move cursor down          $game_system.se_play($data_system.cursor_se)          @index = (@index + @column_max) % @item_max        end      end      # If the up directional button was pressed      if Input.repeat?(Input::UP)        # If column count is 1 and directional button was pressed up with no        # repeat, or if cursor position is more to the back than column count        if (@column_max == 1 and Input.trigger?(Input::UP)) or           @index >= @column_max          # Move cursor up          $game_system.se_play($data_system.cursor_se)          @index = (@index - @column_max + @item_max) % @item_max        end      end      # If the right directional button was pressed      if Input.repeat?(Input::RIGHT)        # If column count is 2 or more, and cursor position is closer to front        # than (item count -1)        if @column_max >= 2 and @index < @item_max - 1          # Move cursor right          $game_system.se_play($data_system.cursor_se)          @index += 1        end      end      # If the left directional button was pressed      if Input.repeat?(Input::LEFT)        # If column count is 2 or more, and cursor position is more back than 0        if @column_max >= 2 and @index > 0          # Move cursor left          $game_system.se_play($data_system.cursor_se)          @index -= 1        end      end      # If R button was pressed    end    # Update help text (update_help is defined by the subclasses)    if self.active and @help_window != nil      update_help    end    # Update cursor rectangle    update_cursor_rect  endend  #==============================================================================# ** Window_Skill#------------------------------------------------------------------------------#  This window displays usable skills on the skill and battle screens.#============================================================================== class Window_Skill < Window_Selectable  #--------------------------------------------------------------------------  # * Object Initialization  #     actor : actor  #--------------------------------------------------------------------------   #--------------------------------------------------------------------------  # * Refresh  #--------------------------------------------------------------------------  def refresh    if self.contents != nil      self.contents.dispose      self.contents = nil    end    @data = []    for i in 0...@actor.skills.size      skill = $data_skills[@actor.skills[i]]      if skill != nil        unless SKILL_PASSIVE.include?(skill.id)        @data.push(skill)      end      end    end    # If item count is not 0, make a bit map and draw all items    @item_max = @data.size    if @item_max > 0      self.contents = Bitmap.new(width - 32, row_max * 32)      for i in 0...@item_max        draw_item(i)      end    end  end  #--------------------------------------------------------------------------  # * Draw Item  #     index : item number  #--------------------------------------------------------------------------  def draw_item(index)    skill = @data[index]    if @actor.skill_can_use?(skill.id)      self.contents.font.color = normal_color    else      self.contents.font.color = disabled_color    end    x = 4 + index % 2 * (288 + 32)    y = index / 2 * 32    rect = Rect.new(x, y, self.width / @column_max - 32, 32)    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))    bitmap = RPG::Cache.icon(skill.icon_name)    opacity = self.contents.font.color == normal_color ? 255 : 128    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)    self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)    if $game_temp.in_battle      if @actor.skill_learn?(MP_DIMEZZA)        sp_2 = skill.sp_cost / 2    self.contents.draw_text(x + 232, y, 48, 32, sp_2.to_s, 2)  elsif @actor.skill_learn?(MP_1)   self.contents.draw_text(x + 232, y, 48, 32, "1", 2)   else    self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)  endelse  self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)  end  end  #--------------------------------------------------------------------------  # * Help Text Update  #--------------------------------------------------------------------------  def update_help    @help_window.set_text(self.skill == nil ? "" : self.skill.description)  endend  #==============================================================================# ** Window_Passive#------------------------------------------------------------------------------#  This window displays passive skills on the skill and battle screens.#============================================================================== class Window_Pass < Window_Selectable_Passive  #--------------------------------------------------------------------------  # * Object Initialization  #     actor : actor  #--------------------------------------------------------------------------  def initialize(actor)    super(0, 128, 640, 352)    @actor = actor    @column_max = 2    refresh    self.index = 0    # If in battle, move window to center of screen    # and make it semi-transparent  end  #--------------------------------------------------------------------------  # * Acquiring Skill  #--------------------------------------------------------------------------  def skill    return @data[self.index]  end  #--------------------------------------------------------------------------  # * Refresh  #--------------------------------------------------------------------------  def refresh    if self.contents != nil      self.contents.dispose      self.contents = nil    end    @data = []    for i in 0...$data_skills.size      skill = $data_skills[i]      if SKILL_PASSIVE.include?(skill.id) and @actor.passive.include?(skill.id)         @data.push(skill)      end      end    # If item count is not 0, make a bit map and draw all items    @item_max = @data.size    if @item_max > 0      self.contents = Bitmap.new(width - 32, row_max * 32)      for i in 0...@item_max        draw_item(i)      end    end  end  #--------------------------------------------------------------------------  # * Draw Item  #     index : item number  #--------------------------------------------------------------------------  def draw_item(index)    skill = @data[index]    self.contents.font.color = normal_color    x = 4 + index % 2 * (288 + 32)    y = index / 2 * 32    rect = Rect.new(x, y, self.width / @column_max - 32, 32)    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))    bitmap = RPG::Cache.icon(PIETRA_ATTIVA) if @actor.skill_learn?(skill.id)    bitmap = RPG::Cache.icon(PIETRA_NONATTIVA) unless @actor.skill_learn?(skill.id)    if skill.id == OCCHI_X_OCCHI and @actor.contrattacco == false        self.contents.font.color = disabled_color       end     opacity = self.contents.font.color == normal_color ? 255 : 128    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)    self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)    self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)  end  #--------------------------------------------------------------------------  # * Help Text Update  #--------------------------------------------------------------------------  def update_help    @help_window.set_text(self.skill == nil ? "" : self.skill.description)  endend  #==============================================================================# ** Game_Battler (part 2)#------------------------------------------------------------------------------#  This class deals with battlers. It's used as a superclass for the Game_Actor#  and Game_Enemy classes.#============================================================================== class Game_Battler  attr_accessor :damage_mp  attr_accessor :damage_pop_mp   alias battler_initialize initialize  def initialize    @damage_mp = nil    @damage_pop_mp = false    battler_initialize    end  #--------------------------------------------------------------------------  # * State Change (+) Application  #     plus_state_set  : State Change (+)  #--------------------------------------------------------------------------  def states_plus(plus_state_set)    # Clear effective flag    effective = false    # Loop (added state)    for i in plus_state_set      if self.is_a?(Game_Actor)      for skill in $data_skills       if skill_learn?(skill.id)         stato = $data_states[i]     if skill.id == SIERO and stato.id == VELENO_STATE_ID     @state_changed = false    @protezione = true  end     if skill.id == MEGAFONO and stato.id == MUTISMO_STATE_ID     @state_changed = false    @protezione = true  end     if skill.id == ANTI_CAOS and stato.id == CAOS_STATE_ID     @state_changed = false    @protezione = true  end     if skill.id == INSONNIA and stato.id == SONNO_STATE_ID     @state_changed = false    @protezione = true  end   if skill.id == DISTENEBRA and stato.id == CECITA_STATE_ID     @state_changed = false    @protezione = true  end   endendend  unless @protezione      # If this state is not guarded      unless self.state_guard?(i)        # Set effective flag if this state is not full        effective |= self.state_full?(i) == false        # If states offer [no resistance]        if $data_states[i].nonresistance          # Set state change flag          @state_changed = true          # Add a state          add_state(i)        # If this state is not full        elsif self.state_full?(i) == false          # Convert state effectiveness to probability,          # compare to random numbers          if rand(100) < [0,100,80,60,40,20,0][self.state_ranks[i]]            # Set state change flag            @state_changed = true            # Add a state            add_state(i)          end        end      end    end    # End Method    return effective  end  end  #--------------------------------------------------------------------------  # * Applying Normal Attack Effects  #     attacker : battler  #--------------------------------------------------------------------------  def attack_effect(attacker)    # Clear critical flag    self.critical = false    # First hit detection    hit_result = (rand(100) < attacker.hit)    # If hit occurs    if hit_result == true      # Calculate basic damage      atk = [attacker.atk - self.pdef / 2, 0].max      #MP per attacco      if attacker.is_a?(Game_Actor) and attacker.skill_learn?(MP_X_ATTACCO) and attacker.sp > 0          atk += (attacker.atk * ATK_FATTORE) / 100          end      self.damage = atk * (20 + attacker.str) / 20      # Element correction      self.damage *= elements_correct(attacker.element_set)       self.damage /= 100      # If damage value is strictly positive      if self.damage > 0        # Critical correction        if attacker.is_a?(Game_Actor) and attacker.skill_learn?(CRITICO)          numero = 100 - CRITICO_FATTORE          if rand(numero) < 4 * attacker.dex / self.agi            self.damage *= 2 unless attacker.skill_learn?(CRITICO_POT)            self.damage *= CRITICO_POT_FATTORE if attacker.skill_learn?(CRITICO_POT)          self.critical = true          self.damage = self.damage.to_i        end       else #se non ha imparato la skill CRITICO verifica normalmente         if rand(100) < 4 * attacker.dex / self.agi          self.damage *= 2 unless attacker.skill_learn?(CRITICO_POT)          self.damage *= CRITICO_POT_FATTORE if attacker.skill_learn?(CRITICO_POT)          self.critical = true          self.damage = self.damage.to_i        end         end        #Mp per attacco        if attacker.is_a?(Game_Actor) and attacker.skill_learn?(MP_X_ATTACCO) and attacker.sp > 0          attacker.sp -= (self.damage*MP_X_ATTACCO_FATTORE)/ 100          end         # Guard correction        if self.guarding?          self.damage /= 2        end       if attacker.is_a?(Game_Actor) and attacker.skill_learn?(DOPPIO_COLPO)        self.damage /= DOPPIO_COLPO_FATTORE unless $contra        end      end      # Dispersion      if self.damage.abs > 0        amp = [self.damage.abs * 15 / 100, 1].max        self.damage += rand(amp+1) + rand(amp+1) - amp      end      # Second hit detection      eva = 8 * self.agi / attacker.dex + self.eva      hit = self.damage < 0 ? 100 : 100 - eva      hit = self.cant_evade? ? 100 : hit      hit_result = (rand(100) < hit)    end    # If hit occurs    if hit_result == true      # State Removed by Shock      remove_states_shock      # Substract damage from HP       if attacker.is_a?(Game_Actor)      unless attacker.skill_learn?(DANNO_MP)      self.hp -= self.damage     else      self.hp -= self.damage/2       self.hp -= self.damage     # self.damage_mp = self.damage/DANNO_MP_FATTORE      self.sp -= self.damage/DANNO_MP_FATTORE    end  else    self.hp -= self.damage  end       # State change      @state_changed = false      @protezione = false      states_plus(attacker.plus_state_set)      states_minus(attacker.minus_state_set)    # When missing    else      # Set damage to "Miss"      self.damage = "Mancato!"       # Clear critical flag      self.critical = false    end    self.damage = "Guardia!" if @protezione #se si è immuni allo status    # End Method     return true  end  #--------------------------------------------------------------------------  # * Apply Skill Effects  #     user  : the one using skills (battler)  #     skill : skill  #--------------------------------------------------------------------------  def skill_effect(user, skill)    # Clear critical flag    self.critical = false    # If skill scope is for ally with 1 or more HP, and your own HP = 0,    # or skill scope is for ally with 0, and your own HP = 1 or more    if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or       ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)      # End Method      return false    end    # Clear effective flag    effective = false    # Set effective flag if common ID is effective    effective |= skill.common_event_id > 0    # First hit detection    hit = skill.hit    if skill.atk_f > 0      hit *= user.hit / 100    end    hit_result = (rand(100) < hit)    # Set effective flag if skill is uncertain    effective |= hit < 100    # If hit occurs    if hit_result == true      # Calculate power      power = skill.power + user.atk * skill.atk_f / 100      if power > 0        power -= self.pdef * skill.pdef_f / 200        power -= self.mdef * skill.mdef_f / 200        power = [power, 0].max      end      # Calculate rate      rate = 20      rate += (user.str * skill.str_f / 100)      rate += (user.dex * skill.dex_f / 100)      rate += (user.agi * skill.agi_f / 100)      rate += (user.int * skill.int_f / 100)      # Calculate basic damage      self.damage = power * rate / 20      # Element correction      self.damage *= elements_correct(skill.element_set)      self.damage /= 100      # If damage value is strictly positive      if self.damage > 0        # Guard correction        if self.guarding?          self.damage /= 2        end      end      # Dispersion      if skill.variance > 0 and self.damage.abs > 0        amp = [self.damage.abs * skill.variance / 100, 1].max        self.damage += rand(amp+1) + rand(amp+1) - amp      end      # Second hit detection      eva = 8 * self.agi / user.dex + self.eva      hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100      hit = self.cant_evade? ? 100 : hit      hit_result = (rand(100) < hit)      # Set effective flag if skill is uncertain      effective |= hit < 100    end    # If hit occurs    if hit_result == true      # If physical attack has power other than 0      if skill.power != 0 and skill.atk_f > 0        # State Removed by Shock        remove_states_shock        # Set to effective flag        effective = true      end      if self.is_a?(Game_Actor) for abilities in $data_skills   #Se auto levita rende immuni agli attacchi di terra  if abilities.id == AUTO_LEVITA and self.skill_learn?(abilities.id) and skill.element_set.include?(TERRA)        @levita = true       end     end   end   if user.is_a?(Game_Actor)     #Se applicazione è attiva aumenta il danno delle abilità      if user.skill_learn?(APPLICAZIONE) and APPLICAZIONE_SKILL.include?(skill.id)         self.damage *= APPLICAZIONE_FORZA         self.damage = self.damage_to.i       end       end      # Substract damage from HP      last_hp = self.hp            if user.is_a?(Game_Actor)    unless user.skill_learn?(DANNO_MP)      self.hp -= self.damage unless @levita    else      self.hp -= self.damage/2 unless @levita     # self.damage_mp = self.damage/DANNO_MP_FATTORE      self.sp -= self.damage/DANNO_MP_FATTORE unless @levita    end  else   self.hp -= self.damage unless @levita  end     # self.hp -= self.damage/2 unless @levita     # self.sp -= self.damage/DANNO_MP_FATTORE unless @levita     # self.damage_mp = self.damage/DANNO_MP_FATTORE unless @levita      @levita = false      effective |= self.hp != last_hp      # State change      @state_changed = false      @protezione = false      effective |= states_plus(skill.plus_state_set)      effective |= states_minus(skill.minus_state_set)      # If power is 0      if skill.power == 0        # Set damage to an empty string        self.damage = ""        # If state is unchanged        unless @state_changed          # Set damage to "Miss"          self.damage = "Mancato!"        end      end    # If miss occurs    else      # Set damage to "Miss"      self.damage = "Mancato!"    end    # If not in battle    unless $game_temp.in_battle      # Set damage to nil      self.damage = nil    end   self.damage = "Guardia!" if @protezione #se immuni allo status     if self.is_a?(Game_Actor)   for abilities in $data_skills     #Se auto levita rende immuni agli attacchi di terra  if abilities.id == AUTO_LEVITA and self.skill_learn?(abilities.id) and skill.element_set.include?(TERRA)          self.damage = "Immune"       end       end     end    # End Method    return effective  end  #--------------------------------------------------------------------------  # * Application of Item Effects  #     item : item  #--------------------------------------------------------------------------  def item_effect(item, user)    # Clear critical flag    self.critical = false    # If item scope is for ally with 1 or more HP, and your own HP = 0,    # or item scope is for ally with 0 HP, and your own HP = 1 or more    if ((item.scope == 3 or item.scope == 4) and self.hp == 0) or       ((item.scope == 5 or item.scope == 6) and self.hp >= 1)      # End Method      return false    end    # Clear effective flag    effective = false    # Set effective flag if common ID is effective    effective |= item.common_event_id > 0    # Determine hit    hit_result = (rand(100) < item.hit)    # Set effective flag is skill is uncertain    effective |= item.hit < 100    # If hit occurs    if hit_result == true      # Calculate amount of recovery      recover_hp = maxhp * item.recover_hp_rate / 100 + item.recover_hp      recover_sp = maxsp * item.recover_sp_rate / 100 + item.recover_sp      if recover_hp < 0        recover_hp += self.pdef * item.pdef_f / 20        recover_hp += self.mdef * item.mdef_f / 20        recover_hp = [recover_hp, 0].min      end      # Element correction      recover_hp *= elements_correct(item.element_set)      recover_hp /= 100      recover_sp *= elements_correct(item.element_set)      recover_sp /= 100      # Dispersion      if item.variance > 0 and recover_hp.abs > 0        amp = [recover_hp.abs * item.variance / 100, 1].max        recover_hp += rand(amp+1) + rand(amp+1) - amp      end      if item.variance > 0 and recover_sp.abs > 0        amp = [recover_sp.abs * item.variance / 100, 1].max        recover_sp += rand(amp+1) + rand(amp+1) - amp      end      # If recovery code is negative      if recover_hp < 0        # Guard correction        if self.guarding?          recover_hp /= 2        end      end      # Set damage value and reverse HP recovery amount       # HP and SP recovery      last_hp = self.hp      last_sp = self.sp       #se licenza medica è attiva raddoppia gli effetti delle medicineif user.skill_learn?(LICENZA_MEDICA)   recover_hp *= 2 if recover_hp > 0   recover_sp *= 2 if recover_sp > 0  end self.damage = -recover_hp      self.hp += recover_hp      self.sp += recover_sp      effective |= self.hp != last_hp      effective |= self.sp != last_sp      # State change      @state_changed = false      @protezione = false      effective |= states_plus(item.plus_state_set)      effective |= states_minus(item.minus_state_set)      # If parameter value increase is effective      if item.parameter_type > 0 and item.parameter_points != 0        # Branch by parameter        case item.parameter_type        when 1  # Max HP          @maxhp_plus += item.parameter_points        when 2  # Max SP          @maxsp_plus += item.parameter_points        when 3  # Strength          @str_plus += item.parameter_points        when 4  # Dexterity          @dex_plus += item.parameter_points        when 5  # Agility          @agi_plus += item.parameter_points        when 6  # Intelligence          @int_plus += item.parameter_points        end        # Set to effective flag        effective = true      end      # If HP recovery rate and recovery amount are 0      if item.recover_hp_rate == 0 and item.recover_hp == 0        # Set damage to empty string        self.damage = ""        # If SP recovery rate / recovery amount are 0, and parameter increase        # value is ineffective.        if item.recover_sp_rate == 0 and item.recover_sp == 0 and           (item.parameter_type == 0 or item.parameter_points == 0)          # If state is unchanged          unless @state_changed            # Set damage to "Miss"            self.damage = "Mancato!"          end        end      end    # If miss occurs    else      # Set damage to "Miss"      self.damage = "Mancato!"    end    # If not in battle    unless $game_temp.in_battle      # Set damage to nil      self.damage = nil    end    # End Method     self.damage = "Guardia!" if @protezione    return effective  endend  #==============================================================================# ** Game_Enemy#------------------------------------------------------------------------------#  This class handles enemies. It's used within the Game_Troop class#  ($game_troop).#============================================================================== class Game_Enemy < Game_Battler  attr_accessor :contrattacco   attr_accessor :random   attr_accessor :occhio  #--------------------------------------------------------------------------  # * Object Initialization  #     troop_id     : troop ID  #     member_index : troop member index  #--------------------------------------------------------------------------  def initialize(troop_id, member_index)    super()    @troop_id = troop_id    @member_index = member_index    troop = $data_troops[@troop_id]    @enemy_id = troop.members[@member_index].enemy_id    enemy = $data_enemies[@enemy_id]    @battler_name = enemy.battler_name    @battler_hue = enemy.battler_hue    @hp = maxhp    @sp = maxsp    @hidden = troop.members[@member_index].hidden    @immortal = troop.members[@member_index].immortal    @contrattacco = false    @random = false    @occhio = false  endend  #==============================================================================# ** Game_Actor#------------------------------------------------------------------------------#  This class handles the actor. It's used within the Game_Actors class#  ($game_actors) and refers to the Game_Party class ($game_party).#============================================================================== class Game_Actor < Game_Battler  #--------------------------------------------------------------------------  # * Public Instance Variables  #--------------------------------------------------------------------------  attr_reader   :name                     # name  attr_reader   :character_name           # character file name  attr_reader   :character_hue            # character hue  attr_reader   :class_id                 # class ID  attr_reader   :weapon_id                # weapon ID  attr_reader   :armor1_id                # shield ID  attr_reader   :armor2_id                # helmet ID  attr_reader   :armor3_id                # body armor ID  attr_reader   :armor4_id                # accessory ID  attr_reader   :level                    # level  attr_reader   :exp                      # EXP  attr_reader   :skills                   # skills  attr_accessor :passive  attr_accessor :pietre  attr_accessor :pietre_usate  attr_accessor :pietre_disp  attr_accessor :contrattacco  attr_accessor :random  attr_accessor :occhio  attr_accessor :danno  attr_accessor :pozione  attr_accessor :megapozione  attr_accessor :contramagia  attr_accessor :danno_magia  attr_accessor :sinergia  #--------------------------------------------------------------------------  # * Object Initialization  #     actor_id : actor ID  #--------------------------------------------------------------------------  def initialize(actor_id)    super()    setup(actor_id)  end  #--------------------------------------------------------------------------  # * Setup  #     actor_id : actor ID  #--------------------------------------------------------------------------  def setup(actor_id)    @danno = false    @occhio = false    @random = false    @pozione = false    @megapozione = false    @contramagia = false    @danno_magia = false    @sinergia = false    @pietre = Pietre::PIETRE_INIZIALI[actor_id]    @pietre_usate = 0    @pietre_disp = @pietre - @pietre_usate    @contrattacco = false    @passive = []    actor = $data_actors[actor_id]    @actor_id = actor_id    @name = actor.name    @character_name = actor.character_name    @character_hue = actor.character_hue    @battler_name = actor.battler_name    @battler_hue = actor.battler_hue    @class_id = actor.class_id    @weapon_id = actor.weapon_id    @armor1_id = actor.armor1_id    @armor2_id = actor.armor2_id    @armor3_id = actor.armor3_id    @armor4_id = actor.armor4_id    @level = actor.initial_level    @exp_list = Array.new(101)    make_exp_list    @exp = @exp_list[@level]    @skills = []    @hp = maxhp    @sp = maxsp    @states = []    @states_turn = {}    @maxhp_plus = 0    @maxsp_plus = 0    @str_plus = 0    @dex_plus = 0    @agi_plus = 0    @int_plus = 0    # Learn skill    for i in 1..@level      for j in $data_classes[@class_id].learnings        if j.level == i          unless SKILL_PASSIVE.include?(j.skill_id)          learn_skill(j.skill_id)        else          self.passive.push(j.skill_id)          end        end      end    end    # Update auto state    update_auto_state(nil, $data_armors[@armor1_id])    update_auto_state(nil, $data_armors[@armor2_id])    update_auto_state(nil, $data_armors[@armor3_id])    update_auto_state(nil, $data_armors[@armor4_id])  end  #--------------------------------------------------------------------------  # * Get Normal Attack Element  #--------------------------------------------------------------------------  def element_set    for skill in $data_skills       if ELMNT.include?(skill.id) and skill_learn?(skill.id)         return skill != nil ? skill.element_set : []       end     end      weapon = $data_weapons[@weapon_id]    return weapon != nil ? weapon.element_set : []  end   #--------------------status-------------  def plus_state_set    weapon = $data_weapons[@weapon_id]    if self.sinergia    return weapon != nil ? weapon.plus_state_set : []  else    return []    end  end   #--------------------------------------------------------------------------  # * Get Maximum HP  #--------------------------------------------------------------------------  def maxhp    n = [[base_maxhp + @maxhp_plus, 1].max, 9999].min    for i in @states      n *= $data_states[i].maxhp_rate / 100.0    end     for skill in $data_skills       if skill_learn?(skill.id)      n += (base_maxhp*10)/100 if skill.id == HP_10      n += (base_maxhp*20)/100 if skill.id == HP_20      n += (base_maxhp*30)/100 if skill.id == HP_30      n += (base_maxhp*40)/100 if skill.id == HP_40      end      end    n = [[Integer(n), 1].max, 9999].min    return n  end   def maxsp    n = [[base_maxsp + @maxsp_plus, 0].max, 9999].min    for i in @states      n *= $data_states[i].maxsp_rate / 100.0    end    for skill in $data_skills       if skill_learn?(skill.id)      n += (base_maxsp*10)/100 if skill.id == SP_10      n += (base_maxsp*20)/100 if skill.id == SP_20      n += (base_maxsp*30)/100 if skill.id == SP_30      n += (base_maxsp*40)/100 if skill.id == SP_40      end      end    n = [[Integer(n), 0].max, 9999].min    return n  end  #--------------------------------------------------------------------------  # * Get Basic Dexterity  #--------------------------------------------------------------------------  def base_dex    n = $data_actors[@actor_id].parameters[3, @level]    weapon = $data_weapons[@weapon_id]    armor1 = $data_armors[@armor1_id]    armor2 = $data_armors[@armor2_id]    armor3 = $data_armors[@armor3_id]    armor4 = $data_armors[@armor4_id]      if self.skill_learn?(WILHELM_TELL)     n += (n* WILHELM_TELL_FATTORE)/100     end    n += weapon != nil ? weapon.dex_plus : 0    n += armor1 != nil ? armor1.dex_plus : 0    n += armor2 != nil ? armor2.dex_plus : 0    n += armor3 != nil ? armor3.dex_plus : 0    n += armor4 != nil ? armor4.dex_plus : 0    return [[n, 1].max, 999].min  end  #--------------------------------------------------------------------------  # * Change EXP  #     exp : new EXP  #--------------------------------------------------------------------------  def exp=(exp)    @exp = [[exp, 9999999].min, 0].max    # Level up    while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0      @level += 1           if PIETRE_LV.include?(@level)            self.pietre += N_PIETRE            if ARMATURA_PIETRE.include?(@armor1_id) or ARMATURA_PIETRE.include?(@armor2_id) or ARMATURA_PIETRE.include?(@armor3_id) or ARMATURA_PIETRE.include?(@armor4_id)            self.pietre += N_PIETRE          end            end      # Learn skill      for j in $data_classes[@class_id].learnings        if j.level == @level          unless SKILL_PASSIVE.include?(j.skill_id)          learn_skill(j.skill_id)        else          self.passive.push(j.skill_id)          end        end      end    end    # Level down    while @exp < @exp_list[@level]      @level -= 1      if PIETRE_LV.include?(@level)            self.pietre -= N_PIETRE      end    end    # Correction if exceeding current max HP and max SP    @hp = [@hp, self.maxhp].min    @sp = [@sp, self.maxsp].min  endend  #==============================================================================# ** Scene_Skill#------------------------------------------------------------------------------#  This class performs skill screen processing.#============================================================================== class Scene_Passiva  #--------------------------------------------------------------------------  # * Object Initialization  #     actor_index : actor index  #--------------------------------------------------------------------------  def initialize(actor_index = 0, equip_index = 0)    @actor_index = actor_index  end  #--------------------------------------------------------------------------  # * Main Processing  #--------------------------------------------------------------------------  def main    # Get actor    @actor = $game_party.actors[@actor_index]    # Make help window, status window, and skill window    @help_window = Window_Help.new    @status_window = Window_Passive_Status.new(@actor)    @skill_window = Window_Pass.new(@actor)#Skill.new(@actor)    # Associate help window    @skill_window.help_window = @help_window    # Make target window (set to invisible / inactive)    # Execute transition    Graphics.transition    # Main loop    loop do      # Update game screen      Graphics.update      # Update input information      Input.update      # Frame update      update      # Abort loop if screen is changed      if $scene != self        break      end    end    # Prepare for transition    Graphics.freeze    # Dispose of windows    @help_window.dispose    @status_window.dispose    @skill_window.dispose  end  #--------------------------------------------------------------------------  # * Frame Update  #--------------------------------------------------------------------------  def update    # Update windows    @help_window.update    @status_window.update    @skill_window.update    # If skill window is active: call update_skill    if @skill_window.active      update_skill      return    end    # If skill target is active: call update_target  end  #--------------------------------------------------------------------------  # * Frame Update (if skill window is active)  #--------------------------------------------------------------------------  def update_skill    # If B button was pressed    if Input.trigger?(Input::B)      # Play cancel SE      $game_system.se_play($data_system.cancel_se)      # Switch to menu screen      $scene = Scene_Menu.new(1)      return    end    # If C button was pressed    if Input.trigger?(Input::C)      actor = $game_party.actors[@actor_index]      @actor.pietre_disp = @actor.pietre - @actor.pietre_usate      # Get currently selected data on the skill window      @skill = @skill_window.skill      # If unable to use      if @skill == nil        # Play buzzer SE        $game_system.se_play($data_system.buzzer_se)        return      end      # Play decision SE        # If effect scope is ally     if actor.skill_learn?(@skill.id)       $game_system.se_play($data_system.decision_se)        actor.forget_skill(@skill.id)       # @actor.pietre_disp =+ @skill.sp_cost      @actor.pietre_usate -= @skill.sp_cost     @actor.contramagia = false if @skill.id == CONTRAMAGIA #contramagia        if @skill.id == CONTRATTACCO #disabilita occhi per occhi se contrattacco = false        occhi = $data_skills[OCCHI_X_OCCHI]        @actor.pietre_usate -= occhi.sp_cost if @actor.occhio      @actor.contrattacco = false      @actor.occhio = false       actor.forget_skill(OCCHI_X_OCCHI)       end    @actor.occhio = false if @skill.id == OCCHI_X_OCCHI #occhi per occhi    @actor.sinergia = false if @skill.id == SINERGIA #sinergia      @actor.pietre_disp = @actor.pietre - @actor.pietre_usate    elsif not actor.skill_learn?(@skill.id)        if @actor.pietre_disp >= @skill.sp_cost       # @actor.pietre_disp =- @skill.sp_cost      @actor.contrattacco = true if @skill.id == CONTRATTACCO # contrattacco      if @skill.id == OCCHI_X_OCCHI #abilita solo se contrattacco = true        if @actor.contrattacco        @actor.occhio = true      else        $game_system.se_play($data_system.buzzer_se)        return      end    end    @actor.contramagia = true if @skill.id == CONTRAMAGIA    @actor.sinergia = true if @skill.id == SINERGIA    $game_system.se_play($data_system.decision_se)      @actor.pietre_usate += @skill.sp_cost      @actor.pietre_disp = @actor.pietre - @actor.pietre_usate        actor.learn_skill(@skill.id)      else        $game_system.se_play($data_system.buzzer_se)        return        end      end        @status_window.refresh     @skill_window.refresh     end    # If R button was pressed    if Input.trigger?(Input::R)      # Play cursor SE      $game_system.se_play($data_system.cursor_se)      # To next actor      @actor_index += 1      @actor_index %= $game_party.actors.size      # Switch to different skill screen      $scene = Scene_Passiva.new(@actor_index)      return    end    # If L button was pressed    if Input.trigger?(Input::L)      # Play cursor SE      $game_system.se_play($data_system.cursor_se)      # To previous actor      @actor_index += $game_party.actors.size - 1      @actor_index %= $game_party.actors.size      # Switch to different skill screen      $scene = Scene_Passiva.new(@actor_index)      return    end  endend  #==============================================================================# ** Window_Base#------------------------------------------------------------------------------#  This class is for all in-game windows.#============================================================================== class Window_Base < Window  #--------------------------------------------------------------------------  # * Object Initialization  #     x      : window x-coordinate  #     y      : window y-coordinate  #     width  : window width  #     height : window height  #--------------------------------------------------------------------------   #--------------------------------------------------------------------------  # * Draw Name  #     actor : actor  #     x     : draw spot x-coordinate  #     y     : draw spot y-coordinate  #--------------------------------------------------------------------------  def draw_actor_pietre(actor, x, y, width = 144)    # Draw "SP" text string    # Calculate if there is draw space for MaxHP    # Draw SP     rect = Rect.new(x, y, 144, 32)    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))    bitmap = RPG::Cache.icon(PIETRA_ATTIVA)    opacity = self.contents.font.color == normal_color ? 255 : 128    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)    self.contents.draw_text(x+20, y, 48, 32, actor.pietre_usate.to_s, 2)    # Draw MaxSP      self.contents.draw_text(x+ 68, y, 12, 32, "/", 1)      self.contents.draw_text(x + 80, y, 48, 32, actor.pietre.to_s)  end  #--------------------------------------------------------------------------  # * Draw Class  #     actor : actor  #     x     : draw spot x-coordinate  #     y     : draw spot y-coordinate  #--------------------------------------------------------------------------end  #==============================================================================# ** Window_MenuStatus#------------------------------------------------------------------------------#  This window displays party member status on the menu screen.#============================================================================== class Window_MenuStatus < Window_Selectable  #--------------------------------------------------------------------------  # * Object Initialization  #--------------------------------------------------------------------------  def initialize    super(0, 0, 480, 480)    self.contents = Bitmap.new(width - 32, height - 32)    refresh    self.active = false    self.index = -1  end  #--------------------------------------------------------------------------  # * Refresh  #--------------------------------------------------------------------------  def refresh    self.contents.clear    @item_max = $game_party.actors.size    for i in 0...$game_party.actors.size      x = 64      y = i * 116      actor = $game_party.actors[i]      draw_actor_graphic(actor, x - 40, y + 80)      draw_actor_name(actor, x, y)      draw_actor_class(actor, x + 144, y)      draw_actor_level(actor, x, y + 32)      draw_actor_state(actor, x + 90, y + 32)      draw_actor_exp(actor, x, y + 64)      draw_actor_hp(actor, x + 236, y + 32)      draw_actor_sp(actor, x + 236, y + 64)      draw_actor_pietre(actor, x+ 236, y)    end  end  #--------------------------------------------------------------------------  # * Cursor Rectangle Update  #--------------------------------------------------------------------------  def update_cursor_rect    if @index < 0      self.cursor_rect.empty    else      self.cursor_rect.set(0, @index * 116, self.width - 32, 96)    end  endend  #==============================================================================# ** Window_SkillStatus#------------------------------------------------------------------------------#  This window displays the skill user's status on the skill screen.#============================================================================== class Window_Passive_Status < Window_Base  #--------------------------------------------------------------------------  # * Object Initialization  #     actor : actor  #--------------------------------------------------------------------------  def initialize(actor)    super(0, 64, 640, 64)    self.contents = Bitmap.new(width - 32, height - 32)    @actor = actor    refresh  end  #--------------------------------------------------------------------------  # * Refresh  #--------------------------------------------------------------------------  def refresh    self.contents.clear    draw_actor_name(@actor, 4, 0)    draw_actor_hp(@actor, 140, 0)    draw_actor_sp(@actor, 284, 0)    draw_actor_pietre(@actor, 460, 0)  endend  #==============================================================================# ** Scene_Battle (part 1)#------------------------------------------------------------------------------#  This class performs battle screen processing.#============================================================================== class Scene_Battle  #--------------------------------------------------------------------------  # * Main Processing  #--------------------------------------------------------------------------  def main    # Initialize each kind of temporary battle data    $game_temp.in_battle = true    $game_temp.battle_turn = 0    $game_temp.battle_event_flags.clear    $game_temp.battle_abort = false    $game_temp.battle_main_phase = false    $game_temp.battleback_name = $game_map.battleback_name    $game_temp.forcing_battler = nil    # Initialize battle event interpreter    $game_system.battle_interpreter.setup(nil, 0)    # Prepare troop    @troop_id = $game_temp.battle_troop_id    $game_troop.setup(@troop_id)    # Make actor command window    for actor in $game_party.actors     for skill in $data_skills       if skill.id == AUTO_PROTECT and actor.skill_learn?(skill.id)         actor.add_state(PROTECT_STATE_ID, true)        elsif skill.id == AUTO_SHELL and actor.skill_learn?(skill.id)         actor.add_state(SHELL_STATE_ID, true)      elsif skill.id == PROVVIDENZA and actor.skill_learn?(skill.id)         actor.add_state(RISVEGLIO_STATE_ID, true)     elsif skill.id == AUTO_RIGENE and actor.skill_learn?(skill.id)         actor.add_state(RIGENE_STATE_ID, true)         elsif skill.id == AUTO_LEVITA and actor.skill_learn?(skill.id)         actor.add_state(LEVITA_STATE_ID, true)       elsif skill.id == AUTO_REFLEX and actor.skill_learn?(skill.id)         actor.add_state(REFLEX_STATE_ID, true)          elsif skill.id == AUTO_HASTE and actor.skill_learn?(skill.id)         actor.add_state(HASTE_STATE_ID, true)             end     end   end   $fase = false   $fase_4_2 = false   $fase_5_2 = false   $contra = false    s1 = $data_system.words.attack    s2 = $data_system.words.skill    s3 = $data_system.words.guard    s4 = $data_system.words.item    @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])    @actor_command_window.y = 160    @actor_command_window.back_opacity = 160    @actor_command_window.active = false    @actor_command_window.visible = false    # Make other windows    @party_command_window = Window_PartyCommand.new    @help_window = Window_Help.new    @help_window.back_opacity = 160    @help_window.visible = false    @status_window = Window_BattleStatus.new    @message_window = Window_Message.new    # Make sprite set    @spriteset = Spriteset_Battle.new    # Initialize wait count    @wait_count = 0    # Execute transition    if $data_system.battle_transition == ""      Graphics.transition(20)    else      Graphics.transition(40, "Graphics/Transitions/" +        $data_system.battle_transition)    end    # Start pre-battle phase    start_phase1    # Main loop    loop do      # Update game screen      Graphics.update      # Update input information      Input.update      # Frame update      update      # Abort loop if screen is changed      if $scene != self        break      end    end    # Refresh map    $game_map.refresh    # Prepare for transition    Graphics.freeze    # Dispose of windows    @actor_command_window.dispose    @party_command_window.dispose    @help_window.dispose    @status_window.dispose    @message_window.dispose    if @skill_window != nil      @skill_window.dispose    end    if @item_window != nil      @item_window.dispose    end    if @result_window != nil      @result_window.dispose    end    # Dispose of sprite set    @spriteset.dispose    # If switching to title screen    if $scene.is_a?(Scene_Title)      # Fade out screen      Graphics.transition      Graphics.freeze    end    # If switching from battle test to any screen other than game over screen    if $BTEST and not $scene.is_a?(Scene_Gameover)      $scene = nil    end  end   #--------------------------------------------------------------------------  # * Determine Battle Win/Loss Results  #--------------------------------------------------------------------------  def judge    # If all dead determinant is true, or number of members in party is 0    if $game_party.all_dead? or $game_party.actors.size == 0      # If possible to lose      if $game_temp.battle_can_lose        # Return to BGM before battle starts        $game_system.bgm_play($game_temp.map_bgm)        # Battle ends        battle_end(2)        # Return true        return true      end      # Set game over flag      $game_temp.gameover = true      # Return true      return true    end    # Return false if even 1 enemy exists    for enemy in $game_troop.enemies      if enemy.exist?        return false      end    end    # Start after battle phase (win)    start_phase5    # Return true    return true  end  #--------------------------------------------------------------------------  # * Battle Ends  #     result : results (0:win 1:lose 2:escape)  #--------------------------------------------------------------------------  def battle_end(result)    # Clear in battle flag    $game_temp.in_battle = false    # Clear entire party actions flag    $game_party.clear_actions    # Remove battle states    for actor in $game_party.actors      actor.remove_states_battle    end    # Clear enemies    $game_troop.enemies.clear    # Call battle callback    if $game_temp.battle_proc != nil      $game_temp.battle_proc.call(result)      $game_temp.battle_proc = nil    end    for actor in $game_party.actors      for skill in $data_skills       if skill.id == AUTO_PROTECT and actor.skill_learn?(skill.id)         actor.remove_state(PROTECT_STATE_ID, true)       elsif skill.id == AUTO_SHELL and actor.skill_learn?(skill.id)         actor.remove_state(SHELL_STATE_ID, true)       elsif skill.id == PROVVIDENZA and actor.skill_learn?(skill.id)         actor.remove_state(RISVEGLIO_STATE_ID, true)      elsif skill.id == AUTO_RIGENE and actor.skill_learn?(skill.id)         actor.remove_state(RIGENE_STATE_ID, true)        elsif skill.id == AUTO_LEVITA and actor.skill_learn?(skill.id)         actor.remove_state(LEVITA_STATE_ID, true)            elsif skill.id == AUTO_REFLEX and actor.skill_learn?(skill.id)         actor.remove_state(REFLEX_STATE_ID, true)          elsif skill.id == AUTO_HASTE and actor.skill_learn?(skill.id)         actor.remove_state(HASTE_STATE_ID, true)             end     end     end    # Switch to map screen    $scene = Scene_Map.new  end     #--------------------------------------------------------------------------  # * Start After Battle Phase  #--------------------------------------------------------------------------  def start_phase5    # Shift to phase 5    @phase = 5    # Play battle end ME    $game_system.me_play($game_system.battle_end_me)    # Return to BGM before battle started    $game_system.bgm_play($game_temp.map_bgm)    # Initialize EXP, amount of gold, and treasure    exp = 0    gold = 0    treasures = []    # Loop    for enemy in $game_troop.enemies      # If enemy is not hidden      unless enemy.hidden        # Add EXP and amount of gold obtained        exp += enemy.exp        gold += enemy.gold        # Determine if treasure appears        if rand(100) < enemy.treasure_prob          if enemy.item_id > 0            treasures.push($data_items[enemy.item_id])          end          if enemy.weapon_id > 0            treasures.push($data_weapons[enemy.weapon_id])          end          if enemy.armor_id > 0            treasures.push($data_armors[enemy.armor_id])          end        end      end    end    # Treasure is limited to a maximum of 6 items    treasures = treasures[0..5]    # Obtaining EXP    for i in 0...$game_party.actors.size      actor = $game_party.actors[i]      if actor.cant_get_exp? == false        last_level = actor.level        actor.exp += exp        if actor.level > last_level          @status_window.level_up(i)        end      end    end    for actor in $game_party.actors      for skill in $data_skills       if skill.id == LEVEL_UP and actor.skill_learn?(skill.id)         actor.exp += (exp * LEVEL_UP_FATTORE).to_i         actor.exp -= exp       end     end     end    # Obtaining gold    $game_party.gain_gold(gold)    # Obtaining treasure    for item in treasures      case item      when RPG::Item        $game_party.gain_item(item.id, 1)      when RPG::Weapon        $game_party.gain_weapon(item.id, 1)      when RPG::Armor        $game_party.gain_armor(item.id, 1)      end    end    # Make battle result window    @result_window = Window_BattleResult.new(exp, gold, treasures)    # Set wait count    @phase5_wait_count = 100  endend  #==============================================================================# ** Scene_Battle (part 4)#------------------------------------------------------------------------------#  This class performs battle screen processing.#============================================================================== class Scene_Battle   #--------------------------------------------------------------------------  # * Frame Update (main phase)  #--------------------------------------------------------------------------  def update_phase4    case @phase4_step    when 1      update_phase4_step1    when 2      update_phase4_step2    when 3      update_phase4_step3    when 4      update_phase4_step4    when 4.1      update_phase4_step4_2    when 4.2      update_phase4_step4_3        when 5      update_phase4_step5    when 5.1      update_phase4_step5_2      when 5.2      update_phase4_step5_3      when 6      update_phase4_step6    when 7      update_phase4_step7    when 8      update_phase4_step8      when 9      update_phase4_step9    when 10      update_phase4_step10    when 11      update_phase4_step11      end  end  #--------------------------------------------------------------------------  # * Frame Update (main phase step 1 : action preparation)  #--------------------------------------------------------------------------  def update_phase4_step1    # Hide help window    @help_window.visible = false    # Determine win/loss    if judge      # If won, or if lost : end method      return    end    # If an action forcing battler doesn't exist    if $game_temp.forcing_battler == nil      # Set up battle event      setup_battle_event      # If battle event is running      if $game_system.battle_interpreter.running?        return      end    end    # If an action forcing battler exists    if $game_temp.forcing_battler != nil      # Add to head, or move      @action_battlers.delete($game_temp.forcing_battler)      @action_battlers.unshift($game_temp.forcing_battler)    end    # If no actionless battlers exist (all have performed an action)    if @action_battlers.size == 0      # Start party command phase      for actor in $game_party.actors        #se rigene è attivo recupera un 30esimo di vita     if actor.states.include?(RIGENE_STATE_ID) and actor.hp < actor.maxhp       #actor.animation_id = 15        actor.damage_pop = true        actor.damage = - actor.maxhp/RIGENE_FATTORE      actor.hp += actor.maxhp/RIGENE_FATTORE      @status_window.refresh    end    end      start_phase2      return    end    # Initialize animation ID and common event ID    @animation1_id = 0    @animation2_id = 0    @common_event_id = 0    # Shift from head of actionless battlers    @active_battler = @action_battlers.shift    # If already removed from battle    if @active_battler.index == nil      return    end    # Slip damage    if @active_battler.hp > 0 and @active_battler.slip_damage?      @active_battler.slip_damage_effect      @active_battler.damage_pop = true    end    # Natural removal of states    @active_battler.remove_states_auto    # Refresh status window    @status_window.refresh    # Shift to step 2    @phase4_step = 2  end  #--------------------------------------------------------------------------  # * Frame Update (main phase step 2 : start action)  #--------------------------------------------------------------------------  def update_phase4_step2    # If not a forcing action    unless @active_battler.current_action.forcing      # If restriction is [normal attack enemy] or [normal attack ally]      if @active_battler.restriction == 2 or @active_battler.restriction == 3        # Set attack as an action        @active_battler.current_action.kind = 0        @active_battler.current_action.basic = 0      end      # If restriction is [cannot perform action]      if @active_battler.restriction == 4        # Clear battler being forced into action        $game_temp.forcing_battler = nil        # Shift to step 1        @phase4_step = 1        return      end    end    # Clear target battlers    @target_battlers = []    @target_rimasti = []    @target_reflex = []    # Branch according to each action    case @active_battler.current_action.kind    when 0  # basic      make_basic_action_result    when 1  # skill      make_skill_action_result    when 2  # item      make_item_action_result    end    # Shift to step 3    if @phase4_step == 2      @phase4_step = 3    end  end  #--------------------------------------------------------------------------  # * Make Basic Action Results  #--------------------------------------------------------------------------  def make_basic_action_result    # If attack    if @active_battler.current_action.basic == 0      # Set anaimation ID      @help_window.set_text(@active_battler.name + " attacca!",1)      @animation1_id = @active_battler.animation1_id      @animation2_id = @active_battler.animation2_id      # If action battler is enemy      if @active_battler.is_a?(Game_Enemy)        if @active_battler.restriction == 3          target = $game_troop.random_target_enemy        elsif @active_battler.restriction == 2          target = $game_party.random_target_actor        else          index = @active_battler.current_action.target_index          target = $game_party.smooth_target_actor(index)        end      end      # If action battler is actor      if @active_battler.is_a?(Game_Actor)        if @active_battler.restriction == 3          target = $game_party.random_target_actor        elsif @active_battler.restriction == 2          target = $game_troop.random_target_enemy        else          index = @active_battler.current_action.target_index          target = $game_troop.smooth_target_enemy(index)        end      end      # Set array of targeted battlers      @target_battlers = [target]      # Apply normal attack results      for target in @target_battlers        target.attack_effect(@active_battler)      end       return unless target.contrattacco    end    # If guard    if @active_battler.current_action.basic == 1      # Display "Guard" in help window      @help_window.set_text($data_system.words.guard, 1)      return    end    # If escape    if @active_battler.is_a?(Game_Enemy) and       @active_battler.current_action.basic == 2      # Display "Escape" in help window      @help_window.set_text("Escape", 1)      # Escape      @active_battler.escape      return    end    # If doing nothing    if @active_battler.current_action.basic == 3      # Clear battler being forced into action      $game_temp.forcing_battler = nil      # Shift to step 1      @phase4_step = 1      return    end  end  #--------------------------------------------------------------------------  # * Make Skill Action Results  #--------------------------------------------------------------------------  def make_skill_action_result    # Get skill    @skill = $data_skills[@active_battler.current_action.skill_id]    # If not a forcing action    unless @active_battler.current_action.forcing      # If unable to use due to SP running out      unless @active_battler.skill_can_use?(@skill.id)        # Clear battler being forced into action        $game_temp.forcing_battler = nil        # Shift to step 1        @phase4_step = 1        return      end    end    # Use up SP    if @active_battler.is_a?(Game_Actor)    if @active_battler.skill_learn?(MP_DIMEZZA) #dimezza il costo se Salva 50% Mp      @active_battler.sp -= @skill.sp_cost / 2      elsif  @active_battler.skill_learn?(MP_1) #riduce a 1 il consumo    @active_battler.sp -= 1  else    @active_battler.sp -= @skill.sp_cost    end  end    # Refresh status window    @status_window.refresh    # Show skill name on help window    @help_window.set_text(@skill.name, 1)    # Set animation ID    @animation1_id = @skill.animation1_id    @animation2_id = @skill.animation2_id    # Set command event ID    @common_event_id = @skill.common_event_id    # Set target battlers    set_target_battlers(@skill.scope)    # Apply skill effect    for target in @target_battlers      @target_rimasti.push(target)      end        for target in @target_battlers      #se reflex il bersaglio diventa il nemico che ha lanciato la magia      if target.is_a?(Game_Actor) and target.skill_learn?(AUTO_REFLEX) and REFLEX_SKILL.include?(@skill.id)        if @skill.scope == 1           @target_reflex.push(@active_battler)            @target_battlers.delete(target)          end        if @skill.scope == 2          for actor in $game_party.actors            @target_battlers.delete(actor) if actor.skill_learn?(AUTO_REFLEX) and REFLEX_SKILL.include?(@skill.id)            end            for enemy in $game_troop.enemies        @target_reflex.push(enemy)      end    end    if @skill.scope == 3      num = rand($game_troop.enemies.size)      @target_reflex.push($game_troop.enemies[num])    end       end      end    for target in @target_battlers      target.skill_effect(@active_battler, @skill)    end   end    def make_item_action_result    # Get item    @item = $data_items[@active_battler.current_action.item_id]    # If unable to use due to items running out    unless $game_party.item_can_use?(@item.id)      # Shift to step 1      @phase4_step = 1      return    end    # If consumable    if @item.consumable      # Decrease used item by 1      $game_party.lose_item(@item.id, 1)    end    # Display item name on help window    @help_window.set_text(@item.name, 1)    # Set animation ID    @animation1_id = @item.animation1_id    @animation2_id = @item.animation2_id    # Set common event ID    @common_event_id = @item.common_event_id    # Decide on target    index = @active_battler.current_action.target_index    target = $game_party.smooth_target_actor(index)    # Set targeted battlers    set_target_battlers(@item.scope)    # Apply item effect    for target in @target_battlers      target.item_effect(@item, @active_battler)    end  end  #--------------------------------------------------------------------------  # * Frame Update (main phase step 3 : animation for action performer)  #--------------------------------------------------------------------------  def update_phase4_step3     # Animation for action performer (if ID is 0, then white flash)    if @animation1_id == 0      @active_battler.white_flash = true    else      @active_battler.animation_id = @animation1_id      @active_battler.animation_hit = true    end    for actor in @target_rimasti      #mostra l'animazione di reflex    if actor.is_a?(Game_Actor) and actor.skill_learn?(AUTO_REFLEX) and REFLEX_SKILL.include?(@skill.id)    $fase = true        actor.animation_id = REFLEX_ANIM        actor.damage = "Reflex"        actor.damage_pop = true      end      end    # Shift to step 4    @phase4_step = 4  end  #--------------------------------------------------------------------------  # * Frame Update (main phase step 4 : animation for target)  #--------------------------------------------------------------------------  def update_phase4_step4     # Animation for target    for target in @target_battlers      target.animation_id = @animation2_id      target.animation_hit = (target.damage != "Miss")    end    # Animation has at least 8 frames, regardless of its length    @wait_count = 8    # Shift to step 5    @phase4_step = 4.1 if @target_reflex.size != 0    @phase4_step = 5 unless @target_reflex.size != 0    @phase4_step = 5 if @target_reflex == nil  end  #----------------------------------------  def update_phase4_step4_2    # Animation for target    $fase_4_2 = true    for target in @target_battlers      target.damage_pop = true    end    @status_window.refresh    # Shift to step 5    @phase4_step = 4.2  end     def update_phase4_step4_3    for target in @target_reflex      target.animation_id = @animation2_id      target.animation_hit = (target.damage != "Miss")    end    @wait_count = 8    # Shift to step 5    @phase4_step = 5  end  #--------------------------------------------------------------------------  # * Frame Update (main phase step 5 : damage display)  #--------------------------------------------------------------------------  def update_phase4_step5    # Hide help window    @help_window.visible = false    # Refresh status window    # Display damage    for target in @target_reflex      target.skill_effect(@active_battler, @skill)      target.damage_pop = true    end    @status_window.refresh     for target in @target_battlers      if target.damage != nil         if target.is_a?(Game_Actor) and target.damage.is_a?(Numeric) and target.damage > 0           target.danno = true         end         if @active_battler.current_action.kind == 1         if target.is_a?(Game_Actor) and target.damage.is_a?(Numeric) and target.damage > 0 and CONTRAMAGIA_SKILL.include?(@skill.id)           target.danno_magia = true         end       end       unless $fase_4_2        target.damage_pop = true          if @active_battler.is_a?(Game_Actor) and @active_battler.skill_learn?(DOPPIO_COLPO)            $fase_5_2 = true           end         end      end      if @active_battler.is_a?(Game_Actor) and @active_battler.skill_learn?(ASSORBIRE) and @active_battler.current_action.kind == 0 and target.damage.is_a?(Numeric)        @active_battler.damage = -target.damage / ASSORBIRE_FATTORE        @danno = @active_battler.damage        if @danno < 0        @active_battler.hp -= @danno        @status_window.refresh        @active_battler.damage_pop = true        end      end      if @active_battler.is_a?(Game_Actor) and @active_battler.skill_learn?(ASSORBIRE_MP) and @active_battler.current_action.kind == 0 and target.damage.is_a?(Numeric)        @active_battler.damage = -target.damage / ASSORBIRE_FATTORE_MP        @danno = @active_battler.damage        if @danno < 0        @active_battler.sp -= @danno        @status_window.refresh        end      end    end    $fase_4_2 = false    # Shift to step 6    @phase4_step = 6 unless $fase_5_2    @phase4_step = 5.1 if $fase_5_2  end    #--------------------------------------------------------------------------  # * Frame Update (main phase step 5 : damage display)  #--------------------------------------------------------------------------  def update_phase4_step5_2    # Hide help window    @help_window.set_text(@active_battler.name + " colpisce ancora!",1) unless judge    # Refresh status window    # Display damage    for target in @target_battlers      target.animation_id = @animation2_id      target.animation_hit = (target.damage != "Miss")    end    @wait_count = 8    # Shift to step 6    $fase_5_2 = false    @phase4_step = 5.2  end   def update_phase4_step5_3    # Hide help window     # Refresh status window    # Display damage    for target in @target_battlers      target.attack_effect(@active_battler)      if target.damage != nil        target.damage_pop = true      end      if @active_battler.is_a?(Game_Actor) and @active_battler.skill_learn?(ASSORBIRE) and @active_battler.current_action.kind == 0 and target.damage.is_a?(Numeric)        @active_battler.damage = -target.damage / ASSORBIRE_FATTORE        @danno = @active_battler.damage        if @danno < 0        @active_battler.hp -= @danno        @status_window.refresh        @active_battler.damage_pop = true        end      end      if @active_battler.is_a?(Game_Actor) and @active_battler.skill_learn?(ASSORBIRE_MP) and @active_battler.current_action.kind == 0 and target.damage.is_a?(Numeric)        @active_battler.damage = -target.damage / ASSORBIRE_FATTORE_MP        @danno = @active_battler.damage        if @danno < 0        @active_battler.sp -= @danno        @status_window.refresh        end      end    end    @phase4_step = 6  end  #--------------------------------------------------------------------------  # * Frame Update (main phase step 6 : refresh)  #--------------------------------------------------------------------------  def update_phase4_step6       @help_window.visible = false      # Clear battler being forced into action    $game_temp.forcing_battler = nil    for target in @target_battlers    #  target.damage_pop_mp = true if target.damage_mp != nil      #probabilità di contrattacco      target.random = true if rand(100) > 60 and target.occhio == false      target.random = true if rand(100) > 30 and target.occhio      if CONTRAMAGIA_SKILL.include?(@skill.id) and target.is_a?(Game_Actor)      target.random = true if rand(100) > 50 and target.contramagia      end      #contrattacca se attaccato e se l'eroe non è addormentato     if target.is_a?(Game_Actor) and target.contrattacco and target.random and target.hp > 0 and @active_battler.current_action.kind == 0       unless target.states.include?(SONNO_STATE_ID)       @help_window.set_text("Contrattacco!",1)       $contra = true       target.white_flash = true       $fase = true     end   end   if target.is_a?(Game_Actor) and target.contramagia and target.random and target.hp > 0 and target.danno_magia #and CONTRAMAGIA_SKILL.include?(@skill.id)        unless target.states.include?(SONNO_STATE_ID)       @help_window.set_text("Contramagia!",1)       $contra = true       target.white_flash = true       $fase = true     end   end   end    # If common event ID is valid    @phase4_step = 7    unless $fase    @phase4_step = 8    end  end  def update_phase4_step7    for target in @target_battlers      #animazione contrattacco     if target.is_a?(Game_Actor) and target.contrattacco and target.random and target.hp > 0 and @active_battler.current_action.kind == 0       unless target.states.include?(SONNO_STATE_ID)            if target.weapon_id != nil              @active_battler.animation_hit = true            weapon = $data_weapons[target.weapon_id]           @active_battler.animation_id = weapon.animation2_id         end         end       end            if target.is_a?(Game_Actor) and target.contramagia and target.random and target.hp > 0 and target.danno_magia #and CONTRAMAGIA_SKILL.include?(@skill.id)        unless target.states.include?(SONNO_STATE_ID)            if target.weapon_id != nil              @active_battler.animation_hit = true            weapon = $data_weapons[target.weapon_id]           @active_battler.animation_id = weapon.animation2_id         end         end       end       end    @phase4_step = 8   end    def update_phase4_step8    for target in @target_battlers      #danno contrattacco     if target.is_a?(Game_Actor) and target.contrattacco and target.random and target.hp > 0 and @active_battler.current_action.kind == 0       unless target.states.include?(SONNO_STATE_ID)          @active_battler.attack_effect(target)           @active_battler.damage_pop = true           target.random = false         end       end       if target.is_a?(Game_Actor) and target.contramagia and target.random and target.hp > 0 and target.danno_magia #and CONTRAMAGIA_SKILL.include?(@skill.id)        unless target.states.include?(SONNO_STATE_ID)          @active_battler.attack_effect(target)           @active_battler.damage_pop = true           target.random = false         end         end     end     for actor in $game_party.actors       #Se auto-risveglio è attivo resuscita se KO        if actor.states.include?(RISVEGLIO_STATE_ID) and actor.states.include?(1)          actor.states.delete(1)          actor.damage = "Risveglio"          actor.damage_pop = true          actor.hp += actor.maxhp/4      actor.animation_id = RISVEGLIO_ANIM       actor.states.delete(RISVEGLIO_STATE_ID)    end  end  $fase = false@phase4_step = 9end def update_phase4_step9   for actor in $game_party.actors     #se attaccato usa una pozione    if actor.skill_learn?(AUTO_POZIONE) and $game_party.item_can_use?(POZIONE_ID) and actor.danno       unless $game_party.item_can_use?(MEGAPOZIONE_ID)      @help_window.set_text("Autopozione",1)      $fase = true      $game_party.gain_item(POZIONE_ID, -1)      actor.pozione = true      actor.animation_id = $data_items[POZIONE_ID].animation1_id    end  end    if actor.skill_learn?(AUTO_POZIONE) and actor.danno         if $game_party.item_can_use?(MEGAPOZIONE_ID)      @help_window.set_text("Autopozione",1)      $game_party.gain_item(MEGAPOZIONE_ID, -1)      $fase = true      actor.megapozione = true      actor.animation_id = $data_items[MEGAPOZIONE_ID].animation1_id     end  endend  @phase4_step = 10 if $fase  @phase4_step = 11 unless $faseend   def update_phase4_step10    #animazione autopozione   for actor in $game_party.actors    if actor.pozione and actor.danno       unless actor.megapozione      actor.animation_id = $data_items[POZIONE_ID].animation2_id    end  end    if actor.megapozione and actor.danno       actor.animation_id = $data_items[MEGAPOZIONE_ID].animation2_id    end  @status_window.refreshend@phase4_step = 11end def update_phase4_step11  #animazione autopozione   for actor in $game_party.actors    if actor.pozione and actor.danno       unless actor.megapozione      actor.hp += $data_items[POZIONE_ID].recover_hp       actor.damage = -$data_items[POZIONE_ID].recover_hp        actor.damage_pop = true    end  end    if actor.megapozione and actor.danno       actor.hp += $data_items[MEGAPOZIONE_ID].recover_hp       actor.damage = -$data_items[MEGAPOZIONE_ID].recover_hp        actor.damage_pop = true  end  @status_window.refresh  actor.danno = false  actor.pozione = false  actor.megapozione = false  actor.danno_magia = false  $contra = falseend      if @common_event_id > 0      # Set up event      common_event = $data_common_events[@common_event_id]      $game_system.battle_interpreter.setup(common_event.list, 0)    end    $fase = false    # Shift to step 1    @phase4_step = 1endend      #==============================================================================# ** Scene_Map#------------------------------------------------------------------------------#  This class performs map screen processing.#============================================================================== class Scene_Map  #--------------------------------------------------------------------------  # * Frame Update  #--------------------------------------------------------------------------  def update    # Loop    loop do      # Update map, interpreter, and player order      # (this update order is important for when conditions are fulfilled       # to run any event, and the player isn't provided the opportunity to      # move in an instant)      $game_map.update      $game_system.map_interpreter.update      $game_player.update      # Update system (timer), screen      $game_system.update      $game_screen.update      # Abort loop if player isn't place moving      unless $game_temp.player_transferring        break      end      # Run place move      transfer_player      # Abort loop if transition processing      if $game_temp.transition_processing        break      end    end    # Update sprite set    @spriteset.update    # Update message window    @message_window.update    # If game over    if $game_temp.gameover      # Switch to game over screen      $scene = Scene_Gameover.new      return    end    # If returning to title screen    if $game_temp.to_title      # Change to title screen      $scene = Scene_Title.new      return    end    # If transition processing    if $game_temp.transition_processing      # Clear transition processing flag      $game_temp.transition_processing = false      # Execute transition      if $game_temp.transition_name == ""        Graphics.transition(20)      else        Graphics.transition(40, "Graphics/Transitions/" +          $game_temp.transition_name)      end    end    # If showing message window    if $game_temp.message_window_showing      return    end    $incontri = false    # If encounter list isn't empty, and encounter count is 0    for actor in $game_party.actors      if actor.skill_learn?(INCONTRI_0)        $incontri = true      end      end    if $game_player.encounter_count == 0 and $game_map.encounter_list != [] and $incontri == false      # If event is running or encounter is not forbidden      unless $game_system.map_interpreter.running? or             $game_system.encounter_disabled        # Confirm troop        n = rand($game_map.encounter_list.size)        troop_id = $game_map.encounter_list[n]        # If troop is valid        if $data_troops[troop_id] != nil          # Set battle calling flag          $game_temp.battle_calling = true          $game_temp.battle_troop_id = troop_id          $game_temp.battle_can_escape = true          $game_temp.battle_can_lose = false          $game_temp.battle_proc = nil        end      end    end    # If B button was pressed    if Input.trigger?(Input::B)      # If event is running, or menu is not forbidden      unless $game_system.map_interpreter.running? or             $game_system.menu_disabled        # Set menu calling flag or beep flag        $game_temp.menu_calling = true        $game_temp.menu_beep = true      end    end    # If debug mode is ON and F9 key was pressed    if $DEBUG and Input.press?(Input::F9)      # Set debug calling flag      $game_temp.debug_calling = true    end    # If player is not moving    unless $game_player.moving?      # Run calling of each screen      if $game_temp.battle_calling        call_battle      elsif $game_temp.shop_calling        call_shop      elsif $game_temp.name_calling        call_name      elsif $game_temp.menu_calling        call_menu      elsif $game_temp.save_calling        call_save      elsif $game_temp.debug_calling        call_debug      end    end  endend



Demo Link


Versione aggiornata più compatibile
EDIT: aggiunte nuove abilità, migliorate le animazioni e risolti alcuni bug.
http://www.mediafire.com/download.php?uu57mz7gxff1r52

Screenshot


http://img844.imageshack.us/img844/756/screen1y.png
http://img836.imageshack.us/img836/5098/screen2g.png
http://img441.imageshack.us/img441/7594/screen3ou.png


Istruzioni per l'uso
Dovrebbero essere tutte all'interno della demo e dello script.
Per qualsiasi cosa rivolgetevi a me.

Bugs e Conflitti Noti
Se trovate qualche bugs, avvertitemi e aggiornerò lo script con i bug eliminati (se riesco XD)


Altri Dettagli

Per aggiungere altre abilità bisogna sapere un po' di RGSS quindi chiedetemi pure e farò quello che volete :D

Comunque sono state implementate molte abilità come ad esempio l'auto-risveglio, auto-reflex, auto-protect, auto.pozione, contrattacco e tante altre... vedrete tutto all'interno della demo :D

Se dovete inserire lo script nel menu e non sapete come fare chiedetemi e posterò una versione con il menu.

Edited by Valentino
Link to comment
Share on other sites

Interessante soprattutto per le abilità già implementate! :3

Bel lavoro! ^ ^

(\_/)
(^ ^) <----coniglietto rosso, me!
(> <)


Il mio Tumblr dove seguire i miei progetti, i progetti della Reverie : : Project ^ ^

http://i.imgur.com/KdUDtQt.png disponibile su Google Play, qui i dettagli! ^ ^

http://i.imgur.com/FwnGMI3.png completo! Giocabile online, qui i dettagli! ^ ^

REVERIE : : RENDEZVOUS (In allenamento per apprendere le buone arti prima di cominciarlo per bene ^ ^) Trovate i dettagli qui insieme alla mia intervista (non utilizzerò più rpgmaker) ^ ^

 

SUWOnzB.jpg 🖤
http://www.rpg2s.net/dax_games/r2s_regali2s.png E:3 http://www.rpg2s.net/dax_games/xmas/gifnatale123.gif
http://i.imgur.com/FfvHCGG.png by Testament (notare dettaglio in basso a destra)! E:3
http://i.imgur.com/MpaUphY.jpg by Idriu E:3

Membro Onorario, Ambasciatore dei Coniglietti (Membro n.44)

http://i.imgur.com/PgUqHPm.png
Ufficiale
"Ad opera della sua onestà e del suo completo appoggio alla causa dei Panda, Guardian Of Irael viene ufficialmente considerato un Membro portante del Partito, e Ambasciatore del suo Popolo presso di noi"


http://i.imgur.com/TbRr4iS.png<- Grazie Testament E:3
Ricorda...se rivolgi il tuo sguardo ^ ^ a Guardian anche Guardian volge il suo sguardo ^ ^ a te ^ ^
http://i.imgur.com/u8UJ4Vm.gifby Flame ^ ^
http://i.imgur.com/VbggEKS.gifhttp://i.imgur.com/2tJmjFJ.gifhttp://projectste.altervista.org/Our_Hero_adotta/ado2.png
Grazie Testament XD Fan n°1 ufficiale di PQ! :D

Viva
il Rhaxen! <- Folletto te lo avevo detto (fa pure rima) che non
avevo programmi di grafica per fare un banner su questo pc XD (ora ho di
nuovo il mio PC veramente :D)

Rosso Guardiano della
http://i.imgur.com/Os5rvhx.png

Rpg2s RPG BY FORUM:

Nome: Darth Reveal

 

PV totali 2
PA totali 16

Descrizione: ragazzo dai lunghi capelli rossi ed occhi dello stesso colore. Indossa una elegante giacca rossa sopra ad una maglietta nera. Porta pantaloni rossi larghi, una cintura nera e degli stivali dello stesso colore. E' solito trasportare lo spadone dietro la schiena in un fodero apposito. Ha un pendente al collo e tiene ben legato un pezzo di stoffa (che gli sta particolarmente a cuore) intorno al braccio sinistro sotto la giacca, copre una cicatrice.
Bozze vesti non definitive qui.

Equipaggiamento:
Indossa:
60$ e 59$ divisi in due tasche interne
Levaitan

Spada a due mani elsa lunga

Guanti del Defender (2PA)
Anello del linguaggio animale (diventato del Richiamo)

Scrinieri da lanciere (2 PA)

Elmo del Leone (5 PA)

Corazza del Leone in Ferro Corrazzato (7 PA)

ZAINO (20) contenente:
Portamonete in pelle di cinghiale contenente: 100$
Scatola Sanitaria Sigillata (può contenere e tenere al sicuro fino a 4 oggetti curativi) (contiene Benda di pronto soccorso x3, Pozione di cura)
Corda
Bottiglia di idromele
Forma di formaggio
Torcia (serve ad illuminare, dura tre settori)

Fiasca di ceramica con Giglio Amaro (Dona +1PN e Velocità all'utilizzatore)
Ampolla Bianca

Semi di Balissa

 

CAVALLO NORMALE + SELLA (30 +2 armi) contentente:
66$
Benda di pronto soccorso x3
Spada a due mani

Fagotto per Adara (fazzoletto ricamato)


 

Link to comment
Share on other sites

Link to comment
Share on other sites

Uno script apprezzabile, tuttavia la formattazione del codice a me risulta completamente sballata ed è un po' difficile orientarsi all'interno e vedere cosa hai fatto. Inoltre vedo che non usi gli alias, ma non sempre si può d'altra parte, però mi sembra di vedere che ci sono tanti metodi ricopiati che sono identici a quelli originali. Se non li hai modificati li dovresti togliere, sia per chiarezza che per aumentare la compatibilità con altri script.
Link to comment
Share on other sites

Sì lo so avrei dovuto toglierli ma ci ho lavorato parecchio e non ne avevo tutta questa voglia XD

Comunque avevo avvertito che per modificare lo script a proprio piacimento servisse un po di RGSS, comunque adesso provvedo subito alla modifica del codice.

Per quanto riguarda gli alias non so usarli benissimo e quindi non volevo incorrere in errori che non sapevo risolvere.

Grazie per il commento :D

 

EDIT: aggiunta una versione più compatibile.

Edited by Valentino
Link to comment
Share on other sites

Complimenti, gran bello script (:

 

Ps. l'abilità "Level Up" in Final Fantasy 9 non fa accumulare il doppio dell'esperienza, ma la moltiplica per 1.5 (:

Coming Soon

 

 

"...non hai bisogno di cercare, è tutto dentro di te..."

 

 

Contest

http://rpg2s.net/gif/SCContest1Oct.gifhttp://rpg2s.net/gif/SCContest1Oct.gifhttp://rpg2s.net/gif/SCContest1Oct.gifhttp://rpg2s.net/gif/SCContest2Oct.gifhttp://rpg2s.net/gif/SCContest3Oct.gifhttp://rpg2s.net/gif/SCContest3Oct.gifhttp://rpg2s.net/gif/SCContest3Oct.gif

 

http://i46.tinypic.com/2zof6dt.png

Link to comment
Share on other sites

Complimenti, gran bello script (:

 

Ps. l'abilità "Level Up" in Final Fantasy 9 non fa accumulare il doppio dell'esperienza, ma la moltiplica per 1.5 (:

 

 

Grazie! Per me è stato un traguardo riuscire a creare un sistema cosi :biggrin:

Comunque ho messo che raddoppia ma nella configurazione è possibile inserire un qualsiasi numero che andrà a moltiplicare all'esperienza ^^

Vi ringrazio per tutti questi commenti XD non ci speravo :tongue:

 

Piuttosto sai per caso come veniva gestita la crescita delle pietre col level up?

Ho cercato in internet e dicono che se ne aquista una ogni volta che si raggiunge un livello che termina con una cifra tra : 0,3,5,7,8 ma provando così ho confrontato il pg con gidan e alla fine gidan aveva almeno una trentina di pietre in piu XD quindi ho deciso di rendere personalizzabili i livelli e il numero di pietre aquistabili ma sarebbe più bello riuscire a renderlo simile a ff 9 XD

Edited by Valentino
Link to comment
Share on other sites

Ho cercato in internet e dicono che se ne aquista una ogni volta che si raggiunge un livello che termina con una cifra tra : 0,3,5,7,8

Si si, ogni volta che un personaggio arriva al livello con la corrispondente cifra alle unità le pietre aumentano di 1 (:

Coming Soon

 

 

"...non hai bisogno di cercare, è tutto dentro di te..."

 

 

Contest

http://rpg2s.net/gif/SCContest1Oct.gifhttp://rpg2s.net/gif/SCContest1Oct.gifhttp://rpg2s.net/gif/SCContest1Oct.gifhttp://rpg2s.net/gif/SCContest2Oct.gifhttp://rpg2s.net/gif/SCContest3Oct.gifhttp://rpg2s.net/gif/SCContest3Oct.gifhttp://rpg2s.net/gif/SCContest3Oct.gif

 

http://i46.tinypic.com/2zof6dt.png

Link to comment
Share on other sites

Si si, ogni volta che un personaggio arriva al livello con la corrispondente cifra alle unità le pietre aumentano di 1 (:

 

 

Eppure ho controllato, cioè:

Al livello uno Gidan ha 18 pietre e al lv 67 ne ha 54

Il pg che ho creato al livello uno ho messo che possiede anche lui 18 pietre, ma salendo di livello al 67 ne ha 44!

Qualcosa non torna. Boh! :biggrin:

Link to comment
Share on other sites

Ho fatto un po' di calcoli, ma non mi trovo u.u

Se a ogni livello che termina con 0,3,5,7,8 si aumenta di uno a me risulta che Gidan al livello 67 dovrebbe averne 51 O.o

Ho letto in vece che si aumentano di 1 quando il livello termina con 0,3,5,8 (e non sette) e la somma è proprio 44 u.u

 

Boh, non saprei però ):

Coming Soon

 

 

"...non hai bisogno di cercare, è tutto dentro di te..."

 

 

Contest

http://rpg2s.net/gif/SCContest1Oct.gifhttp://rpg2s.net/gif/SCContest1Oct.gifhttp://rpg2s.net/gif/SCContest1Oct.gifhttp://rpg2s.net/gif/SCContest2Oct.gifhttp://rpg2s.net/gif/SCContest3Oct.gifhttp://rpg2s.net/gif/SCContest3Oct.gifhttp://rpg2s.net/gif/SCContest3Oct.gif

 

http://i46.tinypic.com/2zof6dt.png

Link to comment
Share on other sites

Ah si scusami! Ho sbagliato a scrivere prima! Le pietre si prendono solo a 0,3,5,8 almeno cosi dicono in internet.

Avevo messo sette perchè lo avevo provato come soluzione ma senza risultato XD

Infatti ne avanzano ancora.

Link to comment
Share on other sites

Mmm, mi sembra di ricordare che, comunque, se si indossano particolari oggetti allo scattare di questi livelli si aumentino i parametri di forza, difesa, ecc..

Magari avendo un particolare equip. si aumentano di 2 le pietre, boh xD

 

Secondo me è proprio cosi u.u

Con alcuni accessori o equipaggiamenti magari invece che aumentare di 1 pietra si aumenta di 2 (:

Edited by abadon92

Coming Soon

 

 

"...non hai bisogno di cercare, è tutto dentro di te..."

 

 

Contest

http://rpg2s.net/gif/SCContest1Oct.gifhttp://rpg2s.net/gif/SCContest1Oct.gifhttp://rpg2s.net/gif/SCContest1Oct.gifhttp://rpg2s.net/gif/SCContest2Oct.gifhttp://rpg2s.net/gif/SCContest3Oct.gifhttp://rpg2s.net/gif/SCContest3Oct.gifhttp://rpg2s.net/gif/SCContest3Oct.gif

 

http://i46.tinypic.com/2zof6dt.png

Link to comment
Share on other sites

Mmm... Se certi oggetti aumentano le pietre allora nel gioco non viene detto XD perchè non ho mai trovato oggetti che facessero aumentare le pietre, forse sono equip con effetti segreti. Bella idea comunque :)
Link to comment
Share on other sites

Io avevo letto che i parametri di forza difesa, ecc..(insomma i primi che ci sono) aumentano di 1 all'arrivo di quei livelli che abbiamo citato noi e con alcuni oggetti aumentano di 2.

Esempio, il "Cinturone" quando arrivi ad un livello che finisce con 0,3,5,8 aumenta la forza di chi lo indossa di 2 e non di uno come è normale che accada, non so se mi sono spiegato ben ) :

Comunque si, sono cose che non vengono dette, ma sono sicuro che sulla guida ce scritto ( :

 

Io sono sicuro di averlo letto ( :

Edited by abadon92

Coming Soon

 

 

"...non hai bisogno di cercare, è tutto dentro di te..."

 

 

Contest

http://rpg2s.net/gif/SCContest1Oct.gifhttp://rpg2s.net/gif/SCContest1Oct.gifhttp://rpg2s.net/gif/SCContest1Oct.gifhttp://rpg2s.net/gif/SCContest2Oct.gifhttp://rpg2s.net/gif/SCContest3Oct.gifhttp://rpg2s.net/gif/SCContest3Oct.gifhttp://rpg2s.net/gif/SCContest3Oct.gif

 

http://i46.tinypic.com/2zof6dt.png

Link to comment
Share on other sites

Io avevo letto che i parametri di forza difesa, ecc..(insomma i primi che ci sono) aumentano di 1 all'arrivo di quei livelli che abbiamo citato noi e con alcuni oggetti aumentano di 2.

Esempio, il "Cinturone" quando arrivi ad un livello che finisce con 0,3,5,8 aumenta la forza di chi lo indossa di 2 e non di uno come è normale che accada, non so se mi sono spiegato ben ) :

Comunque si, sono cose che non vengono dette, ma sono sicuro che sulla guida ce scritto ( :

 

Io sono sicuro di averlo letto ( :

 

 

Ah ecco! Comunque l'ho già implementato, ora ho inserito anche l'abilità di contramagia...

Quando avrò messo altre abilità pubblicherò una versione aggiornata.

Link to comment
Share on other sites

Sapete se riscontra dei bug con l'RATB ?

Iscriviti sul mio canale youtube -

https://www.youtube.com/channel/UCYOxXExvlXiOFfYD1fTFpww?view_as=subscriber

Seguimi su Instagram -

https://www.instagram.com/ancestralguitarist/

---------------------------------------------------------------------------------------------------------------------------------------
Contest vinti
---------------------------------------------------------------------------------------------------------------------------------------

FACE CONTEST # 3
BANNER CONTEST #69

Link to comment
Share on other sites

Eh dipende che script usi XD Comunque credo che si possa tranquillamente renderlo compatibile, ma che così normale sovvrascriva delle classi che andrebbero in conflitto.

Se vuoi te lo modifico io lo script.

Comunque ho scoperto che nella nuova versione ce un bug quando si usano gli oggetti perchè ho cancellato una cosa che non dovevo quindi devo sistemarlo, comunque è una boiata XD

 

EDIT: Ok sistemato il bug e aggiunto la versione fixata.

Edited by Valentino
Link to comment
Share on other sites

Appena posso provo,se ho problemi ri-posto

Iscriviti sul mio canale youtube -

https://www.youtube.com/channel/UCYOxXExvlXiOFfYD1fTFpww?view_as=subscriber

Seguimi su Instagram -

https://www.instagram.com/ancestralguitarist/

---------------------------------------------------------------------------------------------------------------------------------------
Contest vinti
---------------------------------------------------------------------------------------------------------------------------------------

FACE CONTEST # 3
BANNER CONTEST #69

Link to comment
Share on other sites

Link to comment
Share on other sites

Link to comment
Share on other sites

bene, proprio lo script che cercavo. Grazie! :D

Spero che funzioni con i BS Modificati... >__>

http://i46.tinypic.com/260qs1l.jpghttp://i48.tinypic.com/21owyt0.jpghttp://i45.tinypic.com/oj12x5.jpg

http://i45.tinypic.com/oj12x5.jpghttp://i48.tinypic.com/2qanw9v.jpghttp://i45.tinypic.com/oj12x5.jpg

http://i49.tinypic.com/2cpdkb8.jpg

 

http://i47.tinypic.com/vpyfix.jpg http://i45.tinypic.com/jago40.jpg http://img231.imageshack.us/img231/8504/tidus1.png

 

non esco l'ora che veda

Un gioco così ben fatto da farti sballare la testa! XD

 

 

 

 

http://img27.imageshack.us/img27/8540/dsbar.png

http://img294.imageshack.us/img294/6876/nostalebar.png

http://img90.imageshack.us/img90/2158/tbars.png

http://i40.tinypic.com/soqvb8.jpg

http://i45.tinypic.com/29duu1l.jpg

http://img237.imageshack.us/img237/2482/30275.png

http://img182.imageshack.us/img182/8/rpgxpbarrpgmzv1.png

http://img195.imageshack.us/img195/6998/userbarannette.png

http://i48.tinypic.com/awdylh.jpg

Link to comment
Share on other sites

Con i bs modificati probabilmente qualcosa andrà in conflitto ma si tratta semplicemente di editare lo script per renderlo compatibile! Chiamami se ne hai bisogno :D Vedrò cosa posso fare.
Link to comment
Share on other sites

Intendi dire che ogni volta l'attacco sale e poi a fine battaglia viene resettato a normale? mm Non è difficile da fare... almeno non dovrebbe.. se a qualcuno servisse mi dica che lo faccio!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...