本帖最后由 陈大帅帅帅哥 于 2021-8-9 08:12 编辑
我的宝可梦引擎可以设置主副属性,另一个赛尔号同人游戏也在用里面的脚本,符合要求的话可以参考一下
这段插入到main前
def elements_correct( skill_element,first_element,second_element)
#卐 属性相克系数初始化
x = 1.0
for s_e in skill_element
if TYPE[ s_e]
n = TYPE[ s_e] [ first_element] ? TYPE[ s_e] [ first_element] : 1
m = TYPE[ s_e] [ second_element] ? TYPE[ s_e] [ second_element] : 1
x *= n * m
end
end
return x
end
class Game_Actor
#--------------------------------------------------------------------------
# 卐 获取 主属性
#--------------------------------------------------------------------------
def first_element
result = nil
for i in 1 ..$data_classes[ @class_id] .element_ranks .xsize
if $data_classes [ @class_id] .element_ranks [ i] == 1
break result = i
end
end
return result
end
#--------------------------------------------------------------------------
# 卐 获取 副属性
#--------------------------------------------------------------------------
def second_element
result = nil
for i in 1 ..$data_classes[ @class_id] .element_ranks .xsize
if $data_classes [ @class_id] .element_ranks [ i] == 2
break result = i
end
end
return result
end
end
class Game_Enemy
#--------------------------------------------------------------------------
# 卐 获取 主属性
#--------------------------------------------------------------------------
def first_element
result = nil
for i in 1 ..$data_enemies[ @enemy_id] .element_ranks .xsize
if $data_enemies [ @enemy_id] .element_ranks [ i] == 1
break result = i
end
end
return result
end
#--------------------------------------------------------------------------
# 卐 获取 副属性
#--------------------------------------------------------------------------
def second_element
result = nil
for i in 1 ..$data_enemies[ @enemy_id] .element_ranks .xsize
if $data_enemies [ @enemy_id] .element_ranks [ i] == 2
break break result = i
end
end
return result
end
end
def elements_correct( skill_element,first_element,second_element)
#卐 属性相克系数初始化
x = 1.0
for s_e in skill_element
if TYPE[ s_e]
n = TYPE[ s_e] [ first_element] ? TYPE[ s_e] [ first_element] : 1
m = TYPE[ s_e] [ second_element] ? TYPE[ s_e] [ second_element] : 1
x *= n * m
end
end
return x
end
class Game_Actor
#--------------------------------------------------------------------------
# 卐 获取 主属性
#--------------------------------------------------------------------------
def first_element
result = nil
for i in 1 ..$data_classes[ @class_id] .element_ranks .xsize
if $data_classes [ @class_id] .element_ranks [ i] == 1
break result = i
end
end
return result
end
#--------------------------------------------------------------------------
# 卐 获取 副属性
#--------------------------------------------------------------------------
def second_element
result = nil
for i in 1 ..$data_classes[ @class_id] .element_ranks .xsize
if $data_classes [ @class_id] .element_ranks [ i] == 2
break result = i
end
end
return result
end
end
class Game_Enemy
#--------------------------------------------------------------------------
# 卐 获取 主属性
#--------------------------------------------------------------------------
def first_element
result = nil
for i in 1 ..$data_enemies[ @enemy_id] .element_ranks .xsize
if $data_enemies [ @enemy_id] .element_ranks [ i] == 1
break result = i
end
end
return result
end
#--------------------------------------------------------------------------
# 卐 获取 副属性
#--------------------------------------------------------------------------
def second_element
result = nil
for i in 1 ..$data_enemies[ @enemy_id] .element_ranks .xsize
if $data_enemies [ @enemy_id] .element_ranks [ i] == 2
break break result = i
end
end
return result
end
end
在Game_Battler 3里找到
# 属性修正
self .damage *= elements_correct( skill.element_set )
self .damage /= 100
# 属性修正
self .damage *= elements_correct( skill.element_set )
self .damage /= 100
用这两行替换之
# 属性修正
self .damage *= elements_correct( skill.element_set ,self .first_element ,self .second_element )
# 属性修正
self .damage *= elements_correct( skill.element_set ,self .first_element ,self .second_element )
这段是属性相克表,也是插入到main前,按照需求自行调整
#--------------------------------------------------------------------------
# 卐 属性提示
# 8:火 7:水 9:草 2:飞行 10:电
# 4:地面 14:机械 11:冰 12:超能 1:普通
# 3:战斗 5:暗影 6:光 13:龙 16:神秘
# 15:圣灵 29:次元 18:远古 19:邪灵 20:无
# 21:属性 22:自然 23:王 24:混沌 25:神灵
# 26:轮回 27:虫 28:虚空
#--------------------------------------------------------------------------
TYPE=
{
8 =># 火
{ 9 =>2 , 14 =>2 , 11 =>2 , 8 =>0.5 , 7 =>0.5 , 15 =>0.5 , 22 =>0.5 , 24 =>0.5 , 25 =>0.5 } ,
7 =># 水
{ 8 =>2 , 4 =>2 , 2 =>0.5 , 9 =>0.5 , 15 =>0.5 , 22 =>0.5 , 24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光
{ 12 =>2 , 5 =>2 , 27 =>2 , 14 =>0.5 , 11 =>0.5 , 6 =>0.5 , 15 =>0.5 , 19 =>0.5 , 22 =>0.5 , 25 =>0.5 , 26 =>0.5 , 28 =>0.5 , 9 =>0 } ,
13 =># 龙
{ 11 =>2 , 13 =>2 , 15 =>2 , 19 =>2 , 8 =>0.5 , 7 =>0.5 , 9 =>0.5 , 10 =>0.5 , 18 =>0.5 , 27 =>0.5 } ,
16 =># 神秘
{ 10 =>2 , 15 =>2 , 16 =>2 , 22 =>2 , 23 =>2 , 25 =>2 , 26 =>2 , 4 =>0.5 , 3 =>0.5 , 19 =>0.5 , 24 =>0.5 , 27 =>0.5 } ,
15 =># 圣灵
{ 8 =>2 , 7 =>2 , 9 =>2 , 10 =>2 , 11 =>2 , 18 =>2 , 28 =>2 , 3 =>0.5 , 13 =>0.5 , 25 =>0.5 , 26 =>0.5 } ,
29 =># 次元
{ 2 =>2 , 14 =>2 , 12 =>2 , 19 =>2 , 22 =>2 , 27 =>2 , 28 =>2 , 11 =>0.5 , 23 =>0.5 , 24 =>0.5 , 25 =>0.5 , 26 =>0.5 } ,
18 =># 远古
{ 8 =>2 , 2 =>2 , 13 =>2 , 16 =>2 , 28 =>2 , 14 =>0.5 , 11 =>0.5 , 23 =>0.5 , 26 =>0.5 } ,
19 =># 邪灵
{ 5 =>2 , 6 =>2 , 16 =>2 , 29 =>2 , 22 =>2 , 14 =>0.5 , 11 =>0.5 , 12 =>0.5 , 15 =>0.5 , 23 =>0.5 , 24 =>0.5 , 26 =>0.5 , 25 =>0 } ,
20 =># 无
{ } ,
22 =># 自然
{ 8 =>2 , 7 =>2 , 9 =>2 , 2 =>2 , 10 =>2 , 4 =>2 , 6 =>2 , 23 =>2 , 26 =>2 , 14 =>0.5 , 12 =>0.5 , 3 =>0.5 , 5 =>0.5 , 16 =>0.5 , 29 =>0.5 , 19 =>0.5 , 24 =>0.5 , 28 =>0 } ,
23 =># 王
{ 3 =>2 , 5 =>2 , 29 =>2 , 19 =>2 , 12 =>0.5 , 29 =>0.5 , 27 =>0.5 } ,
24 =># 混沌
{ 2 =>2 , 11 =>2 , 16 =>2 , 29 =>2 , 19 =>2 , 22 =>2 , 25 =>2 , 10 =>0.5 , 14 =>0.5 , 3 =>0.5 , 26 =>0.5 , 28 =>0 } ,
25 =># 神灵
{ 8 =>2 , 7 =>2 , 9 =>2 , 10 =>2 , 11 =>2 , 18 =>2 , 19 =>2 , 24 =>2 , 14 =>0.5 , 3 =>0.5 , 13 =>0.5 } ,
26 =># 轮回
{ 5 =>2 , 6 =>2 , 15 =>2 , 29 =>2 , 19 =>2 , 24 =>2 , 11 =>0.5 , 12 =>0.5 , 22 =>0.5 , 28 =>0.5 } ,
27 =># 虫
{ 9 =>2 , 4 =>2 , 3 =>2 , 24 =>2 , 27 =>2 , 8 =>0.5 , 7 =>0.5 , 11 =>0.5 , 6 =>0.5 } ,
28 =># 虚空
{ 12 =>2 , 3 =>2 , 6 =>2 , 16 =>2 , 22 =>2 , 26 =>2 , 2 =>0.5 , 5 =>0.5 , 15 =>0.5 , 29 =>0.5 }
}
#--------------------------------------------------------------------------
# 卐 属性提示
# 8:火 7:水 9:草 2:飞行 10:电
# 4:地面 14:机械 11:冰 12:超能 1:普通
# 3:战斗 5:暗影 6:光 13:龙 16:神秘
# 15:圣灵 29:次元 18:远古 19:邪灵 20:无
# 21:属性 22:自然 23:王 24:混沌 25:神灵
# 26:轮回 27:虫 28:虚空
#--------------------------------------------------------------------------
TYPE=
{
8 =># 火
{ 9 =>2 , 14 =>2 , 11 =>2 , 8 =>0.5 , 7 =>0.5 , 15 =>0.5 , 22 =>0.5 , 24 =>0.5 , 25 =>0.5 } ,
7 =># 水
{ 8 =>2 , 4 =>2 , 2 =>0.5 , 9 =>0.5 , 15 =>0.5 , 22 =>0.5 , 24 =>0.5 , 25 =>0.5 } ,
9 =># 草
{ 7 =>2 , 4 =>2 , 6 =>2 , 8 =>0.5 , 9 =>0.5 , 2 =>0.5 , 14 =>0.5 , 15 =>0.5 , 18 =>0.5 , 24 =>0.5 , 25 =>0.5 } ,
2 =># 飞行
{ 9 =>2 , 3 =>2 , 27 =>2 , 10 =>0.5 , 14 =>0.5 , 29 =>0.5 , 19 =>0.5 , 22 =>0.5 , 24 =>0.5 } ,
10 =># 电
{ 7 =>2 , 2 =>2 , 5 =>2 , 29 =>2 , 24 =>2 , 28 =>2 , 9 =>0.5 , 10 =>0.5 , 15 =>0.5 , 16 =>0.5 , 22 =>0.5 , 25 =>0.5 , 4 =>0 } ,
4 =># 地面
{ 8 =>2 , 10 =>2 , 14 =>2 , 23 =>2 , 26 =>2 , 9 =>0.5 , 12 =>0.5 , 5 =>0.5 , 13 =>0.5 , 15 =>0.5 , 22 =>0.5 , 25 =>0.5 , 27 =>0.5 , 2 =>0 } ,
14 =># 机械
{ 11 =>2 , 3 =>2 , 18 =>2 , 19 =>2 , 25 =>2 , 8 =>0.5 , 7 =>0.5 , 10 =>0.5 , 14 =>0.5 , 29 =>0.5 } ,
11 =># 冰
{ 9 =>2 , 2 =>2 , 4 =>2 , 29 =>2 , 18 =>2 , 26 =>2 , 27 =>2 , 8 =>0.5 , 7 =>0.5 , 14 =>0.5 , 11 =>0.5 , 15 =>0.5 , 24 =>0.5 , 25 =>0.5 } ,
12 =># 超能
{ 3 =>2 , 16 =>2 , 22 =>2 , 14 =>0.5 , 12 =>0.5 , 27 =>0.5 , 6 =>0 } ,
1 =># 普通
{ } ,
3 =># 战斗
{ 14 =>2 , 11 =>2 , 13 =>2 , 15 =>2 , 12 =>0.5 , 3 =>0.5 , 5 =>0.5 , 23 =>0.5 } ,
5 =># 暗影
{ 12 =>2 , 5 =>2 , 29 =>2 , 14 =>0.5 , 11 =>0.5 , 6 =>0.5 , 15 =>0.5 , 19 =>0.5 , 25 =>0.5 } ,
6 =># 光
{ 12 =>2 , 5 =>2 , 27 =>2 , 14 =>0.5 , 11 =>0.5 , 6 =>0.5 , 15 =>0.5 , 19 =>0.5 , 22 =>0.5 , 25 =>0.5 , 26 =>0.5 , 28 =>0.5 , 9 =>0 } ,
13 =># 龙
{ 11 =>2 , 13 =>2 , 15 =>2 , 19 =>2 , 8 =>0.5 , 7 =>0.5 , 9 =>0.5 , 10 =>0.5 , 18 =>0.5 , 27 =>0.5 } ,
16 =># 神秘
{ 10 =>2 , 15 =>2 , 16 =>2 , 22 =>2 , 23 =>2 , 25 =>2 , 26 =>2 , 4 =>0.5 , 3 =>0.5 , 19 =>0.5 , 24 =>0.5 , 27 =>0.5 } ,
15 =># 圣灵
{ 8 =>2 , 7 =>2 , 9 =>2 , 10 =>2 , 11 =>2 , 18 =>2 , 28 =>2 , 3 =>0.5 , 13 =>0.5 , 25 =>0.5 , 26 =>0.5 } ,
29 =># 次元
{ 2 =>2 , 14 =>2 , 12 =>2 , 19 =>2 , 22 =>2 , 27 =>2 , 28 =>2 , 11 =>0.5 , 23 =>0.5 , 24 =>0.5 , 25 =>0.5 , 26 =>0.5 } ,
18 =># 远古
{ 8 =>2 , 2 =>2 , 13 =>2 , 16 =>2 , 28 =>2 , 14 =>0.5 , 11 =>0.5 , 23 =>0.5 , 26 =>0.5 } ,
19 =># 邪灵
{ 5 =>2 , 6 =>2 , 16 =>2 , 29 =>2 , 22 =>2 , 14 =>0.5 , 11 =>0.5 , 12 =>0.5 , 15 =>0.5 , 23 =>0.5 , 24 =>0.5 , 26 =>0.5 , 25 =>0 } ,
20 =># 无
{ } ,
22 =># 自然
{ 8 =>2 , 7 =>2 , 9 =>2 , 2 =>2 , 10 =>2 , 4 =>2 , 6 =>2 , 23 =>2 , 26 =>2 , 14 =>0.5 , 12 =>0.5 , 3 =>0.5 , 5 =>0.5 , 16 =>0.5 , 29 =>0.5 , 19 =>0.5 , 24 =>0.5 , 28 =>0 } ,
23 =># 王
{ 3 =>2 , 5 =>2 , 29 =>2 , 19 =>2 , 12 =>0.5 , 29 =>0.5 , 27 =>0.5 } ,
24 =># 混沌
{ 2 =>2 , 11 =>2 , 16 =>2 , 29 =>2 , 19 =>2 , 22 =>2 , 25 =>2 , 10 =>0.5 , 14 =>0.5 , 3 =>0.5 , 26 =>0.5 , 28 =>0 } ,
25 =># 神灵
{ 8 =>2 , 7 =>2 , 9 =>2 , 10 =>2 , 11 =>2 , 18 =>2 , 19 =>2 , 24 =>2 , 14 =>0.5 , 3 =>0.5 , 13 =>0.5 } ,
26 =># 轮回
{ 5 =>2 , 6 =>2 , 15 =>2 , 29 =>2 , 19 =>2 , 24 =>2 , 11 =>0.5 , 12 =>0.5 , 22 =>0.5 , 28 =>0.5 } ,
27 =># 虫
{ 9 =>2 , 4 =>2 , 3 =>2 , 24 =>2 , 27 =>2 , 8 =>0.5 , 7 =>0.5 , 11 =>0.5 , 6 =>0.5 } ,
28 =># 虚空
{ 12 =>2 , 3 =>2 , 6 =>2 , 16 =>2 , 22 =>2 , 26 =>2 , 2 =>0.5 , 5 =>0.5 , 15 =>0.5 , 29 =>0.5 }
}
全部弄好后,属性有效度为A的属性即为主属性,为B的即为副属性