| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 0 |
| 经验 | |
| 最后登录 | 2025-4-3 |
| 在线时间 | 71 小时 |
- 梦石
- 0
- 星屑
- 37
- 在线时间
- 71 小时
- 注册时间
- 2015-11-28
- 回帖
- 34
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 yaohongde 于 2015-12-13 15:53 编辑
我这有个脚本求大神改求!求!
这是个大完架后显示增加了多少经验,血,物品等……
可我想给它附加上一个评分(就是你在多少秒打败怪物就评SSS,A,B,C,D等)
谢谢
[box=DarkOrange][box=DarkOrange][/box][/box]
ace菜单(脚本1)#==============================================================================
#
# ▼ Yanfly Engine Ace - Ace Menu Engine v1.07
# -- Last Updated: 2012.01.03
# -- Level: Normal, Hard
# -- Requires: n/a
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YEA-AceMenuEngine"] = true
#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.01.03 - Compatibility Update: Ace Item Menu
# 2012.01.01 - Compatibility Update: Kread-EX's Synthesis
# - Compatibility Update: Kread-EX's Grathnode Install
# - Compatibility Update: Yami's Slot Battle
# 2011.12.23 - Script efficiency optimized.
# 2011.12.19 - Compatibility Update: Class System
# 2011.12.15 - Updated for better menu MP/TP gauge management.
# 2011.12.13 - Compatibility Update: Ace Equip Engine
# 2011.12.07 - Update to allow for switches to also hide custom commands.
# 2011.12.06 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# The menu system in RPG Maker VX Ace is great. However, it lacks the user
# customization that RPG Maker 2003 allowed. With this script, you can add,
# remove, and rearrange menu commands as you see fit. In addition to that, you
# can add in menu commands that lead to common events or even custom commands
# provided through other scripts.
#
# This script also provides window appearance management such as setting almost
# all command windows to be center aligned or changing the position of the
# help window. You can also opt to show the TP Gauge in the main menu as well
# as in the skill menu.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# Edit the settings in the module below as you see fit.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================
module YEA
module MENU
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - General Menu Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# This changes the way menus appear in your game. You can change their
# alignment, and the location of the help window, Note that any non-Yanfly
# Engine Ace scripts may not conform to these menu styles.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
HELP_WINDOW_LOCATION = 0 # 0-Top, 1-Middle, 2-Bottom.
COMMAND_WINDOW_ALIGN = 1 # 0-Left, 1-Middle, 2-Right.
# These settings below adjust the visual appearance of the main menu.
# Change the settings as you see fit.
MAIN_MENU_ALIGN = 0 # 0-Left, 1-Middle, 2-Right.
MAIN_MENU_RIGHT = false # false-Left, true-Right.
MAIN_MENU_ROWS = 12 # Maximum number of rows for main menu.
DRAW_TP_GAUGE = true # If true, draws TP in the main menu.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Main Menu Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These settings adjust the main menu, the order at which commands appear,
# what text is displayed, and what the commands are linked to. Here's a
# list of which commands do what:
#
# -------------------------------------------------------------------------
# :command Description
# -------------------------------------------------------------------------
# :item Opens up the item menu. Default menu item.
# :skill Opens up the skill menu. Default menu item.
# :equip Opens up the equip menu. Default menu item.
# :status Opens up the status menu. Default menu item.
# :formation Lets player manage party. Default menu item.
# :save Opens up the save menu. Default menu item.
# :game_end Opens up the shutdown menu. Default menu item.
#
# :class Requires YEA - Class System
#
# :gogototori Requires Kread-EX's Go Go Totori! Synthesis
# :grathnode Requires Kread-EX's Grathnote Install
# :sslots Requires Yami's YSA - Slot Battle
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
COMMANDS =[
:item, # Opens up the item menu. Default menu item.
:skill, # Opens up the skill menu. Default menu item.
:equip, # Opens up the equip menu. Default menu item.
:class, # Requires YEA - Class System.
:guardian,
:formation,
:status, # Opens up the status menu. Default menu item.
#:formation, # Lets player manage party. Default menu item.
:event_3, # Launches Common Event 3. Common Event Command.
:event_4, # Launches Common Event 4. Common Event Command.
:event_11, # Launches Common Event 13. Common Event Command.
:event_12, # Launches Common Event 13. Common Event Command.
:event_13, # Launches Common Event 13. Common Event Command.
:event_14, # Launches Common Event 14. Common Event Command.
:event_15, # Launches Common Event 15. Common Event Command.
:event_16, # Launches Common Event 16. Common Event Command.
:event_21, # Launches Common Event 16. Common Event Command.
:event_22, # Launches Common Event 16. Common Event Command.
:event_53, # Launches Common Event 16. Common Event Command.
:event_54,
:event_55,
# :debug, # Opens up debug menu. Custom Command.
:shop, # Opens up a shop to pawn items. Custom Command.
:save, # Opens up the save menu. Default menu item.
:game_end, # Opens up the shutdown menu. Default menu item.
] # Do not remove this.
#--------------------------------------------------------------------------
# - Common Event Commands -
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# If you insert one of the following commands into the COMMANDS array, the
# player can trigger a common event to launch. You can disable certain
# commands in the menu by binding them to a switch. If you don't want to
# disable them, set the switch to 0 and it will always be enabled. The
# ShowSwitch will prevent a command from appear if that switch is false.
# Set it to 0 for it to have no impact.
#--------------------------------------------------------------------------
COMMON_EVENT_COMMANDS ={
# :command => ["Display Name", EnableSwitch, ShowSwitch, Event ID],
:event_11 => [ "技能升级", 0, 0, 20],
:event_12 => [ "睡觉", 0, 0, 21],
:event_53 => [ "图册", 0, 0, 23],
:event_54 => [ "设置", 0, 0, 25],
:event_55 => [ "物品图鉴", 0, 0, 26],
} # Do not remove this.
#--------------------------------------------------------------------------
# - Custom Commands -
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# For those who use scripts that may lead to other menu scenes, use this
# hash to manage custom commands that run specific script calls. You can
# disable certain commands in the menu by binding them to a switch. If you
# don't want to disable them, set the switch to 0. The ShowSwitch will
# prevent a command from appear if that switch is false. Set it to 0 for
# it to have no impact.
#--------------------------------------------------------------------------
CUSTOM_COMMANDS ={
# :command => ["Display Name", EnableSwitch, ShowSwitch, Handler Method],
:debug => [ "Debug", 0, 0, :command_debug],
:formation => ["整队", 0, 0, :command_formation],
:gogototori => ["Synthesis", 0, 0, :command_totori],
:grathnode => [ "Grathnode", 0, 0, :command_install],
:guardian => [ "援护", 0, 0, :command_guardian],
} # Do not remove this.
end # MENU
end # YEA
#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================
#==============================================================================
# ■ Window_MenuCommand
#------------------------------------------------------------------------------
# This class is kept towards the top of the script to provide easier access.
#==============================================================================
class Window_MenuCommand < Window_Command
#--------------------------------------------------------------------------
# overwrite method: make_command_list
#--------------------------------------------------------------------------
def make_command_list
for command in YEA::MENU::COMMANDS
case command
#--- Default Commands ---
when :item
add_command(Vocab::item, :item, main_commands_enabled)
when :skill
add_command(Vocab::skill, :skill, main_commands_enabled)
when :equip
add_command(Vocab::equip, :equip, main_commands_enabled)
when :status
add_command(Vocab::status, :status, main_commands_enabled)
when :formation
add_formation_command
when :save
add_original_commands
add_save_command
when :game_end
add_game_end_command
#--- Yanfly Engine Ace Commands ---
when :class
next unless $imported["YEA-ClassSystem"]
add_class_command
#--- Imported Commands ---
when :sslots
next unless $imported["YSA-SlotBattle"]
add_sslots_command
when :grathnode
next unless $imported["KRX-GrathnodeInstall"]
process_custom_command(command)
when :gogototori
next unless $imported["KRX-AlchemicSynthesis"]
process_custom_command(command)
#--- Imported Commands ---
else
process_common_event_command(command)
process_custom_command(command)
end
end
end
#--------------------------------------------------------------------------
# new method: process_common_event_command
#--------------------------------------------------------------------------
def process_common_event_command(command)
return unless YEA::MENU::COMMON_EVENT_COMMANDS.include?(command)
show = YEA::MENU::COMMON_EVENT_COMMANDS[command][2]
continue = show <= 0 ? true : $game_switches[show]
return unless continue
text = YEA::MENU::COMMON_EVENT_COMMANDS[command][0]
switch = YEA::MENU::COMMON_EVENT_COMMANDS[command][1]
ext = YEA::MENU::COMMON_EVENT_COMMANDS[command][3]
enabled = switch <= 0 ? true : $game_switches[switch]
add_command(text, command, enabled, ext)
end
#--------------------------------------------------------------------------
# new method: process_custom_command
#--------------------------------------------------------------------------
def process_custom_command(command)
return unless YEA::MENU::CUSTOM_COMMANDS.include?(command)
show = YEA::MENU::CUSTOM_COMMANDS[command][2]
continue = show <= 0 ? true : $game_switches[show]
return unless continue
text = YEA::MENU::CUSTOM_COMMANDS[command][0]
switch = YEA::MENU::CUSTOM_COMMANDS[command][1]
enabled = switch <= 0 ? true : $game_switches[switch]
add_command(text, command, enabled)
end
end # Window_MenuCommand
#==============================================================================
# ■ Menu
#==============================================================================
module Menu
#--------------------------------------------------------------------------
# self.help_window_location
#--------------------------------------------------------------------------
def self.help_window_location
return YEA::MENU::HELP_WINDOW_LOCATION
end
#--------------------------------------------------------------------------
# self.command_window_align
#--------------------------------------------------------------------------
def self.command_window_align
return YEA::MENU::COMMAND_WINDOW_ALIGN
end
#--------------------------------------------------------------------------
# self.main_menu_align
#--------------------------------------------------------------------------
def self.main_menu_align
return YEA::MENU::MAIN_MENU_ALIGN
end
#--------------------------------------------------------------------------
# self.main_menu_right
#--------------------------------------------------------------------------
def self.main_menu_right
return YEA::MENU::MAIN_MENU_RIGHT
end
end # Menu
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# new method: draw_mp?
#--------------------------------------------------------------------------
def draw_mp?
return true unless draw_tp?
for skill in skills
next unless added_skill_types.include?(skill.stype_id)
return true if skill.mp_cost > 0
end
return false
end
#--------------------------------------------------------------------------
# new method: draw_tp?
#--------------------------------------------------------------------------
def draw_tp?
return false unless $data_system.opt_display_tp
for skill in skills
next unless added_skill_types.include?(skill.stype_id)
return true if skill.tp_cost > 0
end
return false
end
end # Game_Actor
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# overwrite method: draw_actor_simple_status
#--------------------------------------------------------------------------
def draw_actor_simple_status(actor, dx, dy)
dy -= line_height / 2
draw_actor_name(actor, dx, dy)
draw_actor_level(actor, dx, dy + line_height * 1)
draw_actor_icons(actor, dx, dy + line_height * 2)
dw = contents.width - dx - 124
draw_actor_class(actor, dx + 120, dy, dw)
draw_actor_hp(actor, dx + 120, dy + line_height * 1, dw)
if YEA::MENU::DRAW_TP_GAUGE && actor.draw_tp? && !actor.draw_mp?
draw_actor_tp(actor, dx + 120, dy + line_height * 2, dw)
elsif YEA::MENU::DRAW_TP_GAUGE && actor.draw_tp? && actor.draw_mp?
if $imported["YEA-BattleEngine"]
draw_actor_tp(actor, dx + 120, dy + line_height * 2, dw/2 + 1)
draw_actor_mp(actor, dx + 120 + dw/2, dy + line_height * 2, dw/2)
else
draw_actor_mp(actor, dx + 120, dy + line_height * 2, dw/2 + 1)
draw_actor_tp(actor, dx + 120 + dw/2, dy + line_height * 2, dw/2)
end
else
draw_actor_mp(actor, dx + 120, dy + line_height * 2, dw)
end
end
end # Window_Base
#==============================================================================
# ■ Window_Command
#==============================================================================
class Window_Command < Window_Selectable
#--------------------------------------------------------------------------
# overwrite method: alignment
#--------------------------------------------------------------------------
def alignment
return Menu.command_window_align
end
end # Window_Command
#==============================================================================
# ■ Window_MenuCommand
#==============================================================================
class Window_MenuCommand < Window_Command
#--------------------------------------------------------------------------
# alias method: init_command_position
#--------------------------------------------------------------------------
class <<self; alias init_command_position_ame init_command_position; end
def self.init_command_position
init_command_position_ame
@@last_command_oy = nil
end
#--------------------------------------------------------------------------
# overwrite method: visible_line_number
#--------------------------------------------------------------------------
def visible_line_number
return [[item_max, YEA::MENU::MAIN_MENU_ROWS].min, 1].max
end
#--------------------------------------------------------------------------
# overwrite method: alignment
#--------------------------------------------------------------------------
def alignment
return Menu.main_menu_align
end
#--------------------------------------------------------------------------
# alias method: process_ok
#--------------------------------------------------------------------------
alias window_menucommand_process_ok_ame process_ok
def process_ok
@@last_command_oy = self.oy
window_menucommand_process_ok_ame
end
#--------------------------------------------------------------------------
# alias method: select_last
#--------------------------------------------------------------------------
alias window_menucommand_select_last_ame select_last
def select_last
window_menucommand_select_last_ame
self.oy = @@last_command_oy unless @@last_command_oy.nil?
@@last_command_oy = nil
end
end # Window_MenuCommand
#==============================================================================
# ■ Scene_Menu
#==============================================================================
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# alias method: start
#--------------------------------------------------------------------------
alias scene_menu_start_ame start
def start
scene_menu_start_ame
relocate_windows
end
#--------------------------------------------------------------------------
# new method: relocate_windows
#--------------------------------------------------------------------------
def relocate_windows
return unless Menu.main_menu_right
@command_window.x = Graphics.width - @command_window.width
@gold_window.x = Graphics.width - @gold_window.width
@status_window.x = 0
end
def return_scene
$game_map.autoplay
SceneManager.return
end
end # Scene_Menu
#==============================================================================
# ■ Scene_Item
#==============================================================================
class Scene_Item < Scene_ItemBase
#--------------------------------------------------------------------------
# alias method: start
#--------------------------------------------------------------------------
alias scene_item_start_ame start
def start
scene_item_start_ame
return if $imported["YEA-ItemMenu"]
relocate_windows
end
#--------------------------------------------------------------------------
# new method: relocate_windows
#--------------------------------------------------------------------------
def relocate_windows
case Menu.help_window_location
when 0 # Top
@help_window.y = 0
@category_window.y = @help_window.height
@item_window.y = @category_window.y + @category_window.height
when 1 # Middle
@category_window.y = 0
@help_window.y = @category_window.height
@item_window.y = @help_window.y + @help_window.height
else # Bottom
@category_window.y = 0
@item_window.y = @category_window.height
@help_window.y = @item_window.y + @item_window.height
end
if $imported["YEA-ItemMenu"]
@types_window.y = @category_window.y
@status_window.y = @category_window.y
end
end
end # Scene_Item
#==============================================================================
# ■ Scene_Skill
#==============================================================================
class Scene_Skill < Scene_ItemBase
#--------------------------------------------------------------------------
# alias method: start
#--------------------------------------------------------------------------
alias scene_skill_start_ame start
def start
scene_skill_start_ame
relocate_windows
end
#--------------------------------------------------------------------------
# new method: relocate_windows
#--------------------------------------------------------------------------
def relocate_windows
case Menu.help_window_location
when 0 # Top
@help_window.y = 0
@command_window.y = @help_window.height
@status_window.y = @help_window.height
@item_window.y = @status_window.y + @status_window.height
when 1 # Middle
@command_window.y = 0
@status_window.y = 0
@help_window.y = @status_window.y + @status_window.height
@item_window.y = @help_window.y + @help_window.height
else # Bottom
@command_window.y = 0
@status_window.y = 0
@item_window.y = @status_window.y + @status_window.height
@help_window.y = @item_window.y + @item_window.height
end
end
end # Scene_Skill
#==============================================================================
# ■ Scene_Equip
#==============================================================================
class Scene_Equip < Scene_MenuBase
#--------------------------------------------------------------------------
# alias method: start
#--------------------------------------------------------------------------
alias scene_equip_start_ame start
def start
scene_equip_start_ame
relocate_windows
relocate_aee_windows
end
#--------------------------------------------------------------------------
# new method: relocate_windows
#--------------------------------------------------------------------------
def relocate_windows
return if $imported["YEA-AceEquipEngine"]
case Menu.help_window_location
when 0 # Top
@help_window.y = 0
@status_window.y = @help_window.height
@command_window.y = @help_window.height
@slot_window.y = @command_window.y + @command_window.height
@item_window.y = @slot_window.y + @slot_window.height
when 1 # Middle
@status_window.y = 0
@command_window.y = 0
@slot_window.y = @command_window.y + @command_window.height
@help_window.y = @slot_window.y + @slot_window.height
@item_window.y = @help_window.y + @help_window.height
else # Bottom
@status_window.y = 0
@command_window.y = 0
@slot_window.y = @command_window.y + @command_window.height
@item_window.y = @slot_window.y + @slot_window.height
@help_window.y = @item_window.y + @item_window.height
end
end
#--------------------------------------------------------------------------
# new method: relocate_aee_windows
#--------------------------------------------------------------------------
def relocate_aee_windows
return unless $imported["YEA-AceEquipEngine"]
case Menu.help_window_location
when 0 # Top
@help_window.y = 0
@command_window.y = @help_window.height
@slot_window.y = @command_window.y + @command_window.height
when 1 # Middle
@command_window.y = 0
@help_window.y = @command_window.height
@slot_window.y = @help_window.y + @help_window.height
else # Bottom
@command_window.y = 0
@slot_window.y = @command_window.height
@help_window.y = @slot_window.y + @slot_window.height
end
@actor_window.y = @command_window.y
@item_window.y = @slot_window.y
@status_window.y = @slot_window.y
end
end # Scene_Equip
#==============================================================================
# ■ Scene_Menu
#==============================================================================
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# alias method: create_command_window
#--------------------------------------------------------------------------
alias scene_menu_create_command_window_ame create_command_window
def create_command_window
scene_menu_create_command_window_ame
process_common_event_commands
process_custom_commands
end
#--------------------------------------------------------------------------
# new method: process_common_event_commands
#--------------------------------------------------------------------------
def process_common_event_commands
for command in YEA::MENU::COMMANDS
next unless YEA::MENU::COMMON_EVENT_COMMANDS.include?(command)
@command_window.set_handler(command, method(:command_common_event))
end
end
#--------------------------------------------------------------------------
# new method: command_common_event
#--------------------------------------------------------------------------
def command_common_event
event_id = @command_window.current_ext
return return_scene if event_id.nil?
return return_scene if $data_common_events[event_id].nil?
$game_temp.reserve_common_event(event_id)
return_scene
end
#--------------------------------------------------------------------------
# new method: process_custom_commands
#--------------------------------------------------------------------------
def process_custom_commands
for command in YEA::MENU::COMMANDS
next unless YEA::MENU::CUSTOM_COMMANDS.include?(command)
called_method = YEA::MENU::CUSTOM_COMMANDS[command][3]
end
end
#--------------------------------------------------------------------------
# new method: command_debug
#--------------------------------------------------------------------------
def command_debug
SceneManager.call(Scene_Debug)
end
#--------------------------------------------------------------------------
# new method: command_shop
#--------------------------------------------------------------------------
def command_shop
goods = []
SceneManager.call(Scene_Shop)
SceneManager.scene.prepare(goods, false)
end
#--------------------------------------------------------------------------
# new method: command_totori
#--------------------------------------------------------------------------
def command_totori
return unless $imported['KRX-AlchemicSynthesis']
SceneManager.call(Scene_Alchemy)
end
end # Scene_Menu
#==============================================================================
#
# ▼ End of File
#
#==============================================================================
胜利基础系统(脚本2)#==============================================================================
# ** Victor Engine - Basic Module
#------------------------------------------------------------------------------
# Author : Victor Sant
#
# Version History:
# v 1.00 - 2011.12.19 > First relase
# v 1.01 - 2011.12.21 > Added Event Troop notes
# v 1.02 - 2011.12.22 > Added character frames value
# v 1.03 - 2011.12.30 > Added Actor and Enemy notes
# v 1.04 - 2012.01.01 > Added party average level and map actors
# v 1.05 - 2012.01.04 > Compatibility with Characters Scripts
# v 1.06 - 2012.01.07 > Compatibility with Fog and Light Effect
# > Added new Sprite Character functions
# v 1.07 - 2012.01.11 > Compatibility with Control Text and Codes
# v 1.08 - 2012.01.13 > Compatibility with Trait Control
# v 1.09 - 2012.01.15 > Fixed the Regular Expressions problem with "" and “”
# v 1.10 - 2012.01.18 > Compatibility with Automatic Battlers
# v 1.11 - 2012.01.26 > Compatibility with Followers Options
# Compatibility with Animated Battle beta
# v 1.12 - 2012.02.08 > Compatibility with Animated Battle
# v 1.13 - 2012.02.18 > Fix for non RTP dependant encrypted projects
# v 1.14 - 2012.03.11 > Better version handling and required messages
# v 1.15 - 2012.03.11 > Added level variable for enemies (to avoid crashes)
# v 1.16 - 2012.03.21 > Compatibility with Follower Control
# v 1.17 - 2012.03.22 > Compatibility with Follower Control new method
#------------------------------------------------------------------------------
# This is the basic script for the system from Victory Engine and is
# required to use the scripts from the engine. This script offer some new
# functions to be used within many scripts of the engine.
#------------------------------------------------------------------------------
# Compatibility
# Required for the Victor Engine
#
# * Overwrite methods (Default)
# module Cache
# def self.character(filename)
#
# class Sprite_Character < Sprite_Base
# def set_character_bitmap
#
# * Alias methods (Default)
# class Game_Interpreter
# def command_108
#
# class Window_Base < Window
# def convert_escape_characters(text)
#
#------------------------------------------------------------------------------
# Instructions:
# To instal the script, open you script editor and paste this script on
# a new section on bellow the Materials section.
#
#------------------------------------------------------------------------------
# New functions
#
# * Random number between two vales
# rand_between(min, max)
# min : min value
# max : max value
# Can be called from any class, this method return an random value between
# two specific numbers
#
# * Random array value
# <Array>.random
# <Array>.random!
# Returns a random object from the array, the method .random! is destructive,
# removing the value returned from the array.
#
# * Sum of the numeric values of a array
# <Array>.sum
# Returns the sum of all numeric values
#
# * Avarage of all numeric values from the array
# <Array>.average(float = false)
# float : float flag
# Returns the average of all numeric values, if floa is true, the value
# returned is a float, otherwise it's a integer.
#
# * Note for events
# <Event>.note
# By default, events doesn't have note boxes. This command allows to use
# comments as note boxes, following the same format as the ones on the
# database. Returns all comments on the active page of the event.
#
# * Comment calls
# <Event>.comment_call
# Another function for comment boxes, by default, they have absolutely no
# effect in game when called. But this method allows to make the comment
# box to behave like an script call, but with the versatility of the
# note boxes. Remember that the commands will only take effect if there
# is scripts to respond to the comment code.
#
#==============================================================================
#==============================================================================
# ** Victor Engine
#------------------------------------------------------------------------------
# Setting module for the Victor Engine
#==============================================================================
module Victor_Engine
#--------------------------------------------------------------------------
# * New method: required_script
#--------------------------------------------------------------------------
def self.required_script(name, req, version, type = 0)
if type != :bellow && (!$imported[req] || $imported[req] < version)
msg = "The script '%s' requires the script\n"
case type
when :above
msg += "'%s' v%s or higher above it to work properly\n"
else
msg += "'%s' v%s or higher to work properly\n"
end
msg += "Go to http://victorscripts.wordpress.com/ to download this script."
self.exit_message(msg, name, req, version)
elsif type == :bellow && $imported[req]
msg = "The script '%s' requires the script\n"
msg += "'%s' to be put bellow it\n"
msg += "move the scripts to the proper position"
self.exit_message(msg, name, req, version)
end
end
#--------------------------------------------------------------------------
# * New method: exit_message
#--------------------------------------------------------------------------
def self.exit_message(message, name, req, version)
name = self.script_name(name)
req = self.script_name(req)
msgbox(sprintf(message, name, req, version))
exit
end
#--------------------------------------------------------------------------
# * New method: script_name
#--------------------------------------------------------------------------
def self.script_name(name, ext = "VE")
name = name.to_s.gsub("_", " ").upcase.split
name.collect! {|char| char == ext ? "#{char} -" : char.capitalize }
name.join(" ")
end
end
$imported ||= {}
$imported[:ve_basic_module] = 1.17
#==============================================================================
# ** Object
#------------------------------------------------------------------------------
# This class is the superclass of all other classes.
#==============================================================================
class Object
#--------------------------------------------------------------------------
# * Include setting module
#--------------------------------------------------------------------------
include Victor_Engine
#-------------------------------------------------------------------------
# * New method: rand_between
#-------------------------------------------------------------------------
def rand_between(min, max)
min + rand(max - min + 1)
end
#--------------------------------------------------------------------------
# * New method: numeric?
#--------------------------------------------------------------------------
def numeric?
return false
end
#--------------------------------------------------------------------------
# * New method: float?
#--------------------------------------------------------------------------
def float?
return false
end
#--------------------------------------------------------------------------
# * New method: item?
#--------------------------------------------------------------------------
def item?
return false
end
#--------------------------------------------------------------------------
# * New method: skill?
#--------------------------------------------------------------------------
def skill?
return false
end
#--------------------------------------------------------------------------
# * New method: file_exist?
#--------------------------------------------------------------------------
def file_exist?(path, filename)
$file_list ||= {}
$file_list[path + filename] ||= file_test(path, filename)
$file_list[path + filename] == :exist
end
#--------------------------------------------------------------------------
# * New method: get_file_list
#--------------------------------------------------------------------------
def file_test(path, filename)
bitmap = Cache.load_bitmap(path, filename) rescue nil
bitmap ? :exist : :inexist
end
#--------------------------------------------------------------------------
# * New method: character_exist?
#--------------------------------------------------------------------------
def character_exist?(filename)
file_exist?("Graphics/Characters/", filename)
end
#--------------------------------------------------------------------------
# * New method: battler_exist?
#--------------------------------------------------------------------------
def battler_exist?(filename)
file_exist?("Graphics/Battlers/", filename)
end
#--------------------------------------------------------------------------
# * New method: get_filename
#--------------------------------------------------------------------------
def get_filename
"[\"'“‘]([^\"'”‘”’]+)[\"'”’]"
end
#--------------------------------------------------------------------------
# * New method: make_symbol
#--------------------------------------------------------------------------
def make_symbol(string)
string.downcase.gsub(" ", "_").to_sym
end
#--------------------------------------------------------------------------
# * New method: make_string
#--------------------------------------------------------------------------
def make_string(symbol)
symbol.to_s.gsub("_", " ").upcase
end
#--------------------------------------------------------------------------
# * New method: returing_value
#--------------------------------------------------------------------------
def returing_value(i, x)
i % (x * 2) >= x ? (x * 2) - i % (x * 2) : i % (x * 2)
end
end
#==============================================================================
# ** Numeric
#------------------------------------------------------------------------------
# This is the abstract class for numbers.
#==============================================================================
class Numeric
#--------------------------------------------------------------------------
# * New method: numeric?
#--------------------------------------------------------------------------
def numeric?
return true
end
end
#==============================================================================
# ** Float
#------------------------------------------------------------------------------
# This is the abstract class for the floating point values.
#==============================================================================
class Float
#--------------------------------------------------------------------------
# * New method: float?
#--------------------------------------------------------------------------
def float?
return true
end
end
#==============================================================================
# ** Array
#------------------------------------------------------------------------------
# This class store arbitrary Ruby objects.
#==============================================================================
class Array
#-------------------------------------------------------------------------
# * New method: random
#-------------------------------------------------------------------------
def random
self[rand(size)]
end
#-------------------------------------------------------------------------
# * New method: random!
#-------------------------------------------------------------------------
def random!
self.delete_at(rand(size))
end
#---------------------------------------------------------------------------
# * New method: sum
#---------------------------------------------------------------------------
def sum
self.inject(0) {|r, n| r += (n.numeric? ? n : 0)}
end
#---------------------------------------------------------------------------
# * New method: average
#---------------------------------------------------------------------------
def average(float = false)
self.sum / [(float ? size.to_f : size.to_i), 1].max
end
#---------------------------------------------------------------------------
# * New method: next_item
#---------------------------------------------------------------------------
def next_item
item = self.shift
self.push(item)
item
end
#---------------------------------------------------------------------------
# * New method: previous_item
#---------------------------------------------------------------------------
def previous_item
item = self.pop
self.unshift(item)
item
end
end
#==============================================================================
# ** RPG::Troop::Page
#------------------------------------------------------------------------------
# This is the data class for battle events (pages).
#==============================================================================
class RPG::Troop::Page
#--------------------------------------------------------------------------
# * New method: note
#--------------------------------------------------------------------------
def note
return "" if !@list || @list.size <= 0
comment_list = []
@list.each do |item|
next unless item && (item.code == 108 || item.code == 408)
comment_list.push(item.parameters[0])
end
comment_list.join("\r\n")
end
end
#==============================================================================
# ** RPG::Skill
#------------------------------------------------------------------------------
# This is the data class for skills.
#==============================================================================
class RPG::Skill
#--------------------------------------------------------------------------
# * New method: item?
#--------------------------------------------------------------------------
def item?
return false
end
#--------------------------------------------------------------------------
# * New method: skill?
#--------------------------------------------------------------------------
def skill?
return true
end
end
#==============================================================================
# ** RPG::Item
#------------------------------------------------------------------------------
# This is the data class for sitems.
#==============================================================================
class RPG::Item
#--------------------------------------------------------------------------
# * New method: item?
#--------------------------------------------------------------------------
def item?
return true
end
#--------------------------------------------------------------------------
# * New method: skill?
#--------------------------------------------------------------------------
def skill?
return false
end
end
#==============================================================================
# ** RPG::UsableItem
#------------------------------------------------------------------------------
# This is the superclass for skills and items.
#==============================================================================
class RPG::UsableItem < RPG::BaseItem
#--------------------------------------------------------------------------
# * New method: for_all_targets?
#--------------------------------------------------------------------------
def for_all_targets?
return false
end
end
#==============================================================================
# ** Cache
#------------------------------------------------------------------------------
# This module loads each of graphics, creates a Bitmap object, and retains it.
# To speed up load times and conserve memory, this module holds the created
# Bitmap object in the internal hash, allowing the program to return
# preexisting objects when the same bitmap is requested again.
#==============================================================================
module Cache
#--------------------------------------------------------------------------
# * New method: cache
#--------------------------------------------------------------------------
def self.cache
@cache
end
#--------------------------------------------------------------------------
# * New method: character
#--------------------------------------------------------------------------
def self.character(filename, hue = 0)
load_bitmap("Graphics/Characters/", filename, hue)
end
end
#==============================================================================
# ** Game_BattlerBase
#------------------------------------------------------------------------------
# This class handles battlers. It's used as a superclass of the Game_Battler
# classes.
#==============================================================================
class Game_BattlerBase
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :buffs
#--------------------------------------------------------------------------
# * New method: get_cond
#--------------------------------------------------------------------------
def get_cond(text)
case text.upcase
when "HIGHER" then ">"
when "LOWER" then "<"
when "EQUAL" then "=="
when "DIFFERENT" then "!="
else "!="
end
end
#--------------------------------------------------------------------------
# * New method: get_param
#--------------------------------------------------------------------------
def get_param(text)
case text.upcase
when "MAXHP" then self.mhp
when "MAXMP" then self.mmp
when "MAXTP" then self.max_tp
else eval("self.#{text.downcase}")
end
end
#--------------------------------------------------------------------------
# * New method: get_param_id
#--------------------------------------------------------------------------
def get_param_id(text)
case text.upcase
when "MAXHP", "HP" then 0
when "MAXMP", "MP" then 1
when "ATK" then 2
when "DEF" then 3
when "MAT" then 4
when "MDF" then 5
when "AGI" then 6
when "LUK" then 7
end
end
#--------------------------------------------------------------------------
# * New method: danger?
#--------------------------------------------------------------------------
def danger?
hp < mhp * 25 / 100
end
#--------------------------------------------------------------------------
# * New method: sprite
#--------------------------------------------------------------------------
def sprite
valid = SceneManager.scene_is?(Scene_Battle) && SceneManager.scene.spriteset
valid ? SceneManager.scene.spriteset.sprite(self) : nil
end
end
#==============================================================================
# ** Game_Enemy
#------------------------------------------------------------------------------
# This class handles enemy characters. It's used within the Game_Troop class
# ($game_troop).
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# * New method: note
#--------------------------------------------------------------------------
def note
enemy ? enemy.note : ""
end
#--------------------------------------------------------------------------
# * New method: get_all_notes
#--------------------------------------------------------------------------
def get_all_notes
result = note
states.compact.each {|state| result += state.note }
result
end
#--------------------------------------------------------------------------
# * New method: level
#--------------------------------------------------------------------------
def level
return 1
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 < Game_Battler
#--------------------------------------------------------------------------
# * New method: note
#--------------------------------------------------------------------------
def note
actor ? actor.note : ""
end
#--------------------------------------------------------------------------
# * New method: hue
#--------------------------------------------------------------------------
def hue
@hue ? @hue : 0
end
#--------------------------------------------------------------------------
# * New method: get_all_notes
#--------------------------------------------------------------------------
def get_all_notes
result = note
result += self.class.note
equips.compact.each {|equip| result += equip.note }
states.compact.each {|state| result += state.note }
result
end
#--------------------------------------------------------------------------
# * New method: in_active_party?
#--------------------------------------------------------------------------
def in_active_party?
$game_party.battle_members.include?(self)
end
#--------------------------------------------------------------------------
# * New method: in_reserve_party?
#--------------------------------------------------------------------------
def in_reserve_party?
$game_party.reserve_members.include?(self)
end
#--------------------------------------------------------------------------
# * New method: in_party?
#--------------------------------------------------------------------------
def in_party?
$game_party.all_members.include?(self)
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 < Game_Unit
#--------------------------------------------------------------------------
# * New method: average_level
#--------------------------------------------------------------------------
def average_level
battle_members.collect {|actor| actor.level }.average
end
#--------------------------------------------------------------------------
# * New method: reserve_members
#--------------------------------------------------------------------------
def reserve_members
all_members - battle_members
end
end
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
# This class handles maps. It includes scrolling and passage determination
# functions. The instance of this class is referenced by $game_map.
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * New method: event_list
#--------------------------------------------------------------------------
def event_list
events.values
end
#--------------------------------------------------------------------------
# * New method: note
#--------------------------------------------------------------------------
def note
@map ? @map.note : ""
end
#--------------------------------------------------------------------------
# * New method: vehicles
#--------------------------------------------------------------------------
def vehicles
@vehicles
end
#--------------------------------------------------------------------------
# * New method: actors
#--------------------------------------------------------------------------
def actors
[$game_player] + $game_player.followers.visible_followers
end
end
#==============================================================================
# ** Game_CharacterBase
#------------------------------------------------------------------------------
# This class deals with characters. Common to all characters, stores basic
# data, such as coordinates and graphics. It's used as a superclass of the
# Game_Character class.
#==============================================================================
class Game_CharacterBase
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :move_speed
attr_accessor :move_frequency
#--------------------------------------------------------------------------
# * New method: is_player?
#--------------------------------------------------------------------------
def is_player?
return false
end
#--------------------------------------------------------------------------
# * New method: is_event?
#--------------------------------------------------------------------------
def is_event?
return false
end
#--------------------------------------------------------------------------
# * New method: is_follower?
#--------------------------------------------------------------------------
def is_follower?
return false
end
#--------------------------------------------------------------------------
# * New method: is_vehicle?
#--------------------------------------------------------------------------
def is_vehicle?
return false
end
#--------------------------------------------------------------------------
# * New method: frames
#--------------------------------------------------------------------------
def frames
return 3
end
#--------------------------------------------------------------------------
# * New method: hue
#--------------------------------------------------------------------------
def hue
@hue ? @hue : 0
end
end
#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
# This class deals with characters. It's used as a superclass of the
# Game_Player and Game_Event classes.
#==============================================================================
class Game_Character < Game_CharacterBase
#--------------------------------------------------------------------------
# * New method: move_toward_position
#--------------------------------------------------------------------------
def move_toward_position(x, y)
sx = distance_x_from(x)
sy = distance_y_from(y)
if sx.abs > sy.abs
move_straight(sx > 0 ? 4 : 6)
move_straight(sy > 0 ? 8 : 2) if !@move_succeed && sy != 0
elsif sy != 0
move_straight(sy > 0 ? 8 : 2)
move_straight(sx > 0 ? 4 : 6) if !@move_succeed && sx != 0
end
end
end
#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
# This class handles the player.
# The instance of this class is referenced by $game_map.
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * New method: is_player?
#--------------------------------------------------------------------------
def is_player?
return true
end
#--------------------------------------------------------------------------
# * New method: perform_transfer
#--------------------------------------------------------------------------
def new_map_id
@new_map_id
end
#--------------------------------------------------------------------------
# * New method: hue
#--------------------------------------------------------------------------
def hue
actor ? actor.hue : 0
end
end
#==============================================================================
# ** Game_Follower
#------------------------------------------------------------------------------
# This class handles the followers. Followers are the actors of the party
# that follows the leader in a line. It's used within the Game_Followers class.
#==============================================================================
class Game_Follower < Game_Character
#--------------------------------------------------------------------------
# * New method: is_follower?
#--------------------------------------------------------------------------
def is_follower?
return true
end
#--------------------------------------------------------------------------
# * New method: index
#--------------------------------------------------------------------------
def index
@member_index
end
end
#==============================================================================
# ** Game_Followers
#------------------------------------------------------------------------------
# This class handles the followers. It's a wrapper for the built-in class
# "Array." It's used within the Game_Player class.
#==============================================================================
class Game_Followers
#--------------------------------------------------------------------------
# * New method: get_actor
#--------------------------------------------------------------------------
def get_actor(id)
list = [$game_player] + visible_followers.select do |follower|
follower.actor && follower.actor.id == id
end
list.first
end
end
#==============================================================================
# ** Game_Vehicle
#------------------------------------------------------------------------------
# This class handles vehicles. It's used within the Game_Map class. If there
# are no vehicles on the current map, the coordinates is set to (-1,-1).
#==============================================================================
class Game_Vehicle < Game_Character
#--------------------------------------------------------------------------
# * New method: is_vehicle?
#--------------------------------------------------------------------------
def is_vehicle?
return true
end
#--------------------------------------------------------------------------
# * New method: map_id
#--------------------------------------------------------------------------
def map_id
@map_id
end
end
#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
# This class deals with events. It handles functions including event page
# switching via condition determinants, and running parallel process events.
# It's used within the Game_Map class.
#==============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# * New method: name
#--------------------------------------------------------------------------
def name
@event.name
end
#--------------------------------------------------------------------------
# * New method: is_event?
#--------------------------------------------------------------------------
def is_event?
return true
end
#--------------------------------------------------------------------------
# * New method: note
#--------------------------------------------------------------------------
def note
return "" if !@page || !@page.list || @page.list.size <= 0
comment_list = []
@page.list.each do |item|
next unless item && (item.code == 108 || item.code == 408)
comment_list.push(item.parameters[0])
end
comment_list.join("\r\n")
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
#--------------------------------------------------------------------------
# * Alias method: command_108
#--------------------------------------------------------------------------
alias :command_108_ve_basic_module :command_108
def command_108
command_108_ve_basic_module
comment_call
end
#--------------------------------------------------------------------------
# * New method: comment_call
#--------------------------------------------------------------------------
def comment_call
end
#--------------------------------------------------------------------------
# * New method: note
#--------------------------------------------------------------------------
def note
@comments ? @comments.join("\r\n") : ""
end
end
#==============================================================================
# ** Sprite_Character
#------------------------------------------------------------------------------
# This sprite is used to display characters. It observes a instance of the
# Game_Character class and automatically changes sprite conditions.
#==============================================================================
class Sprite_Character < Sprite_Base
#--------------------------------------------------------------------------
# * Overwrite method: set_character_bitmap
#--------------------------------------------------------------------------
def set_character_bitmap
update_character_info
set_bitmap
set_bitmap_position
end
#--------------------------------------------------------------------------
# * New method: center_y
#--------------------------------------------------------------------------
def actor?
@character.is_a?(Game_Player) || @character.is_a?(Game_Follower)
end
#--------------------------------------------------------------------------
# * New method: center_y
#--------------------------------------------------------------------------
def actor
actor? ? @character.actor : nil
end
#--------------------------------------------------------------------------
# * New method: update_character_info
#--------------------------------------------------------------------------
def update_character_info
end
#--------------------------------------------------------------------------
# * New method: hue
#--------------------------------------------------------------------------
def hue
@character.hue
end
#--------------------------------------------------------------------------
# * New method: set_bitmap
#--------------------------------------------------------------------------
def set_bitmap
self.bitmap = Cache.character(set_bitmap_name, hue)
end
#--------------------------------------------------------------------------
# * New method: set_bitmap_name
#--------------------------------------------------------------------------
def set_bitmap_name
@character_name
end
#--------------------------------------------------------------------------
# * New method: set_bitmap_position
#--------------------------------------------------------------------------
def set_bitmap_position
sign = get_sign
if sign && sign.include?('$')
@cw = bitmap.width / @character.frames
@ch = bitmap.height / 4
else
@cw = bitmap.width / (@character.frames * 4)
@ch = bitmap.height / 8
end
self.ox = @cw / 2
self.oy = @ch
end
#--------------------------------------------------------------------------
# * New method: get_sign
#--------------------------------------------------------------------------
def get_sign
@character_name[/^[\!\$]./]
end
end
#==============================================================================
# ** Sprite_Battler
#------------------------------------------------------------------------------
# This sprite is used to display battlers. It observes a instance of the
# Game_Battler class and automatically changes sprite conditions.
#==============================================================================
class Sprite_Battler < Sprite_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :dmg_mirror
#--------------------------------------------------------------------------
# * New method: center_x
#--------------------------------------------------------------------------
def center_x
self.ox
end
#--------------------------------------------------------------------------
# * New method: center_y
#--------------------------------------------------------------------------
def center_y
self.oy / 2
end
end
#==============================================================================
# ** Spriteset_Battle
#------------------------------------------------------------------------------
# This class brings together battle screen sprites. It's used within the
# Scene_Battle class.
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :viewport1
#--------------------------------------------------------------------------
# * New method: sprite
#--------------------------------------------------------------------------
def sprite(subject)
battler_sprites.compact.select {|sprite| sprite.battler == subject }.first
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This is a superclass of all windows in the game.
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Alias method: convert_escape_characters
#--------------------------------------------------------------------------
alias :convert_escape_ve_basic_module :convert_escape_characters
def convert_escape_characters(text)
result = text.to_s.clone
result = text_replace(result)
result = convert_escape_ve_basic_module(text)
result
end
#--------------------------------------------------------------------------
# * New method: text_replace
#--------------------------------------------------------------------------
def text_replace(result)
result.gsub!(/\r/) { "" }
result.gsub!(/\\/) { "\e" }
result
end
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :spriteset
end
胜利显示(脚本3)
#==============================================================================
#
# ▼ Yanfly Engine Ace - Victory Aftermath v1.03
# -- Last Updated: 2012.01.07
# -- Level: Easy, Normal, Hard
# -- Requires: n/a
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YEA-VictoryAftermath"] = true
#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.01.07 - Compatibility Update: JP Manager
# 2012.01.01 - Bug Fixed: Quote tags were mislabeled.
# 2011.12.26 - Compatibility Update: Command Autobattle
# 2011.12.16 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# At the end of each battle, RPG Maker VX Ace by default shows text saying that
# the party has gained so-and-so EXP while this person leveled up and your
# party happened to find these drops. This script changes that text into
# something more visual for your players to see. Active battle members will be
# seen gaining EXP, any kind of level up changes, and a list of the items
# obtained through drops.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Actor Notetags - These notetags go in the actors notebox in the database.
# -----------------------------------------------------------------------------
# <win quotes>
# string
# string
# </win quotes>
# Sets the win quote for the actor. The strings are continuous and can use
# text codes. Use \n for a line break. Type in what you want the actor to say
# for the particular win quote. Use [New Quote] in between the two tags to
# start up a new quote.
#
# <level quotes>
# string
# string
# </level quotes>
# Sets the level up quote for the actor. The strings are continuous and can use
# text codes. Use \n for a line break. Type in what you want the actor to say
# for the particular win quote. Use [New Quote] in between the two tags to
# start up a new quote.
#
# <drops quotes>
# string
# string
# </drops quotes>
# Sets the drops quote for the actor. The strings are continuous and can use
# text codes. Use \n for a line break. Type in what you want the actor to say
# for the particular win quote. Use [New Quote] in between the two tags to
# start up a new quote.
#
# -----------------------------------------------------------------------------
# Class Notetags - These notetags go in the class notebox in the database.
# -----------------------------------------------------------------------------
# <win quotes>
# string
# string
# </win quotes>
# Sets the win quote for the class. The strings are continuous and can use
# text codes. Use \n for a line break. Type in what you want the actor to say
# for the particular win quote. Use [New Quote] in between the two tags to
# start up a new quote.
#
# <level quotes>
# string
# string
# </level quotes>
# Sets the level up quote for the class. The strings are continuous and can use
# text codes. Use \n for a line break. Type in what you want the actor to say
# for the particular win quote. Use [New Quote] in between the two tags to
# start up a new quote.
#
# <drops quotes>
# string
# string
# </drops quotes>
# Sets the drops quote for the class. The strings are continuous and can use
# text codes. Use \n for a line break. Type in what you want the actor to say
# for the particular win quote. Use [New Quote] in between the two tags to
# start up a new quote.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================
module YEA
module VICTORY_AFTERMATH
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - General Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These are various settings that are used throughout the Victory Aftermath
# portion of a battle. Adjust them as you see fit.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
VICTORY_BGM = RPG::BGM.new("Field1", 100, 100) # Victory BGM
VICTORY_TICK = RPG::SE.new("Decision1", 100, 150) # EXP ticking SFX
LEVEL_SOUND = RPG::SE.new("Up4", 80, 150) # Level Up SFX
SKILLS_TEXT = "新技能" # New skills text title.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Important Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These are some important settings so please set them up properly. This
# section includes a switch that allows you to skip the victory aftermath
# phase (for those back to back battles and making them seamless) and it
# also allows you to declare a common event to run after each battle. If
# you do not wish to use either of these features, set them to 0. The
# common event will run regardless of win or escape.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
SKIP_AFTERMATH_SWITCH = 0 # If switch on, skip aftermath. 0 to disable.
AFTERMATH_COMMON_EVENT = 0 # Runs common event after battle. 0 to disable.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Top Text Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Here, you can adjust the various text that appears in the window that
# appears at the top of the screen.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TOP_TEAM = "%s的队伍" # Team name used.
TOP_VICTORY_TEXT = "%s胜利了!" # Text used to display victory.
TOP_LEVEL_UP = "%s升级!" # Text used to display level up.
TOP_SPOILS = "胜利战利品!" # Text used for spoils.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - EXP Gauge Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Adjust how the EXP Gauge appears for the Victory Aftermath here. This
# includes the text display, the font size, the colour of the gauges, and
# more. Adjust it all here.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
VICTORY_EXP = "+%sEXP" # Text used to display EXP.
EXP_PERCENT = "%1.2f%%" # The way EXP percentage will be displayed.
LEVELUP_TEXT = "LEVEL UP!" # Text to replace percentage when leveled.
MAX_LVL_TEXT = "MAX LEVEL" # Text to replace percentage when max level.
FONTSIZE_EXP = 20 # Font size used for EXP.
EXP_TICKS = 15 # Ticks to full EXP
EXP_GAUGE1 = 12 # "Window" skin text colour for gauge.
EXP_GAUGE2 = 4 # "Window" skin text colour for gauge.
LEVEL_GAUGE1 = 13 # "Window" skin text colour for leveling.
LEVEL_GAUGE2 = 5 # "Window" skin text colour for leveling.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Victory Messages -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# In the Victory Aftermath, actors can say unique things. This is the pool
# of quotes used for actors without any custom victory quotes. Note that
# actors with custom quotes will take priority over classes with custom
# quotes, which will take priority over these default quotes. Use \n for
# a line break in the quotes.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
HEADER_TEXT = "\e>\eC[6]%s\eC[0]\e<\n" # Always at start of messages.
FOOTER_TEXT = "" # Always at end of messages.
# Win Quotes are what the actors say when a battle is won.
VICTORY_QUOTES ={
# :type => Quotes
#------------------------------------------------------------------------
:win => [ # Occurs as initial victory quote.
'"我们赢了! 多么激烈的战斗!"',
'"我出了一身汗."',
'"这并不难."',
'"让我们挑战更厉害的!"',
],# Do not remove this.
#------------------------------------------------------------------------
:level => [ # Occurs as initial victory quote.
'"好! 升级了!"',
'"我变强了!"',
'"试试超过我!"',
'"我又成长了!"',
],# Do not remove this.
#------------------------------------------------------------------------
:drops => [ # Occurs as initial victory quote.
'"带走这些东西."',
'"胜利者的战利品."',
'"怪物掉了些东西!"',
'"嘿, 这是什么?"',
],# Do not remove this.
#------------------------------------------------------------------------
} # Do not remove this.
end # VICTORY_AFTERMATH
end # YEA
#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================
module YEA
module REGEXP
module BASEITEM
NEW_QUOTE = /\[(?:NEW_QUOTE|new quote)\]/i
WIN_QUOTE_ON = /<(?:WIN_QUOTES|win quote|win quotes)>/i
WIN_QUOTE_OFF = /<\/(?:WIN_QUOTES|win quote|win quotes)>/i
LEVEL_QUOTE_ON = /<(?:LEVEL_QUOTES|level quote|level quotes)>/i
LEVEL_QUOTE_OFF = /<\/(?:LEVEL_QUOTES|level quote|level quotes)>/i
DROPS_QUOTE_ON = /<(?:DROPS_QUOTES|drops quote|drops quotes)>/i
DROPS_QUOTE_OFF = /<\/(?:DROPS_QUOTES|drops quote|drops quotes)>/i
end # BASEITEM
end # REGEXP
end # YEA
#==============================================================================
# ■ Switch
#==============================================================================
module Switch
#--------------------------------------------------------------------------
# self.skip_aftermath
#--------------------------------------------------------------------------
def self.skip_aftermath
return false if YEA::VICTORY_AFTERMATH::SKIP_AFTERMATH_SWITCH <= 0
return $game_switches[YEA::VICTORY_AFTERMATH::SKIP_AFTERMATH_SWITCH]
end
end # Switch
#==============================================================================
# ■ Numeric
#==============================================================================
class Numeric
#--------------------------------------------------------------------------
# new method: group_digits
#--------------------------------------------------------------------------
unless $imported["YEA-CoreEngine"]
def group; return self.to_s; end
end # $imported["YEA-CoreEngine"]
end # Numeric
#==============================================================================
# ■ DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias load_database_va load_database; end
def self.load_database
load_database_va
load_notetags_va
end
#--------------------------------------------------------------------------
# new method: load_notetags_va
#--------------------------------------------------------------------------
def self.load_notetags_va
groups = [$data_actors, $data_classes]
for group in groups
for obj in group
next if obj.nil?
obj.load_notetags_va
end
end
end
end # DataManager
#==============================================================================
# ■ RPG::BaseItem
#==============================================================================
class RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :win_quotes
attr_accessor :level_quotes
attr_accessor :drops_quotes
#--------------------------------------------------------------------------
# common cache: load_notetags_va
#--------------------------------------------------------------------------
def load_notetags_va
@win_quotes = [""]
@level_quotes = [""]
@drops_quotes = [""]
@victory_quote_type = nil
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::BASEITEM::WIN_QUOTE_ON
@victory_quote_type = :win_quote
when YEA::REGEXP::BASEITEM::WIN_QUOTE_OFF
@victory_quote_type = nil
when YEA::REGEXP::BASEITEM::LEVEL_QUOTE_ON
@victory_quote_type = :level_quote
when YEA::REGEXP::BASEITEM::LEVEL_QUOTE_OFF
@victory_quote_type = nil
when YEA::REGEXP::BASEITEM::DROPS_QUOTE_ON
@victory_quote_type = :drops_quote
when YEA::REGEXP::BASEITEM::DROPS_QUOTE_OFF
@victory_quote_type = nil
#---
when YEA::REGEXP::BASEITEM::NEW_QUOTE
case @victory_quote_type
when nil; next
when :win_quote; @win_quotes.push("")
when :level_quote; @level_quotes.push("")
when :drops_quote; @drops_quotes.push("")
end
#---
else
case @victory_quote_type
when nil; next
when :win_quote; @win_quotes[@win_quotes.size-1] += line.to_s
when :level_quote; @level_quotes[@level_quotes.size-1] += line.to_s
when :drops_quote; @drops_quotes[@drops_quotes.size-1] += line.to_s
end
end
} # self.note.split
#---
return unless self.is_a?(RPG::Class)
quotes = YEA::VICTORY_AFTERMATH::VICTORY_QUOTES
@win_quotes = quotes[:win].clone if @win_quotes == [""]
@level_quotes = quotes[:level].clone if @level_quotes == [""]
@drops_quotes = quotes[:drops].clone if @drops_quotes == [""]
end
end # RPG::BaseItem
#==============================================================================
# ■ BattleManager
#==============================================================================
module BattleManager
#--------------------------------------------------------------------------
# overwrite method: self.process_victory
#--------------------------------------------------------------------------
def self.process_victory
if $imported["YEA-CommandAutobattle"]
SceneManager.scene.close_disable_autobattle_window
end
if Switch.skip_aftermath
skip_aftermath
return
end
play_battle_end_me
gain_jp if $imported["YEA-JPManager"]
display_exp
gain_exp
gain_gold
gain_drop_items
close_windows
SceneManager.return
replay_bgm_and_bgs
battle_end(0)
return true
end
#--------------------------------------------------------------------------
# new method: self.skip_aftermath
#--------------------------------------------------------------------------
def self.skip_aftermath
$game_party.all_members.each do |actor|
actor.gain_exp($game_troop.exp_total)
end
$game_party.gain_gold($game_troop.gold_total)
$game_troop.make_drop_items.each do |item|
$game_party.gain_item(item, 1)
end
close_windows
SceneManager.return
replay_bgm_and_bgs
battle_end(0)
end
#--------------------------------------------------------------------------
# overwrite method: self.play_battle_end_me
#--------------------------------------------------------------------------
def self.play_battle_end_me
$game_system.battle_end_me.play
YEA::VICTORY_AFTERMATH::VICTORY_BGM.play
end
#--------------------------------------------------------------------------
# new method: self.set_victory_text
#--------------------------------------------------------------------------
def self.set_victory_text(actor, type)
text = "" + sprintf(YEA::VICTORY_AFTERMATH::HEADER_TEXT, actor.name)
text += actor.victory_quotes(type)[rand(actor.victory_quotes(type).size)]
text += YEA::VICTORY_AFTERMATH::FOOTER_TEXT
$game_message.face_name = actor.face_name
$game_message.face_index = actor.face_index
$game_message.add(text)
wait_for_message
end
#--------------------------------------------------------------------------
# overwrite method: self.display_exp
#--------------------------------------------------------------------------
def self.display_exp
SceneManager.scene.show_victory_display_exp
actor = $game_party.random_target
@victory_actor = actor
set_victory_text(@victory_actor, :win)
end
#--------------------------------------------------------------------------
# overwrite method: self.gain_exp
#--------------------------------------------------------------------------
def self.gain_exp
$game_party.all_members.each do |actor|
temp_actor = Marshal.load(Marshal.dump(actor))
actor.gain_exp($game_troop.exp_total)
next if actor.level == temp_actor.level
SceneManager.scene.show_victory_level_up(actor, temp_actor)
set_victory_text(actor, :level)
wait_for_message
end
end
#--------------------------------------------------------------------------
# overwrite method: self.gain_gold
#--------------------------------------------------------------------------
def self.gain_gold
$game_party.gain_gold($game_troop.gold_total)
end
#--------------------------------------------------------------------------
# overwrite method: self.gain_drop_items
#--------------------------------------------------------------------------
def self.gain_drop_items
drops = []
$game_troop.make_drop_items.each do |item|
$game_party.gain_item(item, 1)
drops.push(item)
end
SceneManager.scene.show_victory_spoils($game_troop.gold_total, drops)
set_victory_text(@victory_actor, :drops)
wait_for_message
end
#--------------------------------------------------------------------------
# new method: self.close_windows
#--------------------------------------------------------------------------
def self.close_windows
SceneManager.scene.close_victory_windows
end
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias battle_end_va battle_end; end
def self.battle_end(result)
battle_end_va(result)
return if result == 2
return if YEA::VICTORY_AFTERMATH::AFTERMATH_COMMON_EVENT <= 0
event_id = YEA::VICTORY_AFTERMATH::AFTERMATH_COMMON_EVENT
$game_temp.reserve_common_event(event_id)
end
end # BattleManager
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# overwrite method: gain_exp
#--------------------------------------------------------------------------
def gain_exp(exp)
enabled = !SceneManager.scene_is?(Scene_Battle)
change_exp(self.exp + (exp * final_exp_rate).to_i, enabled)
end
#--------------------------------------------------------------------------
# new method: victory_quotes
#--------------------------------------------------------------------------
def victory_quotes(type)
case type
when :win
return self.actor.win_quotes if self.actor.win_quotes != [""]
return self.class.win_quotes
when :level
return self.actor.level_quotes if self.actor.level_quotes != [""]
return self.class.level_quotes
when :drops
return self.actor.drops_quotes if self.actor.drops_quotes != [""]
return self.class.drops_quotes
else
return ["NOTEXT"]
end
end
end # Game_Actor
#==============================================================================
# ■ Window_VictoryTitle
#==============================================================================
class Window_VictoryTitle < Window_Base
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize
super(0, 0, Graphics.width, fitting_height(1))
self.z = 200
self.openness = 0
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh(message = "")
contents.clear
draw_text(0, 0, contents.width, line_height, message, 1)
end
end # Window_VictoryTitle
#==============================================================================
# ■ Window_VictoryEXP_Back
#==============================================================================
class Window_VictoryEXP_Back < Window_Selectable
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize
super(0, fitting_height(1), Graphics.width, window_height)
self.z = 200
self.openness = 0
end
#--------------------------------------------------------------------------
# window_height
#--------------------------------------------------------------------------
def window_height
return Graphics.height - fitting_height(4) - fitting_height(1)
end
#--------------------------------------------------------------------------
# col_max
#--------------------------------------------------------------------------
def col_max; return item_max; end
#--------------------------------------------------------------------------
# spacing
#--------------------------------------------------------------------------
def spacing; return 8; end
#--------------------------------------------------------------------------
# item_max
#--------------------------------------------------------------------------
def item_max; return $game_party.battle_members.size; end
#--------------------------------------------------------------------------
# open
#--------------------------------------------------------------------------
def open
@exp_total = $game_troop.exp_total
super
end
#--------------------------------------------------------------------------
# item_rect
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new
rect.width = item_width
rect.height = contents.height
rect.x = index % col_max * (item_width + spacing)
rect.y = index / col_max * item_height
return rect
end
#--------------------------------------------------------------------------
# draw_item
#--------------------------------------------------------------------------
def draw_item(index)
actor = $game_party.battle_members[index]
return if actor.nil?
rect = item_rect(index)
reset_font_settings
draw_actor_name(actor, rect)
draw_exp_gain(actor, rect)
draw_jp_gain(actor, rect)
draw_actor_face(actor, rect)
end
#--------------------------------------------------------------------------
# draw_actor_name
#--------------------------------------------------------------------------
def draw_actor_name(actor, rect)
name = actor.name
draw_text(rect.x, rect.y+line_height, rect.width, line_height, name, 1)
end
#--------------------------------------------------------------------------
# draw_actor_face
#--------------------------------------------------------------------------
def draw_actor_face(actor, rect)
face_name = actor.face_name
face_index = actor.face_index
bitmap = Cache.face(face_name)
rw = [rect.width, 96].min
face_rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, rw, 96)
rx = (rect.width - rw) / 2 + rect.x
contents.blt(rx, rect.y + line_height * 2, bitmap, face_rect, 255)
end
#--------------------------------------------------------------------------
# draw_exp_gain
#--------------------------------------------------------------------------
def draw_exp_gain(actor, rect)
dw = rect.width - (rect.width - [rect.width, 96].min) / 2
dy = rect.y + line_height * 3 + 96
fmt = YEA::VICTORY_AFTERMATH::VICTORY_EXP
text = sprintf(fmt, actor_exp_gain(actor).group)
contents.font.size = YEA::VICTORY_AFTERMATH::FONTSIZE_EXP
change_color(power_up_color)
draw_text(rect.x, dy, dw, line_height, text, 2)
end
#--------------------------------------------------------------------------
# actor_exp_gain
#--------------------------------------------------------------------------
def actor_exp_gain(actor)
n = @exp_total * actor.final_exp_rate
return n.to_i
end
#--------------------------------------------------------------------------
# draw_jp_gain
#--------------------------------------------------------------------------
def draw_jp_gain(actor, rect)
return unless $imported["YEA-JPManager"]
dw = rect.width - (rect.width - [rect.width, 96].min) / 2
dy = rect.y + line_height * 4 + 96
fmt = YEA::JP::VICTORY_AFTERMATH
text = sprintf(fmt, actor_jp_gain(actor).group, Vocab::jp)
contents.font.size = YEA::VICTORY_AFTERMATH::FONTSIZE_EXP
change_color(power_up_color)
draw_text(rect.x, dy, dw, line_height, text, 2)
end
#--------------------------------------------------------------------------
# actor_jp_gain
#--------------------------------------------------------------------------
def actor_jp_gain(actor)
n = actor.battle_jp_earned
if actor.exp + actor_exp_gain(actor) > actor.exp_for_level(actor.level + 1)
n += YEA::JP::LEVEL_UP unless actor.max_level?
end
return n
end
end # Window_VictoryEXP_Back
#==============================================================================
# ■ Window_VictoryEXP_Front
#==============================================================================
class Window_VictoryEXP_Front < Window_VictoryEXP_Back
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize
super
self.back_opacity = 0
@ticks = 0
@counter = 30
contents.font.size = YEA::VICTORY_AFTERMATH::FONTSIZE_EXP
end
#--------------------------------------------------------------------------
# update
#--------------------------------------------------------------------------
def update
super
update_tick
end
#--------------------------------------------------------------------------
# update_tick
#--------------------------------------------------------------------------
def update_tick
return unless self.openness >= 255
return unless self.visible
return if complete_ticks?
@counter -= 1
return unless @counter <= 0
return if @ticks >= YEA::VICTORY_AFTERMATH::EXP_TICKS
YEA::VICTORY_AFTERMATH::VICTORY_TICK.play
@counter = 4
@ticks += 1
refresh
end
#--------------------------------------------------------------------------
# complete_ticks?
#--------------------------------------------------------------------------
def complete_ticks?
for actor in $game_party.battle_members
total_ticks = YEA::VICTORY_AFTERMATH::EXP_TICKS
bonus_exp = actor_exp_gain(actor) * @ticks / total_ticks
now_exp = actor.exp - actor.current_level_exp + bonus_exp
next_exp = actor.next_level_exp - actor.current_level_exp
rate = now_exp * 1.0 / next_exp
return false if rate < 1.0
end
return true
end
#--------------------------------------------------------------------------
# draw_item
#--------------------------------------------------------------------------
def draw_item(index)
actor = $game_party.battle_members[index]
return if actor.nil?
rect = item_rect(index)
draw_actor_exp(actor, rect)
end
#--------------------------------------------------------------------------
# exp_gauge1
#--------------------------------------------------------------------------
def exp_gauge1; return text_color(YEA::VICTORY_AFTERMATH::EXP_GAUGE1); end
#--------------------------------------------------------------------------
# exp_gauge2
#--------------------------------------------------------------------------
def exp_gauge2; return text_color(YEA::VICTORY_AFTERMATH::EXP_GAUGE2); end
#--------------------------------------------------------------------------
# lvl_gauge1
#--------------------------------------------------------------------------
def lvl_gauge1; return text_color(YEA::VICTORY_AFTERMATH::LEVEL_GAUGE1); end
#--------------------------------------------------------------------------
# lvl_gauge2
#--------------------------------------------------------------------------
def lvl_gauge2; return text_color(YEA::VICTORY_AFTERMATH::LEVEL_GAUGE2); end
#--------------------------------------------------------------------------
# draw_actor_exp
#--------------------------------------------------------------------------
def draw_actor_exp(actor, rect)
if actor.max_level?
draw_exp_gauge(actor, rect, 1.0)
return
end
total_ticks = YEA::VICTORY_AFTERMATH::EXP_TICKS
bonus_exp = actor_exp_gain(actor) * @ticks / total_ticks
now_exp = actor.exp - actor.current_level_exp + bonus_exp
next_exp = actor.next_level_exp - actor.current_level_exp
rate = now_exp * 1.0 / next_exp
draw_exp_gauge(actor, rect, rate)
end
#--------------------------------------------------------------------------
# draw_exp_gauge
#--------------------------------------------------------------------------
def draw_exp_gauge(actor, rect, rate)
rate = [[rate, 1.0].min, 0.0].max
dx = (rect.width - [rect.width, 96].min) / 2 + rect.x
dy = rect.y + line_height * 2 + 96
dw = [rect.width, 96].min
colour1 = rate >= 1.0 ? lvl_gauge1 : exp_gauge1
colour2 = rate >= 1.0 ? lvl_gauge2 : exp_gauge2
draw_gauge(dx, dy, dw, rate, colour1, colour2)
fmt = YEA::VICTORY_AFTERMATH::EXP_PERCENT
text = sprintf(fmt, [rate * 100, 100.00].min)
if [rate * 100, 100.00].min == 100.00
text = YEA::VICTORY_AFTERMATH::LEVELUP_TEXT
text = YEA::VICTORY_AFTERMATH::MAX_LVL_TEXT if actor.max_level?
end
draw_text(dx, dy, dw, line_height, text, 1)
end
end # Window_VictoryEXP_Front
#==============================================================================
# ■ Window_VictoryLevelUp
#==============================================================================
class Window_VictoryLevelUp < Window_Base
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize
super(0, fitting_height(1), Graphics.width, window_height)
self.z = 200
hide
end
#--------------------------------------------------------------------------
# window_height
#--------------------------------------------------------------------------
def window_height
return Graphics.height - fitting_height(4) - fitting_height(1)
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh(actor, temp_actor)
contents.clear
reset_font_settings
YEA::VICTORY_AFTERMATH::LEVEL_SOUND.play
draw_actor_changes(actor, temp_actor)
end
#--------------------------------------------------------------------------
# draw_actor_changes
#--------------------------------------------------------------------------
def draw_actor_changes(actor, temp_actor)
dx = contents.width / 16
draw_actor_image(actor, temp_actor, dx)
draw_param_names(actor, dx)
draw_former_stats(temp_actor)
draw_arrows
draw_newer_stats(actor, temp_actor)
draw_new_skills(actor, temp_actor)
end
#--------------------------------------------------------------------------
# draw_actor_image
#--------------------------------------------------------------------------
def draw_actor_image(actor, temp_actor, dx)
draw_text(dx, line_height, 96, line_height, actor.name, 1)
draw_actor_face(actor, dx, line_height * 2)
exp = actor.exp - temp_actor.exp
text = sprintf(YEA::VICTORY_AFTERMATH::VICTORY_EXP, exp.group)
change_color(power_up_color)
contents.font.size = YEA::VICTORY_AFTERMATH::FONTSIZE_EXP
draw_text(0, line_height * 2 + 96, dx + 96, line_height, text, 2)
reset_font_settings
end
#--------------------------------------------------------------------------
# draw_param_names
#--------------------------------------------------------------------------
def draw_param_names(actor, dx)
dx += 108
change_color(system_color)
text = Vocab.level
draw_text(dx, 0, contents.width - dx, line_height, text)
dy = 0
for i in 0...8
dy += line_height
text = Vocab.param(i)
draw_text(dx, dy, contents.width - dx, line_height, text)
end
end
#--------------------------------------------------------------------------
# draw_former_stats
#--------------------------------------------------------------------------
def draw_former_stats(actor)
dw = contents.width / 2 - 12
dy = 0
change_color(normal_color)
draw_text(0, dy, dw, line_height, actor.level.group, 2)
for i in 0...8
dy += line_height
draw_text(0, dy, dw, line_height, actor.param(i).group, 2)
end
end
#--------------------------------------------------------------------------
# draw_arrows
#--------------------------------------------------------------------------
def draw_arrows
dx = contents.width / 2 - 12
dy = 0
change_color(system_color)
for i in 0..8
draw_text(dx, dy, 24, line_height, "→", 1)
dy += line_height
end
end
#--------------------------------------------------------------------------
# draw_newer_stats
#--------------------------------------------------------------------------
def draw_newer_stats(actor, temp_actor)
dx = contents.width / 2 + 12
dw = contents.width - dx
dy = 0
change_color(param_change_color(actor.level - temp_actor.level))
draw_text(dx, dy, dw, line_height, actor.level.group, 0)
for i in 0...8
dy += line_height
change_color(param_change_color(actor.param(i) - temp_actor.param(i)))
draw_text(dx, dy, dw, line_height, actor.param(i).group, 0)
end
end
#--------------------------------------------------------------------------
# draw_new_skills
#--------------------------------------------------------------------------
def draw_new_skills(actor, temp_actor)
return if temp_actor.skills.size == actor.skills.size
dw = 172 + 24
dx = contents.width - dw
change_color(system_color)
text = YEA::VICTORY_AFTERMATH::SKILLS_TEXT
draw_text(dx, 0, dw, line_height, text, 0)
end
end # Window_VictoryLevelUp
#==============================================================================
# ■ Window_VictorySkills
#==============================================================================
class Window_VictorySkills < Window_Selectable
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize
dy = fitting_height(1) + 24
dw = 172 + 24 + 24
dh = Graphics.height - fitting_height(4) - fitting_height(1) - 24
super(Graphics.width - dw, dy, dw, dh)
self.opacity = 0
self.z = 200
hide
end
#--------------------------------------------------------------------------
# item_max
#--------------------------------------------------------------------------
def item_max; return @data.nil? ? 0 : @data.size; end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh(actor, temp_actor)
contents.clear
if actor.skills.size == temp_actor.skills.size
unselect
@data = []
create_contents
return
end
@data = actor.skills - temp_actor.skills
if @data.size > 8
select(0)
activate
else
unselect
deactivate
end
create_contents
draw_all_items
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
skill = @data[index]
return if skill.nil?
rect.width -= 4
draw_item_name(skill, rect.x, rect.y, true)
end
end # Window_VictorySkills
#==============================================================================
# ■ Window_VictorySpoils
#==============================================================================
class Window_VictorySpoils < Window_ItemList
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize
super(0, fitting_height(1), Graphics.width, window_height)
self.z = 200
hide
end
#--------------------------------------------------------------------------
# window_height
#--------------------------------------------------------------------------
def window_height
return Graphics.height - fitting_height(4) - fitting_height(1)
end
#--------------------------------------------------------------------------
# spacing
#--------------------------------------------------------------------------
def spacing; return 32; end
#--------------------------------------------------------------------------
# make
#--------------------------------------------------------------------------
def make(gold, drops)
@gold = gold
@Drops = drops
refresh
select(0)
activate
end
#--------------------------------------------------------------------------
# make_item_list
#--------------------------------------------------------------------------
def make_item_list
@data = [nil]
items = {}
weapons = {}
armours = {}
@goods = {}
for item in @drops
case item
when RPG::Item
items[item] = 0 if items[item].nil?
items[item] += 1
when RPG::Weapon
weapons[item] = 0 if weapons[item].nil?
weapons[item] += 1
when RPG::Armor
armours[item] = 0 if armours[item].nil?
armours[item] += 1
end
end
items = items.sort { |a,b| a[0].id <=> b[0].id }
weapons = weapons.sort { |a,b| a[0].id <=> b[0].id }
armours = armours.sort { |a,b| a[0].id <=> b[0].id }
for key in items; @goods[key[0]] = key[1]; @data.push(key[0]); end
for key in weapons; @goods[key[0]] = key[1]; @data.push(key[0]); end
for key in armours; @goods[key[0]] = key[1]; @data.push(key[0]); end
end
#--------------------------------------------------------------------------
# draw_item
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
rect = item_rect(index)
reset_font_settings
if item.nil?
draw_gold(rect)
return
end
rect.width -= 4
draw_item_name(item, rect.x, rect.y, true, rect.width - 24)
draw_item_number(rect, item)
end
#--------------------------------------------------------------------------
# draw_gold
#--------------------------------------------------------------------------
def draw_gold(rect)
text = Vocab.currency_unit
draw_currency_value(@gold, text, rect.x, rect.y, rect.width)
end
#--------------------------------------------------------------------------
# draw_item_number
#--------------------------------------------------------------------------
def draw_item_number(rect, item)
number = @goods[item].group
if $imported["YEA-AdjustLimits"]
contents.font.size = YEA::LIMIT::ITEM_FONT
text = sprintf(YEA::LIMIT::ITEM_PREFIX, number)
draw_text(rect, text, 2)
else
draw_text(rect, sprintf(":%s", number), 2)
end
end
end # Window_VictorySpoils
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# alias method: create_all_windows
#--------------------------------------------------------------------------
alias scene_battle_create_all_windows_va create_all_windows
def create_all_windows
scene_battle_create_all_windows_va
create_victory_aftermath_windows
end
#--------------------------------------------------------------------------
# new method: create_victory_aftermath_windows
#--------------------------------------------------------------------------
def create_victory_aftermath_windows
@victory_title_window = Window_VictoryTitle.new
@victory_exp_window_back = Window_VictoryEXP_Back.new
@victory_exp_window_front = Window_VictoryEXP_Front.new
@victory_level_window = Window_VictoryLevelUp.new
@victory_level_skills = Window_VictorySkills.new
@victory_spoils_window = Window_VictorySpoils.new
end
#--------------------------------------------------------------------------
# new method: show_victory_display_exp
#--------------------------------------------------------------------------
def show_victory_display_exp
@victory_title_window.open
name = $game_party.battle_members[0].name
fmt = YEA::VICTORY_AFTERMATH::TOP_TEAM
name = sprintf(fmt, name) if $game_party.battle_members.size > 1
fmt = YEA::VICTORY_AFTERMATH::TOP_VICTORY_TEXT
text = sprintf(fmt, name)
@victory_title_window.refresh(text)
#---
@victory_exp_window_back.open
@victory_exp_window_back.refresh
@victory_exp_window_front.open
@victory_exp_window_front.refresh
end
#--------------------------------------------------------------------------
# new method: show_victory_level_up
#--------------------------------------------------------------------------
def show_victory_level_up(actor, temp_actor)
@victory_exp_window_back.hide
@victory_exp_window_front.hide
#---
fmt = YEA::VICTORY_AFTERMATH::TOP_LEVEL_UP
text = sprintf(fmt, actor.name)
@victory_title_window.refresh(text)
#---
@victory_level_window.show
@victory_level_window.refresh(actor, temp_actor)
@victory_level_skills.show
@victory_level_skills.refresh(actor, temp_actor)
end
#--------------------------------------------------------------------------
# new method: show_victory_spoils
#--------------------------------------------------------------------------
def show_victory_spoils(gold, drops)
@victory_exp_window_back.hide
@victory_exp_window_front.hide
@victory_level_window.hide
@victory_level_skills.hide
#---
text = YEA::VICTORY_AFTERMATH::TOP_SPOILS
@victory_title_window.refresh(text)
#---
@victory_spoils_window.show
@victory_spoils_window.make(gold, drops)
end
#--------------------------------------------------------------------------
# new method: close_victory_windows
#--------------------------------------------------------------------------
def close_victory_windows
@victory_title_window.close
@victory_exp_window_back.close
@victory_exp_window_front.close
@victory_level_window.close
@victory_level_skills.close
@victory_spoils_window.close
wait(16)
end
end # Scene_Battle
#==============================================================================
#
# ▼ End of File
#
#==============================================================================
|
评分
-
查看全部评分
|