Teria algum jeito de fazer o script de Cartas igual ao do Ragnarok funcionar no np 3.0?
Aqui está ele:
Ele não dá nenhum erro mais não sei como abrir a tela para equipar as cartas.
Aqui está ele:
- Spoiler:
- ################################################################################
################################################################################
############################## Cards ###########################################
################################################################################
################################################################################
#===============================================================================
# Script de cartas estilo ragnarok
#===============================================================================
$RTHScript ||= {}
$RTHScript["Cards"] = true
module RTH
module CARDS
DATA = []
# Nome do Equipe Quando se tem somente:
# 1
CARDS_1_NAME = "[item]"
# 2
CARDS_2_NAME = "[item] Bi"
# 3
CARDS_3_NAME = "[item] Tri"
# 4
CARDS_4_NAME = "[item] Quad"
# 5
CARDS_5_NAME = "[item] Quint"
# Informações da janela de informações da carta
INFO = {}
INFO["maxhp"] = ["HP Máximo + [valor]", "HP Máximo - [valor]"]
INFO["maxsp"] = ["SP Máximo + [valor]", "SP Máximo - [valor]"]
INFO["str"] = ["FOR + [valor]", "FOR - [valor]"]
INFO["dex"] = ["DES + [valor]", "DES - [valor]"]
INFO["agi"] = ["AGI + [valor]", "AGI - [valor]"]
INFO["int"] = ["INT + [valor]", "INT - [valor]"]
INFO["atk"] = ["ATK + [valor]", "ATK - [valor]"]
INFO["pdef"] = ["DEF F + [valor]", "DEF F - [valor]"]
INFO["mdef"] = ["DEF M + [valor]", "DEF M - [valor]"]
INFO["eva"] = ["ESQUIVA + [valor]", "ESQUIVA - [valor]"]
INFO["skill"] = ["Aprende a skill [valor]", "Esquece a skill [valor]"]
def self.add_card(card=[], card_equip=0, card_fix="[item]", item_id=0)
key = [card, card_equip, card_fix]
DATA[item_id] = key
end
def self.card?(item_id)
return DATA[item_id] != nil
end
end
end
if $RTHScript["Cards"]
class Game_Card
attr_reader :id
def initialize(id)
@id = id
@card = (RTH::CARDS::DATA[id].nil? ? [] : RTH::CARDS::DATA[id])
end
def convert_name(name)
return name if @card[2].nil?
return @card[2].gsub(/\[[Ii][Tt][Ee][Mm]\]/, name)
end
def check_array(name)
return 0 if @card[0].nil?
add = []
@card[0].each { |x| add.push(x[1]) if x[0].downcase == name.downcase and !add.include?(x[1]) }
return add
end
def check_add(name)
return 0 if @card[0].nil?
add = 0
@card[0].each { |x| add += x[1] if x[0].downcase == name.downcase }
return add
end
end
class Game_Actor < Game_Battler
attr_reader :weapon
attr_reader :armor1
attr_reader :armor2
attr_reader :armor3
attr_reader :armor4
#--------------------------------------------------------------------------
# - Alias
#--------------------------------------------------------------------------
alias card_equip_gactor_initialize initialize
alias card_equip_gactor_base_maxhp base_maxhp
alias card_equip_gactor_base_maxsp base_maxsp
alias card_equip_gactor_base_str base_str
alias card_equip_gactor_base_dex base_dex
alias card_equip_gactor_base_agi base_agi
alias card_equip_gactor_base_int base_int
alias card_equip_gactor_base_atk base_atk
alias card_equip_gactor_base_pdef base_pdef
alias card_equip_gactor_base_mdef base_mdef
alias card_equip_gactor_base_eva base_eva
alias card_equip_gactor_equip equip
#--------------------------------------------------------------------------
# - Inicialização
#--------------------------------------------------------------------------
def initialize(*args)
card_equip_gactor_initialize(*args)
@equiped_learned_skills = []
@weapon = (@weapon_id <= 0 ? nil : Game_Weapon.new(@weapon_id))
@armor1 = (@armor1_id <= 0 ? nil : Game_Armor.new(@armor1_id))
@armor2 = (@armor2_id <= 0 ? nil : Game_Armor.new(@armor2_id))
@armor3 = (@armor3_id <= 0 ? nil : Game_Armor.new(@armor3_id))
@armor4 = (@armor4_id <= 0 ? nil : Game_Armor.new(@armor4_id))
end
#--------------------------------------------------------------------------
# - Definição da Base de MaxHP
#--------------------------------------------------------------------------
def base_maxhp
return card_equip_gactor_base_maxhp + (check_add("maxhp"))
end
#--------------------------------------------------------------------------
# - Definição da Base de MaxMP
#--------------------------------------------------------------------------
def base_maxsp
return card_equip_gactor_base_maxsp + (check_add("maxsp"))
end
#--------------------------------------------------------------------------
# - Definição da Base de Força
#--------------------------------------------------------------------------
def base_str
n = card_equip_gactor_base_str + (check_add("str"))
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# - Definição da Base de Destreza
#--------------------------------------------------------------------------
def base_dex
n = card_equip_gactor_base_dex + (check_add("dex"))
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# - Definição da Base de Agilidade
#--------------------------------------------------------------------------
def base_agi
n = card_equip_gactor_base_agi + (check_add("agi"))
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# - Definição da Base de Magia
#--------------------------------------------------------------------------
def base_int
n = card_equip_gactor_base_int + (check_add("int"))
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# - Definição da Base de Ataque
#--------------------------------------------------------------------------
def base_atk
return card_equip_gactor_base_atk + (check_add("atk"))
end
#--------------------------------------------------------------------------
# - Definição da Base de Defesa
#--------------------------------------------------------------------------
def base_pdef
return card_equip_gactor_base_pdef + (check_add("pdef"))
end
#--------------------------------------------------------------------------
# - Definição da Base de Defesa Mágica
#--------------------------------------------------------------------------
def base_mdef
return card_equip_gactor_base_mdef + (check_add("mdef"))
end
#--------------------------------------------------------------------------
# - Definição da Base de Esquiva
#--------------------------------------------------------------------------
def base_eva
return card_equip_gactor_base_eva + (check_add("eva"))
end
def check_add(name)
x = [@weapon, @armor1, @armor2, @armor3, @armor4]
a = 0
for i in x
next if i.nil?
a += i.check_add(name)
end
return a
end
def equip(equip_type, id)
case equip_type
when 0 # Armas
if !id.is_a?(Numeric)
forget_equiped_skills
$game_party.gain_weapon(@weapon)
@weapon = id
@weapon_id = (id.nil? ? 0 : id.id)
$game_party.lose_weapon(@weapon)
learn_equiped_skills
return
end
when 1 # Escudo
if !id.is_a?(Numeric)
forget_equiped_skills
update_auto_state($data_armors[@armor1_id], $data_armors[(id.nil? ? 0 : id.id)])
$game_party.gain_armor(@armor1)
@armor1 = id
@armor1_id = (id.nil? ? 0 : id.id)
$game_party.lose_armor(@armor1)
learn_equiped_skills
return
end
when 2 # Elmo
if !id.is_a?(Numeric)
forget_equiped_skills
update_auto_state($data_armors[@armor2_id], $data_armors[(id.nil? ? 0 : id.id)])
$game_party.gain_armor(@armor2)
@armor2 = id
@armor2_id = (id.nil? ? 0 : id.id)
$game_party.lose_armor(@armor2)
learn_equiped_skills
return
end
when 3 # Armadura
if !id.is_a?(Numeric)
forget_equiped_skills
update_auto_state($data_armors[@armor3_id], $data_armors[(id.nil? ? 0 : id.id)])
$game_party.gain_armor(@armor3)
@armor3 = id
@armor3_id = (id.nil? ? 0 : id.id)
$game_party.lose_armor(@armor3)
learn_equiped_skills
return
end
when 4 # Acessório
if !id.is_a?(Numeric)
forget_equiped_skills
update_auto_state($data_armors[@armor4_id], $data_armors[(id.nil? ? 0 : id.id)])
$game_party.gain_armor(@armor4)
@armor4 = id
@armor4_id = (id.nil? ? 0 : id.id)
$game_party.lose_armor(@armor4)
learn_equiped_skills
return
end
end
card_equip_gactor_equip(equip_type, id)
end
def forget_equiped_skills
for x in @equiped_learned_skills
self.forget_skill(x)
end
@equiped_learned_skills = []
end
def learn_equiped_skills
for x in self.all_equips
next if x.nil?
skills = x.check_array("skill")
for y in skills
if !self.skill_learn?(y) and !@equiped_learned_skills.include?(y)
@equiped_learned_skills.push(y)
self.learn_skill(y)
end
end
end
end
def all_equips
return [@weapon, @armor1, @armor2, @armor3, @armor4]
end
end
class Game_Party
#--------------------------------------------------------------------------
# - Ganhar ou Perder Armas
#
# weapon_id : ID da Arma
# n : quantidade
#--------------------------------------------------------------------------
def gain_weapon(weapon_id, n=1)
if weapon_id.is_a?(NilClass)
return
end
if weapon_id.is_a?(Game_Weapon)
@weapons[weapon_id.id] ||= []
if @weapons[weapon_id.id].size < 99
@weapons[weapon_id.id].push(weapon_id)
end
return
end
# Atualizar a quantidade nesta divisão
if weapon_id > 0
@weapons[weapon_id] ||= []
if n > 0
for i in 0...n
if @weapons[weapon_id].size < 99
weapon = Game_Weapon.new(weapon_id)
@weapons[weapon_id].push(weapon)
end
end
elsif n < 0
nabs = n.abs
indexes = []
for i in 0...@weapons[weapon_id].size
next if @weapons[weapon_id][i].nil?
indexes.push([@weapons[weapon_id][i].cards.size, i])
end
indexes.sort! { |a,b| a[0] - b[0] }
for i in 0...[nabs, indexes.size].min
@weapons[weapon_id].delete_at(indexes[i][1])
end
end
end
end
#--------------------------------------------------------------------------
# - Ganhar ou Perder Armaduras
#
# armor_id : ID da Armadura
# n : quantidade
#--------------------------------------------------------------------------
def gain_armor(armor_id, n=1)
if armor_id.is_a?(NilClass)
return
end
if armor_id.is_a?(Game_Armor)
@armors[armor_id.id] ||= []
if @armors[armor_id.id].size < 99
@armors[armor_id.id].push(armor_id)
end
return
end
# Atualizar a quantidade nesta divisão
if armor_id > 0
@armors[armor_id] ||= []
if n > 0
for i in 0...n
armor = Game_Armor.new(armor_id)
@armors[armor_id].push(armor)
end
elsif n < 0
nabs = n.abs
indexes = []
for i in 0...@armors[armor_id].size
next if @armors[armor_id][i].nil?
indexes.push([@armors[armor_id][i].cards.size, i])
end
indexes.sort! { |a,b| a[0] - b[0] }
for i in 0...[nabs, indexes.size].min
@armors[armor_id].delete_at(indexes[i][1])
end
end
end
end
#--------------------------------------------------------------------------
# - Perder Armas
#
# weapon_id : ID da Arma
# n : quantidade
#--------------------------------------------------------------------------
def lose_weapon(weapon_id, n=1)
if weapon_id.is_a?(NilClass)
return
end
if weapon_id.is_a?(Game_Weapon)
@weapons[weapon_id.id] ||= []
index = (@weapons[weapon_id.id].index(weapon_id))
@weapons[weapon_id.id].delete_at(index) if index != nil
return
end
# Reverter o valor numerical e chamar gain_weapon
gain_weapon(weapon_id, -n)
end
#--------------------------------------------------------------------------
# - Perder Armadura
#
# armor_id : ID da Armadura
# n : quantidade
#--------------------------------------------------------------------------
def lose_armor(armor_id, n=1)
if armor_id.is_a?(NilClass)
return
end
if armor_id.is_a?(Game_Armor)
@armors[armor_id.id] ||= []
index = (@armors[armor_id.id].index(armor_id))
@armors[armor_id.id].delete_at(index) if index != nil
return
end
# Reverter o valor numerical e chamar gain_armor
gain_armor(armor_id, -n)
end
#--------------------------------------------------------------------------
# - Selecionar o Número de Armas Possuídas
#
# weapon_id : ID da Arma
#--------------------------------------------------------------------------
def weapon_number(weapon_id)
# Se a quantidade estiver separada, se não, voltar a 0
return @weapons[weapon_id] != nil ? @weapons[weapon_id].size : 0
end
#--------------------------------------------------------------------------
# - Selecionar o Número de Armaduras Possuídas
#
# armor_id : ID da Armadura
#--------------------------------------------------------------------------
def armor_number(armor_id)
# Se a quantidade estiver separada, se não, voltar a 0
return @armors[armor_id] != nil ? @armors[armor_id].size : 0
end
def weapon(weapon_id, weapon_index)
return (@weapons[weapon_id].nil? ? nil : @weapons[weapon_id][weapon_index])
end
def armor(armor_id, armor_index)
return (@armors[armor_id].nil? ? nil : @armors[armor_id][armor_index])
end
end
class Game_Equip
attr_reader :equip
attr_reader :cards
def initialize
@cards = []
@cards_max = 0
end
def can_add_card?
return (@cards.size < @cards_max)
end
def add_card(card)
@cards.push(card) if self.can_add_card?
end
def name
card_id = {}
name = @equip.name
for card in @cards
if card_id[card.id].nil?
card_id[card.id] = [card, 1]
else
card_id[card.id][1] += 1
end
end
for x in card_id.values
text = eval("RTH::CARDS::CARDS_#{x[1]}_NAME")
aname = x[0].convert_name(name)
name = text.gsub(/\[[Ii][Tt][Ee][Mm]\]/, aname)
end
return (name.nil? or name == "" ? @equip.name : name)
end
def check_add(name)
add = 0
for card in @cards
add += (card.check_add(name))
end
return add
end
def check_array(name)
add = []
for card in @cards
test = card.check_array(name)
for x in test
add.push(x) unless add.include?(x)
end
end
return add
end
def icon_name
return (@equip.nil? ? "" : @equip.icon_name)
end
def description
return (@equip.nil? ? "" : @equip.description)
end
end
class Game_Weapon < Game_Equip
attr_reader :id
def initialize(weapon_id)
super()
@equip = $data_weapons[weapon_id]
@id = weapon_id
@cards_max = @equip.card_slots
end
end
class Game_Armor < Game_Equip
attr_reader :id
def initialize(armor_id)
super()
@equip = $data_armors[armor_id]
@id = armor_id
@cards_max = @equip.card_slots
end
end
class RPG::Weapon
def card_slots
if @card_slots.nil?
@card_slots = 0
setup_comentarios if @comentarios.nil?
for comment in @comentarios
if comment =~ /cslots[ ]?(\d+)?/
@card_slots = $1.to_i
break
end
end
end
return @card_slots
end
#--------------------------------------------------------------
#
#--------------------------------------------------------------
def setup_comentarios
text = @description.clone
@comentarios = []
# Controlar processamento do texto
begin
last_text = text.clone
text.sub!(/\[(.*?)\]/, "")
@comentarios.push($1.dup) unless $1.nil?
end until text == last_text
end
#--------------------------------------------------------------
#
#--------------------------------------------------------------
def description
if @retorna_description.nil?
@retorna_description = @description.gsub(/\[.*?\]/, "")
end
return @retorna_description
end
end
class RPG::Armor
def card_slots
if @card_slots.nil?
@card_slots = 0
setup_comentarios if @comentarios.nil?
for comment in @comentarios
if comment =~ /cslots[ ]?(\d+)?/
@card_slots = $1.to_i
break
end
end
end
return @card_slots
end
#--------------------------------------------------------------
#
#--------------------------------------------------------------
def setup_comentarios
text = @description.clone
@comentarios = []
# Controlar processamento do texto
begin
last_text = text.clone
text.sub!(/\[(.*?)\]/, "")
@comentarios.push($1.dup) unless $1.nil?
end until text == last_text
end
#--------------------------------------------------------------
#
#--------------------------------------------------------------
def description
if @retorna_description.nil?
@retorna_description = @description.gsub(/\[.*?\]/, "")
end
return @retorna_description
end
end
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# - Atualização
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# Adicionar Item
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
# Também é adicionados os equipamentos e os Itens chave caso se esteja fora
# de uma batalha
unless $game_temp.in_battle
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
for j in 0...$game_party.weapon_number(i)
@data.push($game_party.weapon(i, j))
end
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
for j in 0...$game_party.armor_number(i)
@data.push($game_party.armor(i, j))
end
end
end
end
# Caso haja algum Item aqui a janela é desenhada, junto com todos os Itens
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# - Desenhar Item
#
# index : índice de Itens
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
else
number = 1
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# - Atualização do Texto de Ajuda
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
class Window_EquipRight < Window_Selectable
#--------------------------------------------------------------------------
# - Atualização
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@data = []
@data.push(@actor.weapon)
@data.push(@actor.armor1)
@data.push(@actor.armor2)
@data.push(@actor.armor3)
@data.push(@actor.armor4)
@item_max = @data.size
self.contents.font.color = system_color
self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4)
draw_item_name(@data[0], 92, 32 * 0)
draw_item_name(@data[1], 92, 32 * 1)
draw_item_name(@data[2], 92, 32 * 2)
draw_item_name(@data[3], 92, 32 * 3)
draw_item_name(@data[4], 92, 32 * 4)
end
end
class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# - Atualização
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# Aqui são exibidas as Armas equipáveis (0)
if @equip_type == 0
weapon_set = $data_classes[@actor.class_id].weapon_set
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
for j in 0...$game_party.weapon_number(i)
@data.push($game_party.weapon(i, j))
end
end
end
end
# Aqui são exibidas as Armaduras equipáveis (1)
if @equip_type != 0
armor_set = $data_classes[@actor.class_id].armor_set
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and armor_set.include?(i)
if $data_armors[i].kind == @equip_type-1
for j in 0...$game_party.armor_number(i)
@data.push($game_party.armor(i, j))
end
end
end
end
end
# Aqui é exibida uma página em branco
@data.push(nil)
# Aqui é desenhada uma janela e os Itens
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max-1
draw_item(i)
end
end
#--------------------------------------------------------------------------
# - Desenhar Itens
#
# index : índice
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
else
number = 1
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
end
class Window_Equip_Card < Window_Selectable
attr_reader :id
def initialize(item_id)
super(320, 64, 320, 480-64)
@id = item_id
@card = RTH::CARDS::DATA[item_id]
@equip_type = @card[1]
self.z = 10000
refresh
self.active = true
if @item_max > 0
self.index = 0
end
end
def add_item_card
if self.can_add_card?
@data[self.index].add_card(Game_Card.new(@id))
end
end
def can_add_card?
unless @data[self.index].nil?
return @data[self.index].can_add_card?
end
return false
end
def card
return Game_Card.new(@id)
end
def item
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# Aqui são exibidas as Armas equipáveis (0)
if @equip_type == 0
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
for j in 0...$game_party.weapon_number(i)
weapon = $game_party.weapon(i, j)
if weapon != nil and weapon.can_add_card?
@data.push(weapon)
end
end
end
end
end
# Aqui são exibidas as Armaduras equipáveis (1)
if @equip_type != 0
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
if $data_armors[i].kind == @equip_type-1
for j in 0...$game_party.armor_number(i)
armor = $game_party.armor(i, j)
if armor != nil and armor.can_add_card?
@data.push(armor)
end
end
end
end
end
end
# Aqui é desenhada uma janela e os Itens
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
else
self.contents = Bitmap.new(width - 32, 32)
self.contents.draw_text(4, 0, width - 32, 32, "Nenhuma")
end
end
#--------------------------------------------------------------------------
# - Desenhar Itens
#
# index : índice
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
x = 4
y = index * 32
number = 1
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
end
class Window_Card_Description < Window_Base
def initialize(item_id)
super(0, 64, 320, 480-64)
@card = RTH::CARDS::DATA[item_id]
@card_effects = []
self.z = 10000
for x in @card[0]
if x[1] != 0
will_sub = "#{x[1]}"
if x[0].downcase == "skill"
will_sub = "#{$data_skills[x[1]].name}"
end
if x[1] > 0
text = RTH::CARDS::INFO[x[0].downcase][0].gsub(/\[[Vv][Aa][Ll][Oo][Rr]\]/, "#{will_sub}")
elsif x[1] < 0
text = RTH::CARDS::INFO[x[0].downcase][1].gsub(/\[[Vv][Aa][Ll][Oo][Rr]\]/, "#{will_sub}")
end
@card_effects.push(text)
end
end
self.contents = Bitmap.new(self.width - 32, @card_effects.size * 32 + 64)
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, 0, self.width - 32, 32, "Efeitos", 1)
self.contents.font.color = normal_color
for i in 0...@card_effects.size
x = 4
y = 32 + i * 32
self.contents.draw_text(x, y, self.width - 32, 32, @card_effects[i])
end
end
end
class Scene_Item
#--------------------------------------------------------------------------
# - Atualização do Frame
#--------------------------------------------------------------------------
alias rth_cards_scene_item_update update
def update
if @equip_card != nil
# Atualizar janelas
@help_window.update
update_equip_card
return
end
rth_cards_scene_item_update
end
def start_equip_card(item_id)
return if @equip_card != nil
@equip_card = Window_Equip_Card.new(item_id)
@equip_card_description = Window_Card_Description.new(item_id)
end
def dispose_item_select
unless @equip_card.nil?
@equip_card.dispose
@equip_card = nil
@equip_card_description.dispose
@equip_card_description = nil
end
end
def update_equip_card
@equip_card.update
@equip_card_description.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
dispose_item_select
return
end
if Input.trigger?(Input::C)
if @equip_card.item.nil?
$game_system.se_play($data_system.buzzer_se)
return
end
unless @equip_card.can_add_card?
$game_system.se_play($data_system.buzzer_se)
return
end
# Reproduzir SE de Equipamento
$game_system.se_play($data_system.equip_se)
@equip_card.add_item_card
$game_party.lose_item(@equip_card.id, 1)
dispose_item_select
@item_window.refresh
end
end
#--------------------------------------------------------------------------
# - Atualização do Frame (Quando a janela de Itens estiver Ativa)
#--------------------------------------------------------------------------
alias rth_cards_scene_item_update_item update_item
def update_item
if Input.trigger?(Input::C)
# Selecionar os dados escolhidos na janela de Itens
@item = @item_window.item
# Se não for um Item usável
unless @item.is_a?(RPG::Item)
# Reproduzir SE de erro
$game_system.se_play($data_system.buzzer_se)
return
end
if RTH::CARDS.card?(@item.id)
$game_system.se_play($data_system.decision_se)
start_equip_card(@item.id)
return
end
end
rth_cards_scene_item_update_item
end
end
class Scene_Equip
def refresh
# Definir a janela de Itens como visível
@item_window1.visible = (@right_window.index == 0)
@item_window2.visible = (@right_window.index == 1)
@item_window3.visible = (@right_window.index == 2)
@item_window4.visible = (@right_window.index == 3)
@item_window5.visible = (@right_window.index == 4)
# Selecionar os ´tens equipados atualmente
item1 = @right_window.item
# Set current item window to @item_window
case @right_window.index
when 0
@item_window = @item_window1
when 1
@item_window = @item_window2
when 2
@item_window = @item_window3
when 3
@item_window = @item_window4
when 4
@item_window = @item_window5
end
# Se a janela da direita estiver ativa
if @right_window.active
# Limpar parâmetros para depois fazer a troca de equipamentos
@left_window.set_new_parameters(nil, nil, nil)
end
# Se a janela de Itens estiver ativa
if @item_window.active
# Selecionar o Item escolhido
item2 = @item_window.item
# Mudar Equipamento
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(@right_window.index, item2)
# Selecionar parâmetros para depois fazer a troca de equipamentos
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
# Retornar equipamento
@actor.equip(@right_window.index, item1)
@actor.hp = last_hp
@actor.sp = last_sp
# Desenhar na janela da esquerda
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
end
end
#--------------------------------------------------------------------------
# - Atualização do Frame (Quando a janela de Itens estiver Ativa)
#--------------------------------------------------------------------------
def update_item
# Se o botão B for pressionado
if Input.trigger?(Input::B)
# Reproduzir SE de cancelamento
$game_system.se_play($data_system.cancel_se)
# Ativar janela da direita
@right_window.active = true
@item_window.active = false
@item_window.index = -1
return
end
# Se o botão C for pressionado
if Input.trigger?(Input::C)
# Reproduzir SE de Equipamento
$game_system.se_play($data_system.equip_se)
# Selecionar dados escolhidos na janela de Item
item = @item_window.item
# Mudar Equipamento
@actor.equip(@right_window.index, item)
# Ativar janela da direita
@right_window.active = true
@item_window.active = false
@item_window.index = -1
# Recriar os conteúdos da janela de Itens e da direita
@right_window.refresh
@item_window.refresh
return
end
end
end
end
Ele não dá nenhum erro mais não sei como abrir a tela para equipar as cartas.