赞 | 3 |
VIP | 0 |
好人卡 | 0 |
积分 | 22 |
经验 | 46374 |
最后登录 | 2024-11-12 |
在线时间 | 1011 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 2180
- 在线时间
- 1011 小时
- 注册时间
- 2015-10-17
- 帖子
- 1285
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 fjm 于 2022-4-7 19:55 编辑
角色离队时,副将有时候忘记卸下来,就没有了,问下怎样让角色离队时,副将自动解除,卸下来,谢谢
#============================================================================== # ■ VXAce-RGSS3-38 精霊システム [Ver.1.0.0] by Claimh #------------------------------------------------------------------------------ # ・アクターごとに精霊をパートナーにすることができます。 # ・パートナーになるとパラメータ上昇、スキル習得など # (パートナーのパラメータ、特徴が加算されます) # ・精霊はパートナーになっている状態で戦闘に参加することでレベルが上昇します # ・精霊のデータはデータベース上のアクターとして作成してください。 #------------------------------------------------------------------------------ # ☆精霊加入 # $game_party.add_spirit(精霊ID) # ☆精霊脱退 # $game_party.del_spirit(精霊ID) # ☆精霊パートナー化 # Spirits.add_partner(アクターID, 精霊ID) # ☆精霊パートナー解消 # Spirits.remove_partner(アクターID, 精霊ID) # ☆精霊パートナー最大数変更 # $game_actors[アクターID].max_spirits = n #============================================================================== module Spirits AFNTY=[{0=>3}]; MAX=[1] # 変更禁止 ### 精霊設定 ################################################################## # 精霊 ※精霊ID:0 は使用禁止 SPIRIT_ACTOR = { # 精霊ID => アクターID 1 => 300, 2 => 301, 3 => 302, 4 => 303, 5 => 304, 6 => 305, 7 => 306, 8 => 307, 9 => 308, 10 => 309, 11 => 310, 12 => 311, 13 => 312, 14 => 313, 15 => 314, 16 => 315, 17 => 316, 18 => 317, 19 => 318, 20 => 319, 21 => 320, 22 => 321, 23 => 322, 24 => 323, 25 => 324, } ### 初期状態設定 ############################################################## # 初期状態で加入している精霊 # START_V = [精霊ID, …] START_V = [1] # 初期状態のパートナー # (注) 初期メンバーおよび初期精霊以外は設定不可 # START_P = {アクターID => 精霊ID, …} START_P = {1=>12}#{4=>1} #{1=>3, 2=>4, 3=>2, 4=>1} ### パートナー数設定 ########################################################## # 最大パートナー数(初期値) # MAX[アクターID] = 最大数 MAX[1] = 1 MAX[2] = 1 MAX[3] = 1 MAX[4] = 1 MAX[5] = 3 MAX[6] = 3 MAX[7] = 3 MAX[8] = 3 MAX[9] = 3 MAX[10] = 3 MAX[11] = 3 MAX[12] = 3 MAX[13] = 3 MAX[14] = 3 MAX[15] = 3 MAX[16] = 3 MAX[17] = 3 MAX[18] = 3 MAX[19] = 1 MAX[20] = 1 MAX[21] = 1 MAX[22] = 1 MAX[23] = 1 MAX[24] = 1 MAX[25] = 1 MAX[26] = 1 MAX[27] = 1 MAX[28] = 1 MAX[29] = 1 MAX[30] = 1 MAX[31] = 1 MAX[32] = 1 MAX[33] = 1 MAX[34] = 1 MAX[35] = 1 MAX[36] = 1 MAX[37] = 1 MAX[38] = 1 MAX[39] = 1 MAX[40] = 1 MAX[41] = 1 MAX[42] = 1 MAX[43] = 1 MAX[44] = 1 MAX[45] = 1 MAX[46] = 1 MAX[47] = 1 MAX[48] = 1 MAX[49] = 1 MAX[50] = 1 MAX[51] = 1 MAX[52] = 1 MAX[53] = 1 MAX[54] = 1 MAX[55] = 1 MAX[56] = 1 MAX[57] = 1 MAX[58] = 1 MAX[59] = 1 MAX[60] = 1 MAX[61] = 1 MAX[62] = 1 MAX[63] = 1 MAX[64] = 1 MAX[65] = 1 MAX[66] = 1 MAX[67] = 1 MAX[68] = 1 MAX[69] = 1 MAX[70] = 1 MAX[71] = 1 MAX[72] = 1 MAX[73] = 1 MAX[74] = 1 MAX[75] = 1 MAX[76] = 1 MAX[77] = 1 MAX[78] = 1 MAX[79] = 1 MAX[80] = 1 MAX[81] = 1 MAX[82] = 1 MAX[83] = 1 MAX[84] = 1 MAX[85] = 1 MAX[86] = 1 MAX[87] = 1 MAX[88] = 1 MAX[89] = 1 MAX[90] = 1 MAX[91] = 1 MAX[92] = 1 MAX[93] = 1 MAX[94] = 1 MAX[95] = 1 MAX[96] = 1 MAX[97] = 1 MAX[98] = 1 MAX[99] = 1 MAX[100] = 1 MAX[101] = 1 MAX[102] = 1 MAX[103] = 1 MAX[104] = 1 MAX[105] = 1 MAX[106] = 1 MAX[107] = 1 MAX[108] = 1 MAX[109] = 1 MAX[110] = 1 MAX[111] = 1 MAX[112] = 1 MAX[113] = 1 MAX[114] = 1 MAX[115] = 1 MAX[116] = 1 MAX[117] = 1 MAX[118] = 1 MAX[119] = 1 MAX[120] = 1 MAX[121] = 1 MAX[122] = 1 MAX[123] = 1 MAX[124] = 1 MAX[125] = 1 MAX[126] = 1 MAX[127] = 1 MAX[128] = 1 MAX[129] = 1 MAX[130] = 1 MAX[131] = 1 MAX[132] = 1 MAX[133] = 1 MAX[134] = 1 MAX[135] = 1 MAX[136] = 1 MAX[137] = 1 MAX[138] = 1 MAX[139] = 1 MAX[140] = 1 MAX[141] = 1 MAX[142] = 1 MAX[143] = 1 MAX[144] = 1 MAX[145] = 1 MAX[146] = 1 MAX[147] = 1 MAX[148] = 1 MAX[149] = 1 MAX[150] = 1 MAX[151] = 3 MAX[152] = 3 MAX[153] = 3 MAX[154] = 3 MAX[155] = 3 MAX[156] = 3 MAX[157] = 3 MAX[158] = 3 MAX[159] = 3 MAX[160] = 3 MAX[161] = 3 MAX[162] = 3 MAX[163] = 3 MAX[164] = 3 MAX[165] = 3 MAX[166] = 3 MAX[167] = 3 MAX[168] = 3 MAX[169] = 3 MAX[170] = 3 MAX[171] = 3 MAX[172] = 3 MAX[173] = 3 MAX[174] = 3 MAX[175] = 3 MAX[176] = 3 MAX[177] = 3 MAX[178] = 3 MAX[179] = 3 MAX[180] = 3 MAX[181] = 3 MAX[182] = 3 MAX[183] = 3 MAX[184] = 3 MAX[185] = 3 MAX[186] = 3 MAX[187] = 3 MAX[188] = 3 MAX[189] = 3 MAX[190] = 3 MAX[191] = 3 MAX[192] = 3 MAX[193] = 3 MAX[194] = 3 MAX[195] = 3 MAX[196] = 3 MAX[197] = 3 MAX[198] = 3 MAX[199] = 3 MAX[200] = 3 MAX[201] = 3 MAX[202] = 3 MAX[203] = 3 MAX[204] = 3 MAX[205] = 3 MAX[206] = 3 MAX[207] = 3 MAX[208] = 3 MAX[209] = 3 MAX[210] = 3 MAX[211] = 3 MAX[212] = 3 MAX[213] = 3 MAX[214] = 3 MAX[215] = 3 MAX[216] = 3 MAX[217] = 3 MAX[218] = 3 MAX[219] = 3 MAX[220] = 3 MAX[221] = 3 MAX[222] = 3 MAX[223] = 3 MAX[224] = 3 MAX[225] = 3 MAX[226] = 3 MAX[227] = 3 MAX[228] = 3 MAX[229] = 3 MAX[230] = 3 MAX[231] = 3 MAX[232] = 3 MAX[233] = 3 MAX[234] = 3 MAX[235] = 3 MAX[236] = 3 MAX[237] = 3 MAX[238] = 3 MAX[239] = 3 MAX[240] = 3 MAX[241] = 3 MAX[242] = 3 MAX[243] = 3 MAX[244] = 3 MAX[245] = 3 MAX[246] = 3 MAX[247] = 3 MAX[248] = 3 MAX[249] = 3 MAX[250] = 3 MAX[251] = 3 MAX[252] = 3 MAX[253] = 3 MAX[254] = 3 MAX[255] = 3 MAX[256] = 3 MAX[257] = 3 MAX[258] = 3 MAX[259] = 3 MAX[260] = 3 ### 相性設定 ################################################################## # 5段階で各アクターと各精霊の相性を設定できます。 #--------------------------------------------------- # 5 : 非常に良い(能力上昇:1.5倍) # 4 : やや良い (能力上昇:1.2倍) # 3 : 普通 (能力上昇:1.0倍) # 2 : やや悪い (能力上昇:0.8倍) # 1 : 非常に悪い(能力上昇:0.5倍) # 0 : パートナーにできない #--------------------------------------------------- # [アクターID] = {精霊ID=>相性, …} #AFNTY[1] = {1=>3, 2=>2, 3=>5, 4=>1} #AFNTY[2] = {1=>3, 2=>3, 3=>1, 4=>5} #AFNTY[3] = {1=>1, 2=>5, 3=>3, 4=>4} #AFNTY[4] = {1=>5, 2=>1, 3=>3, 4=>4} # AFNTY[8] = {0=>0} # 全ての精霊をパートナーにできない ### 精霊レベル設定 ############################################################ # レベル上昇あり USE_LV = true # 経験値入手対象 # 0 : 戦闘メンバーのパートナーとなっている精霊のみ # 1 : 全メンバーのパートナーとなっている精霊のみ # 2 : 全精霊 EXP_TARGET = 2 # 経験値入出種別 # 0 : 戦闘回数でLvUP # 1 : アクターと同じEXP EXP_TYPE = 1 ### 閾値設定 ################################################################## # 各能力の閾値設定 # 追加パラメータ = データベース上のパラメータ - PRM_BASE PRM_BASE = [ 0, # 最大HP 0, # 最大MP 0, # 攻撃力 0, # 防御力 0, # 魔法力 0, # 魔法防御 0, # 敏捷性 0 # 運 ] ### ステータス画面表示設定 #################################################### # 特徴ステータス表示と表示順序(上から順) STS = { :status => true, # ステータス表示(LVあり用) :stskl => true, # ステータス表示(LVなし用) :skills => true, # 習得スキル :feater => true # 特徴 } ### 入替え画面表示設定 ######################################################## # 特徴ステータス表示と表示順序(上から順) SHOW_ST = { :text => false, # 解説 :status => true, # 能力パラメータ :skills => true, # 習得スキル :rate => false, # 耐性(属性有効度, 弱体有効度, ステート有効度, ステート無効化) :param => false,#false, # 能力値(通常. 追加, 特殊) :attack => false, # 攻撃(属性、ステート, 速度補正, 追加回数) :skill => false, # スキル(タイプ追加・封印, 追加・封印) :equip => false, # 装備(武器タイプ, 防具タイプ, 固定, 封印, スロットタイプ) :other => false # その他(行動回数追加, 特殊フラグ, パーティ能力) } # スキル表示時の列数(1-2) SKILL_NUM = 2 end
#==============================================================================
# ■ VXAce-RGSS3-38 精霊システム [Ver.1.0.0] by Claimh
#------------------------------------------------------------------------------
# ・アクターごとに精霊をパートナーにすることができます。
# ・パートナーになるとパラメータ上昇、スキル習得など
# (パートナーのパラメータ、特徴が加算されます)
# ・精霊はパートナーになっている状態で戦闘に参加することでレベルが上昇します
# ・精霊のデータはデータベース上のアクターとして作成してください。
#------------------------------------------------------------------------------
# ☆精霊加入
# $game_party.add_spirit(精霊ID)
# ☆精霊脱退
# $game_party.del_spirit(精霊ID)
# ☆精霊パートナー化
# Spirits.add_partner(アクターID, 精霊ID)
# ☆精霊パートナー解消
# Spirits.remove_partner(アクターID, 精霊ID)
# ☆精霊パートナー最大数変更
# $game_actors[アクターID].max_spirits = n
#==============================================================================
module Spirits
AFNTY=[{0=>3}]; MAX=[1] # 変更禁止
### 精霊設定 ##################################################################
# 精霊 ※精霊ID:0 は使用禁止
SPIRIT_ACTOR = {
# 精霊ID => アクターID
1 => 300,
2 => 301,
3 => 302,
4 => 303,
5 => 304,
6 => 305,
7 => 306,
8 => 307,
9 => 308,
10 => 309,
11 => 310,
12 => 311,
13 => 312,
14 => 313,
15 => 314,
16 => 315,
17 => 316,
18 => 317,
19 => 318,
20 => 319,
21 => 320,
22 => 321,
23 => 322,
24 => 323,
25 => 324,
}
### 初期状態設定 ##############################################################
# 初期状態で加入している精霊
# START_V = [精霊ID, …]
START_V = [1]
# 初期状態のパートナー
# (注) 初期メンバーおよび初期精霊以外は設定不可
# START_P = {アクターID => 精霊ID, …}
START_P = {1=>12}#{4=>1} #{1=>3, 2=>4, 3=>2, 4=>1}
### パートナー数設定 ##########################################################
# 最大パートナー数(初期値)
# MAX[アクターID] = 最大数
MAX[1] = 1
MAX[2] = 1
MAX[3] = 1
MAX[4] = 1
MAX[5] = 3
MAX[6] = 3
MAX[7] = 3
MAX[8] = 3
MAX[9] = 3
MAX[10] = 3
MAX[11] = 3
MAX[12] = 3
MAX[13] = 3
MAX[14] = 3
MAX[15] = 3
MAX[16] = 3
MAX[17] = 3
MAX[18] = 3
MAX[19] = 1
MAX[20] = 1
MAX[21] = 1
MAX[22] = 1
MAX[23] = 1
MAX[24] = 1
MAX[25] = 1
MAX[26] = 1
MAX[27] = 1
MAX[28] = 1
MAX[29] = 1
MAX[30] = 1
MAX[31] = 1
MAX[32] = 1
MAX[33] = 1
MAX[34] = 1
MAX[35] = 1
MAX[36] = 1
MAX[37] = 1
MAX[38] = 1
MAX[39] = 1
MAX[40] = 1
MAX[41] = 1
MAX[42] = 1
MAX[43] = 1
MAX[44] = 1
MAX[45] = 1
MAX[46] = 1
MAX[47] = 1
MAX[48] = 1
MAX[49] = 1
MAX[50] = 1
MAX[51] = 1
MAX[52] = 1
MAX[53] = 1
MAX[54] = 1
MAX[55] = 1
MAX[56] = 1
MAX[57] = 1
MAX[58] = 1
MAX[59] = 1
MAX[60] = 1
MAX[61] = 1
MAX[62] = 1
MAX[63] = 1
MAX[64] = 1
MAX[65] = 1
MAX[66] = 1
MAX[67] = 1
MAX[68] = 1
MAX[69] = 1
MAX[70] = 1
MAX[71] = 1
MAX[72] = 1
MAX[73] = 1
MAX[74] = 1
MAX[75] = 1
MAX[76] = 1
MAX[77] = 1
MAX[78] = 1
MAX[79] = 1
MAX[80] = 1
MAX[81] = 1
MAX[82] = 1
MAX[83] = 1
MAX[84] = 1
MAX[85] = 1
MAX[86] = 1
MAX[87] = 1
MAX[88] = 1
MAX[89] = 1
MAX[90] = 1
MAX[91] = 1
MAX[92] = 1
MAX[93] = 1
MAX[94] = 1
MAX[95] = 1
MAX[96] = 1
MAX[97] = 1
MAX[98] = 1
MAX[99] = 1
MAX[100] = 1
MAX[101] = 1
MAX[102] = 1
MAX[103] = 1
MAX[104] = 1
MAX[105] = 1
MAX[106] = 1
MAX[107] = 1
MAX[108] = 1
MAX[109] = 1
MAX[110] = 1
MAX[111] = 1
MAX[112] = 1
MAX[113] = 1
MAX[114] = 1
MAX[115] = 1
MAX[116] = 1
MAX[117] = 1
MAX[118] = 1
MAX[119] = 1
MAX[120] = 1
MAX[121] = 1
MAX[122] = 1
MAX[123] = 1
MAX[124] = 1
MAX[125] = 1
MAX[126] = 1
MAX[127] = 1
MAX[128] = 1
MAX[129] = 1
MAX[130] = 1
MAX[131] = 1
MAX[132] = 1
MAX[133] = 1
MAX[134] = 1
MAX[135] = 1
MAX[136] = 1
MAX[137] = 1
MAX[138] = 1
MAX[139] = 1
MAX[140] = 1
MAX[141] = 1
MAX[142] = 1
MAX[143] = 1
MAX[144] = 1
MAX[145] = 1
MAX[146] = 1
MAX[147] = 1
MAX[148] = 1
MAX[149] = 1
MAX[150] = 1
MAX[151] = 3
MAX[152] = 3
MAX[153] = 3
MAX[154] = 3
MAX[155] = 3
MAX[156] = 3
MAX[157] = 3
MAX[158] = 3
MAX[159] = 3
MAX[160] = 3
MAX[161] = 3
MAX[162] = 3
MAX[163] = 3
MAX[164] = 3
MAX[165] = 3
MAX[166] = 3
MAX[167] = 3
MAX[168] = 3
MAX[169] = 3
MAX[170] = 3
MAX[171] = 3
MAX[172] = 3
MAX[173] = 3
MAX[174] = 3
MAX[175] = 3
MAX[176] = 3
MAX[177] = 3
MAX[178] = 3
MAX[179] = 3
MAX[180] = 3
MAX[181] = 3
MAX[182] = 3
MAX[183] = 3
MAX[184] = 3
MAX[185] = 3
MAX[186] = 3
MAX[187] = 3
MAX[188] = 3
MAX[189] = 3
MAX[190] = 3
MAX[191] = 3
MAX[192] = 3
MAX[193] = 3
MAX[194] = 3
MAX[195] = 3
MAX[196] = 3
MAX[197] = 3
MAX[198] = 3
MAX[199] = 3
MAX[200] = 3
MAX[201] = 3
MAX[202] = 3
MAX[203] = 3
MAX[204] = 3
MAX[205] = 3
MAX[206] = 3
MAX[207] = 3
MAX[208] = 3
MAX[209] = 3
MAX[210] = 3
MAX[211] = 3
MAX[212] = 3
MAX[213] = 3
MAX[214] = 3
MAX[215] = 3
MAX[216] = 3
MAX[217] = 3
MAX[218] = 3
MAX[219] = 3
MAX[220] = 3
MAX[221] = 3
MAX[222] = 3
MAX[223] = 3
MAX[224] = 3
MAX[225] = 3
MAX[226] = 3
MAX[227] = 3
MAX[228] = 3
MAX[229] = 3
MAX[230] = 3
MAX[231] = 3
MAX[232] = 3
MAX[233] = 3
MAX[234] = 3
MAX[235] = 3
MAX[236] = 3
MAX[237] = 3
MAX[238] = 3
MAX[239] = 3
MAX[240] = 3
MAX[241] = 3
MAX[242] = 3
MAX[243] = 3
MAX[244] = 3
MAX[245] = 3
MAX[246] = 3
MAX[247] = 3
MAX[248] = 3
MAX[249] = 3
MAX[250] = 3
MAX[251] = 3
MAX[252] = 3
MAX[253] = 3
MAX[254] = 3
MAX[255] = 3
MAX[256] = 3
MAX[257] = 3
MAX[258] = 3
MAX[259] = 3
MAX[260] = 3
### 相性設定 ##################################################################
# 5段階で各アクターと各精霊の相性を設定できます。
#---------------------------------------------------
# 5 : 非常に良い(能力上昇:1.5倍)
# 4 : やや良い (能力上昇:1.2倍)
# 3 : 普通 (能力上昇:1.0倍)
# 2 : やや悪い (能力上昇:0.8倍)
# 1 : 非常に悪い(能力上昇:0.5倍)
# 0 : パートナーにできない
#---------------------------------------------------
# [アクターID] = {精霊ID=>相性, …}
#AFNTY[1] = {1=>3, 2=>2, 3=>5, 4=>1}
#AFNTY[2] = {1=>3, 2=>3, 3=>1, 4=>5}
#AFNTY[3] = {1=>1, 2=>5, 3=>3, 4=>4}
#AFNTY[4] = {1=>5, 2=>1, 3=>3, 4=>4}
# AFNTY[8] = {0=>0} # 全ての精霊をパートナーにできない
### 精霊レベル設定 ############################################################
# レベル上昇あり
USE_LV = true
# 経験値入手対象
# 0 : 戦闘メンバーのパートナーとなっている精霊のみ
# 1 : 全メンバーのパートナーとなっている精霊のみ
# 2 : 全精霊
EXP_TARGET = 2
# 経験値入出種別
# 0 : 戦闘回数でLvUP
# 1 : アクターと同じEXP
EXP_TYPE = 1
### 閾値設定 ##################################################################
# 各能力の閾値設定
# 追加パラメータ = データベース上のパラメータ - PRM_BASE
PRM_BASE = [
0, # 最大HP
0, # 最大MP
0, # 攻撃力
0, # 防御力
0, # 魔法力
0, # 魔法防御
0, # 敏捷性
0 # 運
]
### ステータス画面表示設定 ####################################################
# 特徴ステータス表示と表示順序(上から順)
STS = {
:status => true, # ステータス表示(LVあり用)
:stskl => true, # ステータス表示(LVなし用)
:skills => true, # 習得スキル
:feater => true # 特徴
}
### 入替え画面表示設定 ########################################################
# 特徴ステータス表示と表示順序(上から順)
SHOW_ST = {
:text => false, # 解説
:status => true, # 能力パラメータ
:skills => true, # 習得スキル
:rate => false, # 耐性(属性有効度, 弱体有効度, ステート有効度, ステート無効化)
:param => false,#false, # 能力値(通常. 追加, 特殊)
:attack => false, # 攻撃(属性、ステート, 速度補正, 追加回数)
:skill => false, # スキル(タイプ追加・封印, 追加・封印)
:equip => false, # 装備(武器タイプ, 防具タイプ, 固定, 封印, スロットタイプ)
:other => false # その他(行動回数追加, 特殊フラグ, パーティ能力)
}
# スキル表示時の列数(1-2)
SKILL_NUM = 2
end
#============================================================================== # ■ VXAce-RGSS3-38 精霊システム <入替画面> by Claimh #============================================================================== #============================================================================== # ■ Window_MenuCommand #============================================================================== class Window_MenuCommand < Window_Command #-------------------------------------------------------------------------- # ● 独自コマンドの追加用 #-------------------------------------------------------------------------- alias add_original_commands_partner add_original_commands def add_original_commands add_original_commands_partner add_command("部下", :partner, partner_enable?) # if $game_switches[1] end #-------------------------------------------------------------------------- # ● コマンド追加?[パートナー設定] #-------------------------------------------------------------------------- def add_spirits? $game_party.members.size > 0 and $game_party.spirit_num > 0 #and $game_switches[1] end #-------------------------------------------------------------------------- # ● コマンド可能?[パートナー設定] #-------------------------------------------------------------------------- def partner_enable? $game_party.spirit_num > 0 # and $game_switches[1] end end #============================================================================== # ■ Scene_Menu #============================================================================== class Scene_Menu < Scene_MenuBase #-------------------------------------------------------------------------- # ● コマンドウィンドウの作成 #-------------------------------------------------------------------------- alias create_command_window_partner create_command_window def create_command_window create_command_window_partner @command_window.set_handler(:partner, method(:command_personal)) end #-------------------------------------------------------------------------- # ● コマンド[パートナー設定] #-------------------------------------------------------------------------- def command_partner SceneManager.call(Scene_EditPartner) end #-------------------------------------------------------------------------- # ● 個人コマンド[決定] #-------------------------------------------------------------------------- alias on_personal_ok_partner on_personal_ok def on_personal_ok if @command_window.current_symbol == :partner command_partner else on_personal_ok_partner end end end #============================================================================== # ■ Window_SptActor #============================================================================== class Window_SptActor < Window_Base attr_accessor :index # 入れ替え対象index #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(actor) @actor = actor @spirit = nil @index = 0 @diff_on = false super(0, 0, Graphics.width, fitting_height(9)) refresh end #-------------------------------------------------------------------------- # ● 描画エリア #-------------------------------------------------------------------------- def redraw_area Rect.new(100, line_height, 150, contents.height - line_height) end #-------------------------------------------------------------------------- # ● 差分描画on/off #-------------------------------------------------------------------------- def diff_on @diff_on = true part_refresh end def diff_off @diff_on = false @spirit = nil part_refresh end #-------------------------------------------------------------------------- # ● アクター設定 #-------------------------------------------------------------------------- def actor=(a) return if @actor == a @actor = a @spirit = nil refresh end #-------------------------------------------------------------------------- # ● 精霊設定 #-------------------------------------------------------------------------- def spirit=(s) return if @spirit == s @spirit = s part_refresh end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh contents.clear return if @actor.nil? draw_actor_name(@actor, 0, 0) draw_actor_face(@actor, 140, 0) draw_status_vocab part_refresh(false) change_color(system_color) draw_text(contents_width - 200, 0, 200, line_height, "部下") end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def part_refresh(clear=true) contents.fill_rect(redraw_area, Color.new(0,0,0,0)) if clear return if @actor.nil? draw_actor_status end #-------------------------------------------------------------------------- # ● 顔グラフィックの描画 # enabled : 有効フラグ。false のとき半透明で描画 #-------------------------------------------------------------------------- def draw_face(face_name, face_index, x, y, enabled = true) bitmap = Cache.face(face_name) h = line_height hh = (96 - h) / 2 rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96 + hh, 96, h) contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha) bitmap.dispose end #-------------------------------------------------------------------------- # ● ステータス描画 #-------------------------------------------------------------------------- def draw_status_vocab 8.times do |i| draw_param_vocab(20, i * line_height + line_height, i) end end #-------------------------------------------------------------------------- # ● パラメータVcab描画 #-------------------------------------------------------------------------- def draw_param_vocab(x, y, param_id) change_color(system_color) draw_text(x, y, 120, line_height, Vocab::param(param_id)) end #-------------------------------------------------------------------------- # ● ステータス描画 #-------------------------------------------------------------------------- def draw_actor_status 8.times do |i| draw_actor_param(@actor, @spirit, 10, i * line_height + line_height, i, 300) end end #-------------------------------------------------------------------------- # ● パラメータ描画 #-------------------------------------------------------------------------- def draw_actor_param(actor, spirit, x, y, param_id, width) now = actor.param(param_id) change_color(normal_color) draw_text(x+90, y, 60, line_height, now, 2) return if !@diff_on or (spirit.nil? and @actor.partners[@index].nil?) # 差分描画 draw_actor_new_param(actor, spirit, x, y, param_id, width) end #-------------------------------------------------------------------------- # ● パラメータ描画 #-------------------------------------------------------------------------- def draw_actor_new_param(actor, spirit, x, y, param_id, width) now = actor.param(param_id) spirit_id = spirit.nil? ? 0 : spirit.spirit_id new = @actor.v_chg_param(spirit_id, @index, param_id) change_color(system_color) draw_text(x+150, y, 32, line_height, "→") change_color(param_change_color(new - now)) draw_text(x+170, y, 60, line_height, new, 2) end end #============================================================================== # ■ Window_SptListBase #============================================================================== class Window_SptListBase < Window_Selectable attr_accessor :info_window # help_window2 #-------------------------------------------------------------------------- # ● ウィンドウのアクティブ化 #-------------------------------------------------------------------------- def activate select(0) if @index < 0 super end #-------------------------------------------------------------------------- # ● アイテムの取得 #-------------------------------------------------------------------------- def item i_item(index) end #-------------------------------------------------------------------------- # ● アイテムの取得 #-------------------------------------------------------------------------- def i_item(index) @data && index >= 0 ? @data[index] : nil end #-------------------------------------------------------------------------- # ● 選択項目の有効状態を取得 #-------------------------------------------------------------------------- def current_item_enabled? enable?(item) end #-------------------------------------------------------------------------- # ● 許可状態で表示するかどうか #-------------------------------------------------------------------------- def enable?(item) item.nil? end #-------------------------------------------------------------------------- # ● 項目の描画 #-------------------------------------------------------------------------- def draw_item(index) item = i_item(index) rect = item_rect(index) if item enabled = enable?(item) rect.x += draw_actor_line_graphic(item, rect.x, rect.y, enabled) draw_spirit_name(item, rect.x, rect.y, enabled) else draw_empty_text(rect) end end #-------------------------------------------------------------------------- # ● 空項目の描画 #-------------------------------------------------------------------------- def draw_empty_text(rect) end #-------------------------------------------------------------------------- # ● アクター設定 #-------------------------------------------------------------------------- def actor=(a) return if @actor == a @actor = a data_refresh end #-------------------------------------------------------------------------- # ● カーソルを右に移動 #-------------------------------------------------------------------------- def cursor_right(wrap = false) @help_window.next_page end #-------------------------------------------------------------------------- # ● カーソルを左に移動 #-------------------------------------------------------------------------- def cursor_left(wrap = false) @help_window.prev_page end end #============================================================================== # ■ Window_SptPartner #============================================================================== class Window_SptPartner < Window_SptListBase #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, height, actor) @actor = actor @data = actor.partners y = line_height super(x, y, Graphics.width - x, height - y) self.z += 10 self.opacity = 0 refresh end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def data_refresh @data = @actor.partners refresh end #-------------------------------------------------------------------------- # ● 項目数の取得 #-------------------------------------------------------------------------- def item_max @actor.max_spirits end #-------------------------------------------------------------------------- # ● 許可状態で表示するかどうか #-------------------------------------------------------------------------- def enable?(item) return false if item_max == 0 super(item) or !item.partner_locked end #-------------------------------------------------------------------------- # ● 空項目の描画 #-------------------------------------------------------------------------- def draw_empty_text(rect) draw_text(rect.x, rect.y, contents_width-8, line_height, "-- 空缺 --", 1) end #-------------------------------------------------------------------------- # ● ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help @help_window.spirit = item @info_window.index = @index unless @info_window.nil? end end #============================================================================== # ■ Window_SptSpiritList #============================================================================== class Window_SptSpiritList < Window_SptListBase #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y, actor) @actor = actor @data = $game_party.spirit_stay_members + [nil] super(x, y, Graphics.width - x, Graphics.height - y) refresh end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def data_refresh @data = $game_party.spirit_stay_members + [nil] refresh end #-------------------------------------------------------------------------- # ● 項目数の取得 #-------------------------------------------------------------------------- def item_max (@data ? @data.size : 0) end #-------------------------------------------------------------------------- # ● 許可状態で表示するかどうか #-------------------------------------------------------------------------- def enable?(item) super(item) or @actor.can_partner(item.spirit_id) end #-------------------------------------------------------------------------- # ● ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help @help_window.spirit = item @info_window.spirit = item unless @info_window.nil? end end #============================================================================== # ■ Window_SptSpirit #============================================================================== class Window_SptSpirit < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(y, width) @spirit = nil @page = 0 @data = Spirits.status @max = @data.size @skill_start = @data.index(:skills) super(0, y, width, Graphics.height - y) refresh end #-------------------------------------------------------------------------- # ● 1ページに表示するスキル数 #-------------------------------------------------------------------------- def page_skills ((contents.height - (line_height * 2)) / line_height) * sr end def sr Spirits::SKILL_NUM end #-------------------------------------------------------------------------- # ● ページ切り替え #-------------------------------------------------------------------------- def page=(n) @page = [0, [@max-1, n].min].max refresh end def next_page self.page = @page + 1 end def prev_page self.page = @page - 1 end #-------------------------------------------------------------------------- # ● ウィンドウ内容の幅を計算 #-------------------------------------------------------------------------- def contents_width super + (@spirit.nil? ? 0 : 10) end #-------------------------------------------------------------------------- # ● 精霊設定 #-------------------------------------------------------------------------- def spirit=(s) return if @spirit == s @spirit = s is_skill = @data[@page] == :skills data_refresh refresh self.page = @data.index(:skills) if is_skill end #-------------------------------------------------------------------------- # ● データリフレッシュ #-------------------------------------------------------------------------- def data_refresh @data = Spirits.status @skill_start = @data.index(:skills) unless @spirit.nil? n = @spirit.skills.size if n > page_skills (n / page_skills).times {|i| @data.insert(@skill_start, :skills) } end end @max = @data.size end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh contents_width != contents.width ? create_contents : contents.clear self.ox = 0 return if @spirit.nil? self.ox = (@page == 0 ? 0 : (@page == (@max-1) ? 10 : 5)) draw_spirit_name(@spirit, self.ox, 0) draw_actor_level(@spirit, self.ox + 170, 0) if Spirits::USE_LV draw_actor_face(@spirit, self.ox + contents_width - 100, 0) case @data[@page] when :text # description draw_actor_nickname(@spirit, self.ox + 100, line_height) draw_text_ex(self.ox, line_height * 2, @spirit.description) when :status # status draw_actor_status when :skills # skill i = @page - @skill_start n = page_skills draw_actor_skills(@spirit.skills[i*n, n]) else # feature draw_feature_status end end #-------------------------------------------------------------------------- # ● 顔グラフィックの描画 # enabled : 有効フラグ。false のとき半透明で描画 #-------------------------------------------------------------------------- def draw_face(face_name, face_index, x, y, enabled = true) bitmap = Cache.face(face_name) h = line_height * 2 hh = (96 - h) / 2 rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96 + hh, 96, h) contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha) bitmap.dispose end #-------------------------------------------------------------------------- # ● 能力値の描画 #-------------------------------------------------------------------------- def draw_actor_status change_color(system_color) draw_text(self.ox, line_height, 100, line_height, "部下实力") change_color(normal_color) 8.times do |i| x = self.ox + i % 2 * contents_width / 2 y = i / 2 * line_height + line_height * 2 draw_spirit_param(@spirit, x, y, i) end end #-------------------------------------------------------------------------- # ● スキルの描画 #-------------------------------------------------------------------------- def draw_actor_skills(skills) change_color(system_color) draw_text(self.ox, line_height, 100, line_height, "计谋战技") change_color(normal_color) skills.each_with_index do |skill, i| x = self.ox + i % sr * contents_width / sr y = i / sr * line_height + line_height * 2 draw_item_name(skill, x, y) end end #-------------------------------------------------------------------------- # ● 特徴の描画 #-------------------------------------------------------------------------- def draw_feature_status ft = Spirits::Features.new(@spirit) case @data[@page] when :rate; draw_feature_rate(ft) when :param; draw_feature_param(ft) when :attack; draw_feature_attack(ft) when :skill; draw_feature_skill(ft) when :equip; draw_feature_equip(ft) when :other; draw_feature_other(ft) end end #-------------------------------------------------------------------------- # ● 特徴テキストの描画 #-------------------------------------------------------------------------- def draw_feature_text(features, x, y, w=contents_width, col_max=2) features.each_with_index do |ft, i| ww = w / col_max xx = x + i % col_max * ww yy = y + i / col_max * line_height draw_text(xx, yy, ww, line_height, ft[0]) draw_text(xx, yy, ww, line_height, ft[1], 2) unless ft[1].nil? end end #-------------------------------------------------------------------------- # ● 特徴:耐性の描画 #-------------------------------------------------------------------------- def draw_feature_rate(ft) change_color(system_color) draw_text(self.ox, line_height, 100, line_height, "耐性") change_color(normal_color) draw_feature_text(ft.rate, self.ox, line_height * 2) end #-------------------------------------------------------------------------- # ● 特徴:能力の描画 #-------------------------------------------------------------------------- def draw_feature_param(ft) change_color(system_color) draw_text(self.ox, line_height, 100, line_height, "能力特性") change_color(normal_color) draw_feature_text(ft.param, self.ox, line_height * 2) end #-------------------------------------------------------------------------- # ● 特徴:攻撃の描画 #-------------------------------------------------------------------------- def draw_feature_attack(ft) change_color(system_color) draw_text(self.ox, line_height, 100, line_height, "攻击特性") change_color(normal_color) draw_feature_text(ft.attack, self.ox, line_height * 2) end #-------------------------------------------------------------------------- # ● 特徴:スキルの描画 #-------------------------------------------------------------------------- def draw_feature_skill(ft) change_color(system_color) draw_text(self.ox, line_height, 100, line_height, "技能特性") change_color(normal_color) draw_feature_text(ft.skill, self.ox, line_height * 2) end #-------------------------------------------------------------------------- # ● 特徴:装備の描画 #-------------------------------------------------------------------------- def draw_feature_equip(ft) change_color(system_color) draw_text(self.ox, line_height, 100, line_height, "装备特性") change_color(normal_color) draw_feature_text(ft.equip, self.ox, line_height * 2) end #-------------------------------------------------------------------------- # ● 特徴:その他の描画 #-------------------------------------------------------------------------- def draw_feature_other(ft) change_color(system_color) draw_text(self.ox, line_height, 100, line_height, "特性") change_color(normal_color) draw_feature_text(ft.other, self.ox, line_height * 2) end end #============================================================================== # ■ Scene_EditPartner #============================================================================== class Scene_EditPartner < Scene_MenuBase #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- def start super create_actor_window create_partner_window create_sptlist_window create_spirit_window @sptlist_window.info_window = @actor_window @sptlist_window.help_window = @spirit_window @partner_window.info_window = @actor_window @partner_window.help_window = @spirit_window end #-------------------------------------------------------------------------- # ● アクターウィンドウ作成 #-------------------------------------------------------------------------- def create_actor_window @actor_window = Window_SptActor.new(@actor) end #-------------------------------------------------------------------------- # ● パートナーリストウィンドウ作成 #-------------------------------------------------------------------------- def create_partner_window @partner_window = Window_SptPartner.new(@actor_window.width-200, @actor_window.height, @actor) @partner_window.set_handler(:ok, method(:partner_ok)) @partner_window.set_handler(:cancel, method(:return_scene)) @partner_window.set_handler(:pagedown, method(:next_actor)) @partner_window.set_handler(:pageup, method(:prev_actor)) @partner_window.activate end #-------------------------------------------------------------------------- # ● パートナーウィンドウ : OK #-------------------------------------------------------------------------- def partner_ok @actor_window.diff_on @sptlist_window.activate end #-------------------------------------------------------------------------- # ● 精霊リストウィンドウ作成 #-------------------------------------------------------------------------- def create_sptlist_window @sptlist_window = Window_SptSpiritList.new(@partner_window.x, @actor_window.height, @actor) @sptlist_window.set_handler(:ok, method(:sptlist_ok)) @sptlist_window.set_handler(:cancel, method(:sptlist_cancel)) end #-------------------------------------------------------------------------- # ● 精霊リストウィンドウ : OK #-------------------------------------------------------------------------- def sptlist_ok if @sptlist_window.item.nil? unless @partner_window.item.nil? @actor.change_partner(0, @partner_window.index) end else @actor.change_partner(@sptlist_window.item.spirit_id, @partner_window.index) @sptlist_window.item.change_partner(@actor.id) end unless @partner_window.item.nil? @partner_window.item.change_partner(0) end @sptlist_window.data_refresh @partner_window.data_refresh @partner_window.activate @actor_window.diff_off end #-------------------------------------------------------------------------- # ● 精霊リストウィンドウ : Cancel #-------------------------------------------------------------------------- def sptlist_cancel @partner_window.activate @actor_window.diff_off end #-------------------------------------------------------------------------- # ● 精霊ウィンドウ作成 #-------------------------------------------------------------------------- def create_spirit_window @spirit_window = Window_SptSpirit.new(@actor_window.height, @partner_window.x) end #-------------------------------------------------------------------------- # ● アクターの切り替え #-------------------------------------------------------------------------- def on_actor_change @actor_window.actor = @actor @partner_window.actor = @actor @sptlist_window.actor = @actor @partner_window.select(0) @sptlist_window.select(0) @partner_window.activate end end
#==============================================================================
# ■ VXAce-RGSS3-38 精霊システム <入替画面> by Claimh
#==============================================================================
#==============================================================================
# ■ Window_MenuCommand
#==============================================================================
class Window_MenuCommand < Window_Command
#--------------------------------------------------------------------------
# ● 独自コマンドの追加用
#--------------------------------------------------------------------------
alias add_original_commands_partner add_original_commands
def add_original_commands
add_original_commands_partner
add_command("部下", :partner, partner_enable?) # if $game_switches[1]
end
#--------------------------------------------------------------------------
# ● コマンド追加?[パートナー設定]
#--------------------------------------------------------------------------
def add_spirits?
$game_party.members.size > 0 and $game_party.spirit_num > 0 #and $game_switches[1]
end
#--------------------------------------------------------------------------
# ● コマンド可能?[パートナー設定]
#--------------------------------------------------------------------------
def partner_enable?
$game_party.spirit_num > 0 # and $game_switches[1]
end
end
#==============================================================================
# ■ Scene_Menu
#==============================================================================
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# ● コマンドウィンドウの作成
#--------------------------------------------------------------------------
alias create_command_window_partner create_command_window
def create_command_window
create_command_window_partner
@command_window.set_handler(:partner, method(:command_personal))
end
#--------------------------------------------------------------------------
# ● コマンド[パートナー設定]
#--------------------------------------------------------------------------
def command_partner
SceneManager.call(Scene_EditPartner)
end
#--------------------------------------------------------------------------
# ● 個人コマンド[決定]
#--------------------------------------------------------------------------
alias on_personal_ok_partner on_personal_ok
def on_personal_ok
if @command_window.current_symbol == :partner
command_partner
else
on_personal_ok_partner
end
end
end
#==============================================================================
# ■ Window_SptActor
#==============================================================================
class Window_SptActor < Window_Base
attr_accessor :index # 入れ替え対象index
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(actor)
@actor = actor
@spirit = nil
@index = 0
@diff_on = false
super(0, 0, Graphics.width, fitting_height(9))
refresh
end
#--------------------------------------------------------------------------
# ● 描画エリア
#--------------------------------------------------------------------------
def redraw_area
Rect.new(100, line_height, 150, contents.height - line_height)
end
#--------------------------------------------------------------------------
# ● 差分描画on/off
#--------------------------------------------------------------------------
def diff_on
@diff_on = true
part_refresh
end
def diff_off
@diff_on = false
@spirit = nil
part_refresh
end
#--------------------------------------------------------------------------
# ● アクター設定
#--------------------------------------------------------------------------
def actor=(a)
return if @actor == a
@actor = a
@spirit = nil
refresh
end
#--------------------------------------------------------------------------
# ● 精霊設定
#--------------------------------------------------------------------------
def spirit=(s)
return if @spirit == s
@spirit = s
part_refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents.clear
return if @actor.nil?
draw_actor_name(@actor, 0, 0)
draw_actor_face(@actor, 140, 0)
draw_status_vocab
part_refresh(false)
change_color(system_color)
draw_text(contents_width - 200, 0, 200, line_height, "部下")
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def part_refresh(clear=true)
contents.fill_rect(redraw_area, Color.new(0,0,0,0)) if clear
return if @actor.nil?
draw_actor_status
end
#--------------------------------------------------------------------------
# ● 顔グラフィックの描画
# enabled : 有効フラグ。false のとき半透明で描画
#--------------------------------------------------------------------------
def draw_face(face_name, face_index, x, y, enabled = true)
bitmap = Cache.face(face_name)
h = line_height
hh = (96 - h) / 2
rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96 + hh, 96, h)
contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
bitmap.dispose
end
#--------------------------------------------------------------------------
# ● ステータス描画
#--------------------------------------------------------------------------
def draw_status_vocab
8.times do |i|
draw_param_vocab(20, i * line_height + line_height, i)
end
end
#--------------------------------------------------------------------------
# ● パラメータVcab描画
#--------------------------------------------------------------------------
def draw_param_vocab(x, y, param_id)
change_color(system_color)
draw_text(x, y, 120, line_height, Vocab::param(param_id))
end
#--------------------------------------------------------------------------
# ● ステータス描画
#--------------------------------------------------------------------------
def draw_actor_status
8.times do |i|
draw_actor_param(@actor, @spirit, 10, i * line_height + line_height, i, 300)
end
end
#--------------------------------------------------------------------------
# ● パラメータ描画
#--------------------------------------------------------------------------
def draw_actor_param(actor, spirit, x, y, param_id, width)
now = actor.param(param_id)
change_color(normal_color)
draw_text(x+90, y, 60, line_height, now, 2)
return if !@diff_on or (spirit.nil? and @actor.partners[@index].nil?)
# 差分描画
draw_actor_new_param(actor, spirit, x, y, param_id, width)
end
#--------------------------------------------------------------------------
# ● パラメータ描画
#--------------------------------------------------------------------------
def draw_actor_new_param(actor, spirit, x, y, param_id, width)
now = actor.param(param_id)
spirit_id = spirit.nil? ? 0 : spirit.spirit_id
new = @actor.v_chg_param(spirit_id, @index, param_id)
change_color(system_color)
draw_text(x+150, y, 32, line_height, "→")
change_color(param_change_color(new - now))
draw_text(x+170, y, 60, line_height, new, 2)
end
end
#==============================================================================
# ■ Window_SptListBase
#==============================================================================
class Window_SptListBase < Window_Selectable
attr_accessor :info_window # help_window2
#--------------------------------------------------------------------------
# ● ウィンドウのアクティブ化
#--------------------------------------------------------------------------
def activate
select(0) if @index < 0
super
end
#--------------------------------------------------------------------------
# ● アイテムの取得
#--------------------------------------------------------------------------
def item
i_item(index)
end
#--------------------------------------------------------------------------
# ● アイテムの取得
#--------------------------------------------------------------------------
def i_item(index)
@data && index >= 0 ? @data[index] : nil
end
#--------------------------------------------------------------------------
# ● 選択項目の有効状態を取得
#--------------------------------------------------------------------------
def current_item_enabled?
enable?(item)
end
#--------------------------------------------------------------------------
# ● 許可状態で表示するかどうか
#--------------------------------------------------------------------------
def enable?(item)
item.nil?
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(index)
item = i_item(index)
rect = item_rect(index)
if item
enabled = enable?(item)
rect.x += draw_actor_line_graphic(item, rect.x, rect.y, enabled)
draw_spirit_name(item, rect.x, rect.y, enabled)
else
draw_empty_text(rect)
end
end
#--------------------------------------------------------------------------
# ● 空項目の描画
#--------------------------------------------------------------------------
def draw_empty_text(rect)
end
#--------------------------------------------------------------------------
# ● アクター設定
#--------------------------------------------------------------------------
def actor=(a)
return if @actor == a
@actor = a
data_refresh
end
#--------------------------------------------------------------------------
# ● カーソルを右に移動
#--------------------------------------------------------------------------
def cursor_right(wrap = false)
@help_window.next_page
end
#--------------------------------------------------------------------------
# ● カーソルを左に移動
#--------------------------------------------------------------------------
def cursor_left(wrap = false)
@help_window.prev_page
end
end
#==============================================================================
# ■ Window_SptPartner
#==============================================================================
class Window_SptPartner < Window_SptListBase
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(x, height, actor)
@actor = actor
@data = actor.partners
y = line_height
super(x, y, Graphics.width - x, height - y)
self.z += 10
self.opacity = 0
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def data_refresh
@data = @actor.partners
refresh
end
#--------------------------------------------------------------------------
# ● 項目数の取得
#--------------------------------------------------------------------------
def item_max
@actor.max_spirits
end
#--------------------------------------------------------------------------
# ● 許可状態で表示するかどうか
#--------------------------------------------------------------------------
def enable?(item)
return false if item_max == 0
super(item) or !item.partner_locked
end
#--------------------------------------------------------------------------
# ● 空項目の描画
#--------------------------------------------------------------------------
def draw_empty_text(rect)
draw_text(rect.x, rect.y, contents_width-8, line_height, "-- 空缺 --", 1)
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.spirit = item
@info_window.index = @index unless @info_window.nil?
end
end
#==============================================================================
# ■ Window_SptSpiritList
#==============================================================================
class Window_SptSpiritList < Window_SptListBase
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(x, y, actor)
@actor = actor
@data = $game_party.spirit_stay_members + [nil]
super(x, y, Graphics.width - x, Graphics.height - y)
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def data_refresh
@data = $game_party.spirit_stay_members + [nil]
refresh
end
#--------------------------------------------------------------------------
# ● 項目数の取得
#--------------------------------------------------------------------------
def item_max
(@data ? @data.size : 0)
end
#--------------------------------------------------------------------------
# ● 許可状態で表示するかどうか
#--------------------------------------------------------------------------
def enable?(item)
super(item) or @actor.can_partner(item.spirit_id)
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.spirit = item
@info_window.spirit = item unless @info_window.nil?
end
end
#==============================================================================
# ■ Window_SptSpirit
#==============================================================================
class Window_SptSpirit < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(y, width)
@spirit = nil
@page = 0
@data = Spirits.status
@max = @data.size
@skill_start = @data.index(:skills)
super(0, y, width, Graphics.height - y)
refresh
end
#--------------------------------------------------------------------------
# ● 1ページに表示するスキル数
#--------------------------------------------------------------------------
def page_skills
((contents.height - (line_height * 2)) / line_height) * sr
end
def sr
Spirits::SKILL_NUM
end
#--------------------------------------------------------------------------
# ● ページ切り替え
#--------------------------------------------------------------------------
def page=(n)
@page = [0, [@max-1, n].min].max
refresh
end
def next_page
self.page = @page + 1
end
def prev_page
self.page = @page - 1
end
#--------------------------------------------------------------------------
# ● ウィンドウ内容の幅を計算
#--------------------------------------------------------------------------
def contents_width
super + (@spirit.nil? ? 0 : 10)
end
#--------------------------------------------------------------------------
# ● 精霊設定
#--------------------------------------------------------------------------
def spirit=(s)
return if @spirit == s
@spirit = s
is_skill = @data[@page] == :skills
data_refresh
refresh
self.page = @data.index(:skills) if is_skill
end
#--------------------------------------------------------------------------
# ● データリフレッシュ
#--------------------------------------------------------------------------
def data_refresh
@data = Spirits.status
@skill_start = @data.index(:skills)
unless @spirit.nil?
n = @spirit.skills.size
if n > page_skills
(n / page_skills).times {|i| @data.insert(@skill_start, :skills) }
end
end
@max = @data.size
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents_width != contents.width ? create_contents : contents.clear
self.ox = 0
return if @spirit.nil?
self.ox = (@page == 0 ? 0 : (@page == (@max-1) ? 10 : 5))
draw_spirit_name(@spirit, self.ox, 0)
draw_actor_level(@spirit, self.ox + 170, 0) if Spirits::USE_LV
draw_actor_face(@spirit, self.ox + contents_width - 100, 0)
case @data[@page]
when :text # description
draw_actor_nickname(@spirit, self.ox + 100, line_height)
draw_text_ex(self.ox, line_height * 2, @spirit.description)
when :status # status
draw_actor_status
when :skills # skill
i = @page - @skill_start
n = page_skills
draw_actor_skills(@spirit.skills[i*n, n])
else # feature
draw_feature_status
end
end
#--------------------------------------------------------------------------
# ● 顔グラフィックの描画
# enabled : 有効フラグ。false のとき半透明で描画
#--------------------------------------------------------------------------
def draw_face(face_name, face_index, x, y, enabled = true)
bitmap = Cache.face(face_name)
h = line_height * 2
hh = (96 - h) / 2
rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96 + hh, 96, h)
contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
bitmap.dispose
end
#--------------------------------------------------------------------------
# ● 能力値の描画
#--------------------------------------------------------------------------
def draw_actor_status
change_color(system_color)
draw_text(self.ox, line_height, 100, line_height, "部下实力")
change_color(normal_color)
8.times do |i|
x = self.ox + i % 2 * contents_width / 2
y = i / 2 * line_height + line_height * 2
draw_spirit_param(@spirit, x, y, i)
end
end
#--------------------------------------------------------------------------
# ● スキルの描画
#--------------------------------------------------------------------------
def draw_actor_skills(skills)
change_color(system_color)
draw_text(self.ox, line_height, 100, line_height, "计谋战技")
change_color(normal_color)
skills.each_with_index do |skill, i|
x = self.ox + i % sr * contents_width / sr
y = i / sr * line_height + line_height * 2
draw_item_name(skill, x, y)
end
end
#--------------------------------------------------------------------------
# ● 特徴の描画
#--------------------------------------------------------------------------
def draw_feature_status
ft = Spirits::Features.new(@spirit)
case @data[@page]
when :rate; draw_feature_rate(ft)
when :param; draw_feature_param(ft)
when :attack; draw_feature_attack(ft)
when :skill; draw_feature_skill(ft)
when :equip; draw_feature_equip(ft)
when :other; draw_feature_other(ft)
end
end
#--------------------------------------------------------------------------
# ● 特徴テキストの描画
#--------------------------------------------------------------------------
def draw_feature_text(features, x, y, w=contents_width, col_max=2)
features.each_with_index do |ft, i|
ww = w / col_max
xx = x + i % col_max * ww
yy = y + i / col_max * line_height
draw_text(xx, yy, ww, line_height, ft[0])
draw_text(xx, yy, ww, line_height, ft[1], 2) unless ft[1].nil?
end
end
#--------------------------------------------------------------------------
# ● 特徴:耐性の描画
#--------------------------------------------------------------------------
def draw_feature_rate(ft)
change_color(system_color)
draw_text(self.ox, line_height, 100, line_height, "耐性")
change_color(normal_color)
draw_feature_text(ft.rate, self.ox, line_height * 2)
end
#--------------------------------------------------------------------------
# ● 特徴:能力の描画
#--------------------------------------------------------------------------
def draw_feature_param(ft)
change_color(system_color)
draw_text(self.ox, line_height, 100, line_height, "能力特性")
change_color(normal_color)
draw_feature_text(ft.param, self.ox, line_height * 2)
end
#--------------------------------------------------------------------------
# ● 特徴:攻撃の描画
#--------------------------------------------------------------------------
def draw_feature_attack(ft)
change_color(system_color)
draw_text(self.ox, line_height, 100, line_height, "攻击特性")
change_color(normal_color)
draw_feature_text(ft.attack, self.ox, line_height * 2)
end
#--------------------------------------------------------------------------
# ● 特徴:スキルの描画
#--------------------------------------------------------------------------
def draw_feature_skill(ft)
change_color(system_color)
draw_text(self.ox, line_height, 100, line_height, "技能特性")
change_color(normal_color)
draw_feature_text(ft.skill, self.ox, line_height * 2)
end
#--------------------------------------------------------------------------
# ● 特徴:装備の描画
#--------------------------------------------------------------------------
def draw_feature_equip(ft)
change_color(system_color)
draw_text(self.ox, line_height, 100, line_height, "装备特性")
change_color(normal_color)
draw_feature_text(ft.equip, self.ox, line_height * 2)
end
#--------------------------------------------------------------------------
# ● 特徴:その他の描画
#--------------------------------------------------------------------------
def draw_feature_other(ft)
change_color(system_color)
draw_text(self.ox, line_height, 100, line_height, "特性")
change_color(normal_color)
draw_feature_text(ft.other, self.ox, line_height * 2)
end
end
#==============================================================================
# ■ Scene_EditPartner
#==============================================================================
class Scene_EditPartner < Scene_MenuBase
#--------------------------------------------------------------------------
# ● 開始処理
#--------------------------------------------------------------------------
def start
super
create_actor_window
create_partner_window
create_sptlist_window
create_spirit_window
@sptlist_window.info_window = @actor_window
@sptlist_window.help_window = @spirit_window
@partner_window.info_window = @actor_window
@partner_window.help_window = @spirit_window
end
#--------------------------------------------------------------------------
# ● アクターウィンドウ作成
#--------------------------------------------------------------------------
def create_actor_window
@actor_window = Window_SptActor.new(@actor)
end
#--------------------------------------------------------------------------
# ● パートナーリストウィンドウ作成
#--------------------------------------------------------------------------
def create_partner_window
@partner_window = Window_SptPartner.new(@actor_window.width-200, @actor_window.height, @actor)
@partner_window.set_handler(:ok, method(:partner_ok))
@partner_window.set_handler(:cancel, method(:return_scene))
@partner_window.set_handler(:pagedown, method(:next_actor))
@partner_window.set_handler(:pageup, method(:prev_actor))
@partner_window.activate
end
#--------------------------------------------------------------------------
# ● パートナーウィンドウ : OK
#--------------------------------------------------------------------------
def partner_ok
@actor_window.diff_on
@sptlist_window.activate
end
#--------------------------------------------------------------------------
# ● 精霊リストウィンドウ作成
#--------------------------------------------------------------------------
def create_sptlist_window
@sptlist_window = Window_SptSpiritList.new(@partner_window.x, @actor_window.height, @actor)
@sptlist_window.set_handler(:ok, method(:sptlist_ok))
@sptlist_window.set_handler(:cancel, method(:sptlist_cancel))
end
#--------------------------------------------------------------------------
# ● 精霊リストウィンドウ : OK
#--------------------------------------------------------------------------
def sptlist_ok
if @sptlist_window.item.nil?
unless @partner_window.item.nil?
@actor.change_partner(0, @partner_window.index)
end
else
@actor.change_partner(@sptlist_window.item.spirit_id, @partner_window.index)
@sptlist_window.item.change_partner(@actor.id)
end
unless @partner_window.item.nil?
@partner_window.item.change_partner(0)
end
@sptlist_window.data_refresh
@partner_window.data_refresh
@partner_window.activate
@actor_window.diff_off
end
#--------------------------------------------------------------------------
# ● 精霊リストウィンドウ : Cancel
#--------------------------------------------------------------------------
def sptlist_cancel
@partner_window.activate
@actor_window.diff_off
end
#--------------------------------------------------------------------------
# ● 精霊ウィンドウ作成
#--------------------------------------------------------------------------
def create_spirit_window
@spirit_window = Window_SptSpirit.new(@actor_window.height, @partner_window.x)
end
#--------------------------------------------------------------------------
# ● アクターの切り替え
#--------------------------------------------------------------------------
def on_actor_change
@actor_window.actor = @actor
@partner_window.actor = @actor
@sptlist_window.actor = @actor
@partner_window.select(0)
@sptlist_window.select(0)
@partner_window.activate
end
end
#============================================================================== # ■ VXAce-RGSS3-38 精霊システム <database> by Claimh #============================================================================== #============================================================================== # ■ Spirits #============================================================================== module Spirits #-------------------------------------------------------------------------- # ● 精霊パートナー化 #-------------------------------------------------------------------------- def self.add_partner(actor_id, spirit_id) return unless $game_party.include_spirit?(spirit_id) return unless $game_actors[actor_id].can_join_partner(spirit_id) s_act_id = self.actor_id(spirit_id) return unless $game_actors[s_act_id].can_join_partner(actor_id) $game_actors[actor_id].add_partner(spirit_id) $game_actors[s_act_id].add_partner(actor_id) end #-------------------------------------------------------------------------- # ● 精霊パートナー解消 #-------------------------------------------------------------------------- def self.remove_partner(actor_id, spirit_id) $game_actors[actor_id].remove_partner(spirit_id) $game_actors[self.actor_id(spirit_id)].remove_partner(actor_id) end #-------------------------------------------------------------------------- # ● 精霊パートナー固定化 #-------------------------------------------------------------------------- def self.lock_partner(spirit_id) spirit = $game_actors[self.actor_id(spirit_id)] return unless spirit.has_partner? spirit.lock_partner end #-------------------------------------------------------------------------- # ● 精霊パートナー固有化解除 #-------------------------------------------------------------------------- def self.unlock_partner(spirit_id) spirit = $game_actors[self.actor_id(spirit_id)] return unless spirit.has_partner? spirit.unlock_partner end #-------------------------------------------------------------------------- # ● 精霊? #-------------------------------------------------------------------------- def self.spirit?(actor_id) SPIRIT_ACTOR.has_value?(actor_id) end #-------------------------------------------------------------------------- # ● 精霊ID => アクターID #-------------------------------------------------------------------------- def self.actor_id(spirit_id) SPIRIT_ACTOR[spirit_id].nil? ? 0 : SPIRIT_ACTOR[spirit_id] end #-------------------------------------------------------------------------- # ● アクターID => 精霊ID #-------------------------------------------------------------------------- def self.spirit_id(actor_id) id = SPIRIT_ACTOR.index(actor_id) id.nil? ? 0 : id end #-------------------------------------------------------------------------- # ● パートナー最大数 #-------------------------------------------------------------------------- def self.max(actor_id) MAX[actor_id].nil? ? MAX[0] : MAX[actor_id] end #-------------------------------------------------------------------------- # ● 相性 #-------------------------------------------------------------------------- def self.affinity(actor_id, spirit_id) if AFNTY[actor_id].nil? return AFNTY[0][0] elsif AFNTY[actor_id][spirit_id].nil? return AFNTY[actor_id][0].nil? ? AFNTY[0][0] : AFNTY[actor_id][0] else return AFNTY[actor_id][spirit_id] end end #-------------------------------------------------------------------------- # ● 相性計算 #-------------------------------------------------------------------------- def self.affinity_param(param, actor_id, spirit_id) prm = [0, 0.5, 0.8, 1.0, 1.2, 1.5] # 相性補正 n = affinity(actor_id, spirit_id) p "[#{actor_id}, #{spirit_id}] => #{n}" if n.nil? (param * prm[affinity(actor_id, spirit_id)]).truncate end #-------------------------------------------------------------------------- # ● 有効ステータス表示 #-------------------------------------------------------------------------- def self.sts STS.select {|key, v| v}.keys end #-------------------------------------------------------------------------- # ● 有効ステータス表示 #-------------------------------------------------------------------------- def self.status SHOW_ST.select {|key, v| v}.keys end end #============================================================================== # ■ Spirits::Features : 特徴情報抽出 #============================================================================== class Spirits::Features #-------------------------------------------------------------------------- # ● 定数(特徴) #-------------------------------------------------------------------------- FEATURE_ELEMENT_RATE = 11 # 属性有効度 FEATURE_DEBUFF_RATE = 12 # 弱体有効度 FEATURE_STATE_RATE = 13 # ステート有効度 FEATURE_STATE_RESIST = 14 # ステート無効化 FEATURE_PARAM = 21 # 通常能力値 FEATURE_XPARAM = 22 # 追加能力値 FEATURE_SPARAM = 23 # 特殊能力値 FEATURE_ATK_ELEMENT = 31 # 攻撃時属性 FEATURE_ATK_STATE = 32 # 攻撃時ステート FEATURE_ATK_SPEED = 33 # 攻撃速度補正 FEATURE_ATK_TIMES = 34 # 攻撃追加回数 FEATURE_STYPE_ADD = 41 # スキルタイプ追加 FEATURE_STYPE_SEAL = 42 # スキルタイプ封印 FEATURE_SKILL_ADD = 43 # スキル追加 FEATURE_SKILL_SEAL = 44 # スキル封印 FEATURE_EQUIP_WTYPE = 51 # 武器タイプ装備 FEATURE_EQUIP_ATYPE = 52 # 防具タイプ装備 FEATURE_EQUIP_FIX = 53 # 装備固定 FEATURE_EQUIP_SEAL = 54 # 装備封印 FEATURE_SLOT_TYPE = 55 # スロットタイプ FEATURE_ACTION_PLUS = 61 # 行動回数追加 FEATURE_SPECIAL_FLAG = 62 # 特殊フラグ FEATURE_COLLAPSE_TYPE = 63 # 消滅エフェクト FEATURE_PARTY_ABILITY = 64 # パーティ能力 #-------------------------------------------------------------------------- # ● パーティ能力定数 #-------------------------------------------------------------------------- ABILITY_ENCOUNTER_HALF = 0 # エンカウント半減 ABILITY_ENCOUNTER_NONE = 1 # エンカウント無効 ABILITY_CANCEL_SURPRISE = 2 # 不意打ち無効 ABILITY_RAISE_PREEMPTIVE = 3 # 先制攻撃率アップ ABILITY_GOLD_DOUBLE = 4 # 獲得金額二倍 ABILITY_DROP_ITEM_DOUBLE = 5 # アイテム入手率二倍 #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(spirit) @obj = spirit end #-------------------------------------------------------------------------- # ● 属性耐性 #-------------------------------------------------------------------------- def element_rate fts = @obj.features(FEATURE_ELEMENT_RATE) fts.collect {|ft| ["#{$data_system.elements[ft.data_id]}属性耐性", sprintf("%d %", ft.value)] } end #-------------------------------------------------------------------------- # ● 弱体耐性 #-------------------------------------------------------------------------- def debuff_rate fts = @obj.features(FEATURE_DEBUFF_RATE) fts.collect {|ft| ["#{$data_system.terms.params[ft.data_id]}弱体耐性", sprintf("%d %", ft.value)] } end #-------------------------------------------------------------------------- # ● ステート耐性 #-------------------------------------------------------------------------- def state_rate fts = @obj.features(FEATURE_STATE_RATE) fts.collect {|ft| ["#{$data_states[ft.data_id].name}耐性", sprintf("%d %", ft.value)] } end #-------------------------------------------------------------------------- # ● ステート無効化 #-------------------------------------------------------------------------- def state_regist fts = @obj.features(FEATURE_STATE_RESIST) fts.collect {|ft| ["#{$data_states[ft.data_id].name}无效化", nil] } end #-------------------------------------------------------------------------- # ● 耐性情報取得 #-------------------------------------------------------------------------- def rate element_rate + debuff_rate + state_rate + state_regist end #-------------------------------------------------------------------------- # ● 通常能力情報取得 #-------------------------------------------------------------------------- def nparam fts = @obj.features(FEATURE_PARAM) fts.collect {|ft| ["#{$data_system.terms.params[ft.data_id]}", sprintf("%+d %", ft.value * 100)] } end #-------------------------------------------------------------------------- # ● 追加能力情報取得 #-------------------------------------------------------------------------- def xparam txt = ["命中率", "闪避", "会心一击", "会心闪避", "兵法闪避", "策反", "反击", "#{$data_system.terms.basic[2]}恢复", "#{$data_system.terms.basic[4]}恢复", "#{$data_system.terms.basic[6]}恢复"] fts = @obj.features(FEATURE_XPARAM) fts.collect {|ft| ["#{txt[ft.data_id]}", sprintf("%+d % ", ft.value * 100)] } end #-------------------------------------------------------------------------- # ● 特殊能力情報取得 #-------------------------------------------------------------------------- def sparam txt = ["被攻击率", "防御効果率", "回复効果率", "草药知识", "#{$data_system.terms.basic[4]}消费率", "#{$data_system.terms.basic[6]}消费率", "武力伤害率", "计谋伤害率", "地图伤害率", "经验获得率"] fts = @obj.features(FEATURE_SPARAM) fts.collect {|ft| ["#{$data_system.terms.params[ft.data_id]}", sprintf("%+d % ", ft.value * 100)] } end #-------------------------------------------------------------------------- # ● 能力情報取得 #-------------------------------------------------------------------------- def param nparam + xparam + sparam end #-------------------------------------------------------------------------- # ● 攻撃属性情報取得 #-------------------------------------------------------------------------- def atk_element fts = @obj.features(FEATURE_ATK_ELEMENT) fts.collect {|ft| ["攻击时 属性", $data_system.elements[ft.data_id]] } end #-------------------------------------------------------------------------- # ● 攻撃ステート情報取得 #-------------------------------------------------------------------------- def atk_state fts = @obj.features(FEATURE_ATK_STATE) fts.collect {|ft| ["攻击时 状态附加", $data_states[ft.data_id].name] } end #-------------------------------------------------------------------------- # ● 攻撃速度補正情報取得 #-------------------------------------------------------------------------- def atk_speed fts = @obj.features(FEATURE_ATK_SPEED) fts.collect {|ft| ["攻击速度修正", ft.value.to_s] } end #-------------------------------------------------------------------------- # ● 攻撃回数情報取得 #-------------------------------------------------------------------------- def atk_times fts = @obj.features(FEATURE_ATK_TIMES) fts.collect {|ft| ["#{ft.value}回攻击", nil] } end #-------------------------------------------------------------------------- # ● 攻撃情報取得 #-------------------------------------------------------------------------- def attack atk_element + atk_state + atk_speed + atk_times end #-------------------------------------------------------------------------- # ● スキルタイプ追加情報取得 #-------------------------------------------------------------------------- def skill_add_type fts = @obj.features(FEATURE_STYPE_ADD) fts.collect {|ft| ["タイプ「#{$data_system.skill_types[ft.data_id]}」追加", nil] } end #-------------------------------------------------------------------------- # ● スキルタイプ封印情報取得 #-------------------------------------------------------------------------- def skill_seal_type fts = @obj.features(FEATURE_STYPE_SEAL) fts.collect {|ft| ["タイプ「#{$data_system.skill_types[ft.data_id]}」封印", nil] } end #-------------------------------------------------------------------------- # ● スキル追加情報取得 #-------------------------------------------------------------------------- def skill_add fts = @obj.features(FEATURE_SKILL_ADD) fts.collect {|ft| ["「#{$data_skills[ft.data_id].name}」追加", nil] } end #-------------------------------------------------------------------------- # ● スキル封印情報取得 #-------------------------------------------------------------------------- def skill_seal fts = @obj.features(FEATURE_SKILL_SEAL) fts.collect {|ft| ["「#{$data_skills[ft.data_id].name}」封印", nil] } end #-------------------------------------------------------------------------- # ● スキル情報取得 #-------------------------------------------------------------------------- def skill skill_add_type + skill_seal_type # + skill_add + skill_seal end #-------------------------------------------------------------------------- # ● 武器タイプ装備情報取得 #-------------------------------------------------------------------------- def equip_wtype fts = @obj.features(FEATURE_EQUIP_WTYPE) fts.collect {|ft| ["「#{$data_sytem.weapon_types[ft.data_id]}」装備", nil] } end #-------------------------------------------------------------------------- # ● 防具タイプ装備情報取得 #-------------------------------------------------------------------------- def equip_atype fts = @obj.features(FEATURE_EQUIP_ATYPE) fts.collect {|ft| ["「#{$data_sytem.armor_types[ft.data_id]}」装備", nil] } end #-------------------------------------------------------------------------- # ● 装備固定情報取得 #-------------------------------------------------------------------------- def equip_fix fts = @obj.features(FEATURE_EQUIP_FIX) fts.collect {|ft| ["「#{$data_sytem.terms.etypes[ft.data_id]}」装備固定化", nil] } end #-------------------------------------------------------------------------- # ● 装備封印情報取得 #-------------------------------------------------------------------------- def equip_seal fts = @obj.features(FEATURE_EQUIP_SEAL) fts.collect {|ft| ["「#{$data_sytem.terms.etypes[ft.data_id]}」装備封印", nil] } end #-------------------------------------------------------------------------- # ● 装備情報取得 #-------------------------------------------------------------------------- def equip equip_wtype + equip_atype + equip_fix + equip_seal end #-------------------------------------------------------------------------- # ● 行動回数追加情報取得 #-------------------------------------------------------------------------- def action_plus fts = @obj.features(FEATURE_ACTION_PLUS) fts.collect {|ft| ["「#{[ft.value]}」回行動", nil] } end #-------------------------------------------------------------------------- # ● 特殊フラグ情報取得 #-------------------------------------------------------------------------- def special_flag str = [] str.push(["自动战斗", nil]) if @obj.auto_battle? str.push(["自动防御", nil]) if @obj.guard? str.push(["援军", nil]) if @obj.substitute? str.push(["#{$data_system.terms.basic[6]}装备", nil]) if @obj.substitute? str end #-------------------------------------------------------------------------- # ● パーティー能力情報取得 #-------------------------------------------------------------------------- def party_ability fts = @obj.features(FEATURE_PARTY_ABILITY) str = [] str.push(["遇敌率减半", nil]) if fts.any? {|ft| ft.code_id == ABILITY_ENCOUNTER_HALF } str.push(["不会遇敌", nil]) if fts.any? {|ft| ft.code_id == ABILITY_ENCOUNTER_NONE } str.push(["不会被偷袭", nil]) if fts.any? {|ft| ft.code_id == ABILITY_CANCEL_SURPRISE } str.push(["偷袭几率", nil]) if fts.any? {|ft| ft.code_id == ABILITY_RAISE_PREEMPTIVE } str.push(["获得金双倍", nil]) if fts.any? {|ft| ft.code_id == ABILITY_GOLD_DOUBLE } str.push(["掉宝双倍", nil]) if fts.any? {|ft| ft.code_id == ABILITY_DROP_ITEM_DOUBLE } str end #-------------------------------------------------------------------------- # ● その他情報取得 #-------------------------------------------------------------------------- def other action_plus + special_flag + party_ability end #-------------------------------------------------------------------------- # ● 全特徴取得 #-------------------------------------------------------------------------- def all Spirits.status.inject([]) do |r, st| case st when :rate; r += self.rate when :param; r += self.param when :attack; r += self.attack when :skill; r += self.skill when :equip; r += self.equip when :other; r += self.other end end end end #============================================================================== # ■ Game_Actor #============================================================================== class Game_Actor < Game_Battler attr_reader :max_spirits # 最大精霊数 attr_reader :partner_locked # 固定パートナー #-------------------------------------------------------------------------- # ● セットアップ #-------------------------------------------------------------------------- alias setup_spirit setup def setup(actor_id) @partners = [] @max_spirits = Spirits.max(actor_id) @parent_id = 0 @partner_locked = false @is_spirit = Spirits.spirit?(actor_id) setup_spirit(actor_id) end #-------------------------------------------------------------------------- # ● 精霊? #-------------------------------------------------------------------------- def spirit? @is_spirit end #-------------------------------------------------------------------------- # ● 最大精霊数変更 #-------------------------------------------------------------------------- def max_spirits=(num) @max_spirits = [1, num].max unless spirit? end #-------------------------------------------------------------------------- # ● 精霊ID #-------------------------------------------------------------------------- def spirit_id spirit? ? Spirits.spirit_id(@actor_id) : 0 end #-------------------------------------------------------------------------- # ● 精霊付与可能? #-------------------------------------------------------------------------- def can_partner(spirit_id) spirit? ? false : (Spirits.affinity(@actor_id, spirit_id) != 0) end #-------------------------------------------------------------------------- # ● 精霊交換可能? #-------------------------------------------------------------------------- def can_change_partner(index) return false if spirit? return true if @partners[index] == 0 $game_actors[@partners[index]].partner_locked end #-------------------------------------------------------------------------- # ● 精霊付与可能? #-------------------------------------------------------------------------- def can_join_partner(partner_id=0) return (@parent_id == 0) if spirit? return false unless can_partner(partner_id) (@partners.size < @max_spirits) end #-------------------------------------------------------------------------- # ● パートナー追加 #-------------------------------------------------------------------------- def add_partner(partner_id) if spirit? @parent_id = partner_id else return if @max_spirits == partner_num @partners.push(partner_id) unless @partners.include?(partner_id) end end #-------------------------------------------------------------------------- # ● パートナー削除 #-------------------------------------------------------------------------- def remove_partner(partner_id) if spirit? @parent_id = 0 unlock_partner else @partners.delete(partner_id) end end #-------------------------------------------------------------------------- # ● パートナー変更 #-------------------------------------------------------------------------- def change_partner(partner_id, index=0) if spirit? @parent_id = partner_id else @partners[index] = partner_id end end #-------------------------------------------------------------------------- # ● 仮想パートナー変更 パラメータ取得 #-------------------------------------------------------------------------- def v_chg_param(partner_id, index, param_id) return 0 if spirit? now_partner = @partners[index] change_partner(partner_id, index) prm = self.param(param_id) change_partner(now_partner, index) prm end #-------------------------------------------------------------------------- # ● パートナー有り? #-------------------------------------------------------------------------- def has_partner? spirit? ? (@parent_id != 0) : (!@partners.empty?) end def has_spirit? spirit? ? false : (!@partners.empty?) end #-------------------------------------------------------------------------- # ● 精霊パートナー固定化 #-------------------------------------------------------------------------- def lock_partner return unless spirit? @partner_locked = true end #-------------------------------------------------------------------------- # ● 精霊パートナー固有化解除 #-------------------------------------------------------------------------- def unlock_partner @partner_locked = false end #-------------------------------------------------------------------------- # ● パートナー参照 #-------------------------------------------------------------------------- def partners return (has_partner? ? [$game_actors[@parent_id]] : []) if spirit? @partners.collect {|id| id.nil? ? nil : $game_actors[Spirits.actor_id(id)]} end def partners_objs partners.compact end #-------------------------------------------------------------------------- # ● パートナー数参照 #-------------------------------------------------------------------------- def partner_num @partners.size end #-------------------------------------------------------------------------- # ● 追加スキルの取得 #-------------------------------------------------------------------------- def added_skills has_spirit? ? partners_objs.inject(super) {|r, s| r |= s.skillids} : super end #-------------------------------------------------------------------------- # ● スキルID郡 取得 #-------------------------------------------------------------------------- def skillids @skills end #-------------------------------------------------------------------------- # ● 通常能力値の取得 #-------------------------------------------------------------------------- def param(param_id) super(param_id) - (spirit? ? Spirits::PRM_BASE[param_id] : 0) end alias org_param param def param(param_id) org = org_param(param_id) if has_spirit? partners_objs.each do |s| org += Spirits.affinity_param(s.org_param(param_id), @actor_id, s.spirit_id) end end org end #-------------------------------------------------------------------------- # ● 特徴を保持する全オブジェクトの配列取得 #-------------------------------------------------------------------------- alias org_feature_objects feature_objects def feature_objects org = org_feature_objects partners_objs.collect {|s| s.org_feature_objects }.each {|obj| org += obj} if has_spirit? org end #-------------------------------------------------------------------------- # ● 控えメンバーの経験獲得率を取得 #-------------------------------------------------------------------------- alias reserve_members_exp_rate_spirits reserve_members_exp_rate def reserve_members_exp_rate spirit? ? 1 : reserve_members_exp_rate_spirits end end #============================================================================== # ■ Game_Party #============================================================================== class Game_Party < Game_Unit #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias initialize_spirits initialize def initialize initialize_spirits @spirits = [] end #-------------------------------------------------------------------------- # ● 初期パーティのセットアップ #-------------------------------------------------------------------------- alias setup_starting_members_spirits setup_starting_members def setup_starting_members setup_starting_members_spirits @spirits = Spirits::START_V Spirits::START_P.each_pair do |aid, sid| if @actors.include?(aid) and @spirits.include?(sid) $game_actors[aid].add_partner(sid) $game_actors[Spirits.actor_id(sid)].add_partner(aid) $game_actors[aid].recover_all else p "START_P[#{aid} => #{sid}] is bad arg." end end end #-------------------------------------------------------------------------- # ● 精霊を加える #-------------------------------------------------------------------------- def include_spirit?(spirit_id) @spirits.include?(spirit_id) end #-------------------------------------------------------------------------- # ● 精霊を加える #-------------------------------------------------------------------------- def add_spirit(spirit_id) @spirits.push(spirit_id) unless include_spirit?(spirit_id) end #-------------------------------------------------------------------------- # ● 精霊を外す #-------------------------------------------------------------------------- def remove_spirit(spirit_id) members.each {|actor| actor.remove_partner(spirit_id)} @spirits.delete(spirit_id) end #-------------------------------------------------------------------------- # ● 精霊リスト #-------------------------------------------------------------------------- def spirit_members @spirits.collect {|id| spirit(id)} end #-------------------------------------------------------------------------- # ● 待機 精霊リスト #-------------------------------------------------------------------------- def spirit_stay_members spirit_members.select {|spirit| !spirit.has_partner?} end #-------------------------------------------------------------------------- # ● 精霊数 #-------------------------------------------------------------------------- def spirit_num @spirits.size end #-------------------------------------------------------------------------- # ● 精霊データ #-------------------------------------------------------------------------- def spirit(spirit_id) $game_actors[Spirits.actor_id(spirit_id)] end end #============================================================================== # ■ Window_Base #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ● 歩行グラフィックの描画 #-------------------------------------------------------------------------- def draw_line_character(character_name, character_index, x, y, enabled=true) return unless character_name bitmap = Cache.character(character_name) sign = character_name[/^[\!\$]./] if sign && sign.include?('$') cw = bitmap.width / 3 ch = bitmap.height / 4 else cw = bitmap.width / 12 ch = bitmap.height / 8 end y += (line_height - ch) / 2 if ch < line_height n = character_index src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, [ch, line_height].min) contents.blt(x, y, bitmap, src_rect, enabled ? 255 : translucent_alpha) cw end #-------------------------------------------------------------------------- # ● アクターの歩行グラフィック描画 #-------------------------------------------------------------------------- def draw_actor_line_graphic(actor, x, y, enabled=true) draw_line_character(actor.character_name, actor.character_index, x, y, enabled) end #-------------------------------------------------------------------------- # ● パートナー名描画 #-------------------------------------------------------------------------- def draw_partner_name(actor, x, y) change_color(system_color) draw_text(x, y, contents_width, line_height, actor.spirit? ? "将领" : "副将") x += 100 change_color(normal_color) if actor.has_partner? actor.partners.each_with_index {|s, i| draw_actor_line_graphic(s, x + 48 * i, y)} else draw_text(x, y, contents_width, line_height, "―――") end end #-------------------------------------------------------------------------- # ● 名前の描画 #-------------------------------------------------------------------------- def draw_spirit_name(actor, x, y, enabled=true, width = 112) change_color(normal_color, enabled) draw_text(x, y, width, line_height, actor.name) end #-------------------------------------------------------------------------- # ● 能力値の描画 #-------------------------------------------------------------------------- def draw_spirit_param(actor, x, y, param_id) change_color(system_color) draw_text(x, y, 120, line_height, Vocab::param(param_id)) prm = actor.param(param_id) change_color(param_change_color(prm)) if prm == 0 draw_text(x + 100, y, 56, line_height, "----", 2) else draw_text(x + 100, y, 56, line_height, sprintf("%+d", prm), 2) end end end class << BattleManager #-------------------------------------------------------------------------- # ● 経験値の獲得とレベルアップの表示 #-------------------------------------------------------------------------- alias gain_exp_spirits gain_exp def gain_exp gain_exp_spirits gain_spirit_exp if Spirits::USE_LV end #-------------------------------------------------------------------------- # ● 精霊の経験値獲得 #-------------------------------------------------------------------------- def gain_spirit_exp case Spirits::EXP_TARGET when 0 $game_party.battle_members.each do |actor| actor.partners.compact.each do |spirit| spirit.gain_exp(spirit_exp) end end when 1 $game_party.all_members.each do |actor| actor.partners.compact.each do |spirit| spirit.gain_exp(spirit_exp) end end when 2 $game_party.spirit_members.each do |spirit| spirit.gain_exp(spirit_exp) end end wait_for_message end #-------------------------------------------------------------------------- # ● 精霊用経験値 #-------------------------------------------------------------------------- def spirit_exp Spirits::EXP_TYPE == 0 ? 1 : $game_troop.exp_total end end if defined?(BtlrFv) class << BattleManager #-------------------------------------------------------------------------- # ● 獲得した経験値の表示 #-------------------------------------------------------------------------- alias display_result_spirit display_result def display_result display_result_spirit gain_spirit_exp if Spirits::USE_LV end end end # BtlrFv
#==============================================================================
# ■ VXAce-RGSS3-38 精霊システム <database> by Claimh
#==============================================================================
#==============================================================================
# ■ Spirits
#==============================================================================
module Spirits
#--------------------------------------------------------------------------
# ● 精霊パートナー化
#--------------------------------------------------------------------------
def self.add_partner(actor_id, spirit_id)
return unless $game_party.include_spirit?(spirit_id)
return unless $game_actors[actor_id].can_join_partner(spirit_id)
s_act_id = self.actor_id(spirit_id)
return unless $game_actors[s_act_id].can_join_partner(actor_id)
$game_actors[actor_id].add_partner(spirit_id)
$game_actors[s_act_id].add_partner(actor_id)
end
#--------------------------------------------------------------------------
# ● 精霊パートナー解消
#--------------------------------------------------------------------------
def self.remove_partner(actor_id, spirit_id)
$game_actors[actor_id].remove_partner(spirit_id)
$game_actors[self.actor_id(spirit_id)].remove_partner(actor_id)
end
#--------------------------------------------------------------------------
# ● 精霊パートナー固定化
#--------------------------------------------------------------------------
def self.lock_partner(spirit_id)
spirit = $game_actors[self.actor_id(spirit_id)]
return unless spirit.has_partner?
spirit.lock_partner
end
#--------------------------------------------------------------------------
# ● 精霊パートナー固有化解除
#--------------------------------------------------------------------------
def self.unlock_partner(spirit_id)
spirit = $game_actors[self.actor_id(spirit_id)]
return unless spirit.has_partner?
spirit.unlock_partner
end
#--------------------------------------------------------------------------
# ● 精霊?
#--------------------------------------------------------------------------
def self.spirit?(actor_id)
SPIRIT_ACTOR.has_value?(actor_id)
end
#--------------------------------------------------------------------------
# ● 精霊ID => アクターID
#--------------------------------------------------------------------------
def self.actor_id(spirit_id)
SPIRIT_ACTOR[spirit_id].nil? ? 0 : SPIRIT_ACTOR[spirit_id]
end
#--------------------------------------------------------------------------
# ● アクターID => 精霊ID
#--------------------------------------------------------------------------
def self.spirit_id(actor_id)
id = SPIRIT_ACTOR.index(actor_id)
id.nil? ? 0 : id
end
#--------------------------------------------------------------------------
# ● パートナー最大数
#--------------------------------------------------------------------------
def self.max(actor_id)
MAX[actor_id].nil? ? MAX[0] : MAX[actor_id]
end
#--------------------------------------------------------------------------
# ● 相性
#--------------------------------------------------------------------------
def self.affinity(actor_id, spirit_id)
if AFNTY[actor_id].nil?
return AFNTY[0][0]
elsif AFNTY[actor_id][spirit_id].nil?
return AFNTY[actor_id][0].nil? ? AFNTY[0][0] : AFNTY[actor_id][0]
else
return AFNTY[actor_id][spirit_id]
end
end
#--------------------------------------------------------------------------
# ● 相性計算
#--------------------------------------------------------------------------
def self.affinity_param(param, actor_id, spirit_id)
prm = [0, 0.5, 0.8, 1.0, 1.2, 1.5] # 相性補正
n = affinity(actor_id, spirit_id)
p "[#{actor_id}, #{spirit_id}] => #{n}" if n.nil?
(param * prm[affinity(actor_id, spirit_id)]).truncate
end
#--------------------------------------------------------------------------
# ● 有効ステータス表示
#--------------------------------------------------------------------------
def self.sts
STS.select {|key, v| v}.keys
end
#--------------------------------------------------------------------------
# ● 有効ステータス表示
#--------------------------------------------------------------------------
def self.status
SHOW_ST.select {|key, v| v}.keys
end
end
#==============================================================================
# ■ Spirits::Features : 特徴情報抽出
#==============================================================================
class Spirits::Features
#--------------------------------------------------------------------------
# ● 定数(特徴)
#--------------------------------------------------------------------------
FEATURE_ELEMENT_RATE = 11 # 属性有効度
FEATURE_DEBUFF_RATE = 12 # 弱体有効度
FEATURE_STATE_RATE = 13 # ステート有効度
FEATURE_STATE_RESIST = 14 # ステート無効化
FEATURE_PARAM = 21 # 通常能力値
FEATURE_XPARAM = 22 # 追加能力値
FEATURE_SPARAM = 23 # 特殊能力値
FEATURE_ATK_ELEMENT = 31 # 攻撃時属性
FEATURE_ATK_STATE = 32 # 攻撃時ステート
FEATURE_ATK_SPEED = 33 # 攻撃速度補正
FEATURE_ATK_TIMES = 34 # 攻撃追加回数
FEATURE_STYPE_ADD = 41 # スキルタイプ追加
FEATURE_STYPE_SEAL = 42 # スキルタイプ封印
FEATURE_SKILL_ADD = 43 # スキル追加
FEATURE_SKILL_SEAL = 44 # スキル封印
FEATURE_EQUIP_WTYPE = 51 # 武器タイプ装備
FEATURE_EQUIP_ATYPE = 52 # 防具タイプ装備
FEATURE_EQUIP_FIX = 53 # 装備固定
FEATURE_EQUIP_SEAL = 54 # 装備封印
FEATURE_SLOT_TYPE = 55 # スロットタイプ
FEATURE_ACTION_PLUS = 61 # 行動回数追加
FEATURE_SPECIAL_FLAG = 62 # 特殊フラグ
FEATURE_COLLAPSE_TYPE = 63 # 消滅エフェクト
FEATURE_PARTY_ABILITY = 64 # パーティ能力
#--------------------------------------------------------------------------
# ● パーティ能力定数
#--------------------------------------------------------------------------
ABILITY_ENCOUNTER_HALF = 0 # エンカウント半減
ABILITY_ENCOUNTER_NONE = 1 # エンカウント無効
ABILITY_CANCEL_SURPRISE = 2 # 不意打ち無効
ABILITY_RAISE_PREEMPTIVE = 3 # 先制攻撃率アップ
ABILITY_GOLD_DOUBLE = 4 # 獲得金額二倍
ABILITY_DROP_ITEM_DOUBLE = 5 # アイテム入手率二倍
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(spirit)
@obj = spirit
end
#--------------------------------------------------------------------------
# ● 属性耐性
#--------------------------------------------------------------------------
def element_rate
fts = @obj.features(FEATURE_ELEMENT_RATE)
fts.collect {|ft| ["#{$data_system.elements[ft.data_id]}属性耐性", sprintf("%d %", ft.value)] }
end
#--------------------------------------------------------------------------
# ● 弱体耐性
#--------------------------------------------------------------------------
def debuff_rate
fts = @obj.features(FEATURE_DEBUFF_RATE)
fts.collect {|ft| ["#{$data_system.terms.params[ft.data_id]}弱体耐性", sprintf("%d %", ft.value)] }
end
#--------------------------------------------------------------------------
# ● ステート耐性
#--------------------------------------------------------------------------
def state_rate
fts = @obj.features(FEATURE_STATE_RATE)
fts.collect {|ft| ["#{$data_states[ft.data_id].name}耐性", sprintf("%d %", ft.value)] }
end
#--------------------------------------------------------------------------
# ● ステート無効化
#--------------------------------------------------------------------------
def state_regist
fts = @obj.features(FEATURE_STATE_RESIST)
fts.collect {|ft| ["#{$data_states[ft.data_id].name}无效化", nil] }
end
#--------------------------------------------------------------------------
# ● 耐性情報取得
#--------------------------------------------------------------------------
def rate
element_rate + debuff_rate + state_rate + state_regist
end
#--------------------------------------------------------------------------
# ● 通常能力情報取得
#--------------------------------------------------------------------------
def nparam
fts = @obj.features(FEATURE_PARAM)
fts.collect {|ft| ["#{$data_system.terms.params[ft.data_id]}", sprintf("%+d %", ft.value * 100)] }
end
#--------------------------------------------------------------------------
# ● 追加能力情報取得
#--------------------------------------------------------------------------
def xparam
txt = ["命中率", "闪避", "会心一击", "会心闪避",
"兵法闪避", "策反", "反击",
"#{$data_system.terms.basic[2]}恢复",
"#{$data_system.terms.basic[4]}恢复",
"#{$data_system.terms.basic[6]}恢复"]
fts = @obj.features(FEATURE_XPARAM)
fts.collect {|ft| ["#{txt[ft.data_id]}", sprintf("%+d % ", ft.value * 100)] }
end
#--------------------------------------------------------------------------
# ● 特殊能力情報取得
#--------------------------------------------------------------------------
def sparam
txt = ["被攻击率", "防御効果率", "回复効果率", "草药知识",
"#{$data_system.terms.basic[4]}消费率",
"#{$data_system.terms.basic[6]}消费率",
"武力伤害率", "计谋伤害率", "地图伤害率", "经验获得率"]
fts = @obj.features(FEATURE_SPARAM)
fts.collect {|ft| ["#{$data_system.terms.params[ft.data_id]}", sprintf("%+d % ", ft.value * 100)] }
end
#--------------------------------------------------------------------------
# ● 能力情報取得
#--------------------------------------------------------------------------
def param
nparam + xparam + sparam
end
#--------------------------------------------------------------------------
# ● 攻撃属性情報取得
#--------------------------------------------------------------------------
def atk_element
fts = @obj.features(FEATURE_ATK_ELEMENT)
fts.collect {|ft| ["攻击时 属性", $data_system.elements[ft.data_id]] }
end
#--------------------------------------------------------------------------
# ● 攻撃ステート情報取得
#--------------------------------------------------------------------------
def atk_state
fts = @obj.features(FEATURE_ATK_STATE)
fts.collect {|ft| ["攻击时 状态附加", $data_states[ft.data_id].name] }
end
#--------------------------------------------------------------------------
# ● 攻撃速度補正情報取得
#--------------------------------------------------------------------------
def atk_speed
fts = @obj.features(FEATURE_ATK_SPEED)
fts.collect {|ft| ["攻击速度修正", ft.value.to_s] }
end
#--------------------------------------------------------------------------
# ● 攻撃回数情報取得
#--------------------------------------------------------------------------
def atk_times
fts = @obj.features(FEATURE_ATK_TIMES)
fts.collect {|ft| ["#{ft.value}回攻击", nil] }
end
#--------------------------------------------------------------------------
# ● 攻撃情報取得
#--------------------------------------------------------------------------
def attack
atk_element + atk_state + atk_speed + atk_times
end
#--------------------------------------------------------------------------
# ● スキルタイプ追加情報取得
#--------------------------------------------------------------------------
def skill_add_type
fts = @obj.features(FEATURE_STYPE_ADD)
fts.collect {|ft| ["タイプ「#{$data_system.skill_types[ft.data_id]}」追加", nil] }
end
#--------------------------------------------------------------------------
# ● スキルタイプ封印情報取得
#--------------------------------------------------------------------------
def skill_seal_type
fts = @obj.features(FEATURE_STYPE_SEAL)
fts.collect {|ft| ["タイプ「#{$data_system.skill_types[ft.data_id]}」封印", nil] }
end
#--------------------------------------------------------------------------
# ● スキル追加情報取得
#--------------------------------------------------------------------------
def skill_add
fts = @obj.features(FEATURE_SKILL_ADD)
fts.collect {|ft| ["「#{$data_skills[ft.data_id].name}」追加", nil] }
end
#--------------------------------------------------------------------------
# ● スキル封印情報取得
#--------------------------------------------------------------------------
def skill_seal
fts = @obj.features(FEATURE_SKILL_SEAL)
fts.collect {|ft| ["「#{$data_skills[ft.data_id].name}」封印", nil] }
end
#--------------------------------------------------------------------------
# ● スキル情報取得
#--------------------------------------------------------------------------
def skill
skill_add_type + skill_seal_type # + skill_add + skill_seal
end
#--------------------------------------------------------------------------
# ● 武器タイプ装備情報取得
#--------------------------------------------------------------------------
def equip_wtype
fts = @obj.features(FEATURE_EQUIP_WTYPE)
fts.collect {|ft| ["「#{$data_sytem.weapon_types[ft.data_id]}」装備", nil] }
end
#--------------------------------------------------------------------------
# ● 防具タイプ装備情報取得
#--------------------------------------------------------------------------
def equip_atype
fts = @obj.features(FEATURE_EQUIP_ATYPE)
fts.collect {|ft| ["「#{$data_sytem.armor_types[ft.data_id]}」装備", nil] }
end
#--------------------------------------------------------------------------
# ● 装備固定情報取得
#--------------------------------------------------------------------------
def equip_fix
fts = @obj.features(FEATURE_EQUIP_FIX)
fts.collect {|ft| ["「#{$data_sytem.terms.etypes[ft.data_id]}」装備固定化", nil] }
end
#--------------------------------------------------------------------------
# ● 装備封印情報取得
#--------------------------------------------------------------------------
def equip_seal
fts = @obj.features(FEATURE_EQUIP_SEAL)
fts.collect {|ft| ["「#{$data_sytem.terms.etypes[ft.data_id]}」装備封印", nil] }
end
#--------------------------------------------------------------------------
# ● 装備情報取得
#--------------------------------------------------------------------------
def equip
equip_wtype + equip_atype + equip_fix + equip_seal
end
#--------------------------------------------------------------------------
# ● 行動回数追加情報取得
#--------------------------------------------------------------------------
def action_plus
fts = @obj.features(FEATURE_ACTION_PLUS)
fts.collect {|ft| ["「#{[ft.value]}」回行動", nil] }
end
#--------------------------------------------------------------------------
# ● 特殊フラグ情報取得
#--------------------------------------------------------------------------
def special_flag
str = []
str.push(["自动战斗", nil]) if @obj.auto_battle?
str.push(["自动防御", nil]) if @obj.guard?
str.push(["援军", nil]) if @obj.substitute?
str.push(["#{$data_system.terms.basic[6]}装备", nil]) if @obj.substitute?
str
end
#--------------------------------------------------------------------------
# ● パーティー能力情報取得
#--------------------------------------------------------------------------
def party_ability
fts = @obj.features(FEATURE_PARTY_ABILITY)
str = []
str.push(["遇敌率减半", nil]) if fts.any? {|ft| ft.code_id == ABILITY_ENCOUNTER_HALF }
str.push(["不会遇敌", nil]) if fts.any? {|ft| ft.code_id == ABILITY_ENCOUNTER_NONE }
str.push(["不会被偷袭", nil]) if fts.any? {|ft| ft.code_id == ABILITY_CANCEL_SURPRISE }
str.push(["偷袭几率", nil]) if fts.any? {|ft| ft.code_id == ABILITY_RAISE_PREEMPTIVE }
str.push(["获得金双倍", nil]) if fts.any? {|ft| ft.code_id == ABILITY_GOLD_DOUBLE }
str.push(["掉宝双倍", nil]) if fts.any? {|ft| ft.code_id == ABILITY_DROP_ITEM_DOUBLE }
str
end
#--------------------------------------------------------------------------
# ● その他情報取得
#--------------------------------------------------------------------------
def other
action_plus + special_flag + party_ability
end
#--------------------------------------------------------------------------
# ● 全特徴取得
#--------------------------------------------------------------------------
def all
Spirits.status.inject([]) do |r, st|
case st
when :rate; r += self.rate
when :param; r += self.param
when :attack; r += self.attack
when :skill; r += self.skill
when :equip; r += self.equip
when :other; r += self.other
end
end
end
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
attr_reader :max_spirits # 最大精霊数
attr_reader :partner_locked # 固定パートナー
#--------------------------------------------------------------------------
# ● セットアップ
#--------------------------------------------------------------------------
alias setup_spirit setup
def setup(actor_id)
@partners = []
@max_spirits = Spirits.max(actor_id)
@parent_id = 0
@partner_locked = false
@is_spirit = Spirits.spirit?(actor_id)
setup_spirit(actor_id)
end
#--------------------------------------------------------------------------
# ● 精霊?
#--------------------------------------------------------------------------
def spirit?
@is_spirit
end
#--------------------------------------------------------------------------
# ● 最大精霊数変更
#--------------------------------------------------------------------------
def max_spirits=(num)
@max_spirits = [1, num].max unless spirit?
end
#--------------------------------------------------------------------------
# ● 精霊ID
#--------------------------------------------------------------------------
def spirit_id
spirit? ? Spirits.spirit_id(@actor_id) : 0
end
#--------------------------------------------------------------------------
# ● 精霊付与可能?
#--------------------------------------------------------------------------
def can_partner(spirit_id)
spirit? ? false : (Spirits.affinity(@actor_id, spirit_id) != 0)
end
#--------------------------------------------------------------------------
# ● 精霊交換可能?
#--------------------------------------------------------------------------
def can_change_partner(index)
return false if spirit?
return true if @partners[index] == 0
$game_actors[@partners[index]].partner_locked
end
#--------------------------------------------------------------------------
# ● 精霊付与可能?
#--------------------------------------------------------------------------
def can_join_partner(partner_id=0)
return (@parent_id == 0) if spirit?
return false unless can_partner(partner_id)
(@partners.size < @max_spirits)
end
#--------------------------------------------------------------------------
# ● パートナー追加
#--------------------------------------------------------------------------
def add_partner(partner_id)
if spirit?
@parent_id = partner_id
else
return if @max_spirits == partner_num
@partners.push(partner_id) unless @partners.include?(partner_id)
end
end
#--------------------------------------------------------------------------
# ● パートナー削除
#--------------------------------------------------------------------------
def remove_partner(partner_id)
if spirit?
@parent_id = 0
unlock_partner
else
@partners.delete(partner_id)
end
end
#--------------------------------------------------------------------------
# ● パートナー変更
#--------------------------------------------------------------------------
def change_partner(partner_id, index=0)
if spirit?
@parent_id = partner_id
else
@partners[index] = partner_id
end
end
#--------------------------------------------------------------------------
# ● 仮想パートナー変更 パラメータ取得
#--------------------------------------------------------------------------
def v_chg_param(partner_id, index, param_id)
return 0 if spirit?
now_partner = @partners[index]
change_partner(partner_id, index)
prm = self.param(param_id)
change_partner(now_partner, index)
prm
end
#--------------------------------------------------------------------------
# ● パートナー有り?
#--------------------------------------------------------------------------
def has_partner?
spirit? ? (@parent_id != 0) : (!@partners.empty?)
end
def has_spirit?
spirit? ? false : (!@partners.empty?)
end
#--------------------------------------------------------------------------
# ● 精霊パートナー固定化
#--------------------------------------------------------------------------
def lock_partner
return unless spirit?
@partner_locked = true
end
#--------------------------------------------------------------------------
# ● 精霊パートナー固有化解除
#--------------------------------------------------------------------------
def unlock_partner
@partner_locked = false
end
#--------------------------------------------------------------------------
# ● パートナー参照
#--------------------------------------------------------------------------
def partners
return (has_partner? ? [$game_actors[@parent_id]] : []) if spirit?
@partners.collect {|id| id.nil? ? nil : $game_actors[Spirits.actor_id(id)]}
end
def partners_objs
partners.compact
end
#--------------------------------------------------------------------------
# ● パートナー数参照
#--------------------------------------------------------------------------
def partner_num
@partners.size
end
#--------------------------------------------------------------------------
# ● 追加スキルの取得
#--------------------------------------------------------------------------
def added_skills
has_spirit? ? partners_objs.inject(super) {|r, s| r |= s.skillids} : super
end
#--------------------------------------------------------------------------
# ● スキルID郡 取得
#--------------------------------------------------------------------------
def skillids
@skills
end
#--------------------------------------------------------------------------
# ● 通常能力値の取得
#--------------------------------------------------------------------------
def param(param_id)
super(param_id) - (spirit? ? Spirits::PRM_BASE[param_id] : 0)
end
alias org_param param
def param(param_id)
org = org_param(param_id)
if has_spirit?
partners_objs.each do |s|
org += Spirits.affinity_param(s.org_param(param_id), @actor_id, s.spirit_id)
end
end
org
end
#--------------------------------------------------------------------------
# ● 特徴を保持する全オブジェクトの配列取得
#--------------------------------------------------------------------------
alias org_feature_objects feature_objects
def feature_objects
org = org_feature_objects
partners_objs.collect {|s| s.org_feature_objects }.each {|obj| org += obj} if has_spirit?
org
end
#--------------------------------------------------------------------------
# ● 控えメンバーの経験獲得率を取得
#--------------------------------------------------------------------------
alias reserve_members_exp_rate_spirits reserve_members_exp_rate
def reserve_members_exp_rate
spirit? ? 1 : reserve_members_exp_rate_spirits
end
end
#==============================================================================
# ■ Game_Party
#==============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_spirits initialize
def initialize
initialize_spirits
@spirits = []
end
#--------------------------------------------------------------------------
# ● 初期パーティのセットアップ
#--------------------------------------------------------------------------
alias setup_starting_members_spirits setup_starting_members
def setup_starting_members
setup_starting_members_spirits
@spirits = Spirits::START_V
Spirits::START_P.each_pair do |aid, sid|
if @actors.include?(aid) and @spirits.include?(sid)
$game_actors[aid].add_partner(sid)
$game_actors[Spirits.actor_id(sid)].add_partner(aid)
$game_actors[aid].recover_all
else
p "START_P[#{aid} => #{sid}] is bad arg."
end
end
end
#--------------------------------------------------------------------------
# ● 精霊を加える
#--------------------------------------------------------------------------
def include_spirit?(spirit_id)
@spirits.include?(spirit_id)
end
#--------------------------------------------------------------------------
# ● 精霊を加える
#--------------------------------------------------------------------------
def add_spirit(spirit_id)
@spirits.push(spirit_id) unless include_spirit?(spirit_id)
end
#--------------------------------------------------------------------------
# ● 精霊を外す
#--------------------------------------------------------------------------
def remove_spirit(spirit_id)
members.each {|actor| actor.remove_partner(spirit_id)}
@spirits.delete(spirit_id)
end
#--------------------------------------------------------------------------
# ● 精霊リスト
#--------------------------------------------------------------------------
def spirit_members
@spirits.collect {|id| spirit(id)}
end
#--------------------------------------------------------------------------
# ● 待機 精霊リスト
#--------------------------------------------------------------------------
def spirit_stay_members
spirit_members.select {|spirit| !spirit.has_partner?}
end
#--------------------------------------------------------------------------
# ● 精霊数
#--------------------------------------------------------------------------
def spirit_num
@spirits.size
end
#--------------------------------------------------------------------------
# ● 精霊データ
#--------------------------------------------------------------------------
def spirit(spirit_id)
$game_actors[Spirits.actor_id(spirit_id)]
end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● 歩行グラフィックの描画
#--------------------------------------------------------------------------
def draw_line_character(character_name, character_index, x, y, enabled=true)
return unless character_name
bitmap = Cache.character(character_name)
sign = character_name[/^[\!\$]./]
if sign && sign.include?('$')
cw = bitmap.width / 3
ch = bitmap.height / 4
else
cw = bitmap.width / 12
ch = bitmap.height / 8
end
y += (line_height - ch) / 2 if ch < line_height
n = character_index
src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, [ch, line_height].min)
contents.blt(x, y, bitmap, src_rect, enabled ? 255 : translucent_alpha)
cw
end
#--------------------------------------------------------------------------
# ● アクターの歩行グラフィック描画
#--------------------------------------------------------------------------
def draw_actor_line_graphic(actor, x, y, enabled=true)
draw_line_character(actor.character_name, actor.character_index, x, y, enabled)
end
#--------------------------------------------------------------------------
# ● パートナー名描画
#--------------------------------------------------------------------------
def draw_partner_name(actor, x, y)
change_color(system_color)
draw_text(x, y, contents_width, line_height, actor.spirit? ? "将领" : "副将")
x += 100
change_color(normal_color)
if actor.has_partner?
actor.partners.each_with_index {|s, i| draw_actor_line_graphic(s, x + 48 * i, y)}
else
draw_text(x, y, contents_width, line_height, "―――")
end
end
#--------------------------------------------------------------------------
# ● 名前の描画
#--------------------------------------------------------------------------
def draw_spirit_name(actor, x, y, enabled=true, width = 112)
change_color(normal_color, enabled)
draw_text(x, y, width, line_height, actor.name)
end
#--------------------------------------------------------------------------
# ● 能力値の描画
#--------------------------------------------------------------------------
def draw_spirit_param(actor, x, y, param_id)
change_color(system_color)
draw_text(x, y, 120, line_height, Vocab::param(param_id))
prm = actor.param(param_id)
change_color(param_change_color(prm))
if prm == 0
draw_text(x + 100, y, 56, line_height, "----", 2)
else
draw_text(x + 100, y, 56, line_height, sprintf("%+d", prm), 2)
end
end
end
class << BattleManager
#--------------------------------------------------------------------------
# ● 経験値の獲得とレベルアップの表示
#--------------------------------------------------------------------------
alias gain_exp_spirits gain_exp
def gain_exp
gain_exp_spirits
gain_spirit_exp if Spirits::USE_LV
end
#--------------------------------------------------------------------------
# ● 精霊の経験値獲得
#--------------------------------------------------------------------------
def gain_spirit_exp
case Spirits::EXP_TARGET
when 0
$game_party.battle_members.each do |actor|
actor.partners.compact.each do |spirit|
spirit.gain_exp(spirit_exp)
end
end
when 1
$game_party.all_members.each do |actor|
actor.partners.compact.each do |spirit|
spirit.gain_exp(spirit_exp)
end
end
when 2
$game_party.spirit_members.each do |spirit|
spirit.gain_exp(spirit_exp)
end
end
wait_for_message
end
#--------------------------------------------------------------------------
# ● 精霊用経験値
#--------------------------------------------------------------------------
def spirit_exp
Spirits::EXP_TYPE == 0 ? 1 : $game_troop.exp_total
end
end
if defined?(BtlrFv)
class << BattleManager
#--------------------------------------------------------------------------
# ● 獲得した経験値の表示
#--------------------------------------------------------------------------
alias display_result_spirit display_result
def display_result
display_result_spirit
gain_spirit_exp if Spirits::USE_LV
end
end
end # BtlrFv
|
|