#------------------------------------------------------------------------------
#【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】
#------------------------------------------------------------------------------
=begin
===============================================================================
◆ Ψ 随机武器 Ψ ◆
===============================================================================
--> by 芯☆淡茹水
===============================================================================
随机武器,也叫武器属性随机设定,适合懒人。
-------------------------------------------------------------------------------
使用方法:1.复制脚本,插入到 main 前 数据库武器 ID 栏设置最大(999)
2.事件设置:增加武器(武器ID要 100 以上)
或 事件-脚本 输入:$game_party.gain_rand_weapon(n)
括号里的 n 为数量。
===============================================================================
简单介绍下:
-------------------------------------------------------------------------------
1. 该武器随机脚本占用 数据库-武器 武器ID 100 以上的ID。之所以不全部随机,因为
比如:玩家打败一BOSS后,想给他一件好点的武器,结果随机出来是一件垃圾武器,那
就有点囧了。所以武器ID 100 以下的,自己设定。
数据库的武器 ID 最好改到最大(999),以免太多出现重复武器。ID 100 以上不用
管,留空白,脚本会随机设定。
-------------------------------------------------------------------------------
2. 武器随机出来的属性值会随着队伍平均等级的增加而增加。
除攻击力是100%外(因为每把武器都有攻击力),其他的属性有 10% 的概率增加,
四项属性(力量,灵巧,速度,魔力)有 5% 的概率减少。各项属性值增加或减少
的分散度为 50% 。
-------------------------------------------------------------------------------
3. 武器的价格根据武器的属性值和有无 属性攻击 和 状态变化 来定。
最后根据武器“品质”对武器名进行颜色描绘,武器增加的属性项目越多,品质越高。
颜色随武器“品质”不同,依次为:白 -- 蓝 -- 黄 -- 绿 -- 紫
-------------------------------------------------------------------------------
4. 下面的 icon 图片名,武器名,动画ID,职业ID 可照格式自己添加和修改。武器
的 icon 图片名 要与 Graphics\Icons 文件夹下的文件名一致。
在下面添加icon 图片名时,越好的放在越后面。防止随机出一把名为“青龙偃月刀”
的极品武器,但是随机出来的 icon 图片 却是一把菜刀。
-------------------------------------------------------------------------------
5. 请配合随该脚本一起发放的工程使用。工程里有很多需要改的地方(大多数改的地方
是根据武器品质描绘武器颜色)。没有写成外挂脚本,直接在原脚本上改动。打【*】
的地方。
===============================================================================
=end
#------------------------------------------------------------------------------
#【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】
#------------------------------------------------------------------------------
# 锤 类武器 icon 图片名
ICON_NAME锤 = ["锤1","锤2","锤3","锤4","锤5","锤6","锤7","锤8","锤9",
"锤10","锤11","锤12","锤13","锤14","锤15"]
#------------------------------------------------------------------------------
# 剑 类武器 icon 图片名
ICON_NAME剑 = ["剑1","剑2","剑3","剑4","剑5","剑6","剑7","剑8",
"剑9","剑10","剑11","剑12","剑13","剑14","剑15"]
#------------------------------------------------------------------------------
# 枪 类武器 icon 图片名
ICON_NAME枪 = ["枪1","枪2","枪3","枪4","枪5","枪6","枪7","枪8",
"枪9","枪10","枪11","枪12","枪13","枪14","枪15"]
#------------------------------------------------------------------------------
# 扇 类武器 icon 图片名
ICON_NAME扇 = ["扇1","扇2","扇3","扇4","扇5","扇6","扇7","扇8",
"扇9","扇10","扇11","扇12","扇13","扇14","扇15"]
#------------------------------------------------------------------------------
# 爪 类武器 icon 图片名
ICON_NAME爪 = ["爪1","爪2","爪3","爪4","爪5","爪6","爪7","爪8",
"爪9","爪10","爪11","爪12","爪13","爪14","爪15"]
#------------------------------------------------------------------------------
#【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】
#------------------------------------------------------------------------------
# 武器名
WEAPON_NAME1 =
["桃木","青铜","精铁","镔铁","精钢","亮银","玉骨","秘银","乌金","玄铁","沉香",
"火焰","冰晶","炽焰","寒冰","寒风","古锭","灵蛇","烟雨","竹节","紫金","星光",
"羽灵","穿云","惊鸿","紫鲨","诸刃","炫丽","苍炎","吹雪","流星","月光","苍月",
"萱花","天狼","疾风","封魔","赤龙","闪电","追魂","胜宗","破甲","雪烈","凤鸣",
"怒龙","邪月","龙渊","伏龙","倚天","玄天","方天","震天","破天"]
#------------------------------------------------------------------------------
WEAPON_NAME2 =
["百炼","千锤","万斩","枯骨","凝神","超凡","炼狱","赤霄","五行","阴阳","太极",
"朱雀","玄武","白虎","青龙","乾坤","无极","天地","混沌"]
#------------------------------------------------------------------------------
#【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】
#------------------------------------------------------------------------------
# 锤 类武器攻击方的动画 ID 。
ANIMATION1_ID锤 = 0
# 锤 类武器对象方的动画 ID 。
ANIMATION2_ID锤 = 13
# 剑 类武器攻击方的动画 ID 。
ANIMATION1_ID剑 = 0
# 剑 类武器对象方的动画 ID 。
ANIMATION2_ID剑 = 7
# 枪 类武器攻击方的动画 ID 。
ANIMATION1_ID枪 = 0
# 枪 类武器对象方的动画 ID 。
ANIMATION2_ID枪 = 8
# 扇 类武器攻击方的动画 ID 。
ANIMATION1_ID扇 = 0
# 扇 类武器对象方的动画 ID 。
ANIMATION2_ID扇 = 14
# 爪 类武器攻击方的动画 ID 。
ANIMATION1_ID爪 = 0
# 爪 类武器对象方的动画 ID 。
ANIMATION2_ID爪 = 5
#------------------------------------------------------------------------------
#【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】
#------------------------------------------------------------------------------
# 能装备 锤 类武器的职业 ID
CLASS_锤 = [5,10]
#------------------------------------------------------------------------------
# 能装备 剑 类武器的职业 ID
CLASS_剑 = [3,8]
#------------------------------------------------------------------------------
# 能装备 枪 类武器的职业 ID
CLASS_枪 = [1,6]
#------------------------------------------------------------------------------
# 能装备 扇 类武器的职业 ID
CLASS_扇 = [4,9]
#------------------------------------------------------------------------------
# 能装备 爪 类武器的职业 ID
CLASS_爪 = [2,7]
#------------------------------------------------------------------------------
#【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】
#------------------------------------------------------------------------------
class Game_Party
def gain_rand_weapon(n)
size = $data_weapons.size
# 随机武器 ID (从100开始)
id = rand (size - 100) + 100
# 如果已有随机后的武器,不再随机,直接添加。
if @weapons.include?(id)
@weapons[id] = [[weapon_number(id) + n, 0].max, 99].min
else
# 计算平均等级
level = 0
for i in 0...$game_party.actors.size
level += $game_party.actors[i].level
end
level /= $game_party.actors.size
weapon = $data_weapons[id]
#随机攻击力 数值分散度:+- 50%
weapon.atk = level * 2 + 10 + (level * 2 + 10) * (50 - rand (100)) / 100
# 随机物防,魔防
a = rand (100)
if a < 5
weapon.pdef = level * a / 2 + (level * a / 2) * (50 - rand (100)) / 100
else
weapon.pdef = 0
end
a = rand (100)
if a < 5
weapon.mdef = level * a / 2 + (level * a / 2) * (50 - rand (100)) / 100
else
weapon.mdef = 0
end
#随机四项属性增加值
a = rand (100)
if a < 15
weapon.str_plus = level * a / 4 + (level * a / 4) * (50 - rand (100)) / 100
elsif a >= 15 and a < 20
weapon.str_plus = -(level * a / 10)
else
weapon.str_plus = 0
end
a = rand (100)
if a < 15
weapon.dex_plus = level * a / 4 + (level * a / 4) * (50 - rand (100)) / 100
elsif a >= 15 and a < 20
weapon.dex_plus = -(level * a / 10)
else
weapon.dex_plus = 0
end
a = rand (100)
if a < 15
weapon.agi_plus = level * a / 4 + (level * a / 4) * (50 - rand (100)) / 100
elsif a >= 15 and a < 20
weapon.agi_plus = -(level * a / 10)
else
weapon.agi_plus = 0
end
a = rand (100)
if a < 15
weapon.int_plus = level * a / 4 + (level * a / 4) * (50 - rand (100)) / 100
elsif a >= 15 and a < 20
weapon.int_plus = -(level * a / 10)
else
weapon.int_plus = 0
end
#随机属性攻击
if rand (100) < 10
size = $data_system.elements.size
a = rand (size)
if a != 0
weapon.element_set.push(a)
end
end
#随机附加状态和解除状态
a = rand (100)
size = $data_states.size
state = rand (size)
if state != 0
if state == 1
state += 1
end
if a < 10
weapon.plus_state_set.push(state)
end
if a >= 10 and a < 15
weapon.minus_state_set.push(state)
end
end
#根据属性计算价格
ap = weapon.atk + weapon.pdef + weapon.mdef
bp = weapon.str_plus + weapon.dex_plus + weapon.agi_plus + weapon.int_plus
cp = weapon.element_set.size + weapon.plus_state_set.size
- weapon.minus_state_set.size
weapon.price = ap * 10 + bp * 20 + cp * 800
# 防止价格出现负值,不然卖东西时还要倒扣钱。
if weapon.price < 2
weapon.price = 2
end
#根据属性计算品质
pz = 1
pz += weapon.pdef > 0 ? 1:0
pz += weapon.mdef > 0 ? 1:0
pz += weapon.str_plus > 0 ? 1:0
pz += weapon.dex_plus > 0 ? 1:0
pz += weapon.agi_plus > 0 ? 1:0
pz += weapon.int_plus > 0 ? 1:0
io = weapon.element_set.size
pz += io > 0 ? io * 2:0
io = weapon.plus_state_set.size
pz += io > 0 ? io * 2:0
io = weapon.minus_state_set.size
pz -= io > 0 ? io:0
#根据品质生成武器名字,图标,动画和说明
kind = rand (5)
# 锤
if kind == 0
a = rand (ICON_NAME锤.size / 5)
c = rand (2)
for cn in CLASS_锤
an = $data_classes[cn].name
if pz < 2
spp = "普通的锤," + an + "可以装备@武器"
icon = a
if c == 1
name = WEAPON_NAME1[rand (WEAPON_NAME1.size)]
else
name = WEAPON_NAME2[rand (WEAPON_NAME2.size)]
end
elsif pz >= 2 and pz < 3
spp = "精致的锤," + an + "可以装备@武器"
icon = a + 4
if c == 1
name = WEAPON_NAME1[rand (WEAPON_NAME1.size)]
else
name = WEAPON_NAME2[rand (WEAPON_NAME2.size)]
end
elsif pz >= 3 and pz < 5
spp = "极品的锤," + an + "可以装备@武器"
name = WEAPON_NAME2[rand (WEAPON_NAME2.size)] +
WEAPON_NAME1[rand (WEAPON_NAME1.size)]
icon = a + 8
else
spp = "传说的锤," + an + "可以装备@武器"
name = WEAPON_NAME2[rand (WEAPON_NAME2.size)] + "·" +
WEAPON_NAME1[rand (WEAPON_NAME1.size)]
icon = a + 12
end
weapon.description = spp
end
weapon.animation1_id = ANIMATION1_ID锤
weapon.animation2_id = ANIMATION2_ID锤
weapon.icon_name = ICON_NAME锤[icon]
weapon.name = name + "锤"
# 剑
elsif kind == 1
a = rand (ICON_NAME剑.size / 5)
c = rand (2)
for cn in CLASS_剑
an = $data_classes[cn].name
if pz < 2
spp = "普通的剑," + an + "可以装备@武器"
icon = a
if c == 1
name = WEAPON_NAME1[rand (WEAPON_NAME1.size)]
else
name = WEAPON_NAME2[rand (WEAPON_NAME2.size)]
end
elsif pz >= 2 and pz < 3
spp = "精致的剑," + an + "可以装备@武器"
icon = a + 4
if c == 1
name = WEAPON_NAME1[rand (WEAPON_NAME1.size)]
else
name = WEAPON_NAME2[rand (WEAPON_NAME2.size)]
end
elsif pz >= 3 and pz < 5
spp = "极品的剑," + an + "可以装备@武器"
name = WEAPON_NAME2[rand (WEAPON_NAME2.size)] +
WEAPON_NAME1[rand (WEAPON_NAME1.size)]
icon = a + 8
else
spp = "传说的剑," + an + "可以装备@武器"
name = WEAPON_NAME2[rand (WEAPON_NAME2.size)] + "·" +
WEAPON_NAME1[rand (WEAPON_NAME1.size)]
icon = a + 12
end
weapon.description = spp
end
weapon.animation1_id = ANIMATION1_ID剑
weapon.animation2_id = ANIMATION2_ID剑
weapon.icon_name = ICON_NAME剑[icon]
weapon.name = name + "剑"
# 枪
elsif kind == 2
a = rand (ICON_NAME枪.size / 5)
c = rand (2)
for cn in CLASS_枪
an = $data_classes[cn].name
if pz < 2
spp = "普通的枪," + an + "可以装备@武器"
icon = a
if c == 1
name = WEAPON_NAME1[rand (WEAPON_NAME1.size)]
else
name = WEAPON_NAME2[rand (WEAPON_NAME2.size)]
end
elsif pz >= 2 and pz < 3
spp = "精致的枪," + an + "可以装备@武器"
icon = a + 4
if c == 1
name = WEAPON_NAME1[rand (WEAPON_NAME1.size)]
else
name = WEAPON_NAME2[rand (WEAPON_NAME2.size)]
end
elsif pz >= 3 and pz < 5
spp = "极品的枪," + an + "可以装备@武器"
name = WEAPON_NAME2[rand (WEAPON_NAME2.size)] +
WEAPON_NAME1[rand (WEAPON_NAME1.size)]
icon = a + 8
else
spp = "传说的枪," + an + "可以装备@武器"
name = WEAPON_NAME2[rand (WEAPON_NAME2.size)] + "·" +
WEAPON_NAME1[rand (WEAPON_NAME1.size)]
icon = a + 12
end
weapon.description = spp
end
weapon.animation1_id = ANIMATION1_ID枪
weapon.animation2_id = ANIMATION2_ID枪
weapon.icon_name = ICON_NAME枪[icon]
weapon.name = name + "枪"
# 扇
elsif kind == 3
a = rand (ICON_NAME扇.size / 5)
c = rand (2)
for cn in CLASS_扇
an = $data_classes[cn].name
if pz < 2
spp = "普通的扇," + an + "可以装备@武器"
icon = a
if c == 1
name = WEAPON_NAME1[rand (WEAPON_NAME1.size)]
else
name = WEAPON_NAME2[rand (WEAPON_NAME2.size)]
end
elsif pz >= 2 and pz < 3
spp = "精致的扇," + an + "可以装备@武器"
icon = a + 4
if c == 1
name = WEAPON_NAME1[rand (WEAPON_NAME1.size)]
else
name = WEAPON_NAME2[rand (WEAPON_NAME2.size)]
end
elsif pz >= 3 and pz < 5
spp = "极品的扇," + an + "可以装备@武器"
name = WEAPON_NAME2[rand (WEAPON_NAME2.size)] +
WEAPON_NAME1[rand (WEAPON_NAME1.size)]
icon = a + 8
else
spp = "传说的扇," + an + "可以装备@武器"
name = WEAPON_NAME2[rand (WEAPON_NAME2.size)] + "·" +
WEAPON_NAME1[rand (WEAPON_NAME1.size)]
icon = a + 12
end
weapon.description = spp
end
weapon.animation1_id = ANIMATION1_ID扇
weapon.animation2_id = ANIMATION2_ID扇
weapon.icon_name = ICON_NAME扇[icon]
weapon.name = name + "扇"
# 爪
elsif kind == 4
a = rand (ICON_NAME爪.size / 5)
c = rand (2)
for cn in CLASS_爪
an = $data_classes[cn].name
if pz < 2
spp = "普通的爪," + an + "可以装备@武器"
icon = a
if c == 1
name = WEAPON_NAME1[rand (WEAPON_NAME1.size)]
else
name = WEAPON_NAME2[rand (WEAPON_NAME2.size)]
end
elsif pz >= 2 and pz < 3
spp = "精致的爪," + an + "可以装备@武器"
icon = a + 4
if c == 1
name = WEAPON_NAME1[rand (WEAPON_NAME1.size)]
else
name = WEAPON_NAME2[rand (WEAPON_NAME2.size)]
end
elsif pz >= 3 and pz < 5
spp = "极品的爪," + an + "可以装备@武器"
name = WEAPON_NAME2[rand (WEAPON_NAME2.size)] +
WEAPON_NAME1[rand (WEAPON_NAME1.size)]
icon = a + 8
else
spp = "传说的爪," + an + "可以装备@武器"
name = WEAPON_NAME2[rand (WEAPON_NAME2.size)] + "·" +
WEAPON_NAME1[rand (WEAPON_NAME1.size)]
icon = a + 12
end
weapon.description = spp
end
weapon.animation1_id = ANIMATION1_ID爪
weapon.animation2_id = ANIMATION2_ID爪
weapon.icon_name = ICON_NAME爪[icon]
weapon.name = name + "爪"
end
# 代入职业可装备的武器
if kind == 0
for i in CLASS_锤
$data_classes[i].weapon_set.push(id)
end
elsif kind == 1
for i in CLASS_剑
$data_classes[i].weapon_set.push(id)
end
elsif kind == 2
for i in CLASS_枪
$data_classes[i].weapon_set.push(id)
end
elsif kind == 3
for i in CLASS_扇
$data_classes[i].weapon_set.push(id)
end
elsif kind == 4
for i in CLASS_爪
$data_classes[i].weapon_set.push(id)
end
end
# 增加武器
@weapons[id] = [[weapon_number(id) + n, 0].max, 99].min
end
# 自动提示
weapon = $data_weapons[id]
xdrs_top = Window_Base.new(190,116,260,100)
xdrs_top.contents = Bitmap.new(xdrs_top.width - 32, xdrs_top.height - 32)
xdrs_top.contents.draw_text(0,0,240,32,"获得武器:")
Audio.se_play("Audio/SE/"+"006-System06",100,100)
xdrs_top.draw_weapon_name(weapon, 26, 32)
xdrs_top.opacity = 200
for i in 0..30
Graphics.update
end
a = rand (4)
if a == 0
for i in 0..10
xdrs_top.y -= 12
Graphics.update
end
elsif a == 1
for i in 0..10
xdrs_top.y += 37
Graphics.update
end
elsif a == 2
for i in 0..10
xdrs_top.x -= 45
Graphics.update
end
elsif a == 3
for i in 0..10
xdrs_top.x += 45
Graphics.update
end
end
xdrs_top.dispose
end
end
#------------------------------------------------------------------------------
#【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】【*】
#-------------------------------------------------------------------------