и да можно в игре замутить туман???
и да можно в игре замутить туман???
Туман есть в командах - атмосферные явления. А темную область - полупрозрачной картинкой.
Тут главное - подобрать изображения.
Спойлер И как тебе не стыдно-то, а, Валера?:
Оборона форта: http://rghost.ru/8kLGxFtD2
Сделать, чтоб все происходило, как я хочу, - вот, собственно, и весь мейкер!
Адский Рейд: http://rpgmaker.su/vbdownloads.php?d...downloadid=106
Однако, как печально-то...
Спойлер И как тебе не стыдно-то, а, Валера?:
Оборона форта: http://rghost.ru/8kLGxFtD2
Сделать, чтоб все происходило, как я хочу, - вот, собственно, и весь мейкер!
Адский Рейд: http://rpgmaker.su/vbdownloads.php?d...downloadid=106
так скрипт на туман я нашел в сборнике уроков от Мефиса
но как этим скриптом пользоваться я так и не понял(плюс надой найти тайлы для тумана,а я хз)
вобщем решил полазить на иностранных сайтах
и вот что я нашелСпойлер ссылка:http://www.rpgrevolution.com/forums/index.php?showtopic=19618&hl=OECS
итак вещь очень крутая,тут присутствуют элементы которые я бы хотел видеть в своей крафт системе
но для первой демки подойдет(есть мнение что он останется на весь период игры)
Итак,в принципе я понял как оно работает,но мне надо что бы кто-то перевел эту демку,ибо есть такие непонятки как показаны на скрине 1,2,3
мне нужно что бы кто то объяснил мне за что отвечают те надписи(причем каждая из них)
и вообще я хотел бы узнать все функции этого скрипта
Надеюсь Мефисто будет заинтересован
или еще кто-то)))
Бармалей судя по скринам что ты кинул все очень просто в описание описываеться действие и название оружия и предметов.
а в заметках описываються спецальные атрибуты скрипта так как самого скрипта я не видел не могу сказать за что каждый из описываемых
атрибутов отвечает. но в таких скриптах всегда идет на английском инструкция даже перевод через гугл переводчик дает понятие как с ним работать
вот те скрипты
Спойлер скрипт 1:#================================================= ==============================
# *** Omega Equipment Customizations Scripts Main ***
#-------------------------------------------------------------------------------
=begin
This script is required for all OECS scripts. This script changes the way you
deal with your equipment by a bit. instead of buying 10 clubs at the same time,
you must buy the clubs one by one(which is a small price to pay, since no one
really buys equipment at large quantities). this is for the functionality of
all OECS scripts.
There are options below.
=end
#================================================= =============================
# ** OECS
#------------------------------------------------------------------------------
# a module for Omega Equipment Customization Scripts
#================================================= =============================
module OECS
#--------------------------------------------------------------------------
# * The Only Options in main
#--------------------------------------------------------------------------
# asked when you buy a single item
BuySingleItem = 'Buy Item?'
# Confirm buy single equipment
AgreeBuySingleItem = 'Buy'
DisagreeBuySingleItem = 'No'
# since all equipment are separated, this option removes the quantity indicator
# ": 1" since it would always be like that.
RemoveQuantityCountOnEquip = true
=begin
IMPORTANT: when you edit the database for weapons/armors and then load a save
file, the loaded file will be corrupted. when using this script please
create a save file for your games only after either the game or just the
equipment database is finished.
the above applies to items if you have the materia system.
=end
#================================================= =============================#
################################################## ##############################
#================================================= =============================#
#--------------------------------------------------------------------------
# * The Main Creation of Equipment
#--------------------------------------------------------------------------
def self.create(item, has_prefix, has_suffix, prefix_manual = nil, suffix_manual = nil)
temp_item = item.dup
temp_item.id = temp_item.is_a?(RPG::Weapon) ? $data_weapons.size : $data_armors.size
if OECS.constants.include?("EPSS")
temp_item = OECS::EPSS.prefix_suffix(temp_item, has_prefix, has_suffix, prefix_manual, suffix_manual)
end
if OECS.constants.include?("SLOT")
possible_slots = item.possible_slots
if possible_slots.is_a?(Integer)
temp_item.slots = possible_slots
else
slot_diff = rand(possible_slots[1] - possible_slots[0] + 1)
temp_item.slots = possible_slots[1] - slot_diff
end
end
temp_item.upgrade_level = 0 if OECS.constants.include?("Upgrade")
if item.is_a?(RPG::Weapon)
index = $data_weapons.size
$data_weapons.push(temp_item)
for i in 1...$data_classes.size
if $data_classes[i].weapon_set.include?(item.id)
$data_classes[i].weapon_set.push(temp_item.id)
end
end
else
index = $data_armors.size
$data_armors.push(temp_item)
for i in 1...$data_classes.size
if $data_classes[i].armor_set.include?(item.id)
$data_classes[i].armor_set.push(temp_item.id)
end
end
end
#~ temp_item.mother_item_id = item.id
return temp_item.id
end
#--------------------------------------------------------------------------
# * Item Version of the above
#--------------------------------------------------------------------------
def self.item_create(item, materia_birth = false)
temp_item = item.dup
temp_item.id = $data_items.size
OECS::Materia.reset_materia(temp_item) if OECS.constants.include?("Materia")
$data_items.push(temp_item)
return temp_item.id
end
end
$oz_script = {} if $oz_script == nil
$oz_script["OECS"] = true
#================================================= =============================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#================================================= =============================
class Scene_Battle
#--------------------------------------------------------------------------
# * Display Gained Drop Items
#--------------------------------------------------------------------------
def display_drop_items
drop_items = $game_troop.make_drop_items
for item in drop_items
if item.is_a?(RPG::Weapon)
has_prefix, has_suffix = false, false
if OECS.constants.include?("EPSS")
has_prefix = rand(100) < OECS::EPSS::HavePrefixChance
has_suffix = rand(100) < OECS::EPSS::HaveSuffixChance
has_prefix, has_suffix = false, false if item.note.include?("<unique>")
has_prefix, has_suffix = false, false unless OECS::EPSS::GainWordedItemsFromEnemy
end
index = OECS.create(item, has_prefix, has_suffix)
item = $data_weapons[index]
elsif item.is_a?(RPG::Armor)
has_prefix, has_suffix = false, false
if OECS.constants.include?("EPSS")
has_prefix = rand(100) < OECS::EPSS::HavePrefixChance
has_suffix = rand(100) < OECS::EPSS::HaveSuffixChance
has_prefix, has_suffix = false, false if item.note.include?("<unique>")
has_prefix, has_suffix = false, false unless OECS::EPSS::GainWordedItemsFromEnemy
end
index = OECS.create(item, has_prefix, has_suffix)
item = $data_armors[index]
end
$game_party.gain_item(item, 1)
text = sprintf(Vocab::ObtainItem, item.name)
$game_message.texts.push(text)
end
wait_for_message
end
end
#================================================= =============================
# ** Game_Interpreter
#------------------------------------------------------------------------------
# An interpreter for executing event commands. This class is used within the
# Game_Map, Game_Troop, and Game_Event classes.
#================================================= =============================
class Game_Interpreter
#--------------------------------------------------------------------------
# * Change Weapons
#--------------------------------------------------------------------------
def command_127
value = operate_value(@params[1], @params[2], @params[3])
for i in 0...value
has_prefix, has_suffix = false, false
if OECS.constants.include?("EPSS")
has_prefix = rand(100) < OECS::EPSS::HavePrefixChance
has_suffix = rand(100) < OECS::EPSS::HaveSuffixChance
has_prefix = false if $data_weapons[@params[0]].note.include?("<unique>")
has_suffix = false if $data_weapons[@params[0]].note.include?("<unique>")
has_prefix, has_suffix = false, false unless OECS::EPSS::GainWordedItemsFromEvent
end
index = OECS.create($data_weapons[@params[0]], has_prefix, has_suffix)
$game_party.gain_item($data_weapons[index], 1, @params[4])
end
return true
end
#--------------------------------------------------------------------------
# * Change Armors
#--------------------------------------------------------------------------
def command_128
value = operate_value(@params[1], @params[2], @params[3])
for i in 0...value
has_prefix, has_suffix = false, false
if OECS.constants.include?("EPSS")
has_prefix = rand(100) < OECS::EPSS::HavePrefixChance
has_suffix = rand(100) < OECS::EPSS::HaveSuffixChance
has_prefix = false if $data_armors[@params[0]].note.include?("<unique>")
has_suffix = false if $data_armors[@params[0]].note.include?("<unique>")
has_prefix, has_suffix = false, false unless OECS::EPSS::GainWordedItemsFromEvent
end
index = OECS.create($data_armors[@params[0]], has_prefix, has_suffix)
$game_party.gain_item($data_armors[index], 1, @params[4])
end
return true
end
end
#================================================= =============================
# ** Scene_Shop
#------------------------------------------------------------------------------
# This class performs shop screen processing.
#================================================= =============================
class Scene_Shop
alias oz_oecs_main_update update
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
oz_oecs_main_update
if @buy_confirm_window != nil
update_buy_confirm
end
end
#--------------------------------------------------------------------------
# * Update Buy Confirmation
#--------------------------------------------------------------------------
def update_buy_confirm
@buy_confirm_window.update
if Input.trigger?(Input::B)
Sound.play_cancel
@buy_window.active = true
@buy_window.visible = true
@buy_confirm_window.dispose
@buy_confirm_window = nil
elsif Input.trigger?(Input::C)
Sound.play_decision
if @buy_confirm_window.index == 1
Sound.play_shop
index = OECS.create(@item, false, false)
@item = @item.is_a?(RPG::Weapon) ? $data_weapons[index] : $data_armors[index]
$game_party.lose_gold(@item.price)
$game_party.gain_item(@item, 1)
@gold_window.refresh
@buy_window.refresh
@status_window.refresh
end
@buy_window.active = true
@buy_window.visible = true
@buy_confirm_window.dispose
@buy_confirm_window = nil
end
end
#--------------------------------------------------------------------------
# * Update Buy Item Selection
#--------------------------------------------------------------------------
def update_buy_selection
@status_window.item = @buy_window.item
if Input.trigger?(Input::B)
Sound.play_cancel
@command_window.active = true
@dummy_window.visible = true
@buy_window.active = false
@buy_window.visible = false
@status_window.visible = false
@status_window.item = nil
@help_window.set_text("")
return
end
if Input.trigger?(Input::C)
@item = @buy_window.item
number = $game_party.item_number(@item)
if @item == nil or @item.price > $game_party.gold or number == 99
Sound.play_buzzer
elsif @item.is_a?(RPG::Weapon) or @item.is_a?(RPG::Armor)
Sound.play_decision
@buy_confirm_window = Window_ShopConfirmBuy.new(0, 112, @item)
@buy_confirm_window.active = true
@buy_window.active = false
@buy_window.visible = false
else
Sound.play_decision
max = @item.price == 0 ? 99 : $game_party.gold / @item.price
max = [max, 99 - number].min
@buy_window.active = false
@buy_window.visible = false
@number_window.set(@item, max, @item.price)
@number_window.active = true
@number_window.visible = true
end
end
end
end
#================================================= =============================
# ** Window_ShopConfirmBuy
#------------------------------------------------------------------------------
# This window confirms if the player will buy an item.
#================================================= =============================
class Window_ShopConfirmBuy < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y, item, prefix = nil, suffix = nil)
@prefix = prefix
@suffix = suffix
row_max = 2
super(x, y, 304, 304, 32)
@commands = [OECS::AgreeBuySingleItem, OECS:isagreeBuySingleItem]
@item_max = 2
@column_max = 2
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
self.index = 0
self.contents.draw_text(0, 50, width - 32, 24, OECS::BuySingleItem, 0)
draw_item_name(item, 0, 100)
end
#--------------------------------------------------------------------------
# * Get rectangle for displaying items
# index : item number
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = (contents.width + @spacing) / @column_max - @spacing
rect.height = WLH
rect.x = index % @column_max * (rect.width + @spacing)
rect.y = index / @column_max * WLH + 160
return rect
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# enabled : enabled flag. When false, draw semi-transparently.
#--------------------------------------------------------------------------
def draw_item(index, enabled = true)
rect = item_rect(index)
rect.x += 4
rect.width -= 10
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(rect, @commands[index], 1)
end
#--------------------------------------------------------------------------
# * Draw Item Name
# item : Item (skill, weapon, armor are also possible)
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# enabled : Enabled flag. When false, draw semi-transparently.
#--------------------------------------------------------------------------
def draw_item_name(item, x, y, enabled = true)
if item != nil
draw_icon(item.icon_index, x, y, enabled)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
prefix = @prefix == nil ? '' : @prefix + ' '
suffix = @suffix == nil ? '' : ' ' + @suffix
name = prefix + item.name + suffix
self.contents.draw_text(x + 24, y, 172, WLH, name)
end
end
end
#================================================= =============================
# ** OECS::EquipInclude
#------------------------------------------------------------------------------
# a module for performing mix-ins in all types equipment
#================================================= =============================
module OECS::EquipInclude
attr_accessor :mother_item_id
alias oecs_main_dup dup
def dup
duplicate = self.oecs_main_dup
perform_duplication(duplicate)
return duplicate
end
# separated for aliasing
def perform_duplication(duplicate)
duplicate.element_set = self.element_set.dup
duplicate.state_set = self.state_set.dup
end
end
#================================================= =============================
# ** RPG
#------------------------------------------------------------------------------
# A module containing RPGVX Data Structures.
#================================================= =============================
module RPG
#================================================= ===========================
# ** RPG::Weapon
#----------------------------------------------------------------------------
# Data class for Weapons.
#================================================= ===========================
class Weapon
#------------------------------------------------------------------------
# * Perform mix-in
#------------------------------------------------------------------------
include OECS::EquipInclude
def mother_item
return $data_weapons[@mother_item_id]
end
end
#================================================= ===========================
# ** RPG::Armor
#----------------------------------------------------------------------------
# Data class for Armors.
#================================================= ===========================
class Armor
#------------------------------------------------------------------------
# * Perform mix-in
#------------------------------------------------------------------------
include OECS::EquipInclude
def mother_item
return $data_armors[@mother_item_id]
end
end
end
#================================================= =============================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles actors. It's used within the Game_Actors class
# ($game_actors) and referenced by the Game_Party class ($game_party).
#================================================= =============================
class Game_Actor
#--------------------------------------------------------------------------
# * Alias List
#--------------------------------------------------------------------------
alias oz_oecs_main_setup setup
#--------------------------------------------------------------------------
# * Setup
# actor_id : actor ID
#--------------------------------------------------------------------------
def setup(actor_id)
oz_oecs_main_setup(actor_id)
if @weapon_id != 0
@weapon_id = OECS.create($data_weapons[@weapon_id], false, false)
actor.weapon_id = @weapon_id
end
if @armor1_id != 0
if two_swords_style
@armor1_id = OECS.create($data_armors[@armor1_id], false, false)
else
@armor1_id = OECS.create($data_armors[@armor1_id], false, false)
end
actor.armor1_id = @armor1_id
end
if @armor2_id != 0
@armor2_id = OECS.create($data_armors[@armor2_id], false, false)
actor.armor2_id = @armor2_id
end
if @armor3_id != 0
@armor3_id = OECS.create($data_armors[@armor3_id], false, false)
actor.armor3_id = @armor3_id
end
if @armor4_id != 0
@armor4_id = OECS.create($data_armors[@armor4_id], false, false)
actor.armor4_id = @armor4_id
end
end
def iterate_equips
yield $data_weapons[@weapon_id] unless @weapon_id == 0 or @weapon_id == nil
unless two_swords_style
yield $data_armors[@armor1_id] unless @armor1_id == 0 or @armor1_id == nil
else
yield $data_weapons[@armor1_id] unless @armor1_id == 0 or @armor1_id == nil
end
yield $data_armors[@armor2_id] unless @armor2_id == 0 or @armor2_id == nil
yield $data_armors[@armor3_id] unless @armor3_id == 0 or @armor3_id == nil
yield $data_armors[@armor4_id] unless @armor4_id == 0 or @armor4_id == nil
end
end
#================================================= =============================
# ** Scene_Title
#------------------------------------------------------------------------------
# This class performs the title screen processing.
#================================================= =============================
class Scene_Title
#--------------------------------------------------------------------------
# * Alias List
#--------------------------------------------------------------------------
alias oz_oecs_main_start start
alias oz_oecs_load_bt_database load_bt_database
def load_bt_database
oz_oecs_load_bt_database
initialize_oecs
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
oz_oecs_main_start
initialize_oecs
end
#--------------------------------------------------------------------------
# * Initialize OECS script
#--------------------------------------------------------------------------
def initialize_oecs
for equipment in ($data_weapons + $data_armors).compact
equipment.mother_item_id = equipment.id
end
end
end
#================================================= =============================
# ** Scene_File
#------------------------------------------------------------------------------
# This class performs the save and load screen processing.
#================================================= =============================
class Scene_File
#--------------------------------------------------------------------------
# * Alias List
#--------------------------------------------------------------------------
alias oz_oecs_main_write_save_data write_save_data
alias oz_oecs_main_read_save_data read_save_data
#--------------------------------------------------------------------------
# * Write Save Data
# file : write file object (opened)
#--------------------------------------------------------------------------
def write_save_data(file)
oz_oecs_main_write_save_data(file)
Marshal.dump($data_weapons, file)
Marshal.dump($data_armors, file)
Marshal.dump($data_classes, file)
end
#--------------------------------------------------------------------------
# * Read Save Data
# file : file object for reading (opened)
#--------------------------------------------------------------------------
def read_save_data(file)
oz_oecs_main_read_save_data(file)
$data_weapons = Marshal.load(file)
$data_armors = Marshal.load(file)
$data_classes = Marshal.load(file)
end
end
class Window_CommandWithQuestion < Window_Command
def initialize(width, question, commands)
@question = question
super(width, commands)
create_contents
self.height += WLH
refresh
end
def question=(question)
@question = question
refresh
end
def refresh
super
self.contents.draw_text(0, 0, width - 32, WLH, @question, 1)
end
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = (contents.width + @spacing) / @column_max - @spacing
rect.height = WLH
rect.x = index % @column_max * (rect.width + @spacing)
rect.y = index / @column_max * WLH + WLH
return rect
end
def create_contents
self.contents.dispose
self.contents = Bitmap.new(width - 32, [height - 32, (row_max + 1) * WLH].max)
end
end
if OECS::RemoveQuantityCountOnEquip
class Window_Item
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
number = $game_party.item_number(item)
enabled = enable?(item)
rect.width -= 4
draw_item_name(item, rect.x, rect.y, enabled)
self.contents.draw_text(rect, sprintf(":%2d", number), 2) unless item.is_a?(RPG::Weapon) or item.is_a?(RPG::Armor)
end
end
end
end
Спойлер скрипт2:#================================================= ==============================
# **OECS Equipment Prefix/Suffix System v1.5
#-------------------------------------------------------------------------------
# This script allows you to have be able to have prefixes/suffixes in equipments
# giving it additional effects depending on the prefix/suffix. You may also opt
# to make items unidentified at first, so the equipment will not show its real
# name and description yet, requiring you to use items first to identify it.
#
# Put script above main, below OECS main, below any multi-slot script
#================================================= ==============================
=begin
Instructions:
First, do the tedious job. set-up all prefixes and suffixes. instructions
below
Then customize the options below.
To call the gamble shop, turn on the switch you assigned in the options
then call the shop processing event, set up all products.
remember to turn off the switch after the shop processing, or all your shops
will be gamble shops. This is the same as the Worded Shop.
To manually create a randomly prefixed item type this in the script
section of the events
for weapon: Manual_Create.weapon(id, prefix, suffix)
for armor : Manual_Create.armor(id, prefix, suffix)
if you want to leave prefix or suffix empty type this: ""
i.e. Manual_Create.weapon(2, "Light", "")
NOTE: a prefix/suffix must be for that type, for example, if you put
Amber - a prefix for type armor(helm) to a weapon, it wouldn't work,
it would choose a random prefix instead.
also put this tag:
<unique>
in an equipment's note box
if you don't want an item to have prefix/suffix
=end
#================================================= =============================
# ** OECS::EPSS
#------------------------------------------------------------------------------
# A module for OECS Equipment Prefix/Suffix System Options
#================================================= =============================
module OECS
module EPSS
# gain worded items from enemy battles.
GainWordedItemsFromEnemy = true
# gain prefixed/suffixed items from event command change weapon/armor:
GainWordedItemsFromEvent = true
# Chance to have prefix/suffix for the above (in %):
HavePrefixChance = 50
HaveSuffixChance = 40
# Switch no. to activate Gamble Shop:
GambleShopSwitch = 20
# The number which the original price of the items will be multiplied
# at gamble shop:
GamblePriceMultiplier = 5
# Chance to have prefix/suffix for gamble shop (in %):
HavePrefixChanceGambleShop = 90
HaveSuffixChanceGambleShop = 90
# laziness option. automatically put "of" in the suffixes (i.e. of the rabbit):
PutOfToSuffixes = false
# Worded Shop switch no.(worded shop is a shop
# with visible prefixes/suffixes):
WordedShopSwitch = 19
# Chance to have prefix/suffix for worded shop (in %):
HavePrefixChanceWordedShop = 90
HaveSuffixChanceWordedShop = 80
# Term
GambleConfirmation = "Gamble?"
# looks options:
# make the equipment window single column
# (since equipments with prefix/suffix have very long names
EquipmentWindowSingleColumn = true
# same as above, but for the item window, this includes your other items such
# as potions, to be shown in single column.
ItemWindowSingleColumn = true
EnableTextColors = true
# Colors: [red, green, blue, opacity] , color value range (0-255)
# for normal equipment
NormalColor = [255, 255, 255, 255]
# for equipment with single word (either a prefix or a suffix)
SingleWordedColor = [255, 155, 255, 255]
# for equipment with both prefixes or suffixes
DoubleWordedColor = [160, 240, 160, 255]
# for equipment with the <unique> tag
UniqueColor = [250, 250, 50, 255]
# When This is set to true,
# All worded Items gotten through events or enemies, are unidentified.
# They wont show their real names, or description, until they are identified.
# for example, an unidentified club's real name is club of giant and is supposed
# to add 30 to atk. but in the equip screen, it will only show 10 atk
# (the original parameter added by a normal club). Its selling price is also
# the same as the origin item unless identified.
# You need to use an identification item to identify them, for the real
# effects to show.
RequireIdentification = true
# require identification in items gained in gamble shop
RequireIdentificationInGambled = false
# require identification in items gained from enemy drops
RequireIdentificationFromEnemy = true
# require identification in items gained from event
RequireIdentificationFromEvent = true
# added to the name of unidentified equipment. change to "" for none
AddToUnidentifiedName = "(unidentified)"
IdentifyerItem = 17 # item id
UnidentifiedColor = [150, 150, 255, 255]
IdentifyQuestion = 'Identify Which Item?'
IdentifyQuestionSingle = 'Identify this Item?'
IdentifyConfirm = 'Identify'
IdentifyCancel = 'No'
IdentifySoundEffect = 'Absorb2' # leave '' for no sound.
=begin
================================================== =============================
Prefixes/Suffixes
To set up a prefix/suffix this is the format:
["name", [types], "effects", "description"],
don't forget the commas! especially the one at the end!
alot of examples have been made for your reference.
name = name of the prefix/suffix. enclose in ""
types = numbers that represent the item types that have these prefix/suffix
- 0 : for weapon
- 1 : for shield
- 2 : for helmet
- 3 : for body armor
- 4 : for accessory
if you have multiple, separate by comma (i.e. 1, 2, 3)
then enclose in square brackets
are you using dervvulfan's multi-slot script? if so, you can put types more
than 4. remember the number you put in types is the armor kind number PLUS ONE
description = added to the description of the item when it has the
prefix/suffix. enclose in ""
effects = the different effects added
effects tags: (+ can also be -) replace val with any integer.
all types:
price+val = added price, doesn't affect gamble
atk+val = adds val to attack stat
def+val
spi+val
agi+val
weapon only tags: (when prefix/suffix is gained in armor, does nothing)
hit+val = adds to hit stat
element_att(val) = attack gains element id (val)
state_att(val) = attack has a chance to give state
two_handed = turns weapon to two handed
monkey_grip = turns two handed to one handed
fast_attack = same as in the database
dual_attack
critical_bonus
armor only tags:
eva+val
element_def(val) = added resistance to element id (val)
state_def(val) = add a resistance to state id val
prevent_critical = same as in the database
half_mp_cost
double_exp_gain
auto_hp_recover
also if you have the OECS durability system you may put this:
durability+val = for additional durability
separate effect tags by a comma then enclose everything in ""
enter everything below here
=end
#================================================= ==============================
Prefixes = [
#================================================= ==============================
["Amber" , [1, 2, 3, 4] ,"element_def(11),element_att(11),price+100","+ lightning affinity"],
["Light", [0], "monkey_grip,price+10", ""],
["Black", [1], "element_def(9),element_def(10),element_def(11),pr ice+100", "+ lightning, fire, ice affinity"],
["Shivering", [0], "element_att(10),atk+10,price+50", "+10 atk, + ice attack"],
["Foul", [0], "state_att(2),price+10", "+ chance to poison"],
["Weak", [1, 2], "remove_all_edef,price-10", "all e-def removed"],
["Bronze", [0], "hit+10,price+10", "+10 hit"],
["Blessed", [1, 3, 4], "def_rate+30,spi+10,price+100", "+30% def, +10 spi "],
["Burgundy", [0, 1, 2], "element_def(9)", "+ fire defense"],
["Devious", [0, 2], "spi+10", ""],
["Deadly", [0], "atk+10,critical_bonus", "+10 atk, +crit"],
["Godly", [1, 2, 3], "def+20", "+20 def"],
["Cursed", [0], "atk-10", "-10 atk"],
["Sensei's", [0, 1, 2, 3, 4], "eva+5", "+5 eva"],
#================================================= ==============================
["",[-1],""]]
#================================================= ==============================
Suffixes = [
#================================================= ==============================
["of Alacrity", [0], "hit+5"],
["of Remedy", [1, 2, 3, 4], "state_def(2)"],
["of Brilliance", [0, 1, 2], "def+10,spi+5"],
["of the Grim Reaper", [0], "state_att(1),atk-10"],
["of Atlas", [3, 4], "def+20,atk-10"],
["of Venom", [0], "atk+10,state_att(2)"],
["of Saving", [1, 2, 3 ,4], "half_mp_cost"],
["of the Giant", [0], "atk+30,agi-10,two_handed"],
["of the Doppelganger", [0], "dual_attack"],
["of Gore", [0, 1, 2, 3, 4], "atk+30,def-10"],
#================================================= =============================#
################################################## ##############################
#================================================= =============================#
["",[-1],""]]
#------------------------------------------------------------------------
# * Create and return a prefixed/suffixed item
#------------------------------------------------------------------------
def self.prefix_suffix(temp_item, has_prefix, has_suffix, prefix_manual = nil, suffix_manual = nil)
weapon = temp_item.is_a?(RPG::Weapon)? true : false
if weapon
prefix_array = Prefix.weapon_prefix_array
suffix_array = Suffix.weapon_suffix_array
else
prefix_array = Prefix.armor_prefix_array[temp_item.kind]
suffix_array = Suffix.armor_suffix_array[temp_item.kind]
end
prefix_index = rand(prefix_array.size)
suffix_index = rand(suffix_array.size)
prefix = has_prefix ? prefix_array[prefix_index] : Appended_Word.empty_word
suffix = has_suffix ? suffix_array[suffix_index] : Appended_Word.empty_word
if prefix_manual != nil
for prefix_ in prefix_array
if prefix_.name.downcase == prefix_manual.downcase
prefix = prefix_
break
end
end
end
if suffix_manual != nil
for suffix_ in suffix_array
if suffix_.name.downcase == suffix_manual.downcase
suffix = suffix_
break
end
end
end
temp_item.price = temp_item.price + prefix.price + suffix.price
temp_item.atk = temp_item.atk + prefix.atk + suffix.atk
temp_item.def = temp_item.def + prefix.def + suffix.def
temp_item.spi = temp_item.spi + prefix.spi + suffix.spi
temp_item.agi = temp_item.agi + prefix.agi + suffix.agi
temp_item.durability = temp_item.durability + prefix.durability + suffix.durability if OECS.constants.include?("Durability")
if weapon
temp_item.hit = temp_item.hit + prefix.hit + suffix.hit
temp_item.two_handed = ((temp_item.two_handed or prefix.two_handed or suffix.two_handed) and not (prefix.monkey_grip or suffix.monkey_grip))
temp_item.fast_attack = (temp_item.fast_attack or prefix.fast_attack or suffix.fast_attack)
temp_item.dual_attack = (temp_item.dual_attack or prefix.dual_attack or suffix.dual_attack)
temp_item.critical_bonus = (temp_item.critical_bonus or prefix.critical_bonus or suffix.critical_bonus)
temp_item.element_set = (temp_item.element_set + prefix.element_set_att + suffix.element_set_att)
temp_item.state_set = (temp_item.state_set + prefix.state_set_att + suffix.state_set_att)
else
temp_item.eva = temp_item.eva + prefix.eva + suffix.eva
temp_item.prevent_critical = (temp_item.prevent_critical or prefix.prevent_critical or suffix.prevent_critical)
temp_item.half_mp_cost = (temp_item.half_mp_cost or prefix.half_mp_cost or suffix.half_mp_cost)
temp_item.double_exp_gain = (temp_item.double_exp_gain or prefix.double_exp_gain or suffix.double_exp_gain)
temp_item.auto_hp_recover = (temp_item.auto_hp_recover or prefix.auto_hp_recover or suffix.auto_hp_recover)
temp_item.element_set = (temp_item.element_set + prefix.element_set_def + suffix.element_set_def)
temp_item.state_set = (temp_item.state_set + prefix.state_set_def + suffix.element_set_def)
end
temp_item.name = has_prefix ? prefix.name + ' ' + temp_item.name : temp_item.name
temp_item.name = has_suffix ? temp_item.name + ' ' + suffix.name : temp_item.name
temp_item.description = (temp_item.description + ' ' + prefix.description + ' ' + suffix.description)
if EPSS::EnableTextColors
temp_item.epss_color_mode = 0
temp_item.epss_color_mode += 1 if has_prefix
temp_item.epss_color_mode += 1 if has_suffix
end
if EPSS::RequireIdentification
if (has_prefix or has_suffix) and not (prefix_manual or suffix_manual)
if $scene.is_a?(Scene_GambleShop) and EPSS::RequireIdentificationInGambled
temp_item.identified = false
elsif $scene.is_a?(Scene_Battle) and EPSS::RequireIdentificationFromEnemy
temp_item.identified = false
elsif $scene.is_a?(Scene_Map) and EPSS::RequireIdentificationFromEvent
temp_item.identified = false
else
temp_item.identified = true
end
else
temp_item.identified = true
end
end
return temp_item
end
end
module EquipInclude
if EPSS::EnableTextColors
attr_accessor :epss_color_mode
end
if EPSS::RequireIdentification
attr_accessor :identified
end
end
end
#================================================= =============================
# ** Window_GambleShopBuy
#------------------------------------------------------------------------------
# This window displays buyable goods on the gamble shop screen.
#================================================= =============================
class Window_GambleShopBuy < Window_ShopBuy
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
number = $game_party.item_number(item)
enabled = (item.price <= $game_party.gold and number < 99)
rect = item_rect(index)
self.contents.clear_rect(rect)
draw_item_name(item, rect.x, rect.y, enabled)
rect.width -= 4
price = item.price.to_f*OECS::EPSS::GamblePriceMultiplier
price = price.to_i
self.contents.draw_text(rect, price, 2)
end
end
#================================================= =============================
# ** Window_GambleConfirm
#------------------------------------------------------------------------------
# This window confirms if the player will buy an item.
#================================================= =============================
class Window_GambleConfirm < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y, item)
row_max = 2
super(x, y, 304, 304, 32)
@commands = ['Yes', 'No']
@item_max = 2
@column_max = 2
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
self.index = 0
self.contents.draw_text(0, 50, width - 32, 24, OECS::EPSS::GambleConfirmation, 0)
draw_item_name(item, 0, 100)
end
#--------------------------------------------------------------------------
# * Get rectangle for displaying items
# index : item number
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = (contents.width + @spacing) / @column_max - @spacing
rect.height = WLH
rect.x = index % @column_max * (rect.width + @spacing)
rect.y = index / @column_max * WLH + 160
return rect
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# enabled : enabled flag. When false, draw semi-transparently.
#--------------------------------------------------------------------------
def draw_item(index, enabled = true)
rect = item_rect(index)
rect.x += 4
rect.width -= 10
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(rect, @commands[index], 1)
end
end
#================================================= =============================
# ** Scene_GambleShop
#------------------------------------------------------------------------------
# This class performs gamble shop screen processing.
#================================================= =============================
class Scene_GambleShop < Scene_Shop
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_gamble_window
end
#--------------------------------------------------------------------------
# * Create Gamble Window and Buy Window
#_-------------------------------------------------------------------------
def create_gamble_window
@buy_window = Window_GambleShopBuy.new(0, 112)
@buy_window.active = false
@buy_window.visible = false
@buy_window.help_window = @help_window
@gamble_window = Window_Base.new(80, 150, 384, 56)
@gamble_window.openness = 0
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
update_menu_background
@help_window.update
@command_window.update
@gold_window.update
@dummy_window.update
@buy_window.update
@sell_window.update
@number_window.update
@status_window.update
@gamble_window.update
if @command_window.active
update_command_selection
elsif @buy_window.active
update_buy_selection
elsif @sell_window.active
update_sell_selection
elsif @buy_confirm_window != nil
update_buy_confirm
elsif @number_window.active
update_number_input
elsif @gamble_window.active
update_gamble_window
end
end
#--------------------------------------------------------------------------
# * Update Buy Confirmation
#--------------------------------------------------------------------------
def update_buy_confirm
@buy_confirm_window.update
if Input.trigger?(Input::B)
@buy_window.active = true
@buy_confirm_window.dispose
@buy_window.visible = true
elsif Input.trigger?(Input::C)
case @buy_confirm_window.index
when 0
Sound.play_shop
has_prefix = rand(100) < OECS::EPSS::HavePrefixChanceGambleShop
has_suffix = rand(100) < OECS::EPSS::HaveSuffixChanceGambleShop
has_prefix, has_suffix = false, false if @item.note.include?("<unique>")
index = @item.is_a?(RPG::Weapon) ? $data_weapons.size : $data_armors.size
OECS.create(@item, has_prefix, has_suffix)
if @item.is_a?(RPG::Weapon)
@item = $data_weapons.size == index ? @item : $data_weapons[index]
elsif @item.is_a?(RPG::Armor)
@item = $data_armors.size == index ? @item : $data_armors[index]
end
$game_party.lose_gold(@price)
$game_party.gain_item(@item, 1)
@gold_window.refresh
@buy_window.refresh
@status_window.refresh
@buy_window.visible = true
@buy_confirm_window.dispose
@buy_confirm_window = nil
@gamble_window.contents.clear
@gamble_window.contents.draw_text(0, 0, 352, 24, @item.name + ' gained', 1)
@gamble_window.open
@gamble_window.active = true
when 1
Sound.play_cancel
@buy_window.active = true
@buy_confirm_window.dispose
@buy_confirm_window = nil
@buy_window.visible = true
end
end
end
#--------------------------------------------------------------------------
# * Update Gamble Item Selection
#--------------------------------------------------------------------------
def update_gamble_window
if Input.trigger?(Input::B)
Sound.play_cancel
@gamble_window.close
@gamble_window.active = false
@buy_window.active = true
end
if Input.trigger?(Input::C)
Sound.play_decision
@gamble_window.close
@gamble_window.active = false
@buy_window.active = true
end
end
#--------------------------------------------------------------------------
# * Update Buy Item Action
#--------------------------------------------------------------------------
def update_buy_selection
@status_window.item = @buy_window.item
if Input.trigger?(Input::B)
Sound.play_cancel
@command_window.active = true
@dummy_window.visible = true
@buy_window.active = false
@buy_window.visible = false
@status_window.visible = false
@status_window.item = nil
@help_window.set_text("")
return
end
if Input.trigger?(Input::C)
@item = @buy_window.item
number = $game_party.item_number(@item)
if @item == nil or @item.price > $game_party.gold or number == 99
Sound.play_buzzer
elsif @item.is_a?(RPG::Weapon) or @item.is_a?(RPG::Armor)
Sound.play_decision
@price = @item.price.to_f*OECS::EPSS::GamblePriceMultiplier
@price = @price.to_i
Sound.play_buzzer if $game_party.gold < @price
return if $game_party.gold < @price
@buy_confirm_window = Window_GambleConfirm.new(0, 112, @item)
@buy_confirm_window.active = true
@buy_window.active = false
@buy_window.visible = false
else
Sound.play_decision
max = @item.price == 0 ? 99 : $game_party.gold / @item.price
max = [max, 99 - number].min
@buy_window.active = false
@buy_window.visible = false
@number_window.set(@item, max, @item.price)
@number_window.active = true
@number_window.visible = true
end
end
end
end
#================================================= =============================
# ** Window_WordedShopBuy
#------------------------------------------------------------------------------
# This window displays buyable goods on the worded shop screen.
#================================================= =============================
class Window_WordedShopBuy < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :shop_goods_temp_words
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 304, 304)
@shop_goods = $game_temp.shop_goods
@shop_goods_temp_words = []
randomize_some_words
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Get Item
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Make random prefixes/suffixes for equipments
#--------------------------------------------------------------------------
def randomize_some_words
for goods_item in @shop_goods
case goods_item[0]
when 0
@shop_goods_temp_words.push([nil, nil])
when 1
has_prefix = rand(100) < OECS::EPSS::HavePrefixChanceWordedShop
has_suffix = rand(100) < OECS::EPSS::HaveSuffixChanceWordedShop
has_prefix has_suffix = false, false if $data_weapons[goods_item[1]].note.include?("<unique>")
words = []
if has_prefix
index = rand(Prefix.weapon_prefix_array.size)
prefix = Prefix.weapon_prefix_array[index]
words.push(prefix)
else
words.push(nil)
end
if has_suffix
index = rand(Suffix.weapon_suffix_array.size)
suffix = Suffix.weapon_suffix_array[index]
words.push(suffix)
else
words.push(nil)
end
@shop_goods_temp_words.push(words)
when 2
armor = $data_armors[goods_item[1]]
has_prefix = rand(100) < OECS::EPSS::HavePrefixChanceWordedShop
has_suffix = rand(100) < OECS::EPSS::HaveSuffixChanceWordedShop
has_prefix, has_suffix = false, false if armor.note.include?("<unique>")
words = []
prefix_array = Prefix.armor_prefix_array[armor.kind]
suffix_array = Suffix.armor_suffix_array[armor.kind]
if has_prefix
index = rand(prefix_array.size)
prefix = prefix_array[index]
words.push(prefix)
else
words.push(nil)
end
if has_suffix
index = rand(suffix_array.size)
suffix = suffix_array[index]
words.push(suffix)
else
words.push(nil)
end
@shop_goods_temp_words.push(words)
end
end
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
@current_index = 0
@data = []
for goods_item in @shop_goods
next if goods_item == nil
case goods_item[0]
when 0
item = $data_items[goods_item[1]]
when 1
item = $data_weapons[goods_item[1]]
when 2
item = $data_armors[goods_item[1]]
end
if item != nil
@data.push(item)
end
end
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Draw Item Name
# item : Item (skill, weapon, armor are also possible)
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# enabled : Enabled flag. When false, draw semi-transparently.
#--------------------------------------------------------------------------
def draw_item_name(item, x, y, enabled = true)
if item != nil
draw_icon(item.icon_index, x, y, enabled)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
if item.is_a?(RPG::Armor) or item.is_a?(RPG::Weapon)
data = @shop_goods_temp_words[@current_index]
prefix = data[0] == nil ? '' : data[0].name + ' '
suffix = data[1] == nil ? '' : ' ' + data[1].name
name = prefix + item.name + suffix
self.contents.draw_text(x + 24, y, 172, WLH, name)
else
self.contents.draw_text(x + 24, y, 172, WLH, item.name)
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
number = $game_party.item_number(item)
enabled = (item.price <= $game_party.gold and number < 99)
rect = item_rect(index)
self.contents.clear_rect(rect)
draw_item_name(item, rect.x, rect.y, enabled)
rect.width -= 4
presuf = @shop_goods_temp_words[@current_index]
prefix_price = presuf[0] == nil ? 0 : presuf[0].price
suffix_price = presuf[1] == nil ? 0 : presuf[1].price
price = item.price + prefix_price + suffix_price
self.contents.draw_text(rect, price, 2)
@current_index += 1
end
#--------------------------------------------------------------------------
# * Update Help Text
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(item == nil ? "" : item.description)
end
end
#================================================= =============================
# ** Scene_WordedShop
#------------------------------------------------------------------------------
# This class performs worded shop screen processing.
#================================================= =============================
class Scene_WordedShop < Scene_Shop
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
@buy_window = Window_WordedShopBuy.new(0, 112)
@buy_window.active = false
@buy_window.visible = false
@buy_window.help_window = @help_window
end
#--------------------------------------------------------------------------
# * Update Buy Confirmation
#--------------------------------------------------------------------------
def update_buy_confirm
@buy_confirm_window.update
if Input.trigger?(Input::B)
@buy_window.active = true
@buy_confirm_window.dispose
@buy_confirm_window = nil
@buy_window.visible = true
elsif Input.trigger?(Input::C)
case @buy_confirm_window.index
when 0
Sound.play_shop
presuf = @buy_window.shop_goods_temp_words[@buy_window.index]
prefix_price = presuf[0] == nil ? 0 : presuf[0].price
suffix_price = presuf[1] == nil ? 0 : presuf[1].price
price = @item.price + prefix_price + suffix_price
$game_party.lose_gold(price)
gain_the_item(@item, 1)
@gold_window.refresh
@buy_window.refresh
@status_window.refresh
when 1
Sound.play_cancel
end
@buy_window.active = true
@buy_confirm_window.dispose
@buy_confirm_window = nil
@buy_window.visible = true
end
end
#--------------------------------------------------------------------------
# * Update Buy Item Selection
#--------------------------------------------------------------------------
def update_buy_selection
@status_window.item = @buy_window.item
if Input.trigger?(Input::B)
Sound.play_cancel
@command_window.active = true
@dummy_window.visible = true
@buy_window.active = false
@buy_window.visible = false
@status_window.visible = false
@status_window.item = nil
@help_window.set_text("")
return
end
if Input.trigger?(Input::C)
@item = @buy_window.item
presuf = @buy_window.shop_goods_temp_words[@buy_window.index]
prefix_price = presuf[0] == nil ? 0 : presuf[0].price
suffix_price = presuf[1] == nil ? 0 : presuf[1].price
price = @item.price + prefix_price + suffix_price
number = $game_party.item_number(@item)
if @item == nil or price > $game_party.gold or number == 99
Sound.play_buzzer
elsif @item.is_a?(RPG::Weapon) or @item.is_a?(RPG::Armor)
Sound.play_decision
pref = presuf[0] == nil ? nil : presuf[0].name
suff = presuf[1] == nil ? nil : presuf[1].name
@buy_confirm_window = Window_ShopConfirmBuy.new(0, 112, @item, pref, suff)
@buy_confirm_window.active = true
@buy_window.active = false
@buy_window.visible = false
else
Sound.play_decision
max = price == 0 ? 99 : $game_party.gold / price
max = [max, 99 - number].min
@buy_window.active = false
@buy_window.visible = false
@number_window.set(@item, max, price)
@number_window.active = true
@number_window.visible = true
end
end
end
#--------------------------------------------------------------------------
# * Create the item with the temporary prefix/suffix
#--------------------------------------------------------------------------
def gain_the_item(item, number = 1)
presuf = @buy_window.shop_goods_temp_words[@buy_window.index]
prefix = presuf[0]
suffix = presuf[1]
if item.is_a?(RPG::Item)
$game_party.gain_item(item, number)
elsif item.is_a?(RPG::Weapon)
Manual_Create.weapon(item.id, prefix, suffix, number)
else
Manual_Create.armor(item.id, prefix, suffix, number)
end
end
end
#================================================= =============================
# ** Manual_Create
#------------------------------------------------------------------------------
# This class contains the methods for manually creating prefixed/suffixed items
#================================================= =============================
class Manual_Create
#--------------------------------------------------------------------------
# * Manually Create an weapon
# id : weapon id in the database
# prefix : prefix string (must exist in the configurations)
# suffix : prefix string (must exist in the configurations)
#--------------------------------------------------------------------------
def self.weapon(id, prefix, suffix, number = 1)
prefix = "" if prefix == nil
suffix = "" if suffix == nil
prefix = prefix.name unless prefix.is_a?(String)
suffix = suffix.name unless suffix.is_a?(String)
has_prefix = prefix == "" ? false : true
has_suffix = suffix == "" ? false : true
for i in 0...number
index = OECS.create($data_weapons[id], has_prefix, has_suffix, prefix, suffix)
$game_party.gain_item($data_weapons[index], 1)
end
end
#--------------------------------------------------------------------------
# * Manually Create an armor
# id : armor id in the database
# prefix : prefix string (must exist in the configurations)
# suffix : prefix string (must exist in the configurations)
#--------------------------------------------------------------------------
def self.armor(id, prefix, suffix, number = 1)
prefix = "" if prefix == nil
suffix = "" if suffix == nil
prefix = prefix.name unless prefix.is_a?(String)
suffix = suffix.name unless suffix.is_a?(String)
has_prefix = prefix == "" ? false : true
has_suffix = suffix == "" ? false : true
for i in 0...number
index = OECS.create($data_armors[id], has_prefix, has_suffix, prefix, suffix)
$game_party.gain_item($data_armors[index], 1)
end
end
end
#================================================= =============================
# ** Appended_Word
#------------------------------------------------------------------------------
# This class deals with the properties of appended word objects and the main
# method for creating a prefixed/suffixed item. It is the superclass of
# Prefix and Suffix
#================================================= =============================
class Appended_Word
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :name
attr_accessor :description
attr_accessor rice
attr_accessor :hit
attr_accessor :atk
attr_accessor :def
attr_accessor :spi
attr_accessor :agi
attr_accessor :eva
attr_accessor :two_handed
attr_accessor :fast_attack
attr_accessor :dual_attack
attr_accessor :critical_bonus
attr_accessor revent_critical
attr_accessor :half_mp_cost
attr_accessor :double_exp_gain
attr_accessor :auto_hp_recover
attr_accessor :element_set_att
attr_accessor :state_set_att
attr_accessor :element_set_def
attr_accessor :state_set_def
attr_accessor :monkey_grip
attr_accessor :durability
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(name, effect_string, description)
@name = name
@description = ''
@description = description unless description == nil
@types = [] # 0 - weapon, 1-4 armor 1 - 4
@price = 0
@hit = 0
@atk = 0
@def = 0
@spi = 0
@agi = 0
@eva = 0
@durability = 0
@two_handed = false
@fast_attack = false
@dual_attack = false
@critical_bonus = false
@prevent_critical = false
@half_mp_cost = false
@double_exp_gain = false
@auto_hp_recover = false
@monkey_grip = false
@element_set_att = []
@state_set_att = []
@element_set_def = []
@state_set_def = []
@monkey_grip = false
read_properties(effect_string) unless effect_string == nil
end
#--------------------------------------------------------------------------
# * Read properties from the string of effects
# effect_string : string that contains all effects of the word
#--------------------------------------------------------------------------
def read_properties(effect_string)
effect_string.gsub!(/\,/){"\n"}
effect_string.each_line{|s| apply_effect(s)}
end
#--------------------------------------------------------------------------
# * Apply the effect
# string : the property name
#--------------------------------------------------------------------------
def apply_effect(string)
effect = ""
value = 0
string.gsub!("\n"){""}
string.scan(/([A-Za-z_]+)/){|s| effect = s[0]}
string.scan(/([\+\-0-9]+)/){|s| value = s[0]}
value = value == nil ? 0 : value.to_i
case effect
when "price"
@price = value
when "hit"
@hit = value
when "atk"
@atk = value
when "def"
@def = value
when "spi"
@spi = value
when "agi"
@agi = value
when "eva"
@eva = value
when "durability"
@durability = value
when "two_handed"
@two_handed = true
when "fast_attack"
@fast_attack = true
when "dual_attack"
@dual_attack = true
when "critical_bonus"
@critical_bonus = true
when "prevent_critical"
@prevent_critical = true
when "half_mp_cost"
@half_mp_cost = true
when "double_exp_gain"
@double_exp_gain = true
when "auto_hp_recover"
@auto_hp_recover = true
when "monkey_grip"
@monkey_grip = true
when "element_att"
@element_set_att.push(value)
when "element_def"
@element_set_def.push(value)
when "state_att"
@state_set_att.push(value)
when "state_def"
@state_set_def.push(value)
end
end
def self.empty_word
return Appended_Word.new('','','')
end
end
#================================================= =============================
# ** Prefix
#------------------------------------------------------------------------------
# This class deals with prefixes, the word before the item
#================================================= =============================
class Prefix < Appended_Word
#--------------------------------------------------------------------------
# * Arrays Of All Prefixes
#--------------------------------------------------------------------------
@@weapon_prefix_array = []
if Object.constants.include?("MS_MOD")
@@armor_prefix_array = Array.new(MS_MOD::ARMOR_KINDS.size)
else
@@armor_prefix_array = Array.new(4)
end
for i in 0...@@armor_prefix_array.size
@@armor_prefix_array[i] = Array.new
end
#--------------------------------------------------------------------------
# * Get Weapon Prefix Array
#--------------------------------------------------------------------------
def self.weapon_prefix_array
return @@weapon_prefix_array
end
def self.armor_prefix_array
return @@armor_prefix_array
end
#--------------------------------------------------------------------------
# * Object Initialization
# name : name of the prefix
# type : item types the prefix can attach to
# effect_string : string of all effects
# description : the description added to the item when it is attached
#--------------------------------------------------------------------------
def initialize(name, type, effect_string, description)
super(name, effect_string, description)
for i in 0...type.size
next if type[i] < 0
if type[i] == 0
@@weapon_prefix_array.push(self)
else
@@armor_prefix_array[type[i] - 1].push(self)
end
end
end
end
#================================================= =============================
# ** Suffix
#------------------------------------------------------------------------------
# This class deals with suffixes, the word before the item
#================================================= =============================
class Suffix < Appended_Word
#--------------------------------------------------------------------------
# * Arrays Of All Suffixes
#--------------------------------------------------------------------------
@@weapon_suffix_array = []
if Object.constants.include?("MS_MOD")
@@armor_suffix_array = Array.new(MS_MOD::ARMOR_KINDS.size)
else
@@armor_suffix_array = Array.new(4)
end
for i in 0...@@armor_suffix_array.size
@@armor_suffix_array[i] = Array.new
end
#--------------------------------------------------------------------------
# * Get Weapon Suffix Array
#--------------------------------------------------------------------------
def self.weapon_suffix_array
return @@weapon_suffix_array
end
#--------------------------------------------------------------------------
# * Get Shield Suffix Array
#--------------------------------------------------------------------------
def self.armor_suffix_array
return @@armor_suffix_array
end
#--------------------------------------------------------------------------
# * Object Initialization
# name : name of the suffix
# type : item types the suffix can attach to
# effect_string : string of all effects
# description : the description added to the item when it is attached
#--------------------------------------------------------------------------
def initialize(name, type, effect_string, description)
name = 'of ' + name if OECS::EPSS::PutOfToSuffixes
super(name, effect_string, description)
for i in 0...type.size
next if type[i] < 0
if type[i] == 0
@@weapon_suffix_array.push(self)
else
@@armor_suffix_array[type[i] - 1].push(self)
end
end
end
end
if OECS::EPSS::EnableTextColors
class Window_Base
alias oecs_epss_wb_draw_item_name draw_item_name
def draw_item_name(item, x, y, enabled = true)
if item.is_a?(RPG::Weapon) or item.is_a?(RPG::Armor)
draw_icon(item.icon_index, x, y, enabled)
self.contents.font.color = get_epss_item_color(item)
self.contents.font.color.alpha /= 2 unless enabled
self.contents.draw_text(x + 24, y, 172, WLH, item.name)
else
oecs_epss_wb_draw_item_name(item, x, y, enabled)
end
end
def get_epss_item_color(item)
if not item.identified and OECS::EPSS::RequireIdentification
return Color.new(*(OECS::EPSS::UnidentifiedColor))
elsif item.epss_color_mode == 1
return Color.new(*(OECS::EPSS::SingleWordedColor))
elsif item.epss_color_mode == 2
return Color.new(*(OECS::EPSS:oubleWordedColor))
else
return Color.new(*(OECS::EPSS::UniqueColor)) if item.note.include?("<unique>")
return Color.new(*(OECS::EPSS::NormalColor))
end
end
end
end
if OECS::EPSS::EquipmentWindowSingleColumn
class Window_EquipItem
alias oecs_epss_wei_draw_item_name draw_item_name
alias oecs_epss_wei_item_rect item_rect
def item_rect(*args)
@column_max = OECS::EPSS::EquipmentWindowSingleColumn ? 1 : 2
oecs_epss_wei_item_rect(*args)
end
def draw_item_name(item, x, y, enabled = true)
oecs_epss_wei_draw_item_name(item, x, y, enabled)
if item != nil
rect = Rect.new(x + 24, y, 410, WLH)
self.contents.clear_rect(rect)
self.contents.draw_text(rect, item.name)
end
end
end
end
if OECS::EPSS::ItemWindowSingleColumn
class Window_Item
alias oecs_epss_wi_draw_item_name draw_item_name
alias oecs_epss_wi_item_rect item_rect
def item_rect(*args)
@column_max = 1
oecs_epss_wi_item_rect(*args)
end
unless self.is_a?(Window_EquipItem) and not OECS::EPSS::EquipmentWindowSingleColumn
def draw_item_name(item, x, y, enabled = true)
oecs_epss_wi_draw_item_name(item, x, y, enabled)
if item != nil
rect = Rect.new(x + 24, y, 410, WLH)
self.contents.clear_rect(rect)
self.contents.draw_text(rect, item.name)
end
end
end
end
end
if OECS::RemoveQuantityCountOnEquip
class Window_Item
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
number = $game_party.item_number(item)
enabled = enable?(item)
rect.width -= 4
draw_item_name(item, rect.x, rect.y, enabled)
self.contents.font.color = normal_color
unless item.is_a?(RPG::Weapon) or item.is_a?(RPG::Armor)
self.contents.draw_text(rect, sprintf(":%2d", number), 2)
end
end
end
end
end
if OECS::EPSS::RequireIdentification
module RPG
class Weapon
alias oecs_epss_name name
alias oecs_epss_description description
alias oecs_epss_price price
alias oecs_epss_atk atk
alias oecs_epss_def def
alias oecs_epss_spi spi
alias oecs_epss_agi agi
if OECS.constants.include?("Durability")
alias oecs_epss_durability oecs_epss_durability
end
alias oecs_epss_state_set state_set
alias oecs_epss_element_set element_set
alias oecs_epss_two_handed two_handed
def two_handed
if @identified
return self.oecs_epss_two_handed
else
return self.mother_item.two_handed
end
end
alias oecs_epss_dual_attack dual_attack
def dual_attack
if @identified
return self.oecs_epss_dual_attack
else
return self.mother_item.dual_attack
end
end
alias oecs_epss_critical_bonus critical_bonus
def critical_bonus
if @identified
return self.oecs_epss_critical_bonus
else
return self.mother_item.critical_bonus
end
end
alias oecs_epss_fast_attack fast_attack
def fast_attack
if @identified
return self.oecs_epss_fast_attack
else
return self.mother_item.fast_attack
end
end
def price
if @identified
return self.oecs_epss_price
else
return self.mother_item.price
end
end
def atk
if @identified
return self.oecs_epss_atk
else
return self.mother_item.atk
end
end
def def
if @identified
return self.oecs_epss_def
else
return self.mother_item.def
end
end
def spi
if @identified
return self.oecs_epss_spi
else
return self.mother_item.spi
end
end
def agi
if @identified
return self.oecs_epss_agi
else
return self.mother_item.agi
end
end
if OECS.constants.include?("Durability")
def durability
if @identified
return self.oecs_epss_durability
else
return self.mother_item.durability
end
end
end
def element_set
if @identified
return self.oecs_epss_element_set
else
return self.mother_item.element_set
end
end
def state_set
if @identified
return self.oecs_epss_state_set
else
return self.mother_item.state_set
end
end
end
class Armor
alias oecs_epss_name name
alias oecs_epss_description description
alias oecs_epss_price price
alias oecs_epss_atk atk
alias oecs_epss_def def
alias oecs_epss_spi spi
alias oecs_epss_agi agi
if OECS.constants.include?("Durability")
alias oecs_epss_durability durability
end
alias oecs_epss_state_set state_set
alias oecs_epss_element_set element_set
alias oecs_epss_prevent_critical prevent_critical
def prevent_critical
if @identified
return self.oecs_epss_prevent_critical
else
return self.mother_item.critical
end
end
alias oecs_epss_half_mp_cost half_mp_cost
def half_mp_cost
if @identified
return self.oecs_epss_half_mp_cost
else
return self.mother_item.critical
end
end
alias oecs_epss_double_exp_gain double_exp_gain
def double_exp_gain
if @identified
return self.oecs_epss_double_exp_gain
else
return self.mother_item.critical
end
end
alias oecs_epss_auto_hp_recover auto_hp_recover
def auto_hp_recover
if @identified
return self.oecs_epss_auto_hp_recover
else
return self.mother_item.critical
end
end
def price
if @identified
return self.oecs_epss_price
else
return self.mother_item.price
end
end
def atk
if @identified
return self.oecs_epss_atk
else
return self.mother_item.atk
end
end
def def
if @identified
return self.oecs_epss_def
else
return self.mother_item.def
end
end
def spi
if @identified
return self.oecs_epss_spi
else
return self.mother_item.spi
end
end
def agi
if @identified
return self.oecs_epss_agi
else
return self.mother_item.agi
end
end
if OECS.constants.include?("Durability")
def durability
if @identified
return self.oecs_epss_durability
else
return self.mother_item.durability
end
end
end
def element_set
if @identified
return self.oecs_epss_element_set
else
return self.mother_item.element_set
end
end
def state_set
if @identified
return self.oecs_epss_state_set
else
return self.mother_item.state_set
end
end
end
end
module OECS::EquipInclude
def name
if @identified
return self.oecs_epss_name
else
return self.mother_item.name + OECS::EPSS::AddToUnidentifiedName
end
end
def description
if @identified
return self.oecs_epss_description
else
return self.mother_item.description
end
end
end
class Scene_Item
alias oecs_epss_update_item_selection update_item_selection
def update_item_selection
if @item_window.item.is_a?(RPG::Item) and
@item_window.item.identifyer? and Input.trigger?(Input::C)
Sound.play_decision
$scene = Scene_IdentifyItems.new
return
end
oecs_epss_update_item_selection
end
end
class Scene_IdentifyItems < Scene_Base
def start
super
create_menu_background
@title_window = Window_Help.new
@title_window.set_text(OECS::EPSS::IdentifyQuestio n)
@unidentified_window = Window_UnidentifiedItems.new(0, 56, 544, 360)
@question_window = Window_CommandWithQuestion.new(220, OECS::EPSS::IdentifyQuestionSingle,
[OECS::EPSS::IdentifyConfirm, OECS::EPSS::IdentifyCancel])
@question_window.openness = 0
@question_window.active = false
@question_window.x = 162
@question_window.y = 156
end
def terminate
super
dispose_menu_background
@title_window.dispose
@unidentified_window.dispose
end
def update
super
@title_window.update
@unidentified_window.update
@question_window.update
if @unidentified_window.active
update_item_choice
elsif @question_window.active
update_identify_confirm
end
end
def update_item_choice
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Item.new
elsif Input.trigger?(Input::C)
if @unidentified_window.item.identified
Sound.play_buzzer
else
Sound.play_decision
@question_window.active = true
@question_window.open
@unidentified_window.active = false
end
end
end
def update_identify_confirm
if Input.trigger?(Input::B)
Sound.play_cancel
@question_window.close
@unidentified_window.active = true
@question_window.active = false
elsif Input.trigger?(Input::C)
Sound.play_decision
if @question_window.index == 0
unless OECS::EPSS::IdentifySoundEffect.empty?
Audio.se_play('Audio/SE/' + OECS::EPSS::IdentifySoundEffect)
end
@unidentified_window.item.identified = true
@unidentified_window.refresh
$game_party.consume_item($data_items[OECS::EPSS::IdentifyerItem])
$scene = Scene_Item.new if $game_party.item_number($data_items[OECS::EPSS::IdentifyerItem]) == 0
end
@question_window.close
@unidentified_window.active = true
@question_window.active = false
end
end
end
class Window_UnidentifiedItems < Window_Item
def refresh
@data = []
for item in $game_party.items
next unless include?(item)
if item.is_a?(RPG::Weapon) or item.is_a?(RPG::Armor)
@data.push(item)
end
end
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
def enable?(item)
return item.identified == false
end
end
module RPG
class Item
def identifyer?
return @id == OECS::EPSS::IdentifyerItem
end
end
end
end
#================================================= =============================
# ** Scene_Title
#------------------------------------------------------------------------------
# This class performs the title screen processing.
#================================================= =============================
class Scene_Title
#--------------------------------------------------------------------------
# * Alias List
#--------------------------------------------------------------------------
alias oz_oecs_epss_initialize_oecs initialize_oecs
#--------------------------------------------------------------------------
# * Load data from the configurations and create the prefix/suffix objects
#--------------------------------------------------------------------------
def initialize_oecs
oz_oecs_epss_initialize_oecs
for prefix in OECS::EPSS::Prefixes
prefix.is_a?(Array) ? prefix_ = Prefix.new(prefix[0], prefix[1], prefix[2], prefix[3]) : break
end
for suffix in OECS::EPSS::Suffixes
suffix.is_a?(Array) ? suffix_ = Suffix.new(suffix[0], suffix[1], suffix[2], suffix[3]) : break
end
if OECS::EPSS::RequireIdentification
for equipment in ($data_armors + $data_weapons).compact
equipment.identified = true
end
end
end
end
#================================================= =============================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs the map screen processing.
#================================================= =============================
class Scene_Map
#--------------------------------------------------------------------------
# * Alias List
#--------------------------------------------------------------------------
alias oz_oecs_epss_call_shop call_shop
#--------------------------------------------------------------------------
# * Switch To Shop Screen
#--------------------------------------------------------------------------
def call_shop
oz_oecs_epss_call_shop
if $game_switches[OECS::EPSS::WordedShopSwitch]
$scene = Scene_WordedShop.new
elsif $game_switches[OECS::EPSS::GambleShopSwitch]
$scene = Scene_GambleShop.new
end
end
end
Спойлер скрипт3:#================================================= ==============================
# **OECS Slot system v1.22
#-------------------------------------------------------------------------------
# This script allows you to have slotted equipment, which you can attach items
# like gems, and gain additional effects from those.
#
# The attach gem scene appears at equip in the menu, choose the item then choose
# the item to be equipped, instead of being equipped a window will pop-up
# giving you an option to equip the item or attach gems to it.
#
# Put script above main, below OECS main, below any equipment-altering script.
#================================================= ==============================
=begin
First Initialize the equipment with slots
to do this, type this at the equipment's note box
<possible_slots(min-max)>
where min is an integer which is the minimum possible slots
and where min is an integer which is the minimum possible slots
Or you could type this:
<possible_slots(val)>
for a constant val number of slots
If you do not type anything, the number of slots will be initialized
to the default number of slots (which is set at the options below)
Then Initialize the items that can be attached to equipment
To do that, first type this in its note box:
<attachable_to_slot(types)>
where types are the types of equipment which it can be attached to
0 - weapon
1 - shield
2 - helmet
3 - body armor
4 - accessory
put it like this for multiple types : type, type, type
i.e.
<attachable_to_slot(1, 2, 3)>
Then set its parameters
to do that type this :
<params: parameter>
where parameter is the parameter added to item when attached.
The tags are the same as the one in OECS
IMPORTANT NOTE: You have to do this separately for each parameter.
i.e. (an items note box)
<attachable_to_slot(1, 2, 3)>
<params: atk+10>
<params: two_handed>
<params: state_def(2)>
Parameter Tags
The parameter tags are the same as the one in OECS's prefixes/suffixes
all types:
price+val = added price, doesn't affect gamble
atk+val = adds val to attack stat
def+val
spi+val
agi+val
weapon only tags: (when prefix/suffix is gained in armor, does nothing)
hit+val = adds to hit stat
element_att(val) = attack gains element id (val)
state_att(val) = attack has a chance to give state
two_handed = turns weapon to two handed
monkey_grip = turns two handed to one handed
fast_attack = same as in the database
dual_attack
critical_bonus
armor only tags:
eva+val
element_def(val) = added resistance to element id (val)
state_def(val) = add a resistance to state id val
prevent_critical = same as in the database
half_mp_cost
double_exp_gain
auto_hp_recover
You can Edit the Options Below:
================================================== =============================
=end
#================================================= =============================
# ** OECS::SLOT
#------------------------------------------------------------------------------
# A module for OECS slot system options
#================================================= =============================
module OECS
module SLOT
#--------------------------------------------------------------------------
# * Options
#--------------------------------------------------------------------------
SEPlayedAtAttach = "Open1"
DefaultNumberOfSlots = 3
# terms
NameAtTheTopOfAttachWindow = "Gem Attachment"
AttachToSlotQuestion = "Attach to slot?"
# the 2 term at the window that pops up at the equip scene
AttachToSlotPopUp = "Attach to slots"
EquipAtPopUpWindow = "Equip"
AgreeAttach = "Yes"
DisagreeAttach = "No"
#================================================= =============================#
################################################## ##############################
#================================================= =============================#
end
#================================================= =============================
# ** OECS::EquipInclude
#------------------------------------------------------------------------------
# a module for performing mix-ins in both equipment
#================================================= =============================
module EquipInclude
#------------------------------------------------------------------------
# * Public Instance Variables
#------------------------------------------------------------------------
attr_accessor :item_slotted
attr_accessor :slots
#------------------------------------------------------------------------
# * Possible number of slots
#------------------------------------------------------------------------
def possible_slots
s = @note.scan(/\<possible_slots\(([0-9]+)\-([0-9]+)\)\>/)
s = @note.scan(/\<possible_slots\(([0-9]+)\)\>/) if s[0] == nil
s = s[0]
return OECS::SLOT:efaultNumberOfSlots if s == nil
if s.size == 1
s = s[0]
return s.to_i
else
s[0] = s[0].to_i
s[1] = s[1].to_i
return s
end
end
end
end
#================================================= =============================
# ** RPG
#------------------------------------------------------------------------------
# A module containing RPGVX Data Structures.
#================================================= =============================
module RPG
#================================================= ===========================
# ** RPG::Item
#----------------------------------------------------------------------------
# Data class for Items.
#================================================= ===========================
class Item
#------------------------------------------------------------------------
# * Returns what types of equipment the item can attach to.
#------------------------------------------------------------------------
def slot_for_what
s = @note.scan(/\<attachable\_to\_slot.+$/)
s = s[0]
return [-1] if s == nil
type_arr = s.scan(/[0-9]+/)
type_arr_ = []
for type in type_arr
type = type.to_i
type_arr_.push(type)
end
return type_arr_
end
#------------------------------------------------------------------------
# * Array of different effects the item gives when it is attached
#------------------------------------------------------------------------
def slot_effects
effects = []
s = @note.scan(/<params\.+)$/)
for str in s
effect = str[0]
effect.gsub!(/\s|\>/){""}
effects.push(effect)
end
return effects
end
end
end
#================================================= =============================
# ** Scene_Equip
#------------------------------------------------------------------------------
# This class performs the equipment screen processing.
#================================================= =============================
class Scene_Equip
#--------------------------------------------------------------------------
# * Alias List
#--------------------------------------------------------------------------
alias oz_oecsc_ss_start start
alias oz_oecsc_ss_terminate terminate
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
oz_oecsc_ss_start
@choose_attach = Window_Command.new(172, [OECS::SLOT::EquipAtPopUpWindow, OECS::SLOT::AttachToSlotPopUp])
@choose_attach.openness = 0
@choose_attach.active = false
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
oz_oecsc_ss_terminate
@choose_attach.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
update_menu_background
@help_window.update
update_equip_window
update_status_window
update_item_windows
if @equip_window.active
update_equip_selection
elsif @choose_attach.active
update_choose_attach
elsif @item_window.active
update_item_selection
end
end
#--------------------------------------------------------------------------
# * Update Choice to attach
#--------------------------------------------------------------------------
def update_choose_attach
@choose_attach.update
if Input.trigger?(Input::B)
Sound.play_cancel
close_choose_attach
elsif Input.trigger?(Input::C)
Sound.play_decision
case @choose_attach.index
when 0
equip_item
close_choose_attach
when 1
$scene = Scene_AttachItem.new(@item_window.item)
end
end
end
#--------------------------------------------------------------------------
# * Equip The Item
#--------------------------------------------------------------------------
def equip_item
Sound.play_equip
@actor.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
#--------------------------------------------------------------------------
# * 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)
@item_window.item == nil ? equip_item : open_choose_attach
end
end
#--------------------------------------------------------------------------
# * Open Choice to attach window
#--------------------------------------------------------------------------
def open_choose_attach
Sound.play_decision
@item_window.active = false
@choose_attach.open
@choose_attach.index = 0
@choose_attach.visible = true
@choose_attach.active = true
index = @item_window.index
if index%2 == 1
@choose_attach.x = 100
index -= 1
else
@choose_attach.x = 272
end
@choose_attach.y = 216 + 24*(@item_window.index/2)
if @choose_attach.y > (540 - @choose_attach.height)
@choose_attach.y = 540 - @choose_attach.height
end
end
#--------------------------------------------------------------------------
# * Cloase Choice to attach window
#--------------------------------------------------------------------------
def close_choose_attach
Sound.play_cancel
@item_window.active = true
@choose_attach.openness = 0
@choose_attach.visible = false
@choose_attach.active = false
end
end
#================================================= =============================
# ** Scene_AttachItem
#------------------------------------------------------------------------------
# This class performs the slot attachment screen processing.
#================================================= =============================
class Scene_AttachItem < Scene_Base
#--------------------------------------------------------------------------
# * Object Initialization
# item : equipment to be attached with
#--------------------------------------------------------------------------
def initialize(item)
@item = item
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
create_menu_background
create_windows
end
#--------------------------------------------------------------------------
# * Termination processing
#--------------------------------------------------------------------------
def terminate
dispose_menu_background
@title_window.dispose
@item_window.dispose
@attachable_items_window.dispose
@question_window.dispose
@help_window.dispose
end
#--------------------------------------------------------------------------
# * Create Windows
#--------------------------------------------------------------------------
def create_windows
@title_window = Window_Base.new(0, 0, 544, 56)
@title_window.contents.draw_text(0, 0, 512, 24, OECS::SLOT::NameAtTheTopOfAttachWindow, 1)
@title_window.open
@item_window = Window_Base.new(0, 56, 544, 56)
refresh
@item_window.open
@help_window = Window_Help.new
@help_window.y = 112
@help_window.open
item_type = @item.is_a?(RPG::Weapon) ? 0 : @item.kind + 1
@attachable_items_window = Window_AttachableItem.new(0, 168, 544, 248, item_type)
@attachable_items_window.open
@question_window = Window_SlotConfirm.new(0, 0, 172, [OECS::SLOT::AgreeAttach, OECS::SLOT:isagreeAttach])
@question_window.active = false
@question_window.openness = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
@item_window.contents.clear
@item_window.draw_item_name(@item, 0, 0)
@item_window.contents.font.color.alpha = 150
plurality = @item.slots == 1 ? " slot" : " slots"
slots = @item.slots.to_s
slots = "No more" if @item.slots == 0
slot_string = "(" + slots + plurality + " available)"
@item_window.contents.draw_text(256, 0, 248, 24, slot_string, 2)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@title_window.update
@item_window.update
@help_window.update
@attachable_items_window.item == nil ? @help_window.set_text("") : @help_window.set_text(@attachable_items_window.ite m.description)
if @attachable_items_window.active
@attachable_items_window.update
elsif @question_window.active
@question_window.update
end
if Input.trigger?(Input::B)
Sound.play_cancel
if @attachable_items_window.active
$scene = Scene_Equip.new
elsif @question_window.active
close_question_window
end
elsif Input.trigger?(Input::C)
if @attachable_items_window.active
if @attachable_items_window.item == nil or @item.slots == 0
Sound.play_buzzer
else
Sound.play_decision
open_question_window
end
elsif @question_window.active
case @question_window.index
when 0
Sound.play_decision
attach_item
when 1
close_question_window
Sound.play_decision
end
end
end
end
#--------------------------------------------------------------------------
# * Attach item to slot
#--------------------------------------------------------------------------
def attach_item
string = @attachable_items_window.item.slot_effects
effect = ""
value = 0
for s in string
str = s
s.scan(/([A-Za-z_]+)/){|s| effect = s[0]}
s = str
s.scan(/([\+\-0-9]+)/){|s| value = s[0]}
value = value == nil ? 0 : value.to_i
apply_effect_to_item(effect, value)
end
se = "Audio/SE/"
se += OECS::SLOT::SEPlayedAtAttach
Audio.se_play(se) unless OECS::SLOT::SEPlayedAtAttach.empty?
$game_party.consume_item(@attachable_items_window. item)
@attachable_items_window.draw_item(@attachable_ite ms_window.index)
@item.slots -= 1
close_question_window
refresh
end
#--------------------------------------------------------------------------
# * Apply the slot item effect to equipment
#--------------------------------------------------------------------------
def apply_effect_to_item(effect, value)
case effect
when "price"
@item.price += value
when "hit"
@item.hit += value if @item.is_a?(RPG::Weapon)
when "atk"
@item.atk += value
when "def"
@item.def += value
when "spi"
@item.spi += value
when "agi"
@item.agi += value
when "eva"
@item.eva += value if @item.is_a?(RPG::Armor)
when "two_handed"
@item.two_handed = true if @item.is_a?(RPG::Weapon)
when "fast_attack"
@item.fast_attack = true if @item.is_a?(RPG::Weapon)
when "dual_attack"
@item.dual_attack = true if @item.is_a?(RPG::Weapon)
when "critical_bonus"
@item.critical_bonus = true if @item.is_a?(RPG::Weapon)
when "prevent_critical"
@item.prevent_critical = true if @item.is_a?(RPG::Armor)
when "half_mp_cost"
@item.half_mp_cost = true if @item.is_a?(RPG::Armor)
when "double_exp_gain"
@item.double_exp_gain = true if @item.is_a?(RPG::Armor)
when "auto_hp_recover"
@item.auto_hp_recover = true if @item.is_a?(RPG::Armor)
when "monkey_grip"
@item.two_handed = false if @item.is_a?(RPG::Weapon)
when "element_att"
@item.element_set.push(value) if @item.is_a?(RPG::Weapon)
when "element_def"
@item.element_set.push(value) if @item.is_a?(RPG::Armor)
when "state_att"
@item.state_set.push(value) if @item.is_a?(RPG::Weapon)
when "state_def"
@item.state_set.push(value) if @item.is_a?(RPG::Armor)
end
end
#--------------------------------------------------------------------------
# * Open Confirm attach window
#--------------------------------------------------------------------------
def open_question_window
@attachable_items_window.active = false
@question_window.open
@question_window.index = 0
@question_window.visible = true
@question_window.active = true
index = @attachable_items_window.index
if index%2 == 1
@question_window.x = 100
index -= 1
else
@question_window.x = 272
end
@question_window.y = 168 + 24*(@attachable_items_window.index/2)
if @question_window.y > (540 - @question_window.height)
@question_window.y = 540 - @question_window.height
end
end
#--------------------------------------------------------------------------
# * Close Confirm attach window
#--------------------------------------------------------------------------
def close_question_window
@attachable_items_window.active = true
@question_window.openness = 0
@question_window.visible = false
@question_window.active = false
end
end
#================================================= =============================
# ** Game_Party
#------------------------------------------------------------------------------
# This class handles the party. It includes information on amount of gold
# and items. The instance of this class is referenced by $game_party.
#================================================= =============================
class Game_Party
#--------------------------------------------------------------------------
# * Get Attachable Items
# type : equipment type
#--------------------------------------------------------------------------
def attachable_items(type)
result = []
for i in @items.keys.sort
item = $data_items[i]
result.push($data_items[i]) if @items[i] > 0 and item.slot_for_what.include?(type)
end
return result
end
end
#================================================= =============================
# ** Window_SlotConfirm
#------------------------------------------------------------------------------
# This window is used to select attach item confirmation choice
#================================================= =============================
class Window_SlotConfirm < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y, width, commands)
row_max = commands.size
super(0, 0, width, row_max * WLH + 56, 32)
@commands = commands
@item_max = commands.size
@column_max = 1
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
self.index = 0
self.contents.draw_text(0, 0, width - 32, 24, OECS::SLOT::AttachToSlotQuestion, 1)
end
#--------------------------------------------------------------------------
# * Get rectangle for displaying items
# index : item number
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = (contents.width + @spacing) / @column_max - @spacing
rect.height = WLH
rect.x = index % @column_max * (rect.width + @spacing)
rect.y = index / @column_max * WLH + 24
return rect
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# enabled : enabled flag. When false, draw semi-transparently.
#--------------------------------------------------------------------------
def draw_item(index, enabled = true)
rect = item_rect(index)
rect.x += 4
rect.width -= 10
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(rect, @commands[index], 1)
end
end
#================================================= =============================
# ** Window_AttachableItem
#------------------------------------------------------------------------------
# This window displays a list of inventory items that are attachable
#================================================= =============================
class Window_AttachableItem < Window_Item
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y, width, height, item_type)
@item_type = item_type
super(x, y, width, height)
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
@data = []
for item in $game_party.attachable_items(@item_type)
next unless include?(item)
@data.push(item)
if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id
self.index = @data.size - 1
end
end
@data.push(nil) if include?(nil)
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Whether or not to display in enabled state
#--------------------------------------------------------------------------
def enable?(item)
return true
end
end
#================================================= =============================
# ** Scene_Title
#------------------------------------------------------------------------------
# This class performs the title screen processing.
#================================================= =============================
class Scene_Title
#--------------------------------------------------------------------------
# * Alias List
#--------------------------------------------------------------------------
alias oz_oecs_ss_initialize_oecs initialize_oecs
#--------------------------------------------------------------------------
# * Initialize slot number for weapons that exist from the start
# i.e. the player's default equipment
#--------------------------------------------------------------------------
def initialize_oecs
oz_oecs_ss_initialize_oecs
for weapon in $data_weapons
next if weapon == nil
if weapon.slots == nil
weapon.slots = slot_number_temp(weapon)
end
end
for armor in $data_armors
next if armor == nil
if armor.slots == nil
armor.slots = slot_number_temp(weapon)
end
end
end
#--------------------------------------------------------------------------
# * Make a temporary number of slots
# item : the item with the slots
#--------------------------------------------------------------------------
def slot_number_temp(item)
slots = item.possible_slots
return slots if slots.is_a?(Integer)
slot_diff = rand(slots[1] - slots[0] + 1)
slots = slots[1] - slot_diff
return slots
end
end
# For dervvulfan's multi-slot
if Object.constants.include?("MS_MOD")
class Scene_Equip
def update_item_selection
if Input.trigger?(Input::C)
index = @equip_window.index
current_item = @item_window.item
unless current_item == nil || @actor.equippable?(current_item)
Sound.play_buzzer
return
end
unless current_item == nil
switched = @actor.switch_items(current_item)
end
end
if Input.trigger?(Input::B)
Sound.play_cancel
@equip_window.active = true
@item_window.active = false
@item_window.index = -1
end
if Input.trigger?(Input::C)
unless switched == nil
if current_item.is_a?(RPG::Weapon)
gained_item = $data_weapons[switched]
else
gained_item = $data_armors[switched]
end
@item_window.item == nil ? equip_item : open_choose_attach
end
end
end
end
end
Спойлер скрипт4:#================================================= ==============================
# **OECS Equipment Upgrade System v1.1
#-------------------------------------------------------------------------------
# This script allows you to have be able to upgrade equipment. giving it more
# power each upgrade.
#
# Put script above main, below OECS main
#================================================= ==============================
=begin
Instructions:
Set Options below
To call the upgrade shop, type this in the script section
$scene = Scene_EquipmentUpgradeShop.new
=end
#================================================= =============================
# ** OECS::Upgrade
#------------------------------------------------------------------------------
# A module for OECS Equipment Upgrade System Options
#================================================= =============================
module OECS
module Upgrade
# OPTIONS:
# Max upgrade level for equipments
MaxEqLevel = 10
# upgrade price ratio in %
UpgradePriceRatio = 10
# besides the upgrade price ratio, this is added to the item's price
# you may make upgradepriceratio to 0 to make a constant price for all.
ConstantPricePlus = 100
# multiply ratio by level, so that it would get more expensive each level
MultiplyRatioByLevel = true
# Growth of non-zero parameters of the equipment per plus in %
ParameterGrowthRatio = 5
# if an equipment parameter is not equal to 0 this is the minimum
# value it can increase at an upgrade
MinimumGrowth = 1
# Show addition in name i.e. Club+7
ShowAdditionInName = true
# terms
# when equipment is maxed
EqMaxed = 'level maxed'
# for those with <cannot_be_upgraded> tag
CantBeUpgraded = "can't be upgraded"
# at the top of the shop
UpgradeShopTerm = 'Upgrade Shop'
# At the requirements
RequirementTerm = 'Requires:'
# at the command window
WeaponTerm = 'Weapon'
ArmorTerm = 'Armor'
# confirmation question
UpgradeWeaponTerm = 'Upgrade Weapon?'
UpgradeArmorTerm = 'Upgrade Armor?'
# confirm choice
AgreeUpgrade = 'Upgrade'
DisagreeUpgrade = 'No'
=begin
EQUIPMENT TAGS:
Put these tags on the weapons/armors
<upgrade_requires: id, id, id >
id is the item id required for equipment to be upgraded.
you may put as many as you want, and you may
also put duplicates.
<upgrade_price+: val>
val is added to the price of the upgrade, besides the calculation from the
options above.
<upgrade_price*: val>
val is multiplied by the equipment's level, then added to the upgrade price
<cant_be_upgraded>
for items that cannot be upgraded.
=end
#================================================= =============================#
################################################## ##############################
#================================================= =============================#
end
end
module RPG
class Weapon
alias oecs_upgrade_name name # Need to alias before mixin.
end
class Armor
alias oecs_upgrade_name name
end
end
#================================================= ===========================
# ** OECS::EquipInclude
#----------------------------------------------------------------------------
# a module for performing mix-ins in both equipment
#================================================= ===========================
module OECS
module EquipInclude
#------------------------------------------------------------------------
# * Public Instance Variables
#------------------------------------------------------------------------
attr_accessor :upgrade_level
def upgrade_plus
text = self.note.scan(/\<upgrade\_price\+:\s*([0-9]+)\s*\>/)
text = text[0]
return 0 if text == nil
return text[0].to_i
end
def upgrade_exp
text = self.note.scan(/\<upgrade\_price\*:\s*([0-9]+)\s*\>/)
text = text[0]
return 0 if text == nil
return text[0].to_i
end
if OECS::Upgrade::ShowAdditionInName
def name
if @upgrade_level == 0
return self.oecs_upgrade_name
else
temp_name = self.oecs_upgrade_name
temp_name += ' +' + @upgrade_level.to_s
return temp_name
end
end
end
def name_no_plus
return self.oecs_upgrade_name
end
def upgrade_requires
hash = {}
text = self.note.scan(/\<upgrade\_requires:\s*(.+)\s*\>/)
text = text[0]
return hash if text == nil
text = text[0]
text.split(/[\,\s]/).each do |num|
num = num.to_i
hash.keys.include?(num) ? hash[num] += 1 : hash[num] = 1
end
return hash
end
end
end
#================================================= =============================
# ** Window_UpgradeConfirm
#------------------------------------------------------------------------------
# This window confirms if the player will upgrade the item.
#================================================= =============================
class Window_UpgradeConfirm < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :item
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y, item)
row_max = 2
super(x, y, 300, 304, 32)
@commands = [OECS::Upgrade::AgreeUpgrade, OECS::Upgrade:isagreeUpgrade]
@item_max = 2
@column_max = 1
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
@item = item
self.index = 0
if @item.is_a?(RPG::Weapon)
self.contents.draw_text(0, 50, width - 32, 24, OECS::Upgrade::UpgradeWeaponTerm, 0)
else
self.contents.draw_text(0, 50, width - 32, 24, OECS::Upgrade::UpgradeArmorTerm, 0)
end
draw_item_name(item, 0, 100)
end
#--------------------------------------------------------------------------
# * Get rectangle for displaying items
# index : item number
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = (contents.width + @spacing) / @column_max - @spacing
rect.height = WLH
rect.x = index % @column_max * (rect.width + @spacing)
rect.y = index / @column_max * WLH + 160
return rect
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# enabled : enabled flag. When false, draw semi-transparently.
#--------------------------------------------------------------------------
def draw_item(index, enabled = true)
rect = item_rect(index)
rect.x += 4
rect.width -= 10
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(rect, @commands[index], 1)
end
alias oecs_upgrade_draw_item_name draw_item_name
def draw_item_name(item, x, y, enabled = true)
oecs_upgrade_draw_item_name(item, x, y, enabled)
rect = Rect.new(x + 24, y, 245, WLH)
self.contents.clear_rect(rect)
self.contents.draw_text(x + 24, y, 240, WLH, item.name) if item != nil
end
end
#================================================= =============================
# ** Scene_EquipmentUpgradeShop
#------------------------------------------------------------------------------
# This class performs equipment upgrade shop screen processing.
#================================================= =============================
class Scene_EquipmentUpgradeShop < Scene_Base
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
create_command_window
@help_window = Window_Help.new
@gold_window = Window_Gold.new(384, 56)
@dummy_window = Window_Base.new(0, 112, 544, 304)
@help_window.set_text(OECS::Upgrade::UpgradeShopTe rm)
@weapon_window = Window_Upgradeable.new(0, 112, 300, 304, 'weapon')
@details_window = Window_UpgradeDetails.new
@details_window.visible = false
@weapon_window.active = false
@weapon_window.visible = false
@weapon_window.help_window = @details_window
@armor_window = Window_Upgradeable.new(0, 112, 300, 304, 'armor')
@armor_window.active = false
@armor_window.visible = false
@armor_window.help_window = @details_window
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@help_window.dispose
@gold_window.dispose
@details_window.dispose
@command_window.dispose
@dummy_window.dispose
@weapon_window.dispose
@armor_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
update_menu_background
@help_window.update
@dummy_window.update
@gold_window.update
@weapon_window.update
@armor_window.update
@command_window.update
@details_window.update
if @command_window.active
update_command_window
elsif @weapon_window.active
update_weapon_window
elsif @armor_window.active
update_armor_window
elsif @confirm_upgrade_window != nil
update_confirm_upgrade
end
end
#--------------------------------------------------------------------------
# * Update Command Selection
#--------------------------------------------------------------------------
def update_command_window
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
Sound.play_decision
case @command_window.index
when 0
@weapon_window.active = true
@weapon_window.visible = true
@details_window.visible = true
@dummy_window.visible = false
@command_window.active = false
when 1
@armor_window.active = true
@armor_window.visible = true
@details_window.visible = true
@dummy_window.visible = false
@command_window.active = false
when 2
Sound.play_cancel
$scene = Scene_Map.new
end
end
end
#--------------------------------------------------------------------------
# * Update Weapon Window
#--------------------------------------------------------------------------
def update_weapon_window
if Input.trigger?(Input::B)
Sound.play_cancel
@weapon_window.active = false
@weapon_window.visible = false
@details_window.visible = false
@dummy_window.visible = true
@command_window.active = true
elsif Input.trigger?(Input::C)
if @weapon_window.item == nil or not @weapon_window.enable?(@weapon_window.item)
Sound.play_buzzer
return
end
Sound.play_decision
@weapon_window.active = false
@weapon_window.visible = false
@confirm_upgrade_window = Window_UpgradeConfirm.new(0, 112, @weapon_window.item)
end
end
#--------------------------------------------------------------------------
# * Update Armor Window
#--------------------------------------------------------------------------
def update_armor_window
if Input.trigger?(Input::B)
Sound.play_cancel
@armor_window.active = false
@armor_window.visible = false
@details_window.visible = false
@dummy_window.visible = true
@command_window.active = true
elsif Input.trigger?(Input::C)
if @armor_window.item == nil or not @armor_window.enable?(@armor_window.item)
Sound.play_buzzer
return
end
Sound.play_decision
@armor_window.active = false
@armor_window.visible = false
@confirm_upgrade_window = Window_UpgradeConfirm.new(0, 112, @armor_window.item)
end
end
#--------------------------------------------------------------------------
# * Update Upgrade Decision
#--------------------------------------------------------------------------
def update_confirm_upgrade
@confirm_upgrade_window.update
if Input.trigger?(Input::B)
Sound.play_cancel
if @confirm_upgrade_window.item.is_a?(RPG::Weapon)
@weapon_window.active = true
@weapon_window.visible = true
else
@armor_window.active = true
@armor_window.visible = true
end
@confirm_upgrade_window.dispose
@confirm_upgrade_window = nil
elsif Input.trigger?(Input::C)
if @confirm_upgrade_window.index == 0
upgrade_item(@confirm_upgrade_window.item)
if @confirm_upgrade_window.item.is_a?(RPG::Weapon)
@weapon_window.refresh
else
@armor_window.refresh
end
@details_window.refresh
end
if @confirm_upgrade_window.item.is_a?(RPG::Weapon)
@weapon_window.active = true
@weapon_window.visible = true
else
@armor_window.active = true
@armor_window.visible = true
end
@confirm_upgrade_window.dispose
@confirm_upgrade_window = nil
end
end
#--------------------------------------------------------------------------
# * Process Item Upgrade
#--------------------------------------------------------------------------
def upgrade_item(item)
if item.is_a?(RPG::Weapon)
$game_party.lose_gold(@weapon_window.upgrade_price (@weapon_window.item))
else
$game_party.lose_gold(@armor_window.upgrade_price( @armor_window.item))
end
for id in item.upgrade_requires.keys
$game_party.lose_item($data_items[id], item.upgrade_requires[id])
end
item.upgrade_level += 1
upgrade_params(item)
@gold_window.refresh
Sound.play_shop
end
#--------------------------------------------------------------------------
# * Upgrade the item's parameters
#--------------------------------------------------------------------------
def upgrade_params(item)
params_item = item
unless item.mother_item_id == nil
params_item = item.is_a?(RPG::Weapon) ? $data_weapons[item.mother_item_id] : $data_armors[item.mother_item_id]
end
param = (params_item.atk.to_f*OECS::Upgrade::ParameterGrow thRatio/100).to_i
param = OECS::Upgrade::MinimumGrowth if param < OECS::Upgrade::MinimumGrowth and params_item.atk != 0
item.atk += param
param = (params_item.def.to_f*OECS::Upgrade::ParameterGrow thRatio/100).to_i
param = OECS::Upgrade::MinimumGrowth if param < OECS::Upgrade::MinimumGrowth and params_item.def != 0
item.def += param
param = (params_item.spi.to_f*OECS::Upgrade::ParameterGrow thRatio/100).to_i
param = OECS::Upgrade::MinimumGrowth if param < OECS::Upgrade::MinimumGrowth and params_item.spi != 0
item.spi += param
param = (params_item.agi.to_f*OECS::Upgrade::ParameterGrow thRatio/100).to_i
param = OECS::Upgrade::MinimumGrowth if param < OECS::Upgrade::MinimumGrowth and params_item.agi != 0
item.agi += param
end
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
def create_command_window
s1 = OECS::Upgrade::WeaponTerm
s2 = OECS::Upgrade::ArmorTerm
s3 = Vocab::ShopCancel
@command_window = Window_Command.new(384, [s1, s2, s3], 3)
@command_window.y = 56
end
end
#================================================= =============================
# ** Window_Upgradeable
#------------------------------------------------------------------------------
# This window displays a list of inventory items depending on the type
#================================================= =============================
class Window_Upgradeable < Window_Item
#--------------------------------------------------------------------------
# * Object Initialization
# x : window x-coordinate
# y : window y-coordinate
# width : window width
# height : window height
# type : item type (weapon or armor)
#--------------------------------------------------------------------------
def initialize(x, y, width, height, type)
@type = type
super(x, y, width, height)
@column_max = 1
refresh
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
number = $game_party.item_number(item)
enabled = enable?(item)
rect.width -= 4
draw_item_name(item, rect.x, rect.y, enabled)
end
end
#--------------------------------------------------------------------------
# * Whether or not to display in enabled state
# item : item
#--------------------------------------------------------------------------
def enable?(item)
return false if item.note.include?("<cant_be_upgraded>")
return false if upgrade_price(item) > $game_party.gold
return false if item.upgrade_level >= OECS::Upgrade::MaxEqLevel
return evaluate_item_requirements(item)
end
def evaluate_item_requirements(item)
for id in item.upgrade_requires.keys
next if id == 0
unless $game_party.items.include?($data_items[id]) and $game_party.item_number($data_items[id]) >= item.upgrade_requires[id]
return false
end
end
return true
end
#--------------------------------------------------------------------------
# * Return the price of the upgrade of the item
#--------------------------------------------------------------------------
def upgrade_price(item)
price = item.price.to_f * (OECS::Upgrade::UpgradePriceRatio.to_f/100)
price *= (item.upgrade_level + 1) if OECS::Upgrade::MultiplyRatioByLevel
price += OECS::Upgrade::ConstantPricePlus
price += item.upgrade_plus
price += item.upgrade_exp*(item.upgrade_level + 1)
price = price.to_i
return price
end
alias oecs_upgrade_draw_item_name draw_item_name
def draw_item_name(item, x, y, enabled = true)
oecs_upgrade_draw_item_name(item, x, y, enabled)
rect = Rect.new(x + 24, y, 240, WLH)
self.contents.clear_rect(rect)
self.contents.draw_text(x + 24, y, 240, WLH, item.name) if item != nil
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
@data = []
for item in $game_party.items
next unless include?(item)
if @type == 'weapon'
next unless item.is_a?(RPG::Weapon)
else
next unless item.is_a?(RPG::Armor)
end
@data.push(item)
end
@data.push(nil) if include?(nil)
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
def update_help
return if self.item == nil or @help_window == nil
@help_window.set_data(self.item, upgrade_price(self.item))
end
end
class Window_UpgradeDetails < Window_Base
def initialize
super(300, 112, 244, 304)
end
def set_data(item, price, refresh = false)
return if item == @item unless refresh
@item = item
@price = price
self.contents.clear
draw_item_name(item, 0, 0)
if item.note.include?("<cant_be_upgraded>")
self.contents.draw_text(0, WLH, 212, WLH, OECS::Upgrade::CantBeUpgraded, 1)
return
elsif item.upgrade_level < OECS::Upgrade::MaxEqLevel
self.contents.draw_text(0, WLH, 212, WLH, '+ ' + item.upgrade_level.to_s + ' ', 2)
else
self.contents.draw_text(0, WLH, 212, WLH, OECS::Upgrade::EqMaxed, 1)
return
end
self.contents.draw_text(0, WLH*2, 212, WLH, OECS::Upgrade::RequirementTerm)
draw_currency_value(price, 4, WLH*3, 204)
item.upgrade_requires.keys.each_with_index do |id, index|
draw_item_name($data_items[id], 0, WLH*(index + 4))
end
end
def refresh
set_data(@item, @price, true)
end
def draw_item_name(item, x, y, enabled = true)
if item != nil
draw_icon(item.icon_index, x, y, enabled)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
if item.is_a?(RPG::Item)
self.contents.draw_text(x + 24, y, 180, WLH, item.name)
else
self.contents.draw_text(x + 24, y, 180, WLH, item.name_no_plus)
end
end
end
def draw_currency_value(value, x, y, width)
cx = contents.text_size(value.to_s).width
self.contents.font.color = normal_color
self.contents.draw_text(x, y, width, WLH, value, 0)
self.contents.font.color = system_color
self.contents.draw_text(x+cx+2, y, width, WLH, Vocab::gold, 0)
end
end
#================================================= =============================
# ** Scene_Title
#------------------------------------------------------------------------------
# This class performs the title screen processing.
#================================================= =============================
class Scene_Title
#--------------------------------------------------------------------------
# * Alias List
#--------------------------------------------------------------------------
alias oz_oecs_equpgrade_initialize_oecs initialize_oecs
#--------------------------------------------------------------------------
# * Initialize all nil upgrade levels to 0
#--------------------------------------------------------------------------
def initialize_oecs
oz_oecs_equpgrade_initialize_oecs
for weapon in $data_weapons
next if weapon == nil
weapon.upgrade_level = 0 if weapon.upgrade_level == nil
end
for armor in $data_armors
next if armor == nil
armor.upgrade_level = 0 if armor.upgrade_level == nil
end
end
end
и последний
Спойлер 5:#================================================= ==============================
# **OECS Durability System v1.00 *BETA*
#-------------------------------------------------------------------------------
# This script allows you to have a "durability" property on equipments. The
# equipments would break if durability reaches to zero, unless you repair it.
#
# Put script above main, below OECS main, below any custom battle(i.e. tankentai)
#================================================= ==============================
=begin
Instructions:
Set the options below
put this tag in the equipments note box, to set its durability:
<durability: val>
where val is the max durability for that item
Otherwise if you dont set it it would use the default durability at the
options below.
use this tag, on a skill to denote a skill that uses up durability.
<durability_decrease: val>
where val is the durability decrease
you can also put that to an enemy skill for their skill to damage durability
=end
#================================================= =============================
# ** OECS:urability
#------------------------------------------------------------------------------
# A module for OECS durability system options
#================================================= =============================
module OECS
module Durability
# durability of weapons that are not set in the database
DefaultWeaponDurability = 50
# durability of armors that are not set in the database
DefaultArmorDurability = 50
# chance per attack to decrease weapon durability by one
ChancePerAttackToDecreaseDur = 100
# chance per enemy attack to decrease armors' durability by one
ChancePerDefendToDecreaseDur = 30
# show durabilty at the description
ShowDurabilityAtDescription = true
# if above is true, this is what is shown (where the %d are the numbers)
DurabilityShownAtDescription = "Dur. : %d/%d"
# message when the item is broken first %s is actor name, second is item
BrokenMessage = "%s's %s is broken"
#================================================= =============================#
################################################## ##############################
#================================================= =============================#
end
#--------------------------------------------------------------------------
# * Repair all Items
#--------------------------------------------------------------------------
def self.repair_all
for weapon in $data_weapons
next if weapon == nil
weapon.durability = weapon.durability_max
end
for armor in $data_armors
next if armor == nil
armor.durability = armor.durability_max
end
end
#================================================= ===========================
# ** OECS::EquipInclude
#----------------------------------------------------------------------------
# a module for performing mix-ins in both equipment
#================================================= ===========================
module EquipInclude
#------------------------------------------------------------------------
# * Public Instance Variables
#------------------------------------------------------------------------
attr_reader :durability
#------------------------------------------------------------------------
# * Set Durability
#------------------------------------------------------------------------
def durability=(value)
@durability = [[value, 0].max, durability_max].min
end
#------------------------------------------------------------------------
# * Get Maximum Durability
#------------------------------------------------------------------------
def durability_max
self.note.each_line{|line|
if line =~ /<durability\:\s/
value = line.scan(/[0-9]+/)
value = value[0].to_i
return value
end }
return OECS:urability:efaultWeaponDurability
end
end
end
#================================================= =============================
# ** RPG
#------------------------------------------------------------------------------
# A module containing RPGVX Data Structures.
#================================================= =============================
module RPG
#================================================= ===========================
# ** RPG::Skill
#----------------------------------------------------------------------------
# Data class for skills
#================================================= ===========================
class Skill
#------------------------------------------------------------------------
# * Return the durability the skill consumes/damages
#------------------------------------------------------------------------
def durability_decrease
self.note.each_line{|line|
if line =~ /<durability_decrease\:\s/
value = line.scan(/[0-9]+/)
value = value[0].to_i
return value
end }
return 0
end
end
end
#================================================= =============================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#================================================= =============================
class Scene_Battle
#--------------------------------------------------------------------------
# * Alias List
#--------------------------------------------------------------------------
alias oz_oecs_dur_execute_action_attack execute_action_attack
alias oz_oecs_dur_execute_action_skill execute_action_skill
alias oz_oecs_dur_execute_action_escape execute_action_escape
alias oz_oecs_dur_battle_end battle_end
#--------------------------------------------------------------------------
# * Execute Battle Action: Skill
#--------------------------------------------------------------------------
def execute_action_skill
oz_oecs_dur_execute_action_skill
if @active_battler.is_a?(Game_Actor)
return if $data_weapons[@active_battler.weapon_id] == nil
$data_weapons[@active_battler.weapon_id].durability -= @active_battler.action.skill.durability_decrease
if @active_battler.two_swords_style
$data_weapons[@active_battler.armor1_id].durability -= @active_battler.action.skill.durability_decrease
end
else
targets = @active_battler.action.make_targets
for target in targets
for armor_id in [target.armor1_id,target.armor2_id,target.armor3_id ,target.armor4_id]
next if $data_armors[armor_id] == nil
$data_armors[armor_id].durability -= @active_battler.action.skill.durability_decrease
end
end
end
end
#--------------------------------------------------------------------------
# * Execute Battle Action: Attack
#--------------------------------------------------------------------------
def execute_action_attack
oz_oecs_dur_execute_action_attack
if @active_battler.is_a?(Game_Actor)
return if $data_weapons[@active_battler.weapon_id] == nil
if rand(100) < OECS:urability::ChancePerAttackToDecreaseDur
$data_weapons[@active_battler.weapon_id].durability -= 1
end
else
targets = @active_battler.action.make_targets
for target in targets
for armor_id in [target.armor1_id,target.armor2_id,target.armor3_id ,target.armor4_id]
next if $data_armors[armor_id] == nil
next if target.two_swords_style and armor_id == target.armor1_id
if rand(100) < OECS:urability::ChancePerDefendToDecreaseDur
$data_armors[armor_id].durability -= 1
end
end
end
end
end
#--------------------------------------------------------------------------
# * Execute Battle Action: Escape
#--------------------------------------------------------------------------
def execute_action_escape
display_broken_items
oz_oecs_dur_execute_action_escape
end
#--------------------------------------------------------------------------
# * End Battle
# result : Results (0: win, 1: escape, 2:lose)
#--------------------------------------------------------------------------
def battle_end(result)
display_broken_items if result != 2 or $game_party.can_lose
oz_oecs_dur_battle_end(result)
end
#--------------------------------------------------------------------------
# * Display Broken Items
#--------------------------------------------------------------------------
def display_broken_items
$game_message.clear
for actor in $game_party.members
if actor.weapon_id != 0 and $data_weapons[actor.weapon_id].durability == 0
text = sprintf(OECS:urability::BrokenMessage, actor.name, $data_weapons[actor.weapon_id].name)
$game_message.texts.push(text)
$data_weapons[actor.weapon_id] = nil
end
if actor.armor1_id != 0
if not actor.two_swords_style and $data_armors[actor.armor1_id] != nil and
$data_armors[actor.armor1_id].durability == 0
text = sprintf(OECS:urability::BrokenMessage, actor.name, $data_armors[actor.armor1_id].name)
$game_message.texts.push(text)
$data_armors[actor.armor1_id] = nil
elsif actor.two_swords_style and $data_weapons[actor.armor1_id] != nil and
$data_weapons[actor.armor1_id].durability == 0
text = sprintf(OECS:urability::BrokenMessage, actor.name, $data_armors[actor.armor1_id].name)
$game_message.texts.push(text)
$data_weapons[actor.armor1_id] = nil
end
end
if actor.armor2_id != 0 and $data_armors[actor.armor2_id] != nil and
$data_armors[actor.armor2_id].durability == 0
text = sprintf(OECS:urability::BrokenMessage, actor.name, $data_armors[actor.armor2_id].name)
$game_message.texts.push(text)
$data_armors[actor.armor2_id] = nil
end
if actor.armor3_id != 0 and $data_armors[actor.armor3_id] != nil and
$data_armors[actor.armor3_id].durability == 0
text = sprintf(OECS:urability::BrokenMessage, actor.name, $data_armors[actor.armor3_id].name)
$game_message.texts.push(text)
$data_armors[actor.armor3_id] = nil
end
if actor.armor4_id != 0 and $data_armors[actor.armor4_id] != nil and
$data_armors[actor.armor4_id].durability == 0
text = sprintf(OECS:urability::BrokenMessage, actor.name, $data_armors[actor.armor4_id].name)
$game_message.texts.push(text)
$data_armors[actor.armor4_id] = nil
end
end
wait_for_message
end
end
#================================================= =============================
# ** Window_Equip
#------------------------------------------------------------------------------
# This window displays items the actor is currently equipped with on the
# equipment screen.
#================================================= =============================
class Window_Equip
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
text = item == nil ? "" : item.description
if item.is_a?(RPG::Weapon) or item.is_a?(RPG::Armor)
text = sprintf("%s " + OECS:urability:urabilityShownAtDescription, item.description, item.durability, item.durability_max)
end
@help_window.set_text(text)
end
end
#================================================= =============================
# ** Window_Item
#------------------------------------------------------------------------------
# This window displays a list of inventory items for the item screen, etc.
#================================================= =============================
class Window_Item
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
text = item == nil ? "" : item.description
if item.is_a?(RPG::Weapon) or item.is_a?(RPG::Armor)
text = sprintf("%s " + OECS:urability:urabilityShownAtDescription, item.description, item.durability, item.durability_max)
end
@help_window.set_text(text)
end
end
#================================================= =============================
# ** Window_ShopBuy
#------------------------------------------------------------------------------
# This window displays buyable goods on the shop screen.
#================================================= =============================
class Window_ShopBuy
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
text = item == nil ? "" : item.description
if item.is_a?(RPG::Weapon) or item.is_a?(RPG::Armor)
text = sprintf("%s " + OECS:urability:urabilityShownAtDescription, item.description, item.durability, item.durability_max)
end
@help_window.set_text(text)
end
end
#================================================= =============================
# ** Scene_Title
#------------------------------------------------------------------------------
# This class performs the title screen processing.
#================================================= =============================
class Scene_Title
#--------------------------------------------------------------------------
# * Alias List
#--------------------------------------------------------------------------
alias oz_oecs_dur_initialize_oecs initialize_oecs
#--------------------------------------------------------------------------
# * Initialize all nil durabilities levels to durability_max
#--------------------------------------------------------------------------
def initialize_oecs
oz_oecs_dur_initialize_oecs
for weapon in $data_weapons
next if weapon == nil
weapon.durability = weapon.durability_max if weapon.durability == nil
end
for armor in $data_armors
next if armor == nil
armor.durability = armor.durability_max if armor.durability == nil
end
end
end
а не еще 1
Спойлер 6:# I have given up on this. If anyone wants to try, here it is.
#================================================= =============================
# ** OECS::Materia
#------------------------------------------------------------------------------
# A module for OECS Materia System Options
#================================================= =============================
module OECS
module Materia
MasteredText = '-- Mastered --'
NextLevelText = 'next level:'
AP = 'AP'
GeneralType = 'Magic'
QuantityType = 'Summon'
ShowQuantityLeftOfQuantityType = true
SEPlayedAtAttach = "Open1"
DefaultEnemyAP = 1
GainedAPText = "Gained %d AP!" # %d is the amount of AP
#================================================= =============================#
################################################## ##############################
#================================================= =============================#
=begin
#================================================= =============================#
# MAKING MATERIAS #
#================================================= =============================#
(It is recommended to copy paste the tags here, and then just changing a bit)
(everything is in lower case)
(the numbers may be changed, obviously)
(each tag is separated by a newline.)
# note : materia should be consumable, but cannot be used anywhere
#================================================= =============================#
# GENERAL SKILLS #
#================================================= =============================#
- materia that teach the character skills each time it levels up.
- a.k.a. magic materia in FF7
To create a general skill, put first:
<materia>
All materias should start with that tag. then
<materia_type: general_skills>
Then, you put <skills: id, id, id...> the order which you want it to be learned
remember that the first one is already learned.
<skills: 59, 61, 60, 62>
The ap needed, Always the same number as the skills or more than the number
of skills by one. If the ap set is more than the number of skills by one, the
first skill won't be learned yet. the final number is the AP required to master,
which gives birth to a new materia.
<ap: 100, 200, 300, 10000>
Then Optionally, you may add any of the All-Materia tags further down below
End with:
</materia>
#================================================= =============================#
# QUANTITY SKILLS #
#================================================= =============================#
- materia that teach a skill but can only be used a number of times.
- a.k.a. summon materia in FF7
start with
<materia>
<materia_type: quantity_skill>
Then: (only one skill). remember '<skill:', not '<skills:'
<skill: id>
then the ap: remember that the level it has is the maximum number of times it
can be used, unless of course it is mastered, where it cant be used as much as
you want.
<ap: 220, 400, 500, 20000>
Then Optionally, you may add any of the All-Materia tags further down below
End with
</materia>
#================================================= =============================#
# ALL-MATERIA TAGS #
#================================================= =============================#
effect tags for all types of materias. must still be inside <materia> </materia>
Anything else beyond this point does not work yet.
#================================================= =============================#
# PASSIVE SKILLS #
#================================================= =============================#
- skills that give passive effects to the one who equipped it
- a.k.a. independent materia
start with
<materia>
<materia_type: passive_skill>
then the effect tag, which are: (those in () are not included in the tag)
(parameter increase tag)(the numbers are the parameter increase per level
<param: atk 10, 20, 30, 40, 50>
(the parameters are, atk, def, spi, agi, maxhp, maxmp)
or these: (again, recommended to copy paste)
(swap hp & mp, stacks.)
<hp<->mp>
(cover, protects allies when attacked. the numbers are the percentages.)
<cover: 20, 40, 60, 80>
(mega_all, turns normal attack scope to all enemies)
<slash_all>
(counter attack when attacked)
<counter_attack>
(pre_emptive, increase the chance of preemptive attacks by %)
(The value here is added to the absolute chance, )
(that means, if the original chance is 3-5, it becomes 13-15 if the)
(chance written is 10)
<pre_emptive: 10>
(enemy encounter: the number is the percent of encounter rate when it is equipped)
(like enemy lure, 150 or enemy away 50)
<enemy_encounter: 150>
(gold plus, increase gold earned by %)
<gold_plus: 10>
(exp plus, increase exp earned by %, only affects the one who equipped it)
<exp_plus: 10>
(After adding the effect you can optionally add text at the materia data,)
(which is shown below materia level and ap.)
<text: Encounter chocobos!>
then add
<ap: 100, 200, 220, 300>
(unless the passive type is a parameter or cover, it should only, be
<ap: value> and no other levels)
End with
</materia>
#================================================= =============================#
# SUPPORT MATERIA #
#================================================= =============================#
support: all
: counter
: magic_counter
: steal_as_well
: added_cut
: sneak_attack
: added_effect
: elemental
: HPabsorb
: MPabsorb
: MPturbo
: quadra_magic
#================================================= =============================#
# COMMAND MATERIA #
#================================================= =============================#
#================================================= =============================#
# EVENT MATERIA #
#================================================= =============================#
=end
#------------------------------------------------------------------------
# * Reset Materia Data
#------------------------------------------------------------------------
def self.reset_materia(item)
item.materia_level = 0
item.current_ap_gained = 0
end
end
#================================================= ===========================
# ** OECS::EquipInclude
#----------------------------------------------------------------------------
# a module for performing mix-ins in both equipment
#================================================= ===========================
module EquipInclude
#------------------------------------------------------------------------
# * Alias List
#------------------------------------------------------------------------
alias oecs_materia_perform_duplication perform_duplication
def perform_duplication(duplicate)
oecs_materia_perform_duplication(duplicate)
duplicate.materia_slotted = self.materia_slotted.dup unless self.materia_slotted == nil
end
#------------------------------------------------------------------------
# * Public Instance Variables
#------------------------------------------------------------------------
attr_accessor :materia_slotted
#------------------------------------------------------------------------
# * Determine if slottable by materia
#------------------------------------------------------------------------
def materia_slottable?
return self.note.include?('<materia>')
end
#------------------------------------------------------------------------
# * Return an array containing all data related to materia
#------------------------------------------------------------------------
def materia_data
materia_data_flag = false
materia_data_array = []
self.note.split(/[\r\n]+/).each do |line|
case line
when '<materia>'
materia_data_flag = true
when '</materia>'
materia_data_flag = false
else
materia_data_array.push(line) if materia_data_flag
end
end
return materia_data_array
end
#------------------------------------------------------------------------
# * Determine number of slottable materias
#------------------------------------------------------------------------
def materia_slots
for data in materia_data
if data.include?('<slots: ')
_slots_ = data.scan(/\<slots\:\s([0-9]+)\>/)
_slots_ = _slots_[0]
_slots_ = _slots_[0].to_i
return _slots_
end
end
return 0
end
#------------------------------------------------------------------------
# * Determine number of linked slots
#------------------------------------------------------------------------
def slot_links
for data in materia_data
if data.include?('<links: ')
slot_links_ = data.scan(/\<links\:.*([0-9]+)\>/)
slot_links_ = slot_links_[0]
slot_links_ = slot_links_[0].to_i
return slot_links_
end
end
return 0
end
#------------------------------------------------------------------------
# * Determine ap growth of equipment
#------------------------------------------------------------------------
def materia_growth
for data in materia_data
if data.include?('<growth: ')
materia_growth_ = data.scan(/\<growth\:.*([0-9]+)\>/)
materia_growth_ = materia_growth_[0]
materia_growth_ = materia_growth_[0].to_i
return materia_growth_
end
end
return 0
end
end
end
#================================================= ===========================
# ** RPG::Enemy
#----------------------------------------------------------------------------
# Data class for enemies
#================================================= ===========================
module RPG
class Enemy
#------------------------------------------------------------------------
# * Determine AP
#------------------------------------------------------------------------
def materia_ap
self.note.split(/[\r\n]+/).each do |line|
if line.include?("<materia_ap:")
_ap_ = line.scan(/[0-9]+/)
_ap_ = _ap_[0]
return _ap_.to_i
end
end
return OECS::Materia:efaultEnemyAP
end
end
end
class Game_Party
attr_accessor :total_preemptive
alias oecs_materia_initialize initialize
def initialize
oecs_materia_initialize
@total_preemptive = 0
end
def consume_materia(item)
if item.is_a?(RPG::Item)
lose_item(item, 1)
end
end
end
#================================================= =============================
# ** Window_MateriaSlots
#------------------------------------------------------------------------------
# This window displays the materia slots along with the materias attached.
#================================================= =============================
class Window_MateriaSlots < Window_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :index
attr_reader :help_window
def initialize(x, y, type, actor_index, cursor_viewport)
@index = 0
@commands = []
@x = x
@y = y
@float = 0
@cursor_viewport = cursor_viewport
@actor_index = actor_index
@actor = $game_party.members[@actor_index]
super(x, y, 336, 56)
refresh(type, false)
@column_max = 12
draw_cursor
draw_slots
draw_slotted
end
def dispose
@cursor.dispose
super
end
#--------------------------------------------------------------------------
# * Set help window
#--------------------------------------------------------------------------
def help_window=(window)
@help_window = window
update_help
end
#--------------------------------------------------------------------------
# * Determine if there are no slots in the equipment
#--------------------------------------------------------------------------
def empty?
return true if @commands == nil
return @commands.size == 0
end
#--------------------------------------------------------------------------
# * Return item in the current slot pointed at by cursor
#--------------------------------------------------------------------------
def item
return nil if @equipment == nil
return nil if @equipment.materia_slotted == nil
return $data_items[@equipment.materia_slotted[@index]]
end
#--------------------------------------------------------------------------
# * Draw cursor
#--------------------------------------------------------------------------
def draw_cursor
@cursor = Sprite.new(@cursor_viewport)
@cursor.bitmap = Cache.system("materia_cursor")
@cursor.y = @y + 12
update_cursor
end
#--------------------------------------------------------------------------
# * Set index
#--------------------------------------------------------------------------
def index=(value)
@index = [[value, 0].max, @commands.size - 1].min
@index = 0 if @index < 0
update_cursor unless @cursor == nil
end
#--------------------------------------------------------------------------
# * Update cursor position
#--------------------------------------------------------------------------
def update_cursor
@cursor.x = @index*25
update_help
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if active
update_float
else
@cursor.y = @y + 12
@float = 0
end
if active
if Input.repeat?(Input::RIGHT)
cursor_right
update_cursor
update_help
elsif Input.repeat?(Input::LEFT)
cursor_left
update_cursor
update_help
end
end
end
#--------------------------------------------------------------------------
# * Update floating animation of cursor
#--------------------------------------------------------------------------
def update_float
@float += 1
@float %= 20
if @float < 10
@cursor.y += @float%2
else
@cursor.y -= @float%2
end
end
#--------------------------------------------------------------------------
# * Move cursor to the right
#--------------------------------------------------------------------------
def cursor_right
Sound.play_cursor
self.index += 1
end
#--------------------------------------------------------------------------
# * Move cursor to the left
#--------------------------------------------------------------------------
def cursor_left
Sound.play_cursor
self.index -= 1
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(type, draw_the_slots = true)
self.contents.clear
@type = type
last_equipment = @equipment
case @type
when 0
@equipment = $data_weapons[@actor.weapon_id]
when 1
@equipment = $data_armors[@actor.armor1_id]
when 2
@equipment = $data_armors[@actor.armor2_id]
when 3
@equipment = $data_armors[@actor.armor3_id]
when 4
@equipment = $data_armors[@actor.armor4_id]
end
@commands = []
self.index = 0 if @equipment.nil? or last_equipment != @equipment
return self.contents.clear if @equipment == nil
for i in 0...@equipment.materia_slots
@commands.push(' ')
end
@item_max = @commands.size
update_cursor unless @cursor == nil
draw_slots if draw_the_slots
draw_slotted
end
#--------------------------------------------------------------------------
# * Draw the slots
#--------------------------------------------------------------------------
def draw_slots
self.contents.clear
return if @equipment == nil
count = 0
slot_links = @equipment.slot_links
with_materia_growth = @equipment.materia_growth > 0
while count < @equipment.materia_slots
if slot_links > 0
draw_linked(count, with_materia_growth)
slot_links -= 1
count += 2
else
draw_slot(count, with_materia_growth)
count += 1
end
end
end
#--------------------------------------------------------------------------
# * Draw a slot
#--------------------------------------------------------------------------
def draw_slot(count, with_materia_growth = true)
filename = with_materia_growth ? "Materia_WithGrowth" : "Materia_Nogrowth"
bitmap = Cache.system(filename)
rect = Rect.new(0, 0, bitmap.width, bitmap.height)
self.contents.blt(25*count + 2, 0, bitmap, rect)
end
#--------------------------------------------------------------------------
# * Draw 2 linked slots
#--------------------------------------------------------------------------
def draw_linked(count, with_materia_growth = true)
filename = with_materia_growth ? "Materia_DualWithGrowth" : "Materia_DualNoGrowth"
bitmap = Cache.system(filename)
src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
self.contents.blt(25*count + 2, 0, bitmap, src_rect)
end
#--------------------------------------------------------------------------
# * Draw the item slotted to the equipment
#--------------------------------------------------------------------------
def draw_slotted
return if @equipment.nil? or @equipment.materia_slotted == nil
@equipment.materia_slotted.each_with_index do |id, index|
next if id == 0
icon_index = $data_items[id].icon_index
bitmap = Cache.system("Iconset")
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
self.contents.blt(25*index + 2, 0, bitmap, rect, 255)
end
end
#--------------------------------------------------------------------------
# * Update help window
#--------------------------------------------------------------------------
def update_help
return if @help_window.nil?
return unless active
@help_window.contents.clear
@help_window.help_window.set_text('') unless @help_window.help_window.nil?
unless self.item.nil?
@help_window.set_data(self.item)
end
end
end
#================================================= =============================
# ** Window_MateriaData
#------------------------------------------------------------------------------
# This window shows all materia data
#================================================= =============================
class Window_MateriaData < Window_Base
attr_accessor :help_window
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 336, 152)
end
#--------------------------------------------------------------------------
# * Draw materia details
#--------------------------------------------------------------------------
def set_data(materia)
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(0, 0, 304, WLH, materia.name, 0)
draw_materia_level(materia)
draw_ap(materia)
draw_type(materia)
draw_skills(materia)
unless @help_window.nil?
@help_window.set_text(materia.description)
end
end
#--------------------------------------------------------------------------
# * Draw materia level
#--------------------------------------------------------------------------
def draw_materia_level(materia)
lvl = -1
offset = 304 - (materia.materia_max_level + 1)*20
for i in 0..materia.materia_level
lvl += 1
draw_icon(materia.icon_index, lvl*20 + offset, 0, true)
end
lvl += 1
current_lvl = lvl
for i in current_lvl..materia.materia_max_level
draw_icon(materia.icon_index, lvl*20 + offset, 0, false)
lvl += 1
end
end
#--------------------------------------------------------------------------
# * Draw icon
#--------------------------------------------------------------------------
def draw_icon(icon_index, x, y, enabled = true)
bitmap = Cache.system("Iconset")
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
self.contents.blt(x, y, bitmap, rect, enabled ? 255 : 50)
end
#--------------------------------------------------------------------------
# * Draw current AP
#--------------------------------------------------------------------------
def draw_ap(materia)
return self.contents.draw_text(0, WLH, width - 32, WLH, OECS::Materia::MasteredText, 1) if materia.materia_mastered?
self.contents.draw_text(0, WLH, width - 32, WLH, OECS::Materia::NextLevelText, 0)
ap = materia.materia_ap_set[materia.materia_level] - materia.current_ap_gained
self.contents.draw_text(0, WLH, width - 32, WLH, ap.to_s + ' ' + OECS::Materia::AP, 2)
end
#--------------------------------------------------------------------------
# * Draw Materia Type
#--------------------------------------------------------------------------
def draw_type(materia)
string = ''
case materia.materia_type
when 'general_skills'
string = OECS::Materia::GeneralType
when 'quantity_skill'
string = OECS::Materia::QuantityType
self.contents.draw_text(0, WLH*2, width - 32, WLH, sprintf("x %d", materia.materia_level + 1), 2)
when 'passive_skill'
string = materia.materia_text
end
self.contents.draw_text(0, WLH*2, width - 32, WLH, string)
end
#--------------------------------------------------------------------------
# * Draw materia skills
#--------------------------------------------------------------------------
def draw_skills(materia)
enabled = materia.materia_level + 1
index = 0
if materia.materia_type == 'general_skills'
enabled -= 1 if materia.materia_ap_set.size > materia.materia_general_skills.size
materia.materia_general_skills.each_with_index do |id, index|
name = $data_skills[id] == nil ? '' : $data_skills[id].name
if enabled > 0
self.contents.font.color.alpha = 255
self.contents.draw_text(((width - 32)/3)*(index%3),WLH*(index/3 + 3), (width - 32)/3, WLH, name)
enabled -= 1
else
self.contents.font.color.alpha = 128
self.contents.draw_text(((width - 32)/3)*(index%3),WLH*(index/3 + 3), (width - 32)/3, WLH, name)
end
end
end
end
end
#================================================= =============================
# ** Window_Materia
#------------------------------------------------------------------------------
# This window displays all materia in the party's inventory
#================================================= =============================
class Window_Materia < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# x : window x-coordinate
# y : window y-coordinate
# width : window width
# height : window height
#--------------------------------------------------------------------------
def initialize(x, y, materia = nil)
super(x, y, 208, 360)
@materia = materia
@column_max = 1
self.index = -1
refresh
end
alias oecs_materia_activeset active=
def active=(value)
oecs_materia_activeset(value)
self.index = value ? 0 : -1
end
#--------------------------------------------------------------------------
# * Get Item
#--------------------------------------------------------------------------
def materia
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Whether or not to include in item list
# item : item
#--------------------------------------------------------------------------
def include?(materia)
return materia != nil
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
@data = []
for materia in $game_party.items
next unless include?(materia)
next unless materia.is_a?(RPG::Item)
next unless materia.materia?
@data.push(materia)
if materia.id == $game_party.last_item_id
self.index = @data.size - 1
end
end
@data.push(nil)
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
materia = @data[index]
if materia != nil
number = $game_party.item_number(materia)
rect.width -= 4
draw_item_name(materia, rect.x, rect.y, true)
end
end
#--------------------------------------------------------------------------
# * Update Help Text
#--------------------------------------------------------------------------
def update_help
return if @help_window.nil?
@help_window.contents.clear
@help_window.help_window.set_text('') unless @help_window.help_window.nil?
unless self.materia.nil?
@help_window.set_data(self.materia)
end
end
end
if OECS::Materia::ShowQuantityLeftOfQuantityType
class Window_Skill
alias oecs_materia_update_help update_help
def update_help
if $scene.is_a?(Scene_Battle) and @actor.materia_quantity_skills != nil and
skill != nil and @actor.materia_quantity_skills.keys.include?(skill .id)
@help_window.set_text(skill.description + ' x ' + @actor.materia_quantity_skills[skill.id].to_s)
else
@help_window.set_text(skill == nil ? "" : skill.description)
end
end
end
end
#================================================= =============================
# ** Game_Interpreter
#------------------------------------------------------------------------------
# An interpreter for executing event commands. This class is used within the
# Game_Map, Game_Troop, and Game_Event classes.
#================================================= =============================
class Game_Interpreter
#--------------------------------------------------------------------------
# * Change Items
#--------------------------------------------------------------------------
def command_126
value = operate_value(@params[1], @params[2], @params[3])
if $data_items[@params[0]] != nil and $data_items[@params[0]].materia?
item = $data_items[@params[0]]
for i in 0...value
$game_party.gain_item($data_items[OECS.item_create(item)], 1)
end
else
$game_party.gain_item($data_items[@params[0]], value)
end
$game_map.need_refresh = true
return true
end
end
class Game_Enemy
def materia_ap
return enemy.materia_ap
end
end
#================================================= =============================
# ** Scene_Shop
#------------------------------------------------------------------------------
# This class performs shop screen processing.
#================================================= =============================
class Scene_Shop
#--------------------------------------------------------------------------
# * Update Buy Item Selection
#--------------------------------------------------------------------------
def update_buy_selection
@status_window.item = @buy_window.item
if Input.trigger?(Input::B)
Sound.play_cancel
@command_window.active = true
@dummy_window.visible = true
@buy_window.active = false
@buy_window.visible = false
@status_window.visible = false
@status_window.item = nil
@help_window.set_text("")
return
end
if Input.trigger?(Input::C)
@item = @buy_window.item
number = $game_party.item_number(@item)
if @item == nil or @item.price > $game_party.gold or number == 99
Sound.play_buzzer
elsif @item.is_a?(RPG::Weapon) or @item.is_a?(RPG::Armor) or @item.materia?
Sound.play_decision
@buy_confirm_window = Window_ShopConfirmBuy.new(0, 112, @item)
@buy_confirm_window.active = true
@buy_window.active = false
@buy_window.visible = false
else
Sound.play_decision
max = @item.price == 0 ? 99 : $game_party.gold / @item.price
max = [max, 99 - number].min
@buy_window.active = false
@buy_window.visible = false
@number_window.set(@item, max, @item.price)
@number_window.active = true
@number_window.visible = true
end
end
end
end
#================================================= =============================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#================================================= =============================
class Scene_Battle
#--------------------------------------------------------------------------
# * Display Gained Drop Items
#--------------------------------------------------------------------------
def display_drop_items
drop_items = $game_troop.make_drop_items
for item in drop_items
if item.is_a?(RPG::Weapon)
has_prefix, has_suffix = false, false
if OECS.constants.include?("EPSS")
has_prefix = rand(100) < OECS::EPSS::HavePrefixChance
has_suffix = rand(100) < OECS::EPSS::HaveSuffixChance
has_prefix, has_suffix = false, false if item.note.include?("<unique>")
has_prefix, has_suffix = false, false unless OECS::EPSS::GainWordedItemsFromEnemy
end
index = OECS.create(item, has_prefix, has_suffix)
item = $data_weapons[index]
elsif item.is_a?(RPG::Armor)
has_prefix, has_suffix = false, false
if OECS.constants.include?("EPSS")
has_prefix = rand(100) < OECS::EPSS::HavePrefixChance
has_suffix = rand(100) < OECS::EPSS::HaveSuffixChance
has_prefix, has_suffix = false, false if item.note.include?("<unique>")
has_prefix, has_suffix = false, false unless OECS::EPSS::GainWordedItemsFromEnemy
end
index = OECS.create(item, has_prefix, has_suffix)
item = $data_armors[index]
elsif item.materia?
index = OECS.item_create(item)
item = $data_items[index]
end
$game_party.gain_item(item, 1)
text = sprintf(Vocab::ObtainItem, item.name)
$game_message.texts.push(text)
end
gain_materia_ap
wait_for_message
end
#--------------------------------------------------------------------------
# * Gain AP for materia
#--------------------------------------------------------------------------
def gain_materia_ap
ap = 0
for member in $game_troop.members
ap += member.materia_ap
end
text = sprintf(OECS::Materia::GainedAPText, ap)
$game_message.texts.push(text)
for member in $game_party.members
weapon = $data_weapons[member.weapon_id]
if weapon != nil and weapon.materia_slotted != nil
for _id_ in weapon.materia_slotted
next if _id_ == 0
$data_items[_id_].current_ap_gained += ap
for skill_id in $data_items[_id_].materia_general_skills(true)
member.learn_skill(skill_id)
end
end
end
for armor_id in [member.armor1_id, member.armor2_id, member.armor2_id]
armor = $data_armors[armor_id]
if armor != nil and armor.materia_slotted != nil
for id in armor.materia_slotted
next if id == 0
$data_items[id].current_ap_gained += ap
for skill_id in $data_items[id].materia_general_skills(true)
member.learn_skill(skill_id)
end
end
end
end
end
end
end
#================================================= =============================
# ** Scene_Title
#------------------------------------------------------------------------------
# This class performs the title screen processing.
#================================================= =============================
class Scene_Title
#--------------------------------------------------------------------------
# * Alias List
#--------------------------------------------------------------------------
alias oz_oecs_materia_initialize_oecs initialize_oecs
#--------------------------------------------------------------------------
# * Fill all materia slot nil values
#--------------------------------------------------------------------------
def initialize_oecs
oz_oecs_materia_initialize_oecs
for item in $data_items
next if item == nil or not item.materia?
item.materia_level = 0 if item.materia_level == nil
item.current_ap_gained = 0 if item.current_ap_gained == nil
end
for weapon in $data_weapons
next if weapon == nil or not weapon.materia_slottable?
if weapon.materia_slotted == nil
weapon.materia_slotted = Array.new(weapon.materia_slots)
for i in 0...weapon.materia_slotted.size
weapon.materia_slotted[i] = 0
end
end
end
for armor in $data_armors
next if armor == nil or not armor.materia_slottable?
if armor.materia_slotted == nil
armor.materia_slotted = Array.new(armor.materia_slots)
for i in 0...armor.materia_slotted.size
armor.materia_slotted[i] = 0
end
end
end
end
end
#================================================= =============================
# ** Scene_File
#------------------------------------------------------------------------------
# This class performs the save and load screen processing.
#================================================= =============================
class Scene_File
#--------------------------------------------------------------------------
# * Alias List
#--------------------------------------------------------------------------
alias oz_oecs_materia_write_save_data write_save_data
alias oz_oecs_materia_read_save_data read_save_data
#--------------------------------------------------------------------------
# * Write Save Data
# file : write file object (opened)
#--------------------------------------------------------------------------
def write_save_data(file)
oz_oecs_materia_write_save_data(file)
Marshal.dump($data_items, file)
end
#--------------------------------------------------------------------------
# * Read Save Data
# file : file object for reading (opened)
#--------------------------------------------------------------------------
def read_save_data(file)
oz_oecs_materia_read_save_data(file)
$data_items = Marshal.load(file)
end
end
class Game_Actor
attr_accessor :materia_quantity_skills # quantity skills hash
alias oecs_materia_skill_can_use? skill_can_use?
alias oecs_materia_change_equip change_equip
def skill_can_use?(skill)
if $scene.is_a?(Scene_Battle)
if @materia_quantity_skills[skill.id] != nil
return false if @materia_quantity_skills[skill.id] == 0
end
end
oecs_materia_skill_can_use?(skill)
end
def change_equip(equip_type, item, test = false)
case equip_type
when 0
last_equip = $data_weapons[@weapon_id]
when 1
if two_swords_style
last_equip = $data_weapons[@armor1_id]
else
last_equip = $data_armors[@armor1_id]
end
when 2
last_equip = $data_armors[@armor2_id]
when 3
last_equip = $data_armors[@armor3_id]
when 4
last_equip = $data_armors[@armor4_id]
end
unless last_equip.nil? or last_equip.materia_slotted.nil?
for materia in last_equip.materia_slotted
next if materia == 0
$data_items[materia].remove_materia_effects(self)
end
end
oecs_materia_change_equip(equip_type, item, test)
item_id = item.nil? ? 0 : item.id
case equip_type
when 0
equipment = $data_weapons[item_id]
when 1
if two_swords_style
equipment = $data_weapons[item_id]
else
equipment = $data_armos[item_id]
end
when 2
equipment = $data_armors[item_id]
when 3
equipment = $data_armors[item_id]
when 4
equipment = $data_armors[item_id]
end
unless equipment.nil? or equipment.materia_slotted.nil?
for materia in equipment.materia_slotted
next if materia == 0
$data_items[materia].add_materia_effects(self)
end
end
end
attr_accessor :hpmpswaps
alias oecs_materia_initialize initialize
def initialize(*args)
@hpmpswaps = 0
oecs_materia_initialize(*args)
end
alias oecs_materia_maxhp maxhp
alias oecs_materia_maxmp maxmp
def maxhp
if @hpmpswaps % 2 == 1
return oecs_materia_maxmp
else
return oecs_materia_maxhp
end
end
def maxmp
if @hpmpswaps % 2 == 1
return oecs_materia_maxhp
else
return oecs_materia_maxmp
end
end
end
class Scene_Battle
alias oecs_materia_start start
alias oecs_materia_execute_action_skill execute_action_skill
def start
initialize_materia_skills_and_effects
oecs_materia_start
end
def execute_action_skill
oecs_materia_execute_action_skill
if @active_battler.is_a?(Game_Actor)
skill = @active_battler.action.skill
if @active_battler.materia_quantity_skills.keys.inclu de?(skill.id)
@active_battler.materia_quantity_skills[skill.id] -= 1
end
end
end
def initialize_materia_skills_and_effects
initialize_quantity_skills
end
def initialize_quantity_skills
for actor in $game_party.members
actor.materia_quantity_skills = {}
actor.iterate_equips do |equipment|
next unless equipment.materia_slottable?
for i in equipment.materia_slotted
next if i == 0
if $data_items[i].materia_type == 'quantity_skill'
actor.materia_quantity_skills[$data_items[i].materia_quantity_skill] =
$data_items[i].materia_level + 1
end
end
end
end
end
end
#================================================= =============================
# ** RPG
#------------------------------------------------------------------------------
# A module containing RPGVX Data Structures.
#================================================= =============================
module RPG
#================================================= ===========================
# ** RPG::Item
#----------------------------------------------------------------------------
# Data class for items
#================================================= ===========================
class Item
#------------------------------------------------------------------------
# * Public Instance Variables
#------------------------------------------------------------------------
attr_accessor :materia_level
attr_reader :current_ap_gained
#------------------------------------------------------------------------
# * Determine if item is a materia
#------------------------------------------------------------------------
def materia?
return self.note.include?('<materia>')
end
def current_ap_gained=(value)
return if self.materia_mastered?
@current_ap_gained = value
if materia_ap_set[@materia_level] < @current_ap_gained
@current_ap_gained = 0
@materia_level += 1
end
end
#------------------------------------------------------------------------
# * Return an array of all materia data
#------------------------------------------------------------------------
def materia_data
materia_data_flag = false
materia_data_array = []
self.note.split(/[\r\n]+/).each{|line|
case line
when '<materia>'
materia_data_flag = true
when '</materia>'
materia_data_flag = false
else
materia_data_array.push(line) if materia_data_flag
end }
return materia_data_array
end
#------------------------------------------------------------------------
# * Determine max level of materia
#------------------------------------------------------------------------
def materia_max_level
return materia_ap_set.size
end
#------------------------------------------------------------------------
# * Determine if materia is mastered
#------------------------------------------------------------------------
def materia_mastered?
return materia_max_level == materia_level
end
#------------------------------------------------------------------------
# * Determine materia type
#------------------------------------------------------------------------
def materia_type
for data in materia_data
if data.include?('<materia_type: ')
materia_t = data.scan(/\<materia\_type\:\s(.+)\>/)
materia_t = materia_t[0]
materia_t = materia_t[0]
return materia_t
end
end
return nil
end
#------------------------------------------------------------------------
# * Determine materia support type
#------------------------------------------------------------------------
def materia_support_type
for data in materia_data
if data.include?('<support_type: ')
support_t = data.scan(/\<support\_type\:\s(.+)\>/)
support_t = support_t[0]
support_t = support_t[0]
return materia_t
end
end
return nil
end
MATERIA_PASSIVE_TYPE_TAGS = ['hp<->mp', 'preemptive', 'enemy_encounter']
def materia_passive_type
for data in materia_data
for tag in MATERIA_PASSIVE_TYPE_TAGS
if data.include?(tag)
return tag
end
end
end
return ''
end
def materia_text
for data in materia_data
if data.include?('text')
text = data.scan(/<text\:\s*(.+)\>/)
return text[0][0]
end
end
return ''
end
def materia_encounter_value
for data in materia_data
if data.include?('enemy_encounter')
val = data.scan(/[0-9]+/)
return val[0].to_i
end
end
return 1.0
end
def materia_preemptive_value
for data in materia_data
if data.include?('preemptive')
val = data.scan(/[0-9]+/)
return val[0].to_i
end
end
return 0
end
#------------------------------------------------------------------------
# * Determine materia single skill when a quantity skill
#------------------------------------------------------------------------
def materia_quantity_skill
for data in materia_data
if data.include?('<skill: ')
skill = data.scan(/\<skill\:.\s*([0-9]+)\>/)
skill = skill[0]
skill = skill[0].to_i
return skill
end
end
return 0
end
#------------------------------------------------------------------------
# * Get materia skills if type is general
#------------------------------------------------------------------------
def materia_general_skills(learned_only = false)
for data in materia_data
if data.include?('<skills: ')
general_skills = []
skills = data.scan(/\<skills\:\s(.+)\>/)
skills = skills[0]
skills = skills[0]
skills = skills.split(/,\s*/)
for skill in skills
general_skills.push(skill.to_i)
end
if learned_only
learned_skills = []
if materia_general_skills(false).size < materia_ap_set.size
for i in 0...materia_level
learned_skills.push(general_skills[i]) unless general_skills[i] == nil
end
else
for i in 0..materia_level
learned_skills.push(general_skills[i])
end
end
return learned_skills - [0]
else
return general_skills - [0]
end
end
end
return []
end
#------------------------------------------------------------------------
# * Determine parameter increases by materia
#------------------------------------------------------------------------
def materia_params
params = []
for data in materia_data
if data.include?('<param: ')
param = data.scan(/\<param\:\s(.+)\>/)
param = param[0]
param = param[0]
params.push(param)
end
end
return params
end
#------------------------------------------------------------------------
# * Determine AP set
#------------------------------------------------------------------------
def materia_ap_set
for data in materia_data
if data.include?('<ap: ')
ap_set = []
ap = data.scan(/\<ap\:\s(.+)\>/)
ap = ap[0]
break if ap == nil
ap = ap[0]
ap = ap.split(/,\s*/)
for ap_ in ap
ap_set.push(ap_.to_i)
end
return ap_set
end
end
return []
end
#------------------------------------------------------------------------
# * Determine Switch set for event type
#------------------------------------------------------------------------
def materia_switches
for data in materia_data
if data.include?(/\<switches\:\s(.+)\>/)
switch_set = []
switches = data.scan(/\<switches\:\s(.+)\>/)
switches = switches[0]
switches = switches[0]
switches = switches.split(/,\s*/)
for switch in switches
switch_set.push(switch)
end
return switch_set
end
end
return []
end
end
end
module RPG
class Item
def remove_materia_effects(actor)
if self.materia_type == 'general_skills' or self.materia_type == 'quantity_skill'
remove_materia_skills(actor)
elsif self.materia_type == 'passive_skill'
remove_passive_effects(actor)
end
end
def add_materia_effects(actor)
if self.materia_type == 'general_skills' or self.materia_type == 'quantity_skill'
add_materia_skills(actor)
elsif self.materia_type == 'passive_skill'
add_passive_effects(actor)
end
end
def add_materia_skills(actor)
case self.materia_type
when 'general_skills'
for skill in self.materia_general_skills(true)
actor.learn_skill(skill) unless skill == 0
end
when 'quantity_skill'
actor.learn_skill(self.materia_quantity_skill)
end
end
def remove_materia_skills(actor)
for skill in self.materia_general_skills(true)
actor.forget_skill(skill)
end
actor.forget_skill(self.materia_quantity_skill)
for learning in actor.class.learnings
actor.learn_skill(learning.skill_id) if learning.level <= actor.level
end
end
def add_passive_effects(actor)
case self.materia_passive_type
when 'hp<->mp'
temp_hp = actor.hp
temp_mp = actor.mp
actor.hpmpswaps += 1
if actor.dead?
actor.hp = 0
else
actor.hp = temp_mp
end
actor.mp = temp_hp
when 'preemptive'
$game_party.total_preemptive += self.materia_preemptive_value
when 'enemy_encounter'
if self.materia_encounter_value == 0
$game_player.no_encounter_materias += 1
else
$game_player.encounter_rate *= self.materia_encounter_value
end
end
end
def remove_passive_effects(actor)
case self.materia_passive_type
when 'hp<->mp'
temp_hp = actor.hp
temp_mp = actor.mp
actor.hpmpswaps -= 1
if actor.dead?
actor.hp = 0
else
actor.hp = temp_mp
end
actor.mp = temp_hp
when 'preemptive'
$game_party.total_preemptive -= self.materia_preemptive_value
when 'enemy_encounter'
if self.materia_encounter_value == 0
$game_player.no_encounter_materias -= 1
else
$game_player.encounter_rate /= self.materia_encounter_value
end
end
end
end
end
#================================================= =============================
# ** Scene_Materia
#------------------------------------------------------------------------------
# This class performs materia attachment screen processing.
#================================================= =============================
class Scene_Materia < Scene_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor_index = 0)
@actor_index = actor_index
@actor = $game_party.members[actor_index]
end
#--------------------------------------------------------------------------
# * Start Processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
@viewport1 = Viewport.new(0, 0, 544, 416)
@viewport1.z = 100
@viewport2 = Viewport.new(0, 0, 544, 416)
@viewport2.z = 50
@help_window = Window_Help.new
@equip_window = Window_Equip.new(0, 56, $game_party.members[@actor_index])
@equip_window.active = true
@materia_data_window = Window_MateriaData.new(0, 264)
@materia_data_window.help_window = @help_window
@materia_window = Window_Materia.new(336, 56)
@materia_window.active = false
@materia_window.help_window = @materia_data_window
@attachable_slots = Window_MateriaSlots.new(0, 208, 0, @actor_index, @viewport1)
@attachable_slots.viewport = @viewport2
@attachable_slots.help_window = @materia_data_window
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
@help_window.dispose
@materia_data_window.dispose
@materia_window.dispose
@attachable_slots.dispose
@equip_window.dispose
dispose_menu_background
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
update_menu_background
@help_window.update
@equip_window.update
@materia_data_window.update
@materia_window.update
@attachable_slots.update
if @attachable_slots.active
update_attachable_slots
elsif @materia_window.active
update_materia_selection
end
end
#--------------------------------------------------------------------------
# * Update Slot Selection
#--------------------------------------------------------------------------
def update_attachable_slots
if Input.press?(Input::UP) or Input.press?(Input:OWN)
@attachable_slots.refresh(@equip_window.index)
@attachable_slots.update_help
end
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
unless @attachable_slots.empty?
Sound.play_decision
@materia_window.active = true
@materia_window.update_help
@attachable_slots.active = false
@equip_window.active = false
else
Sound.play_buzzer
end
end
end
#--------------------------------------------------------------------------
# * Update Materia Selection
#--------------------------------------------------------------------------
def update_materia_selection
if Input.trigger?(Input::B)
Sound.play_cancel
@attachable_slots.active = true
@equip_window.active = true
@attachable_slots.update_help
@materia_window.active = false
elsif Input.trigger?(Input::C)
string = "Audio/SE/"
string += OECS::Materia::SEPlayedAtAttach
Audio.se_play(string)
attach_materia
@materia_window.update_help
@attachable_slots.active = true
@equip_window.active = true
@attachable_slots.update_help
@materia_window.active = false
end
end
#--------------------------------------------------------------------------
# * Attach materia to chosen slot
#--------------------------------------------------------------------------
def attach_materia
materia_id = @materia_window.materia == nil ? 0 : @materia_window.materia.id
$game_party.gain_item(@attachable_slots.item, 1)
@attachable_slots.item.remove_materia_effects(@act or) unless @attachable_slots.item.nil?
@equip_window.item.materia_slotted[@attachable_slots.index] = materia_id
$game_party.consume_materia(@materia_window.materi a)
@materia_window.materia.add_materia_effects(@actor ) unless @materia_window.materia.nil?
type = @equip_window.item.is_a?(RPG::Weapon) ? 0 : @equip_window.item.kind + 1
@materia_window.refresh
@attachable_slots.refresh(type)
end
end
class Scene_Map
alias oecs_update_encounter update_encounter
def update_encounter
return if $game_player.no_encounter_materias > 0
oecs_update_encounter
end
def preemptive_or_surprise
actors_agi = $game_party.average_agi
enemies_agi = $game_troop.average_agi
if actors_agi >= enemies_agi
percent_preemptive = 5
percent_surprise = 3
else
percent_preemptive = 3
percent_surprise = 5
end
percent_preemptive += $game_party.total_preemptive
if rand(100) < percent_preemptive
$game_troop.preemptive = true
elsif rand(100) < percent_surprise
$game_troop.surprise = true
end
end
end
class Game_Player
attr_accessor :encounter_rate
attr_accessor :no_encounter_materias # better than rescuing division by zero
alias oecs_materia_initialize initialize
alias oecs_materia_make_encounter_count make_encounter_count
def initialize
oecs_materia_initialize
@encounter_rate = 1.0
@no_encounter_materias = 0 # instead of a truth value, for stack checking
end
#--------------------------------------------------------------------------
# * Make Encounter Count
#--------------------------------------------------------------------------
def make_encounter_count
oecs_materia_make_encounter_count
if $game_map.map_id != 0
@encounter_count = @encounter_count.to_f
@encounter_count *= @encounter_rate
@encounter_count = @encounter_count.to_i
end
end
end
помоги пожалуйста))))
ахуенно,всем спасибо
можете закрывать тему
Социальные закладки