Jump to content
Rpg²S Forum

Valentino

Utenti
  • Posts

    463
  • Joined

  • Last visited

Posts posted by Valentino

  1. Trance System



    Descrizione



    Questo script emula la Trance di FF9, cioè subiti abbastanza colpi ci si trasforma automaticamente in Trance con lo sblocco di nuove abilità.


    Autore


    Avon Valentino (Io)



    Allegati

    Script:

     

    #----------------------------Trance System------------------------------
    #Script creato da Valentino Avon
    #Se usate questo script, creditatemi ;)
    #Questo script emula la trance di FF9: Subiti abbastanza danni dal nemico, ci
    #si trasforma in modalità trance sbloccando abilità più potenti e potenziando
    #di un po' la forza, l'agilità, la destrezza e l'intelligenza.
    #il sistema offre solo una base di quella che è veramente la trance di ff9, in
    #quanto si limita a sbloccare nuove abilità.
    #La grafica non è delle migliori ma può essere migliorata.
    module Trance
    	#nomi che verranno sostituiti al comando "skill" nell elenco dei comandi quando
    	#in trance.
    	ACTOR_COMMAND = {1 => "Segreto", 2 => "Caccia", 7=> "Soccorso", 8 => "Distruzione"}
    	DEFAULT_COMMAND = "P. Celato" #nome default
    end
    #abilità utilizzabili dalle trance
    TRANCE_SKILL = [2,11,58,62]
    #animazione visualizzata alla trasformazione
    ANIMAZIONE_TRANCE = 101
    class Game_Actor < Game_Battler
    	attr_accessor :trance
    	attr_accessor :barra_trance
    	attr_accessor :trance_command
    	alias vale_setup setup
    	def setup(actor_id)
    		@trance = false
    		@barra_trance = 0
    		if Trance::ACTOR_COMMAND[actor_id] != nil
    			@trance_command = Trance::ACTOR_COMMAND[actor_id]
    		else
    			@trance_command = Trance::DEFAULT_COMMAND
    		end
    		vale_setup(actor_id)
    	end
    	alias vale_base_str base_str
    	def base_str
    		n = $data_actors[@actor_id].parameters[2, @level]
    		n += n/5 if self.trance
    		vale_base_str
    		return [[n, 1].max, 999].min
    	end
    	alias vale_base_dex base_dex
    	def base_dex
    		n = $data_actors[@actor_id].parameters[3, @level]
    		n += n/5 if self.trance
    		vale_base_dex
    		return [[n, 1].max, 999].min
    	end
    	alias vale_base_agi base_agi
    	def base_agi
    		n = $data_actors[@actor_id].parameters[4, @level]
    		n += n/5 if self.trance
    		vale_base_agi
    		return [[n, 1].max, 999].min
    	end
    	alias vale_base_int base_int
    	def base_int
    		n = $data_actors[@actor_id].parameters[5, @level]
    		n += n/5 if self.trance
    		vale_base_int
    		return [[n, 1].max, 999].min
    	end
    end
    class Window_Base < Window
    	def draw_actor_trance(actor, x, y)
    		self.contents.font.color = normal_color
    		unless actor.trance
    			self.contents.draw_text(x,y,120, 32,"Trance: " + actor.barra_trance.to_s + "%")
    		else
    			self.contents.draw_text(x,y,170, 32,"Trance: Attiva!")
    		end
    	end
    end
    class Scene_Battle
    	alias vale_p3_setup_command_window phase3_setup_command_window
    	def phase3_setup_command_window
    		if @active_battler != nil and @active_battler.trance == true and @active_battler.barra_trance != 0
    			s1 = $data_system.words.attack
    			s2 = @active_battler.trance_command
    			s3 = $data_system.words.guard
    			s4 = $data_system.words.item
    			@actor_command_window.dispose unless @actor_index == $game_party.actors.size
    			@actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
    			@actor_command_window.draw_item(1,Color.new(255, 255, 64, 255))
    			@actor_command_window.y = 160
    			@actor_command_window.back_opacity = 160
    		else
    			s1 = $data_system.words.attack
    			s2 = $data_system.words.skill
    			s3 = $data_system.words.guard
    			s4 = $data_system.words.item
    			@actor_command_window.dispose unless @actor_index == $game_party.actors.size
    			@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 = true
    			@actor_command_window.visible = true
    		end
    		vale_p3_setup_command_window
    	end
    	alias vale_update_phase4_step5 update_phase4_step5
    	def update_phase4_step5
    		for target in @target_battlers
    			if @active_battler.is_a?(Game_Actor)
    				if @active_battler.trance == true
    					@active_battler.barra_trance -= 50
    				end
    				if @active_battler.barra_trance <= 0
    					@active_battler.trance = false
    					@active_battler.barra_trance = 0
    				end
    			end
    			if target.is_a?(Game_Actor)
    				if target.damage.is_a?(Numeric) and target.damage > 0 and target.hp > 0
    					barra = (target.damage*2) / (target.maxhp/30)
    					target.barra_trance += barra unless target.trance
    					if barra <= 0
    						target.barra_trance += 1 unless target.trance
    					end
    				end
    				if target.barra_trance > 100 and target.hp > 0
    					target.barra_trance = 100
    					target.animation_id = ANIMAZIONE_TRANCE
    					target.trance = true
    				end
    				if target.hp == 0
    					target.barra_trance = 0
    				end
    			end
    		end
    		@status_window.refresh
    		@phase4_step = 6
    		vale_update_phase4_step5
    	end
    	alias valentino_update_phase3_basic_command update_phase3_basic_command
    	def update_phase3_basic_command
    		if Input.trigger?(Input::C)
    			case @actor_command_window.index
    			when 0 # attack
    				$game_system.se_play($data_system.decision_se)
    				# Set action
    				@active_battler.current_action.kind = 0
    				@active_battler.current_action.basic = 0
    				start_enemy_select
    			when 1 # skill
    				$game_system.se_play($data_system.decision_se)
    				@active_battler.current_action.kind = 1
    				start_skill_select unless @active_battler.trance
    				start_trance_select if @active_battler.trance
    			when 2
    				$game_system.se_play($data_system.decision_se)
    				@active_battler.current_action.kind = 0
    				@active_battler.current_action.basic = 1
    				phase3_next_actor
    			when 3 # item
    				$game_system.se_play($data_system.decision_se)
    				@active_battler.current_action.kind = 2
    				start_item_select
    			end
    			return
    		end
    		valentino_update_phase3_basic_command
    	end
    	def start_trance_select
    		@skill_window = Window_Trance.new(@active_battler)
    		@skill_window.help_window = @help_window
    		@actor_command_window.active = false
    		@actor_command_window.visible = false
    	end
    	alias valentino_make_basic_action_result make_basic_action_result
    	def make_basic_action_result
    		if @active_battler.current_action.basic == 1
    			@help_window.set_text($data_system.words.guard, 1)
    			if @active_battler.is_a?(Game_Actor)
    				if @active_battler.trance == true
    					@active_battler.barra_trance -= 50
    					if @active_battler.barra_trance <= 0
    						@active_battler.trance = false
    						@active_battler.barra_trance = 0
    					end
    				end
    			end
    			return
    		end
    		valentino_make_basic_action_result
    	end
    	alias vale_battle_end battle_end
    	def battle_end(result)
    		for actor in $game_party.actors
    			if actor.trance
    				actor.trance = false
    				actor.barra_trance = 0
    			end
    		end
    		vale_battle_end(result)
    	end
    end
    class Window_Skill < Window_Selectable
    	alias vale_refresh refresh
    	def refresh
    		vale_refresh
    		@data = []
    		for i in 0...@actor.skills.size
    			skill = $data_skills[@actor.skills[i]]
    			if skill != nil
    				unless TRANCE_SKILL.include?(skill.id)
    					@data.push(skill)
    				end
    			end
    		end
    		@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
    end
    class Window_Trance < Window_Selectable
    	def initialize(actor)
    		super(0, 128, 640, 352)
    		@actor = actor
    		@column_max = 2
    		refresh
    		self.index = 0
    		if $game_temp.in_battle
    			self.y = 64
    			self.height = 256
    			self.back_opacity = 160
    		end
    	end
    	def skill
    		return @data[self.index]
    	end
    	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
    				if TRANCE_SKILL.include?(skill.id)
    					@data.push(skill)
    				end
    			end
    		end
    		@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
    	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)
    		self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
    	end
    	def update_help
    		@help_window.set_text(self.skill == nil ? "" : self.skill.description)
    	end
    end
    class Window_MenuStatus < Window_Selectable
    	alias vale_refresh refresh
    	def refresh
    		self.contents.clear
    		vale_refresh
    		@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_trance(actor, x + 236,y)
    		end
    	end
    end
    class Window_BattleStatus < Window_Base
    	alias vale_refresh refresh
    	def refresh
    		self.contents.clear
    		@item_max = $game_party.actors.size
    		for i in 0...$game_party.actors.size
    			actor = $game_party.actors[i]
    			actor_x = i * 160 + 4
    			draw_actor_hp(actor, actor_x, 32, 120)
    			draw_actor_sp(actor, actor_x, 48, 120)
    			draw_actor_trance(actor, actor_x, 72)
    		end
    		vale_refresh
    	end
    end
    

     

     



    EDIT Reso più leggero e compatibile lo script.
    Demo Link:
    http://www.mediafire.com/download.php?b5z91nygxnk9ikc

    Istruzioni per l'uso

    Trovate tutto all'interno dello script, se lo usate creditatemi per favore :wink:


    Bugs e Conflitti Noti


    N/A


    Altri Dettagli


    La grafica non è il massimo, ma il concetto è quello :)

  2. Ecco fatto: :sisi: Dovrebbe andare

     

    X = 10

    Y = 10

    MAP = 2

    DIREZIONE = 2 # 2 = giu 4 = sinistra 6 = destra e 8 = su

     

    #------------------------------------------------------------------------------

    # Ring_Menu

    #------------------------------------------------------------------------------

    # By: XRXS, Dubealex, and Hypershadow180

    #------------------------------------------------------------------------------

    class Scene_Menu

    #------------------------------------------------------------------------------

    # Initialize

    #------------------------------------------------------------------------------

    def initialize(menu_index = 0)

    @menu_index = menu_index

    $location_text=[]

    $gold_text=[]

    $window_size=[]

    $ring_menu_text=[]

    $chara_select=[]

    @window_opacity=[]

    @chara_select=[]

    @window_position=[]

    $location_text[0]="Calibri" # Font Type

    $location_text[1]=24 # Font Size

    $location_text[2]=0 # Location Title Color

    $location_text[4]=0 # Map Name Color

    $location_text[3]="Location:" # Text

    $gold_text[0]="Calibri" # Font Type

    $gold_text[1]=20 # Font Size

    $gold_text[2]=0 # Gold Title Color

    $gold_text[3]=0 # Gold Color

    $gold_text[4]="Gold" # Text

    @window_opacity[0]=255 # Border Opacity

    @window_opacity[1]=130 # Background Opacity

    $window_location_skin="001-Blue01" # Location Windowskin

    $window_gold_skin="001-Blue01" # Gold Windowskin

    @window_position[0]=0 # X Axis Position

    @window_position[1]=0 # Location Y Axis Position

    @window_position[2]=384 # Gold Y Axis Position

    $window_size[0]=160 # Length

    $window_size[1]=96 # Height

    $ring_menu_text[0]="Calibri" # Font Type

    $ring_menu_text[7]=0 # Font Color

    $ring_menu_text[8]=20 # Font Size

    $ring_menu_text[1]="Items"

    $ring_menu_text[2]="Skills"

    $ring_menu_text[3]="Equip"

    $ring_menu_text[4]="Stats"

    $ring_menu_text[5]="Teletrasporto"

    $ring_menu_text[6]="Quit"

    @chara_select[0]=408 # X Axis Position

    @chara_select[1]=0 # Y Axis Position

    $chara_select[0]="Calibri" # Font Type

    $chara_select[1]=0 # Font Color

    $chara_select[5]=24 # Font Size

    $chara_select[2]=255 # Border Opacity

    $chara_select[3]=130 # Background Opacity

    $chara_select[4]="001-Blue01" # Windowskin

    end

    #------------------------------------------------------------------------------

    # Main

    #------------------------------------------------------------------------------

    def main

    @window_location = Window_Location.new

    @window_location.x = @window_position[0]

    @window_location.y = @window_position[1]

    @window_location.opacity = @window_opacity[0]

    @window_location.back_opacity = @window_opacity[1]

    @window_gold = Window_MenuGold.new

    @window_gold.x = @window_position[0]

    @window_gold.y = @window_position[2]

    @window_gold.opacity = @window_opacity[0]

    @window_gold.back_opacity = @window_opacity[1]

    @spriteset = Spriteset_Map.new

    px = $game_player.screen_x - 15

    py = $game_player.screen_y - 24

    @command_window = Window_RingMenu.new(px,py)

    @command_window.index = @menu_index

    if $game_party.actors.size == 0

    @command_window.disable_item(0)

    @command_window.disable_item(1)

    @command_window.disable_item(2)

    @command_window.disable_item(3)

    end

    @command_window.z = 100

    if $game_system.save_disabled

    @command_window.disable_item(4)

    end

    @status_window = Window_RingMenuStatus.new

    @status_window.x = @chara_select[0]

    @status_window.y = @chara_select[1]

    @status_window.z = 200

    @status_window.opacity=$chara_select[2]

    @status_window.back_opacity=$chara_select[3]

    @status_window.visible = false

    Graphics.transition

    loop do

    Graphics.update

    Input.update

    update

    if $scene != self

    break

    end

    end

    Graphics.freeze

    @spriteset.dispose

    @window_location.dispose

    @window_gold.dispose

    @command_window.dispose

    @status_window.dispose

    end

    #------------------------------------------------------------------------------

    # Update

    #------------------------------------------------------------------------------

    def update

    @window_location.update

    @window_gold.update

    @command_window.update

    @status_window.update

    if @command_window.active

    update_command

    return

    end

    if @status_window.active

    update_status

    return

    end

    end

    #------------------------------------------------------------------------------

    # Update Comman

    #------------------------------------------------------------------------------

    def update_command

    if Input.trigger?(Input::B)

    $game_system.se_play($data_system.cancel_se)

    $scene = Scene_Map.new

    return

    end

    if Input.trigger?(Input::C)

    if $game_party.actors.size == 0 and @command_window.index < 4

    $game_system.se_play($data_system.buzzer_se)

    return

    end

    case @command_window.index

    when 0

    $game_system.se_play($data_system.decision_se)

    $scene = Scene_Item.new

    when 1

    $game_system.se_play($data_system.decision_se)

    @command_window.active = false

    @status_window.active = true

    @status_window.visible = true

    @status_window.index = 0

    when 2

    $game_system.se_play($data_system.decision_se)

    @command_window.active = false

    @status_window.active = true

    @status_window.visible = true

    @status_window.index = 0

    when 3

    $game_system.se_play($data_system.decision_se)

    @command_window.active = false

    @status_window.active = true

    @status_window.visible = true

    @status_window.index = 0

    when 4

    if $game_system.save_disabled

    $game_system.se_play($data_system.buzzer_se)

    return

    end

    $game_system.se_play($data_system.decision_se)

    $game_map.setup(MAP)

    # Move player to initial position

    $game_player.moveto(X, Y)

     

    case DIREZIONE

    when 2

    $game_player.turn_down

    when 4

    $game_player.turn_left

    when 6

    $game_player.turn_right

    when 8

    $game_player.turn_up

    end

     

    $scene = Scene_Map.new

    # Refresh player

    $game_player.refresh

    # Run automatic change for BGM and BGS set with map

    $game_map.autoplay

    when 5

    $game_system.se_play($data_system.decision_se)

    $scene = Scene_End.new

    end

    return

    end

    return if @command_window.animation?

    if Input.press?(Input::UP) or Input.press?(Input::LEFT)

    $game_system.se_play($data_system.cursor_se)

    @command_window.setup_move_move(Window_RingMenu::MODE_MOVEL)

    return

    end

    if Input.press?(Input::DOWN) or Input.press?(Input::RIGHT)

    $game_system.se_play($data_system.cursor_se)

    @command_window.setup_move_move(Window_RingMenu::MODE_MOVER)

    return

    end

    end

    #------------------------------------------------------------------------------

    # Update Status

    #------------------------------------------------------------------------------

    def update_status

    if Input.trigger?(Input::B)

    $game_system.se_play($data_system.cancel_se)

    @command_window.active = true

    @status_window.active = false

    @status_window.visible = false

    @status_window.index = -1

    return

    end

    if Input.trigger?(Input::C)

    case @command_window.index

    when 1

    if $game_party.actors[@status_window.index].restriction >= 2

    $game_system.se_play($data_system.buzzer_se)

    return

    end

    $game_system.se_play($data_system.decision_se)

    $scene = Scene_Skill.new(@status_window.index)

    when 2

    $game_system.se_play($data_system.decision_se)

    $scene = Scene_Equip.new(@status_window.index)

    when 3

    $game_system.se_play($data_system.decision_se)

    $scene = Scene_Status.new(@status_window.index)

    end

    return

    end

    end

    end

    #------------------------------------------------------------------------------

    # Window_RingMenu

    #------------------------------------------------------------------------------

    class Window_RingMenu < Window_Base

    STARTUP_FRAMES = 20

    MOVING_FRAMES = 5

    RING_R = 64

    ICON_ITEM = RPG::Cache.icon("034-Item03")

    ICON_SKILL = RPG::Cache.icon("044-Skill01")

    ICON_EQUIP = RPG::Cache.icon("001-Weapon01")

    ICON_STATUS = RPG::Cache.icon("050-Skill07")

    ICON_SAVE = RPG::Cache.icon("038-Item07")

    ICON_EXIT = RPG::Cache.icon("046-Skill03")

    ICON_DISABLE= RPG::Cache.icon("")

    SE_STARTUP = "056-Right02"

    MODE_START = 1

    MODE_WAIT = 2

    MODE_MOVER = 3

    MODE_MOVEL = 4

    attr_accessor :index

    #------------------------------------------------------------------------------

    # Initialize

    #------------------------------------------------------------------------------

    def initialize( center_x, center_y )

    super(0, 0, 640, 480)

    self.contents = Bitmap.new(width-32, height-32)

    self.contents.font.name = $ring_menu_text[0]

    self.contents.font.color = text_color($ring_menu_text[7])

    self.contents.font.size = $ring_menu_text[8]

    self.opacity = 0

    self.back_opacity = 0

    s1 = $ring_menu_text[1]

    s2 = $ring_menu_text[2]

    s3 = $ring_menu_text[3]

    s4 = $ring_menu_text[4]

    s5 = $ring_menu_text[5]

    s6 = $ring_menu_text[6]

    @commands = [ s1, s2, s3, s4, s5, s6 ]

    @item_max = 6

    @index = 0

    @items = [ ICON_ITEM, ICON_SKILL, ICON_EQUIP, ICON_STATUS, ICON_SAVE, ICON_EXIT ]

    @disabled = [ false, false, false, false, false, false ]

    @cx = center_x - 16

    @cy = center_y - 16

    setup_move_start

    refresh

    end

    #------------------------------------------------------------------------------

    # Update

    #------------------------------------------------------------------------------

    def update

    super

    refresh

    end

    #------------------------------------------------------------------------------

    # Refresh

    #------------------------------------------------------------------------------

    def refresh

    self.contents.clear

    case @mode

    when MODE_START

    refresh_start

    when MODE_WAIT

    refresh_wait

    when MODE_MOVER

    refresh_move(1)

    when MODE_MOVEL

    refresh_move(0)

    end

    rect = Rect.new(@cx - 272, @cy + 24, self.contents.width-32, 32)

    self.contents.draw_text(rect, @commands[@index],1)

    end

    #------------------------------------------------------------------------------

    # Refresh Start

    #------------------------------------------------------------------------------

    def refresh_start

    d1 = 2.0 * Math::PI / @item_max

    d2 = 1.0 * Math::PI / STARTUP_FRAMES

    r = RING_R - 1.0 * RING_R * @steps / STARTUP_FRAMES

    for i in 0...@item_max

    j = i - @index

    d = d1 * j + d2 * @steps

    x = @cx + ( r * Math.sin( d ) ).to_i

    y = @cy - ( r * Math.cos( d ) ).to_i

    draw_item(x, y, i)

    end

    @steps -= 1

    if @steps < 1

    @mode = MODE_WAIT

    end

    end

    #------------------------------------------------------------------------------

    # Refresh Wait

    #------------------------------------------------------------------------------

    def refresh_wait

    d = 2.0 * Math::PI / @item_max

    for i in 0...@item_max

    j = i - @index

    x = @cx + ( RING_R * Math.sin( d * j ) ).to_i

    y = @cy - ( RING_R * Math.cos( d * j ) ).to_i

    draw_item(x, y, i)

    end

    end

    #------------------------------------------------------------------------------

    # Refresh Move

    #------------------------------------------------------------------------------

    def refresh_move( mode )

    d1 = 2.0 * Math::PI / @item_max

    d2 = d1 / MOVING_FRAMES

    d2 *= -1 if mode != 0

    for i in 0...@item_max

    j = i - @index

    d = d1 * j + d2 * @steps

    x = @cx + ( RING_R * Math.sin( d ) ).to_i

    y = @cy - ( RING_R * Math.cos( d ) ).to_i

    draw_item(x, y, i)

    end

    @steps -= 1

    if @steps < 1

    @mode = MODE_WAIT

    end

    end

    #------------------------------------------------------------------------------

    # Draw Item

    #------------------------------------------------------------------------------

    def draw_item(x, y, i)

    rect = Rect.new(0, 0, @items.width, @items.height)

    if @index == i

    self.contents.blt( x, y, @items, rect )

    if @disabled[@index]

    self.contents.blt( x, y, ICON_DISABLE, rect )

    end

    else

    self.contents.blt( x, y, @items, rect, 128 )

    if @disabled[@index]

    self.contents.blt( x, y, ICON_DISABLE, rect, 128 )

    end

    end

    end

    #------------------------------------------------------------------------------

    # Disable Item

    #------------------------------------------------------------------------------

    def disable_item(index)

    @disabled[index] = true

    end

    #------------------------------------------------------------------------------

    # Setup Move Start

    #------------------------------------------------------------------------------

    def setup_move_start

    @mode = MODE_START

    @steps = STARTUP_FRAMES

    if SE_STARTUP != nil and SE_STARTUP != ""

    Audio.se_play("Audio/SE/" + SE_STARTUP, 80, 100)

    end

    end

    #------------------------------------------------------------------------------

    # Setup Move Move

    #------------------------------------------------------------------------------

    def setup_move_move(mode)

    if mode == MODE_MOVER

    @index -= 1

    @index = @items.size - 1 if @index < 0

    elsif mode == MODE_MOVEL

    @index += 1

    @index = 0 if @index >= @items.size

    else

    return

    end

    @mode = mode

    @steps = MOVING_FRAMES

    end

    #------------------------------------------------------------------------------

    # Animation

    #------------------------------------------------------------------------------

    def animation?

    return @mode != MODE_WAIT

    end

    end

    #------------------------------------------------------------------------------

    # Window_RingMenuStatus

    #------------------------------------------------------------------------------

    class Window_RingMenuStatus < Window_Selectable

    #------------------------------------------------------------------------------

    # Initialize

    #------------------------------------------------------------------------------

    def initialize

    super(204, 64, 232, 352)

    self.contents = Bitmap.new(width - 32, height - 32)

    self.contents.font.size = $chara_select[5]

    refresh

    self.active = false

    self.index = -1

    end

    #------------------------------------------------------------------------------

    # Refresh

    #------------------------------------------------------------------------------

    def refresh

    self.contents.clear

    self.windowskin = RPG::Cache.windowskin($chara_select[4])

    self.contents.font.name = $chara_select[0]

    self.contents.font.color = text_color($chara_select[1])

    @item_max = $game_party.actors.size

    for i in 0...$game_party.actors.size

    x = 80

    y = 80 * i

    actor = $game_party.actors

    draw_actor_graphic(actor, x - 60, y + 65)

    draw_actor_name(actor, x, y + 2)

    draw_actor_hp(actor, x - 40, y + 26)

    draw_actor_sp(actor, x - 40, y + 50)

    end

    end

    #------------------------------------------------------------------------------

    # Update Cursor Rect

    #------------------------------------------------------------------------------

    def update_cursor_rect

    if @index < 0

    self.cursor_rect.empty

    else

    self.cursor_rect.set(0, @index * 80, self.width - 32, 80)

    end

    end

    end

    #------------------------------------------------------------------------------

    # Game_Map

    #------------------------------------------------------------------------------

    class Game_Map

    #------------------------------------------------------------------------------

    # Name

    #------------------------------------------------------------------------------

    def name

    $map_infos[@map_id]

    end

    end

    #------------------------------------------------------------------------------

    # Scene_Title

    #------------------------------------------------------------------------------

    class Scene_Title

    $map_infos = load_data("Data/MapInfos.rxdata")

    for key in $map_infos.keys

    $map_infos[key] = $map_infos[key].name

    end

    end

    #------------------------------------------------------------------------------

    # Window_Location

    #------------------------------------------------------------------------------

    class Window_Location < Window_Base

    #------------------------------------------------------------------------------

    # Initialize

    #------------------------------------------------------------------------------

    def initialize

    super(0, 0, $window_size[0], $window_size[1])

    self.contents = Bitmap.new(width - 32, height - 32)

    self.contents.font.name = $location_text[0]

    self.contents.font.size = $location_text[1]

    refresh

    end

    #------------------------------------------------------------------------------

    # Refresh

    #------------------------------------------------------------------------------

    def refresh

    self.contents.clear

    self.windowskin = RPG::Cache.windowskin($window_location_skin)

    self.contents.font.color = text_color($location_text[2])

    self.contents.draw_text(4, 0, 120, 32, $location_text[3])

    self.contents.font.color = text_color($location_text[4])

    self.contents.draw_text(4, 32, 120, 32, $game_map.name, 2)

    end

    end

    #------------------------------------------------------------------------------

    # Window_MenuGold

    #------------------------------------------------------------------------------

    class Window_MenuGold < Window_Base

    #------------------------------------------------------------------------------

    # Initialize

    #------------------------------------------------------------------------------

    def initialize

    super(0, 0, $window_size[0], $window_size[1])

    self.contents = Bitmap.new(width - 32, height - 32)

    self.contents.font.name = $gold_text[0]

    self.contents.font.size = $gold_text[1]

    refresh

    end

    #------------------------------------------------------------------------------

    # Refresh

    #------------------------------------------------------------------------------

    def refresh

    self.contents.clear

    self.windowskin = RPG::Cache.windowskin($window_gold_skin)

    self.contents.font.color = text_color($gold_text[2])

    self.contents.draw_text(4, 0, 120, 32, $gold_text[4])

    self.contents.font.color = text_color($gold_text[3])

    self.contents.draw_text(4, 32, 120, 32, $game_party.gold.to_s, 2)

    end

    end

     

     

    Modifica i valori X,Y,MAP, e DIREZIONE per personalizzare le cordinate, la mappa e la direzione quando viene teletrasportato il personaggio.

  3. Ciao a tutti! Avrei un mini quesito di RGSS... Mi serve il comando per rendere una variabile un numero intero, cioè ad esempio, se una variabile ha un valore di 5,4, prende il valore di 5...

    Da quanto so dovrebbe esistere un comando tipo quello che la converte in stringa (.to_s)...

    Grazie in anticipo! :tongue:

  4. 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.

  5. 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.

  6. 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:

  7. 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

  8. 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.

  9. 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.

  10. Protection System

    Descrizione

     

    Questo script crea una tecnica che permette di proteggere un alleato da quasi tutti gli attacchi per un turno. Tutte le personalizzazioni si possono fare nello script attraverso la Configurazione.
    È possibile scegliere quali abilità ignorano la protezione e tante altre piccole cose.

    Autore

     

    Avon Valentino (Io)

    Allegati


    DEMO LINK:

    http://www.mediafire.com/?urro3uudnr83dpw

    SCRIPT LINK:

    http://www.mediafire.com/?ilmpeb8sksejfuu

     

     

    #-------------------------------#PROTECTION SYSTEM#----------------------------
    #
    #
    #
    #
    #Script creato da Valentino Avon
    #Se questo script viene utilizzato, per favore creditatemi ;)
    #
    #Questo script permette di difendere un alleato da quasi ogni attacco.
    #Tutto è personalizzabile nella sezione CONFIGURAZIONE.
    #
    #
    #--------------------------------#CONFIGURAZIONE#-----------------------------
    #
    #Se true la tecnica protezione sarà sempre la prima a essere eseguita nel corso 
    #di una battaglia (se si vuole un utilizzo legato alla velocità del personaggio,
    #mettere false).
    FIRST_ACTION_PROTEZIONE = true
    #
    #ID Magie che ignorano la protezione (Magie status ad esempio)
    MAGIE_STATUS = [33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52]
    
    #id della classe con l'abilità di protezione.
    DIFENSORE = 9
    
    #Nome dell'abilità visualizzata
    PROTEZIONE = "Proteggi"
    
    #nome visualizzato nell'uso della tecnica
    PROTEZIONE_HELP = "Protezione"
    
    #nome visualizzato quando un alleato viene protetto
    PROTEZIONE_AVVISO = "Protezione!"
    
    #permette la protezione anche dalle magie con target singolo (Mettere false se
    #non si vuole utilizzare)
    PROTEZIONE_MAGIE = true
    
    #animazione visualizzata quando un alleato viene protetto da un attacco fisico
    ATTACCO_ANIM = 64
    
    #animazione visualizzata quando un alleato viene protetto da una magia
    MAGIE_ANIM = 65
    
    #animazione visualizzata sull'alleato selezionato da proteggere
    USO_PROTEZIONE_ANIM = 64
    
    #animazione visualizzata sul Difensore quando usa la tecnica
    PROTEZIONE_ANIM = 101
    
    #
    #
    #--------------------------------#CONFIGURAZIONE#-----------------------
    
    
    
    
    #-----------------------------------#SCRIPT#--------------------------------
    
    
    #==============================================================================
    # ** Game_Battler (part 1)
    #------------------------------------------------------------------------------
    # This class deals with battlers. It's used as a superclass for the Game_Actor
    # and Game_Enemy classes.
    #==============================================================================
    
    class Game_Battler
    	
    	#--------------------------------------------------------------------------
    	# * Determine Action Speed
    	#--------------------------------------------------------------------------
    	def make_action_speed
    		@current_action.speed = agi + rand(10 + agi / 4)
    		if self.current_action.basic == 4 and FIRST_ACTION_PROTEZIONE
    			@current_action.speed += 9999
    		end
    	end
    end
    
    
    
    #==============================================================================
    # ** 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 :alleato # alleato da proteggere
    	attr_accessor :actor_id # ID eroe
    	#--------------------------------------------------------------------------
    	# * Object Initialization
    	# actor_id : actor ID
    	#--------------------------------------------------------------------------
    	def initialize(actor_id)
    		super()
    		setup(actor_id)
    	end
    	#--------------------------------------------------------------------------
    	# * Setup
    	# actor_id : actor ID
    	#--------------------------------------------------------------------------
    	def setup(actor_id)
    		
    		@alleato = nil
    		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
    					learn_skill(j.skill_id)
    				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
    	def position
    		return 0 if self == $game_party.actors[0]
    		return 1 if self == $game_party.actors[1]
    		return 2 if self == $game_party.actors[2]
    		return 3 if self == $game_party.actors[3]
    	end
    end
    
    
    
    
    #==============================================================================
    # ** Scene_Battle 
    #------------------------------------------------------------------------------
    # This class performs battle screen processing.
    #==============================================================================
    
    class Scene_Battle
    	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
    		s1 = $data_system.words.attack
    		s2 = $data_system.words.skill
    		s3 = $data_system.words.guard
    		s4 = $data_system.words.item
    		s5 = PROTEZIONE
    		@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
    	
    	
    	def update
    		# If battle event is running
    		if $game_system.battle_interpreter.running?
    			# Update interpreter
    			$game_system.battle_interpreter.update
    			# If a battler which is forcing actions doesn't exist
    			if $game_temp.forcing_battler == nil
    				# If battle event has finished running
    				unless $game_system.battle_interpreter.running?
    					# Rerun battle event set up if battle continues
    					unless judge
    						setup_battle_event
    					end
    				end
    				# If not after battle phase
    				if @phase != 5
    					# Refresh status window
    					@status_window.refresh
    				end
    			end
    		end
    		# Update system (timer) and screen
    		$game_system.update
    		$game_screen.update
    		# If timer has reached 0
    		if $game_system.timer_working and $game_system.timer == 0
    			# Abort battle
    			$game_temp.battle_abort = true
    		end
    		# Update windows
    		@party_command_window.update
    		@actor_command_window.update
    		@status_window.update
    		@message_window.update
    		
    		# Update sprite set
    		@spriteset.update
    		# If transition is 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 message window is showing
    		if $game_temp.message_window_showing
    			return
    		end
    		# If effect is showing
    		if @spriteset.effect?
    			return
    		end
    		# 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
    			# Switch to title screen
    			$scene = Scene_Title.new
    			return
    		end
    		# If battle is aborted
    		if $game_temp.battle_abort
    			# Return to BGM used before battle started
    			$game_system.bgm_play($game_temp.map_bgm)
    			# Battle ends
    			battle_end(1)
    			return
    		end
    		# If waiting
    		if @wait_count > 0
    			# Decrease wait count
    			@wait_count -= 1
    			return
    		end
    		# If battler forcing an action doesn't exist,
    		# and battle event is running
    		if $game_temp.forcing_battler == nil and
    			$game_system.battle_interpreter.running?
    			return
    		end
    		# Branch according to phase
    		case @phase
    		when 1 # pre-battle phase
    			update_phase1
    		when 2 # party command phase
    			update_phase2
    		when 3 # actor command phase
    			update_phase3
    		when 4 # main phase
    			update_phase4
    		when 5 # after battle phase
    			update_phase5
    		end
    	end
    	
    	
    	
    	#--------------------------------------------------------------------------
    	# * Frame Update (actor command phase)
    	#--------------------------------------------------------------------------
    	def update_phase3
    		# If enemy arrow is enabled
    		if @enemy_arrow != nil
    			update_phase3_enemy_select
    			# If actor arrow is enabled
    		elsif @actor_arrow != nil
    			update_phase3_actor_select
    			# If skill window is enabled
    		elsif @skill_window != nil
    			update_phase3_skill_select
    			# If item window is enabled
    		elsif @item_window != nil
    			update_phase3_item_select
    			# If actor command window is enabled
    		elsif @actor_command_window.active
    			update_phase3_basic_command
    		end
    	end
    	#--------------------------------------------------------------------------
    	# * Frame Update (actor command phase : basic command)
    	#--------------------------------------------------------------------------
    	def update_phase3_basic_command
    		# If B button was pressed
    		if Input.trigger?(Input::B)
    			# Play cancel SE
    			$game_system.se_play($data_system.cancel_se)
    			# Go to command input for previous actor
    			
    			phase3_prior_actor
    			return
    		end
    		# If C button was pressed
    		if Input.trigger?(Input::C)
    			# Branch by actor command window cursor position
    			case @actor_command_window.index
    			when 0 # attack
    				# Play decision SE
    				$game_system.se_play($data_system.decision_se)
    				# Set action
    				@active_battler.current_action.kind = 0
    				@active_battler.current_action.basic = 0
    				# Start enemy selection
    				start_enemy_select
    			when 1 # skill
    				# Play decision SE
    				$game_system.se_play($data_system.decision_se)
    				# Set action
    				@active_battler.current_action.kind = 1
    				# Start skill selection
    				start_skill_select
    			when 2 # guard
    				# Play decision SE
    				$game_system.se_play($data_system.decision_se)
    				# Set action
    				@active_battler.current_action.kind = 0
    				@active_battler.current_action.basic = 1
    				phase3_next_actor
    				
    				
    				# Go to command input for next actor
    			when 3 # item
    				# Se è un difensore, proteggi
    				if @active_battler.class_id == DIFENSORE
    					$game_system.se_play($data_system.decision_se)
    					@active_battler.current_action.basic = 4
    					start_actor_select
    				else
    					$game_system.se_play($data_system.decision_se)
    					# Set action
    					@active_battler.current_action.kind = 2
    					# Start item selection
    					start_item_select
    				end
    			when 4
    				if @active_battler.class_id == DIFENSORE
    					$game_system.se_play($data_system.decision_se)
    					@active_battler.current_action.kind = 2
    					start_item_select
    				end
    			end
    			return
    		end
    	end
    	#--------------------------------------------------------------------------
    	# * Frame Update (actor command phase : actor selection)
    	#--------------------------------------------------------------------------
    	def update_phase3_actor_select
    		# Update actor arrow
    		@actor_arrow.update
    		# If B button was pressed
    		if Input.trigger?(Input::B)
    			# Play cancel SE
    			$game_system.se_play($data_system.cancel_se)
    			# End actor selection
    			end_actor_select
    			return
    		end
    		# If C button was pressed
    		
    		if Input.trigger?(Input::C)
    			
    			@active_battler.current_action.target_index = @actor_arrow.index
    			if @active_battler.is_a?(Game_Actor)
    				if @active_battler.current_action.basic == 4 and @active_battler.current_action.kind != 2
    					if @active_battler.class_id == DIFENSORE #se è un difensore
    						if @actor_arrow.index == @active_battler.position #se non difende se stesso
    							$game_system.se_play($data_system.buzzer_se)
    							# @help.set_text("Non puoi auto-proteggerti!")
    							return
    						else
    							
    							@active_battler.alleato = @active_battler.current_action.target_index #proteggi alleato
    						end
    					end
    				end
    			end
    			# Set action
    			
    			
    			$game_system.se_play($data_system.decision_se)
    			end_actor_select
    			# If skill window is showing
    			if @skill_window != nil
    				# End skill selection
    				end_skill_select
    			end
    			# If item window is showing
    			if @item_window != nil
    				# End item selection
    				end_item_select
    			end
    			
    			# Go to command input for next actor
    			phase3_next_actor
    			# End actor selection
    			
    		end
    	end
    	
    	#--------------------------------------------------------------------------
    	# * Start Actor Selection
    	#--------------------------------------------------------------------------
    	def start_actor_select
    		# Make actor arrow
    		@actor_arrow = Arrow_Actor.new(@spriteset.viewport2)
    		@actor_arrow.index = @actor_index
    		if @active_battler.is_a?(Game_Actor)
    			if @active_battler.class_id == DIFENSORE
    				if @active_battler.current_action.basic == 4
    					@help_window.visible = true #mostra obiettivo
    				end
    			end
    		end
    		# Associate help window
    		@actor_arrow.help_window = @help_window
    		# Disable actor command window
    		@actor_command_window.active = false
    		@actor_command_window.visible = false
    	end
    	#--------------------------------------------------------------------------
    	# * End Actor Selection
    	#--------------------------------------------------------------------------
    	def end_actor_select
    		# Dispose of actor arrow
    		@actor_arrow.dispose
    		@actor_arrow = nil
    		if @active_battler.is_a?(Game_Actor)
    			if @active_battler.class_id == DIFENSORE
    				if @active_battler.current_action.basic == 4
    					@actor_command_window.active = true
    					@actor_command_window.visible = true
    					@help_window.visible = false
    				end
    			end
    		end
    	end
    	def make_basic_action_result
    		# If attack
    		if @active_battler.current_action.basic == 0
    			# Set anaimation ID
    			@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
    			
    			for actor in $game_party.actors
    				if @active_battler.is_a?(Game_Enemy)
    					#proteggi se attacca il protetto
    					if actor.alleato == @active_battler.current_action.target_index and actor.hp > 0#target 
    						target.damage_pop = true
    						target.animation_id = ATTACCO_ANIM
    						target.damage = PROTEZIONE_AVVISO
    						target = actor
    					end
    				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
    		end
    		
    		# If guard
    		
    		if @active_battler.current_action.basic == 1
    			@help_window.set_text($data_system.words.guard, 1)
    			return
    		end
    		
    		if @active_battler.current_action.basic == 4
    			if @active_battler.class_id == DIFENSORE
    				@active_battler.animation_id = PROTEZIONE_ANIM
    				@help_window.set_text(PROTEZIONE_HELP, 1)
    			end
    			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 == 4
    			# Clear battler being forced into action
    			$game_temp.forcing_battler = nil
    			# Shift to step 1
    			@phase4_step = 1
    			return
    		end
    	end
    	
    	
    	
    	
    	def set_target_battlers(scope)
    		# If battler performing action is enemy
    		if @active_battler.is_a?(Game_Enemy)
    			# Branch by effect scope
    			case scope
    			when 1 # single enemy
    				index = @active_battler.current_action.target_index
    				if PROTEZIONE_MAGIE
    					unless MAGIE_STATUS.include?(@skill.id)
    						for actor in $game_party.actors
    							if actor.class_id == DIFENSORE
    								#proteggi se attacca il protetto
    								if actor.alleato == @active_battler.current_action.target_index and actor.hp > 0#target 
    									$game_party.smooth_target_actor(index).damage_pop = true
    									$game_party.smooth_target_actor(index).animation_id = MAGIE_ANIM
    									$game_party.smooth_target_actor(index).damage = PROTEZIONE_AVVISO
    									@target_battlers.push(actor)
    									return
    								end
    							end
    						end
    					end
    				end
    				@target_battlers.push($game_party.smooth_target_actor(index))
    			when 2 # all enemies
    				for actor in $game_party.actors
    					if actor.exist?
    						@target_battlers.push(actor)
    					end
    				end
    			when 3 # single ally
    				index = @active_battler.current_action.target_index
    				@target_battlers.push($game_troop.smooth_target_enemy(index))
    			when 4 # all allies
    				for enemy in $game_troop.enemies
    					if enemy.exist?
    						@target_battlers.push(enemy)
    					end
    				end
    			when 5 # single ally (HP 0) 
    				index = @active_battler.current_action.target_index
    				enemy = $game_troop.enemies[index]
    				if enemy != nil and enemy.hp0?
    					@target_battlers.push(enemy)
    				end
    			when 6 # all allies (HP 0) 
    				for enemy in $game_troop.enemies
    					if enemy != nil and enemy.hp0?
    						@target_battlers.push(enemy)
    					end
    				end
    			when 7 # user
    				@target_battlers.push(@active_battler)
    			end
    		end
    		# If battler performing action is actor
    		if @active_battler.is_a?(Game_Actor)
    			# Branch by effect scope
    			case scope
    			when 1 # single enemy
    				index = @active_battler.current_action.target_index
    				@target_battlers.push($game_troop.smooth_target_enemy(index))
    			when 2 # all enemies
    				for enemy in $game_troop.enemies
    					if enemy.exist?
    						@target_battlers.push(enemy)
    					end
    				end
    			when 3 # single ally
    				index = @active_battler.current_action.target_index
    				@target_battlers.push($game_party.smooth_target_actor(index))
    			when 4 # all allies
    				for actor in $game_party.actors
    					if actor.exist?
    						@target_battlers.push(actor)
    					end
    				end
    			when 5 # single ally (HP 0) 
    				index = @active_battler.current_action.target_index
    				actor = $game_party.actors[index]
    				if actor != nil and actor.hp0?
    					@target_battlers.push(actor)
    				end
    			when 6 # all allies (HP 0) 
    				for actor in $game_party.actors
    					if actor != nil and actor.hp0?
    						@target_battlers.push(actor)
    					end
    				end
    			when 7 # user
    				@target_battlers.push(@active_battler)
    			end
    		end
    	end
    	
    	
    	
    	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.alleato = nil
    			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
    		# Switch to map screen
    		$scene = Scene_Map.new
    	end
    	
    	
    	
    	def phase3_prior_actor
    		@actor_command_window.dispose if @actor_index != 0
    		# Loop
    		begin
    			# Actor blink effect OFF
    			if @active_battler != nil
    				@active_battler.blink = false
    			end
    			# If first actor
    			if @actor_index == 0
    				# Start party command phase
    				start_phase2
    				return
    			end
    			# Return to actor index
    			@actor_index -= 1
    			@active_battler = $game_party.actors[@actor_index]
    			s1 = $data_system.words.attack
    			s2 = $data_system.words.skill
    			s3 = $data_system.words.guard
    			s4 = $data_system.words.item
    			s5 = PROTEZIONE
    			if @active_battler.class_id == DIFENSORE
    				@actor_command_window = Window_Command.new(160, [s1, s2, s3, s5, s4])
    			else
    				@actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
    			end
    			@actor_command_window.y = 160
    			@actor_command_window.back_opacity = 160
    			@active_battler.alleato = nil
    			@active_battler.blink = true
    			# Once more if actor refuses command input
    		end until @active_battler.inputable?
    		# Set up actor command window
    		phase3_setup_command_window
    	end
    	
    	
    	def phase3_next_actor
    		@actor_command_window.dispose if @actor_index != $game_party.actors.size-1
    		# Loop
    		begin
    			# Actor blink effect OFF
    			if @active_battler != nil
    				@active_battler.blink = false
    			end
    			# If last actor
    			if @actor_index == $game_party.actors.size-1
    				# Start main phase
    				
    				start_phase4
    				return
    			end
    			# Advance actor index
    			@actor_index += 1
    			@active_battler = $game_party.actors[@actor_index]
    			@active_battler.alleato = nil
    			s1 = $data_system.words.attack
    			s2 = $data_system.words.skill
    			s3 = $data_system.words.guard
    			s4 = $data_system.words.item
    			s5 = PROTEZIONE
    			if @active_battler.class_id == DIFENSORE
    				@actor_command_window = Window_Command.new(160, [s1, s2, s3, s5, s4])
    			else
    				@actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
    			end
    			@actor_command_window.y = 160
    			@actor_command_window.back_opacity = 160
    			@active_battler.blink = true
    			# Once more if actor refuses command input
    		end until @active_battler.inputable?
    		# Set up actor command window
    		phase3_setup_command_window
    	end
    	
    	
    	def update_phase4_step3
    		# Animation for action performer (if ID is 0, then white flash)
    		if @animation1_id == 0
    			unless @active_battler.current_action.basic == 4 and @active_battler.class_id == DIFENSORE
    				@active_battler.white_flash = true
    			else
    				case @active_battler.current_action.target_index
    				when 0
    					$game_party.actors[0].animation_id = USO_PROTEZIONE_ANIM
    				when 1
    					$game_party.actors[1].animation_id = USO_PROTEZIONE_ANIM
    				when 2
    					$game_party.actors[2].animation_id = USO_PROTEZIONE_ANIM
    				when 3
    					$game_party.actors[3].animation_id = USO_PROTEZIONE_ANIM
    				end
    			end
    		else
    			@active_battler.animation_id = @animation1_id
    			@active_battler.animation_hit = true
    		end
    		# Shift to step 4
    		@phase4_step = 4
    	end
    	
    	
    	def phase3_setup_command_window
    		
    		# Disable party command window
    		@party_command_window.active = false
    		@party_command_window.visible = false
    		# Enable actor command window
    		@actor_command_window.active = true
    		@actor_command_window.visible = true
    		@actor_command_window.y = 160
    		@actor_command_window.y = 128 if @active_battler.class_id == DIFENSORE
    		# Set actor command window position
    		@actor_command_window.x = @actor_index * 160
    		# Set index to 0
    		@actor_command_window.index = 0
    	end
    end
    
    #----------------------------------#SCRIPT#-------------------------------------
    

     

     

     

    Istruzioni per l'uso

     

    Trovate tutto all'interno dello script, se lo usate creditatemi per favore :wink:

    Bugs e Conflitti Noti

     

    N/A

    Altri Dettagli

     

    Per qualsiasi cosa rivolgetevi pure a me, non fatevi problemi. :)

×
×
  • Create New...