Project1
标题:
提供一个思路,可解决烦躁的数据库设置的一小部分。
[打印本页]
作者:
1243852
时间:
2012-9-25 19:53
标题:
提供一个思路,可解决烦躁的数据库设置的一小部分。
、。之所以只提供思路,是因为这套思路定然需要脚本才能完成,而我根本不会脚本。。。
思路如下:
我发现大多数人,都很有兴趣去做地图、剧情、事件、系统,但却对制作数据库感到烦躁,我也是其中一个。繁琐的武器设置、技能设置、敌人设置,计算伤害,真的相当让人感觉头大,因为你无法估计,当玩家得到XX武器的时候,他应该是个什么样的等级,遇到什么样的怪。。。怪遇小了,游戏变简单,怪遇大了,游戏太难。
我所提供的思路,可以解决敌人设置的问题。
就是,设置一种敌人成长的系统。他会随着玩家的等级、攻击力、防御力、HP、MP等等数据,进行一个比例性的生长。也就是说,玩家有多厉害,怪物就会在作者预先设置的比例上面,长到多厉害。那么我们就不用考虑怪物的数据了,只需要考虑他的种类就行了。
当然,此系统脚本,可以设置一些特殊类敌人,诸如使用when return 这种语句来定义,某几个敌人编号。这几个编号,不会受到成长比例的影响,而这几个编号的作用,主要就是用于制作BOSS。
作者:
IamI
时间:
2012-9-25 20:04
已采集。考虑嵌入中
作者:
yagami
时间:
2012-9-25 20:11
我也这么偷懒的设定的 只要个怪物加个新属性 LV ,数据库里的数据都是成长值 怪物实际能力是成长值*LV 脚本改动很简单的 省不少时间
作者:
Password
时间:
2012-9-25 20:14
看到这个我还是老老实实去捣鼓数据库吧
一碰脚本就晕死……
作者:
pigsss
时间:
2012-9-25 20:26
老早就有了 ……
不过有想法不错
作者:
yagami
时间:
2012-9-25 20:29
module RPG
class Enemy
def lv
return 1 if @name.split(/@/)[1] == nil
return @name.split(/@/)[1].to_i
end
def name
return @name.split(/@/)[0]
end
end
end
复制代码
#==============================================================================
# ■ Game_Enemy
#------------------------------------------------------------------------------
# 处理敌人的类。本类在 Game_Troop 类 ($game_troop) 的
# 内部使用。
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ● 初始化对像
# troop_id : 循环 ID
# member_index : 循环成员的索引
#--------------------------------------------------------------------------
def initialize(troop_id, member_index)
super()
@troop_id = troop_id
@member_index = member_index
troop = $data_troops[@troop_id]
@enemy_id = troop.members[@member_index].enemy_id
enemy = $data_enemies[@enemy_id]
@battler_name = enemy.battler_name
@battler_hue = enemy.battler_hue
@hp = maxhp
@sp = maxsp
@hidden = troop.members[@member_index].hidden
@immortal = troop.members[@member_index].immortal
end
#--------------------------------------------------------------------------
# ● 获取敌人 ID
#--------------------------------------------------------------------------
def id
return @enemy_id
end
#--------------------------------------------------------------------------
# ● 获取索引
#--------------------------------------------------------------------------
def index
return @member_index
end
#--------------------------------------------------------------------------
# ● 获取名称
#--------------------------------------------------------------------------
def name
return $data_enemies[@enemy_id].name
end
#--------------------------------------------------------------------------
# ● 获取基本 MaxHP
#--------------------------------------------------------------------------
def base_maxhp
return $data_enemies[@enemy_id].maxhp * $data_enemies[@enemy_id].lv
end
#--------------------------------------------------------------------------
# ● 获取基本 MaxSP
#--------------------------------------------------------------------------
def base_maxsp
return $data_enemies[@enemy_id].maxsp * $data_enemies[@enemy_id].lv
end
#--------------------------------------------------------------------------
# ● 获取基本力量
#--------------------------------------------------------------------------
def base_str
return $data_enemies[@enemy_id].str * $data_enemies[@enemy_id].lv
end
#--------------------------------------------------------------------------
# ● 获取基本灵巧
#--------------------------------------------------------------------------
def base_dex
return $data_enemies[@enemy_id].dex * $data_enemies[@enemy_id].lv
end
#--------------------------------------------------------------------------
# ● 获取基本速度
#--------------------------------------------------------------------------
def base_agi
return $data_enemies[@enemy_id].agi * $data_enemies[@enemy_id].lv
end
#--------------------------------------------------------------------------
# ● 获取基本魔力
#--------------------------------------------------------------------------
def base_int
return $data_enemies[@enemy_id].int * $data_enemies[@enemy_id].lv
end
#--------------------------------------------------------------------------
# ● 获取基本攻击力
#--------------------------------------------------------------------------
def base_atk
return $data_enemies[@enemy_id].atk * $data_enemies[@enemy_id].lv
end
#--------------------------------------------------------------------------
# ● 获取基本物理防御
#--------------------------------------------------------------------------
def base_pdef
return $data_enemies[@enemy_id].pdef * $data_enemies[@enemy_id].lv
end
#--------------------------------------------------------------------------
# ● 获取基本魔法防御
#--------------------------------------------------------------------------
def base_mdef
return $data_enemies[@enemy_id].mdef * $data_enemies[@enemy_id].lv
end
#--------------------------------------------------------------------------
# ● 获取基本回避修正
#--------------------------------------------------------------------------
def base_eva
return $data_enemies[@enemy_id].eva
end
#--------------------------------------------------------------------------
# ● 普通攻击 获取攻击方动画 ID
#--------------------------------------------------------------------------
def animation1_id
return $data_enemies[@enemy_id].animation1_id
end
#--------------------------------------------------------------------------
# ● 普通攻击 获取对像方动画 ID
#--------------------------------------------------------------------------
def animation2_id
return $data_enemies[@enemy_id].animation2_id
end
#--------------------------------------------------------------------------
# ● 获取属性修正值
# element_id : 属性 ID
#--------------------------------------------------------------------------
def element_rate(element_id)
# 获取对应属性有效度的数值
table = [0,200,150,100,50,0,-100]
result = table[$data_enemies[@enemy_id].element_ranks[element_id]]
# 状态能防御本属性的情况下效果减半
for i in @states
if $data_states[i].guard_element_set.include?(element_id)
result /= 2
end
end
# 过程结束
return result
end
#--------------------------------------------------------------------------
# ● 获取属性有效度
#--------------------------------------------------------------------------
def state_ranks
return $data_enemies[@enemy_id].state_ranks
end
#--------------------------------------------------------------------------
# ● 属性防御判定
# state_id : 状态 ID
#--------------------------------------------------------------------------
def state_guard?(state_id)
return false
end
#--------------------------------------------------------------------------
# ● 获取普通攻击属性
#--------------------------------------------------------------------------
def element_set
return []
end
#--------------------------------------------------------------------------
# ● 获取普通攻击的状态变化 (+)
#--------------------------------------------------------------------------
def plus_state_set
return []
end
#--------------------------------------------------------------------------
# ● 获取普通攻击的状态变化 (-)
#--------------------------------------------------------------------------
def minus_state_set
return []
end
#--------------------------------------------------------------------------
# ● 获取行动
#--------------------------------------------------------------------------
def actions
return $data_enemies[@enemy_id].actions
end
#--------------------------------------------------------------------------
# ● 获取 EXP
#--------------------------------------------------------------------------
def exp
return $data_enemies[@enemy_id].exp
end
#--------------------------------------------------------------------------
# ● 获取金钱
#--------------------------------------------------------------------------
def gold
return $data_enemies[@enemy_id].gold
end
#--------------------------------------------------------------------------
# ● 获取物品 ID
#--------------------------------------------------------------------------
def item_id
return $data_enemies[@enemy_id].item_id
end
#--------------------------------------------------------------------------
# ● 获取武器 ID
#--------------------------------------------------------------------------
def weapon_id
return $data_enemies[@enemy_id].weapon_id
end
#--------------------------------------------------------------------------
# ● 获取防具 ID
#--------------------------------------------------------------------------
def armor_id
return $data_enemies[@enemy_id].armor_id
end
#--------------------------------------------------------------------------
# ● 获取宝物出现率
#--------------------------------------------------------------------------
def treasure_prob
return $data_enemies[@enemy_id].treasure_prob
end
#--------------------------------------------------------------------------
# ● 取得战斗画面 X 坐标
#--------------------------------------------------------------------------
def screen_x
return $data_troops[@troop_id].members[@member_index].x
end
#--------------------------------------------------------------------------
# ● 取得战斗画面 Y 坐标
#--------------------------------------------------------------------------
def screen_y
return $data_troops[@troop_id].members[@member_index].y
end
#--------------------------------------------------------------------------
# ● 取得战斗画面 Z 坐标
#--------------------------------------------------------------------------
def screen_z
return screen_y
end
#--------------------------------------------------------------------------
# ● 逃跑
#--------------------------------------------------------------------------
def escape
# 设置隐藏标志
@hidden = true
# 清除当前行动
self.current_action.clear
end
#--------------------------------------------------------------------------
# ● 变身
# enemy_id : 变身为的敌人 ID
#--------------------------------------------------------------------------
def transform(enemy_id)
# 更改敌人 ID
@enemy_id = enemy_id
# 更改战斗图形
@battler_name = $data_enemies[@enemy_id].battler_name
@battler_hue = $data_enemies[@enemy_id].battler_hue
# 再生成行动
make_action
end
#--------------------------------------------------------------------------
# ● 生成行动
#--------------------------------------------------------------------------
def make_action
# 清除当前行动
self.current_action.clear
# 无法行动的情况
unless self.movable?
# 过程结束
return
end
# 抽取现在有效的行动
available_actions = []
rating_max = 0
for action in self.actions
# 确认回合条件
n = $game_temp.battle_turn
a = action.condition_turn_a
b = action.condition_turn_b
if (b == 0 and n != a) or
(b > 0 and (n < 1 or n < a or n % b != a % b))
next
end
# 确认 HP 条件
if self.hp * 100.0 / self.maxhp > action.condition_hp
next
end
# 确认等级条件
if $game_party.max_level < action.condition_level
next
end
# 确认开关条件
switch_id = action.condition_switch_id
if switch_id > 0 and $game_switches[switch_id] == false
next
end
# 符合条件 : 添加本行动
available_actions.push(action)
if action.rating > rating_max
rating_max = action.rating
end
end
# 最大概率值作为 3 合计计算(0 除外)
ratings_total = 0
for action in available_actions
if action.rating > rating_max - 3
ratings_total += action.rating - (rating_max - 3)
end
end
# 概率合计不为 0 的情况下
if ratings_total > 0
# 生成随机数
value = rand(ratings_total)
# 设置对应生成随机数的当前行动
for action in available_actions
if action.rating > rating_max - 3
if value < action.rating - (rating_max - 3)
self.current_action.kind = action.kind
self.current_action.basic = action.basic
self.current_action.skill_id = action.skill_id
self.current_action.decide_random_target_for_enemy
return
else
value -= action.rating - (rating_max - 3)
end
end
end
end
end
end
复制代码
作者:
晴兰
时间:
2012-9-25 20:31
提示:
作者被禁止或删除 内容自动屏蔽
作者:
feizhaodan
时间:
2012-9-25 20:49
我会说我很喜欢搞弄数据库么?
你只需要一个大致的数字即可。不用考虑太高的,也不用考虑太低的。实际上我都是这么想,然后平衡一般都没问题。
作者:
布里蓝
时间:
2012-9-25 21:00
我一般是先考虑打到这个阶段主角有几级,然后设个几级,再慢慢测试
作者:
爱尔伯塔
时间:
2012-9-25 21:14
设置数据库确实让人头疼...
作者:
精灵使者
时间:
2012-9-25 23:31
精灵对于这种东西的测试在后期的剧情测试中进行的……
模拟真·正的玩家的每一分动作……发生的。
作者:
evermilk
时间:
2012-9-25 23:43
用心的话,你会发现数据库非常有趣
作者:
Tink
时间:
2012-9-25 23:45
唔 把数据库当玩具玩的撸过
话说 谁给写个VA版的脚本?←伸手可耻 当我没说……
作者:
yoyu1989
时间:
2012-9-25 23:58
48。敌人等级系统(来自Yanfly Engine Ace)
使用后可以使敌人也拥有等级,增加敌人能力值,具体成长值可以在脚本中设置。
适用游戏:角色扮演游戏且角色能力值比较高
[原创发布] 【VA】超级脚本整合+说明(有时间我会更新的
这些脚本我都一个个认真的看了~所以知道这个有~是VA的哦~还有商店的自动定义的那个脚本也很好用~
作者:
疯狂异形
时间:
2012-9-26 05:30
本帖最后由 疯狂异形 于 2012-9-25 21:31 编辑
我这边已经有EXCEL成品了,而且很平衡。
嗯……但是……
这是为Y君造的,所以不外传嗯
作者:
yoyu1989
时间:
2012-9-26 12:17
本帖最后由 yoyu1989 于 2012-9-26 12:29 编辑
yoyu1989 发表于 2012-9-25 23:58
48。敌人等级系统(来自Yanfly Engine Ace)
使用后可以使敌人也拥有等级,增加敌人能力值,具体成长值 ...
?????我这的那脚本是全英文的啊~我用谷歌翻译了看下,依然没肿么懂~不过上面有个注释我感觉可能是整个脚本的开关~你要不要???
我给你的也是英文的~用谷歌翻译依然没看懂~
那脚本就是那个整合里的~我看了下他的怪物设定什么也没有设~就自动用上了~
然后脚本的最上面有个好像是开关的东西~
好吧我对于脚本也只是给我就用那种的~改脚本我不会~
敌人等级~
#==============================================================================
#
# ▼ Yanfly Engine Ace - Enemy Levels v1.01
# -- Last Updated: 2012.01.24
# -- Level: Normal, Hard
# -- Requires: n/a
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YEA-EnemyLevels"] = true
#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 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.
#
# <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.
#
# <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.
#
# <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.
#
# <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
#
#==============================================================================
# ▼ 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 = 9999
# 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.
DEFAULT_LEVEL_TYPE = 2
# 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.
RANDOM_FLUCTUATION = 2
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - 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 => [:param, per%, +set],
0 => [:maxhp, 0.15, 10],
1 => [:maxmp, 0.10, 2],
2 => [ :atk, 0.05, 1],
3 => [ :def, 0.05, 1],
4 => [ :mat, 0.05, 1],
5 => [ :mdf, 0.05, 1],
6 => [ :agi, 0.05, 1],
7 => [ :luk, 0.05, 1],
8 => [ :gold, 0.15, 2],
9 => [ :exp, 0.05, 2],
} # 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 = true
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 = YEA::ENEMY_LEVEL::DEFAULT_GROWTH.clone
#---
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
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
#
#==============================================================================
复制代码
敌人成长~好像可以和等级配合用~
#==============================================================================
#
# ▼ Yanfly Engine Ace - Enemy Levels Add-On: Doppelganger v1.00
# -- Last Updated: 2012.01.23
# -- Level: Normal
# -- Requires: Yanfly Engine Ace - Enemy Levels v1.00+
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YEA-Doppelganger"] = true
#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.01.23 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script gives the ability to base an enemy's stats off of a class or, as
# the script title suggests, an actor as a doppelganger. Doppelgangers will
# have the option of copying an actor's name, naming it differently, copying
# their stats, and even going as far as copying their current skills.
#
#==============================================================================
# ▼ 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.
# -----------------------------------------------------------------------------
# <doppelganger battler: string>
# This will set the battler used for the current actor to the battler filename
# of string. If no battler is used, doppelgangers will use their default image.
# Doppelganger battlers will give priority to script called battlers, then
# actor doppelganger battlers, then class doppelganger battlers, then default
# enemy battlers.
#
# -----------------------------------------------------------------------------
# Class Notetags - These notetags go in the class notebox in the database.
# -----------------------------------------------------------------------------
# <doppelganger battler: string>
# This will set the battler used for the current class to the battler filename
# of string. If no battler is used, doppelgangers will use their default image.
# Doppelganger battlers will give priority to script called battlers, then
# actor doppelganger battlers, then class doppelganger battlers, then default
# enemy battlers.
#
# -----------------------------------------------------------------------------
# Enemy Notetags - These notetags go in the enemies notebox in the database.
# -----------------------------------------------------------------------------
# <class stats: x>
# This notetag will cause the enemy to take on the base stats of class x at
# that particular level. Note that this tag will only cause the enemy to take
# on the class's stats. Any traits or other custom features related to that
# class will not be factored in. This will take priority over the enemy's
# default stats but will not take priority over a doppelganger actor's stats.
#
# <doppelganger: x>
# This notetag will cause the enemy to take on the base stats and level of
# actor x. Any traits or other custom features related to that actor will not
# be factored in. This will take priority over the enemy's default stats and
# class stats.
#
# <doppelganger member: x>
# This notetag will cause the enemy to take on the base stats and level of the
# party member with index x. Like the doppelganger, any traits or other custom
# features related to that actor will not be factored in. This will take
# priority over the enemy's default stats and class stats. In the event that
# no such member exists in slot x, then the monster will actually not appear
# and not participate in battle. Remember, the first party member's index is 0.
#
# -----------------------------------------------------------------------------
# Script Calls - These commands are used with script calls.
# -----------------------------------------------------------------------------
# $game_actors[actor_id].doppelimage = string
# This will set the specified actor's doppelganger battler image to whatever
# string is as the filename. This can be done mid-game and whatever you set the
# new doppelganger battler image to be will override the actor doppelganger
# and class doppelganger battler images. Set this to nil to nullify it.
#
#==============================================================================
# ▼ 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 - Enemy Levels v1.00+. Place this
# script under Yanfly Engine Ace - Enemy Levels in the script listing.
#
#==============================================================================
module YEA
module DOPPELGANGER
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Doppelganger Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Adjust the settings here for doppelgangers. Doppelgangers can copy an
# actor's name, add on a prefix or suffix, and copy the actor's skills.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
COPY_NAME = true # Uses the actor's name for doppelgangers.
NAME_TEXT = "Fake %s" # Name appearance for doppelgangers.
COPY_SKILL = true # Uses the actor's skills for doppelgangers.
end # DOPPELGANGER
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-EnemyLevels"]
module YEA
module REGEXP
module BASEITEM
DOPPELIMAGE = /<(?:DOPPELGANGER_BATTLER|doppelganger battler):[ ](.*)>/i
end # BASEITEM
module ENEMY
CLASS_STATS = /<(?:CLASS_STATS|class stats):[ ](\d+)>/i
DOPPELGANGER = /<(?:DOPPELGANGER|doppelganger):[ ](\d+)>/i
DOPPELMEMBER = /<(?:DOPPELGANGER_MEMBER|doppelganger member):[ ](\d+)>/i
end # ENEMY
end # REGEXP
end # YEA
#==============================================================================
# ■ DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias load_database_doppel load_database; end
def self.load_database
load_database_doppel
load_notetags_doppel
end
#--------------------------------------------------------------------------
# new method: load_notetags_doppel
#--------------------------------------------------------------------------
def self.load_notetags_doppel
groups = [$data_actors, $data_classes, $data_enemies]
for group in groups
for obj in group
next if obj.nil?
obj.load_notetags_doppel
end
end
end
end # DataManager
#==============================================================================
# ■ RPG::BaseItem
#==============================================================================
class RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :doppelimage
#--------------------------------------------------------------------------
# common cache: load_notetags_doppel
#--------------------------------------------------------------------------
def load_notetags_doppel
@doppelimage = ""
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::BASEITEM::DOPPELIMAGE
@doppelimage = $1.to_s
end
} # self.note.split
#---
end
end # RPG::BaseItem
#==============================================================================
# ■ RPG::Enemy
#==============================================================================
class RPG::Enemy < RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :class_id
attr_accessor :doppelganger
attr_accessor :doppelmember
#--------------------------------------------------------------------------
# common cache: load_notetags_doppel
#--------------------------------------------------------------------------
def load_notetags_doppel
@class_id = 0
@doppelganger = 0
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::ENEMY::CLASS_STATS
@class_id = $1.to_i
when YEA::REGEXP::ENEMY::DOPPELGANGER
@doppelganger = $1.to_i
when YEA::REGEXP::ENEMY::DOPPELMEMBER
@doppelmember = $1.to_i
end
} # self.note.split
#---
end
#--------------------------------------------------------------------------
# new method: actions
#--------------------------------------------------------------------------
if YEA::DOPPELGANGER::COPY_SKILL
def actions
return @actions if doppelganger_actor.nil?
list = @actions.dup
action = RPG::Enemy::Action.new
action.skill_id = doppelganger_actor.attack_skill_id
list.push(action)
for skill in doppelganger_actor.skills
next unless doppelganger_actor.added_skill_types.include?(skill.stype_id)
action = RPG::Enemy::Action.new
action.skill_id = skill.id
list.push(action)
end
return list
end
end # YEA::DOPPELGANGER::COPY_SKILL
#--------------------------------------------------------------------------
# new method: doppelganger_actor
#--------------------------------------------------------------------------
def doppelganger_actor
return doppelmember_actor unless doppelmember_actor.nil?
return $game_actors[@doppelganger] if @doppelganger > 0
end
#--------------------------------------------------------------------------
# new method: doppelmember_actor
#--------------------------------------------------------------------------
def doppelmember_actor
return nil if @doppelmember.nil?
return $game_party.battle_members[@doppelmember]
end
end # RPG::Enemy
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :doppelimage
#--------------------------------------------------------------------------
# new method: doppelimage
#--------------------------------------------------------------------------
def doppelimage
return @doppelimage unless @doppelimage.nil?
return self.actor.doppelimage unless self.actor.doppelimage.nil?
return self.class.doppelimage unless self.class.doppelimage.nil?
return nil
end
end # Game_Actor
#==============================================================================
# ■ Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# alias method: level=
#--------------------------------------------------------------------------
alias game_enemy_level_equal_doppel level=
def level=(value)
return unless doppelganger.nil?
game_enemy_level_equal_doppel(value)
end
#--------------------------------------------------------------------------
# alias method: set_level_type
#--------------------------------------------------------------------------
alias game_enemy_set_level_type_doppel set_level_type
def set_level_type
return @level = doppelganger.level unless doppelganger.nil?
game_enemy_set_level_type_doppel
end
#--------------------------------------------------------------------------
# new method: class
#--------------------------------------------------------------------------
def class
return doppelganger.class unless doppelganger.nil?
return $data_classes[enemy.class_id]
end
#--------------------------------------------------------------------------
# new method: doppelganger
#--------------------------------------------------------------------------
def doppelganger
return doppelmember unless doppelmember.nil?
return $game_actors[enemy.doppelganger]
end
#--------------------------------------------------------------------------
# new method: doppelmember
#--------------------------------------------------------------------------
def doppelmember
return nil if enemy.doppelmember.nil?
return $game_party.battle_members[enemy.doppelmember]
end
#--------------------------------------------------------------------------
# alias method: param_base
#--------------------------------------------------------------------------
alias game_enemy_param_base_doppel param_base
def param_base(param_id)
return actor_base_stats(param_id) unless doppelganger.nil?
return class_base_stats(param_id) unless self.class.nil?
return game_enemy_param_base_doppel(param_id)
end
#--------------------------------------------------------------------------
# new method: actor_base_stats
#--------------------------------------------------------------------------
def actor_base_stats(param_id)
return game_enemy_param_base_doppel(param_id) if @level.nil?
return doppelganger.param_base(param_id) + doppelganger.param_plus(param_id)
end
#--------------------------------------------------------------------------
# new method: class_base_stats
#--------------------------------------------------------------------------
def class_base_stats(param_id)
return game_enemy_param_base_doppel(param_id) if @level.nil?
return self.class.params[param_id, @level] if @level <= 99
if $imported["YEA-AdjustLimits"]
return self.class.above_lv99_params(param_id, @level)
end
return game_enemy_param_base_doppel(param_id)
end
#--------------------------------------------------------------------------
# alias method: feature_objects
#--------------------------------------------------------------------------
alias game_enemy_feature_objects_doppel feature_objects
def feature_objects
result = game_enemy_feature_objects_doppel
result += [self.class] unless self.class.nil?
result += [doppelganger.actor] unless doppelganger.nil?
return result
end
#--------------------------------------------------------------------------
# alias method: name
#--------------------------------------------------------------------------
alias game_enemy_name_doppel name
def name
return doppelganger_name if copy_doppel_name?
return game_enemy_name_doppel
end
def doppelganger_name
fmt = YEA::DOPPELGANGER::NAME_TEXT
return sprintf(fmt, doppelganger.name)
end
#--------------------------------------------------------------------------
# new method: copy_doppel_name?
#--------------------------------------------------------------------------
def copy_doppel_name?
return false if doppelganger.nil?
return YEA::DOPPELGANGER::COPY_NAME
end
#--------------------------------------------------------------------------
# new method: change_doppelganger_battler
#--------------------------------------------------------------------------
def change_doppelganger_battler
return if doppelganger.nil?
return if doppelganger.doppelimage == ""
@battler_name = doppelganger.doppelimage
@battler_hue = 0
end
end # Game_Enemy
#==============================================================================
# ■ Game_Troop
#==============================================================================
class Game_Troop < Game_Unit
#--------------------------------------------------------------------------
# alias method: init_screen_tone
#--------------------------------------------------------------------------
alias game_troop_init_screen_tone_doppel init_screen_tone
def init_screen_tone
game_troop_init_screen_tone_doppel
check_doppelmember
change_doppelimage
end
#--------------------------------------------------------------------------
# new method: check_doppelmember
#--------------------------------------------------------------------------
def check_doppelmember
for member in @enemies
next if member.enemy.doppelmember.nil?
@enemies.delete(member) if member.doppelmember.nil?
end
end
#--------------------------------------------------------------------------
# new method: change_doppelimage
#--------------------------------------------------------------------------
def change_doppelimage
for member in @enemies
next if member.doppelganger.nil?
member.change_doppelganger_battler
end
end
end # Game_Troop
end # $imported["YEA-EnemyLevels"]
#==============================================================================
#
# ▼ End of File
#
#==============================================================================
复制代码
作者:
天使喝可乐
时间:
2012-9-26 20:28
怪物属性完全按玩家属性比例成长?那请问升级有什么意义?
作者:
harinlen
时间:
2012-9-26 20:36
表示私还是很享受数据库这种东西的,看着那么多的数字觉得很有规律啊~
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1