| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 4 |
| 经验 | |
| 最后登录 | 2018-7-17 |
| 在线时间 | 127 小时 |
- 梦石
- 0
- 星屑
- 354
- 在线时间
- 127 小时
- 注册时间
- 2016-10-8
- 回帖
- 54
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 elemmy72 于 2018-5-4 16:39 编辑
Enemy Levels v1.02[pre lang="ruby"]#==============================================================================
#
# ▼ Yanfly Engine Ace - Enemy Levels v1.02
# -- Last Updated: 2012.01.26
# -- Level: Normal, Hard
# -- Requires: n/a
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YEA-EnemyLevels"] = true
#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.01.26 - Bug Fixed: Duplication of stat growth rates per enemy.
# 2012.01.24 - Added <hide level> notetag for enemies.
# - Option to change Party Level function in Action Conditions to
# enemy level requirements.
# 2011.12.30 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# RPG's with enemies that level up with the party enforces the player to stay
# on their toes the whole time. This is both a good and bad thing as it can
# cause the player to stay alert, but can also cause the player to meet some
# roadblocks. This script will not only provide enemies the ability to level up
# but also allow the script's user to go around these roadblocks using various
# tags to limit or slow down the rate of growth across all enemies.
#
#==============================================================================
# ▼ 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.
#
# -----------------------------------------------------------------------------
# Skill Notetags - These notetags go in the skill notebox in the database.
# -----------------------------------------------------------------------------
# <enemy level: +x>
# <enemy level: -x>
# This causes the enemy to raise or drop x levels depending on the tag used.
# The new level will readjust the enemy's stats (including HP and MP).
# 根據提升和降低等級而增減所有能力值。
#
# <enemy level reset>
# This resets the enemy's level back to the typical range it should be plus or
# minus any level fluctuations it was given. This occurs before enemy level +
# and enemy level - tags.
# 重置敵人等級。
#
# -----------------------------------------------------------------------------
# Enemy Notetags - These notetags go in the enemies notebox in the database.
# -----------------------------------------------------------------------------
# <hide level>
# This notetag will hide the level of the enemy. If YEA - Enemy Target Info is
# installed, the level will be revealed upon a parameter scan.
# 隱藏敵人的等級,如果安裝了YEA - Enemy Target Info,則會顯示等級。
#
# <min level: x>
# <max level: x>
# This will adjust the minimum and maximum levels for the enemy. By default,
# the minimum level is 1 and the maximum level is whatever is set in the module
# as MAX_LEVEL.
# 設置敵人的最低與最高等級。默認情況下最低等級為1,最高等級則需設置。
#
# <set level: x>
# This will set the enemy's level to exactly x. It a sense, this is just the
# usage of both the min and max level tags together as the same value.
# 設置敵人的固定等級。並不會像上列那樣有最低最高的浮動等級,這個是固定的。
#
# <level type: x>
# Choosing a value from 0 to 4, you can adjust the different leveling rulesets
# for the enemy. See the list below.
# Type 0 - Lowest level of all actors that have joined.
# Type 1 - Lowest level in the battle party.
# Type 2 - Average level of the battle party.
# Type 3 - Highest level of the battle party.
# Type 4 - Highest level of all actors that have joined.
# 可依照設置的等級類型來自動判斷敵人等級。
# Type 0 - 取我方隊伍中的最低等級為敵人等級。
# Type 1 - 取戰鬥中的敵我方的最低等級為敵人等級。
# Type 2 - 取戰鬥中的敵我方的平均等級為敵人等級。
# Type 3 - 取戰鬥中的敵我方的最高等級為敵人等級。
# Type 4 - 取我方隊伍中的最高等級為敵人等級。
#
# <level random: x>
# This will give the level a random flunctuation in either direction. Set this
# value to 0 if you don't wish to use it. Adjust RANDOM_FLUCTUATION inside the
# module to change the default fluctuation value.
# 這將使該等級在任一方向都出現隨機波動。
# 不想使用就設置為0,調整模塊內部的RANDOM_FLUCTUATION以更改默認波動值。
#
# <stat: +x per level>
# <stat: -x per level>
# <stat: +x% per level>
# <stat: -x% per level>
# This will raise or lower the stat by x or x% per level (depending on the tag
# used). This will override the default growth settings found inside the module
# hash called DEFAULT_GROWTH. You may replace stat with:
# MAXHP, MAXMP, ATK, DEF, MAT, MDF, AGI, LUK, GOLD, EXP
# 用於提高或降低每個等級x或x%的能力數值。(會覆蓋數據庫裡的敵人能力值設置)
# stat修改為:MAXHP,MAXMP,ATK,DEF,MAT,MDF,AGI,LUK,GOLD,EXP
#
#==============================================================================
# ▼ 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 ENEMY_LEVEL
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - General Level Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These settings adjust the general level setup for your enemies from the
# way levels appear in the game to the default maximum level for enemies,
# to the way their levels are calculated by default, and the random level
# fluctuation they have. If you want enemies to have different settings,
# use notetags to change the respective setting.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# This is how the level text will appear whenever enemy levels are shown.
# 設置在遊戲內戰鬥中會顯示的字樣。
LEVEL_TEXT = "Lv.%s %s"
# This is the maximum level your enemies can achieve. They cannot go higher
# no exceptions. Adjust this accordingly to fit your game.
# 設置所有敵人的最高等級。
MAX_LEVEL = 99
# Default level calculations for your enemies will be adjusted as such.
# Type 0 - Lowest level of all actors that have joined.
# Type 1 - Lowest level in the battle party.
# Type 2 - Average level of the battle party.
# Type 3 - Highest level of the battle party.
# Type 4 - Highest level of all actors that have joined.
# 判定敵人的默認等級。
# Type 0 - 取我方隊伍中的最低等級為敵人等級。
# Type 1 - 取戰鬥中的敵我方的最低等級為敵人等級。
# Type 2 - 取戰鬥中的敵我方的平均等級為敵人等級。
# Type 3 - 取戰鬥中的敵我方的最高等級為敵人等級。
# Type 4 - 取我方隊伍中的最高等級為敵人等級。
DEFAULT_LEVEL_TYPE = 4
# If you want your enemies to have random +/- levels of some degree, change
# this number to something other than 0. This is the default value.
# 依照設置的數值隨機增減敵人能力值,若不需要則設為0。
RANDOM_FLUCTUATION = 10
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Parameter Growth Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Here, you adjust how much stats grow for enemies by default, including
# the formula used to calculate those stats. If you wish for enemies to
# have different growth settings, use notetags to change them.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These settings adjust the default growth rates (not the base stat formula)
# for each stat. These are the values that will exist for each enemy unless
# defined otherwise by the tags inside their noteboxes.
# 設定敵人的能力值增加量。(若在數據庫裡有設定敵人能力值則無視這裡的設定)
DEFAULT_GROWTH ={
# ParamID => [:類型, 每級增加值, 最大增加值],
0 => [:maxhp, 0.15, 50],
1 => [:maxmp, 0.10, 10],
2 => [ :atk, 0.05, 5],
3 => [ :def, 0.05, 5],
4 => [ :mat, 0.05, 5],
5 => [ :mdf, 0.05, 5],
6 => [ :agi, 0.05, 5],
7 => [ :luk, 0.05, 5],
8 => [ :gold, 0.15, 10],
9 => [ :exp, 0.05, 10],
} # Do not remove this.
# The following hash will adjust each of the formulas for each base stat.
# Adjust them as you see fit but only if you know what you're doing.
# base - The base stat from the enemy database.
# per - Growth rate which has not been yet converted to a percent.
# set - Set growth rate. Modified
# Default: "base * (1.00 + (level-1) * per) + (set * (level-1))"
STAT_FORMULA = "base * (1.00 + (level-1) * per) + (set * (level-1))"
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Party Level to Enemy Level Action Conditions -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Setting the below to true will cause the Party Level requirement under
# Action Conditions in the Action Patterns list to become an Enemy Level
# requirement. The enemy must be at least the level or else it cannot use
# the listed action.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
PARTY_LEVEL_TO_ENEMY_LEVEL = false
end # ENEMY_LEVEL
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 USABLEITEM
LEVEL_CHANGE = /<(?:ENEMY LEVEL|enemy level):[ ]([\+\-]\d+)>/i
LEVEL_RESET = /<(?:ENEMY LEVEL RESET|enemy level reset)>/i
end # USABLEITEM
module ENEMY
LEVEL_TYPE = /<(?:LEVEL_TYPE|level type):[ ](\d+)>/i
LEVEL_MIN = /<(?:MIN_LEVEL|min level|minimum level):[ ](\d+)>/i
LEVEL_MAX = /<(?:MAX_LEVEL|max level|maximum level):[ ](\d+)>/i
LEVEL_SET = /<(?:SET_LEVEL|set level|permanent level):[ ](\d+)>/i
LEVEL_RAND = /<(?:LEVEL_RANDOM|level random):[ ](\d+)>/i
GROWTH_PER = /<(.*):[ ]([\+\-]\d+)([%%])[ ](?:PER_LEVEL|per level)>/i
GROWTH_SET = /<(.*):[ ]([\+\-]\d+)[ ](?:PER_LEVEL|per level)>/i
HIDE_LEVEL = /<(?:HIDE_LEVEL|hide level)>/i
end # ENEMY
end # REGEXP
end # YEA
#==============================================================================
# ■ 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_elv load_database; end
def self.load_database
load_database_elv
load_notetags_elv
end
#--------------------------------------------------------------------------
# new method: load_notetags_elv
#--------------------------------------------------------------------------
def self.load_notetags_elv
groups = [$data_enemies, $data_skills, $data_items]
for group in groups
for obj in group
next if obj.nil?
obj.load_notetags_elv
end
end
end
end # DataManager
#==============================================================================
# ■ RPG::UsableItem
#==============================================================================
class RPG::UsableItem < RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :level_change
attr_accessor :level_reset
#--------------------------------------------------------------------------
# common cache: load_notetags_elv
#--------------------------------------------------------------------------
def load_notetags_elv
@level_change = 0
@level_reset = false
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::USABLEITEM::LEVEL_CHANGE
@level_change = $1.to_i
when YEA::REGEXP::USABLEITEM::LEVEL_RESET
@level_reset = true
end
} # self.note.split
#---
end
end # RPG::UsableItem
#==============================================================================
# ■ RPG::Enemy
#==============================================================================
class RPG::Enemy < RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :hide_level
attr_accessor :level_type
attr_accessor :level_min
attr_accessor :level_max
attr_accessor :level_rand
attr_accessor :level_growth
#--------------------------------------------------------------------------
# common cache: load_notetags_elv
#--------------------------------------------------------------------------
def load_notetags_elv
@hide_level = false
@level_type = YEA::ENEMY_LEVEL::DEFAULT_LEVEL_TYPE
@level_min = 1
@level_max = YEA::ENEMY_LEVEL::MAX_LEVEL
@level_rand = YEA::ENEMY_LEVEL::RANDOM_FLUCTUATION
@level_growth = Marshal.load(Marshal.dump(YEA::ENEMY_LEVEL::DEFAULT_GROWTH))
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::ENEMY::HIDE_LEVEL
@hide_level = true
when YEA::REGEXP::ENEMY::LEVEL_TYPE
@level_type = $1.to_i
when YEA::REGEXP::ENEMY::LEVEL_MIN
@level_min = [$1.to_i, 1].max
when YEA::REGEXP::ENEMY::LEVEL_MAX
@level_max = [$1.to_i, YEA::ENEMY_LEVEL::MAX_LEVEL].min
when YEA::REGEXP::ENEMY::LEVEL_SET
@level_min = [[$1.to_i, 1].max, YEA::ENEMY_LEVEL::MAX_LEVEL].min
@level_max = [[$1.to_i, 1].max, YEA::ENEMY_LEVEL::MAX_LEVEL].min
when YEA::REGEXP::ENEMY::LEVEL_RAND
@level_rand = $1.to_i
#---
when YEA::REGEXP::ENEMY::GROWTH_PER
case $1.upcase
when "MAXHP", "MHP", "HP"
type = 0
when "MAXMP", "MMP", "MP", "MAXSP", "MSP", "SP"
type = 1
when "ATK", "ATTACK"
type = 2
when "DEF", "DEFENSE"
type = 3
when "MAT", "MAGIC ATTACK", "INT", "INTELLIGENCE", "SPI", "SPIRIT"
type = 4
when "MDF", "MAGIC DEFENSE", "RES", "RESISTANCE"
type = 5
when "AGI", "AGILITY"
type = 6
when "LUK", "LUCK"
type = 7
when "GOLD", "MONEY"
type = 8
when "EXP", "EXPERIENCE", "XP"
type = 9
else; next
end
@level_growth[type][1] = $2.to_i * 0.01
when YEA::REGEXP::ENEMY::GROWTH_SET
case $1.upcase
when "MAXHP", "MHP", "HP"
type = 0
when "MAXMP", "MMP", "MP", "MAXSP", "MSP", "SP"
type = 1
when "ATK", "ATTACK"
type = 2
when "DEF", "DEFENSE"
type = 3
when "MAT", "MAGIC ATTACK", "INT", "INTELLIGENCE", "SPI", "SPIRIT"
type = 4
when "MDF", "MAGIC DEFENSE", "RES", "RESISTANCE"
type = 5
when "AGI", "AGILITY"
type = 6
when "LUK", "LUCK"
type = 7
when "GOLD", "MONEY"
type = 8
when "EXP", "EXPERIENCE", "XP"
type = 9
else; next
end
@level_growth[type][2] = $2.to_i
end
} # self.note.split
#---
end
end # RPG::Enemy
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# alias method: item_user_effect
#--------------------------------------------------------------------------
alias game_battler_item_user_effect_elv item_user_effect
def item_user_effect(user, item)
game_battler_item_user_effect_elv(user, item)
apply_level_changes(item) if self.is_a?(Game_Enemy)
end
end # Game_Battler
#==============================================================================
# ■ Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# alias method: initialize
#--------------------------------------------------------------------------
alias game_enemy_initialize_elv initialize
def initialize(index, enemy_id)
game_enemy_initialize_elv(index, enemy_id)
create_init_level
end
#--------------------------------------------------------------------------
# new method: level
#--------------------------------------------------------------------------
def level
create_init_level if @level.nil?
return @level
end
#--------------------------------------------------------------------------
# new method: level=
#--------------------------------------------------------------------------
def level=(value)
create_init_level if @level.nil?
return if @level == value
hp_rate = self.hp.to_f / self.mhp.to_f
mp_rate = self.mp.to_f / [self.mmp, 1].max.to_f
#@level = [[value, 1].max, YEA::ENEMY_LEVEL::MAX_LEVEL].min
@level = [[value, @level].max, YEA::ENEMY_LEVEL::MAX_LEVEL].min
self.hp = (self.mhp * hp_rate).to_i
self.mp = (self.mmp * mp_rate).to_i
end
#--------------------------------------------------------------------------
# new method: create_init_level
#--------------------------------------------------------------------------
def create_init_level
set_level_type
@hp = mhp
@mp = mmp
end
#--------------------------------------------------------------------------
# new method: set_level_type
#--------------------------------------------------------------------------
def set_level_type
@level = $game_party.match_party_level(enemy.level_type)
@level += rand(enemy.level_rand+1)
@level -= rand(enemy.level_rand+1)
@level = [[@level, enemy.level_max].min, enemy.level_min].max
end
#--------------------------------------------------------------------------
# alias method: transform
#--------------------------------------------------------------------------
alias game_enemy_transform_elv transform
def transform(enemy_id)
game_enemy_transform_elv(enemy_id)
create_init_level
end
#--------------------------------------------------------------------------
# new method: apply_level_changes
#--------------------------------------------------------------------------
def apply_level_changes(item)
create_init_level if item.level_reset
self.level += item.level_change
end
#--------------------------------------------------------------------------
# alias method: param_base
#--------------------------------------------------------------------------
alias game_enemy_param_base_elv param_base
def param_base(param_id)
base = game_enemy_param_base_elv(param_id)
per = enemy.level_growth[param_id][1]
set = enemy.level_growth[param_id][2]
total = eval(YEA::ENEMY_LEVEL::STAT_FORMULA)
return total.to_i
end
#--------------------------------------------------------------------------
# alias method: exp
#--------------------------------------------------------------------------
alias game_enemy_exp_elv exp
def exp
base = game_enemy_exp_elv
per = enemy.level_growth[8][1]
set = enemy.level_growth[8][2]
total = eval(YEA::ENEMY_LEVEL::STAT_FORMULA)
return total.to_i
end
#--------------------------------------------------------------------------
# alias method: gold
#--------------------------------------------------------------------------
alias game_enemy_gold_elv gold
def gold
base = game_enemy_gold_elv
per = enemy.level_growth[9][1]
set = enemy.level_growth[9][2]
total = eval(YEA::ENEMY_LEVEL::STAT_FORMULA)
return total.to_i
end
#--------------------------------------------------------------------------
# alias method: name
#--------------------------------------------------------------------------
alias game_enemy_name_elv name
def name
text = game_enemy_name_elv
if add_level_name?
fmt = YEA::ENEMY_LEVEL::LEVEL_TEXT
text = sprintf(fmt, @level.group, text)
end
return text
end
#--------------------------------------------------------------------------
# new method: add_level_name?
#--------------------------------------------------------------------------
def add_level_name?
if $imported["YEA-EnemyTargetInfo"] && show_info_param?
return true
end
return false if enemy.hide_level
return true
end
#--------------------------------------------------------------------------
# overwrite method: conditions_met_party_level?
#--------------------------------------------------------------------------
if YEA::ENEMY_LEVEL::PARTY_LEVEL_TO_ENEMY_LEVEL
def conditions_met_party_level?(param1, param2)
return @level >= param1
end
end
end # Game_Enemy
#==============================================================================
# ■ Game_Party
#==============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# new method: match_party_level
#--------------------------------------------------------------------------
def match_party_level(level_type)
case level_type
when 0; return all_lowest_level
when 1; return lowest_level
when 2; return average_level
when 3; return highest_level
else; return all_highest_level
end
end
#--------------------------------------------------------------------------
# new method: all_lowest_level
#--------------------------------------------------------------------------
def all_lowest_level
lv = all_members.collect {|actor| actor.level }.min
return lv
end
#--------------------------------------------------------------------------
# new method: lowest_level
#--------------------------------------------------------------------------
def lowest_level
lv = members.collect {|actor| actor.level }.min
return lv
end
#--------------------------------------------------------------------------
# new method: average_level
#--------------------------------------------------------------------------
def average_level
lv = 0
for member in all_members; lv += member.level; end
lv /= all_members.size
return lv
end
#--------------------------------------------------------------------------
# overwrite method: highest_level
#--------------------------------------------------------------------------
def highest_level
lv = members.collect {|actor| actor.level }.max
return lv
end
#--------------------------------------------------------------------------
# all method: all_highest_level
#--------------------------------------------------------------------------
def all_highest_level
lv = all_members.collect {|actor| actor.level }.max
return lv
end
end # Game_Party
#==============================================================================
#
# ▼ End of File
#
#==============================================================================[/pre]
Enemy Target Info v1.02[pre lang="ruby"]#==============================================================================
#
# ▼ Yanfly Engine Ace - Enemy Target Info v1.02
# -- Last Updated: 2012.01.01
# -- Level: Normal
# -- Requires: YEA - Ace Battle Engine v1.10+.
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YEA-EnemyTargetInfo"] = true
#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.01.01 - Bug Fixed: <scan info: all> didn't work properly.
# 2011.12.30 - Bug Fixed: Crash when using Ace Battle Engine's F8 debug.
# 2011.12.29 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# The enemy target info window can be activated in battle to show enemy data
# at the bottom of the screen. Information can be revealed straight from the
# start or requires the player to actively reveal the information on their own
# through either defeating the enemies, using skills on them, or scanning them
# in various ways produced by the script.
#
#==============================================================================
# ▼ 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.
#
# -----------------------------------------------------------------------------
# Skill Notetags - These notetags go in the skill notebox in the database.
# 使用技能來顯示敵人資訊(技能備註欄)
# -----------------------------------------------------------------------------
# <scan info: all>
# This will scan the target enemy of all properties that are shown in the
# comparison windows. Unless the enemy has a permanent hide tag, all of the
# data becomes available.
# 顯示敵人所有資訊,設置隱藏的能力除外。
#
# <scan info: parameters>
# This will scan the target enemy's parameters and reveal them to the player
# unless the enemy has a permanent hide tag.
# 顯示基本能力值。
#
# <scan info: elements>
# This will scan the target enemy's elemental resistances and reveal them to
# the player unless the enemy has a permanent hide tag.
# 顯示特徵。
#
# <scan info: states>
# This will scan the target enemy's state resistances and reveal them to the
# player unless the enemy has a permanent hide tag.
# 顯示獲得的異常、強弱化狀態。
#
# <scan element: x>
# <scan element: x, x>
# This will scan the target enemy's elemental resistance for element x. Insert
# multiple of these tags to scan more elements. If you have the automatic scan
# element setting on in the module, all skills and items will automatically
# scan whatever element the skill or item deals damage with innately.
#
# <scan state: x>
# <scan state: x, x>
# This will scan the target enemy's state resistance for element x. Insert
# multiple of these tags to scan more states. If you have the automatic scan
# state setting on in the module, all skills and items will automatically
# scan whatever state the skill or item inflicts innately.
#
# -----------------------------------------------------------------------------
# Item Notetags - These notetags go in the item notebox in the database.
# 使用道具來顯示敵人資訊(道具備註欄)
# -----------------------------------------------------------------------------
# <scan info: all>
# This will scan the target enemy of all properties that are shown in the
# comparison windows. Unless the enemy has a permanent hide tag, all of the
# data becomes available.
#
# <scan info: parameters>
# This will scan the target enemy's parameters and reveal them to the player
# unless the enemy has a permanent hide tag.
#
# <scan info: elements>
# This will scan the target enemy's elemental resistances and reveal them to
# the player unless the enemy has a permanent hide tag.
#
# <scan info: states>
# This will scan the target enemy's state resistances and reveal them to the
# player unless the enemy has a permanent hide tag.
#
# <scan element: x>
# <scan element: x, x>
# This will scan the target enemy's elemental resistance for element x. Insert
# multiple of these tags to scan more elements. If you have the automatic scan
# element setting on in the module, all skills and items will automatically
# scan whatever element the skill or item deals damage with innately.
#
# <scan state: x>
# <scan state: x, x>
# This will scan the target enemy's state resistance for element x. Insert
# multiple of these tags to scan more states. If you have the automatic scan
# state setting on in the module, all skills and items will automatically
# scan whatever state the skill or item inflicts innately.
#
# -----------------------------------------------------------------------------
# Enemy Notetags - These notetags go in the enemies notebox in the database.
# 設置敵人的顯示資訊方式(敵人備註欄)
# -----------------------------------------------------------------------------
# <hide info: all>
# <show info: all>
# These notetags will set the enemy to either always hide all of their battle
# information or to always show all of their info. The tags will override
# each other if both are used simultaneously.
# <hide info: all> 隱藏所有資訊
# <show info: all> 顯示所有資訊
#
# <hide info: parameters>
# <show info: parameters>
# These notetags will set the enemy to either always hide their parameter
# information or to always show their parameter info. The tags will override
# each other if both are used simultaneously.
#
# <hide info: elements>
# <show info: elements>
# These notetags will set the enemy to either always hide their element
# information or to always show their element info. The tags will override
# each other if both are used simultaneously.
#
# <hide info: states>
# <show info: states>
# These notetags will set the enemy to either always hide their state
# information or to always show their state info. The tags will override
# each other if both are used simultaneously.
#
#==============================================================================
# ▼ 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.
#
# This script requires Yanfly Engine Ace - Ace Battle Engine v1.10+ and the
# script must be placed under Ace Battle Engine in the script listing.
#
#==============================================================================
module YEA
module ENEMY_INFO
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Info Window Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These are the general settings revolving around the info windows shown in
# battle such as the sound effect played, the button used to open up the
# menus, the page orders, and the info text.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
INFO_SFX = RPG::SE.new("Book2", 80, 150) # SFX played for Info Window.
# Button used to toggle the Info Window. Keep in mind that L and R are
# used for moving between pages so it's best to not use those.
# 切換敵人資訊顯示頁面的按鈕。
# (L和R用於切換種類頁面,因此最好不要使用它們。)
INFO_BUTTON = :SHIFT
# This sets the page order in which data is displayed for the player. The
# player can switch pages by pressing L or R.
# 設置敵人資訊顯示頁面的種類顯示順序,用L和R來切換。
PAGE_ORDER =[
:parameters,
:elements,
:states,
] # Do not remove this.
# If testplay is being used, reveal all battle information for non-hidden
# enemy information?
SHOW_DEBUG_ALL = true
# The follow adjusts the settings regarding the help window. If this
# setting is on, the the help info will be displayed.
SHOW_HELP_INFO = true
HELP_WINDOW_Y = 72 # Y location of the help window.
# This is the text displayed to let the player know how to activate and
# show the info windows.
HELP_INFO_SHOW = "\e}Press \eC[4]SHIFT\eC[0] to show target info."
# This is the text displayed to let the player know how to switch between
# pages for the info windows.
HELP_INFO_SWITCH = "\e}Press \eC[4]L\eC[0] or \eC[4]R\eC[0] to switch info."
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - General Page Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# The general page shows the stats of the battlers. The player can compare
# and contrast the stats of both battlers relative to each other. The
# settings here adjust the font size, the text displayed if parameters are
# hidden, and whether or not to show parameters by default?
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
PARAM_FONT_SIZE = 20 # Font size used for parameters.
HIDDEN_PARAM_TEXT = "???" # Text used if parameters are hidden.
# Show the parameters by default? If false, the enemy must be defeated once
# or scanned to show the those parameters.
# 設置為 false 時則需要擊破敵人一次才會顯示敵人資訊。
DEFAULT_SHOW_PARAMS = true
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Element Page Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# The elements page shows the elemental resistances of the battlers. The
# player can compare and contrast the resistances relative to each other.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
ELE_FONT_SIZE = 20 # Font size used for element resistances.
HIDDEN_ELE_TEXT = "???" # Text used if element resistances are hidden.
SHOWN_ELEMENTS = [3..14] # 會顯示出來的屬性ID。
ELEMENT_ICONS ={ # Contains element icon information.
# Element ID => 圖標ID,
3 => 7563, # 火
4 => 7566, # 水
5 => 7568, # 風
6 => 7567, # 地
7 => 7569, # 光
8 => 7570, # 闇
9 => 2, # 斬
10 => 20, # 打
11 => 4, # 突
12 => 11, # 爪
13 => 16, # 射
14 => 88, # 幻
} # Do not remove this.
# Show the elemental resistances by default? If false, a skill with the
# specific element must be used on the enemy to reveal the element data if
# the AUTO_SCAN_ELEMENT setting is set to true.
# 設置為 true 時,則需要使用該屬性技能才會顯示敵人該屬性的抗性數值。
# 例如:使用 火屬性 技能時敵人才會顯示 火屬性 的抗性數值。
DEFAULT_SHOW_ELEMENTS = false
# If this is set to true, then skills with elemental properties will
# automatically scan the specific elemental resistance of that enemy type
# when used against that enemy.
# 設置為 true 時,擁有該屬性技能時會自動顯示出敵人該屬性的抗性數值。
AUTO_SCAN_ELEMENT = true
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - States Page Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# The states page shows the state resistances of the battlers. The player
# can compare and contrast the resistances relative to each other.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
STATE_FONT_SIZE = 20 # Font size used for state resistances.
HIDDEN_STATE_TEXT = "???" # Text used if state resistances are hidden.
SHOWN_STATES = [2..29] # 會顯示出來的狀態ID,最多可以顯示8個。
# Show the state resistances by default? If false, a skill with the
# specific state must be used on the enemy to reveal the element data if
# the AUTO_SCAN_STATES setting is set to true.
# 設置為 true 時,則需要使用擁有附加該狀態的技能時敵人才會顯示該狀態的抗性數值。
# 例如:使用有附加狀態 睡眠 技能時,敵人才會顯示 睡眠 狀態的抗性數值。
DEFAULT_SHOW_STATES = false
# If this is set to true, then skills with state applying properties will
# automatically scan the specific state resistance of that enemy type
# when used against that enemy.
# 設置為 true 時,擁有附加該狀態的技能時會自動顯示出敵人該狀態的抗性數值。
AUTO_SCAN_STATES = true
end # ENEMY_INFO
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.
#==============================================================================
if $imported["YEA-BattleEngine"]
module YEA
module ENEMY_INFO
module_function
#--------------------------------------------------------------------------
# convert_integer_array
#--------------------------------------------------------------------------
def convert_integer_array(array)
result = []
array.each { |i|
case i
when Range; result |= i.to_a
when Integer; result |=
end }
return result
end
#--------------------------------------------------------------------------
# converted_contants
#--------------------------------------------------------------------------
SHOWN_ELEMENTS = convert_integer_array(SHOWN_ELEMENTS)
SHOWN_STATES = convert_integer_array(SHOWN_STATES)
end # ENEMY_INFO
module REGEXP
module ENEMY
HIDE_INFO = /<(?:HIDE_INFO|hide info):[ ](.*)>/i
SHOW_INFO = /<(?:SHOW_INFO|show info):[ ](.*)>/i
end # ENEMY
module USABLEITEM
SCAN_INFO = /<(?:SCAN_INFO|scan info):[ ](.*)>/i
SCAN_ELE = /<(?:SCAN_ELE|scan ele|scan element):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
SCAN_STATE = /<(?:SCAN_STATE|scan state):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
end # USABLEITEM
end # REGEXP
end # YEA
#==============================================================================
# ■ Icon
#==============================================================================
module Icon
#--------------------------------------------------------------------------
# self.element
#--------------------------------------------------------------------------
def self.element(id)
return 0 unless YEA::ENEMY_INFO::ELEMENT_ICONS.include?(id)
return YEA::ENEMY_INFO::ELEMENT_ICONS[id]
end
end # Icon
#==============================================================================
# ■ 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_etin load_database; end
def self.load_database
load_database_etin
load_notetags_etin
end
#--------------------------------------------------------------------------
# new method: load_notetags_etin
#--------------------------------------------------------------------------
def self.load_notetags_etin
groups = [$data_enemies, $data_skills, $data_items]
for group in groups
for obj in group
next if obj.nil?
obj.load_notetags_etin
end
end
end
end # DataManager
#==============================================================================
# ■ RPG::Enemy
#==============================================================================
class RPG::Enemy < RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :hide_info
attr_accessor :show_info
#--------------------------------------------------------------------------
# common cache: load_notetags_etin
#--------------------------------------------------------------------------
def load_notetags_etin
@hide_info = []
@show_info = []
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::ENEMY::HIDE_INFO
case $1.upcase
when "PARAM", "PARAMETER", "PARAMETERS"
@hide_info.push(:param)
@show_info.delete(:param)
when "ELE", "ELEMENT", "ELEMENTS"
@hide_info.push(:ele)
@show_info.delete(:ele)
when "STATE", "STATES"
@hide_info.push(:state)
@show_info.delete(:state)
when "ALL"
@hide_info.push(:all)
@show_info.delete(:all)
end
#---
when YEA::REGEXP::ENEMY::SHOW_INFO
case $1.upcase
when "PARAM", "PARAMETER", "PARAMETERS"
@show_info.push(:param)
@hide_info.delete(:param)
when "ELE", "ELEMENT", "ELEMENTS"
@show_info.push(:ele)
@hide_info.delete(:ele)
when "STATE", "STATES"
@show_info.push(:state)
@hide_info.delete(:state)
when "ALL"
@show_info.push(:all)
@hide_info.delete(:all)
end
#---
end
} # self.note.split
#---
end
end # RPG::Enemy
#==============================================================================
# ■ RPG::UsableItem
#==============================================================================
class RPG::UsableItem < RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :scan_info
attr_accessor :scan_ele
attr_accessor :scan_state
#--------------------------------------------------------------------------
# common cache: load_notetags_etin
#--------------------------------------------------------------------------
def load_notetags_etin
@scan_info = []
@scan_ele = []
@scan_state = []
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::USABLEITEM::SCAN_INFO
case $1.upcase
when "PARAM", "PARAMETER", "PARAMETERS"
@scan_info.push(:param)
when "ELE", "ELEMENT", "ELEMENTS"
@scan_info.push(:ele)
when "STATE", "STATES"
@scan_info.push(:state)
when "ALL"
@scan_info.push(:all)
end
#---
when YEA::REGEXP::USABLEITEM::SCAN_ELE
$1.scan(/\d+/).each { |num|
@scan_ele.push(num.to_i) if num.to_i > 0 }
when YEA::REGEXP::USABLEITEM::SCAN_STATE
$1.scan(/\d+/).each { |num|
@scan_state.push(num.to_i) if num.to_i > 0 }
#---
end
} # self.note.split
#---
@scan_ele.push(self.damage.element_id) if YEA::ENEMY_INFO::AUTO_SCAN_ELEMENT
if YEA::ENEMY_INFO::AUTO_SCAN_STATES
for effect in @effects
next unless effect.code == 21
next unless effect.data_id > 0
@scan_state.push(effect.data_id)
end
end
end
end # RPG::UsableItem
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# alias method: initialize
#--------------------------------------------------------------------------
alias game_system_initialize_eti initialize
def initialize
game_system_initialize_eti
initialize_enemy_info_data
end
#--------------------------------------------------------------------------
# new method: initialize_enemy_info_data
#--------------------------------------------------------------------------
def initialize_enemy_info_data
@param_enemies = [] if @param_enemies.nil?
@ele_enemies = {} if @ele_enemies.nil?
@state_enemies = {} if @state_enemies.nil?
end
#--------------------------------------------------------------------------
# new method: info_param_enemies
#--------------------------------------------------------------------------
def info_param_enemies
initialize_enemy_info_data if @param_enemies.nil?
return @param_enemies
end
#--------------------------------------------------------------------------
# new method: add_info_param_enemies
#--------------------------------------------------------------------------
def add_info_param_enemies(id)
initialize_enemy_info_data if @param_enemies.nil?
@param_enemies.push(id) unless @param_enemies.include?(id)
end
#--------------------------------------------------------------------------
# new method: info_ele_enemies
#--------------------------------------------------------------------------
def info_ele_enemies(ele_id)
initialize_enemy_info_data if @ele_enemies.nil?
@ele_enemies[ele_id] = [] if @ele_enemies[ele_id].nil?
return @ele_enemies[ele_id]
end
#--------------------------------------------------------------------------
# new method: add_info_ele_enemies
#--------------------------------------------------------------------------
def add_info_ele_enemies(ele_id, id)
initialize_enemy_info_data if @ele_enemies.nil?
@ele_enemies[ele_id] = [] if @ele_enemies[ele_id].nil?
@ele_enemies[ele_id].push(id) unless @ele_enemies[ele_id].include?(id)
end
#--------------------------------------------------------------------------
# new method: info_state_enemies
#--------------------------------------------------------------------------
def info_state_enemies(state_id)
initialize_enemy_info_data if @state_enemies.nil?
@state_enemies[state_id] = [] if @state_enemies[state_id].nil?
return @state_enemies[state_id]
end
#--------------------------------------------------------------------------
# new method: add_info_state_enemies
#--------------------------------------------------------------------------
def add_info_state_enemies(state_id, id)
initialize_enemy_info_data if @state_enemies.nil?
@state_enemies[state_id] = [] if @state_enemies[state_id].nil?
@state_enemies[state_id].push(id) if !@state_enemies[state_id].include?(id)
end
end # Game_System
#==============================================================================
# ■ Game_BattlerBase
#==============================================================================
class Game_BattlerBase
#--------------------------------------------------------------------------
# new method: show_info_param?
#--------------------------------------------------------------------------
def show_info_param?
return true if YEA::ENEMY_INFO::SHOW_DEBUG_ALL && ($TEST || $BTEST)
return YEA::ENEMY_INFO::DEFAULT_SHOW_PARAMS
end
#--------------------------------------------------------------------------
# new method: show_info_element?
#--------------------------------------------------------------------------
def show_info_element?(ele_id)
return true if YEA::ENEMY_INFO::SHOW_DEBUG_ALL && ($TEST || $BTEST)
return YEA::ENEMY_INFO::DEFAULT_SHOW_ELEMENTS
end
#--------------------------------------------------------------------------
# new method: show_info_state?
#--------------------------------------------------------------------------
def show_info_state?(state_id)
return true if YEA::ENEMY_INFO::SHOW_DEBUG_ALL && ($TEST || $BTEST)
return YEA::ENEMY_INFO::DEFAULT_SHOW_STATES
end
end # Game_BattlerBase
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# alias method: die
#--------------------------------------------------------------------------
alias game_battler_die_eti die
def die
game_battler_die_eti
return if actor?
$game_system.add_info_param_enemies(@enemy_id)
end
#--------------------------------------------------------------------------
# alias method: item_user_effect
#--------------------------------------------------------------------------
alias game_battler_item_user_effect_eti item_user_effect
def item_user_effect(user, item)
game_battler_item_user_effect_eti(user, item)
scan_enemy_info_effect(user, item)
end
#--------------------------------------------------------------------------
# new method: scan_enemy_info_effect
#--------------------------------------------------------------------------
def scan_enemy_info_effect(user, item)
return if self.actor?
return unless user.actor?
#---
for info in item.scan_info
case info
when :all
$game_system.add_info_param_enemies(@enemy_id)
for i in 0...$data_system.elements.size
$game_system.add_info_ele_enemies(i, @enemy_id)
end
for i in 0...$data_states.size
$game_system.add_info_state_enemies(i, @enemy_id)
end
when :param
$game_system.add_info_param_enemies(@enemy_id)
when :ele
for i in 0...$data_system.elements.size
$game_system.add_info_ele_enemies(i, @enemy_id)
end
when :state
for i in 0...$data_states.size
$game_system.add_info_state_enemies(i, @enemy_id)
end
end
end
#---
for ele_id in item.scan_ele
$game_system.add_info_ele_enemies(ele_id, @enemy_id)
end
for state_id in item.scan_state
$game_system.add_info_state_enemies(state_id, @enemy_id)
end
end
end # Game_Battler
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# new method: show_info_param?
#--------------------------------------------------------------------------
def show_info_param?
return true
end
#--------------------------------------------------------------------------
# new method: show_info_element?
#--------------------------------------------------------------------------
def show_info_element?(ele_id)
return true
end
#--------------------------------------------------------------------------
# new method: show_info_state?
#--------------------------------------------------------------------------
def show_info_state?(state_id)
return true
end
end # Game_Actor
#==============================================================================
# ■ Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# new method: show_info_param?
#--------------------------------------------------------------------------
def show_info_param?
return false if enemy.hide_info.include?(:param)
return false if enemy.hide_info.include?(:all)
return true if enemy.show_info.include?(:param)
return true if enemy.show_info.include?(:all)
return true if $game_system.info_param_enemies.include?(@enemy_id)
return super
end
#--------------------------------------------------------------------------
# new method: show_info_element?
#--------------------------------------------------------------------------
def show_info_element?(ele_id)
return false if enemy.hide_info.include?(:ele)
return false if enemy.hide_info.include?(:all)
return true if enemy.show_info.include?(:ele)
return true if enemy.show_info.include?(:all)
return true if $game_system.info_ele_enemies(ele_id).include?(@enemy_id)
return super(ele_id)
end
#--------------------------------------------------------------------------
# new method: show_info_state?
#--------------------------------------------------------------------------
def show_info_state?(state_id)
return false if enemy.hide_info.include?(:state)
return false if enemy.hide_info.include?(:all)
return true if enemy.show_info.include?(:state)
return true if enemy.show_info.include?(:all)
return true if $game_system.info_state_enemies(state_id).include?(@enemy_id)
return super(state_id)
end
end # Game_Enemy
#==============================================================================
# ■ Window_Comparison
#==============================================================================
class Window_Comparison < Window_Base
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize(type)
dx = type == :actor ? 0 : Graphics.width / 2
dh = fitting_height(4)
super(dx, Graphics.height - dh, Graphics.width / 2, dh)
@button = YEA::ENEMY_INFO::INFO_BUTTON
@battler = nil
@type = type
@page = 0
hide
end
#--------------------------------------------------------------------------
# update
#--------------------------------------------------------------------------
def update
super
return unless @type == :enemy
process_enemy_window_input
return unless self.visible
reveal(SceneManager.scene.enemy_window.enemy)
end
#--------------------------------------------------------------------------
# process_enemy_window_input
#--------------------------------------------------------------------------
def process_enemy_window_input
return unless SceneManager.scene_is?(Scene_Battle)
return unless SceneManager.scene.enemy_window.active
return if SceneManager.scene.enemy_window.select_all?
SceneManager.scene.toggle_enemy_info if Input.trigger?(@button)
return unless self.visible
SceneManager.scene.enemy_info_page_up if Input.trigger?(:L)
SceneManager.scene.enemy_info_page_down if Input.trigger?(:R)
end
#--------------------------------------------------------------------------
# reveal
#--------------------------------------------------------------------------
def reveal(battler)
return if @battler == battler
@battler = battler
refresh
show
end
#--------------------------------------------------------------------------
# clear
#--------------------------------------------------------------------------
def clear
@battler = nil
@page = 0
hide
end
#--------------------------------------------------------------------------
# actor
#--------------------------------------------------------------------------
def actor; return BattleManager.actor; end
#--------------------------------------------------------------------------
# enemy
#--------------------------------------------------------------------------
def enemy; return SceneManager.scene.enemy_window.enemy; end
#--------------------------------------------------------------------------
# page_up
#--------------------------------------------------------------------------
def page_up
@page = @page == 0 ? YEA::ENEMY_INFO::PAGE_ORDER.size - 1 : @page - 1
refresh
end
#--------------------------------------------------------------------------
# page_down
#--------------------------------------------------------------------------
def page_down
@page = @page == YEA::ENEMY_INFO::PAGE_ORDER.size - 1 ? 0 : @page + 1
refresh
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
reset_font_settings
draw_page(@page)
end
#--------------------------------------------------------------------------
# draw_page
#--------------------------------------------------------------------------
def draw_page(page_id)
return if @battler.nil?
case YEA::ENEMY_INFO::PAGE_ORDER[page_id]
when :parameters
@battler = actor if @type == :actor
draw_parameters
when :elements
@battler = enemy if @type == :actor
draw_parameters if @type == :actor
draw_elements if @type == :enemy
when :states
@battler = enemy if @type == :actor
draw_parameters if @type == :actor
draw_states if @type == :enemy
end
end
#--------------------------------------------------------------------------
# draw_parameters
#--------------------------------------------------------------------------
def draw_parameters
draw_text(4, 0, contents.width, line_height, @battler.name)
dx = contents.width / 2
contents.font.size = YEA::ENEMY_INFO::PARAM_FONT_SIZE
draw_param(2, 0, line_height*1); draw_param(3, dx, line_height*1)
draw_param(4, 0, line_height*2); draw_param(5, dx, line_height*2)
draw_param(6, 0, line_height*3); draw_param(7, dx, line_height*3)
end
#--------------------------------------------------------------------------
# draw_param
#--------------------------------------------------------------------------
def draw_param(param_id, dx, dy)
dw = contents.width / 2
colour = Color.new(0, 0, 0, translucent_alpha/2)
rect = Rect.new(dx+1, dy+1, dw - 2, line_height - 2)
contents.fill_rect(rect, colour)
#---
change_color(system_color)
draw_text(dx+4, dy, dw-8, line_height, Vocab::param(param_id))
change_color(normal_color)
if @battler.show_info_param?
text = @battler.param(param_id).group
else
text = YEA::ENEMY_INFO::HIDDEN_PARAM_TEXT
end
draw_text(dx+4, dy, dw-8, line_height, text, 2)
end
#--------------------------------------------------------------------------
# draw_elements
#--------------------------------------------------------------------------
def draw_elements
dx = 0; dy = 0
contents.font.size = YEA::ENEMY_INFO::ELE_FONT_SIZE
for ele_id in YEA::ENEMY_INFO::SHOWN_ELEMENTS
draw_element_info(ele_id, dx, dy)
dx = dx == 0 ? contents.width / 2 : 0
dy += dx == 0 ? line_height : 0
end
end
#--------------------------------------------------------------------------
# draw_element_info
#--------------------------------------------------------------------------
def draw_element_info(ele_id, dx, dy)
dw = contents.width / 2
colour = Color.new(0, 0, 0, translucent_alpha/2)
rect = Rect.new(dx+1, dy+1, dw - 2, line_height - 2)
contents.fill_rect(rect, colour)
#---
draw_icon(Icon.element(ele_id), dx, dy)
change_color(system_color)
draw_text(dx+24, dy, dw-24, line_height, $data_system.elements[ele_id])
change_color(normal_color)
if @battler.show_info_element?(ele_id)
text = sprintf("%d%%", (@battler.element_rate(ele_id) * 100).to_i)
else
text = YEA::ENEMY_INFO::HIDDEN_ELE_TEXT
end
draw_text(dx+4, dy, dw-8, line_height, text, 2)
end
#--------------------------------------------------------------------------
# draw_states
#--------------------------------------------------------------------------
def draw_states
dx = 0; dy = 0
contents.font.size = YEA::ENEMY_INFO::ELE_FONT_SIZE
for state_id in YEA::ENEMY_INFO::SHOWN_STATES
draw_state_info(state_id, dx, dy)
dx = dx == 0 ? contents.width / 2 : 0
dy += dx == 0 ? line_height : 0
end
end
#--------------------------------------------------------------------------
# draw_state_info
#--------------------------------------------------------------------------
def draw_state_info(state_id, dx, dy)
dw = contents.width / 2
colour = Color.new(0, 0, 0, translucent_alpha/2)
rect = Rect.new(dx+1, dy+1, dw - 2, line_height - 2)
contents.fill_rect(rect, colour)
#---
draw_icon($data_states[state_id].icon_index, dx, dy)
change_color(system_color)
draw_text(dx+24, dy, dw-24, line_height, $data_states[state_id].name)
change_color(normal_color)
if @battler.show_info_state?(state_id)
text = sprintf("%d%%", (@battler.state_rate(state_id) * 100).to_i)
else
text = YEA::ENEMY_INFO::HIDDEN_STATE_TEXT
end
draw_text(dx+4, dy, dw-8, line_height, text, 2)
end
end # Window_Comparison
#==============================================================================
# ■ Window_ComparisonHelp
#==============================================================================
class Window_ComparisonHelp < Window_Base
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize(info_window)
dy = YEA::ENEMY_INFO::HELP_WINDOW_Y
super(-12, dy, Graphics.width + 24, fitting_height(1))
@info_window = info_window
self.opacity = 0
self.z = 300
@text = ""
hide
end
#--------------------------------------------------------------------------
# update
#--------------------------------------------------------------------------
def update
super
return unless YEA::ENEMY_INFO::SHOW_HELP_INFO
update_visibility
update_text
end
#--------------------------------------------------------------------------
# update_visibility
#--------------------------------------------------------------------------
def update_visibility
return unless SceneManager.scene_is?(Scene_Battle)
return if SceneManager.scene.enemy_window.select_all?
self.visible = SceneManager.scene.enemy_window.active
end
#--------------------------------------------------------------------------
# update_text
#--------------------------------------------------------------------------
def update_text
return unless self.visible
if @info_window.visible
text = YEA::ENEMY_INFO::HELP_INFO_SWITCH
else
text = YEA::ENEMY_INFO::HELP_INFO_SHOW
end
return if @text == text
@text = text
refresh
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
reset_font_settings
draw_background
draw_text_ex(4, 0, @text)
end
#--------------------------------------------------------------------------
# draw_background
#--------------------------------------------------------------------------
def draw_background
temp_rect = Rect.new(0, 0, contents.width / 2, contents.height)
colour1 = Color.new(0, 0, 0, 192)
colour2 = Color.new(0, 0, 0, 0)
contents.gradient_fill_rect(temp_rect, colour1, colour2)
end
end # Window_ComparisonHelp
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# alias method: create_all_windows
#--------------------------------------------------------------------------
alias scene_battle_create_all_windows_eti create_all_windows
def create_all_windows
scene_battle_create_all_windows_eti
create_comparison_windows
end
#--------------------------------------------------------------------------
# alias method: create_comparison_windows
#--------------------------------------------------------------------------
def create_comparison_windows
@actor_info_window = Window_Comparison.new(:actor)
@enemy_info_window = Window_Comparison.new(:enemy)
@info_help_window = Window_ComparisonHelp.new(@enemy_info_window)
end
#--------------------------------------------------------------------------
# new method: toggle_enemy_info
#--------------------------------------------------------------------------
def toggle_enemy_info
YEA::ENEMY_INFO::INFO_SFX.play
if @enemy_info_window.visible
hide_comparison_windows
else
show_comparison_windows
end
end
#--------------------------------------------------------------------------
# new method: enemy_info_page_up
#--------------------------------------------------------------------------
def enemy_info_page_up
YEA::ENEMY_INFO::INFO_SFX.play
@actor_info_window.page_up
@enemy_info_window.page_up
end
#--------------------------------------------------------------------------
# new method: enemy_info_page_down
#--------------------------------------------------------------------------
def enemy_info_page_down
YEA::ENEMY_INFO::INFO_SFX.play
@actor_info_window.page_down
@enemy_info_window.page_down
end
#--------------------------------------------------------------------------
# alias method: on_enemy_ok
#--------------------------------------------------------------------------
alias scene_battle_on_enemy_ok_eti on_enemy_ok
def on_enemy_ok
hide_comparison_windows
scene_battle_on_enemy_ok_eti
end
#--------------------------------------------------------------------------
# alias method: on_enemy_cancel
#--------------------------------------------------------------------------
alias scene_battle_on_enemy_cancel_eti on_enemy_cancel
def on_enemy_cancel
hide_comparison_windows
scene_battle_on_enemy_cancel_eti
end
#--------------------------------------------------------------------------
# new method: show_comparison_windows
#--------------------------------------------------------------------------
def show_comparison_windows
@actor_info_window.reveal(BattleManager.actor)
@enemy_info_window.reveal(@enemy_window.enemy)
@info_viewport.visible = false
@skill_window.y = Graphics.height * 2
@item_window.y = Graphics.height * 2
@status_aid_window.y = Graphics.height * 2
end
#--------------------------------------------------------------------------
# new method: hide_comparison_windows
#--------------------------------------------------------------------------
def hide_comparison_windows
@actor_info_window.clear
@enemy_info_window.clear
@info_viewport.visible = true
@skill_window.y = Graphics.height - @skill_window.height
@item_window.y = Graphics.height - @item_window.height
@status_aid_window.y = Graphics.height - @status_aid_window.height
end
end # Scene_Battle
end # $imported["YEA-BattleEngine"]
#==============================================================================
#
# ▼ End of File
#
#==============================================================================[/pre]
雖然自己簡單翻譯了一下,但大致還是搞不太懂該寫入多少備註才會顯示?
所以敵人備註欄我只寫入:
<set level: 1>
<level random: 0>
<show info: all>
而探查的技能備註欄只寫入:
<scan info: all>
然而我一開始敵人等級是找到v1.01版本的,
這樣子設置會顯示等級,但探查敵人的資訊會顯示無作用...
於是我去Yanfly的網站找到v1.02版本的敵人等級,
但是覆蓋上去竟然報錯了
我實在是找不到原因...
也想詢問一下為何無法探查敵人資訊?
難道我備註欄輸入錯誤嗎? |
-
報錯內容
|