AccueilAccueil  PortailPortail  RechercherRechercher  Dernières imagesDernières images  S'enregistrerS'enregistrer  ConnexionConnexion  



Le deal à ne pas rater :
Funko POP! Jumbo One Piece Kaido Dragon Form : où l’acheter ?
Voir le deal

Partagez
 

 Script Invocations + Formation

Voir le sujet précédent Voir le sujet suivant Aller en bas 
AuteurMessage
Kay0077
Poulet trizo Lv.3
Poulet trizo Lv.3
Kay0077


Masculin Age : 29
Inscrit le : 14/03/2010
Messages : 36

Script Invocations + Formation Empty
MessageSujet: Script Invocations + Formation   Script Invocations + Formation Icon_minitimeMar 16 Mar 2010 - 12:54

Bonjour

J'aimerais s'il vous plait un script qui fusionne a la foie la géstion des invocation et la gestion de l'equipe j'ai trouver pour avoir l'equipe et l'invocation séparer mais quand je les met ensemble sa me metque invocation et pas les formation mais si je retire invocation sa laisse formation voicis les script :
Formation:
Code:
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ ? ??????? - KGC_LargeParty ? VX ?
#_/ ? Last update : 2008/02/06 ?
#_/----------------------------------------------------------------------------
#_/ 5?????????????????????
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#==============================================================================
# ? ???????? - Customize ?
#==============================================================================

module KGC
module LargeParty
# ? ?????????????????
# ??????? ON/OFF ???????? ??/??? ????????
PARTYFORM_SWITCH = 1
# ? ?????????????????????
# ??????????????????????????????????
BATTLE_PARTYFORM_SWITCH = 1
# ? ?????????????
# true ?????????????????????????????????
# ???? ON ??????
DEFAULT_PARTYFORM_ENABLED = true

# ? ????????? (??????)
# 5 Nombre mximum dans les combats. (pas plus de 5)
MAX_BATTLE_MEMBERS = 4
# ? ???????????
# Game_Party::MAX_MEMBERS ????????
# 100 ?????? [Window_MenuStatus] ???????
MAX_MEMBERS = 5

# ? ??????????????
# ???????????????????????????
FORBID_CHANGE_SHIFT_FIXED = false

# ? ??????????
# ????????? Color.new(0, 0, 0, 0)
STAND_BY_COLOR = Color.new(0, 0, 0, 128)
# ? ??????????
FIXED_COLOR = Color.new(255, 128, 64, 96)
# ? ?????????
SELECTED_COLOR = Color.new(64, 255, 128, 128)

# ? ????????? (???????)
# ????????????????????????????????
# ???????? nil
MENU_PARTYFORM_BUTTON = Input::A
# ? ??????????????????????
# ???????????????????????
# ?????????????«????????????» ?????????
USE_MENU_PARTYFORM_COMMAND = true
# ? ????????????????????
VOCAB_MENU_PARTYFORM = "Formation"

# ? ???????????????????
# ????????????????????(???????)???
USE_BATTLE_PARTYFORM = true
# ? ?????????????????
VOCAB_BATTLE_PARTYFORM = "Ordre"

# ? ???????????????? [?, ??]
# ???????????????????????????????
PARTY_FORM_CHARACTER_SIZE = [40, 48]
# ? ????????????????????????????
BATTLE_MEMBER_BLANK_TEXT = "Vide"
# ? ???????????????????????
# ???????????????????????
# ???? 1 ????????
PARTY_MEMBER_WINDOW_ROW_MAX = 2
# ? ??????????????????????????????
SHOW_BATTLE_MEMBER_IN_PARTY = false
# ? ??????????????????????????????
PARTY_MEMBER_BLANK_TEXT = "-"

# ? ??????????????????
CAPTION_WINDOW_WIDTH = 192
# ? ???????????????????????
BATTLE_MEMBER_CAPTION = "Battle Party"

if SHOW_BATTLE_MEMBER_IN_PARTY
# ? ?????????????????????????
# SHOW_BATTLE_MEMBER_IN_PARTY = true ???
PARTY_MEMBER_CAPTION = "Party Member"
else
# ? ?????????????????????????
# SHOW_BATTLE_MEMBER_IN_PARTY = false ???
PARTY_MEMBER_CAPTION = "Reserve Party"
end

# ? ???????????
CONFIRM_WINDOW_WIDTH = 160
# ? ?????????????
# ??????•??????????????
CONFIRM_WINDOW_COMMANDS = ["Confirmation changer", "Annuler changer", "Annuler"]

# ? ???????????????????????????????
# ?????????????????????????????
# ?????????????? nil ????
# «????????????»?????????????????
SHOP_STATUS_SCROLL_BUTTON = Input::A

# ? ????????????????:‰(??? 1‰=0.1%)?
# 500 ?? 50.0% ???
STAND_BY_EXP_RATE = 500
# ? ?????????????????????????
# false ???????????????????
SHOW_STAND_BY_LEVEL_UP = true
end
end

#???????????????????????????????????????

$imported = {} if $imported == nil
$imported["LargeParty"] = true

#???????????????????????????????????????

#==============================================================================
# ? KGC::Commands
#==============================================================================

module KGC::Commands
# ??????????
SORT_BY_ID = 0 # ID?
SORT_BY_NAME = 1 # ???
SORT_BY_LEVEL = 2 # ????

module_function
#--------------------------------------------------------------------------
# ? ?????????????
#--------------------------------------------------------------------------
def call_partyform
return if $game_temp.in_battle
$game_temp.next_scene = :partyform
end
#--------------------------------------------------------------------------
# ? ????????????
# value : ?? (????????????????)
#--------------------------------------------------------------------------
def set_max_battle_member_count(value = nil)
$game_party.max_battle_member_count = value
end
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
def party_full?
return $game_party.full?
end
#--------------------------------------------------------------------------
# ? ???????????
# enabled : ????? (??? : true)
#--------------------------------------------------------------------------
def permit_partyform(enabled = true)
$game_switches[KGC::LargeParty::PARTYFORM_SWITCH] = enabled
end
#--------------------------------------------------------------------------
# ? ???????????????
# enabled : ????? (??? : true)
#--------------------------------------------------------------------------
def permit_battle_partyform(enabled = true)
$game_switches[KGC::LargeParty::BATTLE_PARTYFORM_SWITCH] = enabled
end
#--------------------------------------------------------------------------
# ? ????????????
# actor_id : ???? ID
# fixed : ????? (??? : true)
#--------------------------------------------------------------------------
def fix_actor(actor_id, fixed = true)
$game_party.fix_actor(actor_id, fixed)
end
#--------------------------------------------------------------------------
# ? ????
# ????? index1 ??? index2 ????????
#--------------------------------------------------------------------------
def change_party_shift(index1, index2)
$game_party.change_shift(index1, index2)
end
#--------------------------------------------------------------------------
# ? ?????? (??)
# sort_type : ????? (SORT_BY_xxx)
# reverse : true ????
#--------------------------------------------------------------------------
def sort_party_member(sort_type = SORT_BY_ID, reverse = false)
$game_party.sort_member(sort_type, reverse)
end
end

class Game_Interpreter
include KGC::Commands
end

#???????????????????????????????????????

#==============================================================================
# ¦ Vocab
#==============================================================================

module Vocab
# ????????????? (????)
def self.partyform
return KGC::LargeParty::VOCAB_MENU_PARTYFORM
end

# ????????????? (??)
def self.partyform_battle
return KGC::LargeParty::VOCAB_BATTLE_PARTYFORM
end
end

#???????????????????????????????????????

#==============================================================================
# ¦ Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ? ?????????????
#--------------------------------------------------------------------------
def party_index
return $game_party.all_members.index(self)
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def battle_member?
return $game_party.battle_members.include?(self)
end
end

#???????????????????????????????????????

#==============================================================================
# ¦ Game_Party
#==============================================================================

class Game_Party
#--------------------------------------------------------------------------
# ? ??
#--------------------------------------------------------------------------
MAX_MEMBERS = KGC::LargeParty::MAX_MEMBERS # ????????
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
alias initialize_KGC_LargeParty initialize
def initialize
initialize_KGC_LargeParty

@max_battle_member_count = nil
@battle_member_count = 0
@fixed_actors = []
end
#--------------------------------------------------------------------------
# ? ???????????
#--------------------------------------------------------------------------
def max_battle_member_count
if @max_battle_member_count == nil
return KGC::LargeParty::MAX_BATTLE_MEMBERS
else
return @max_battle_member_count
end
end
#--------------------------------------------------------------------------
# ? ???????????
#--------------------------------------------------------------------------
def max_battle_member_count=(value)
if value.is_a?(Integer)
value = [value, 1].max
end
@max_battle_member_count = value
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def battle_member_count
if @battle_member_count == nil
@battle_member_count = @actors.size
end
@battle_member_count =
[@battle_member_count, @actors.size, max_battle_member_count].min
return @battle_member_count
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def battle_member_count=(value)
@battle_member_count = [[value, 0].max,
@actors.size, max_battle_member_count].min
end
#--------------------------------------------------------------------------
# ? ???????
#--------------------------------------------------------------------------
alias members_KGC_LargeParty members
def members
return ($game_temp.in_battle ? battle_members : members_KGC_LargeParty)
end
#--------------------------------------------------------------------------
# ? ????????
#--------------------------------------------------------------------------
def all_members
return members_KGC_LargeParty
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def battle_members
result = []
battle_member_count.times { |i| result << $game_actors[@actors[i]] }
return result
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def stand_by_members
return (all_members - battle_members)
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def fixed_members
result = []
@fixed_actors.each { |i| result << $game_actors[i] }
return result
end
#--------------------------------------------------------------------------
# ? ?????????????
#--------------------------------------------------------------------------
alias setup_starting_members_KGC_LargeParty setup_starting_members
def setup_starting_members
setup_starting_members_KGC_LargeParty

self.battle_member_count = @actors.size
end
#--------------------------------------------------------------------------
# ? ?????????????????
#--------------------------------------------------------------------------
alias setup_battle_test_members_KGC_LargeParty setup_battle_test_members
def setup_battle_test_members
setup_battle_test_members_KGC_LargeParty

self.battle_member_count = @actors.size
end
#--------------------------------------------------------------------------
# ? ?????????
# new_member : ???????
#--------------------------------------------------------------------------
def set_member(new_member)
@actors = []
new_member.each { |actor| @actors << actor.id }
end
#--------------------------------------------------------------------------
# ? ???????????
# new_member : ?????????
#--------------------------------------------------------------------------
def set_battle_member(new_member)
new_battle_member = []
new_member.each { |actor|
@actors.delete(actor.id)
new_battle_member << actor.id
}
@actors = new_battle_member + @actors
self.battle_member_count = new_member.size
end
#--------------------------------------------------------------------------
# ? ????????????????
#--------------------------------------------------------------------------
def partyform_enable?
return $game_switches[KGC::LargeParty::PARTYFORM_SWITCH]
end
#--------------------------------------------------------------------------
# ? ????????????????????
#--------------------------------------------------------------------------
def battle_partyform_enable?
return false unless partyform_enable?
return $game_switches[KGC::LargeParty::BATTLE_PARTYFORM_SWITCH]
end
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
def full?
return (@actors.size >= MAX_MEMBERS)
end
#--------------------------------------------------------------------------
# ? ?????????
# actor_id : ????????? ID
#--------------------------------------------------------------------------
def actor_fixed?(actor_id)
return @fixed_actors.include?(actor_id)
end
#--------------------------------------------------------------------------
# ? ????????
# actor_id : ???? ID
#--------------------------------------------------------------------------
alias add_actor_KGC_LargeParty add_actor
def add_actor(actor_id)
last_size = @actors.size

add_actor_KGC_LargeParty(actor_id)

if last_size < @actors.size
self.battle_member_count += 1
end
end
#--------------------------------------------------------------------------
# ? ????????????
# actor_id : ???? ID
# fixed : ????? (??? : false)
#--------------------------------------------------------------------------
def fix_actor(actor_id, fixed = false)
unless @actors.include?(actor_id)
return
end

if fixed
# ??
unless @fixed_actors.include?(actor_id)
@fixed_actors << actor_id
unless battle_members.include?($game_actors[actor_id])
self.battle_member_count += 1
end
end
# ????
apply_force_launch
else
# ????
@fixed_actors.delete(actor_id)
end
$game_player.refresh
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def apply_force_launch
@actors -= @fixed_actors
@actors = @fixed_actors + @actors
end
#--------------------------------------------------------------------------
# ? ?????? (??)
# sort_type : ????? (SORT_BY_xxx)
# reverse : true ????
#--------------------------------------------------------------------------
def sort_member(sort_type = KGC::Commands::SORT_BY_ID,
reverse = false)
# ???????
b_actors = battle_members
actors = all_members - b_actors
f_actors = fixed_members
# ????????????
if KGC::LargeParty::FORBID_CHANGE_SHIFT_FIXED
actors -= f_actors
b_actors -= f_actors
end
# ???
case sort_type
when KGC::Commands::SORT_BY_ID # ID?
actors.sort! { |a, b| a.id <=> b.id }
b_actors.sort! { |a, b| a.id <=> b.id }
when KGC::Commands::SORT_BY_NAME # ???
actors.sort! { |a, b| a.name <=> b.name }
b_actors.sort! { |a, b| a.name <=> b.name }
when KGC::Commands::SORT_BY_LEVEL # ????
actors.sort! { |a, b| a.level <=> b.level }
b_actors.sort! { |a, b| a.level <=> b.level }
end
# ??
if reverse
actors.reverse!
b_actors.reverse!
end
# ??????????????
if KGC::LargeParty::FORBID_CHANGE_SHIFT_FIXED
actors = f_actors + actors
b_actors = f_actors + b_actors
end
# ??
set_member(actors)
set_battle_member(b_actors)

apply_force_launch
$game_player.refresh
end
#--------------------------------------------------------------------------
# ? ????
# ??????? index1 ??? index2 ????????
#--------------------------------------------------------------------------
def change_shift(index1, index2)
size = @actors.size
if index1 >= size || index2 >= size
return
end
buf = @actors[index1]
@actors[index1] = @actors[index2]
@actors[index2] = buf
$game_player.refresh
end
end

#???????????????????????????????????????

#==============================================================================
# ¦ Window_Command
#==============================================================================

class Window_Command < Window_Selectable
unless method_defined?(:add_command)
#--------------------------------------------------------------------------
# ? ???????
# ?????????
#--------------------------------------------------------------------------
def add_command(command)
@commands << command
@item_max = @commands.size
item_index = @item_max - 1
refresh_command
draw_item(item_index)
return item_index
end
#--------------------------------------------------------------------------
# ? ???????????
#--------------------------------------------------------------------------
def refresh_command
buf = self.contents.clone
self.height = [self.height, row_max * WLH + 32].max
create_contents
self.contents.blt(0, 0, buf, buf.rect)
buf.dispose
end
#--------------------------------------------------------------------------
# ? ???????
#--------------------------------------------------------------------------
def insert_command(index, command)
@commands.insert(index, command)
@item_max = @commands.size
refresh_command
refresh
end
#--------------------------------------------------------------------------
# ? ???????
#--------------------------------------------------------------------------
def remove_command(command)
@commands.delete(command)
@item_max = @commands.size
refresh
end
end
end

#???????????????????????????????????????

#==============================================================================
# ¦ Window_MenuStatus
#==============================================================================

class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# ? ??
#--------------------------------------------------------------------------
STATUS_HEIGHT = 96 # ???????????
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
def create_contents
self.contents.dispose
self.contents = Bitmap.new(width - 32,
[height - 32, row_max * STATUS_HEIGHT].max)
end
#--------------------------------------------------------------------------
# ? ???????
#--------------------------------------------------------------------------
def top_row
return self.oy / STATUS_HEIGHT
end
#--------------------------------------------------------------------------
# ? ???????
# row : ????????
#--------------------------------------------------------------------------
def top_row=(row)
super(row)
self.oy = self.oy / WLH * STATUS_HEIGHT
end
#--------------------------------------------------------------------------
# ? 1 ??????????????
#--------------------------------------------------------------------------
def page_row_max
return (self.height - 32) / STATUS_HEIGHT
end
#--------------------------------------------------------------------------
# ? ????????????
# index : ????
#--------------------------------------------------------------------------
def item_rect(index)
rect = super(index)
rect.height = STATUS_HEIGHT
rect.y = index / @column_max * STATUS_HEIGHT
return rect
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
@item_max = $game_party.all_members.size
create_contents
fill_stand_by_background
draw_member
end
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
def draw_member
for actor in $game_party.members
draw_actor_face(actor, 2, actor.party_index * 96 + 2, 92)
x = 104
y = actor.party_index * 96 + WLH / 2
draw_actor_name(actor, x, y)
draw_actor_class(actor, x + 120, y)
draw_actor_level(actor, x, y + WLH * 1)
draw_actor_state(actor, x, y + WLH * 2)
draw_actor_hp(actor, x + 120, y + WLH * 1)
draw_actor_mp(actor, x + 120, y + WLH * 2)
end
end
#--------------------------------------------------------------------------
# ? ?????????????
#--------------------------------------------------------------------------
def fill_stand_by_background
color = KGC::LargeParty::STAND_BY_COLOR
dy = STATUS_HEIGHT * $game_party.battle_members.size
dh = STATUS_HEIGHT * $game_party.stand_by_members.size
if dh > 0
self.contents.fill_rect(0, dy, self.width - 32, dh, color)
end
end
#--------------------------------------------------------------------------
# ? ???????
#--------------------------------------------------------------------------
def update_cursor
if @index < 0 # ??????
self.cursor_rect.empty
elsif @index < @item_max # ??
super
elsif @index >= 100 # ??
self.cursor_rect.set(0, (@index - 100) * STATUS_HEIGHT,
contents.width, STATUS_HEIGHT)
else # ??
self.cursor_rect.set(0, 0, contents.width, @item_max * STATUS_HEIGHT)
end
end
end

#???????????????????????????????????????

#==============================================================================
# ¦ Window_ShopStatus
#==============================================================================

class Window_ShopStatus < Window_Base
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
def create_contents
self.contents.dispose
self.contents = Bitmap.new(width - 32,
WLH * ($game_party.members.size + 1) * 2)
end
end

#???????????????????????????????????????

#==============================================================================
# ¦ Window_BattleStatus
#==============================================================================

class Window_BattleStatus < Window_Selectable
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
def create_contents
self.contents.dispose
self.contents = Bitmap.new(width - 32,
[WLH * $game_party.members.size, height - 32].max)
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
alias refresh_KGC_LargeParty refresh
def refresh
create_contents

refresh_KGC_LargeParty
end
end

#???????????????????????????????????????

#==============================================================================
# ? Window_PartyFormCaption
#------------------------------------------------------------------------------
#  ??????????????????????????????????
#==============================================================================

class Window_PartyFormCaption < Window_Base
#--------------------------------------------------------------------------
# ? ?????????
# caption : ??????????
#--------------------------------------------------------------------------
def initialize(caption = "")
super(0, 0, KGC::LargeParty::CAPTION_WINDOW_WIDTH, WLH + 32)
self.z = 1500
@caption = caption
refresh
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.draw_text(0, 0, width - 32, WLH, @caption)
end
end

#???????????????????????????????????????

#==============================================================================
# ? Window_PartyFormMember
#------------------------------------------------------------------------------
#  ??????????????????????????
#==============================================================================

class Window_PartyFormMember < Window_Selectable
#--------------------------------------------------------------------------
# ? ??
#--------------------------------------------------------------------------
DRAW_SIZE = KGC::LargeParty::PARTY_FORM_CHARACTER_SIZE
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
attr_accessor :selected_index # ??????????
#--------------------------------------------------------------------------
# ? ?????????
# x : ?????? X ??
# y : ?????? Y ??
# width : ???????
# height : ????????
# spacing : ??????????????
#--------------------------------------------------------------------------
def initialize(x, y, width, height, spacing = 8)
super(x, y, width, height, spacing)
self.z = 1000
end
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
def create_contents
self.contents.dispose
self.contents = Bitmap.new(width - 32,
[height - 32, row_max * DRAW_SIZE[1]].max)
end
#--------------------------------------------------------------------------
# ? ???????
#--------------------------------------------------------------------------
def top_row
return self.oy / DRAW_SIZE[1]
end
#--------------------------------------------------------------------------
# ? ???????
# row : ????????
#--------------------------------------------------------------------------
def top_row=(row)
super(row)
self.oy = self.oy / WLH * DRAW_SIZE[1]
end
#--------------------------------------------------------------------------
# ? 1 ??????????????
#--------------------------------------------------------------------------
def page_row_max
return (self.height - 32) / DRAW_SIZE[1]
end
#--------------------------------------------------------------------------
# ? ????????????
# index : ????
#--------------------------------------------------------------------------
def item_rect(index)
rect = super(index)
rect.width = DRAW_SIZE[0]
rect.height = DRAW_SIZE[1]
rect.y = index / @column_max * DRAW_SIZE[1]
return rect
end
#--------------------------------------------------------------------------
# ? ????????
#--------------------------------------------------------------------------
def actor
return @actors[self.index]
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
self.contents.clear
restore_member_list
draw_member
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def restore_member_list
# ??????
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def draw_member
# ??????
end
#--------------------------------------------------------------------------
# ? ????????
# index : ????
#--------------------------------------------------------------------------
def draw_empty_actor(index)
# ??????
end
#--------------------------------------------------------------------------
# ? ?????????
# index : ????
#--------------------------------------------------------------------------
def draw_fixed_back(index)
rect = item_rect(index)
self.contents.fill_rect(rect, KGC::LargeParty::FIXED_COLOR)
end
#--------------------------------------------------------------------------
# ? ??????????
# index : ????
#--------------------------------------------------------------------------
def draw_selected_back(index)
rect = item_rect(index)
self.contents.fill_rect(rect, KGC::LargeParty::SELECTED_COLOR)
end
end

#???????????????????????????????????????

#==============================================================================
# ? Window_PartyFormBattleMember
#------------------------------------------------------------------------------
#  ????????????????????????????
#==============================================================================

class Window_PartyFormBattleMember < Window_PartyFormMember
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
attr_accessor :selected_index # ??????????
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def initialize
super(0, 0, 64, DRAW_SIZE[1] + 32)
column_width = DRAW_SIZE[0] + @spacing
nw = [column_width * $game_party.max_battle_member_count + 32,
Graphics.width].min
self.width = nw

@item_max = $game_party.max_battle_member_count
@column_max = width / column_width
@selected_index = nil
create_contents
refresh
self.active = true
self.index = 0
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def restore_member_list
@actors = $game_party.battle_members
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def draw_member
@item_max.times { |i|
actor = @actors[i]
if actor == nil
draw_empty_actor(i)
else
if i == @selected_index
draw_selected_back(i)
elsif $game_party.actor_fixed?(actor.id)
draw_fixed_back(i)
end
rect = item_rect(i)
draw_actor_graphic(actor,
rect.x + DRAW_SIZE[0] / 2,
rect.y + DRAW_SIZE[1] - 4)
end
}
end
#--------------------------------------------------------------------------
# ? ????????
# index : ????
#--------------------------------------------------------------------------
def draw_empty_actor(index)
rect = item_rect(index)
self.contents.font.color = system_color
self.contents.draw_text(rect, KGC::LargeParty::BATTLE_MEMBER_BLANK_TEXT, 1)
self.contents.font.color = normal_color
end
end

#???????????????????????????????????????

#==============================================================================
# ? Window_PartyFormAllMember
#------------------------------------------------------------------------------
#  ???????????????????????????
#==============================================================================

class Window_PartyFormAllMember < Window_PartyFormMember
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def initialize
super(0, 0, 64, 64)
restore_member_list
@item_max = $game_party.all_members.size

# ???????
column_width = DRAW_SIZE[0] + @spacing
sw = [@item_max * column_width + 32, Graphics.width].min
@column_max = (sw - 32) / column_width
sh = ([@item_max - 1, 0].max / @column_max + 1) * DRAW_SIZE[1] + 32
sh = [sh, DRAW_SIZE[1] * KGC::LargeParty::PARTY_MEMBER_WINDOW_ROW_MAX + 32].min

# ??•?????
self.y += DRAW_SIZE[1] + 32
self.width = sw
self.height = sh

create_contents
refresh
self.active = false
self.index = 0
end
#--------------------------------------------------------------------------
# ? ???????????????????
#--------------------------------------------------------------------------
def actor_index
return @index_offset + self.index
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def restore_member_list
if KGC::LargeParty::SHOW_BATTLE_MEMBER_IN_PARTY
@actors = $game_party.all_members
@index_offset = 0
else
@actors = $game_party.stand_by_members
@index_offset = $game_party.battle_members.size
end
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def draw_member
@item_max.times { |i|
actor = @actors[i]
if actor == nil
draw_empty_actor(i)
next
end

if $game_party.actor_fixed?(actor.id)
draw_fixed_back(i)
end
rect = item_rect(i)
opacity = ($game_party.battle_members.include?(actor) ? 96 : 255)
draw_actor_graphic(actor,
rect.x + DRAW_SIZE[0] / 2,
rect.y + DRAW_SIZE[1] - 4,
opacity)
}
end
#--------------------------------------------------------------------------
# ? ???????????????
# actor : ????
# x : ??? X ??
# y : ??? Y ??
# opacity : ????
#--------------------------------------------------------------------------
def draw_actor_graphic(actor, x, y, opacity = 255)
draw_character(actor.character_name, actor.character_index, x, y, opacity)
end
#--------------------------------------------------------------------------
# ? ???????????
# character_name : ???????? ?????
# character_index : ???????? ??????
# x : ??? X ??
# y : ??? Y ??
# opacity : ????
#--------------------------------------------------------------------------
def draw_character(character_name, character_index, x, y, opacity = 255)
return if character_name == nil
bitmap = Cache.character(character_name)
sign = character_name[/^[\!\$]./]
if sign != nil and sign.include?('$')
cw = bitmap.width / 3
ch = bitmap.height / 4
else
cw = bitmap.width / 12
ch = bitmap.height / 8
end
n = character_index
src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect, opacity)
end
#--------------------------------------------------------------------------
# ? ????????
# index : ????
#--------------------------------------------------------------------------
def draw_empty_actor(index)
rect = item_rect(index)
self.contents.font.color = system_color
self.contents.draw_text(rect, KGC::LargeParty::PARTY_MEMBER_BLANK_TEXT, 1)
self.contents.font.color = normal_color
end
end

#???????????????????????????????????????

#==============================================================================
# ? Window_PartyFormStatus
#------------------------------------------------------------------------------
#  ????????????????????????????????
#==============================================================================

class Window_PartyFormStatus < Window_Base
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def initialize
super(0, 0, 384, 128)
self.z = 1000
@actor = nil
refresh
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def set_actor(actor)
if @actor != actor
@actor = actor
refresh
end
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if @actor == nil
return
end

draw_actor_face(@actor, 0, 0)
dx = 104
draw_actor_name(@actor, dx, 0)
draw_actor_level(@actor, dx, WLH * 1)
draw_actor_hp(@actor, dx, WLH * 2)
draw_actor_mp(@actor, dx, WLH * 3)
4.times { |i|
draw_actor_parameter(@actor, dx + 128, WLH * i, i, 120)
}
end
#--------------------------------------------------------------------------
# ? ??????
# actor : ????
# x : ??? X ??
# y : ??? Y ??
# type : ?????? (0~3)
# width : ???
#--------------------------------------------------------------------------
def draw_actor_parameter(actor, x, y, type, width = 156)
case type
when 0
parameter_name = Vocab::atk
parameter_value = actor.atk
when 1
parameter_name = Vocab::def
parameter_value = actor.def
when 2
parameter_name = Vocab::spi
parameter_value = actor.spi
when 3
parameter_name = Vocab::agi
parameter_value = actor.agi
end
nw = width - 36
self.contents.font.color = system_color
self.contents.draw_text(x, y, nw, WLH, parameter_name)
self.contents.font.color = normal_color
self.contents.draw_text(x + nw, y, 36, WLH, parameter_value, 2)
end
end

#???????????????????????????????????????

#==============================================================================
# ? Window_PartyFormControl
#------------------------------------------------------------------------------
#  ??????????????????????????
#==============================================================================

class Window_PartyFormControl < Window_Base
#--------------------------------------------------------------------------
# ? ??
#--------------------------------------------------------------------------
MODE_BATTLE_MEMBER = 0
MODE_SHIFT_CHANGE = 1
MODE_PARTY_MEMBER = 2
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def initialize
super(0, 0, Graphics.width - 384, 128)
self.z = 1000
@mode = MODE_BATTLE_MEMBER
refresh
end
#--------------------------------------------------------------------------
# ? ?????
#--------------------------------------------------------------------------
def mode=(value)
@mode = value
refresh
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
self.contents.clear
case @mode
when MODE_BATTLE_MEMBER # ??????
buttons = [
"Echap : Annuler",
"Espace : Confirmer",
]
when MODE_SHIFT_CHANGE # ????
buttons = [
"Echap : Annuler",
"Espace : Confirmer",
]
when MODE_PARTY_MEMBER # ????????
buttons = [
"Echap : Annuler",
"Espace : Confirmer"
]
else
return
end

buttons.each_with_index { |c, i|
self.contents.draw_text(0, WLH * i, width - 32, WLH, c)
}
end
end

#???????????????????????????????????????

#==============================================================================
# ¦ Scene_Title
#==============================================================================

class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# ? ??????????????
#--------------------------------------------------------------------------
alias create_game_objects_KGC_LargeParty create_game_objects
def create_game_objects
create_game_objects_KGC_LargeParty

if KGC::LargeParty::DEFAULT_PARTYFORM_ENABLED
$game_switches[KGC::LargeParty::PARTYFORM_SWITCH] = true
$game_switches[KGC::LargeParty::BATTLE_PARTYFORM_SWITCH] = true
end
end
end

#???????????????????????????????????????

#==============================================================================
# ¦ Scene_Map
#==============================================================================

class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
alias update_scene_change_KGC_LargeParty update_scene_change
def update_scene_change
return if $game_player.moving? # ??????????

if $game_temp.next_scene == :partyform
call_partyform
return
end

update_scene_change_KGC_LargeParty
end
#--------------------------------------------------------------------------
# ? ??????????????
#--------------------------------------------------------------------------
def call_partyform
$game_temp.next_scene = nil
$scene = Scene_PartyForm.new(0, Scene_PartyForm::HOST_MAP)
end
end

#???????????????????????????????????????

#==============================================================================
# ¦ Scene_Menu
#==============================================================================

class Scene_Menu < Scene_Base
if KGC::LargeParty::USE_MENU_PARTYFORM_COMMAND
#--------------------------------------------------------------------------
# ? ????????????
#--------------------------------------------------------------------------
alias create_command_window_KGC_LargeParty create_command_window
def create_command_window
create_command_window_KGC_LargeParty

return if $imported["CustomMenuCommand"]

@__command_partyform_index =
@command_window.add_command(Vocab.partyform)
@command_window.draw_item(@__command_partyform_index,
$game_party.partyform_enable?)
if @command_window.oy > 0
@command_window.oy -= Window_Base::WLH
end
@command_window.index = @menu_index
end
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
alias update_command_selection_KGC_LargeParty update_command_selection
def update_command_selection
current_menu_index = @__command_partyform_index
call_partyform_flag = false

if Input.trigger?(Input::C)
case @command_window.index
when @__command_partyform_index # ??????
call_partyform_flag = true
end
# ???????????
elsif KGC::LargeParty::MENU_PARTYFORM_BUTTON != nil &&
Input.trigger?(KGC::LargeParty::MENU_PARTYFORM_BUTTON)
call_partyform_flag = true
current_menu_index = @command_window.index if current_menu_index == nil
end

# ???????????
if call_partyform_flag
if $game_party.members.size == 0 || !$game_party.partyform_enable?
Sound.play_buzzer
return
end
Sound.play_decision
$scene = Scene_PartyForm.new(current_menu_index)
return
end

update_command_selection_KGC_LargeParty
end
end

#???????????????????????????????????????

#==============================================================================
# ¦ Scene_Shop
#==============================================================================

unless $imported["HelpExtension"]
class Scene_Shop < Scene_Base
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
alias udpate_KGC_LargeParty update
def update
# ???????
if !@command_window.active &&
KGC::LargeParty::SHOP_STATUS_SCROLL_BUTTON != nil &&
Input.press?(KGC::LargeParty::SHOP_STATUS_SCROLL_BUTTON)
super
update_menu_background
update_scroll_status
return
else
@status_window.cursor_rect.empty
end

udpate_KGC_LargeParty
end
#--------------------------------------------------------------------------
# ? ??????????????????
#--------------------------------------------------------------------------
def update_scroll_status
# ??????????????????
@status_window.cursor_rect.width = @status_window.contents.width
@status_window.cursor_rect.height = @status_window.height - 32
@status_window.update

if Input.press?(Input::UP)
@status_window.oy = [@status_window.oy - 4, 0].max
elsif Input.press?(Input::DOWN)
max_pos = [@status_window.contents.height -
(@status_window.height - 32), 0].max
@status_window.oy = [@status_window.oy + 4, max_pos].min
end
end
end
end

#???????????????????????????????????????

#==============================================================================
# ? Scene_PartyForm
#------------------------------------------------------------------------------
#  ????????????????????
#==============================================================================

class Scene_PartyForm < Scene_Base
#--------------------------------------------------------------------------
# ? ??
#--------------------------------------------------------------------------
CAPTION_OFFSET = 40 # ????????????????
HOST_MENU = 0 # ????? : ????
HOST_MAP = 1 # ????? : ???
HOST_BATTLE = 2 # ????? : ??
#--------------------------------------------------------------------------
# ? ?????????
# menu_index : ?????????????
# host_scene : ????? (0..???? 1..??? 2..??)
#--------------------------------------------------------------------------
def initialize(menu_index = 0, host_scene = HOST_MENU)
@menu_index = menu_index
@host_scene = host_scene
end
#--------------------------------------------------------------------------
# ? ????
#--------------------------------------------------------------------------
def start
super
create_menu_background

create_windows
create_confirm_window
adjust_window_location

# ???????????
@battle_actors = $game_party.battle_members.dup
@party_actors = $game_party.all_members.dup
end
#--------------------------------------------------------------------------
# ? ????????
#--------------------------------------------------------------------------
def create_windows
# ???????????
@battle_member_window = Window_PartyFormBattleMember.new
@party_member_window = Window_PartyFormAllMember.new
@status_window = Window_PartyFormStatus.new
@status_window.set_actor(@battle_member_window.actor)

# ????????????
@battle_member_caption_window =
Window_PartyFormCaption.new(KGC::LargeParty::BATTLE_MEMBER_CAPTION)
@party_member_caption_window =
Window_PartyFormCaption.new(KGC::LargeParty::PARTY_MEMBER_CAPTION)
@control_window = Window_PartyFormControl.new
end
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
def create_confirm_window
commands = KGC::LargeParty::CONFIRM_WINDOW_COMMANDS
@confirm_window =
Window_Command.new(KGC::LargeParty::CONFIRM_WINDOW_WIDTH, commands)
@confirm_window.index = 0
@confirm_window.x = (Graphics.width - @confirm_window.width) / 2
@confirm_window.y = (Graphics.height - @confirm_window.height) / 2
@confirm_window.z = 2000
@confirm_window.openness = 0
@confirm_window.active = false
end
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
def adjust_window_location
# ???????
base_x = [@battle_member_window.width, @party_member_window.width].max
base_x = [(Graphics.width - base_x) / 2, 0].max
base_y = @battle_member_window.height + @party_member_window.height +
@status_window.height + CAPTION_OFFSET * 2
base_y = [(Graphics.height - base_y) / 2, 0].max

# ???????????????
@battle_member_window.x = base_x
@battle_member_window.y = base_y + CAPTION_OFFSET
@party_member_window.x = base_x
@party_member_window.y = @battle_member_window.y +
@battle_member_window.height + CAPTION_OFFSET
@status_window.x = 0
@status_window.y = @party_member_window.y + @party_member_window.height

# ????????????????
@battle_member_caption_window.x = [base_x - 16, 0].max
@battle_member_caption_window.y = @battle_member_window.y - CAPTION_OFFSET
@party_member_caption_window.x = [base_x - 16, 0].max
@party_member_caption_window.y = @party_member_window.y - CAPTION_OFFSET
@control_window.x = @status_window.width
@control_window.y = @status_window.y
end
#--------------------------------------------------------------------------
# ? ????
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@battle_member_window.dispose
@party_member_window.dispose
@status_window.dispose
@battle_member_caption_window.dispose
@party_member_caption_window.dispose
@control_window.dispose
@confirm_window.dispose
end
#--------------------------------------------------------------------------
# ? ????????????
#--------------------------------------------------------------------------
def create_menu_background
super
@menuback_sprite.z = 500
end
#--------------------------------------------------------------------------
# ? ???????
#--------------------------------------------------------------------------
def return_scene
case @host_scene
when HOST_MENU
$scene = Scene_Menu.new(@menu_index)
when HOST_MAP
$scene = Scene_Map.new
when HOST_BATTLE
$scene = Scene_Battle.new
end
$game_player.refresh
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def update
super
update_menu_background
update_window
if @battle_member_window.active
update_battle_member
elsif @party_member_window.active
update_party_member
elsif @confirm_window.active
update_confirm
end
end
#--------------------------------------------------------------------------
# ? ???????
#--------------------------------------------------------------------------
def update_window
@battle_member_window.update
@party_member_window.update
@status_window.update
@battle_member_caption_window.update
@party_member_caption_window.update
@control_window.update
@confirm_window.update
end
#--------------------------------------------------------------------------
# ? ????????
#--------------------------------------------------------------------------
def refresh_window
@battle_member_window.refresh
@party_member_window.refresh
end
#--------------------------------------------------------------------------
# ? ?????? (????????????????????)
#--------------------------------------------------------------------------
def update_battle_member
@status_window.set_actor(@battle_member_window.actor)
if Input.trigger?(Input::A)
if @battle_member_window.selected_index == nil # ????????
actor = @battle_member_window.actor
# ???????????
if actor == nil || $game_party.actor_fixed?(actor.id)
Sound.play_buzzer
return
end
# ???????
Sound.play_decision
actors = $game_party.battle_members
actors.delete_at(@battle_member_window.index)
$game_party.set_battle_member(actors)
refresh_window
end
elsif Input.trigger?(Input::B)
if @battle_member_window.selected_index == nil # ????????
# ????????????
Sound.play_cancel
show_confirm_window
else # ?????
# ??????
Sound.play_cancel
@battle_member_window.selected_index = nil
@battle_member_window.refresh
@control_window.mode = Window_PartyFormControl::MODE_BATTLE_MEMBER
end
elsif Input.trigger?(Input::C)
if @battle_member_window.selected_index == nil # ????????
actor = @battle_member_window.actor
# ???????????
if actor != nil && $game_party.actor_fixed?(actor.id)
Sound.play_buzzer
return
end
# ??????????????????
Sound.play_decision
@battle_member_window.active = false
@party_member_window.active = true
@control_window.mode = Window_PartyFormControl::MODE_PARTY_MEMBER
else # ?????
unless can_change_shift?(@battle_member_window.actor)
Sound.play_buzzer
return
end
# ??????
Sound.play_decision
index1 = @battle_member_window.selected_index
index2 = @battle_member_window.index
change_shift(index1, index2)
@control_window.mode = Window_PartyFormControl::MODE_BATTLE_MEMBER
end
elsif Input.trigger?(Input::X)
# ??????????
unless can_change_shift?(@battle_member_window.actor)
Sound.play_buzzer
return
end
if @battle_member_window.selected_index == nil # ????????
# ??????
Sound.play_decision
@battle_member_window.selected_index = @battle_member_window.index
@battle_member_window.refresh
@control_window.mode = Window_PartyFormControl::MODE_SHIFT_CHANGE
else # ?????
# ??????
Sound.play_decision
index1 = @battle_member_window.selected_index
index2 = @battle_member_window.index
change_shift(index1, index2)
@control_window.mode = Window_PartyFormControl::MODE_BATTLE_MEMBER
end
end
end
#--------------------------------------------------------------------------
# ? ????????
#--------------------------------------------------------------------------
def can_change_shift?(actor)
# ???????????????????????????
if actor == nil ||
(KGC::LargeParty::FORBID_CHANGE_SHIFT_FIXED &&
$game_party.actor_fixed?(actor.id))
return false
end
return true
end
#--------------------------------------------------------------------------
# ? ????
#--------------------------------------------------------------------------
def change_shift(index1, index2)
# ???????
$game_party.change_shift(index1, index2)
# ??????????????
@battle_member_window.selected_index = nil
refresh_window
end
#--------------------------------------------------------------------------
# ? ?????? (??????????????????)
#--------------------------------------------------------------------------
def update_party_member
@status_window.set_actor(@party_member_window.actor)
if Input.trigger?(Input::B)
Sound.play_cancel
# ????????????????
@battle_member_window.active = true
@party_member_window.active = false
@control_window.mode = Window_PartyFormControl::MODE_BATTLE_MEMBER
elsif Input.trigger?(Input::C)
actor = @party_member_window.actor
# ??????????????????
if $game_party.battle_members.include?(actor)
Sound.play_buzzer
return
end
# ?????????
Sound.play_decision
actors = $game_party.all_members
battle_actors = $game_party.battle_members
if @battle_member_window.actor != nil
actors[@party_member_window.actor_index] = @battle_member_window.actor
actors[@battle_member_window.index] = actor
$game_party.set_member(actors.compact)
end
battle_actors[@battle_member_window.index] = actor
$game_party.set_battle_member(battle_actors.compact)
refresh_window
# ????????????????
@battle_member_window.active = true
@party_member_window.active = false
@control_window.mode = Window_PartyFormControl::MODE_BATTLE_MEMBER
end
end
#--------------------------------------------------------------------------
# ? ?????? (????????????????)
#--------------------------------------------------------------------------
def update_confirm
if Input.trigger?(Input::B)
Sound.play_cancel
hide_confirm_window
elsif Input.trigger?(Input::C)
case @confirm_window.index
when 0 # ????
# ????????????
if $game_party.battle_members.size == 0
Sound.play_buzzer
return
end
Sound.play_decision
return_scene
when 1 # ????
Sound.play_decision
# ??????????????
$game_party.set_member(@party_actors)
$game_party.set_battle_member(@battle_actors)
return_scene
when 2 # ?????
Sound.play_cancel
hide_confirm_window
end
end
end
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
def show_confirm_window
if @battle_member_window.active
@last_active_window = @battle_member_window
else
@last_active_window = @party_member_window
end
@battle_member_window.active = false
@party_member_window.active = false

@confirm_window.draw_item(0, $game_party.battle_members.size > 0)
@confirm_window.open
@confirm_window.active = true
end
#--------------------------------------------------------------------------
# ? ???????????
#--------------------------------------------------------------------------
def hide_confirm_window
@confirm_window.active = true
@confirm_window.close
@last_active_window.active = true
end
end

#???????????????????????????????????????

#==============================================================================
# ¦ Scene_Battle
#==============================================================================

class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ? ?????????????????
#--------------------------------------------------------------------------
alias wait_for_message_KGC_LargeParty wait_for_message
def wait_for_message
return if @ignore_wait_for_message # ?????????????????

wait_for_message_KGC_LargeParty
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
alias display_level_up_KGC_LargeParty display_level_up
def display_level_up
@ignore_wait_for_message = true

display_level_up_KGC_LargeParty

exp = $game_troop.exp_total * KGC::LargeParty::STAND_BY_EXP_RATE / 1000
$game_party.stand_by_members.each { |actor|
if actor.exist?
actor.gain_exp(exp, KGC::LargeParty::SHOW_STAND_BY_LEVEL_UP)
end
}
@ignore_wait_for_message = false
wait_for_message
end
#--------------------------------------------------------------------------
# ? ?????????????
#--------------------------------------------------------------------------
alias start_party_command_selection_KGC_LargeParty start_party_command_selection
def start_party_command_selection
if $game_temp.in_battle
@status_window.index = 0
end

start_party_command_selection_KGC_LargeParty
end

if KGC::LargeParty::USE_BATTLE_PARTYFORM
#--------------------------------------------------------------------------
# ? ?????????????
#--------------------------------------------------------------------------
alias create_info_viewport_KGC_LargeParty create_info_viewport
def create_info_viewport
create_info_viewport_KGC_LargeParty

@__command_partyform_index =
@party_command_window.add_command(Vocab.partyform_battle)
@party_command_window.draw_item(@__command_partyform_index,
$game_party.battle_partyform_enable?)
end
#--------------------------------------------------------------------------
# ? ?????????????
#--------------------------------------------------------------------------
alias update_party_command_selection_KGC_LargeParty update_party_command_selection
def update_party_command_selection
if Input.trigger?(Input::C)
case @party_command_window.index
when @__command_partyform_index # ??????
unless $game_party.battle_partyform_enable?
Sound.play_buzzer
return
end
Sound.play_decision
process_partyform
return
end
end

update_party_command_selection_KGC_LargeParty
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def process_partyform
Graphics.freeze
snapshot_for_background
$scene = Scene_PartyForm.new(0, Scene_PartyForm::HOST_BATTLE)
$scene.main
$scene = self
@status_window.refresh
perform_transition
end
end
end
Revenir en haut Aller en bas
https://rpg-maker-vx.bbactif.com
Kay0077
Poulet trizo Lv.3
Poulet trizo Lv.3
Kay0077


Masculin Age : 29
Inscrit le : 14/03/2010
Messages : 36

Script Invocations + Formation Empty
MessageSujet: Re: Script Invocations + Formation   Script Invocations + Formation Icon_minitimeMar 16 Mar 2010 - 13:00

Invocation:
Code:
#===============================================================
# ● [VX] ◦ Système d'invocation complet
#--------------------------------------------------------------
# ◦ Par Blockade,
# ◦ http://rpg-maker-vx.bbactif.com/forum.htm
# ◦ Crée le
# ◦ Version 1.0
# ◦ Remerciment à Dargor, Lettuce, Sihn
#--------------------------------------------------------------
#===============================================================
#===============================================================
#  Notes de version
#---------------------------------------------------------------
# Version 1.0
#  - Une vrai gestion des invocations, avec un option s'ajoutant au menu
#  - Possibilité d'augmenter/baisser les caractéristique de l'invocation avec des objets
#  - Possibilité d'apprendre des sorts au invocation, via des objets
#  - Possibilité d'équiper une invocation avec des armes/armures
#  - 2 mode de progression : Soit avec le niveau de l'invoqueur, soit par méthode normale, c'est celle qui fini le combat qui amasse l'expérience
#  - Désactivation de l'option qui s'ajoute au menu par un interrupteur
#  - Possibilité de faire que les objets soit réservés à certaines invocations
#  - Possibilité de définir un seuil de caractéristiques a ne pas franchir par défaut et pour chaque objet (Explications viendront avec le tutoriel)
#  - Adaptable à presque tous les systèmes de combat (SABS (7.0 mini), SBS (2.6 mini), Combat normal, GTBS (Marche sans rajout normalement)
#  - Gestions des Invocateurs multiples
#===============================================================

#===============================================================
#  Utilisation
#---------------------------------------------------------------
# > Prise en main rapide (avancé)
#  Ceci est un gros système, si vous voulez commencez à l'utiliser tout de suite, vous pouvez, lisez attentivement
#  le module Config_Invoc
#
# > Prise en main normale
#  Lisez le tutoriel disponible ici :
#===============================================================

#===============================================================
#  FAQ
#---------------------------------------------------------------
# Q: J'ai installé le script mais le menu d'invocation ne s'affiche pas.
# R: Par défaut le menu d'invocation n'est pas affiché, regardez dans le module de configuration Interrupteur_activation,
#      activez cet interrupteur et le menu apparaitra
#
# Q: J'ai un script de menu, mais quand le menu d'invocation est disponible, le contenu deborde sur la fenêtre d'en
#      dessous !
# R: Modifiez la valeur de Affichage_max, par defaut c'est 7, mettez 6 et regardez si elle déborde toujours, si c'est le
#      cas baissez la valeur !
#
#Q: J'utilise le SBS, mais l'invocation ne se retire pas correctement à la fin du combat et j'ai des bugs.
#R: Pensez bien a mettre la constante Systeme_combat égale à 1 pour qu'il prenne en charge la compabilité SBS.
#
# Q: J'utilise ton rapport de combat, les scripts sont compatibles ?
# R: Oui bien sur, mais assurez vous de donner la valeur true à Utiliser_rapport_combat, et d'utiliser la dernière
#      version (v3)
#
# Q: J'ai configuré les objets comme il faut, mais dans la scene de l'augmentation des caractéristiques, l'objet est
#      reconnu mais donne aucune caractéristiques et/ou les limite sont pas définie comme elle devraient
# R: Verifiez bien que les tag utilisés sont bon, ils sont très sensible à la case.
#===============================================================

#===============================================================
#  Config_Invoc :: Début du Module de configuration
#===============================================================
module Config_Invoc
#==============================================
# >>> Configuration générale
#==============================================
#--------------------------------------
# >> Information système
#--------------------------------------
# > Les invocations
# SI vous utilisez l'ABS cette section ne vous concerne pas, allez voir un peu plus bas (Invocation ABS)
# Mettez l'id de l'invoqueur (personnage qui possède la compétence d'invocation, par exemple le héros qui a pour iD 5
# Puis [[, ensuite l'id de l'invocation, puis la compétence qui l'invoque, par exemple 8,83 puis refermez les crochets ]
# Vous avez alors : { 5 => [[8,83]
# Si vous voulez une autre invocation pour cet invocateur, on rajoute une virgule, puis un [ et on recommence avec
# l'id de l'invocation et la compétence qui l'invoque
# Pour fermer la balise il faut fermer le grand array donc rajoutez un ] ( Vous devrez avoir ca : { 5 => [[8,83]] )  puis le
# hash donc au final nous avons { 5 => [[8,83]]}.
# Si vous voulez un autre invoqueur pas de problème on réouvre le hash : { 5 => [[8,83]], et met une virgule à la place
# du }. Après on recommence à la première étape on met l'id de l'invoqueur etc...
# On peut avoir à la fin : { 5 => [[8,83]],
#                                          4 => [[9,84],
#                                                      [10,85]]}
# L'invoqueur qui a pour ID 5 à une invocation, celui qui a pour ID 4 à deux invocations. Vous êtes pas obligé de passer
# des lignes c'est juste plus clair !
Invocations = {
2 => [[9,84],
          [10,85],
          [11,86]],
   
1 => [[8,83]]}
         
# > Texte dans le menu
Text_menu_invoc = "Invocations"

# > Nombre de choix affichable en 1 fois dans Scene_Menu
# Permet d'élargir la fenêtre de commande si par exemple vous utilisez un menu modifié, comme
# celui de moghunter, mettez 6 ! Si vous comprenez pas ce que ca fait mettez 4 par exemple,
# lancez le jeu, ouvrez le menu et regardez !
Affichage_max = 7

# > Le système de combat utilisé
# 0 : Combat normal
# 1 : SBS
# 2 : ABS (Version 7.0 min)
# 3 : GTBS
Systeme_combat = 0

# > Invocation pour le système ABS
# /!\ A configurer uniquement si vous utilisez l'ABS
# Mettez juste l'ID des invocations dans cet array : [8,9,10,11] considère
# que les héros qui ont pour ID 8,9,10,11 sont des invocations
Invocations_abs = [8,9,10,11]

# > Si vous utilisez mon rapport de combat (V3 mini)
Utiliser_rapport_combat = false

# > Le numéro de l'interrupteur à activer pour afficher le menu Invocations
Interrupteur_activation =  1

# > Mode de progression des invocations
# 0 : Mode de progression à la Somnia Memorias, l'invocation prend le level de l'invoqueur
# 1 : L'invocation gagne l'XP reçue en fin de combat
Mode_progression = 0

#==============================================
# >>> Configuration des menus principaux
#==============================================
#--------------------------------------
# >> Caractéristiques supplémentaires
#--------------------------------------
Nom_carac_gene = "Caractéristiques :"  # "Titre" d'affichage des caractéristiques
Icone_carac_gene = 131                            # Icône pour les caractéristiques
Nom_pre = "Précision :"                              # Nom pour la Précision
Nom_esq = "Esquive :"                                # Nom pour l'Esquive
Nom_cri =    "Critiques :"                              # Nom pour les Critiques

#--------------------------------------
# >> Menu principal listant les invocations
#--------------------------------------
# > 1ére  fenêtre du haut
Titre_menu_principal = "Invocations"  # Titre dans la 1ere fenêtre du haut
Alignement_titre  = 1                              # Alignement du titre (0:Droite, 1:Milieu, 2:Gauche)

# > 2éme fenêtre du haut
Text_aucune_invoc_dispo = "Aucune invocation disponible" # Si aucune invocation est disponible
Text_invoc_dispo = "Perfectionner les aptitudes de %s"        # Texte affiché lorsque le curseur est sur l'invoc (%s est le nom de l'invoc)
Alignement_invoc_2 = 1                                                                # Alignement du titre (0:Droite, 1:Milieu, 2:Gauche)

#--------------------------------------
# >> Sous-menu principal affichant les caractéristiques
#--------------------------------------
# > Informations sur l'équipement
Titre_equipement = "Équipement :"    # Titre affiché au dessus des équipements
Icone_equipement =  40                        # Icône affichée à coté de Titre_equipement
Pas_arme        = "Aucune arme"        # Si pas d'arme équipée
Pas_arme2      = "Aucune arme"        # Si pas d'arme équipée (Si ambidextre)
Pas_bouclier    ="Aucun bouclier"      # Si pas de bouclier equipé
Pas_casque      = "Aucun casque"      # Si pas de casque équipé
Pas_armure      =  "Aucune armure"    # Si pas d'armure équipée
Pas_accesoire  = "Aucun accessoire"  # Si pas d'accessoire équipé

# > Configuration de la fenêtre de commande
# Nom des commandes
Command_entrainer    = "Entrainer"    # Nom de la commande pour l'affichage du menu d'augmentation des carac' 
Command_enseigner  = "Enseigner"  # Nom de la commande pour l'affichage du menu d'apprentissage des sorts
Command_equiper      = "Équiper"      # Nom de la commande pour l'affichage du menu d'équipement
Command_revenir        = "Revenir"        # Nom de la commande pour revenir au menu précédent

# Taille & position de la fenêtre
Taille_window_command = 170 # Taille de la fenêtre de commande
Posx_window_command = 325  # Position X de la fenêtre de commande
Posy_window_command = 70    #Position Y de la fenêtre de commande

# > Description affichée dans l'Help_Window (Celle su haut)
# /!\ ICI %s est le nom de l'invocation
Description1 = "Améliorer les caractéristiques de %s."                    # Si le curseur est sur le 1er choix
Description2 = "Apprendre des nouveaux sorts à %s."                    # Si le curseur est sur le 2éme choix
Description3 = "Changer l'équipement de %s."                                  # Si le curseur est sur le 3éme choix
Description4 = "Revenir à l'écran de sélection des invocations."    # Si le curseur est sur le 4éme choix


#==============================================
# >>> Configuration de la scene d'augmentation des stats
#==============================================
#--------------------------------------
# >> Information système
#--------------------------------------
# > Les limites par defaut de chaque caractéristiques
Max_limite_hp = 9999  # Les Hp (Max : 9999)
Max_limite_mp = 9999  # Les Mp (Max : 9999)
Max_limite_atk = 999      # L'attaque (Max : 999)
Max_limite_def = 999      # La defense (Max : 999)
Max_limite_int = 999      # L'intelligence (Max : 999)
Max_limite_agi = 999      # L'agilité (Max : 999)
Max_limite_pre = 100  # La précision( Si 100, alors l'invoc ne ratera aucun coup)
Max_limite_esq = 65    # L'esquive (Si 100, l'invoc esquivera TOUT les coups (Pas d'intêret !) 65-75 est une bonne moyenne
Max_limite_cri = 50        #  Les critiques (Si 100, l'invoc fera tout le temps des coup critiques)

# /!\ Niveau avancé ne pas modifier si vous n'êtes pas sur de vous
# > Tag de récupération des infos
# Les tag permettant de récupérer les info dans la BDD. Attention la case est très sensible
# respecter les espaces et majuscule.
# /!\ La valeur doit être collée au tag si vous mettez "truc=", dans la BDD, ça sera "truc=15"
# si vous voulez un espace mettez "truc= " ou ça sera "truc= 15" dans ce cas la.

# Modification des caractéristiques
Tag_hp_plus  = "Invoc_hp="      # Pour l'augmentation des Hp
Tag_mp_plus  = "Invoc_mp="      # Pour l'augmentation des Mp
Tag_atk_plus  = "Invoc_atk="      # Pour l'augmentation d'attaque
Tag_def_plus  = "Invoc_def="      # Pour l'augmentation de défense
Tag_int_plus    = "Invoc_int="      # Pour l'augmentation d'intelligence
Tag_agi_plus  = "Invoc_agi="    # Pour l'augmentation d'agilité
Tag_pre_plus  = "Invoc_pre="    # Pour l'augmentation de précision
Tag_esq_plus  = "Invoc_esq="    # Pour l'augmentation d''esquive
Tag_cri_plus    = "Invoc_cri="      # Pour l'augmentation de critiques

# Modifications des limites
Tag_hp_limit  = "Limite_hp="    # Pour la limite des Hp
Tag_mp_limit  = "Limite_mp="    # Pour la limite des Mp
Tag_atk_limit  = "Limite_atk="    # Pour la limite d'attaque
Tag_def_limit  = "Limite_def="    # Pour la limite de défense
Tag_int_limit    = "Limite_int="      # Pour la limite d'intelligence
Tag_agi_limit  = "Limite_agi="  # Pour la limite d'agilité
Tag_pre_limit  = "Limite_pre="  # Pour la limite de précision
Tag_esq_limit  = "Limite_esq="  # Pour la limite d'esquive
Tag_cri_limit    = "Limite_cri="    # Pour la limite de critiques

# Reservations à certaines invocations
Tag_invoc_spe = "Invoc_reserve="

# Tag qui indique au script que c'est un objet pour les invocations
Tag_confirm_obj_carac = "<invoc_carac>"

#---------------------------------------------
# >> Personnalisation des fenêtres
#----------------------------------------------
# > Configuration de la fenêtre de confirmation
Taille_fenetre = 222                    # Taille de la fenêtre
Texte0 = "Donner la gemme"    # Texte qui confirme l'application de l'objet pour augmenter les caractéristiques
Texte1 = "Annuler"                      # Texte d'annulation
Index_defaut = 0                          # Positionnement du curseur par défaut (0 sur Texte0 et 1 sur Texte 1)

# > Nom dans la fenêtre d'affichage des modifications de carac' et des limites (bas-droite)
Nom_page1 = "Bonus :"  # Nom en cas d'affichage des bonus
Nom_page2 = "Limites :" # Nom en cas d'affichage des limites

# > Configuration des icones dans la fenêtre d'affichage des modifications de carac' et des limites (bas-droite)
Icon_hp  = 208                      # Icone pour les HP
Icon_mp  = 209                      # Icone pour les MP
Icon_atk_plus      = 120        # Icone pour l'attaque (si positif)
Icon_atk_moins    = 124      # Icone pour l'attaque (si negatif)
Icon_def_plus      = 121      # Icone pour la defense (si positif)
Icon_def_moins  = 125      # Icone pour la défense (si negatif)
Icon_int_plus        = 122      # Icone pour l'intelligence (si positif)
Icon_int_moins    = 126      # Icone pour l'intelligence (si negatif)
Icon_agi_plus      = 123      # Icone pour l'agilité (si positif)
Icon_agi_moins  = 127      # Icone pour l'agilité (si negatif)
Icon_pre = 23                        # Icone pour la précision
Icon_esq = 158                      # Icone pour l'esquive
Icon_cri =  110                      # Icone pour les critiques

# > Texte si il n'y a plus/pas d'objet disponibles
Text_aucun_objet = "Aucun objet disponible"  # Texte dans la fenêtre d'aide
Alignement_aucun_objet = 1                              # Alignement du texte (0:Droite, 1:Milieu, 2:Gauche)

#==============================================
# >>> Configuration de la scene d'apprentisage des sorts
#==============================================
#--------------------------------------
# >> Information système
#--------------------------------------
# /!\ Niveau avancé ne pas modifier si vous n'êtes pas sur de vous
# > Tag de récupération des infos
# Les tag permettant de récupérer les info dans la BDD. Attention la case est très sensible
# respecter les espaces et majuscule.
# /!\ La valeur doit être collée au tag si vous mettez "truc=", dans la BDD, ca sera "truc=15"
# si vous voulez un espace mettez "truc= " ou ca sera "truc= 15" dans ce cas la.

# Tag qui indique au script que c'est un objet pour les invocations
Tag_confirm_skill_obj = "<invoc_sort>"

# Reservations à certaines invocations
Tag_invoc_skill = "Sort_reserve="

# Tag pour recupérer l'ID du sort appris
Tag_skill_learn = "Sort_appris="

#--------------------------------------
# >> Configuration des textes
#--------------------------------------
# > Si il n'y a pas/plus d'objet disponible
Text_pas_obj_skill = "Aucun objet disponible"      # Texte dans l'Help_Window
Alignement_pas_obj_skill = 1                                    # Alignement de Text_pas_obj_skill
Text_aucun_sort_defini = "Aucun sort défini"          # Texte affiché dans la fenêtre qui affiche le sort appris avec l'objet 
Text_aucun_sort_connu = "Pas de sorts connus" # Texte si l'invocation ne connait pas encore de sorts


# >Si un objet est disponible
Alignement_description = 0                                # Alignement de la description de l'objet (0:Droite, 1:Milieu, 2:Gauche)
Text_sort_appris = "Sort appris :"                      # Texte dans la fenêtre qui affiche le sort appris avec l'objet
Text_sort_connu = "Sort connu :"                      # Texte affiché dans la fenêtre qui liste les sorts (Si un sort)
Text_sorts_connus = "Sorts connus :"            # Texte affiché dans la fenêtre qui liste les sorts (Si plusieurs sorts)

# > Configuration de la fenêtre de confirmation
Taille_fenetre_skill = 222                    # Taille de la fenêtre
Texte0_skill = "Apprendre le sort"      # Texte qui confirme l'application de l'objet pour augmenter les caractéristiques
Texte1_skill= "Annuler"                        # Texte d'annulation
Index_defaut_skill = 0                          # Positionnement du curseur par défaut (0 sur Texte0 et 1 sur Texte 1)

#--------------------------------------
# >> Configuration des sons
#--------------------------------------
# > Lors de l'apprentissage d'un sort
Audio_play_new_skill = "Audio/SE/Chime2"  # Son joué lors de l'apprentissage d'un sort
Volume_play_new_skill = 80                            # Volume du son
Tempo_play_new_skill = 100                          # Tempo du son

end
#===============================================================
#  Config_Invoc :: Fin du Module de configuration
#===============================================================




#==============================================================================
# ** Scene_Invoc
#------------------------------------------------------------------------------
#  Gére les invocations
#==============================================================================
class Scene_Invoc < Scene_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #    menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
    @invoc = []
    determine_invoc
  end
 
  #--------------------------------------------------------------------------
  # * Détermine les invocations
  #--------------------------------------------------------------------------
  def determine_invoc
  @invoc =[]
    for actor in $game_party.members
      invocateur_dans_equipe = false
      invocateur_dans_equipe = true if Config_Invoc::Invocations.include?(actor.id)
      if invocateur_dans_equipe
        liste_invoc = Config_Invoc::Invocations[actor.id]
        for i in 0...Config_Invoc::Invocations[actor.id].size
          invoc_en_cours = liste_invoc[i]
          if actor.skills.include?($data_skills[invoc_en_cours[1]])
            $game_actors[invoc_en_cours[0]].change_level(actor.level,false) if Config_Invoc::Mode_progression == 0
            $game_actors[invoc_en_cours[0]].recover_all
            @invoc.push($game_actors[invoc_en_cours[0]])
          end
        end
      end
    invocateur_dans_equipe = false
  end
  end
 
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    @invoc_window = Window_Invoc.new(@invoc,@menu_index)
    @help_window = Window_Help_Invoc.new
    @description_window = Window_Description_Invoc.new
  end
 
  #--------------------------------------------------------------------------
  # * Terminate
  #--------------------------------------------------------------------------
  def terminate
    super
    @invoc_window.dispose
    @help_window.dispose
    @description_window.dispose
  end
 
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    @invoc_window.update
    @help_window.update
    @description_window.update
    if @invoc != []
      invoc_actuelle = @invoc[@invoc_window.index].name
      @description_window.set_text(sprintf(Config_Invoc::Text_invoc_dispo,invoc_actuelle),Config_Invoc::Alignement_invoc_2)
    else
      @description_window.set_text(Config_Invoc::Text_aucune_invoc_dispo,Config_Invoc::Alignement_invoc_2)   
    end
    @help_window.set_text(Config_Invoc::Titre_menu_principal,Config_Invoc::Alignement_titre)
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Menu.new(4)
    elsif Input.trigger?(Input::C)
      if @invoc != []
        $game_party.last_actor_index = @invoc_window.index
        Sound.play_decision
        $scene = Scene_Invoc_Stats.new(@invoc[@invoc_window.index],@invoc_window.index)
      else
        Sound.play_buzzer
      end
    end
  end
 
end
#==============================================================================
# ** Window_Help_Invoc
#------------------------------------------------------------------------------
#  Affiche le titre de la scène dans la sélection des invocations
#==============================================================================
class Window_Help_Invoc < Window_Base
  #--------------------------------------------------------------------------
  # * Initialize
  #--------------------------------------------------------------------------
  def initialize
    super(0,0,544,48)
  end
  #--------------------------------------------------------------------------
  # * Affiche le texte dans la fenêtre
  #--------------------------------------------------------------------------
  def set_text(text,alignement=0)
    self.contents.clear
    self.contents.draw_text(0,-5,contents.width,WLH,text,alignement)
  end
end

#==============================================================================
# ** Window_Description_Invoc
#------------------------------------------------------------------------------
#  Affiche une description dans la scene de sélection des invocations
#==============================================================================
class Window_Description_Invoc < Window_Base
  #--------------------------------------------------------------------------
  # * Initialize
  #--------------------------------------------------------------------------
  def initialize
    super(0,48,544,48)
  end
 
  #--------------------------------------------------------------------------
  # * Affiche le texte dans la fenêtre
  #--------------------------------------------------------------------------
  def set_text(text,alignement=0)
    self.contents.clear
    self.contents.draw_text(0,-5,contents.width,WLH,text,alignement)
  end
end

#==============================================================================
# ** Window_Invoc
#------------------------------------------------------------------------------
#  Gère les invocations
#==============================================================================
class Window_Invoc < Window_Selectable
  def initialize(invoc,menu_index)
    super(0,96,544, 320)
    @invoc = invoc
    @column_max = 2
    height = 320
    extra_height = (96 * (@invoc.size) / 2)
    height += extra_height  if @invoc.size > 8
    @index = menu_index
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end

  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    @invoc = []
    for actor in $game_party.members
      invocateur_dans_equipe = false
      invocateur_dans_equipe = true if Config_Invoc::Invocations.include?(actor.id)
      if invocateur_dans_equipe
        liste_invoc =Config_Invoc::Invocations[actor.id]
        for i in 0...Config_Invoc::Invocations[actor.id].size
          invoc_en_cours = liste_invoc[i]
        @invoc.push($game_actors[invoc_en_cours[0]]) if actor.skills.include?($data_skills[invoc_en_cours[1]])
        end
      end
    invocateur_dans_equipe = false
  end
    @item_max = @invoc.size
    for i in 0...@item_max
      draw_item(i)
    end
  end
 
  #--------------------------------------------------------------------------
  # * Affiche les invocations
  #--------------------------------------------------------------------------
  def draw_item(index)
      x = 272 * (index % 2)
      y = 96 * (index / 2)
      @invoc[index].name
      draw_actor_face(@invoc[index], x + 2, y + 2, 92)
      x += 104
      draw_actor_name(@invoc[index], x, y)
      draw_actor_level(@invoc[index], x, y + WLH * 1)
      draw_actor_hp(@invoc[index], x, y + WLH * 2)
      draw_actor_mp(@invoc[index], x , y + WLH * 3)
  end
 
  #--------------------------------------------------------------------------
  # * Update cursor
  #--------------------------------------------------------------------------
  def update_cursor
  if @index < 0
      self.cursor_rect.empty
    return
    end
    row = @index  / @column_max
    if row < self.top_row
      self.top_row = row
    end
    if row > self.top_row + (self.page_row_max - 1)
      self.top_row = row - (self.page_row_max - 1)
    end
    x = 272 * (@index % 2)
    y = @index / @column_max * 96 - self.oy
    self.cursor_rect.set(x, y, (contents.width-32)/2, 96)
  end
 
  #--------------------------------------------------------------------------
  # * Get Top Row
  #-------------------------------------------------------------------------- 
  def top_row
    return self.oy / 96
  end
  #--------------------------------------------------------------------------
  # * Set Top Row
  #    row : row shown on top
  #-------------------------------------------------------------------------- 
  def top_row=(row)
    if row < 0
      row = 0
    end
    if row > row_max - 1
      row = row_max - 1
    end
    self.oy = row * 96
  end
  #--------------------------------------------------------------------------
  # * Get Number of Rows Displayable on 1 Page
  #-------------------------------------------------------------------------- 
  def page_row_max
    return 3
  end

 
end

#==============================================================================
# ** Scene_Invoc_Stats
#------------------------------------------------------------------------------
#  Sous- menu principal : Affiche les stats des invocations et propose les choix
#==============================================================================
class Scene_Invoc_Stats < Scene_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #    menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(invoc,menu_index_old,index_invoc=0)
    @invoc = invoc
    @menu_index_old = menu_index_old
    @index_invoc = index_invoc
  end
 
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    @help_window = Window_Help.new
    @stat_invoc_window = Window_Stat_Invoc.new(@invoc)
    create_command_window
  end
  #--------------------------------------------------------------------------
  # * Crée la fenêtre de commande
  #--------------------------------------------------------------------------
  def create_command_window
    s0 = Config_Invoc::Command_entrainer
    s1 = Config_Invoc::Command_enseigner
    s2 = Config_Invoc::Command_equiper
    s3 = Config_Invoc::Command_revenir
    @selection_window = Window_Command.new(Config_Invoc::Taille_window_command , [s0,s1,s2,s3])
    @selection_window.x = Config_Invoc::Posx_window_command
    @selection_window.y = Config_Invoc::Posy_window_command
    @selection_window.index = @index_invoc
  end
 
  #--------------------------------------------------------------------------
  # * Terminate
  #--------------------------------------------------------------------------
  def terminate
    super
    @stat_invoc_window.dispose
    @selection_window.dispose
    @help_window.dispose
  end
 
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    @help_window.update
    @stat_invoc_window.update
    @selection_window.update
    case @selection_window.index
        when 0
          @help_window.set_text(sprintf(Config_Invoc::Description1,@invoc.name))
        when 1
          @help_window.set_text(sprintf(Config_Invoc::Description2,@invoc.name))     
        when 2
          @help_window.set_text(sprintf(Config_Invoc::Description3,@invoc.name))
        when 3
          @help_window.set_text(sprintf(Config_Invoc::Description4,@invoc.name))
      end
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Invoc.new(@menu_index_old)
    elsif Input.trigger?(Input::C)
      Sound.play_decision
      case @selection_window.index
        when 0
          $scene = Scene_Invoc_Carac.new(@invoc,@menu_index_old,@selection_window.index)
        when 1
          $scene = Scene_Skill_Carac.new(@invoc,@menu_index_old,@selection_window.index)
        when 2
          $scene = Scene_Equip_Invoc.new(@invoc,@menu_index_old,@selection_window.index)
        when 3
          $scene = Scene_Invoc.new(@menu_index_old)
      end
    end
  end
end

#==============================================================================
# ** Scene_Invoc_Stats
#------------------------------------------------------------------------------
#  Affiche les stats des invocations
#==============================================================================
class Window_Stat_Invoc < Window_Base
  def initialize(invoc)
    super(0,56,544, 360)
    @invoc = invoc
    afficher_fiche
    afficher_carac
    afficher_equip
  end
 
  #--------------------------------------------------------------------------
  # * Affiche le faceset, le level et les barres Hp/MP
  #--------------------------------------------------------------------------
  def afficher_fiche
      x = 0 ; y = 0
      draw_actor_face(@invoc, x + 2, y + 2, 92)
      x += 104
      draw_actor_name(@invoc, x, y)
      draw_actor_level(@invoc, x, y + WLH * 1)
      draw_actor_hp(@invoc, x, y + WLH * 2)
      draw_actor_mp(@invoc, x , y + WLH * 3)
    end
   
  #--------------------------------------------------------------------------
  # * Affiche les caractéristiques
  #--------------------------------------------------------------------------
    def afficher_carac
      x = 0  ; y = WLH * 5
      self.contents.font.color = system_color
      draw_icon(Config_Invoc::Icone_carac_gene,x,y)
      self.contents.draw_text(x+25,y,contents.width,WLH,Config_Invoc::Nom_carac_gene)
      self.contents.font.color = normal_color
      y = WLH * 7 - 15
      for i in 0..3
        draw_actor_parameter(@invoc, x, y + WLH * i, i)
        draw_extra_parameters(@invoc,x,y+WLH*i+WLH*4,i) if i < 3   
      end
    end
   
  #--------------------------------------------------------------------------
  # * Affiche l'équipement des invocs
  #--------------------------------------------------------------------------
    def afficher_equip
      x = 280 ; y = WLH * 6
      self.contents.font.color = system_color
      draw_icon(Config_Invoc::Icone_equipement,x,y)
      self.contents.draw_text(x+25, y, 120, WLH, Config_Invoc::Titre_equipement)
      y = WLH * 7 - 15
      for i in 0..4
        draw_item_name(@invoc.equips[i], x + 20, y + WLH * (i + 1))
        if @invoc.equips[i] == nil
          self.contents.font.color = normal_color
          self.contents.font.color.alpha = 128
          case i
            when 0
              self.contents.draw_text(x + 25, y + WLH * (i + 1),172,WLH, Config_Invoc::Pas_arme)
            when 1
              if @invoc.two_swords_style
                self.contents.draw_text(x + 25, y + WLH * (i + 1),172,WLH,Config_Invoc::Pas_arme2)
              else
                self.contents.draw_text(x + 25, y + WLH * (i + 1),172,WLH,Config_Invoc::Pas_bouclier)
              end
            when 2
              self.contents.draw_text(x + 25, y + WLH * (i + 1),172,WLH,Config_Invoc::Pas_casque)
            when 3
              self.contents.draw_text(x + 25, y + WLH * (i + 1),172,WLH,Config_Invoc::Pas_armure )
            when 4
              self.contents.draw_text(x + 24, y + WLH * (i + 1),172,WLH,Config_Invoc::Pas_accesoire)             
          end
          self.contents.font.color.alpha = 255
          self.contents.font.color = system_color
        end
      end
    end

  #--------------------------------------------------------------------------
  # * Affiche les caractéristiques supplémentaires (Eva,Cri,Hit)
  #--------------------------------------------------------------------------
  def draw_extra_parameters(invoc,x,y,type)
    case type
      when 0
        parameter_name = Config_Invoc::Nom_pre
        parameter_value = invoc.hit
      when 1
        parameter_name = Config_Invoc::Nom_esq
        parameter_value = invoc.eva
      when 2
        parameter_name = Config_Invoc::Nom_cri
        parameter_value = invoc.cri
    end
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 120, WLH, parameter_name)
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 120, y, 36, WLH, parameter_value, 2)
  end
end

#==============================================================================
# ** Scene_Invoc_Carac
#------------------------------------------------------------------------------
#  Scene permettant d'augmenter les caractéristiques de l'invocation
#==============================================================================
class Scene_Invoc_Carac < Scene_Base
  def initialize(invoc,index_invoc,index_old)
    @invoc = invoc
    @menu_index_old = index_old
    @index_invoc = index_invoc
  end
 
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    @page = 1
    @help_window = Window_Help.new
    @stat_invoc_window = Window_Item_Invoc.new(@invoc)
    @stat_invoc_window.page_actuelle(@page)
    @info_stats_invoc_window = Window_Item_Info_Invoc.new
    @info_stats_item_window = Window_Item_Info_Stats.new(@invoc)
    @stat_invoc_window.help_window = [@help_window,@info_stats_item_window]
    @confirm_window = Window_Command.new(Config_Invoc::Taille_fenetre,[Config_Invoc::Texte0,Config_Invoc::Texte1])
    @confirm_window.x =(544 - @confirm_window.width) / 2
    @confirm_window.y = (416 - @confirm_window.height) / 2
    @confirm_window.active = false
    @confirm_window.visible = false
    @confirm_window.index = Config_Invoc::Index_defaut
    update_stat_window
  end
 
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  def update
    super
    if @confirm_window.visible == false
      last_index = @stat_invoc_window.index
      @stat_invoc_window.update
      index = @stat_invoc_window.index
      if last_index != index
        update_stat_window
      end
      @stat_invoc_window.page_actuelle(@page)
      @info_stats_item_window.set_carac(@stat_invoc_window.get_objet,@page)
      @info_stats_invoc_window.update
    else
      @confirm_window.update
    end
    if Input.trigger?(Input::LEFT)
      if @page > 1 and @page <= 2 ; @page -= 1
        else @page = 2 ; end
    elsif Input.trigger?(Input::RIGHT)
        if @page >= 1 and @page < 2 ; @page += 1
          else @page = 1 ; end
    end
  if @confirm_window.visible
    update_confirm
  else
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Invoc_Stats.new(@invoc,@index_invoc,@menu_index_old)
    elsif Input.trigger?(Input::C)
      Input.update
      if @stat_invoc_window.get_objet != nil and @info_stats_invoc_window.aucun_bonus? == false
        update_confirm
      else
        Sound.play_buzzer
      end
    end
  end
 end
 
 #--------------------------------------------------------------------------
  # * Update pour la fenêtre de confirmation
  #--------------------------------------------------------------------------
  def update_confirm
    @stat_invoc_window.active=false
    @confirm_window.visible = true ; @confirm_window.active = true
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @stat_invoc_window.active = true
      @confirm_window.visible = false ; @confirm_window.active = false
      @confirm_window.index = Config_Invoc::Index_defaut
    end
      case @confirm_window.index
        when 0
          if Input.trigger?(Input::C)
            @stat_invoc_window.active= true
            @confirm_window.visible = false ; @confirm_window.active = false
            if @stat_invoc_window.get_objet != nil and @info_stats_invoc_window.aucun_bonus? == false
              Sound.play_decision
              @info_stats_item_window.augmenter_carac(@stat_invoc_window.get_objet.get_limit_carac)
              $game_party.consume_item(@stat_invoc_window.get_objet)
              @stat_invoc_window.refresh
              update_stat_window
              @confirm_window.index = Config_Invoc::Index_defaut
            else
              Sound.play_buzzer
            end
        end
      when 1
      if Input.trigger?(Input::C)
            Sound.play_cancel
            @confirm_window.index = Config_Invoc::Index_defaut
            @stat_invoc_window.active = true
            @confirm_window.visible = false ; @confirm_window.active = false
        end
      end
  end
 
  #--------------------------------------------------------------------------
  # * Termine la scene
  #--------------------------------------------------------------------------
  def terminate
    super
    @help_window.dispose
    @stat_invoc_window.dispose
    @info_stats_invoc_window.dispose
    @info_stats_item_window.dispose
    @confirm_window.dispose
  end
 
  #--------------------------------------------------------------------------
  # * Met a jour la fenêtre de statistiques
  #--------------------------------------------------------------------------
  def update_stat_window
    @carac_invoc = recup_carac
    if @stat_invoc_window.get_objet != nil
      @carac = @stat_invoc_window.get_objet.get_invoc_carac
      @limite_carac = @stat_invoc_window.get_objet.get_limit_carac
      @info_stats_invoc_window.afficher_info(@invoc,@carac_invoc,@carac,@limite_carac)
    else
      @carac = [0,0,0,0,0,0,0,0,0]
      @limite_carac = [0,0,0,0,0,0,0,0,0]
      @info_stats_invoc_window.afficher_info(@invoc,@carac_invoc,@carac,@limite_carac)
    end
  end
  #--------------------------------------------------------------------------
  # * Renvoie les caractéristiques actuelle de l'invoc
  #--------------------------------------------------------------------------
  def recup_carac
    return @invoc.hp,@invoc.mp,@invoc.atk,@invoc.def,@invoc.spi,@invoc.agi,@invoc.hit,@invoc.eva,@invoc.cri
  end
end


#==============================================================================
# ** Window_Item_Invoc
#------------------------------------------------------------------------------
#  Affiche les objets pour augmenter les caractéristiques de l'invocation
#==============================================================================
class Window_Item_Invoc < Window_Selectable
  def initialize(invoc)
    super(0,56,272,246)
    @column_max = 1
    @index = 0
    @invoc = invoc
    refresh
  end

  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    @data = []
    for item in $game_party.items
      if item.is_a?(RPG::Item)
        reserve = item.get_invoc_reserve
        invoc_id = @invoc.id.to_s
        reserve = invoc_id if reserve == []
        @data.push(item) if item.pour_invoc? and reserve.include?(invoc_id)
      end
      end
    @item_max = @data.size
    create_contents
    for i in 0...@data.size
      draw_item(i)
    end
  end
 
  #--------------------------------------------------------------------------
  # * Affiche les objets
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    item = @data[index]
    if item != nil
        rect.width -= 4
        number = $game_party.item_number(item)
        draw_item_name(item, rect.x, rect.y)
        self.contents.draw_text(rect, sprintf(":%2d", number), 2)
    end
  end
 
  #--------------------------------------------------------------------------
  # * Renvoye l'objet en cours
  #--------------------------------------------------------------------------
  def get_objet
    return @data[@index]
  end
   
  #--------------------------------------------------------------------------
  # * Defini la page actuelle
  #--------------------------------------------------------------------------
  def page_actuelle(page)
    @page = page
  end

 
  #--------------------------------------------------------------------------
  # * Update les fenêtre d'aide
  #--------------------------------------------------------------------------
  def update_help
    if @data[index] != nil
      @help_window[0].set_text(@data[index].description)
      @help_window[1].set_carac(@data[index],@page)
    else
    @help_window[0].set_text(Config_Invoc::Text_aucun_objet,Config_Invoc::Alignement_aucun_objet)
    end
  end
end

#==============================================================================
# ** Window_Item_Info_Invoc
#------------------------------------------------------------------------------
#  Affiche les infos sur l'augmentation de caractéristiques
#==============================================================================
class Window_Item_Info_Invoc < Window_Base
  def initialize
    super(272,56,272,360)
  end
 
  #--------------------------------------------------------------------------
  # * Affiche les caractéristiques
  #--------------------------------------------------------------------------
  def afficher_info(invoc,carac_invoc,carac,limit_carac)
    self.contents.clear
    afficher_fiche(invoc)
    afficher_carac(carac_invoc,carac,limit_carac)
  end
Revenir en haut Aller en bas
https://rpg-maker-vx.bbactif.com
Kay0077
Poulet trizo Lv.3
Poulet trizo Lv.3
Kay0077


Masculin Age : 29
Inscrit le : 14/03/2010
Messages : 36

Script Invocations + Formation Empty
MessageSujet: Re: Script Invocations + Formation   Script Invocations + Formation Icon_minitimeMar 16 Mar 2010 - 13:02

Code:
 #--------------------------------------------------------------------------
  # * Affiche le faceset, le level et les barres Hp/MP
  #--------------------------------------------------------------------------
  def afficher_fiche(invoc)
    @invoc = invoc
      x = 0 ; y = 0
      draw_actor_face(@invoc, x + 2, y + 2, 92)
      x += 104
      draw_actor_name(@invoc, x, y)
      draw_actor_level(@invoc, x, y + WLH * 1)
      draw_actor_hp(@invoc, x, y + WLH * 2)
      draw_actor_mp(@invoc, x , y + WLH * 3)
    end
   
  #--------------------------------------------------------------------------
  # * Affiche les caractéristiques
  #--------------------------------------------------------------------------
    def afficher_carac(carac_invoc,carac,limite_carac)
      @carac_invoc = carac_invoc
      @carac = carac
      @limite_carac = limite_carac
      x = 0  ; y = WLH * 5
      self.contents.font.color = system_color
      draw_icon(Config_Invoc::Icone_carac_gene,x,y)
      self.contents.draw_text(x+25,y,contents.width,WLH,Config_Invoc::Nom_carac_gene)
      self.contents.font.color = normal_color
      y = WLH * 6 - 15
      for i in 0..6
        draw_all_parameters(x,y+WLH*i+WLH,i)
      end
    end
  #--------------------------------------------------------------------------
  # * Affiche toutes caractéristiques supplémentaires
  #--------------------------------------------------------------------------
  def draw_all_parameters(x,y,type)
    case type
      when 0
        parameter_name = Vocab::atk
      when 1
        parameter_name = Vocab::def
      when 2
        parameter_name = Vocab::spi
      when 3
        parameter_name = Vocab::agi
      when 4
        parameter_name = Config_Invoc::Nom_pre
      when 5
        parameter_name = Config_Invoc::Nom_esq
      when 6
        parameter_name = Config_Invoc::Nom_cri
    end
    parameter_value = @carac_invoc[type+2]
    parameter_plus = @carac[type+2]
    limit_parameter = @limite_carac[type+2]
    valeur_finale = parameter_value + parameter_plus
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 120, WLH, parameter_name)
    self.contents.font.color = normal_color
    parameter_initial =parameter_value.to_s + " > "
    self.contents.draw_text(x + 100, y, 100, WLH, parameter_initial, 2)
    valeur_finale = limit_parameter if valeur_finale > limit_parameter
    valeur_finale = parameter_value if parameter_value > valeur_finale
    valeur_finale = parameter_value + parameter_plus if parameter_plus < 0
    valeur_finale = 1 if valeur_finale < 1
    self.contents.font.color = power_up_color  if parameter_value < valeur_finale
    self.contents.font.color = power_down_color  if parameter_value > valeur_finale
    self.contents.font.color.alpha = 127  if parameter_value == valeur_finale
    self.contents.draw_text(x+200,y,100,WLH,valeur_finale.to_s)
    self.contents.font.color =normal_color
    self.contents.font.color.alpha = 255
  end
 
  #--------------------------------------------------------------------------
  # * Renvoie true si l'objet ne donne plus de bonus
  #--------------------------------------------------------------------------
  def aucun_bonus?
    @verif = []
    for i in 0..8
    parameter_value = @carac_invoc[i]
    parameter_plus = @carac[i]
    limit_parameter = @limite_carac[i]
    valeur_finale = parameter_value + parameter_plus
    valeur_finale = limit_parameter if valeur_finale > limit_parameter
    valeur_finale = parameter_value if parameter_value > valeur_finale
    if parameter_value == valeur_finale
      @verif.push(true)
    else
    @verif.push(false)
  end
  end
  if @verif.include?(false)
    return false
  else 
    return true
  end
end
end

#==============================================================================
# ** Window_Item_Info_Stats
#------------------------------------------------------------------------------
#  Bonus donnés par l'objet
#==============================================================================
class Window_Item_Info_Stats < Window_Base
  def initialize(invoc)
    super(0,302,272,114)
    @invoc = invoc
  end
 
  #--------------------------------------------------------------------------
  # * Affiche soit les bonus de l'objet ou les limites
  #--------------------------------------------------------------------------
  def set_carac(objet,page)
    self.contents.clear
    if objet == nil
      self.ox = 0
      self.contents = Bitmap.new(width-32, height - 32)
      self.contents.font.color.alpha = 127
      self.contents.draw_text(0,30,contents.width,WLH,"Aucun objet disponible",1)
      self.contents.font.color.alpha = 255
    else
      self.ox = 1
      self.contents = Bitmap.new(width, height - 32)
      carac_up =  objet.get_invoc_carac
      @pdv =carac_up[0]
      @mp = carac_up[1]
      @atk = carac_up[2]
      @defe = carac_up[3]
      @intt = carac_up[4]
      @agi = carac_up[5]
      @pre = carac_up[6]
      @esq = carac_up[7]
      @cri = carac_up[8]
      carac_lim =  objet.get_limit_carac
      @pdv_lim =carac_lim[0]
      @mp_lim = carac_lim[1]
      @atk_lim = carac_lim[2]
      @defe_lim = carac_lim[3]
      @intt_lim = carac_lim[4]
      @agi_lim = carac_lim[5]
      @pre_lim = carac_lim[6]
      @esq_lim = carac_lim[7]
      @cri_lim = carac_lim[8]
      self.contents.font.color = system_color
      if page == 1
        self.contents.draw_text(0,0,100,WLH,Config_Invoc::Nom_page1,1)   
      else
        self.contents.draw_text(0,0,100,WLH,Config_Invoc::Nom_page2,1)   
      end
      self.contents.font.color = normal_color
      # Points de vie
      determine_color(@pdv)
      if page == 2
        self.contents.font.color = power_up_color if @pdv_lim > Config_Invoc::Max_limite_hp
        self.contents.font.color = power_down_color if @pdv_lim < Config_Invoc::Max_limite_hp
        self.contents.font.color = normal_color if @pdv_lim == Config_Invoc::Max_limite_hp
      end
      draw_icon(Config_Invoc::Icon_hp,130,0)
      self.contents.draw_text(155,0,30,WLH,page == 1 ? @pdv : @pdv_lim)   
      # Mp
      determine_color(@mp)
      if page == 2
        self.contents.font.color = power_up_color if @mp_lim > Config_Invoc::Max_limite_mp
        self.contents.font.color = power_down_color if @mp_lim < Config_Invoc::Max_limite_mp
        self.contents.font.color = normal_color if @mp_lim == Config_Invoc::Max_limite_mp
      end
      draw_icon(Config_Invoc::Icon_mp,190,0)
      self.contents.draw_text(215,0,20,WLH,page == 1 ? @mp : @mp_lim)
      # Attaque
      determine_color(@atk)
      if page ==2
        self.contents.font.color = power_up_color if @atk_lim > Config_Invoc::Max_limite_atk
        self.contents.font.color = power_down_color if @atk_lim < Config_Invoc::Max_limite_atk
        self.contents.font.color = normal_color if @atk_lim == Config_Invoc::Max_limite_atk
        icon = Config_Invoc::Icon_atk_plus
      else
        icon = @atk < 0 ? Config_Invoc::Icon_atk_moins : Config_Invoc::Icon_atk_plus
      end
      draw_icon(icon,0,25)
      self.contents.draw_text(25,25,30,WLH,page == 1 ? @atk : @atk_lim)
      # Défense
      determine_color(@defe)
      if page ==2
        self.contents.font.color = power_up_color if @defe_lim > Config_Invoc::Max_limite_def
        self.contents.font.color = power_down_color if @defe_lim < Config_Invoc::Max_limite_def
        self.contents.font.color = normal_color if @defe_lim == Config_Invoc::Max_limite_def
        icon = Config_Invoc::Icon_def_plus
      else
        icon = @defe < 0 ?  Config_Invoc::Icon_def_moins :  Config_Invoc::Icon_def_plus
      end
      draw_icon(icon,0,50)
      self.contents.draw_text(25,50,30,WLH,page == 1 ? @defe : @defe_lim)
      # Intelligence
      determine_color(@intt)
      if page ==2
        self.contents.font.color = power_up_color if @intt_lim > Config_Invoc::Max_limite_int
        self.contents.font.color = power_down_color if @intt_lim < Config_Invoc::Max_limite_int
        self.contents.font.color = normal_color if @intt_lim == Config_Invoc::Max_limite_int
        icon = Config_Invoc::Icon_int_plus
      else
        icon = @intt < 0 ? Config_Invoc::Icon_int_moins : Config_Invoc::Icon_int_plus
      end
      draw_icon(icon,60,25)
      self.contents.draw_text(85,25,30,WLH,page == 1 ? @intt : @intt_lim)
      # Agilitée
      determine_color(@agi)
        if page ==2
          self.contents.font.color = power_up_color if @agi_lim > Config_Invoc::Max_limite_agi
          self.contents.font.color = power_down_color if @agi_lim < Config_Invoc::Max_limite_agi
          self.contents.font.color = normal_color if @agi_lim == Config_Invoc::Max_limite_agi
          icon = Config_Invoc::Icon_agi_plus
        else
          icon = @agi <0  ? Config_Invoc::Icon_agi_moins : Config_Invoc::Icon_agi_plus
        end
      draw_icon(icon,60,50)
      self.contents.draw_text(85,50,30,WLH,page == 1 ? @agi : @agi_lim)
      # Préscision
      determine_color(@pre)
      if page ==2
        self.contents.font.color = power_up_color if @pre_lim > Config_Invoc::Max_limite_pre
        self.contents.font.color = power_down_color if @pre_lim < Config_Invoc::Max_limite_pre
        self.contents.font.color = normal_color if @pre_lim == Config_Invoc::Max_limite_pre
      end
      draw_icon(Config_Invoc::Icon_pre,130,25)
      self.contents.draw_text(155,25,30,WLH,page == 1 ? @pre : @pre_lim )
      # Esquive
      determine_color(@esq)
      if page ==2
        self.contents.font.color = power_up_color if @esq_lim> Config_Invoc::Max_limite_esq
        self.contents.font.color = power_down_color if @esq_lim < Config_Invoc::Max_limite_esq
        self.contents.font.color = normal_color if @esq_lim == Config_Invoc::Max_limite_esq
      end
      draw_icon(Config_Invoc::Icon_esq,130,50)
      self.contents.draw_text(155,50,30,WLH,page == 1 ? @esq : @esq_lim)
      # Critique
      determine_color(@cri)
        if page ==2
        self.contents.font.color = power_up_color if @cri_lim > Config_Invoc::Max_limite_cri
        self.contents.font.color = power_down_color if @cri_lim < Config_Invoc::Max_limite_cri
        self.contents.font.color = normal_color if @cri_lim == Config_Invoc::Max_limite_cri
      end
      draw_icon(Config_Invoc::Icon_cri,190,25)
      self.contents.draw_text(215,25,20,WLH,page == 1 ? @cri : @cri_lim)
      self.contents.font.color = normal_color
    end
    end
   
  #--------------------------------------------------------------------------
  # * Augmente les caractéristiques
  #--------------------------------------------------------------------------
  def augmenter_carac(limit_carac)
    @invoc.ajouter_carac(@invoc,@pdv,@mp,@atk,@defe,@intt,@agi,@pre,@esq,@cri,limit_carac)
  end
 
  #--------------------------------------------------------------------------
  # * Détermine la couleur du texte (Uniquement pour la page 1)
  #--------------------------------------------------------------------------
  def determine_color(carac)
      self.contents.font.color = power_up_color if carac >0
      self.contents.font.color = power_down_color if carac < 0
      self.contents.font.color = normal_color if carac == 0
  end
end


#==============================================================================
# **String
#------------------------------------------------------------------------------
#  Classe qui gère les objets de type String.
#==============================================================================
class String
  #--------------------------------------------------------------------------
  # * Découpe la note ligne par ligne
  #--------------------------------------------------------------------------
  def decoupe
    bloc = []
    self.split(/[\r\n]+/).each { |line| bloc.push(line) }
    return bloc
  end
end

#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  Gère les touts les paramètres des héros
#==============================================================================
class Game_Actor < Game_Battler
  attr_accessor :hit_plus
  attr_accessor :esq_plus
  attr_accessor :cri_plus
  #--------------------------------------------------------------------------
  # * Object Initialization
  #    actor_id : actor ID
  #--------------------------------------------------------------------------
  def initialize(actor_id)
    super()
    setup(actor_id)
    @last_skill_id = 0
    @hit_plus = 0
    @esq_plus = 0
    @cri_plus = 0
  end
    #--------------------------------------------------------------------------
  # * Get Hit Rate
  #--------------------------------------------------------------------------
  def hit
    if two_swords_style
      n1 = weapons[0] == nil ? 95 : weapons[0].hit
      n2 = weapons[1] == nil ? 95 : weapons[1].hit
      n = [n1, n2].min
    else
      n = weapons[0] == nil ? 95 : weapons[0].hit
    end
    return n+@hit_plus
  end
  #--------------------------------------------------------------------------
  # * Get Evasion Rate
  #--------------------------------------------------------------------------
  def eva
    n = 5
    for item in armors.compact do n += item.eva end
    return  n+@esq_plus
  end
  #--------------------------------------------------------------------------
  # * Get Critical Ratio
  #--------------------------------------------------------------------------
  def cri
    n = 4
    n += 4 if actor.critical_bonus
    for weapon in weapons.compact
      n += 4 if weapon.critical_bonus
    end
      return n+@cri_plus
  end
 
 #--------------------------------------------------------------------------
  # * Get Hit Rate
  #--------------------------------------------------------------------------
  def base_hit
    if two_swords_style
      n1 = weapons[0] == nil ? 95 : weapons[0].hit
      n2 = weapons[1] == nil ? 95 : weapons[1].hit
      n = [n1, n2].min
    else
      n = weapons[0] == nil ? 95 : weapons[0].hit
    end
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Evasion Rate
  #--------------------------------------------------------------------------
  def base_eva
    n = 5
    for item in armors.compact do n += item.eva end
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Critical Ratio
  #--------------------------------------------------------------------------
  def base_cri
    n = 4
    n += 4 if actor.critical_bonus
    for weapon in weapons.compact
      n += 4 if weapon.critical_bonus
    end
    return n
  end
 
  #--------------------------------------------------------------------------
  # * La valeur d'augmentation de la précision
  #-------------------------------------------------------------------------- 
  def hit_plus
    return @hit_plus
  end
 
  #--------------------------------------------------------------------------
  # * La valeur d'augmentation de l'esquive
  #-------------------------------------------------------------------------- 
  def esq_plus
    return @esq_plus
  end
 
#--------------------------------------------------------------------------
  # * La valeur d'augmentation des critiques
  #-------------------------------------------------------------------------- 
  def cri_plus
    return @cri_plus
  end

  #--------------------------------------------------------------------------
  # *Donner la nouvelle valeur de la précision
  #-------------------------------------------------------------------------- 
  def hit=(new_hit)
    @hit_plus += new_hit - self.hit
    @hit_plus = [[@hit_plus, -999].max, 999].min
  end
 
  #--------------------------------------------------------------------------
  # *Donner la nouvelle valeur de l'esquive
  #-------------------------------------------------------------------------- 
  def eva=(new_esq)
    @esq_plus += new_esq - self.eva
    @esq_plus = [[@esq_plus, -999].max, 999].min
  end
 
  #--------------------------------------------------------------------------
  # *Donner la nouvelle valeur des critiques
  #-------------------------------------------------------------------------- 
    def cri=(new_cri)
    @cri_plus += new_cri - self.cri
    @cri_plus = [[@cri_plus, -999].max, 999].min
  end
 
end

#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
#  Gére les touts les paramètres des héros
#==============================================================================
class Game_Battler
  #--------------------------------------------------------------------------
  # * Efface les valeurs en plus
  #--------------------------------------------------------------------------
  def clear_extra_values
    @maxhp_plus = 0
    @maxmp_plus = 0
    @atk_plus = 0
    @def_plus = 0
    @spi_plus = 0
    @agi_plus = 0
  end
 
  #--------------------------------------------------------------------------
  # * Ajoute les caractéristiques
  #--------------------------------------------------------------------------
  def ajouter_carac(invoc,pdv,mp,atk,defe,intt,agi,pre,esq,cri,limit_carac)
      # Modifie les pdv
      @maxhp_plus += pdv
      invoc.hp += pdv
      invoc.hp = 1 if invoc.hp == 0
      # Modifie les mp
      mp = -invoc.mp + 1 if mp + invoc.mp < 1
      @maxmp_plus += mp
      invoc.mp += mp
      # Modifie l'atk
      if invoc.atk + atk >0
        if invoc.atk + atk > limit_carac[2] and invoc.atk < limit_carac[2]
          invoc.atk = limit_carac[2] if invoc.atk  <= limit_carac[2]
        else
          @atk_plus += atk if invoc.atk  + atk <= limit_carac[2] or atk < 0
        end
      else
        invoc.atk = 1
      end
      # Modifie la def
      if invoc.def + defe > 0
        if invoc.def  + defe > limit_carac[3] and invoc.def < limit_carac[3]
          invoc.def = limit_carac[3] if  invoc.def  <= limit_carac[3]
        else
          @def_plus += defe if invoc.def  + defe <= limit_carac[3] or defe < 0
        end
      else
        invoc.def = 1
      end
      # Modifie l'int
      if invoc.spi + intt > 0
        if invoc.spi + intt > limit_carac[4] and invoc.spi < limit_carac[4]
          invoc.spi = limit_carac[4] if invoc.spi  <= limit_carac[4]
        else
          @spi_plus += intt if invoc.spi + intt <= limit_carac[4] or intt <0
        end
      else
        invoc.spi = 1
      end
      # Modifie l'agi
      if invoc.agi + agi> 0
        if invoc.agi + agi > limit_carac[5] and invoc.spi < limit_carac[5] 
          invoc.agi = limit_carac[5] if invoc.agi  <= limit_carac[5]
        else
          @agi_plus += agi if invoc.agi  + agi <= limit_carac[5]  or agi < 0 
        end
      else
        invoc.atk = 1
      end
      # Modifie la précision
      if invoc.hit + pre> 0
        if invoc.hit + pre > limit_carac[6] and invoc.hit < limit_carac[6] 
          invoc.hit = limit_carac[6] if invoc.hit  <= limit_carac[6]
        else
          invoc.hit_plus += pre  if invoc.hit + pre <= limit_carac[6]  or pre <0 
        end
      else
        invoc.hit = 1
      end
    # Modifie l'esquive
      if invoc.eva + esq> 0
        if invoc.eva + esq > limit_carac[7] and invoc.eva < limit_carac[7] 
          invoc.eva = limit_carac[7] if invoc.eva  <= limit_carac[7]
        else
          invoc.esq_plus += esq  if invoc.eva + esq <= limit_carac[7]  or esq <0
        end
      else
        invoc.eva = 1
      end
    # Modifie les critiques 
      if invoc.cri + cri> 0
        if invoc.cri + esq > limit_carac[8] and invoc.cri < limit_carac[8] 
          invoc.cri = limit_carac[8] if invoc.cri <= limit_carac[8]
        else
          invoc.cri_plus += cri  if invoc.cri + cri <= limit_carac[8]  or cri < 0 
        end
      else
        invoc.cri = 1
      end
  end
end

#==============================================================================
# ** RPG::Item
#------------------------------------------------------------------------------
#  Gère les objets dans la base de données
#==============================================================================
module RPG
  class Item < UsableItem
  #--------------------------------------------------------------------------
  # * Determine si l'objet est pour une invocation
  #--------------------------------------------------------------------------
    def pour_invoc?
      text = @note.decoupe
      item_pour_invoc = false
      for line in text
        item_pour_invoc = true if line == Config_Invoc::Tag_confirm_obj_carac
      end
    return item_pour_invoc
  end
 
  #--------------------------------------------------------------------------
  # * Prend les caractéristiques de l'objet
  #--------------------------------------------------------------------------
  def get_invoc_carac
      text = @note.decoupe
      pdv = 0 ; mp = 0 ;atk = 0 ;intt= 0 ;
      agi = 0;defe=0 ; pre = 0 ; esq = 0 ; cri = 0
      for line in text
        pdv =  line.delete(Config_Invoc::Tag_hp_plus).to_i if line.include?(Config_Invoc::Tag_hp_plus)
        mp = line.delete(Config_Invoc::Tag_mp_plus).to_i if line.include?(Config_Invoc::Tag_mp_plus)
        atk = line.delete(Config_Invoc::Tag_atk_plus).to_i if line.include?(Config_Invoc::Tag_atk_plus)
        defe = line.delete(Config_Invoc::Tag_def_plus).to_i if line.include?(Config_Invoc::Tag_def_plus)
        intt  = line.delete(Config_Invoc::Tag_int_plus).to_i if line.include?(Config_Invoc::Tag_int_plus)
        agi  = line.delete(Config_Invoc::Tag_agi_plus).to_i if line.include?(Config_Invoc::Tag_agi_plus)
        pre = line.delete(Config_Invoc::Tag_pre_plus).to_i if line.include?(Config_Invoc::Tag_pre_plus)
        esq = line.delete(Config_Invoc::Tag_esq_plus).to_i if line.include?(Config_Invoc::Tag_esq_plus)
        cri = line.delete(Config_Invoc::Tag_cri_plus).to_i if line.include?(Config_Invoc::Tag_cri_plus)
      end
    return pdv,mp,atk,defe,intt,agi,pre,esq,cri
  end
 
  #--------------------------------------------------------------------------
  # * Prend les limites des objets
  #--------------------------------------------------------------------------
  def get_limit_carac
      text = @note.decoupe
      limit_pdv = Config_Invoc::Max_limite_hp ; limit_mp = Config_Invoc::Max_limite_mp ;
      limit_atk =Config_Invoc::Max_limite_atk ;limit_defe=Config_Invoc::Max_limite_def ;
      limit_intt= Config_Invoc::Max_limite_int ; limit_agi = Config_Invoc::Max_limite_agi ;
      limit_pre = Config_Invoc::Max_limite_pre ; limit_esq = Config_Invoc::Max_limite_esq ;
      limit_cri = Config_Invoc::Max_limite_cri
      for line in text
        limit_pdv =  line.delete(Config_Invoc::Tag_hp_limit).to_i if line.include?(Config_Invoc::Tag_hp_limit)
        limit_mp = line.delete(Config_Invoc::Tag_mp_limit).to_i if line.include?(Config_Invoc::Tag_mp_limit)
        limit_atk = line.delete(Config_Invoc::Tag_atk_limit).to_i if line.include?(Config_Invoc::Tag_atk_limit)
        limit_defe = line.delete(Config_Invoc::Tag_def_limit).to_i if line.include?(Config_Invoc::Tag_def_limit)
        limit_intt  = line.delete(Config_Invoc::Tag_int_limit).to_i if line.include?(Config_Invoc::Tag_int_limit)
        limit_agi  = line.delete(Config_Invoc::Tag_agi_limit).to_i if line.include?(Config_Invoc::Tag_agi_limit)
        limit_pre = line.delete(Config_Invoc::Tag_pre_limit).to_i if line.include?(Config_Invoc::Tag_pre_limit)
        limit_esq = line.delete(Config_Invoc::Tag_esq_limit).to_i if line.include?(Config_Invoc::Tag_esq_limit)
        limit_cri = line.delete(Config_Invoc::Tag_cri_limit).to_i if line.include?(Config_Invoc::Tag_cri_limit)
      end
    return limit_pdv,limit_mp,limit_atk,limit_defe,limit_intt,limit_agi,limit_pre,limit_esq,limit_cri
  end
 
  #--------------------------------------------------------------------------
  # * Prend les objets réservé a certaines invocations
  #--------------------------------------------------------------------------
  def get_invoc_reserve
    text = @note.decoupe
    items = []
    for line in text
      items = line.delete(Config_Invoc::Tag_invoc_spe) if line.include?(Config_Invoc::Tag_invoc_spe)
    end
    return items
  end
  end
end

#==============================================================================
# **  Scene_Skill_Carac
#------------------------------------------------------------------------------
#  Scene permettant d'apprendre des sorts aux invocations
#==============================================================================
class Scene_Skill_Carac < Scene_Base
    #--------------------------------------------------------------------------
  # * Object Initialization
  #    menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(invoc,index_invoc,menu_index)
    @menu_index = menu_index
    @invoc = invoc
    @index_invoc = index_invoc
    @page = 1
    @page_max = calc_page_max
  end
 
 
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    @help_window = Window_Help.new
    @face_window = Window_Face_Invoc.new(@invoc,0,56,260,128)
    @skill_learn_window = Window_Skill_Learn.new
    @skill_info_window = Window_Skill_Info.new(@invoc,@page,@page_max)
    @skill_window = Skill_Window.new(@invoc)
    @skill_window.help_window = [@help_window,@skill_learn_window]
    @confirm_window = Window_Command.new(Config_Invoc::Taille_fenetre_skill,[Config_Invoc::Texte0_skill,Config_Invoc::Texte1_skill])
    @confirm_window.x =(544 - @confirm_window.width) / 2
    @confirm_window.y = (416 - @confirm_window.height) / 2
    @confirm_window.active = false
    @confirm_window.visible = false
    @confirm_window.index = Config_Invoc::Index_defaut_skill
  end
 
  #--------------------------------------------------------------------------
  # * Terminate
  #--------------------------------------------------------------------------
  def terminate
    super
    @help_window.dispose
    @face_window.dispose
    @skill_window.dispose
    @skill_learn_window.dispose
    @skill_info_window.dispose
  end
 
  #--------------------------------------------------------------------------
  # * Calcule le nombre de page d'affichage des sorts
  #--------------------------------------------------------------------------
  def calc_page_max
    nb_sorts = @invoc.skills.size.to_f ; affichage_max = 9
    result = (nb_sorts/affichage_max.to_f)
    result = result.truncate + 1 if result != result.truncate
    return result
  end
 
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    if @confirm_window.visible == false
      @help_window.update
      @skill_window.update
      @skill_info_window.update
    else
      @confirm_window.update
      update_confirm
    end
    if Input.trigger?(Input::LEFT)
      if @page > 1 and @page <= @page_max ; @page -= 1
      else @page = @page_max ; end
      @skill_info_window.afficher_sorts(@invoc,@page,@page_max)
    elsif Input.trigger?(Input::RIGHT)
        if @page >= 1 and @page < @page_max ; @page += 1
        else @page = 1 ; end
        @skill_info_window.afficher_sorts(@invoc,@page,@page_max)
    end
    if Input.trigger?(Input::B) and @confirm_window.visible == false
      Sound.play_cancel
      $scene = Scene_Invoc_Stats.new(@invoc,@index_invoc,@menu_index)
    elsif Input.trigger?(Input::C) and @confirm_window.visible == false
      if @skill_window.get_objet == nil
        Sound.play_buzzer
      else
        if @invoc.skills.include?($data_skills[@skill_window.get_objet.get_id_skill])
          Sound.play_buzzer 
        else
          Input.update
          update_confirm
        end
      end
    end
  end
 
  #--------------------------------------------------------------------------
  # * Update_confirm
  #--------------------------------------------------------------------------
  def update_confirm
    @skill_window.active = false
    @confirm_window.visible = true ; @confirm_window.active = true
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @skill_window.active = true
      @confirm_window.visible = false ; @confirm_window.active = false
      @confirm_window.index = Config_Invoc::Index_defaut_skill
      Input.update
    elsif Input.trigger?(Input::C)
      case @confirm_window.index
        when 0
            id_sort = @skill_window.get_objet.get_id_skill
            sort = $data_skills[id_sort]
            Audio.se_play(Config_Invoc::Audio_play_new_skill, Config_Invoc::Volume_play_new_skill, Config_Invoc::Tempo_play_new_skill)
            @invoc.learn_skill(id_sort)
            @page_max = calc_page_max
            $game_party.consume_item(@skill_window.get_objet)
            @skill_window.refresh
            @skill_info_window.afficher_sorts(@invoc,@page,@page_max)
            @skill_window.active = true
            @confirm_window.visible = false ; @confirm_window.active = false
            @confirm_window.index = Config_Invoc::Index_defaut_skill
            Input.update
      when 1
            Sound.play_cancel
            Input.update
            @confirm_window.index = Config_Invoc::Index_defaut_skill
            @skill_window.active = true
            @confirm_window.visible = false ; @confirm_window.active = false
      end
    end
  end
end

#==============================================================================
# ** Window_Face_Invoc
#------------------------------------------------------------------------------
#  Affiche : le nom,faceset, les hp, les mp et le level de l'invoc
#==============================================================================
class Window_Face_Invoc < Window_Base
  def initialize(invoc,x,y,w,h)
    super(x,y,w,h)
    @invoc = invoc
    afficher_face
  end

  #--------------------------------------------------------------------------
  # * Affiche le nom,faceset, les hp, les mp et le level de l'invoc
  #--------------------------------------------------------------------------
  def afficher_face
      x = 0 ; y = 0
      draw_actor_face(@invoc, x + 2, y + 2, 92)
      x += 104
      draw_actor_name(@invoc, x, y)
      draw_actor_level(@invoc, x, y + WLH * 1)
      draw_actor_hp(@invoc, x, y + WLH * 2)
      draw_actor_mp(@invoc, x , y + WLH * 3)
    end
  #--------------------------------------------------------------------------
  # * Affiche les bonus de l'arme/armure sélectionnée (Pour la scène d'équipement)
  #--------------------------------------------------------------------------
  def set_info(item)
    self.contents.clear
    afficher_face
    self.contents.font.color = system_color
    self.contents.draw_text(0,WLH*5-10,contents.width,WLH,Config_Invoc::Nom_page1)
    self.contents.font.color = normal_color
    if item != nil
      atk = item.atk ; defe = item.def
      intt = item.spi ; agi = item.agi
    else
      atk = 0 ; defe = 0 ; intt = 0 ; agi = 0
    end
      # Attaque
      determine_color(atk)
      icon = atk < 0 ? Config_Invoc::Icon_atk_moins : Config_Invoc::Icon_atk_plus
      draw_icon(icon,0,WLH*6)
      self.contents.draw_text(25,WLH*6,30,WLH,atk)
      # Défense
      determine_color(defe)
      icon = defe < 0 ?  Config_Invoc::Icon_def_moins :  Config_Invoc::Icon_def_plus
      draw_icon(icon,60,WLH*6)
      self.contents.draw_text(85,WLH*6,30,WLH,defe)
      # Intelligence
      determine_color(intt)
      icon = intt < 0 ? Config_Invoc::Icon_int_moins : Config_Invoc::Icon_int_plus
      draw_icon(icon,120,WLH*6)
      self.contents.draw_text(145,WLH*6,75,WLH,intt)
      # Agilitée
      determine_color(agi)
      icon = agi <0  ? Config_Invoc::Icon_agi_moins : Config_Invoc::Icon_agi_plus
      draw_icon(icon,180,WLH*6)
      self.contents.draw_text(205,WLH*6,30,WLH,agi)
    end
   
  #--------------------------------------------------------------------------
  # * Determine la couleur du texte (Uniquement pour la page 1)
  #--------------------------------------------------------------------------
  def determine_color(carac)
      self.contents.font.color = power_up_color if carac >0
      self.contents.font.color = power_down_color if carac < 0
      self.contents.font.color = normal_color if carac == 0
  end
end

#==============================================================================
# ** Window_Skill_Learn
#------------------------------------------------------------------------------
#  Affiche le sort que va apprendre l'invocation
#==============================================================================
class Window_Skill_Learn < Window_Base
  def initialize
    super(260,56,284,75)
  end

  #--------------------------------------------------------------------------
  # * Affiche le nom,faceset, les hp, les mp et le level de l'invoc
  #--------------------------------------------------------------------------
  def afficher_sorts(id_skill)
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(0,-5,contents.width,WLH,Config_Invoc::Text_sort_appris)
    self.contents.font.color =  normal_color
    self.contents.font.color.alpha = 127 if id_skill == 0
    self.contents.draw_text(id_skill != 0 ? 25 : 0,20,contents.width,WLH,id_skill != 0 ? $data_skills[id_skill].name : Config_Invoc::Text_aucun_sort_defini)
    self.contents.font.color.alpha = 255
    draw_icon($data_skills[id_skill].icon_index,0,20)  if id_skill !=0   
  end
end
 
#==============================================================================
# ** Window_Skill_Info
#------------------------------------------------------------------------------
#  Affiche le sort que possède l'invocation
#==============================================================================
class Window_Skill_Info < Window_Base
  def initialize(invoc,page,page_max)
    super(260,131,284,285)
    afficher_sorts(invoc,page,page_max)
  end

  #--------------------------------------------------------------------------
  # * Affiche les sorts
  #--------------------------------------------------------------------------
  def afficher_sorts(invoc,page,page_max)
    self.contents.clear
    if page_max > 1
      self.ox = 1
      self.contents = Bitmap.new(width, height - 32)
    end
    self.contents.font.color = system_color
    text = invoc.skills.size > 1 ? Config_Invoc::Text_sorts_connus :  Config_Invoc::Text_sort_connu
    self.contents.draw_text(0,0,contents.width,WLH,text)
    self.contents.font.color =  normal_color
    y = 30
    index_max = page.to_i * 9.to_i
    index_min = index_max.to_i - 9.to_i
    index_max.to_i ; index_min.to_i
    for i in index_min..index_max
      if invoc.skills[i] != nil
        skill = invoc.skills[i]
        draw_icon(skill.icon_index, 0, y)
        self.contents.draw_text(25, y, 250, WLH, skill.name)
        y += 25
      end
    end
  if invoc.skills == []
    self.contents.font.color.alpha = 127
    self.contents.draw_text(0, y, 250, WLH, Config_Invoc::Text_aucun_sort_connu)
    self.contents.font.color.alpha = 255
    end
  end
end

#==============================================================================
# ** Skill_Window
#------------------------------------------------------------------------------
#  Liste les objets d'apprentissage des sorts
#==============================================================================
class Skill_Window < Window_Selectable
  def initialize(invoc)
    super(0,184,260,232)
    @column_max =1
    @index = 0
    @invoc = invoc
    refresh
  end

  #--------------------------------------------------------------------------
  # * Liste les objets qui apprennent des sorts
  #--------------------------------------------------------------------------
  def refresh
    @data = []
    for item in $game_party.items
      if item.is_a?(RPG::Item)
        reserve = item.get_skill_reserve
        invoc_id = @invoc.id.to_s
        reserve = invoc_id if reserve == []
        @data.push(item) if item.skill_pour_invoc? and reserve.include?(invoc_id)
      end
    end
    @item_max = @data.size
    create_contents
    for i in 0...@data.size
      draw_item(i)
    end
  end
 
  #--------------------------------------------------------------------------
  # * Affiche les objets qui apprennent des sorts
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    item = @data[index]
    if item != nil
        rect.width -= 4
        number = $game_party.item_number(item)
        draw_item_name(item, rect.x, rect.y)
        self.contents.draw_text(rect, sprintf(":%2d", number), 2)
    end
  end
 
  #--------------------------------------------------------------------------
  # * Update les fenêtre d'info
  #--------------------------------------------------------------------------
  def update_help
    @help_window[0].set_text(@data[index] != nil ? @data[index].description : Config_Invoc::Text_pas_obj_skill,@data[index] != nil ? Config_Invoc::Alignement_description : Config_Invoc::Alignement_pas_obj_skill)
    @help_window[1].afficher_sorts(@data[index] != nil ? @data[index].get_id_skill : 0)
  end
 
  #--------------------------------------------------------------------------
  # * Renvoie l'objet en cours
  #--------------------------------------------------------------------------
  def get_objet
    return @data[index]
  end
end

#==============================================================================
# ** RPG::Item
#------------------------------------------------------------------------------
#  Gére les objets dans la base de données
#==============================================================================
module RPG
  class Item < UsableItem
#--------------------------------------------------------------------------
# * Détermine si l'objet est pour une invocation
#--------------------------------------------------------------------------
    def skill_pour_invoc?
      text = @note.decoupe
      item_pour_invoc = false
      for line in text
        item_pour_invoc = true if line == Config_Invoc::Tag_confirm_skill_obj
      end
    return item_pour_invoc
    end
 
  #--------------------------------------------------------------------------
  # * Prend les objets réservé a certaines invocations
  #--------------------------------------------------------------------------
  def get_skill_reserve
    text = @note.decoupe
    items = []
    for line in text
      items = line.delete(Config_Invoc::Tag_invoc_skill) if line.include?(Config_Invoc::Tag_invoc_skill)
    end
    return items
  end
 
  #--------------------------------------------------------------------------
  # * Prend l'ID du sort appris
  #--------------------------------------------------------------------------
  def get_id_skill
    text = @note.decoupe
    skill = 0
    for line in text
      skill = line.delete(Config_Invoc::Tag_skill_learn).to_i if line.include?(Config_Invoc::Tag_skill_learn)
    end
    return skill
  end
  end
end

#==============================================================================
# ** Scene_Equip_Invoc
#------------------------------------------------------------------------------
#  Classe qui gère les équipements des invocations
#==============================================================================
class Scene_Equip_Invoc < Scene_Base
  EQUIP_TYPE_MAX = 5
  def initialize(invoc,index_invoc,menu_index,equip_index = 0)
    @invoc = invoc
    @index_invoc =  index_invoc
    @menu_index = menu_index
    @equip_index = equip_index
  end
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    @help_window = Window_Help.new
    create_item_windows
    @equip_window = Window_Equip_Invoc.new(206, 56, @invoc)
    @equip_window.help_window = @help_window
    @equip_window.index = @equip_index
    @face_window = Window_Face_Invoc.new(@invoc,272,208,272,208)
    @status_window = Window_EquipStatus_Invoc.new(0, 56, @invoc)
  end
Revenir en haut Aller en bas
https://rpg-maker-vx.bbactif.com
Kay0077
Poulet trizo Lv.3
Poulet trizo Lv.3
Kay0077


Masculin Age : 29
Inscrit le : 14/03/2010
Messages : 36

Script Invocations + Formation Empty
MessageSujet: Re: Script Invocations + Formation   Script Invocations + Formation Icon_minitimeMar 16 Mar 2010 - 13:03

Fiou enfin la fin c'est chian quand c'est trop long ^^

Code:
 #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    super
    @help_window.dispose
    @equip_window.dispose
    @status_window.dispose
    @face_window.dispose
    dispose_item_windows
  end
  #--------------------------------------------------------------------------
  # * Update Frame
  #--------------------------------------------------------------------------
  def update
    super
    @help_window.update
    @face_window.update
    update_equip_window
    update_status_window
    update_item_windows
    if @equip_window.active
      @face_window.set_info(@equip_window.item)
      update_equip_selection
    elsif @item_window.active
      @face_window.set_info(@item_window.item)
      update_item_selection
    end
  end
  #--------------------------------------------------------------------------
  # * Create Item Window
  #--------------------------------------------------------------------------
  def create_item_windows
    @item_windows = []
    for i in 0...EQUIP_TYPE_MAX
      @item_windows[i] = Window_EquipItem_Invoc.new(0, 208, 272, 208, @invoc, i)
      @item_windows[i].help_window = @help_window
      @item_windows[i].visible = (@equip_index == i)
      @item_windows[i].y = 208
      @item_windows[i].height = 208
      @item_windows[i].active = false
      @item_windows[i].index = -1
    end
  end
  #--------------------------------------------------------------------------
  # * Dispose of Item Window
  #--------------------------------------------------------------------------
  def dispose_item_windows
    for window in @item_windows
      window.dispose
    end
  end
  #--------------------------------------------------------------------------
  # * Update Item Window
  #--------------------------------------------------------------------------
  def update_item_windows
    for i in 0...EQUIP_TYPE_MAX
      @item_windows[i].visible = (@equip_window.index == i)
      @item_windows[i].update
    end
    @item_window = @item_windows[@equip_window.index]
  end
  #--------------------------------------------------------------------------
  # * Update Equipment Window
  #--------------------------------------------------------------------------
  def update_equip_window
    @equip_window.update
  end
  #--------------------------------------------------------------------------
  # * Update Status Window
  #--------------------------------------------------------------------------
  def update_status_window
    if @equip_window.active
      @status_window.set_new_parameters(nil, nil, nil, nil)
    elsif @item_window.active
      temp_actor = @invoc.clone
      temp_actor.change_equip(@equip_window.index, @item_window.item, true)
      new_atk = temp_actor.atk
      new_def = temp_actor.def
      new_spi = temp_actor.spi
      new_agi = temp_actor.agi
      @status_window.set_new_parameters(new_atk, new_def, new_spi, new_agi)
    end
    @status_window.update
  end
  #--------------------------------------------------------------------------
  # * Update Equip Region Selection
  #--------------------------------------------------------------------------
  def update_equip_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Invoc_Stats.new(@invoc,@index_invoc,@menu_index)
    elsif Input.trigger?(Input::C)
      if @invoc.fix_equipment
        Sound.play_buzzer
      else
        Sound.play_decision
        @equip_window.active = false
        @item_window.active = true
        @item_window.index = 0
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Update Item Selection
  #--------------------------------------------------------------------------
  def update_item_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @equip_window.active = true
      @item_window.active = false
      @item_window.index = -1
    elsif Input.trigger?(Input::C)
      Sound.play_equip
      @invoc.change_equip(@equip_window.index, @item_window.item)
      @equip_window.active = true
      @item_window.active = false
      @item_window.index = -1
      @equip_window.refresh
      for item_window in @item_windows
        item_window.refresh
      end
    end
  end
end

#==============================================================================
# ** Window_Equip
#------------------------------------------------------------------------------
#  Liste les 5 endroits équipables (Arme,bouclier,casque,armure, accessoire)
#==============================================================================

class Window_Equip_Invoc < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #    x    : window X coordinate
  #    y    : window Y corrdinate
  #    actor : actor
  #--------------------------------------------------------------------------
  def initialize(x, y, invoc)
    super(x, y, 336, WLH * 5 + 32)
    @invoc = invoc
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # * Get Item
  #--------------------------------------------------------------------------
  def item
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @data = []
    for item in @invoc.equips do @data.push(item) end
    @item_max = @data.size
    self.contents.font.color = system_color
    if @invoc.two_swords_style
      self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon1)
      self.contents.draw_text(4, WLH * 1, 92, WLH, Vocab::weapon2)
    else
      self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon)
      self.contents.draw_text(4, WLH * 1, 92, WLH, Vocab::armor1)
    end
    self.contents.draw_text(4, WLH * 2, 92, WLH, Vocab::armor2)
    self.contents.draw_text(4, WLH * 3, 92, WLH, Vocab::armor3)
    self.contents.draw_text(4, WLH * 4, 92, WLH, Vocab::armor4)
    for i in 0..4
      draw_item_name(@data[i], 92, WLH * i)
    end
  end
  #--------------------------------------------------------------------------
  # * Update Help Text
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(item == nil ? "" : item.description)
  end
end

#==============================================================================
# ** Window_EquipItem
#------------------------------------------------------------------------------
#  La liste des armes que l'invocation peut équiper
#==============================================================================

class Window_EquipItem_Invoc < Window_Item
  #--------------------------------------------------------------------------
  # * Object Initialization
  #    x          : sindow X coordinate
  #    y          : sindow Y corrdinate
  #    width      : sindow width
  #    height    : sindow height
  #    actor      : actor
  #    equip_type : equip region (0-4)
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height, invoc, equip_type)
    @invoc = invoc
    if equip_type == 1 and invoc.two_swords_style
      equip_type = 0                              # Change shield to weapon
    end
    @equip_type = equip_type
    super(x, y, width, height,1)
  end
  #--------------------------------------------------------------------------
  # * Whether to include item in list
  #    item : item
  #--------------------------------------------------------------------------
  def include?(item)
    return true if item == nil
    if @equip_type == 0
      return false unless item.is_a?(RPG::Weapon)
    else
      return false unless item.is_a?(RPG::Armor)
      return false unless item.kind == @equip_type - 1
    end
    return @invoc.equippable?(item)
  end
  #--------------------------------------------------------------------------
  # * Whether to display item in enabled state
  #    item : item
  #--------------------------------------------------------------------------
  def enable?(item)
    return true
  end
end

#==============================================================================
# ** Window_EquipStatus
#------------------------------------------------------------------------------
#  Affiche le changement de caractéristiques
#==============================================================================
class Window_EquipStatus_Invoc < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #    x    : window X coordinate
  #    y    : window Y corrdinate
  #    actor : actor
  #--------------------------------------------------------------------------
  def initialize(x, y, invoc)
    super(x, y, 208, WLH * 5 + 32)
    @invoc = invoc
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_icon(Config_Invoc::Icone_carac_gene,4,0)
    self.contents.draw_text(29,0,contents.width,WLH,Config_Invoc::Nom_carac_gene)
    for i in 1..4
      draw_parameter(0, WLH * i, i-1)
    end
  end
  #--------------------------------------------------------------------------
  # * Set Parameters After Equipping
  #    new_atk : attack after equipping
  #    new_def : defense after equipping
  #    new_spi : spirit after equipping
  #    new_agi : agility after equipping
  #--------------------------------------------------------------------------
  def set_new_parameters(new_atk, new_def, new_spi, new_agi)
    if @new_atk != new_atk or @new_def != new_def or
      @new_spi != new_spi or @new_agi != new_agi
      @new_atk = new_atk
      @new_def = new_def
      @new_spi = new_spi
      @new_agi = new_agi
      refresh
    end
  end
  #--------------------------------------------------------------------------
  # * Get Post Equip Parameter Drawing Color
  #    old_value : parameter before equipment change
  #    new_value : parameter after equipment change
  #--------------------------------------------------------------------------
  def new_parameter_color(old_value, new_value)
    if new_value > old_value      # Get stronger
      return power_up_color
    elsif new_value == old_value  # No change
      return normal_color
    else                          # Get weaker
      return power_down_color
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Parameters
  #    x    : draw spot x-coordinate
  #    y    : draw spot y-coordinate
  #    type : type of parameter (0 - 3)
  #--------------------------------------------------------------------------
  def draw_parameter(x, y, type)
    case type
    when 0
      name = Vocab::atk
      value = @invoc.atk
      new_value = @new_atk
    when 1
      name = Vocab::def
      value = @invoc.def
      new_value = @new_def
    when 2
      name = Vocab::spi
      value = @invoc.spi
      new_value = @new_spi
    when 3
      name = Vocab::agi
      value = @invoc.agi
      new_value = @new_agi
    end
    self.contents.font.color = system_color
    self.contents.draw_text(x + 4, y, 80, WLH, name)
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 90, y, 30, WLH, value, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(x + 122, y, 20, WLH, ">", 1)
    if new_value != nil
      self.contents.font.color = new_parameter_color(value, new_value)
      self.contents.draw_text(x + 142, y, 30, WLH, new_value, 2)
    end
  end
end


#==============================================================================
# ** Window_Affiche_Info
#------------------------------------------------------------------------------
#  Affiche les caractéristiques de l'invoc
#==============================================================================
class Window_Affiche_Info < Window_Base
  def initialize(invoc)
    super(336,56,208,WLH * 5 + 32)
    draw_actor_name(invoc, 0, 10)
    draw_actor_level(invoc, 0, WLH * 1+10)
    draw_actor_hp(invoc, 0, WLH * 2+10)
    draw_actor_mp(invoc, 0 ,WLH * 3+10)
  end
end

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  Gére les combats
#==============================================================================
class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # * Execute Battle Action: Skill
  #--------------------------------------------------------------------------
  def execute_action_skill
    if Config_Invoc::Systeme_combat == 0
      skill = @active_battler.action.skill
      text = @active_battler.name + skill.message1
      @message_window.add_instant_text(text)
      unless skill.message2.empty?
        wait(10)
        @message_window.add_instant_text(skill.message2)
      end
      targets = @active_battler.action.make_targets
      display_animation(targets, skill.animation_id)
      @active_battler.mp -= @active_battler.calc_mp_cost(skill)
      $game_temp.common_event_id = skill.common_event_id
      for target in targets
        target.skill_effect(@active_battler, skill)
        display_action_effects(target, skill)
      end
      if Config_Invoc::Invocations.include?(@active_battler.id)
        sort_invoc = false
        liste_invoc = Config_Invoc::Invocations[@active_battler.id]
        for i in 0...Config_Invoc::Invocations[@active_battler.id].size
          invoc_en_cours = liste_invoc[i]
          if invoc_en_cours[1] == skill.id
            sort_invoc = true
          break
          end
        end
        if sort_invoc
          @invoc = invoc_en_cours[0]
          @if_invoc = true
          @old_party_members = $game_party.members
          for actor in $game_party.members
            $game_party.remove_actor(actor.id)
          end
          $game_party.add_actor(@invoc)
      end
    end
  else
      skill = @active_battler.action.skill
    # 戦闘不能付与のスキルで不死身設定を分岐
    if skill.plus_state_set.include?(1)
      for member in $game_party.members + $game_troop.members
        next if member.immortal
        next if member.dead?
        member.dying = true
      end
    else
      # 行動中に死なないようメンバー全員を不死身化
      immortaling
    end
    # スキル使用可能判定
    return unless @active_battler.skill_can_use?(skill)
    # ターゲット決定
    target_decision(skill)
    # アクション開始
    @spriteset.set_action(@active_battler.actor?, @active_battler.index, skill.base_action)
    # ヘルプウインドウにスキル名表示
    pop_help(skill)
    # アクション中
    playing_action
    # スキルコスト消費
    @active_battler.consum_skill_cost(skill)
    # ステータスウインドウをリフレッシュ
    @status_window.refresh
    # コモンイベント取得
    $game_temp.common_event_id = skill.common_event_id
    if Config_Invoc::Invocations.include?(@active_battler.id)
        sort_invoc = false
        liste_invoc = Config_Invoc::Invocations[@active_battler.id]
        for i in 0...Config_Invoc::Invocations[@active_battler.id].size
          invoc_en_cours = liste_invoc[i]
          if invoc_en_cours[1] == skill.id
            sort_invoc = true
          break
          end
        end
        if sort_invoc
          @invoc = invoc_en_cours[0]
          @if_invoc = true
          @old_party_members = $game_party.members
          for actor in $game_party.members
            $game_party.remove_actor(actor.id)
          end
          $game_party.add_actor(@invoc)
          $game_actors[@invoc].change_level($game_actors[@active_battler.id].level,false)
          $game_actors[@invoc].recover_all
      end
    end
  end
  end

  #--------------------------------------------------------------------------
  # * Victory Processing
  #--------------------------------------------------------------------------
  def process_victory
    if Config_Invoc::Systeme_combat == 1
    @status_window.visible = true
    @message_window.visible = false
    # ボスコラプスはウエイトを長く挟む
    for enemy in $game_troop.members
      break boss_wait = true if enemy.collapse_type == 3
    end
    wait(440) if boss_wait
    wait(N01::WIN_WAIT) unless boss_wait
    # 動けないアクターを除いて勝利アクション
    for actor in $game_party.members
      unless actor.restriction >= 4
        @spriteset.set_action(true, actor.index,actor.win)
      end
    end
    end
    @info_viewport.visible = false
    @message_window.visible = true
    RPG::BGM.stop
    $game_system.battle_end_me.play
    unless $BTEST
      $game_temp.map_bgm.play
      $game_temp.map_bgs.play
    end
    enlever_invocation if Config_Invoc::Mode_progression == 0
    if Config_Invoc::Utiliser_rapport_combat
      @message_window.visible = false
      @exp =$game_troop.exp_total
      @gold = $game_troop.gold_total
      @drop = $game_troop.make_drop_items
      $game_party.gain_gold(@gold)
      ini_variable   
      Graphics.fadeout(30)
      update_basic
      afficher_rapport
      enlever_invocation if Config_Invoc::Mode_progression == 1
      Graphics.fadein(20)
    else
    display_exp_and_gold
    display_drop_items
    display_level_up
    enlever_invocation if Config_Invoc::Mode_progression == 1
    battle_end(0)
    end
  end
 
  #--------------------------------------------------------------------------
  # * Defeat Processing
  #--------------------------------------------------------------------------
  def process_defeat
    if Config_Invoc::Systeme_combat == 1
      for member in $game_party.members
        @spriteset.set_stand_by_action(member.actor?, member.index)
      end
    end
    @info_viewport.visible = false
    @message_window.visible = true
    text = sprintf(Vocab::Defeat, $game_party.name)
    $game_message.texts.push(text)
    if @if_invoc
      enlever_invocation(true)
    else
      text = sprintf(Vocab::Defeat, $game_party.name)
      $game_message.texts.push(text)
      wait_for_message
      battle_end(2)
    end
  end
 
  #--------------------------------------------------------------------------
  # * Escape Processing
  #--------------------------------------------------------------------------
  def process_escape
  if Config_Invoc::Systeme_combat == 0 
    @info_viewport.visible = false
    @message_window.visible = true
    text = sprintf(Vocab::EscapeStart, $game_party.name)
    $game_message.texts.push(text)
    if $game_troop.preemptive
      success = true
    else
      success = (rand(100) < @escape_ratio)
    end
    Sound.play_escape
    if success
      wait_for_message
      enlever_invocation
      battle_end(1)
    else
      @escape_ratio += 10
      $game_message.texts.push('\.' + Vocab::EscapeFailure)
      wait_for_message
      $game_party.clear_actions
      start_main
    end
  else
    @info_viewport.visible = false
    @message_window.visible = true
    text = sprintf(Vocab::EscapeStart, $game_party.name)
    $game_message.texts.push(text)
    if $game_troop.preemptive
      success = true
    else
      success = (rand(100) < @escape_ratio)
    end
    Sound.play_escape
    # 動けないアクターを除いて逃走成功アクション
    if success
      for actor in $game_party.members
        unless actor.restriction >= 4
          @spriteset.set_action(true, actor.index,actor.run_success)
        end
      end 
      wait_for_message
      enlever_invocation
      battle_end(1)
    # 動けないアクターを除いて逃走失敗アクション
    else
      for actor in $game_party.members
        unless actor.restriction >= 4
          @spriteset.set_action(true, actor.index,actor.run_ng)
        end
      end
      @escape_ratio += 10
      $game_message.texts.push('\.' + Vocab::EscapeFailure)
      wait_for_message
      $game_party.clear_actions
      start_main
    end
    end
  end
 
  #--------------------------------------------------------------------------
  # * Enléve l'inocation en cours
  #--------------------------------------------------------------------------
  def enlever_invocation(game_over=false)
    if @if_invoc
      $game_actors[@invoc].recover_all if game_over == false
      $game_party.remove_actor(@invoc)
      for actor in @old_party_members
        $game_party.add_actor(actor.id)     
      end
      @if_invoc = false
    end
  end
end

#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
#  Gère les héros
#==============================================================================
class Game_Battler
    #--------------------------------------------------------------------------
  # * Désactive l'utilisation du sort si les HP de l'invoc sont égal à 0
  #--------------------------------------------------------------------------
  def skill_can_use?(skill)
    return false unless skill.is_a?(RPG::Skill)
    return false unless movable?
    return false if silent? and skill.spi_f > 0
    return false if calc_mp_cost(skill) > mp
    if Config_Invoc::Invocations.include?(self.id)
    liste_sort = Config_Invoc::Invocations[self.id]
    for i in 0...liste_sort.size
      invoc_en_cours = liste_sort[i]
      if invoc_en_cours[1] == skill.id and $game_actors[invoc_en_cours[0]].hp == 0
        return false
        break
      end
    end
    end
    if $game_temp.in_battle
      return skill.battle_ok?
    else
      return skill.menu_ok?
    end
  end
end

#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
#  Permet de réduire column_max pour la scene d'équipement
#==============================================================================
class Window_Item < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #    x      : window x-coordinate
  #    y      : window y-coordinate
  #    width  : window width
  #    height : window height
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height,column_max=2)
    super(x, y, width, height)
    @column_max = column_max
    self.index = 0
    refresh
  end
end


#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  Classe qui gère le menu
#==============================================================================
class Scene_Menu < Scene_Base
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_command_window
    s1 = Vocab::item
    s2 = Vocab::skill
    s3 = Vocab::equip
    s4 = Vocab::status
    s5 = Config_Invoc::Text_menu_invoc if $game_switches[Config_Invoc::Interrupteur_activation]
    s6 = Vocab::save
    s7 = Vocab::game_end
    decalage_invoc = $game_switches[Config_Invoc::Interrupteur_activation] ? 0 : 1
    @command_window = Window_Command.new(160,$game_switches[Config_Invoc::Interrupteur_activation] ?  [s1, s2, s3, s4, s5, s6,s7] : [s1, s2, s3, s4, s6,s7],
    column_max = 1, row_max = Config_Invoc::Affichage_max - decalage_invoc )
    @command_window.index = @menu_index
    if $game_party.members.size == 0          # If number of party members is 0
      @command_window.draw_item(0, false)    # Disable item
      @command_window.draw_item(1, false)    # Disable skill
      @command_window.draw_item(2, false)    # Disable equipment
      @command_window.draw_item(3, false)    # Disable status
      @command_window.draw_item(4, false)  if $game_switches[Config_Invoc::Interrupteur_activation]  # Ne pas autoriser les invocations     
    end
    if $game_system.save_disabled            # If save is forbidden
      @command_window.draw_item( $game_switches[Config_Invoc::Interrupteur_activation] ? 5 : 4, false)    # Disable save
    end
  end
 
  #--------------------------------------------------------------------------
  # * Update Command Selection
  #--------------------------------------------------------------------------
  def update_command_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      save_index = $game_switches[Config_Invoc::Interrupteur_activation] ? 5 : 4
      if $game_party.members.size == 0 and @command_window.index < save_index
        Sound.play_buzzer
        return
      elsif $game_system.save_disabled and @command_window.index == save_index
        Sound.play_buzzer
        return
      end
      Sound.play_decision
      case @command_window.index
      when 0      # Item
        $scene = Scene_Item.new
      when 1,2,3  # Skill, equipment, status
        start_actor_selection
      when $game_switches[Config_Invoc::Interrupteur_activation]  ? 4 : 0
        $scene = Scene_Invoc.new
      when $game_switches[Config_Invoc::Interrupteur_activation] ? 5  : 4    # Save
        $scene = Scene_File.new(true, false, false)
      when $game_switches[Config_Invoc::Interrupteur_activation] ? 6 : 5      # End Game
        $scene = Scene_End.new
      end
    end
  end
end

#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
#  Gère le menu de sauvegarde
#==============================================================================
class Scene_File < Scene_Base
    #--------------------------------------------------------------------------
  # *Fait revenir l'index du menu à ca bon index
  #--------------------------------------------------------------------------
  def return_scene
    if @from_title
      $scene = Scene_Title.new
    elsif @from_event
      $scene = Scene_Map.new
    else
      $scene = Scene_Menu.new( $game_switches[Config_Invoc::Interrupteur_activation] ? 5 : 4)
    end
  end
end

#==============================================================================
# ** Scene_End
#------------------------------------------------------------------------------
#  This class performs game end screen processing.
#==============================================================================
class Scene_End < Scene_Base
  #--------------------------------------------------------------------------
  # *Fait revenir l'index du menu à ca bon index
  #--------------------------------------------------------------------------
  def return_scene
    $scene = Scene_Menu.new( $game_switches[Config_Invoc::Interrupteur_activation] ? 6 : 5)
  end
end

#==============================================================================
# ** Window_Command
#------------------------------------------------------------------------------
#  Gère les fenêtres de commande
#==============================================================================
class Window_Command < Window_Selectable
  #--------------------------------------------------------------------------
  # * Correction d'un bug qui n'affichait pas les objets dépasant de la Window_Command
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    create_contents # A ajouter
    for i in 0...@item_max
      draw_item(i)
    end
  end
end

#==============================================================================
# ** ABS
#------------------------------------------------------------------------------
#  Extension de compatibilité avec l'ABS (Version 7.0 mini)
#==============================================================================
if Config_Invoc::Systeme_combat == 2
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# Étend la possibilité de joueur à 5 pour laisser une place à l'invocation
#==============================================================================
class Game_Party < Game_Unit
  MAX_MEMBERS = 5
  #--------------------------------------------------------------------------
  # * Enléve l'invoc quand le temps est fini
  #--------------------------------------------------------------------------
  def remove_actor(actor_id)
    for ally in $game_allies
      next if ally.nil?
      ally.destroy = true if actor_id == ally.actor.id
    end
    $scene.refresh_sprites if $scene.is_a?(Scene_Map)
    requiem_sbabs_gparty_remove_actor(actor_id)
  end
end

#==============================================================================
# ** Invoc
#------------------------------------------------------------------------------
# Ajoute l'invocation dans l'équipe
#==============================================================================
class Invoc
  def initialize(invoc,time)
    $invoc = invoc
    $game_party.add_actor($invoc)
    $time_invoc = time
  end
end

#==============================================================================
# ** Requiem_ABS
#------------------------------------------------------------------------------
# La classe qui gère l'ABS
#==============================================================================
class Requiem_ABS
  def initialize
#    transform_config
    $time_invoc = -1 if $time_invoc.nil? or $time_invoc > 0
    @attack_key1 = param("Attack_Key1")
    @attack_key2 = param("Attack_Key2")
    @skill_keys = param("Skills_Keys")
    @item_keys = param("Items_Keys")
    @animations_divide = param("Animations_Divide")
    @memorized_text = param("Memorized_Text")
    @allow_weapons_graphics = param("Allow_Weapons_Graphics")
    @allow_shields_graphics = param("Allow_Shields_Graphics")
    @allow_attack_with_shield = param("Allow_attack_with_shield")
    @allow_combo_damage = param("Allow_Combo_Damage")
    @levelup_animation = param("LevelUp_Animation")
    @recovery_when_levelup = param("Recovery_When_LevelUp")
    @gold_drop_icon_index  = param("Gold_Drop_Icon_Index")
    @gold_drop_rate  = param("Gold_Drop_Rate")
    @drop_duration_time = param("Drop_Duration_Time")
    @show_reward = param("Show_Reward")
    @drop_se = [param("Drop_Money_SE"), param("Drop_Item_SE")]
    @auto_exp_e_gold  = param("Auto_EXP_Gold")
    @auto_exp_rate  = param("Auto_EXP_Rate")
    @auto_gold_rate  = param("Auto_Gold_Rate")
    @through_drop = param("Through_Drop")
    @trasfer_when_defending = param("Trasfer_When_Defending")
    @divide_exp = param("Divide_EXP")
    @change_group_order = param("Change_Group_Order")
    @next_actor_if_dead = param("Next_Actor_If_Dead")
    @damage_properties = {}
    @damage_properties["Damage"] = ["MS Gothic", 18, false, false]
    @damage_properties["Hits"] = ["Times New Roman", 26, true, true]
    @damage_properties["Texts"] = ["Miss", "Critical", "Combo", "Guard", "Level Up", "Hits", "Reflect"]
    @damage_properties["Colors"] = [Color.new(255,255,255), Color.new(125,200,120),
    Color.new(255,255,128), Color.new(245,150,120), Color.new(210,160,210), Color.new(180,165,215)]
  end
 
  #--------------------------------------------------------------------------
  # * Empêche le joueur de contrôler l'invocation
  #--------------------------------------------------------------------------
  def change_group_order
    for ally in $game_allies
      next if ally.nil? or ally.map_id == $game_map.map_id
      return
    end
    return if members.size <= 1
    actor = @actors[0]
    @actors.delete(actor)
    @actors.compact
    if all_dead?
      @actors.insert(0, actor)
      return
    end
    @actors.push(actor)
    for a in members
      next if a.nil?
      if a.dead? or Config_Invoc::Invocations_abs.include?(a.id)
        ally = a
        @actors.delete(a.id)
        @actors.push(a.id)
      else
        for i in $game_allies
          next if i.nil? or i.actor != a
          ally = i
        end
        break
      end
    end
    allies = []
    for a in $game_allies
      next if a .nil?
      allies.push(a)
    end
    allies.delete(ally)
    allies.push($game_player)
    allies.compact
    for i in 1...members.size
      next if members[i].nil?
      $game_allies[i] = Game_Ally.new(i)
      $game_allies[i].refresh
      $game_allies[i].moveto(allies[i-1].x, allies[i-1].y)
      if !allies[i-1].is_a?(Game_Player)
        $game_allies[i].map_id = allies[i-1].map_id
      else
        $game_allies[i].map_id = $game_map.map_id
      end
      $game_allies[i].direction = allies[i-1].direction
    end
    $game_player.moveto(ally.x, ally.y)
    $game_player.refresh
    $scene.refresh_sprites if $scene.is_a?(Scene_Map)
  end
end

#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
# Gère les maps
#==============================================================================
class Game_Map
  #--------------------------------------------------------------------------
  # *  Gére le temps que va rester l'invocation sur le terrain
  #--------------------------------------------------------------------------
  def update_events
    for event in @events.values
      next unless in_range?(event) or event.trigger == 3 or event.trigger == 4
      event.update
    end
    for common_event in @common_events.values
      common_event.update
    end
    $time_invoc -= 1 # ici
    if $time_invoc == 0
      $time_invoc = -1
      $game_party.remove_actor($invoc)
    end
  end
end

#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
# Gère la liste des héros dans le menu principal
#==============================================================================
class Window_MenuStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # * N'affiche pas l'invocation dans le menu principale si elle est rajoutée à l'équipe
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.members.size == 5 ? $game_party.members.size - 1 : $game_party.members.size
    for actor in $game_party.members
      draw_actor_face(actor, 2, actor.index * 96 + 2, 92)
      x = 104
      y = actor.index * 96 + WLH / 2
      draw_actor_name(actor, x, y)
      draw_actor_class(actor, x + 120, y)
      draw_actor_level(actor, x, y + WLH * 1)
      draw_actor_state(actor, x, y + WLH * 2)
      draw_actor_hp(actor, x + 120, y + WLH * 1)
      draw_actor_mp(actor, x + 120, y + WLH * 2)
    end
  end
end
end # Fin config ABS
Revenir en haut Aller en bas
https://rpg-maker-vx.bbactif.com
Contenu sponsorisé




Script Invocations + Formation Empty
MessageSujet: Re: Script Invocations + Formation   Script Invocations + Formation Icon_minitime

Revenir en haut Aller en bas
 

Script Invocations + Formation

Voir le sujet précédent Voir le sujet suivant Revenir en haut 
Page 1 sur 1

 Sujets similaires

-
» Problème script Invocations
» Problème compatilité SBS et script invocations de Blockade?
» [Non résolu] Script d'invocations V1 + rapport de combat V3
» Script de Formation [Résolu]
» [VX]Enlever les invocations en fin de combat (invocations de Blockade)

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
RPG Maker VX :: Entraide :: Scripts :: Requêtes :: Archives-
Créer un forum | ©phpBB | Forum gratuit d'entraide | Signaler un abus | Forum gratuit | Informatique et Internet | Informatique et électronique