Guest User

Untitled

a guest
Jun 16th, 2018
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 225.48 KB | None | 0 0
  1.  
  2. #==============================================================================
  3. # ■ Game_Actor
  4. #------------------------------------------------------------------------------
  5. #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
  6. # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
  7. #==============================================================================
  8.  
  9. class Game_Actor < Game_Battler
  10. #--------------------------------------------------------------------------
  11. # ● 公開インスタンス変数
  12. #--------------------------------------------------------------------------
  13.  
  14. # EDIT
  15. #==============================================================================
  16. attr_reader :actor_id
  17. attr_accessor :mandatory
  18. attr_accessor :unavailable
  19. #==============================================================================
  20. # END EDIT
  21.  
  22. attr_reader :name # 名前
  23. attr_reader :character_name # キャラクター ファイル名
  24. attr_reader :character_hue # キャラクター 色相
  25. attr_reader :class_id # クラス ID
  26. attr_reader :weapon_id # 武器 ID
  27. attr_reader :armor1_id # 盾 ID
  28. attr_reader :armor2_id # 頭防具 ID
  29. attr_reader :armor3_id # 体防具 ID
  30. attr_reader :armor4_id # 装飾品 ID
  31. attr_reader :level # レベル
  32. attr_reader :exp # EXP
  33. attr_reader :skills # スキル
  34. #--------------------------------------------------------------------------
  35. # ● オブジェクト初期化
  36. # actor_id : アクター ID
  37. #--------------------------------------------------------------------------
  38. def initialize(actor_id)
  39. super()
  40. setup(actor_id)
  41. end
  42. #--------------------------------------------------------------------------
  43. # ● セットアップ
  44. # actor_id : アクター ID
  45. #--------------------------------------------------------------------------
  46. def setup(actor_id)
  47.  
  48. # EDIT
  49. #==============================================================================
  50. mandatory = false
  51. unavailable = false
  52. #==============================================================================
  53. # END EDIT
  54.  
  55. actor = $data_actors[actor_id]
  56. @actor_id = actor_id
  57. @name = actor.name
  58. @character_name = actor.character_name
  59. @character_hue = actor.character_hue
  60. @battler_name = actor.battler_name
  61. @battler_hue = actor.battler_hue
  62. @class_id = actor.class_id
  63. @weapon_id = actor.weapon_id
  64. @armor1_id = actor.armor1_id
  65. @armor2_id = actor.armor2_id
  66. @armor3_id = actor.armor3_id
  67. @armor4_id = actor.armor4_id
  68. @level = actor.initial_level
  69. @exp_list = Array.new(101)
  70. make_exp_list
  71. @exp = @exp_list[@level]
  72. @skills = []
  73. @hp = maxhp
  74. @sp = maxsp
  75. @states = []
  76. @states_turn = {}
  77. @maxhp_plus = 0
  78. @maxsp_plus = 0
  79. @str_plus = 0
  80. @dex_plus = 0
  81. @agi_plus = 0
  82. @int_plus = 0
  83. # スキル習得
  84. for i in 1..@level
  85. for j in $data_classes[@class_id].learnings
  86. if j.level == i
  87. learn_skill(j.skill_id)
  88. end
  89. end
  90. end
  91. # オートステートを更新
  92. update_auto_state(nil, $data_armors[@armor1_id])
  93. update_auto_state(nil, $data_armors[@armor2_id])
  94. update_auto_state(nil, $data_armors[@armor3_id])
  95. update_auto_state(nil, $data_armors[@armor4_id])
  96. end
  97. #--------------------------------------------------------------------------
  98. # ● アクター ID 取得
  99. #--------------------------------------------------------------------------
  100. def id
  101. return @actor_id
  102. end
  103. #--------------------------------------------------------------------------
  104. # ● インデックス取得
  105. #--------------------------------------------------------------------------
  106. def index
  107. return $game_party.actors.index(self)
  108. end
  109. #--------------------------------------------------------------------------
  110. # ● EXP 計算
  111. #--------------------------------------------------------------------------
  112. def make_exp_list
  113. actor = $data_actors[@actor_id]
  114. @exp_list[1] = 0
  115. pow_i = 2.4 + actor.exp_inflation / 100.0
  116. for i in 2..100
  117. if i > actor.final_level
  118. @exp_list[i] = 0
  119. else
  120. n = actor.exp_basis * ((i + 3) ** pow_i) / (5 ** pow_i)
  121. @exp_list[i] = @exp_list[i-1] + Integer(n)
  122. end
  123. end
  124. end
  125. #--------------------------------------------------------------------------
  126. # ● 属性補正値の取得
  127. # element_id : 属性 ID
  128. #--------------------------------------------------------------------------
  129. def element_rate(element_id)
  130. # 属性有効度に対応する数値を取得
  131. table = [0,200,150,100,50,0,-100]
  132. result = table[$data_classes[@class_id].element_ranks[element_id]]
  133. # 防具でこの属性が防御されている場合は半減
  134. for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
  135. armor = $data_armors[i]
  136. if armor != nil and armor.guard_element_set.include?(element_id)
  137. result /= 2
  138. end
  139. end
  140. # ステートでこの属性が防御されている場合は半減
  141. for i in @states
  142. if $data_states[i].guard_element_set.include?(element_id)
  143. result /= 2
  144. end
  145. end
  146. # メソッド終了
  147. return result
  148. end
  149. #--------------------------------------------------------------------------
  150. # ● ステート有効度の取得
  151. #--------------------------------------------------------------------------
  152. def state_ranks
  153. return $data_classes[@class_id].state_ranks
  154. end
  155. #--------------------------------------------------------------------------
  156. # ● ステート防御判定
  157. # state_id : ステート ID
  158. #--------------------------------------------------------------------------
  159. def state_guard?(state_id)
  160. for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
  161. armor = $data_armors[i]
  162. if armor != nil
  163. if armor.guard_state_set.include?(state_id)
  164. return true
  165. end
  166. end
  167. end
  168. return false
  169. end
  170. #--------------------------------------------------------------------------
  171. # ● 通常攻撃の属性取得
  172. #--------------------------------------------------------------------------
  173. def element_set
  174. weapon = $data_weapons[@weapon_id]
  175. return weapon != nil ? weapon.element_set : []
  176. end
  177. #--------------------------------------------------------------------------
  178. # ● 通常攻撃のステート変化 (+) 取得
  179. #--------------------------------------------------------------------------
  180. def plus_state_set
  181. weapon = $data_weapons[@weapon_id]
  182. return weapon != nil ? weapon.plus_state_set : []
  183. end
  184. #--------------------------------------------------------------------------
  185. # ● 通常攻撃のステート変化 (-) 取得
  186. #--------------------------------------------------------------------------
  187. def minus_state_set
  188. weapon = $data_weapons[@weapon_id]
  189. return weapon != nil ? weapon.minus_state_set : []
  190. end
  191. #--------------------------------------------------------------------------
  192. # ● MaxHP の取得
  193. #--------------------------------------------------------------------------
  194. def maxhp
  195. n = [[base_maxhp + @maxhp_plus, 1].max, 9999].min
  196. for i in @states
  197. n *= $data_states[i].maxhp_rate / 100.0
  198. end
  199. n = [[Integer(n), 1].max, 9999].min
  200. return n
  201. end
  202. #--------------------------------------------------------------------------
  203. # ● 基本 MaxHP の取得
  204. #--------------------------------------------------------------------------
  205. def base_maxhp
  206. return $data_actors[@actor_id].parameters[0, @level]
  207. end
  208. #--------------------------------------------------------------------------
  209. # ● 基本 MaxSP の取得
  210. #--------------------------------------------------------------------------
  211. def base_maxsp
  212. return $data_actors[@actor_id].parameters[1, @level]
  213. end
  214. #--------------------------------------------------------------------------
  215. # ● 基本腕力の取得
  216. #--------------------------------------------------------------------------
  217. def base_str
  218. n = $data_actors[@actor_id].parameters[2, @level]
  219. weapon = $data_weapons[@weapon_id]
  220. armor1 = $data_armors[@armor1_id]
  221. armor2 = $data_armors[@armor2_id]
  222. armor3 = $data_armors[@armor3_id]
  223. armor4 = $data_armors[@armor4_id]
  224. n += weapon != nil ? weapon.str_plus : 0
  225. n += armor1 != nil ? armor1.str_plus : 0
  226. n += armor2 != nil ? armor2.str_plus : 0
  227. n += armor3 != nil ? armor3.str_plus : 0
  228. n += armor4 != nil ? armor4.str_plus : 0
  229. return [[n, 1].max, 999].min
  230. end
  231. #--------------------------------------------------------------------------
  232. # ● 基本器用さの取得
  233. #--------------------------------------------------------------------------
  234. def base_dex
  235. n = $data_actors[@actor_id].parameters[3, @level]
  236. weapon = $data_weapons[@weapon_id]
  237. armor1 = $data_armors[@armor1_id]
  238. armor2 = $data_armors[@armor2_id]
  239. armor3 = $data_armors[@armor3_id]
  240. armor4 = $data_armors[@armor4_id]
  241. n += weapon != nil ? weapon.dex_plus : 0
  242. n += armor1 != nil ? armor1.dex_plus : 0
  243. n += armor2 != nil ? armor2.dex_plus : 0
  244. n += armor3 != nil ? armor3.dex_plus : 0
  245. n += armor4 != nil ? armor4.dex_plus : 0
  246. return [[n, 1].max, 999].min
  247. end
  248. #--------------------------------------------------------------------------
  249. # ● 基本素早さの取得
  250. #--------------------------------------------------------------------------
  251. def base_agi
  252. n = $data_actors[@actor_id].parameters[4, @level]
  253. weapon = $data_weapons[@weapon_id]
  254. armor1 = $data_armors[@armor1_id]
  255. armor2 = $data_armors[@armor2_id]
  256. armor3 = $data_armors[@armor3_id]
  257. armor4 = $data_armors[@armor4_id]
  258. n += weapon != nil ? weapon.agi_plus : 0
  259. n += armor1 != nil ? armor1.agi_plus : 0
  260. n += armor2 != nil ? armor2.agi_plus : 0
  261. n += armor3 != nil ? armor3.agi_plus : 0
  262. n += armor4 != nil ? armor4.agi_plus : 0
  263. return [[n, 1].max, 999].min
  264. end
  265. #--------------------------------------------------------------------------
  266. # ● 基本魔力の取得
  267. #--------------------------------------------------------------------------
  268. def base_int
  269. n = $data_actors[@actor_id].parameters[5, @level]
  270. weapon = $data_weapons[@weapon_id]
  271. armor1 = $data_armors[@armor1_id]
  272. armor2 = $data_armors[@armor2_id]
  273. armor3 = $data_armors[@armor3_id]
  274. armor4 = $data_armors[@armor4_id]
  275. n += weapon != nil ? weapon.int_plus : 0
  276. n += armor1 != nil ? armor1.int_plus : 0
  277. n += armor2 != nil ? armor2.int_plus : 0
  278. n += armor3 != nil ? armor3.int_plus : 0
  279. n += armor4 != nil ? armor4.int_plus : 0
  280. return [[n, 1].max, 999].min
  281. end
  282. #--------------------------------------------------------------------------
  283. # ● 基本攻撃力の取得
  284. #--------------------------------------------------------------------------
  285. def base_atk
  286. weapon = $data_weapons[@weapon_id]
  287. return weapon != nil ? weapon.atk : 0
  288. end
  289. #--------------------------------------------------------------------------
  290. # ● 基本物理防御の取得
  291. #--------------------------------------------------------------------------
  292. def base_pdef
  293. weapon = $data_weapons[@weapon_id]
  294. armor1 = $data_armors[@armor1_id]
  295. armor2 = $data_armors[@armor2_id]
  296. armor3 = $data_armors[@armor3_id]
  297. armor4 = $data_armors[@armor4_id]
  298. pdef1 = weapon != nil ? weapon.pdef : 0
  299. pdef2 = armor1 != nil ? armor1.pdef : 0
  300. pdef3 = armor2 != nil ? armor2.pdef : 0
  301. pdef4 = armor3 != nil ? armor3.pdef : 0
  302. pdef5 = armor4 != nil ? armor4.pdef : 0
  303. return pdef1 + pdef2 + pdef3 + pdef4 + pdef5
  304. end
  305. #--------------------------------------------------------------------------
  306. # ● 基本魔法防御の取得
  307. #--------------------------------------------------------------------------
  308. def base_mdef
  309. weapon = $data_weapons[@weapon_id]
  310. armor1 = $data_armors[@armor1_id]
  311. armor2 = $data_armors[@armor2_id]
  312. armor3 = $data_armors[@armor3_id]
  313. armor4 = $data_armors[@armor4_id]
  314. mdef1 = weapon != nil ? weapon.mdef : 0
  315. mdef2 = armor1 != nil ? armor1.mdef : 0
  316. mdef3 = armor2 != nil ? armor2.mdef : 0
  317. mdef4 = armor3 != nil ? armor3.mdef : 0
  318. mdef5 = armor4 != nil ? armor4.mdef : 0
  319. return mdef1 + mdef2 + mdef3 + mdef4 + mdef5
  320. end
  321. #--------------------------------------------------------------------------
  322. # ● 基本回避修正の取得
  323. #--------------------------------------------------------------------------
  324. def base_eva
  325. armor1 = $data_armors[@armor1_id]
  326. armor2 = $data_armors[@armor2_id]
  327. armor3 = $data_armors[@armor3_id]
  328. armor4 = $data_armors[@armor4_id]
  329. eva1 = armor1 != nil ? armor1.eva : 0
  330. eva2 = armor2 != nil ? armor2.eva : 0
  331. eva3 = armor3 != nil ? armor3.eva : 0
  332. eva4 = armor4 != nil ? armor4.eva : 0
  333. return eva1 + eva2 + eva3 + eva4
  334. end
  335. #--------------------------------------------------------------------------
  336. # ● 通常攻撃 攻撃側アニメーション ID の取得
  337. #--------------------------------------------------------------------------
  338. def animation1_id
  339. weapon = $data_weapons[@weapon_id]
  340. return weapon != nil ? weapon.animation1_id : 0
  341. end
  342. #--------------------------------------------------------------------------
  343. # ● 通常攻撃 対象側アニメーション ID の取得
  344. #--------------------------------------------------------------------------
  345. def animation2_id
  346. weapon = $data_weapons[@weapon_id]
  347. return weapon != nil ? weapon.animation2_id : 0
  348. end
  349. #--------------------------------------------------------------------------
  350. # ● クラス名の取得
  351. #--------------------------------------------------------------------------
  352. def class_name
  353. return $data_classes[@class_id].name
  354. end
  355. #--------------------------------------------------------------------------
  356. # ● EXP の文字列取得
  357. #--------------------------------------------------------------------------
  358. def exp_s
  359. return @exp_list[@level+1] > 0 ? @exp.to_s : "-------"
  360. end
  361. #--------------------------------------------------------------------------
  362. # ● 次のレベルの EXP の文字列取得
  363. #--------------------------------------------------------------------------
  364. def next_exp_s
  365. return @exp_list[@level+1] > 0 ? @exp_list[@level+1].to_s : "-------"
  366. end
  367. #--------------------------------------------------------------------------
  368. # ● 次のレベルまでの EXP の文字列取得
  369. #--------------------------------------------------------------------------
  370. def next_rest_exp_s
  371. return @exp_list[@level+1] > 0 ?
  372. (@exp_list[@level+1] - @exp).to_s : "-------"
  373. end
  374. #--------------------------------------------------------------------------
  375. # ● オートステートの更新
  376. # old_armor : 外した防具
  377. # new_armor : 装備した防具
  378. #--------------------------------------------------------------------------
  379. def update_auto_state(old_armor, new_armor)
  380. # 外した防具のオートステートを強制解除
  381. if old_armor != nil and old_armor.auto_state_id != 0
  382. remove_state(old_armor.auto_state_id, true)
  383. end
  384. # 装備した防具のオートステートを強制付加
  385. if new_armor != nil and new_armor.auto_state_id != 0
  386. add_state(new_armor.auto_state_id, true)
  387. end
  388. end
  389. #--------------------------------------------------------------------------
  390. # ● 装備固定判定
  391. # equip_type : 装備タイプ
  392. #--------------------------------------------------------------------------
  393. def equip_fix?(equip_type)
  394. case equip_type
  395. when 0 # 武器
  396. return $data_actors[@actor_id].weapon_fix
  397. when 1 # 盾
  398. return $data_actors[@actor_id].armor1_fix
  399. when 2 # 頭
  400. return $data_actors[@actor_id].armor2_fix
  401. when 3 # 身体
  402. return $data_actors[@actor_id].armor3_fix
  403. when 4 # 装飾品
  404. return $data_actors[@actor_id].armor4_fix
  405. end
  406. return false
  407. end
  408. #--------------------------------------------------------------------------
  409. # ● 装備の変更
  410. # equip_type : 装備タイプ
  411. # id : 武器 or 防具 ID (0 なら装備解除)
  412. #--------------------------------------------------------------------------
  413. def equip(equip_type, id)
  414. case equip_type
  415. when 0 # 武器
  416. if id == 0 or $game_party.weapon_number(id) > 0
  417. $game_party.gain_weapon(@weapon_id, 1)
  418. @weapon_id = id
  419. $game_party.lose_weapon(id, 1)
  420. end
  421. when 1 # 盾
  422. if id == 0 or $game_party.armor_number(id) > 0
  423. update_auto_state($data_armors[@armor1_id], $data_armors[id])
  424. $game_party.gain_armor(@armor1_id, 1)
  425. @armor1_id = id
  426. $game_party.lose_armor(id, 1)
  427. end
  428. when 2 # 頭
  429. if id == 0 or $game_party.armor_number(id) > 0
  430. update_auto_state($data_armors[@armor2_id], $data_armors[id])
  431. $game_party.gain_armor(@armor2_id, 1)
  432. @armor2_id = id
  433. $game_party.lose_armor(id, 1)
  434. end
  435. when 3 # 身体
  436. if id == 0 or $game_party.armor_number(id) > 0
  437. update_auto_state($data_armors[@armor3_id], $data_armors[id])
  438. $game_party.gain_armor(@armor3_id, 1)
  439. @armor3_id = id
  440. $game_party.lose_armor(id, 1)
  441. end
  442. when 4 # 装飾品
  443. if id == 0 or $game_party.armor_number(id) > 0
  444. update_auto_state($data_armors[@armor4_id], $data_armors[id])
  445. $game_party.gain_armor(@armor4_id, 1)
  446. @armor4_id = id
  447. $game_party.lose_armor(id, 1)
  448. end
  449. end
  450. end
  451. #--------------------------------------------------------------------------
  452. # ● 装備可能判定
  453. # item : アイテム
  454. #--------------------------------------------------------------------------
  455. def equippable?(item)
  456. # 武器の場合
  457. if item.is_a?(RPG::Weapon)
  458. # 現在のクラスの装備可能な武器に含まれている場合
  459. if $data_classes[@class_id].weapon_set.include?(item.id)
  460. return true
  461. end
  462. end
  463. # 防具の場合
  464. if item.is_a?(RPG::Armor)
  465. # 現在のクラスの装備可能な防具に含まれている場合
  466. if $data_classes[@class_id].armor_set.include?(item.id)
  467. return true
  468. end
  469. end
  470. return false
  471. end
  472. #--------------------------------------------------------------------------
  473. # ● EXP の変更
  474. # exp : 新しい EXP
  475. #--------------------------------------------------------------------------
  476. def exp=(exp)
  477. @exp = [[exp, 9999999].min, 0].max
  478. # レベルアップ
  479. while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
  480. @level += 1
  481. # スキル習得
  482. for j in $data_classes[@class_id].learnings
  483. if j.level == @level
  484. learn_skill(j.skill_id)
  485. end
  486. end
  487. end
  488. # レベルダウン
  489. while @exp < @exp_list[@level]
  490. @level -= 1
  491. end
  492. # 現在の HP と SP が最大値を超えていたら修正
  493. @hp = [@hp, self.maxhp].min
  494. @sp = [@sp, self.maxsp].min
  495. end
  496. #--------------------------------------------------------------------------
  497. # ● レベルの変更
  498. # level : 新しいレベル
  499. #--------------------------------------------------------------------------
  500. def level=(level)
  501. # 上下限チェック
  502. level = [[level, $data_actors[@actor_id].final_level].min, 1].max
  503. # EXP を変更
  504. self.exp = @exp_list[level]
  505. end
  506. #--------------------------------------------------------------------------
  507. # ● スキルを覚える
  508. # skill_id : スキル ID
  509. #--------------------------------------------------------------------------
  510. def learn_skill(skill_id)
  511. if skill_id > 0 and not skill_learn?(skill_id)
  512. @skills.push(skill_id)
  513. @skills.sort!
  514. end
  515. end
  516. #--------------------------------------------------------------------------
  517. # ● スキルを忘れる
  518. # skill_id : スキル ID
  519. #--------------------------------------------------------------------------
  520. def forget_skill(skill_id)
  521. @skills.delete(skill_id)
  522. end
  523. #--------------------------------------------------------------------------
  524. # ● スキルの習得済み判定
  525. # skill_id : スキル ID
  526. #--------------------------------------------------------------------------
  527. def skill_learn?(skill_id)
  528. return @skills.include?(skill_id)
  529. end
  530. #--------------------------------------------------------------------------
  531. # ● スキルの使用可能判定
  532. # skill_id : スキル ID
  533. #--------------------------------------------------------------------------
  534. def skill_can_use?(skill_id)
  535. if not skill_learn?(skill_id)
  536. return false
  537. end
  538. return super
  539. end
  540. #--------------------------------------------------------------------------
  541. # ● 名前の変更
  542. # name : 新しい名前
  543. #--------------------------------------------------------------------------
  544. def name=(name)
  545. @name = name
  546. end
  547. #--------------------------------------------------------------------------
  548. # ● クラス ID の変更
  549. # class_id : 新しいクラス ID
  550. #--------------------------------------------------------------------------
  551. def class_id=(class_id)
  552. if $data_classes[class_id] != nil
  553. @class_id = class_id
  554. # 装備できなくなったアイテムを外す
  555. unless equippable?($data_weapons[@weapon_id])
  556. equip(0, 0)
  557. end
  558. unless equippable?($data_armors[@armor1_id])
  559. equip(1, 0)
  560. end
  561. unless equippable?($data_armors[@armor2_id])
  562. equip(2, 0)
  563. end
  564. unless equippable?($data_armors[@armor3_id])
  565. equip(3, 0)
  566. end
  567. unless equippable?($data_armors[@armor4_id])
  568. equip(4, 0)
  569. end
  570. end
  571. end
  572. #--------------------------------------------------------------------------
  573. # ● グラフィックの変更
  574. # character_name : 新しいキャラクター ファイル名
  575. # character_hue : 新しいキャラクター 色相
  576. # battler_name : 新しいバトラー ファイル名
  577. # battler_hue : 新しいバトラー 色相
  578. #--------------------------------------------------------------------------
  579. def set_graphic(character_name, character_hue, battler_name, battler_hue)
  580. @character_name = character_name
  581. @character_hue = character_hue
  582. @battler_name = battler_name
  583. @battler_hue = battler_hue
  584. end
  585. #--------------------------------------------------------------------------
  586. # ● バトル画面 X 座標の取得
  587. #--------------------------------------------------------------------------
  588. def screen_x
  589. # パーティ内の並び順から X 座標を計算して返す
  590. if self.index != nil
  591. return self.index * 160 + 80
  592. else
  593. return 0
  594. end
  595. end
  596. #--------------------------------------------------------------------------
  597. # ● バトル画面 Y 座標の取得
  598. #--------------------------------------------------------------------------
  599. def screen_y
  600. return 464
  601. end
  602. #--------------------------------------------------------------------------
  603. # ● バトル画面 Z 座標の取得
  604. #--------------------------------------------------------------------------
  605. def screen_z
  606. # パーティ内の並び順から Z 座標を計算して返す
  607. if self.index != nil
  608. return 4 - self.index
  609. else
  610. return 0
  611. end
  612. end
  613. end
  614.  
  615.  
  616.  
  617. #==============================================================================
  618. # ■ Game_Actors
  619. #------------------------------------------------------------------------------
  620. #  アクターの配列を扱うクラスです。このクラスのインスタンスは $game_actors で
  621. # 参照されます。
  622. #==============================================================================
  623.  
  624. class Game_Actors
  625. # EDIT
  626. #==============================================================================
  627. attr_accessor :data
  628. #==============================================================================
  629. # END EDIT
  630. #--------------------------------------------------------------------------
  631. # ● オブジェクト初期化
  632. #--------------------------------------------------------------------------
  633. def initialize
  634. @data = []
  635. end
  636. #--------------------------------------------------------------------------
  637. # ● アクターの取得
  638. # actor_id : アクター ID
  639. #--------------------------------------------------------------------------
  640. def [](actor_id)
  641. if actor_id > 999 or $data_actors[actor_id] == nil
  642. return nil
  643. end
  644. if @data[actor_id] == nil
  645. @data[actor_id] = Game_Actor.new(actor_id)
  646. end
  647. return @data[actor_id]
  648. end
  649. end
  650.  
  651.  
  652.  
  653. #==============================================================================
  654. # ■ Game_Party
  655. #------------------------------------------------------------------------------
  656. #  パーティを扱うクラスです。ゴールドやアイテムなどの情報が含まれます。このク
  657. # ラスのインスタンスは $game_party で参照されます。
  658. #==============================================================================
  659.  
  660. class Game_Party
  661. #--------------------------------------------------------------------------
  662. # ● 公開インスタンス変数
  663. #--------------------------------------------------------------------------
  664.  
  665. # EDIT
  666. #==============================================================================
  667. attr_accessor :actors
  668. #==============================================================================
  669. # END EDIT
  670.  
  671. attr_reader :gold # ゴールド
  672. attr_reader :steps # 歩数
  673. #--------------------------------------------------------------------------
  674. # ● オブジェクト初期化
  675. #--------------------------------------------------------------------------
  676. def initialize
  677. # アクターの配列を作成
  678. @actors = []
  679. # ゴールドと歩数を初期化
  680. @gold = 0
  681. @steps = 0
  682. # アイテム、武器、防具の所持数ハッシュを作成
  683. @items = {}
  684. @weapons = {}
  685. @armors = {}
  686. end
  687. #--------------------------------------------------------------------------
  688. # ● 初期パーティのセットアップ
  689. #--------------------------------------------------------------------------
  690. def setup_starting_members
  691. @actors = []
  692. for i in $data_system.party_members
  693. @actors.push($game_actors[i])
  694. end
  695. end
  696. #--------------------------------------------------------------------------
  697. # ● 戦闘テスト用パーティのセットアップ
  698. #--------------------------------------------------------------------------
  699. def setup_battle_test_members
  700. @actors = []
  701. for battler in $data_system.test_battlers
  702. actor = $game_actors[battler.actor_id]
  703. actor.level = battler.level
  704. gain_weapon(battler.weapon_id, 1)
  705. gain_armor(battler.armor1_id, 1)
  706. gain_armor(battler.armor2_id, 1)
  707. gain_armor(battler.armor3_id, 1)
  708. gain_armor(battler.armor4_id, 1)
  709. actor.equip(0, battler.weapon_id)
  710. actor.equip(1, battler.armor1_id)
  711. actor.equip(2, battler.armor2_id)
  712. actor.equip(3, battler.armor3_id)
  713. actor.equip(4, battler.armor4_id)
  714. actor.recover_all
  715. @actors.push(actor)
  716. end
  717. @items = {}
  718. for i in 1...$data_items.size
  719. if $data_items[i].name != ""
  720. occasion = $data_items[i].occasion
  721. if occasion == 0 or occasion == 1
  722. @items[i] = 99
  723. end
  724. end
  725. end
  726. end
  727. #--------------------------------------------------------------------------
  728. # ● パーティメンバーのリフレッシュ
  729. #--------------------------------------------------------------------------
  730. def refresh
  731. # ゲームデータをロードした直後はアクターオブジェクトが
  732. # $game_actors から分離してしまっている。
  733. # ロードのたびにアクターを再設定することで問題を回避する。
  734. new_actors = []
  735. for i in 0...@actors.size
  736. if $data_actors[@actors[i].id] != nil
  737. new_actors.push($game_actors[@actors[i].id])
  738. end
  739. end
  740. @actors = new_actors
  741. end
  742. #--------------------------------------------------------------------------
  743. # ● 最大レベルの取得
  744. #--------------------------------------------------------------------------
  745. def max_level
  746. # パーティ人数が 0 人の場合
  747. if @actors.size == 0
  748. return 0
  749. end
  750. # ローカル変数 level を初期化
  751. level = 0
  752. # パーティメンバーの最大レベルを求める
  753. for actor in @actors
  754. if level < actor.level
  755. level = actor.level
  756. end
  757. end
  758. return level
  759. end
  760. #--------------------------------------------------------------------------
  761. # ● アクターを加える
  762. # actor_id : アクター ID
  763. #--------------------------------------------------------------------------
  764. def add_actor(actor_id)
  765. # アクターを取得
  766. actor = $game_actors[actor_id]
  767. # パーティ人数が 4 人未満で、このアクターがパーティにいない場合
  768. if @actors.size < 4 and not @actors.include?(actor)
  769. # アクターを追加
  770. @actors.push(actor)
  771. # プレイヤーをリフレッシュ
  772. $game_player.refresh
  773. end
  774. end
  775. #--------------------------------------------------------------------------
  776. # ● アクターを外す
  777. # actor_id : アクター ID
  778. #--------------------------------------------------------------------------
  779. def remove_actor(actor_id)
  780. # アクターを削除
  781. @actors.delete($game_actors[actor_id])
  782. # プレイヤーをリフレッシュ
  783. $game_player.refresh
  784. end
  785. #--------------------------------------------------------------------------
  786. # ● ゴールドの増加 (減少)
  787. # n : 金額
  788. #--------------------------------------------------------------------------
  789. def gain_gold(n)
  790. @gold = [[@gold + n, 0].max, 9999999].min
  791. end
  792. #--------------------------------------------------------------------------
  793. # ● ゴールドの減少
  794. # n : 金額
  795. #--------------------------------------------------------------------------
  796. def lose_gold(n)
  797. # 数値を逆転して gain_gold を呼ぶ
  798. gain_gold(-n)
  799. end
  800. #--------------------------------------------------------------------------
  801. # ● 歩数増加
  802. #--------------------------------------------------------------------------
  803. def increase_steps
  804. @steps = [@steps + 1, 9999999].min
  805. end
  806. #--------------------------------------------------------------------------
  807. # ● アイテムの所持数取得
  808. # item_id : アイテム ID
  809. #--------------------------------------------------------------------------
  810. def item_number(item_id)
  811. # ハッシュに個数データがあればその数値を、なければ 0 を返す
  812. return @items.include?(item_id) ? @items[item_id] : 0
  813. end
  814. #--------------------------------------------------------------------------
  815. # ● 武器の所持数取得
  816. # weapon_id : 武器 ID
  817. #--------------------------------------------------------------------------
  818. def weapon_number(weapon_id)
  819. # ハッシュに個数データがあればその数値を、なければ 0 を返す
  820. return @weapons.include?(weapon_id) ? @weapons[weapon_id] : 0
  821. end
  822. #--------------------------------------------------------------------------
  823. # ● 防具の所持数取得
  824. # armor_id : 防具 ID
  825. #--------------------------------------------------------------------------
  826. def armor_number(armor_id)
  827. # ハッシュに個数データがあればその数値を、なければ 0 を返す
  828. return @armors.include?(armor_id) ? @armors[armor_id] : 0
  829. end
  830. #--------------------------------------------------------------------------
  831. # ● アイテムの増加 (減少)
  832. # item_id : アイテム ID
  833. # n : 個数
  834. #--------------------------------------------------------------------------
  835. def gain_item(item_id, n)
  836. # ハッシュの個数データを更新
  837. if item_id > 0
  838. @items[item_id] = [[item_number(item_id) + n, 0].max, 99].min
  839. end
  840. end
  841. #--------------------------------------------------------------------------
  842. # ● 武器の増加 (減少)
  843. # weapon_id : 武器 ID
  844. # n : 個数
  845. #--------------------------------------------------------------------------
  846. def gain_weapon(weapon_id, n)
  847. # ハッシュの個数データを更新
  848. if weapon_id > 0
  849. @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min
  850. end
  851. end
  852. #--------------------------------------------------------------------------
  853. # ● 防具の増加 (減少)
  854. # armor_id : 防具 ID
  855. # n : 個数
  856. #--------------------------------------------------------------------------
  857. def gain_armor(armor_id, n)
  858. # ハッシュの個数データを更新
  859. if armor_id > 0
  860. @armors[armor_id] = [[armor_number(armor_id) + n, 0].max, 99].min
  861. end
  862. end
  863. #--------------------------------------------------------------------------
  864. # ● アイテムの減少
  865. # item_id : アイテム ID
  866. # n : 個数
  867. #--------------------------------------------------------------------------
  868. def lose_item(item_id, n)
  869. # 数値を逆転して gain_item を呼ぶ
  870. gain_item(item_id, -n)
  871. end
  872. #--------------------------------------------------------------------------
  873. # ● 武器の減少
  874. # weapon_id : 武器 ID
  875. # n : 個数
  876. #--------------------------------------------------------------------------
  877. def lose_weapon(weapon_id, n)
  878. # 数値を逆転して gain_weapon を呼ぶ
  879. gain_weapon(weapon_id, -n)
  880. end
  881. #--------------------------------------------------------------------------
  882. # ● 防具の減少
  883. # armor_id : 防具 ID
  884. # n : 個数
  885. #--------------------------------------------------------------------------
  886. def lose_armor(armor_id, n)
  887. # 数値を逆転して gain_armor を呼ぶ
  888. gain_armor(armor_id, -n)
  889. end
  890. #--------------------------------------------------------------------------
  891. # ● アイテムの使用可能判定
  892. # item_id : アイテム ID
  893. #--------------------------------------------------------------------------
  894. def item_can_use?(item_id)
  895. # アイテムの個数が 0 個の場合
  896. if item_number(item_id) == 0
  897. # 使用不能
  898. return false
  899. end
  900. # 使用可能時を取得
  901. occasion = $data_items[item_id].occasion
  902. # バトルの場合
  903. if $game_temp.in_battle
  904. # 使用可能時が 0 (常時) または 1 (バトルのみ) なら使用可能
  905. return (occasion == 0 or occasion == 1)
  906. end
  907. # 使用可能時が 0 (常時) または 2 (メニューのみ) なら使用可能
  908. return (occasion == 0 or occasion == 2)
  909. end
  910. #--------------------------------------------------------------------------
  911. # ● 全員のアクションクリア
  912. #--------------------------------------------------------------------------
  913. def clear_actions
  914. # パーティ全員のアクションをクリア
  915. for actor in @actors
  916. actor.current_action.clear
  917. end
  918. end
  919. #--------------------------------------------------------------------------
  920. # ● コマンド入力可能判定
  921. #--------------------------------------------------------------------------
  922. def inputable?
  923. # 一人でもコマンド入力可能なら true を返す
  924. for actor in @actors
  925. if actor.inputable?
  926. return true
  927. end
  928. end
  929. return false
  930. end
  931. #--------------------------------------------------------------------------
  932. # ● 全滅判定
  933. #--------------------------------------------------------------------------
  934. def all_dead?
  935. # パーティ人数が 0 人の場合
  936. if $game_party.actors.size == 0
  937. return false
  938. end
  939. # HP 0 以上のアクターがパーティにいる場合
  940. for actor in @actors
  941. if actor.hp > 0
  942. return false
  943. end
  944. end
  945. # 全滅
  946. return true
  947. end
  948. #--------------------------------------------------------------------------
  949. # ● スリップダメージチェック (マップ用)
  950. #--------------------------------------------------------------------------
  951. def check_map_slip_damage
  952. for actor in @actors
  953. if actor.hp > 0 and actor.slip_damage?
  954. actor.hp -= [actor.maxhp / 100, 1].max
  955. if actor.hp == 0
  956. $game_system.se_play($data_system.actor_collapse_se)
  957. end
  958. $game_screen.start_flash(Color.new(255,0,0,128), 4)
  959. $game_temp.gameover = $game_party.all_dead?
  960. end
  961. end
  962. end
  963. #--------------------------------------------------------------------------
  964. # ● 対象アクターのランダムな決定
  965. # hp0 : HP 0 のアクターに限る
  966. #--------------------------------------------------------------------------
  967. def random_target_actor(hp0 = false)
  968. # ルーレットを初期化
  969. roulette = []
  970. # ループ
  971. for actor in @actors
  972. # 条件に該当する場合
  973. if (not hp0 and actor.exist?) or (hp0 and actor.hp0?)
  974. # アクターのクラスの [位置] を取得
  975. position = $data_classes[actor.class_id].position
  976. # 前衛のとき n = 4、中衛のとき n = 3、後衛のとき n = 2
  977. n = 4 - position
  978. # ルーレットにアクターを n 回追加
  979. n.times do
  980. roulette.push(actor)
  981. end
  982. end
  983. end
  984. # ルーレットのサイズが 0 の場合
  985. if roulette.size == 0
  986. return nil
  987. end
  988. # ルーレットを回し、アクターを決定
  989. return roulette[rand(roulette.size)]
  990. end
  991. #--------------------------------------------------------------------------
  992. # ● 対象アクターのランダムな決定 (HP 0)
  993. #--------------------------------------------------------------------------
  994. def random_target_actor_hp0
  995. return random_target_actor(true)
  996. end
  997. #--------------------------------------------------------------------------
  998. # ● 対象アクターのスムーズな決定
  999. # actor_index : アクターインデックス
  1000. #--------------------------------------------------------------------------
  1001. def smooth_target_actor(actor_index)
  1002. # アクターを取得
  1003. actor = @actors[actor_index]
  1004. # アクターが存在する場合
  1005. if actor != nil and actor.exist?
  1006. return actor
  1007. end
  1008. # ループ
  1009. for actor in @actors
  1010. # アクターが存在する場合
  1011. if actor.exist?
  1012. return actor
  1013. end
  1014. end
  1015. end
  1016. end
  1017.  
  1018.  
  1019. #==============================================================================
  1020. # ■ Scene_Title
  1021. #==============================================================================
  1022.  
  1023. class Scene_Title
  1024.  
  1025. def main
  1026. # edit #
  1027. #==============================================================================
  1028. #-------------------------------------------------------------------------- # Item ID numbers
  1029. $basic_items_ids = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]
  1030. $quest_items_ids = [23,24,25,26,27,28,29,30,31,32]
  1031. #-------------------------------------------------------------------------- # Weapon ID numbers
  1032. $weapon_ids = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,
  1033. 19,20,21,22,23,24,25,26,27,28,29,30,31,32]
  1034. #-------------------------------------------------------------------------- # Shield ID numbers
  1035. $armor_ids = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]
  1036. $accessory_ids = [25,26,27,28,29,30,31,32]
  1037. #==============================================================================
  1038. # end edit #
  1039. if $BTEST
  1040. battle_test
  1041. return
  1042. end
  1043. $data_actors = load_data("Data/Actors.rxdata")
  1044. $data_classes = load_data("Data/Classes.rxdata")
  1045. $data_skills = load_data("Data/Skills.rxdata")
  1046. $data_items = load_data("Data/Items.rxdata")
  1047. $data_weapons = load_data("Data/Weapons.rxdata")
  1048. $data_armors = load_data("Data/Armors.rxdata")
  1049. $data_enemies = load_data("Data/Enemies.rxdata")
  1050. $data_troops = load_data("Data/Troops.rxdata")
  1051. $data_states = load_data("Data/States.rxdata")
  1052. $data_animations = load_data("Data/Animations.rxdata")
  1053. $data_tilesets = load_data("Data/Tilesets.rxdata")
  1054. $data_common_events = load_data("Data/CommonEvents.rxdata")
  1055. $data_system = load_data("Data/System.rxdata")
  1056. # edit #
  1057. #==============================================================================
  1058. $map_infos = load_data("Data/MapInfos.rxdata")
  1059. for key in $map_infos.keys
  1060. $map_infos[key] = $map_infos[key].name
  1061. end
  1062. $game_time = Game_Time.new
  1063. #==============================================================================
  1064. # end edit #
  1065. $game_system = Game_System.new
  1066. @sprite = Sprite.new
  1067. @sprite.bitmap = RPG::Cache.title($data_system.title_name)
  1068. s1 = "New Game"
  1069. s2 = "Continue"
  1070. s3 = "Shutdown"
  1071. @command_window = Window_Command.new(192, [s1, s2, s3])
  1072. @command_window.back_opacity = 160
  1073. @command_window.x = 320 - @command_window.width / 2
  1074. @command_window.y = 288
  1075. @continue_enabled = false
  1076. for i in 0..3
  1077. if FileTest.exist?("Save#{i+1}.rxdata")
  1078. @continue_enabled = true
  1079. end
  1080. end
  1081. if @continue_enabled
  1082. @command_window.index = 1
  1083. else
  1084. @command_window.disable_item(1)
  1085. end
  1086. $game_system.bgm_play($data_system.title_bgm)
  1087. Audio.me_stop
  1088. Audio.bgs_stop
  1089. # トランジション実行
  1090. Graphics.transition
  1091. # メインループ
  1092. loop do
  1093. # ゲーム画面を更新
  1094. Graphics.update
  1095. # 入力情報を更新
  1096. Input.update
  1097. # フレーム更新
  1098. update
  1099. # 画面が切り替わったらループを中断
  1100. if $scene != self
  1101. break
  1102. end
  1103. end
  1104. # トランジション準備
  1105. Graphics.freeze
  1106. # コマンドウィンドウを解放
  1107. @command_window.dispose
  1108. # タイトルグラフィックを解放
  1109. @sprite.bitmap.dispose
  1110. @sprite.dispose
  1111. end
  1112. #--------------------------------------------------------------------------
  1113. # ● フレーム更新
  1114. #--------------------------------------------------------------------------
  1115. def update
  1116. # コマンドウィンドウを更新
  1117. @command_window.update
  1118. # C ボタンが押された場合
  1119. if Input.trigger?(Input::C)
  1120. # コマンドウィンドウのカーソル位置で分岐
  1121. case @command_window.index
  1122. when 0 # ニューゲーム
  1123. command_new_game
  1124. when 1 # コンティニュー
  1125. command_continue
  1126. when 2 # シャットダウン
  1127. command_shutdown
  1128. end
  1129. end
  1130. end
  1131. #--------------------------------------------------------------------------
  1132. # ● コマンド : ニューゲーム
  1133. #--------------------------------------------------------------------------
  1134. def command_new_game
  1135. # 決定 SE を演奏
  1136. $game_system.se_play($data_system.decision_se)
  1137. # BGM を停止
  1138. Audio.bgm_stop
  1139. # プレイ時間計測用のフレームカウントをリセット
  1140. Graphics.frame_count = 0
  1141. # 各種ゲームオブジェクトを作成
  1142. $game_temp = Game_Temp.new
  1143. $game_system = Game_System.new
  1144. $game_switches = Game_Switches.new
  1145. $game_variables = Game_Variables.new
  1146. $game_self_switches = Game_SelfSwitches.new
  1147. $game_screen = Game_Screen.new
  1148. $game_actors = Game_Actors.new
  1149. $game_party = Game_Party.new
  1150. $game_troop = Game_Troop.new
  1151. $game_map = Game_Map.new
  1152. $game_player = Game_Player.new
  1153. # 初期パーティをセットアップ
  1154. $game_party.setup_starting_members
  1155. # 初期位置のマップをセットアップ
  1156. $game_map.setup($data_system.start_map_id)
  1157. # プレイヤーを初期位置に移動
  1158. $game_player.moveto($data_system.start_x, $data_system.start_y)
  1159. # プレイヤーをリフレッシュ
  1160. $game_player.refresh
  1161. # マップに設定されている BGM と BGS の自動切り替えを実行
  1162. $game_map.autoplay
  1163. # マップを更新 (並列イベント実行)
  1164. $game_map.update
  1165. # マップ画面に切り替え
  1166. $scene = Scene_Map.new
  1167. end
  1168. #--------------------------------------------------------------------------
  1169. # ● コマンド : コンティニュー
  1170. #--------------------------------------------------------------------------
  1171. def command_continue
  1172. # コンティニューが無効の場合
  1173. unless @continue_enabled
  1174. # ブザー SE を演奏
  1175. $game_system.se_play($data_system.buzzer_se)
  1176. return
  1177. end
  1178. # 決定 SE を演奏
  1179. $game_system.se_play($data_system.decision_se)
  1180. # ロード画面に切り替え
  1181. $scene = Scene_Load.new
  1182. end
  1183. #--------------------------------------------------------------------------
  1184. # ● コマンド : シャットダウン
  1185. #--------------------------------------------------------------------------
  1186. def command_shutdown
  1187. # 決定 SE を演奏
  1188. $game_system.se_play($data_system.decision_se)
  1189. # BGM、BGS、ME をフェードアウト
  1190. Audio.bgm_fade(800)
  1191. Audio.bgs_fade(800)
  1192. Audio.me_fade(800)
  1193. # シャットダウン
  1194. $scene = nil
  1195. end
  1196. #--------------------------------------------------------------------------
  1197. # ● 戦闘テスト
  1198. #--------------------------------------------------------------------------
  1199. def battle_test
  1200. # データベース (戦闘テスト用) をロード
  1201. $data_actors = load_data("Data/BT_Actors.rxdata")
  1202. $data_classes = load_data("Data/BT_Classes.rxdata")
  1203. $data_skills = load_data("Data/BT_Skills.rxdata")
  1204. $data_items = load_data("Data/BT_Items.rxdata")
  1205. $data_weapons = load_data("Data/BT_Weapons.rxdata")
  1206. $data_armors = load_data("Data/BT_Armors.rxdata")
  1207. $data_enemies = load_data("Data/BT_Enemies.rxdata")
  1208. $data_troops = load_data("Data/BT_Troops.rxdata")
  1209. $data_states = load_data("Data/BT_States.rxdata")
  1210. $data_animations = load_data("Data/BT_Animations.rxdata")
  1211. $data_tilesets = load_data("Data/BT_Tilesets.rxdata")
  1212. $data_common_events = load_data("Data/BT_CommonEvents.rxdata")
  1213. $data_system = load_data("Data/BT_System.rxdata")
  1214. # プレイ時間計測用のフレームカウントをリセット
  1215. Graphics.frame_count = 0
  1216. # 各種ゲームオブジェクトを作成
  1217. $game_temp = Game_Temp.new
  1218. $game_system = Game_System.new
  1219. $game_switches = Game_Switches.new
  1220. $game_variables = Game_Variables.new
  1221. $game_self_switches = Game_SelfSwitches.new
  1222. $game_screen = Game_Screen.new
  1223. $game_actors = Game_Actors.new
  1224. $game_party = Game_Party.new
  1225. $game_troop = Game_Troop.new
  1226. $game_map = Game_Map.new
  1227. $game_player = Game_Player.new
  1228. # 戦闘テスト用のパーティをセットアップ
  1229. $game_party.setup_battle_test_members
  1230. # トループ ID、逃走可能フラグ、バトルバックを設定
  1231. $game_temp.battle_troop_id = $data_system.test_troop_id
  1232. $game_temp.battle_can_escape = true
  1233. $game_map.battleback_name = $data_system.battleback_name
  1234. # バトル開始 SE を演奏
  1235. $game_system.se_play($data_system.battle_start_se)
  1236. # バトル BGM を演奏
  1237. $game_system.bgm_play($game_system.battle_bgm)
  1238. # バトル画面に切り替え
  1239. $scene = Scene_Battle.new
  1240. end
  1241. end
  1242.  
  1243.  
  1244.  
  1245. #==============================================================================
  1246. # ■ Scene_Save
  1247. #------------------------------------------------------------------------------
  1248. #  セーブ画面の処理を行うクラスです。
  1249. #==============================================================================
  1250.  
  1251. class Scene_Save < Scene_File
  1252. #--------------------------------------------------------------------------
  1253. # ● オブジェクト初期化
  1254. #--------------------------------------------------------------------------
  1255. def initialize
  1256. super("Which file do you want to save to?")
  1257. end
  1258. #--------------------------------------------------------------------------
  1259. # ● 決定時の処理
  1260. #--------------------------------------------------------------------------
  1261. def on_decision(filename)
  1262. # セーブ SE を演奏
  1263. $game_system.se_play($data_system.save_se)
  1264. # セーブデータの書き込み
  1265. file = File.open(filename, "wb")
  1266. write_save_data(file)
  1267. file.close
  1268. # イベントから呼び出されている場合
  1269. if $game_temp.save_calling
  1270. # セーブ呼び出しフラグをクリア
  1271. $game_temp.save_calling = false
  1272. # マップ画面に切り替え
  1273. $scene = Scene_Map.new
  1274. return
  1275. end
  1276. # メニュー画面に切り替え
  1277. $scene = Scene_Menu.new(9)
  1278. end
  1279. #--------------------------------------------------------------------------
  1280. # ● キャンセル時の処理
  1281. #--------------------------------------------------------------------------
  1282. def on_cancel
  1283. # キャンセル SE を演奏
  1284. $game_system.se_play($data_system.cancel_se)
  1285. # イベントから呼び出されている場合
  1286. if $game_temp.save_calling
  1287. # セーブ呼び出しフラグをクリア
  1288. $game_temp.save_calling = false
  1289. # マップ画面に切り替え
  1290. $scene = Scene_Map.new
  1291. return
  1292. end
  1293. # メニュー画面に切り替え
  1294. $scene = Scene_Menu.new(9)
  1295. end
  1296. #--------------------------------------------------------------------------
  1297. # ● セーブデータの書き込み
  1298. # file : 書き込み用ファイルオブジェクト (オープン済み)
  1299. #--------------------------------------------------------------------------
  1300. def write_save_data(file)
  1301. # セーブファイル描画用のキャラクターデータを作成
  1302. characters = []
  1303. for i in 0...$game_party.actors.size
  1304. actor = $game_party.actors[i]
  1305. characters.push([actor.character_name, actor.character_hue])
  1306. end
  1307. # セーブファイル描画用のキャラクターデータを書き込む
  1308. Marshal.dump(characters, file)
  1309. # プレイ時間計測用のフレームカウントを書き込む
  1310. Marshal.dump(Graphics.frame_count, file)
  1311. # セーブ回数を 1 増やす
  1312. $game_system.save_count += 1
  1313. # マジックナンバーを保存する
  1314. # (エディタで保存するたびにランダムな値に書き換えられる)
  1315. $game_system.magic_number = $data_system.magic_number
  1316. # 各種ゲームオブジェクトを書き込む
  1317. Marshal.dump($game_system, file)
  1318. Marshal.dump($game_switches, file)
  1319. Marshal.dump($game_variables, file)
  1320. Marshal.dump($game_self_switches, file)
  1321. Marshal.dump($game_screen, file)
  1322. Marshal.dump($game_actors, file)
  1323. Marshal.dump($game_party, file)
  1324. Marshal.dump($game_troop, file)
  1325. Marshal.dump($game_map, file)
  1326. Marshal.dump($game_player, file)
  1327. # edit #
  1328. #==============================================================================
  1329. Marshal.dump($game_time,file)
  1330. #==============================================================================
  1331. # end edit #
  1332. end
  1333. end
  1334.  
  1335.  
  1336.  
  1337. #==============================================================================
  1338. # ■ Scene_Load
  1339. #------------------------------------------------------------------------------
  1340. #  ロード画面の処理を行うクラスです。
  1341. #==============================================================================
  1342.  
  1343. class Scene_Load < Scene_File
  1344. #--------------------------------------------------------------------------
  1345. # ● オブジェクト初期化
  1346. #--------------------------------------------------------------------------
  1347. def initialize
  1348. # テンポラリオブジェクトを再作成
  1349. $game_temp = Game_Temp.new
  1350. # タイムスタンプが最新のファイルを選択
  1351. $game_temp.last_file_index = 0
  1352. latest_time = Time.at(0)
  1353. for i in 0..3
  1354. filename = make_filename(i)
  1355. if FileTest.exist?(filename)
  1356. file = File.open(filename, "r")
  1357. if file.mtime > latest_time
  1358. latest_time = file.mtime
  1359. $game_temp.last_file_index = i
  1360. end
  1361. file.close
  1362. end
  1363. end
  1364. super("Which file do you wish to load from?")
  1365. end
  1366. #--------------------------------------------------------------------------
  1367. # ● 決定時の処理
  1368. #--------------------------------------------------------------------------
  1369. def on_decision(filename)
  1370. # ファイルが存在しない場合
  1371. unless FileTest.exist?(filename)
  1372. # ブザー SE を演奏
  1373. $game_system.se_play($data_system.buzzer_se)
  1374. return
  1375. end
  1376. # ロード SE を演奏
  1377. $game_system.se_play($data_system.load_se)
  1378. # セーブデータの書き込み
  1379. file = File.open(filename, "rb")
  1380. read_save_data(file)
  1381. file.close
  1382. # BGM、BGS を復帰
  1383. $game_system.bgm_play($game_system.playing_bgm)
  1384. $game_system.bgs_play($game_system.playing_bgs)
  1385. # マップを更新 (並列イベント実行)
  1386. $game_map.update
  1387. # マップ画面に切り替え
  1388. $scene = Scene_Map.new
  1389. end
  1390. #--------------------------------------------------------------------------
  1391. # ● キャンセル時の処理
  1392. #--------------------------------------------------------------------------
  1393. def on_cancel
  1394. # キャンセル SE を演奏
  1395. $game_system.se_play($data_system.cancel_se)
  1396. # タイトル画面に切り替え
  1397. $scene = Scene_Title.new
  1398. end
  1399. #--------------------------------------------------------------------------
  1400. # ● セーブデータの読み込み
  1401. # file : 読み込み用ファイルオブジェクト (オープン済み)
  1402. #--------------------------------------------------------------------------
  1403. def read_save_data(file)
  1404. # セーブファイル描画用のキャラクターデータを読み込む
  1405. characters = Marshal.load(file)
  1406. # プレイ時間計測用のフレームカウントを読み込む
  1407. Graphics.frame_count = Marshal.load(file)
  1408. # 各種ゲームオブジェクトを読み込む
  1409. $game_system = Marshal.load(file)
  1410. $game_switches = Marshal.load(file)
  1411. $game_variables = Marshal.load(file)
  1412. $game_self_switches = Marshal.load(file)
  1413. $game_screen = Marshal.load(file)
  1414. $game_actors = Marshal.load(file)
  1415. $game_party = Marshal.load(file)
  1416. $game_troop = Marshal.load(file)
  1417. $game_map = Marshal.load(file)
  1418. $game_player = Marshal.load(file)
  1419. # edit #
  1420. #==============================================================================
  1421. $game_time =Marshal.load(file)
  1422. #==============================================================================
  1423. # end edit #
  1424. # マジックナンバーがセーブ時と異なる場合
  1425. # (エディタで編集が加えられている場合)
  1426. if $game_system.magic_number != $data_system.magic_number
  1427. # マップをリロード
  1428. $game_map.setup($game_map.map_id)
  1429. $game_player.center($game_player.x, $game_player.y)
  1430. end
  1431. # パーティメンバーをリフレッシュ
  1432. $game_party.refresh
  1433. end
  1434. end
  1435.  
  1436.  
  1437.  
  1438. #==============================================================================
  1439. # Custom Menu System
  1440. # Written by Diego
  1441. # Bug-fixing by ccoa
  1442. #==============================================================================
  1443. # - Fully Animated
  1444. # Includes:
  1445. # - Quest/Key Item Support
  1446. # - Organized Menus by Items, Weapons, Armors, Accessories and Quest/Key Items
  1447. # - Advanced Equip Screen (by RPG-Advocate)
  1448. # - Reorganized Status Screen
  1449. # - Elemental Resistance Circle
  1450. # - Map Name Window
  1451. # - Icons in Menu
  1452. # - Options
  1453. # - Support for Deke/Near Fantastica's Day/Night System
  1454. #
  1455. # Instructions Manual:
  1456. #
  1457. # Step 1 - copy and paste these lines into Scene_Title just under def main
  1458. # #-------------------------------------------------------------------------- # Item ID numbers
  1459. # $basic_items_ids = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]
  1460. # $quest_items_ids = [23,24,25,26,27,28,29,30,31,32]
  1461. # #-------------------------------------------------------------------------- # Weapon ID numbers
  1462. # $weapon_ids = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,
  1463. #19,20,21,22,23,24,25,26,27,28,29,30,31,32]
  1464. # #-------------------------------------------------------------------------- # Armor ID numbers
  1465. # $armor_ids = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]
  1466. # $accessory_ids = [25,26,27,28,29,30,31,32]
  1467. # This is for organizing your items.
  1468. #
  1469. # Step 2 - copy and paste these lines into Scene_Title just under $data_system = load_data("Data/System.rxdata")
  1470. # $map_infos = load_data("Data/MapInfos.rxdata")
  1471. # for key in $map_infos.keys
  1472. # $map_infos[key] = $map_infos[key].name
  1473. # end
  1474. # $game_time = Game_Time.new
  1475. # This is support for Window_NewTime and Window_NewLocation
  1476. #
  1477. # Step 3 - copy and paste this line into Scene_Save just under Marshal.dump($game_player, file)
  1478. # Marshal.dump($game_time,file)
  1479. # also change this line $scene = Scene_Menu.new(4) into this $scene = Scene_Menu.new(9) in def on_decision(filename)
  1480. # This is support for Window_NewTime
  1481. #
  1482. # Step 4 - copy and paste this line into Scene_Load just under $game_player = Marshal.load(file)
  1483. # $game_time =Marshal.load(file)
  1484. # This is support for Window_NewTime
  1485. #
  1486. # Support for Deke/Near Fantastica's Day and Night System:
  1487. # You can copy and paste the D&N system script into a new section above main,
  1488. # just make sure that the D&N system script is below this one in the list
  1489. #
  1490. #
  1491. # That's all. Enjoy ^^;
  1492. # - Diego
  1493.  
  1494.  
  1495.  
  1496.  
  1497. #==============================================================================
  1498. # ■ Bestiary
  1499. #------------------------------------------------------------------------------
  1500. # Created by Momomo
  1501. # Modified by Thousand Dragoon Link
  1502. #==============================================================================
  1503.  
  1504. module Enemy_Book_Config
  1505. DROP_ITEM_NEED_ANALYZE = false
  1506. EVA_NAME = "Evasion"
  1507. SHOW_COMPLETE_TYPE = 3
  1508.  
  1509. end
  1510.  
  1511. class Game_Temp
  1512. attr_accessor :enemy_book_data
  1513. alias temp_enemy_book_data_initialize initialize
  1514. def initialize
  1515. temp_enemy_book_data_initialize
  1516. @enemy_book_data = Data_MonsterBook.new
  1517. end
  1518. end
  1519.  
  1520. class Game_Party
  1521. attr_accessor :enemy_info
  1522. #--------------------------------------------------------------------------
  1523. alias book_info_initialize initialize
  1524. def initialize
  1525. book_info_initialize
  1526. @enemy_info = {}
  1527. end
  1528. #--------------------------------------------------------------------------
  1529. def add_enemy_info(enemy_id, type = 0)
  1530. case type
  1531. when 0
  1532. if @enemy_info[enemy_id] == 2
  1533. return false
  1534. end
  1535. @enemy_info[enemy_id] = 1
  1536. when 1
  1537. @enemy_info[enemy_id] = 2
  1538. when -1
  1539. @enemy_info[enemy_id] = 0
  1540. end
  1541. end
  1542. #--------------------------------------------------------------------------
  1543. def enemy_book_max
  1544. return $game_temp.enemy_book_data.id_data.size - 1
  1545. end
  1546. #--------------------------------------------------------------------------
  1547. def enemy_book_now
  1548. now_enemy_info = @enemy_info.keys
  1549. no_add = $game_temp.enemy_book_data.no_add_element
  1550. new_enemy_info = []
  1551. for i in now_enemy_info
  1552. enemy = $data_enemies[i]
  1553. next if enemy.name == ""
  1554. if enemy.element_ranks[no_add] == 1
  1555. next
  1556. end
  1557. new_enemy_info.push(enemy.id)
  1558. end
  1559. return new_enemy_info.size
  1560. end
  1561. #--------------------------------------------------------------------------
  1562. def enemy_book_complete_percentage
  1563. e_max = enemy_book_max.to_f
  1564. e_now = enemy_book_now.to_f
  1565. comp = e_now / e_max * 100
  1566. return comp.truncate
  1567. end
  1568. end
  1569.  
  1570. class Interpreter
  1571. def enemy_book_max
  1572. return $game_party.enemy_book_max
  1573. end
  1574. def enemy_book_now
  1575. return $game_party.enemy_book_now
  1576. end
  1577. def enemy_book_comp
  1578. return $game_party.enemy_book_complete_percentage
  1579. end
  1580. end
  1581.  
  1582. class Scene_Battle
  1583. alias add_enemy_info_start_phase5 start_phase5
  1584. def start_phase5
  1585. for enemy in $game_troop.enemies
  1586. unless enemy.hidden
  1587. $game_party.add_enemy_info(enemy.id, 0)
  1588. end
  1589. end
  1590. add_enemy_info_start_phase5
  1591. end
  1592. end
  1593.  
  1594. class Window_Base < Window
  1595. #--------------------------------------------------------------------------
  1596. def draw_enemy_drop_item(enemy, x, y)
  1597. self.contents.font.color = normal_color
  1598. treasures = []
  1599. if enemy.item_id > 0
  1600. treasures.push($data_items[enemy.item_id])
  1601. end
  1602. if enemy.weapon_id > 0
  1603. treasures.push($data_weapons[enemy.weapon_id])
  1604. end
  1605. if enemy.armor_id > 0
  1606. treasures.push($data_armors[enemy.armor_id])
  1607. end
  1608. if treasures.size > 0
  1609. item = treasures[0]
  1610. bitmap = RPG::Cache.icon(item.icon_name)
  1611. opacity = 255
  1612. self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  1613. name = treasures[0].name
  1614. else
  1615. self.contents.font.color = disabled_color
  1616. name = "No Item"
  1617. end
  1618. self.contents.draw_text(x+28, y, 212, 32, name)
  1619. end
  1620. #--------------------------------------------------------------------------
  1621. def draw_actor_hp2(actor, x, y, width = 144)
  1622. self.contents.font.color = system_color
  1623. self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
  1624. if width - 32 >= 108
  1625. hp_x = x + width - 108
  1626. flag = true
  1627. elsif width - 32 >= 48
  1628. hp_x = x + width - 48
  1629. flag = false
  1630. end
  1631. self.contents.font.color = actor.hp == 0 ? knockout_color :
  1632. actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  1633. #self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
  1634. if flag
  1635. self.contents.font.color = normal_color
  1636. #self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
  1637. self.contents.draw_text(hp_x + 84, y, 48, 32, actor.maxhp.to_s)
  1638. end
  1639. end
  1640. #--------------------------------------------------------------------------
  1641. def draw_actor_sp2(actor, x, y, width = 144)
  1642. self.contents.font.color = system_color
  1643. self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
  1644. if width - 32 >= 108
  1645. sp_x = x + width - 108
  1646. flag = true
  1647. elsif width - 32 >= 48
  1648. sp_x = x + width - 48
  1649. flag = false
  1650. end
  1651. self.contents.font.color = actor.sp == 0 ? knockout_color :
  1652. actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  1653. #self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
  1654. if flag
  1655. self.contents.font.color = normal_color
  1656. #self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
  1657. self.contents.draw_text(sp_x + 84, y, 48, 32, actor.maxsp.to_s)
  1658. end
  1659. end
  1660. #--------------------------------------------------------------------------
  1661. def draw_enemy_book_id(enemy, x, y)
  1662. self.contents.font.color = normal_color
  1663. id = $game_temp.enemy_book_data.id_data.index(enemy.id)
  1664. self.contents.draw_text(x, y, 32, 32, id.to_s)
  1665. end
  1666. #--------------------------------------------------------------------------
  1667. def draw_enemy_name(enemy, x, y)
  1668. self.contents.font.color = normal_color
  1669. self.contents.draw_text(x, y, 152, 32, enemy.name)
  1670. end
  1671. #--------------------------------------------------------------------------
  1672. def draw_enemy_graphic(enemy, x, y, opacity = 255)
  1673. bitmap = RPG::Cache.battler(enemy.battler_name, enemy.battler_hue)
  1674. cw = bitmap.width
  1675. ch = bitmap.height
  1676. src_rect = Rect.new(0, 0, cw, ch)
  1677. x = x + (cw / 2 - x) if cw / 2 > x
  1678. self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect, opacity)
  1679. end
  1680. #--------------------------------------------------------------------------
  1681. def draw_enemy_exp(enemy, x, y)
  1682. self.contents.font.color = system_color
  1683. self.contents.draw_text(x, y, 120, 32, "EXP")
  1684. self.contents.font.color = normal_color
  1685. self.contents.draw_text(x + 120, y, 36, 32, enemy.exp.to_s, 2)
  1686. end
  1687. #--------------------------------------------------------------------------
  1688. def draw_enemy_gold(enemy, x, y)
  1689. self.contents.font.color = system_color
  1690. self.contents.draw_text(x, y, 120, 32, $data_system.words.gold)
  1691. self.contents.font.color = normal_color
  1692. self.contents.draw_text(x + 120, y, 36, 32, enemy.gold.to_s, 2)
  1693. end
  1694. end
  1695.  
  1696. class Game_Enemy_Book < Game_Enemy
  1697. #--------------------------------------------------------------------------
  1698. def initialize(enemy_id)
  1699. super(2, 1)
  1700. @enemy_id = enemy_id
  1701. enemy = $data_enemies[@enemy_id]
  1702. @battler_name = enemy.battler_name
  1703. @battler_hue = enemy.battler_hue
  1704. @hp = maxhp
  1705. @sp = maxsp
  1706. end
  1707. end
  1708.  
  1709. class Data_MonsterBook
  1710. attr_reader :id_data
  1711. #--------------------------------------------------------------------------
  1712. def initialize
  1713. @id_data = enemy_book_id_set
  1714. end
  1715. #--------------------------------------------------------------------------
  1716. def no_add_element
  1717. no_add = 0
  1718. for i in 1...$data_system.elements.size
  1719. if $data_system.elements[i] =~ /図鑑登録無効/
  1720. no_add = i
  1721. break
  1722. end
  1723. end
  1724. return no_add
  1725. end
  1726. #--------------------------------------------------------------------------
  1727. def enemy_book_id_set
  1728. data = [0]
  1729. no_add = no_add_element
  1730. for i in 1...$data_enemies.size
  1731. enemy = $data_enemies[i]
  1732. next if enemy.name == ""
  1733. if enemy.element_ranks[no_add] == 1
  1734. next
  1735. end
  1736. data.push(enemy.id)
  1737. end
  1738. return data
  1739. end
  1740. end
  1741.  
  1742.  
  1743. class Window_MonsterBook < Window_Selectable
  1744. attr_reader :data
  1745. #--------------------------------------------------------------------------
  1746. def initialize(index=0)
  1747. super(0, 64, 576, 352)
  1748. @column_max = 2
  1749. @book_data = $game_temp.enemy_book_data
  1750. @data = @book_data.id_data.dup
  1751. @data.shift
  1752. #@data.sort!
  1753. @item_max = @data.size
  1754. self.index = 0
  1755. refresh if @item_max > 0
  1756. end
  1757. #--------------------------------------------------------------------------
  1758. def data_set
  1759. data = $game_party.enemy_info.keys
  1760. data.sort!
  1761. newdata = []
  1762. for i in data
  1763. next if $game_party.enemy_info[i] == 0
  1764. if book_id(i) != nil
  1765. newdata.push(i)
  1766. end
  1767. end
  1768. return newdata
  1769. end
  1770. #--------------------------------------------------------------------------
  1771. def show?(id)
  1772. if $game_party.enemy_info[id] == 0 or $game_party.enemy_info[id] == nil
  1773. return false
  1774. else
  1775. return true
  1776. end
  1777. end
  1778. #--------------------------------------------------------------------------
  1779. def book_id(id)
  1780. return @book_data.index(id)
  1781. end
  1782. #--------------------------------------------------------------------------
  1783. def item
  1784. return @data[self.index]
  1785. end
  1786. #--------------------------------------------------------------------------
  1787. def refresh
  1788. if self.contents != nil
  1789. self.contents.dispose
  1790. self.contents = nil
  1791. end
  1792. self.contents = Bitmap.new(width - 32, row_max * 32)
  1793. self.contents.font.name= $fontface
  1794. self.contents.font.size= 20
  1795. if @item_max > 0
  1796. for i in 0...@item_max
  1797. draw_item(i)
  1798. end
  1799. end
  1800. end
  1801. #--------------------------------------------------------------------------
  1802. def draw_item(index)
  1803. enemy = $data_enemies[@data[index]]
  1804. return if enemy == nil
  1805. x = 4 + index % 2 * (256 + 32)
  1806. y = index / 2 * 32
  1807. rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  1808. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  1809. self.contents.font.color = normal_color
  1810. draw_enemy_book_id(enemy, x, y)
  1811. if show?(enemy.id)
  1812. self.contents.draw_text(x + 28+16, y, 212, 32, enemy.name, 0)
  1813. else
  1814. self.contents.draw_text(x + 28+16, y, 212, 32, "????????????????", 0)
  1815. return
  1816. end
  1817. if analyze?(@data[index])
  1818. self.contents.font.color = text_color(3)
  1819. self.contents.draw_text(x + 256, y, 24, 32, "済", 2)
  1820. end
  1821. end
  1822. #--------------------------------------------------------------------------
  1823. def analyze?(enemy_id)
  1824. if $game_party.enemy_info[enemy_id] == 2
  1825. return true
  1826. else
  1827. return false
  1828. end
  1829. end
  1830. end
  1831.  
  1832.  
  1833. class Window_MonsterBook_Info < Window_Base
  1834. include Enemy_Book_Config
  1835. #--------------------------------------------------------------------------
  1836. def initialize
  1837. super(0, 0+64, 576, 416-64)
  1838. self.contents = Bitmap.new(width - 32, height - 32)
  1839. self.contents.font.name= $fontface
  1840. self.contents.font.size= 20
  1841. end
  1842. #--------------------------------------------------------------------------
  1843. def refresh(enemy_id)
  1844. self.contents.clear
  1845. enemy = Game_Enemy_Book.new(enemy_id)
  1846. draw_enemy_graphic(enemy, 0, 240+48, 200)
  1847. draw_enemy_book_id(enemy, 4, 0)
  1848. draw_enemy_name(enemy, 48, 0)
  1849. draw_actor_hp2(enemy, 227, 0)
  1850. draw_actor_sp2(enemy, 227+160, 0)
  1851. draw_actor_parameter(enemy, 227 , 32, 0)
  1852. self.contents.font.color = normal_color
  1853. draw_actor_parameter(enemy, 288+100, 32, 7)
  1854. draw_actor_parameter(enemy, 227 , 64, 3)
  1855. draw_actor_parameter(enemy, 288+100, 64, 4)
  1856. draw_actor_parameter(enemy, 227 , 96, 5)
  1857. draw_actor_parameter(enemy, 288+100, 96, 6)
  1858. draw_actor_parameter(enemy, 227 , 128, 1)
  1859. draw_actor_parameter(enemy, 288+100, 128, 2)
  1860. draw_enemy_exp(enemy, 227, 160)
  1861. draw_enemy_gold(enemy, 227+160, 160)
  1862. if analyze?(enemy.id) or !DROP_ITEM_NEED_ANALYZE
  1863. self.contents.draw_text(260, 192, 96, 32, "Drop Item")
  1864. draw_enemy_drop_item(enemy, 288+96+4, 192)
  1865. self.contents.font.color = normal_color
  1866. #draw_element_guard(enemy, 320-32, 160-16+96)
  1867. end
  1868. end
  1869. #--------------------------------------------------------------------------
  1870. def analyze?(enemy_id)
  1871. if $game_party.enemy_info[enemy_id] == 2
  1872. return true
  1873. else
  1874. return false
  1875. end
  1876. end
  1877. end
  1878. #==============================================================================
  1879. # END BESTIARY
  1880.  
  1881.  
  1882.  
  1883.  
  1884. #==============================================================================
  1885. # Window_SwitchParty class definition
  1886. #------------------------------------------------------------------------------
  1887. # A window that displays all 4 character slots in the party, and offers a
  1888. # cursor to modify it.
  1889. #
  1890. # By exseiken, October 04, 2004
  1891. #==============================================================================
  1892.  
  1893. class Window_SwitchParty < Window_Selectable
  1894.  
  1895.  
  1896. #----------------------------------------------------------------------------
  1897. # Create public access variables
  1898. #----------------------------------------------------------------------------
  1899. attr_reader :new_party # The party shown in the window [R-O]
  1900.  
  1901.  
  1902. #----------------------------------------------------------------------------
  1903. # Window's constructor. Create the window's contents, makes a copy of the
  1904. # current party, then stocks it into member variable new_party, for later
  1905. # use.
  1906. #----------------------------------------------------------------------------
  1907. def initialize()
  1908. # create the window and its contents
  1909. super(32, 32, 224, 416)
  1910. self.contents = Bitmap.new(width - 32, height - 32)
  1911. self.contents.font.name = $fontface
  1912. self.contents.font.size = 20
  1913.  
  1914. # copy the party
  1915. @new_party = $game_party.actors.clone
  1916.  
  1917. # always 4 party members
  1918. @item_max = 4
  1919.  
  1920. # select the first character
  1921. if @new_party.size > 0
  1922. @index = @new_party.index(@new_party.first )
  1923.  
  1924. else
  1925. @index = 0
  1926.  
  1927. end
  1928.  
  1929. # draw the window's contents
  1930. refresh
  1931.  
  1932. # update the cursor rectangle
  1933. update_cursor_rect
  1934.  
  1935. end
  1936.  
  1937.  
  1938. #----------------------------------------------------------------------------
  1939. # Return the actor currently selected.
  1940. #----------------------------------------------------------------------------
  1941. def actor
  1942. # return the selected actor, or nil if none
  1943. @new_party[@index]
  1944.  
  1945. end
  1946.  
  1947.  
  1948. #----------------------------------------------------------------------------
  1949. # Update the contents of the window: clear the contents bitmap, then rebuild
  1950. # it.
  1951. #----------------------------------------------------------------------------
  1952. def refresh
  1953. # clear the contents of the bitmap
  1954. self.contents.clear
  1955.  
  1956. # draw each non-null party member
  1957. for i in 0..@new_party.size - 1
  1958. # get the actor
  1959. actor = @new_party[i]
  1960.  
  1961. # if the actor is valid, draw it on the screen
  1962. if actor != nil
  1963. # calculate the y coordinate
  1964. y = 96 * i
  1965.  
  1966. # draw the actor's graphic
  1967. draw_actor_graphic(actor, 24, y + 80)
  1968.  
  1969. # draw the actor's name
  1970. draw_actor_name(actor, 64, y + 32)
  1971.  
  1972. # if the actor is not available, write in red "can't select"
  1973. if actor.mandatory
  1974. self.contents.font.color = Color.new(255, 0, 0, 255)
  1975. self.contents.draw_text(0, y, 224, 32, "Unswitchable", 1)
  1976.  
  1977. end
  1978.  
  1979. end
  1980.  
  1981. end
  1982.  
  1983. end
  1984.  
  1985.  
  1986. #----------------------------------------------------------------------------
  1987. # Update the position rectangle of the cursor.
  1988. #----------------------------------------------------------------------------
  1989. def update_cursor_rect
  1990. # reset the cursor rectangle
  1991. self.cursor_rect.set(0, 96 * @index, width - 32, 96)
  1992.  
  1993. end
  1994.  
  1995.  
  1996. #----------------------------------------------------------------------------
  1997. # Change the actor selected for another, then redraw the entire window.
  1998. #
  1999. # Parameters:
  2000. # actors: The actor that will replace the selected one
  2001. #----------------------------------------------------------------------------
  2002. def change_selection(actor)
  2003. # change the actor (can be nil to remove it)
  2004. @new_party[@index] = actor
  2005.  
  2006. # redraw the window
  2007. refresh
  2008.  
  2009. end
  2010.  
  2011.  
  2012. #----------------------------------------------------------------------------
  2013. # Update the help window. (Here, the help window is really the actor status
  2014. # window.)
  2015. #----------------------------------------------------------------------------
  2016. def update_help
  2017. # draw the selected actor's name, level, status conditions and stats
  2018. @help_window.draw_actor_status(@new_party[@index])
  2019.  
  2020. end
  2021.  
  2022. end
  2023.  
  2024. #==============================================================================
  2025. # Window_SwitchReserve class definition
  2026. #------------------------------------------------------------------------------
  2027. # A window that displays all characters available to pick in the party. Offers
  2028. # a cursor to select them
  2029. #
  2030. # By exseiken, October 06, 2004 (v. 1.01)
  2031. #==============================================================================
  2032.  
  2033. class Window_SwitchReserve < Window_Selectable
  2034.  
  2035.  
  2036. #----------------------------------------------------------------------------
  2037. # Window constructor. Create the contents bitmap and fill it with all
  2038. # characters that are not into the party, but that are loaded in the data
  2039. # member of the Game_Actors global object.
  2040. #
  2041. # Parameters:
  2042. # max_size: The maximum of characters that can fit into that
  2043. # window
  2044. #----------------------------------------------------------------------------
  2045. def initialize(max_size)
  2046. # initialize the window and its contents
  2047. super(256, 160, 352, 288)
  2048. self.contents = Bitmap.new(width - 32, ((max_size & ~(0x01)) << 5) + ((max_size & 0x01) << 6))
  2049. self.contents.font.name = $fontface
  2050. self.contents.font.size = 20
  2051.  
  2052. # initialize the list for the first time
  2053. @actor_list = $game_actors.data.clone
  2054.  
  2055. # remove currently active party members
  2056. $game_party.actors.each do |actor|
  2057. @actor_list[actor.actor_id] = nil
  2058.  
  2059. end
  2060.  
  2061. # remove all actors that are unavailable
  2062. $game_actors.data.each do |actor|
  2063. if actor != nil and actor.unavailable
  2064. @actor_list[actor.actor_id] = nil
  2065.  
  2066. end
  2067.  
  2068. end
  2069.  
  2070. # remove all holes in the list
  2071. @actor_list.compact!
  2072.  
  2073. # set the maximum of characters the list can contain
  2074. @item_max = max_size
  2075.  
  2076. # 2 columns
  2077. @column_max = 2
  2078.  
  2079. # select the first item
  2080. @index = 0
  2081.  
  2082. # default: unactive
  2083. self.active = false
  2084.  
  2085. # draw the window's contents
  2086. refresh
  2087.  
  2088. # draw the cursor rectangle
  2089. update_cursor_rect
  2090.  
  2091. end
  2092.  
  2093.  
  2094. #----------------------------------------------------------------------------
  2095. # Update the contents of the window: clear the contents bitmap, then rebuild
  2096. # it.
  2097. #----------------------------------------------------------------------------
  2098. def refresh
  2099. # clear the contents of the bitmap
  2100. self.contents.clear
  2101.  
  2102. # display all actors
  2103. for i in 0..@actor_list.size
  2104. # get the concerned actor
  2105. actor = @actor_list[i]
  2106.  
  2107. # if the actor is non-nil, draw it
  2108. if actor != nil
  2109. # get the coordinates
  2110. x = (i & 0x01) == 1 ? self.width / @column_max : 0
  2111. y = (i >> 0x01) * 64
  2112.  
  2113. # draw the actor's sprite
  2114. draw_actor_graphic(actor, x + 24, y + 48)
  2115.  
  2116. # draw the actor's name
  2117. draw_actor_name(actor, x + 64, y + 16)
  2118.  
  2119. end
  2120.  
  2121. end
  2122.  
  2123. end
  2124.  
  2125.  
  2126. #----------------------------------------------------------------------------
  2127. # Update the position rectangle of the cursor.
  2128. #----------------------------------------------------------------------------
  2129. def update_cursor_rect
  2130. # if the screen is not active, or the cursor is invalid, don't display the
  2131. # cursor
  2132. if not active or @index < 0
  2133. # set an empty cursor
  2134. self.cursor_rect.empty
  2135.  
  2136. # stop
  2137. return
  2138.  
  2139. end
  2140.  
  2141. # get the row of the item
  2142. row = @index / @column_max
  2143.  
  2144. # if the cursor went over the window, scroll up
  2145. if row < self.top_row
  2146. # set the top row as the current row
  2147. self.top_row = row
  2148.  
  2149. end
  2150.  
  2151. # if the cursor went farther than the bottom of the window, scroll down
  2152. if row > self.top_row + (self.page_row_max - 1)
  2153. # set the bottom row as the current row
  2154. self.top_row = row - (self.page_row_max - 1)
  2155.  
  2156. end
  2157.  
  2158. # set the width of the cursor
  2159. cursor_width = self.width / @column_max - 32
  2160.  
  2161. # get the upper-left coordinates of the window
  2162. x = @index % @column_max * (cursor_width + 32)
  2163. y = @index / @column_max * 64 - self.oy
  2164.  
  2165. # set the cursor rectangle
  2166. self.cursor_rect.set(x, y, cursor_width, 64)
  2167.  
  2168. end
  2169.  
  2170.  
  2171. #----------------------------------------------------------------------------
  2172. # Takes a character, put in into the list at the selected position, and
  2173. # returns the character that was presently there. If there was no
  2174. # character, returns nil.
  2175. #
  2176. # Parameters:
  2177. # actor_to_switch: The character to put at the selected position
  2178. #----------------------------------------------------------------------------
  2179. def swap_characters(actor_to_switch)
  2180. # store the old actor (needed for swapping)
  2181. old_actor = @actor_list[@index]
  2182.  
  2183. # put the new actor at the place
  2184. @actor_list[@index] = actor_to_switch
  2185.  
  2186. # redraw the window
  2187. refresh
  2188.  
  2189. # return the old actor
  2190. return old_actor
  2191.  
  2192. end
  2193.  
  2194.  
  2195. #----------------------------------------------------------------------------
  2196. # Update the help window. (Here, the help window is really the actor status
  2197. # window.)
  2198. #----------------------------------------------------------------------------
  2199. def update_help
  2200. # draw the selected actor's name, level, status conditions and stats
  2201. @help_window.draw_actor_status(@actor_list[@index])
  2202.  
  2203. end
  2204.  
  2205.  
  2206. #--------------------------------------------------------------------------
  2207. # Return the index of the top row, that is, the first row that is displayed
  2208. # on the window.
  2209. #--------------------------------------------------------------------------
  2210. def top_row
  2211. # divide the coordinate of the top of the bitmap by the cursor's height,
  2212. # 64, returning the index of the top row
  2213. return self.oy / 64
  2214.  
  2215. end
  2216.  
  2217.  
  2218. #--------------------------------------------------------------------------
  2219. # Validate, and set the top row to a new value. The validation makes sure
  2220. # that the new row is not off-limits.
  2221. #
  2222. # Parameters:
  2223. # row : the index of the row to be set as the new top row
  2224. #--------------------------------------------------------------------------
  2225. def top_row=(row)
  2226. # forces the new row to be positive
  2227. if row < 0
  2228. row = 0
  2229.  
  2230. end
  2231.  
  2232. # forces the new row to be less or equal to the maximum
  2233. if row > row_max - 1
  2234. row = row_max - 1
  2235.  
  2236. end
  2237.  
  2238. # return the top of the window by multiplying it by the height of the
  2239. # cursor window: 64.
  2240. self.oy = row * 64
  2241.  
  2242. end
  2243.  
  2244.  
  2245. #--------------------------------------------------------------------------
  2246. # Return the maximum amount of rows that can
  2247. #--------------------------------------------------------------------------
  2248. def page_row_max
  2249. # return the maximum of rows fitting in a page by dividing the
  2250. # height of the bitmap by the height of a window, 64
  2251. return (self.height - 32) / 64
  2252.  
  2253. end
  2254.  
  2255. end
  2256.  
  2257. #==============================================================================
  2258. # Window_SwitchStatus class definition
  2259. #------------------------------------------------------------------------------
  2260. # A window that displays the status of a character being selected.
  2261. #
  2262. # By exseiken, October 06, 2004 (v. 1.01)
  2263. #==============================================================================
  2264.  
  2265. class Window_SwitchStatus < Window_Base
  2266.  
  2267.  
  2268. #----------------------------------------------------------------------------
  2269. # Construct the window: create the contents bitmap.
  2270. #----------------------------------------------------------------------------
  2271. def initialize
  2272. # create the window and initialize its contents
  2273. super(256, 32, 352, 128)
  2274. self.contents = Bitmap.new(width - 32, height - 32)
  2275. self.contents.font.name = $fontface
  2276. self.contents.font.size = 20
  2277.  
  2278. end
  2279.  
  2280.  
  2281. #----------------------------------------------------------------------------
  2282. # Draw the status on an actor on the window's contents.
  2283. #
  2284. # Parameters:
  2285. # actor: The actor to put on the screen
  2286. #----------------------------------------------------------------------------
  2287. def draw_actor_status(actor)
  2288. # clear the contents of the bitmap
  2289. self.contents.clear
  2290.  
  2291. # if the actor to draw is nil, leave the window empty
  2292. if actor == nil
  2293. return
  2294.  
  2295. end
  2296.  
  2297. # draw the actor's graphic
  2298. draw_actor_graphic(actor, 24, 64)
  2299.  
  2300. # draw the actor's name, level
  2301. draw_actor_name(actor, 64, 0)
  2302. draw_actor_level(actor, 256, 0)
  2303. draw_actor_hp(actor, 64, 32)
  2304. draw_actor_sp(actor, 64, 64)
  2305.  
  2306. end
  2307.  
  2308. end
  2309. #==============================================================================
  2310. # END SWITCH SCREEN
  2311.  
  2312.  
  2313.  
  2314. #==============================================================================
  2315. # ■ Game_System
  2316. #==============================================================================
  2317.  
  2318. class Game_System
  2319.  
  2320. attr_reader :map_interpreter
  2321. attr_reader :battle_interpreter
  2322. attr_accessor :timer
  2323. attr_accessor :timer_working
  2324. attr_accessor :save_disabled
  2325. attr_accessor :menu_disabled
  2326. attr_accessor :encounter_disabled
  2327. attr_accessor :message_position
  2328. attr_accessor :message_frame
  2329. attr_accessor :save_count
  2330. attr_accessor :magic_number
  2331. attr_accessor :bgm_volume
  2332. attr_accessor :se_volume
  2333.  
  2334. def initialize
  2335. @map_interpreter = Interpreter.new(0, true)
  2336. @battle_interpreter = Interpreter.new(0, false)
  2337. @timer = 0
  2338. @timer_working = false
  2339. @save_disabled = false
  2340. @menu_disabled = false
  2341. @encounter_disabled = false
  2342. @message_position = 2
  2343. @message_frame = 0
  2344. @save_count = 0
  2345. @magic_number = 0
  2346. @bgm_volume = 100
  2347. @se_volume = 100
  2348. end
  2349.  
  2350. def bgm_play(bgm)
  2351. @playing_bgm = bgm
  2352. if bgm != nil and bgm.name != ""
  2353. Audio.bgm_play("Audio/BGM/" + bgm.name , bgm.volume * bgm_volume / 100, bgm.pitch)
  2354. else
  2355. Audio.bgm_stop
  2356. end
  2357. Graphics.frame_reset
  2358. end
  2359.  
  2360. def bgs_play(bgs)
  2361. @playing_bgs = bgs
  2362. if bgs != nil and bgs.name != ""
  2363. Audio.bgs_play("Audio/BGS/" + bgs.name, bgs.volume * se_volume / 100, bgs.pitch)
  2364. else
  2365. Audio.bgs_stop
  2366. end
  2367. Graphics.frame_reset
  2368. end
  2369.  
  2370. def me_play(me)
  2371. if me != nil and me.name != ""
  2372. Audio.me_play("Audio/ME/" + me.name, me.volume * se_volume / 100, me.pitch)
  2373. else
  2374. Audio.me_stop
  2375. end
  2376. Graphics.frame_reset
  2377. end
  2378.  
  2379. def se_play(se)
  2380. if se != nil and se.name != ""
  2381. Audio.se_play("Audio/SE/" + se.name, se.volume * se_volume / 100, se.pitch)
  2382. end
  2383. end
  2384.  
  2385. end
  2386.  
  2387. #==============================================================================
  2388. # ■ Game_Actor
  2389. #==============================================================================
  2390.  
  2391. class Game_Actor < Game_Battler
  2392. def now_exp
  2393. return @exp - @exp_list[@level]
  2394. end
  2395. def next_exp
  2396. return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  2397. end
  2398.  
  2399. end
  2400.  
  2401. #==============================================================================
  2402. # ■ Game_Map
  2403. #==============================================================================
  2404.  
  2405. class Game_Map
  2406.  
  2407. def name
  2408. $map_infos[@map_id]
  2409. end
  2410.  
  2411. end
  2412.  
  2413. #==============================================================================
  2414. # ■ class Game_Time
  2415. # written by Deke
  2416. #--------------------------------------------------------------------------------------------------------------------------------------------
  2417. #==============================================================================
  2418. class Game_Time
  2419.  
  2420. attr_accessor :minute_length
  2421.  
  2422. def initialize
  2423. @minute_length=2.0 #length of game minute in real seconds
  2424. @hour_length= 60.0 #minute in an hour
  2425. @day_length=24.0 #hours in a day
  2426. @month_length=30.0 #days in a month
  2427. @year_length=12.0 #months in a year
  2428. @minutes=0 #starting minute count
  2429. start_minute=0
  2430. add_minutes(start_minute)
  2431. start_hour=23 #starting hour count
  2432. add_hours(start_hour)
  2433. start_day=13 #starting day count
  2434. add_days(start_day)
  2435. start_month=4 #starting month count
  2436. add_months(start_month-1)
  2437. start_year=1207 #starting year count
  2438. add_years(start_year)
  2439. end
  2440.  
  2441. def add_minutes(minutes)
  2442. @minutes +=minutes
  2443. end
  2444.  
  2445. def add_hours(hours)
  2446. @minutes +=hours*@hour_length
  2447. end
  2448.  
  2449. def add_days(days)
  2450. @minutes += days*@hour_length*@day_length
  2451. end
  2452.  
  2453. def add_months(months)
  2454. @minutes +=months * @hour_length*@day_length*@month_length
  2455. end
  2456.  
  2457. def add_years(years)
  2458. @minutes += years * @hour_length*@day_length*@month_length * @year_length
  2459. end
  2460.  
  2461.  
  2462. def get_year
  2463. minutes=get_total_minutes
  2464. year=minutes / @hour_length / @day_length / @month_length / @year_length
  2465. return year
  2466. end
  2467.  
  2468. def get_month
  2469. minutes=get_total_minutes
  2470. month=minutes / @hour_length / @day_length / @month_length % @year_length + 1
  2471. return month
  2472. end
  2473.  
  2474. def get_day
  2475. minutes=get_total_minutes
  2476. day=minutes / @hour_length / @day_length % @month_length
  2477. return day
  2478. end
  2479.  
  2480. def get_hour
  2481. minutes=get_total_minutes
  2482. hour=minutes / @hour_length % @day_length
  2483. return hour
  2484. end
  2485.  
  2486. def get_total_minutes
  2487. total_sec=Graphics.frame_count / Graphics.frame_rate
  2488. minute=(total_sec/@minute_length+@minutes)
  2489. return minute
  2490. end
  2491.  
  2492. def get_minute
  2493. minutes=get_total_minutes % @hour_length
  2494. return minutes
  2495. end
  2496.  
  2497. def get_tone
  2498. period_length=Math::PI*(get_hour / @day_length)
  2499. red_shift= -100+ 115*Math.sin(period_length)
  2500. green_shift= -140+ 155*Math.sin(period_length)
  2501. blue_shift= -150+ 165*Math.sin(period_length)
  2502. return Tone.new(red_shift, green_shift, blue_shift, 0)
  2503. end
  2504.  
  2505. end
  2506.  
  2507. #==============================================================================
  2508. # ■ Window_Base
  2509. #==============================================================================
  2510.  
  2511. class Window_Base < Window
  2512.  
  2513. def draw_actor_battler(actor, x, y)
  2514. bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
  2515. cw =bitmap.width
  2516. ch = bitmap.height
  2517. src_rect = Rect.new(0, 0, cw,ch)
  2518. self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  2519. end
  2520.  
  2521. FONT_SIZE = 16
  2522. NUMBER_OF_ELEMENTS = 8
  2523. ELEMENT_ORDER = [1,2,3,4,5,6, 7, 8]
  2524. GRAPH_SCALINE_COLOR = Color.new(255, 255, 255, 128)
  2525. GRAPH_SCALINE_COLOR_SHADOW = Color.new( 0, 0, 0, 192)
  2526. GRAPH_LINE_COLOR = Color.new(255, 255, 64, 255)
  2527. GRAPH_LINE_COLOR_MINUS = Color.new( 64, 255, 255, 255)
  2528. GRAPH_LINE_COLOR_PLUS = Color.new(255, 64, 64, 255)
  2529.  
  2530. def draw_actor_element_radar_graph(actor, x, y, radius = 43)
  2531. cx = x + radius + FONT_SIZE + 48
  2532. cy = y + radius + FONT_SIZE + 32
  2533. for loop_i in 0..NUMBER_OF_ELEMENTS
  2534. if loop_i == 0
  2535. else
  2536. @pre_x = @now_x
  2537. @pre_y = @now_y
  2538. @pre_ex = @now_ex
  2539. @pre_ey = @now_ey
  2540. @color1 = @color2
  2541. end
  2542. if loop_i == NUMBER_OF_ELEMENTS
  2543. eo = ELEMENT_ORDER[0]
  2544. else
  2545. eo = ELEMENT_ORDER[loop_i]
  2546. end
  2547. er = actor.element_rate(eo)
  2548. estr = $data_system.elements[eo]
  2549. @color2 = er < 0 ? GRAPH_LINE_COLOR_MINUS : er > 100 ? GRAPH_LINE_COLOR_PLUS : GRAPH_LINE_COLOR
  2550. er = er.abs
  2551. th = Math::PI * (0.5 - 2.0 * loop_i / NUMBER_OF_ELEMENTS)
  2552. @now_x = cx + (radius * Math.cos(th)).floor
  2553. @now_y = cy - (radius * Math.sin(th)).floor
  2554. @now_wx = cx - 6 + ((radius + FONT_SIZE * 3 / 2) * Math.cos(th)).floor - FONT_SIZE
  2555. @now_wy = cy - ((radius + FONT_SIZE * 1 / 2) * Math.sin(th)).floor - FONT_SIZE/2
  2556. @now_vx = cx + ((radius + FONT_SIZE * 8 / 2) * Math.cos(th)).floor - FONT_SIZE
  2557. @now_vy = cy - ((radius + FONT_SIZE * 3 / 2) * Math.sin(th)).floor - FONT_SIZE/2
  2558. @now_ex = cx + (er*radius/100 * Math.cos(th)).floor
  2559. @now_ey = cy - (er*radius/100 * Math.sin(th)).floor
  2560. if loop_i == 0
  2561. @pre_x = @now_x
  2562. @pre_y = @now_y
  2563. @pre_ex = @now_ex
  2564. @pre_ey = @now_ey
  2565. @color1 = @color2
  2566. else
  2567. end
  2568. next if loop_i == 0
  2569. self.contents.draw_line(cx+1,cy+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
  2570. self.contents.draw_line(@pre_x+1,@pre_y+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
  2571. self.contents.draw_line(cx,cy, @now_x,@now_y, GRAPH_SCALINE_COLOR)
  2572. self.contents.draw_line(@pre_x,@pre_y, @now_x,@now_y, GRAPH_SCALINE_COLOR)
  2573. self.contents.draw_line(@pre_ex,@pre_ey, @now_ex,@now_ey, @color1, 2, @color2)
  2574. self.contents.font.color = system_color
  2575. self.contents.draw_text(@now_wx,@now_wy, FONT_SIZE*3.1, FONT_SIZE, estr, 1)
  2576. self.contents.font.color = Color.new(255,255,255,128)
  2577. self.contents.draw_text(@now_vx,@now_vy, FONT_SIZE*2, FONT_SIZE, er.to_s + "%", 2)
  2578. self.contents.font.color = normal_color
  2579. end
  2580. end
  2581.  
  2582. alias :draw_actor_hp_original :draw_actor_hp
  2583. def draw_actor_hp(actor, x, y, width = 144)
  2584. if actor.maxhp != 0
  2585. rate = actor.hp.to_f / actor.maxhp
  2586. else
  2587. rate = 0
  2588. end
  2589. plus_x = 0
  2590. rate_x = 0
  2591. plus_y = 25
  2592. plus_width = 0
  2593. rate_width = 100
  2594. height = 10
  2595. align1 = 1
  2596. align2 = 2
  2597. align3 = 0
  2598. grade1 = 1
  2599. grade2 = 0
  2600. color1 = Color.new(0, 0, 0, 192)
  2601. color2 = Color.new(255, 255, 192, 192)
  2602. color3 = Color.new(0, 0, 0, 192)
  2603. color4 = Color.new(64, 0, 0, 192)
  2604. color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
  2605. color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
  2606. if actor.maxhp != 0
  2607. hp = (width + plus_width) * actor.hp * rate_width / 100 / actor.maxhp
  2608. else
  2609. hp = 0
  2610. end
  2611. gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
  2612. width, plus_width + width * rate_width / 100,
  2613. height, hp, align1, align2, align3,
  2614. color1, color2, color3, color4, color5, color6, grade1, grade2)
  2615. draw_actor_hp_original(actor, x, y, width)
  2616. end
  2617.  
  2618. alias :draw_actor_sp_original :draw_actor_sp
  2619. def draw_actor_sp(actor, x, y, width = 144)
  2620. if actor.maxsp != 0
  2621. rate = actor.sp.to_f / actor.maxsp
  2622. else
  2623. rate = 1
  2624. end
  2625. plus_x = 0
  2626. rate_x = 0
  2627. plus_y = 25
  2628. plus_width = 0
  2629. rate_width = 100
  2630. height = 10
  2631. align1 = 1
  2632. align2 = 2
  2633. align3 = 0
  2634. grade1 = 1
  2635. grade2 = 0
  2636. color1 = Color.new(0, 0, 0, 192)
  2637. color2 = Color.new(255, 255, 192, 192)
  2638. color3 = Color.new(0, 0, 0, 192)
  2639. color4 = Color.new(0, 64, 0, 192)
  2640. color5 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
  2641. color6 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
  2642. if actor.maxsp != 0
  2643. sp = (width + plus_width) * actor.sp * rate_width / 100 / actor.maxsp
  2644. else
  2645. sp = (width + plus_width) * rate_width / 100
  2646. end
  2647. gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
  2648. width, plus_width + width * rate_width / 100,
  2649. height, sp, align1, align2, align3,
  2650. color1, color2, color3, color4, color5, color6, grade1, grade2)
  2651. draw_actor_sp_original(actor, x, y, width)
  2652. end
  2653.  
  2654. alias :draw_actor_exp_original :draw_actor_exp
  2655. def draw_actor_exp(actor, x, y, width = 204)
  2656. if actor.next_exp != 0
  2657. rate = actor.now_exp.to_f / actor.next_exp
  2658. else
  2659. rate = 1
  2660. end
  2661. plus_x = 0
  2662. rate_x = 0
  2663. plus_y = 25
  2664. plus_width = 0
  2665. rate_width = 100
  2666. height = 10
  2667. align1 = 1
  2668. align2 = 2
  2669. align3 = 0
  2670. grade1 = 1
  2671. grade2 = 0
  2672. color1 = Color.new(0, 0, 0, 192)
  2673. color2 = Color.new(255, 255, 192, 192)
  2674. color3 = Color.new(0, 0, 0, 192)
  2675. color4 = Color.new(64, 0, 0, 192)
  2676. color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
  2677. color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
  2678. if actor.next_exp != 0
  2679. exp = (width + plus_width) * actor.now_exp * rate_width /
  2680. 100 / actor.next_exp
  2681. else
  2682. exp = (width + plus_width) * rate_width / 100
  2683. end
  2684. gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
  2685. width, plus_width + width * rate_width / 100,
  2686. height, exp, align1, align2, align3,
  2687. color1, color2, color3, color4, color5, color6, grade1, grade2)
  2688. draw_actor_exp_original(actor, x, y)
  2689. end
  2690.  
  2691. def gauge_rect(x, y, rect_width, width, height, gauge, align1, align2, align3,
  2692. color1, color2, color3, color4, color5, color6, grade1, grade2)
  2693. case align1
  2694. when 1
  2695. x += (rect_width - width) / 2
  2696. when 2
  2697. x += rect_width - width
  2698. end
  2699. case align2
  2700. when 1
  2701. y -= height / 2
  2702. when 2
  2703. y -= height
  2704. end
  2705. # ˜g•`‰æ
  2706. self.contents.fill_rect(x, y, width, height, color1)
  2707. self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color2)
  2708. if align3 == 0
  2709. if grade1 == 2
  2710. grade1 = 3
  2711. end
  2712. if grade2 == 2
  2713. grade2 = 3
  2714. end
  2715. end
  2716. if (align3 == 1 and grade1 == 0) or grade1 > 0
  2717. color = color3
  2718. color3 = color4
  2719. color4 = color
  2720. end
  2721. if (align3 == 1 and grade2 == 0) or grade2 > 0
  2722. color = color5
  2723. color5 = color6
  2724. color6 = color
  2725. end
  2726. self.contents.gradation_rect(x + 2, y + 2, width - 4, height - 4,
  2727. color3, color4, grade1)
  2728. if align3 == 1
  2729. x += width - gauge
  2730. end
  2731. self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4,
  2732. color5, color6, grade2)
  2733. end
  2734.  
  2735. def up_color
  2736. return Color.new(74, 210, 74)
  2737. end
  2738.  
  2739. def down_color
  2740. return Color.new(170, 170, 170)
  2741. end
  2742.  
  2743. def draw_actor_parameter(actor, x, y, type)
  2744. case type
  2745. when 0
  2746. parameter_name = $data_system.words.atk
  2747. parameter_value = actor.atk
  2748. when 1
  2749. parameter_name = $data_system.words.pdef
  2750. parameter_value = actor.pdef
  2751. when 2
  2752. parameter_name = $data_system.words.mdef
  2753. parameter_value = actor.mdef
  2754. when 3
  2755. parameter_name = $data_system.words.str
  2756. parameter_value = actor.str
  2757. when 4
  2758. parameter_name = $data_system.words.dex
  2759. parameter_value = actor.dex
  2760. when 5
  2761. parameter_name = $data_system.words.agi
  2762. parameter_value = actor.agi
  2763. when 6
  2764. parameter_name = $data_system.words.int
  2765. parameter_value = actor.int
  2766. when 7
  2767. parameter_name = "Evasion"
  2768. parameter_value = actor.eva
  2769. end
  2770. self.contents.font.color = system_color
  2771. self.contents.draw_text(x, y, 120, 32, parameter_name)
  2772. self.contents.font.color = normal_color
  2773. self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
  2774. end
  2775.  
  2776. end
  2777.  
  2778. #==============================================================================
  2779. # ■ Bitmap
  2780. #==============================================================================
  2781. class Bitmap
  2782.  
  2783. def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
  2784. distance = (start_x - end_x).abs + (start_y - end_y).abs
  2785. if end_color == start_color
  2786. for i in 1..distance
  2787. x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  2788. y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  2789. if width == 1
  2790. self.set_pixel(x, y, start_color)
  2791. else
  2792. self.fill_rect(x, y, width, width, start_color)
  2793. end
  2794. end
  2795. else
  2796. for i in 1..distance
  2797. x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  2798. y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  2799. r = start_color.red * (distance-i)/distance + end_color.red * i/distance
  2800. g = start_color.green * (distance-i)/distance + end_color.green * i/distance
  2801. b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
  2802. a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
  2803. if width == 1
  2804. self.set_pixel(x, y, Color.new(r, g, b, a))
  2805. else
  2806. self.fill_rect(x, y, width, width, Color.new(r, g, b, a))
  2807. end
  2808. end
  2809. end
  2810. end
  2811.  
  2812. def gradation_rect(x, y, width, height, color1, color2, align = 0)
  2813. if align == 0
  2814. for i in x...x + width
  2815. red = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
  2816. green = color1.green +
  2817. (color2.green - color1.green) * (i - x) / (width - 1)
  2818. blue = color1.blue +
  2819. (color2.blue - color1.blue) * (i - x) / (width - 1)
  2820. alpha = color1.alpha +
  2821. (color2.alpha - color1.alpha) * (i - x) / (width - 1)
  2822. color = Color.new(red, green, blue, alpha)
  2823. fill_rect(i, y, 1, height, color)
  2824. end
  2825. elsif align == 1
  2826. for i in y...y + height
  2827. red = color1.red +
  2828. (color2.red - color1.red) * (i - y) / (height - 1)
  2829. green = color1.green +
  2830. (color2.green - color1.green) * (i - y) / (height - 1)
  2831. blue = color1.blue +
  2832. (color2.blue - color1.blue) * (i - y) / (height - 1)
  2833. alpha = color1.alpha +
  2834. (color2.alpha - color1.alpha) * (i - y) / (height - 1)
  2835. color = Color.new(red, green, blue, alpha)
  2836. fill_rect(x, i, width, 1, color)
  2837. end
  2838. elsif align == 2
  2839. for i in x...x + width
  2840. for j in y...y + height
  2841. red = color1.red + (color2.red - color1.red) *
  2842. ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  2843. green = color1.green + (color2.green - color1.green) *
  2844. ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  2845. blue = color1.blue + (color2.blue - color1.blue) *
  2846. ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  2847. alpha = color1.alpha + (color2.alpha - color1.alpha) *
  2848. ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  2849. color = Color.new(red, green, blue, alpha)
  2850. set_pixel(i, j, color)
  2851. end
  2852. end
  2853. elsif align == 3
  2854. for i in x...x + width
  2855. for j in y...y + height
  2856. red = color1.red + (color2.red - color1.red) *
  2857. ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  2858. green = color1.green + (color2.green - color1.green) *
  2859. ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  2860. blue = color1.blue + (color2.blue - color1.blue) *
  2861. ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  2862. alpha = color1.alpha + (color2.alpha - color1.alpha) *
  2863. ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  2864. color = Color.new(red, green, blue, alpha)
  2865. set_pixel(i, j, color)
  2866. end
  2867. end
  2868. end
  2869. end
  2870.  
  2871. end
  2872.  
  2873. #==============================================================================
  2874. # ■ Sprite
  2875. #==============================================================================
  2876.  
  2877. module RPG
  2878. class Sprite < ::Sprite
  2879. def damage(value, critical)
  2880. dispose_damage
  2881. if value.is_a?(Numeric)
  2882. damage_string = value.abs.to_s
  2883. else
  2884. damage_string = value.to_s
  2885. end
  2886. bitmap = Bitmap.new(160, 48)
  2887. bitmap.font.name = "Arial Black"
  2888. bitmap.font.size = 32
  2889. bitmap.font.color.set(0, 0, 0)
  2890. bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
  2891. bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
  2892. bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
  2893. bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
  2894. if value.is_a?(Numeric) and value < 0
  2895. bitmap.font.color.set(176, 255, 144)
  2896. else
  2897. bitmap.font.color.set(255, 255, 255)
  2898. end
  2899. bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
  2900. if critical
  2901. bitmap.font.size = 20
  2902. bitmap.font.color.set(0, 0, 0)
  2903. bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
  2904. bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
  2905. bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
  2906. bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
  2907. bitmap.font.color.set(255, 255, 255)
  2908. bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
  2909. end
  2910. @_damage_sprite = ::Sprite.new
  2911. @_damage_sprite.bitmap = bitmap
  2912. @_damage_sprite.ox = 80 + self.viewport.ox
  2913. @_damage_sprite.oy = 20 + self.viewport.oy
  2914. @_damage_sprite.x = self.x + self.viewport.rect.x
  2915. @_damage_sprite.y = self.y - self.oy / 2 + self.viewport.rect.y
  2916. @_damage_sprite.z = 3000
  2917. @_damage_duration = 40
  2918. end
  2919. def animation(animation, hit)
  2920. dispose_animation
  2921. @_animation = animation
  2922. return if @_animation == nil
  2923. @_animation_hit = hit
  2924. @_animation_duration = @_animation.frame_max
  2925. animation_name = @_animation.animation_name
  2926. animation_hue = @_animation.animation_hue
  2927. bitmap = RPG::Cache.animation(animation_name, animation_hue)
  2928. if @@_reference_count.include?(bitmap)
  2929. @@_reference_count[bitmap] += 1
  2930. else
  2931. @@_reference_count[bitmap] = 1
  2932. end
  2933. @_animation_sprites = []
  2934. if @_animation.position != 3 or not @@_animations.include?(animation)
  2935. for i in 0..15
  2936. sprite = ::Sprite.new
  2937. sprite.bitmap = bitmap
  2938. sprite.visible = false
  2939. @_animation_sprites.push(sprite)
  2940. end
  2941. unless @@_animations.include?(animation)
  2942. @@_animations.push(animation)
  2943. end
  2944. end
  2945. update_animation
  2946. end
  2947. def loop_animation(animation)
  2948. return if animation == @_loop_animation
  2949. dispose_loop_animation
  2950. @_loop_animation = animation
  2951. return if @_loop_animation == nil
  2952. @_loop_animation_index = 0
  2953. animation_name = @_loop_animation.animation_name
  2954. animation_hue = @_loop_animation.animation_hue
  2955. bitmap = RPG::Cache.animation(animation_name, animation_hue)
  2956. if @@_reference_count.include?(bitmap)
  2957. @@_reference_count[bitmap] += 1
  2958. else
  2959. @@_reference_count[bitmap] = 1
  2960. end
  2961. @_loop_animation_sprites = []
  2962. for i in 0..15
  2963. sprite = ::Sprite.new
  2964. sprite.bitmap = bitmap
  2965. sprite.visible = false
  2966. @_loop_animation_sprites.push(sprite)
  2967. end
  2968. update_loop_animation
  2969. end
  2970. def animation_set_sprites(sprites, cell_data, position)
  2971. for i in 0..15
  2972. sprite = sprites[i]
  2973. pattern = cell_data[i, 0]
  2974. if sprite == nil or pattern == nil or pattern == -1
  2975. sprite.visible = false if sprite != nil
  2976. next
  2977. end
  2978. sprite.visible = true
  2979. sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
  2980. if position == 3
  2981. if self.viewport != nil
  2982. sprite.x = self.viewport.rect.width / 2
  2983. sprite.y = self.viewport.rect.height - 160
  2984. else
  2985. sprite.x = 320
  2986. sprite.y = 240
  2987. end
  2988. else
  2989. sprite.x = self.x + self.viewport.rect.x -
  2990. self.ox + self.src_rect.width / 2
  2991. sprite.y = self.y + self.viewport.rect.y -
  2992. self.oy + self.src_rect.height / 2
  2993. sprite.y -= self.src_rect.height / 4 if position == 0
  2994. sprite.y += self.src_rect.height / 4 if position == 2
  2995. end
  2996. sprite.x += cell_data[i, 1]
  2997. sprite.y += cell_data[i, 2]
  2998. sprite.z = 2000
  2999. sprite.ox = 96
  3000. sprite.oy = 96
  3001. sprite.zoom_x = cell_data[i, 3] / 100.0
  3002. sprite.zoom_y = cell_data[i, 3] / 100.0
  3003. sprite.angle = cell_data[i, 4]
  3004. sprite.mirror = (cell_data[i, 5] == 1)
  3005. sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  3006. sprite.blend_type = cell_data[i, 7]
  3007. end
  3008. end
  3009. end
  3010.  
  3011. end
  3012.  
  3013.  
  3014. #==============================================================================
  3015. # ■ Window_MenuCommand
  3016. #==============================================================================
  3017. class Window_MenuCommand < Window_Selectable
  3018.  
  3019. def initialize(width, commands)
  3020. super(0, 0, width, commands.size * 32 + 32)
  3021. @item_max = commands.size
  3022. @commands = commands
  3023. self.contents = Bitmap.new(width - 32, @item_max * 32)
  3024. self.contents.font.name = $fontface
  3025. self.contents.font.size = 20
  3026. refresh
  3027. self.index = 0
  3028. end
  3029.  
  3030. def refresh
  3031. self.contents.clear
  3032. self.contents.font.name = $fontface
  3033. self.contents.font.size = 20
  3034. for i in 0...@item_max
  3035. draw_item(i, normal_color)
  3036. end
  3037. end
  3038.  
  3039. def draw_item(index, color)
  3040. self.contents.font.color = color
  3041. rect = Rect.new(24, 32 * index, self.contents.width - 8, 32)
  3042. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  3043. bitmap = RPG::Cache.icon("menu" + index.to_s)
  3044. self.contents.blt(x + 3, index * 32 +4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  3045. self.contents.draw_text(rect, @commands[index])
  3046. end
  3047.  
  3048. def disable_item(index)
  3049. draw_item(index, normal_color)
  3050. end
  3051.  
  3052. end
  3053.  
  3054. #==============================================================================
  3055. # ■ Window_ItemMenuCommand
  3056. #==============================================================================
  3057. class Window_ItemMenuCommand < Window_Selectable
  3058.  
  3059. def initialize(width, commands)
  3060. super(0, 0, width, commands.size * 32 + 32)
  3061. @item_max = commands.size
  3062. @commands = commands
  3063. self.contents = Bitmap.new(width - 32, @item_max * 32)
  3064. self.contents.font.name = $fontface
  3065. self.contents.font.size = 20
  3066. refresh
  3067. self.index = 0
  3068. end
  3069.  
  3070. def refresh
  3071. self.contents.clear
  3072. for i in 0...@item_max
  3073. draw_item(i, normal_color)
  3074. end
  3075. end
  3076.  
  3077. def draw_item(index, color)
  3078. self.contents.font.color = color
  3079. rect = Rect.new(12, 32 * index, self.contents.width - 8, 32)
  3080. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  3081. bitmap = RPG::Cache.icon("submenu" + index.to_s)
  3082. self.contents.blt(x + 3, index * 32 +4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  3083. self.contents.draw_text(rect, @commands[index])
  3084. end
  3085.  
  3086. def disable_item(index)
  3087. draw_item(index, disabled_color)
  3088. end
  3089.  
  3090. end
  3091.  
  3092. #==============================================================================
  3093. # ■ Window_NewMenuStatus
  3094. #==============================================================================
  3095.  
  3096. class Window_NewMenuStatus < Window_Selectable
  3097.  
  3098. def initialize
  3099. super(0, 0, 432, $game_party.actors.size * 88 + 32)
  3100. self.contents = Bitmap.new(width - 32, height - 32)
  3101. self.contents.font.name = $fontface
  3102. self.contents.font.size = 20
  3103. refresh
  3104. self.active = false
  3105. self.index = -1
  3106. end
  3107.  
  3108. def refresh
  3109. self.contents.clear
  3110. self.height = $game_party.actors.size * 88 + 32
  3111. @item_max = $game_party.actors.size
  3112. for i in 0...$game_party.actors.size
  3113. x = 64
  3114. y = i * 90
  3115. actor = $game_party.actors[i]
  3116. draw_actor_graphic(actor, x, y + 80)
  3117. draw_actor_name(actor, x - 10, y)
  3118. draw_actor_class(actor, x + 154, y)
  3119. draw_actor_level(actor, x + 80, y)
  3120. draw_actor_state(actor, x + 240, y)
  3121. draw_actor_hp(actor, x + 32, y + 32)
  3122. draw_actor_sp(actor, x + 192, y + 32)
  3123. end
  3124. end
  3125.  
  3126. def update_cursor_rect
  3127. if @index < 0
  3128. self.cursor_rect.empty
  3129. else
  3130. self.cursor_rect.set(0, @index * 88, self.width - 32, 92)
  3131. end
  3132. end
  3133.  
  3134. end
  3135.  
  3136. #==============================================================================
  3137. # ■ Window_Basic_Item
  3138. #==============================================================================
  3139.  
  3140. class Window_Basic_Item < Window_Selectable
  3141.  
  3142. def initialize
  3143. super(0, 64, 384, 352)
  3144. @column_max = 1
  3145. refresh
  3146. self.index = 0
  3147. if $game_temp.in_battle
  3148. self.y = 64
  3149. self.height = 272
  3150. self.back_opacity = 160
  3151. end
  3152. end
  3153.  
  3154. def item
  3155. return @data[self.index]
  3156. end
  3157.  
  3158. def refresh
  3159. if self.contents != nil
  3160. self.contents.dispose
  3161. self.contents = nil
  3162. end
  3163. @data = []
  3164. for i in 1...$data_items.size
  3165. if $game_party.item_number(i) > 0
  3166. for x in 0...$basic_items_ids.size
  3167. if i == $basic_items_ids[x]
  3168. @data.push($data_items [i] )
  3169. end
  3170. end
  3171. end
  3172. end
  3173.  
  3174. @item_max = @data.size
  3175. if @item_max > 0
  3176. self.contents = Bitmap.new(width - 32, row_max * 32)
  3177. self.contents.font.name = $fontface
  3178. self.contents.font.size = 20
  3179. for i in 0...@item_max
  3180. draw_item(i)
  3181. end
  3182. end
  3183. end
  3184.  
  3185. def draw_item(index)
  3186. item = @data[index]
  3187. case item
  3188. when RPG::Item
  3189. number = $game_party.item_number(item.id)
  3190. end
  3191. if item.is_a?(RPG::Item) and
  3192. $game_party.item_can_use?(item.id)
  3193. self.contents.font.color = normal_color
  3194. else
  3195. self.contents.font.color = disabled_color
  3196. end
  3197. x = 4 + index % 1 * (240 + 32)
  3198. y = index / 1 * 32
  3199. rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  3200. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  3201. bitmap = RPG::Cache.icon(item.icon_name)
  3202. opacity = self.contents.font.color == normal_color ? 255 : 128
  3203. self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  3204. self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  3205. self.contents.draw_text(x + 304, y, 16, 32, ":", 1)
  3206. self.contents.draw_text(x + 320, y, 24, 32, number.to_s, 2)
  3207. end
  3208.  
  3209. def update_help
  3210. @help_window.set_text(self.item == nil ? "" : self.item.description)
  3211. end
  3212.  
  3213. end
  3214.  
  3215. #==============================================================================
  3216. # ■ Window_NewTarget
  3217. #==============================================================================
  3218.  
  3219. class Window_NewTarget < Window_Selectable
  3220.  
  3221. def initialize
  3222. super(0, 0, 192, 352)
  3223. self.contents = Bitmap.new(width - 32, height - 32)
  3224. self.contents.font.name = $fontface
  3225. self.contents.font.size = 20
  3226. self.z += 10
  3227. @item_max = $game_party.actors.size
  3228. refresh
  3229. end
  3230.  
  3231. def refresh
  3232. self.contents.clear
  3233. for i in 0...$game_party.actors.size
  3234. x = 4
  3235. y = i * 80
  3236. actor = $game_party.actors[i]
  3237. draw_actor_name(actor, x, y)
  3238. draw_actor_state(actor, x + 80, y)
  3239. draw_actor_hp(actor, x, y + 24)
  3240. draw_actor_sp(actor, x, y + 48)
  3241. end
  3242. end
  3243.  
  3244. def update_cursor_rect
  3245. if self.active == false
  3246. self.cursor_rect.empty
  3247. end
  3248. if self.index >= 0 and self.active
  3249. self.cursor_rect.set(0, @index * 80, self.width - 32, 80)
  3250. elsif self.index >= -1 and self.active
  3251. self.cursor_rect.set(0, 0, self.width - 32, self.height - 32)
  3252. end
  3253. end
  3254.  
  3255. end
  3256.  
  3257. #==============================================================================
  3258. # ■ Window_NewHelp
  3259. #==============================================================================
  3260. class Window_NewHelp < Window_Base
  3261.  
  3262. def initialize
  3263. super(0, 0, 576, 64)
  3264. self.contents = Bitmap.new(width - 32, height - 32)
  3265. self.contents.font.name = $fontface
  3266. self.contents.font.size = 20
  3267. end
  3268.  
  3269. def set_text(text, align = 0)
  3270. if text != @text or align != @align
  3271. self.contents.clear
  3272. self.contents.font.name = $fontface
  3273. self.contents.font.size = 20
  3274. self.contents.font.color = normal_color
  3275. self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
  3276. @text = text
  3277. @align = align
  3278. @actor = nil
  3279. end
  3280. self.visible = true
  3281. end
  3282.  
  3283. def set_actor(actor)
  3284. if actor != @actor
  3285. self.contents.clear
  3286. self.contents.font.name = $fontface
  3287. self.contents.font.size = 20
  3288. draw_actor_name(actor, 4, 0)
  3289. draw_actor_state(actor, 140, 0)
  3290. draw_actor_hp(actor, 284, 0)
  3291. draw_actor_sp(actor, 460, 0)
  3292. @actor = actor
  3293. @text = nil
  3294. self.visible = true
  3295. end
  3296. end
  3297.  
  3298. def set_enemy(enemy)
  3299. self.contents.clear
  3300. self.contents.font.name = $fontface
  3301. self.contents.font.size = 20
  3302. text = enemy.name
  3303. state_text = make_battler_state_text(enemy, 112, false)
  3304. if state_text != ""
  3305. text += " " + state_text
  3306. end
  3307. set_text(text, 1)
  3308. end
  3309.  
  3310. end
  3311.  
  3312. #==============================================================================
  3313. # ■ Window_Quest_Item
  3314. #==============================================================================
  3315.  
  3316. class Window_Quest_Item < Window_Selectable
  3317.  
  3318. def initialize
  3319. super(0, 64, 576, 128)
  3320. @column_max = 3
  3321. refresh
  3322. self.index = 0
  3323. if $game_temp.in_battle
  3324. self.y = 64
  3325. self.height = 256
  3326. self.back_opacity = 160
  3327. end
  3328. end
  3329.  
  3330. def item
  3331. return @data[self.index]
  3332. end
  3333.  
  3334. def refresh
  3335. if self.contents != nil
  3336. self.contents.dispose
  3337. self.contents = nil
  3338. end
  3339. @data = []
  3340. for i in 1...$data_items.size
  3341. if $game_party.item_number(i) > 0
  3342. for x in 0...$quest_items_ids.size
  3343. if i == $quest_items_ids[x]
  3344. @data.push($data_items [i] )
  3345. end
  3346. end
  3347. end
  3348. end
  3349. @item_max = @data.size
  3350. if @item_max > 0
  3351. self.contents = Bitmap.new(width - 32, row_max * 32)
  3352. self.contents.font.name = $fontface
  3353. self.contents.font.size = 20
  3354. for i in 0...@item_max
  3355. draw_item(i)
  3356. end
  3357. end
  3358. end
  3359.  
  3360. def draw_item(index)
  3361. item = @data[index]
  3362. case item
  3363. when RPG::Item
  3364. number = $game_party.item_number(item.id)
  3365. when RPG::Weapon
  3366. number = $game_party.weapon_number(item.id)
  3367. when RPG::Armor
  3368. number = $game_party.armor_number(item.id)
  3369. end
  3370. if item.is_a?(RPG::Item) and
  3371. $game_party.item_can_use?(item.id)
  3372. self.contents.font.color = normal_color
  3373. else
  3374. self.contents.font.color = disabled_color
  3375. end
  3376. x = 4 + index % 3 * (160 + 32)
  3377. y = index / 3 * 32
  3378. rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  3379. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  3380. bitmap = RPG::Cache.icon(item.icon_name)
  3381. opacity = self.contents.font.color == normal_color ? 255 : 128
  3382. self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  3383. self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  3384. self.contents.draw_text(x + 112, y, 16, 32, ":", 1)
  3385. self.contents.draw_text(x + 128, y, 24, 32, number.to_s, 2)
  3386. end
  3387.  
  3388. def update_help
  3389. @help_window.set_text(self.item == nil ? "" : self.item.description)
  3390. end
  3391.  
  3392. end
  3393.  
  3394. #==============================================================================
  3395. # ■ Window_Weapons
  3396. #==============================================================================
  3397.  
  3398. class Window_Weapons < Window_Selectable
  3399.  
  3400. def initialize
  3401. super(0, 64, 224, 352)
  3402. @column_max = 1
  3403. refresh
  3404. self.index = 0
  3405. if $game_temp.in_battle
  3406. self.y = 64
  3407. self.height = 256
  3408. self.back_opacity = 160
  3409. end
  3410. end
  3411.  
  3412. def item
  3413. return @data[self.index]
  3414. end
  3415.  
  3416. def refresh
  3417. if self.contents != nil
  3418. self.contents.dispose
  3419. self.contents = nil
  3420. end
  3421. @data = []
  3422. for i in 1...$data_weapons.size
  3423. if $game_party.weapon_number(i) > 0
  3424. for x in 0...$weapon_ids.size
  3425. if i == $weapon_ids[x]
  3426. @data.push($data_weapons [i] )
  3427. end
  3428. end
  3429. end
  3430. end
  3431. @item_max = @data.size
  3432. if @item_max > 0
  3433. self.contents = Bitmap.new(width - 32, row_max * 32)
  3434. self.contents.font.name = $fontface
  3435. self.contents.font.size = 20
  3436. for i in 0...@item_max
  3437. draw_item(i)
  3438. end
  3439. end
  3440. end
  3441.  
  3442. def draw_item(index)
  3443. item = @data[index]
  3444. case item
  3445. when RPG::Item
  3446. number = $game_party.item_number(item.id)
  3447. when RPG::Weapon
  3448. number = $game_party.weapon_number(item.id)
  3449. when RPG::Armor
  3450. number = $game_party.armor_number(item.id)
  3451. end
  3452. if item.is_a?(RPG::Item) and
  3453. $game_party.item_can_use?(item.id)
  3454. self.contents.font.color = normal_color
  3455. else
  3456. self.contents.font.color = disabled_color
  3457. end
  3458. x = 4 + index % 1 * (288 + 32)
  3459. y = index / 1 * 32
  3460. rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  3461. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  3462. bitmap = RPG::Cache.icon(item.icon_name)
  3463. opacity = self.contents.font.color == normal_color ? 255 : 128
  3464. self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  3465. self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  3466. self.contents.draw_text(x + 144, y, 16, 32, ":", 1)
  3467. self.contents.draw_text(x + 160, y, 24, 32, number.to_s, 2)
  3468. end
  3469.  
  3470. def update_help
  3471. @help_window.set_text(self.item == nil ? "" : self.item.description)
  3472. end
  3473.  
  3474. end
  3475.  
  3476. #==============================================================================
  3477. # ■ Window_Weapon_Stats
  3478. #==============================================================================
  3479.  
  3480. class Window_Weapon_Stats < Window_Base
  3481.  
  3482. def initialize
  3483. super(0, 0, 352, 352)
  3484. self.contents = Bitmap.new(width - 32, height - 32)
  3485. self.contents.font.name = $fontface
  3486. self.contents.font.size = 20
  3487. @item = nil
  3488. refresh
  3489. end
  3490.  
  3491. def refresh
  3492. self.contents.clear
  3493. if @item == nil
  3494. return
  3495. end
  3496. case @item
  3497. when RPG::Item
  3498. number = $game_party.item_number(@item.id)
  3499. when RPG::Weapon
  3500. number = $game_party.weapon_number(@item.id)
  3501. when RPG::Armor
  3502. number = $game_party.armor_number(@item.id)
  3503. end
  3504. if @item.is_a?(RPG::Item)
  3505. return
  3506. end
  3507. for i in 0...$game_party.actors.size
  3508. actor = $game_party.actors[i]
  3509. if @item.is_a?(RPG::Weapon)
  3510. item1 = $data_weapons[actor.weapon_id]
  3511. elsif @item.kind == 0
  3512. item1 = $data_armors[actor.armor1_id]
  3513. elsif @item.kind == 1
  3514. item1 = $data_armors[actor.armor2_id]
  3515. elsif @item.kind == 2
  3516. item1 = $data_armors[actor.armor3_id]
  3517. else
  3518. item1 = $data_armors[actor.armor4_id]
  3519. end
  3520. if not actor.equippable?(@item)
  3521. draw_actor_graphic(actor, 16, 68 + (84 * i))
  3522. draw_actor_name(actor, 0, -6 + (84 * i))
  3523. draw_actor_level(actor, 86, -6 + (84 * i))
  3524. draw_actor_class(actor, 150, -6 + (84 * i))
  3525. draw_actor_state(actor, 230, -6 + (84 * i))
  3526. self.contents.draw_text(150, 44 + (84 * i), 150, 32, @item.name)
  3527. self.contents.font.name = $fontface
  3528. self.contents.font.size = 20
  3529. self.contents.font.color = normal_color
  3530. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Cannot Equip")
  3531. end
  3532. if actor.equippable?(@item)
  3533. draw_actor_graphic(actor, 16, 68 + (84 * i))
  3534. draw_actor_name(actor, 0, -6 + (84 * i))
  3535. draw_actor_level(actor, 86, -6 + (84 * i))
  3536. draw_actor_class(actor, 150, -6 + (84 * i))
  3537. draw_actor_state(actor, 230, -6 + (84 * i))
  3538. self.contents.draw_text(150, 44 + (84 * i), 150, 32, @item.name)
  3539. atk1 = 0
  3540. atk2 = 0
  3541. eva1 = 0
  3542. eva2 = 0
  3543. str1 = 0
  3544. str2 = 0
  3545. dex1 = 0
  3546. dex2 = 0
  3547. agi1 = 0
  3548. agi2 = 0
  3549. int1 = 0
  3550. int2 = 0
  3551. pdf1 = 0
  3552. pdf2 = 0
  3553. mdf1 = 0
  3554. mdf2 = 0
  3555. eva1 = 0
  3556. eva2 = 0
  3557. str1 = item1 != nil ? item1.str_plus : 0
  3558. str2 = @item != nil ? @item.str_plus : 0
  3559. dex1 = item1 != nil ? item1.dex_plus : 0
  3560. dex2 = @item != nil ? @item.dex_plus : 0
  3561. agi1 = item1 != nil ? item1.agi_plus : 0
  3562. agi2 = @item != nil ? @item.agi_plus : 0
  3563. int1 = item1 != nil ? item1.int_plus : 0
  3564. int2 = @item != nil ? @item.int_plus : 0
  3565. pdf1 = item1 != nil ? item1.pdef : 0
  3566. pdf2 = @item != nil ? @item.pdef : 0
  3567. mdf1 = item1 != nil ? item1.mdef : 0
  3568. mdf2 = @item != nil ? @item.mdef : 0
  3569. if @item.is_a?(RPG::Weapon)
  3570. atk1 = item1 != nil ? item1.atk : 0
  3571. atk2 = @item != nil ? @item.atk : 0
  3572. end
  3573. if @item.is_a?(RPG::Armor)
  3574. eva1 = item1 != nil ? item1.eva : 0
  3575. eva2 = @item != nil ? @item.eva : 0
  3576. end
  3577. str_change = str2 - str1
  3578. dex_change = dex2 - dex1
  3579. agi_change = agi2 - agi1
  3580. int_change = int2 - int1
  3581. pdf_change = pdf2 - pdf1
  3582. mdf_change = mdf2 - mdf1
  3583. atk_change = atk2 - atk1
  3584. eva_change = eva2 - eva1
  3585. if item1 == nil
  3586. name1 = ""
  3587. else
  3588. name1 = item1.name
  3589. end
  3590. if @item == nil
  3591. name2 = ""
  3592. else
  3593. name2 = @item.name
  3594. end
  3595. if str_change == 0 && dex_change == 0 && agi_change == 0 &&
  3596. pdf_change == 0 && mdf_change == 0 && atk_change == 0 &&
  3597. eva_change == 0 && name1 != name2
  3598. self.contents.font.name = $fontface
  3599. self.contents.font.size = 20
  3600. self.contents.draw_text(48, 18 + (84 * i), 288, 32, "No Change")
  3601. end
  3602. if name1 == name2
  3603. self.contents.font.name = $fontface
  3604. self.contents.font.size = 20
  3605. self.contents.draw_text(48, 18 + (84 * i), 288, 32, "Currently Equipped")
  3606. end
  3607. self.contents.font.name = $fontface
  3608. self.contents.font.size = 20
  3609. self.contents.font.color = normal_color
  3610. if @item.is_a?(RPG::Weapon) && atk_change != 0
  3611. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  3612. end
  3613. if @item.is_a?(RPG::Armor) && eva_change != 0
  3614. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  3615. end
  3616. if pdf_change != 0
  3617. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  3618. end
  3619. if mdf_change != 0
  3620. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  3621. end
  3622. if str_change != 0
  3623. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  3624. end
  3625. if dex_change != 0
  3626. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  3627. end
  3628. if agi_change != 0
  3629. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  3630. end
  3631. if str_change != 0
  3632. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  3633. end
  3634. end
  3635. end
  3636. end
  3637.  
  3638. def item=(item)
  3639. if @item != item
  3640. @item = item
  3641. refresh
  3642. end
  3643. end
  3644.  
  3645. def draw_actor_graphic(actor, x, y)
  3646. bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  3647. cw = bitmap.width / 4
  3648. ch = bitmap.height / 4
  3649. src_rect = Rect.new(0, 0, cw, ch)
  3650. self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  3651. end
  3652.  
  3653. end
  3654.  
  3655. #==============================================================================
  3656. # ■ Window_Armor
  3657. #==============================================================================
  3658.  
  3659. class Window_Armor < Window_Selectable
  3660.  
  3661. def initialize
  3662. super(0, 64, 224, 352)
  3663. @column_max = 1
  3664. refresh
  3665. self.index = 0
  3666. if $game_temp.in_battle
  3667. self.y = 64
  3668. self.height = 256
  3669. self.back_opacity = 160
  3670. end
  3671. end
  3672.  
  3673. def item
  3674. return @data[self.index]
  3675. end
  3676.  
  3677. def refresh
  3678. if self.contents != nil
  3679. self.contents.dispose
  3680. self.contents = nil
  3681. end
  3682. @data = []
  3683. for i in 1...$data_armors.size
  3684. if $game_party.armor_number(i) > 0
  3685. for x in 0...$armor_ids.size
  3686. if i == $armor_ids[x]
  3687. @data.push($data_armors [i] )
  3688. end
  3689. end
  3690. end
  3691. end
  3692. @item_max = @data.size
  3693. if @item_max > 0
  3694. self.contents = Bitmap.new(width - 32, row_max * 32)
  3695. self.contents.font.name = $fontface
  3696. self.contents.font.size = 20
  3697. for i in 0...@item_max
  3698. draw_item(i)
  3699. end
  3700. end
  3701. end
  3702.  
  3703. def draw_item(index)
  3704. item = @data[index]
  3705. case item
  3706. when RPG::Item
  3707. number = $game_party.item_number(item.id)
  3708. when RPG::Weapon
  3709. number = $game_party.weapon_number(item.id)
  3710. when RPG::Armor
  3711. number = $game_party.armor_number(item.id)
  3712. end
  3713. if item.is_a?(RPG::Item) and
  3714. $game_party.item_can_use?(item.id)
  3715. self.contents.font.color = normal_color
  3716. else
  3717. self.contents.font.color = disabled_color
  3718. end
  3719. x = 4 + index % 1 * (288 + 32)
  3720. y = index / 1 * 32
  3721. rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  3722. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  3723. bitmap = RPG::Cache.icon(item.icon_name)
  3724. opacity = self.contents.font.color == normal_color ? 255 : 128
  3725. self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  3726. self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  3727. self.contents.draw_text(x + 144, y, 16, 32, ":", 1)
  3728. self.contents.draw_text(x + 160, y, 24, 32, number.to_s, 2)
  3729. end
  3730.  
  3731. def update_help
  3732. @help_window.set_text(self.item == nil ? "" : self.item.description)
  3733. end
  3734.  
  3735. end
  3736.  
  3737. #==============================================================================
  3738. # ■ Window_Armor_Stats
  3739. #==============================================================================
  3740.  
  3741. class Window_Armor_Stats < Window_Base
  3742.  
  3743. def initialize
  3744. super(0, 0, 352, 352)
  3745. self.contents = Bitmap.new(width - 32, height - 32)
  3746. self.contents.font.name = $fontface
  3747. self.contents.font.size = 20
  3748. @item = nil
  3749. refresh
  3750. end
  3751.  
  3752. def refresh
  3753. self.contents.clear
  3754. if @item == nil
  3755. return
  3756. end
  3757. case @item
  3758. when RPG::Item
  3759. number = $game_party.item_number(@item.id)
  3760. when RPG::Weapon
  3761. number = $game_party.weapon_number(@item.id)
  3762. when RPG::Armor
  3763. number = $game_party.armor_number(@item.id)
  3764. end
  3765. if @item.is_a?(RPG::Item)
  3766. return
  3767. end
  3768. for i in 0...$game_party.actors.size
  3769. actor = $game_party.actors[i]
  3770. if @item.is_a?(RPG::Weapon)
  3771. item1 = $data_weapons[actor.weapon_id]
  3772. elsif @item.kind == 0
  3773. item1 = $data_armors[actor.armor1_id]
  3774. elsif @item.kind == 1
  3775. item1 = $data_armors[actor.armor2_id]
  3776. elsif @item.kind == 2
  3777. item1 = $data_armors[actor.armor3_id]
  3778. else
  3779. item1 = $data_armors[actor.armor4_id]
  3780. end
  3781. if not actor.equippable?(@item)
  3782. draw_actor_graphic(actor, 16, 68 + (84 * i))
  3783. draw_actor_name(actor, 0, -6 + (84 * i))
  3784. draw_actor_level(actor, 86, -6 + (84 * i))
  3785. draw_actor_class(actor, 150, -6 + (84 * i))
  3786. draw_actor_state(actor, 230, -6 + (84 * i))
  3787. self.contents.draw_text(150, 44 + (84 * i), 150, 32, @item.name)
  3788. self.contents.font.name = $fontface
  3789. self.contents.font.size = 20
  3790. self.contents.font.color = normal_color
  3791. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Cannot Equip")
  3792. end
  3793. if actor.equippable?(@item)
  3794. draw_actor_graphic(actor, 16, 68 + (84 * i))
  3795. draw_actor_name(actor, 0, -6 + (84 * i))
  3796. draw_actor_level(actor, 86, -6 + (84 * i))
  3797. draw_actor_class(actor, 150, -6 + (84 * i))
  3798. draw_actor_state(actor, 230, -6 + (84 * i))
  3799. self.contents.draw_text(150, 44 + (84 * i), 150, 32, @item.name)
  3800. atk1 = 0
  3801. atk2 = 0
  3802. eva1 = 0
  3803. eva2 = 0
  3804. str1 = 0
  3805. str2 = 0
  3806. dex1 = 0
  3807. dex2 = 0
  3808. agi1 = 0
  3809. agi2 = 0
  3810. int1 = 0
  3811. int2 = 0
  3812. pdf1 = 0
  3813. pdf2 = 0
  3814. mdf1 = 0
  3815. mdf2 = 0
  3816. eva1 = 0
  3817. eva2 = 0
  3818. str1 = item1 != nil ? item1.str_plus : 0
  3819. str2 = @item != nil ? @item.str_plus : 0
  3820. dex1 = item1 != nil ? item1.dex_plus : 0
  3821. dex2 = @item != nil ? @item.dex_plus : 0
  3822. agi1 = item1 != nil ? item1.agi_plus : 0
  3823. agi2 = @item != nil ? @item.agi_plus : 0
  3824. int1 = item1 != nil ? item1.int_plus : 0
  3825. int2 = @item != nil ? @item.int_plus : 0
  3826. pdf1 = item1 != nil ? item1.pdef : 0
  3827. pdf2 = @item != nil ? @item.pdef : 0
  3828. mdf1 = item1 != nil ? item1.mdef : 0
  3829. mdf2 = @item != nil ? @item.mdef : 0
  3830. if @item.is_a?(RPG::Weapon)
  3831. atk1 = item1 != nil ? item1.atk : 0
  3832. atk2 = @item != nil ? @item.atk : 0
  3833. end
  3834. if @item.is_a?(RPG::Armor)
  3835. eva1 = item1 != nil ? item1.eva : 0
  3836. eva2 = @item != nil ? @item.eva : 0
  3837. end
  3838. str_change = str2 - str1
  3839. dex_change = dex2 - dex1
  3840. agi_change = agi2 - agi1
  3841. int_change = int2 - int1
  3842. pdf_change = pdf2 - pdf1
  3843. mdf_change = mdf2 - mdf1
  3844. atk_change = atk2 - atk1
  3845. eva_change = eva2 - eva1
  3846. if item1 == nil
  3847. name1 = ""
  3848. else
  3849. name1 = item1.name
  3850. end
  3851. if @item == nil
  3852. name2 = ""
  3853. else
  3854. name2 = @item.name
  3855. end
  3856. if str_change == 0 && dex_change == 0 && agi_change == 0 &&
  3857. pdf_change == 0 && mdf_change == 0 && atk_change == 0 &&
  3858. eva_change == 0 && name1 != name2
  3859. self.contents.font.name = $fontface
  3860. self.contents.font.size = 20
  3861. self.contents.draw_text(48, 18 + (84 * i), 288, 32, "No Change")
  3862. end
  3863. if name1 == name2
  3864. self.contents.font.name = $fontface
  3865. self.contents.font.size = 20
  3866. self.contents.draw_text(48, 18 + (84 * i), 288, 32, "Currently Equipped")
  3867. end
  3868. self.contents.font.name = $fontface
  3869. self.contents.font.size = 20
  3870. self.contents.font.color = normal_color
  3871. if @item.is_a?(RPG::Weapon) && atk_change != 0
  3872. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  3873. end
  3874. if @item.is_a?(RPG::Armor) && eva_change != 0
  3875. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  3876. end
  3877. if pdf_change != 0
  3878. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  3879. end
  3880. if mdf_change != 0
  3881. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  3882. end
  3883. if str_change != 0
  3884. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  3885. end
  3886. if dex_change != 0
  3887. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  3888. end
  3889. if agi_change != 0
  3890. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  3891. end
  3892. if str_change != 0
  3893. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  3894. end
  3895. end
  3896. end
  3897. end
  3898.  
  3899. def item=(item)
  3900. if @item != item
  3901. @item = item
  3902. refresh
  3903. end
  3904. end
  3905.  
  3906. def draw_actor_graphic(actor, x, y)
  3907. bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  3908. cw = bitmap.width / 4
  3909. ch = bitmap.height / 4
  3910. src_rect = Rect.new(0, 0, cw, ch)
  3911. self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  3912. end
  3913.  
  3914. end
  3915.  
  3916. #==============================================================================
  3917. # ■ Window_Accessory
  3918. #==============================================================================
  3919.  
  3920. class Window_Accessory < Window_Selectable
  3921.  
  3922. def initialize
  3923. super(0, 64, 224, 352)
  3924. @column_max = 1
  3925. refresh
  3926. self.index = 0
  3927. if $game_temp.in_battle
  3928. self.y = 64
  3929. self.height = 256
  3930. self.back_opacity = 160
  3931. end
  3932. end
  3933.  
  3934. def item
  3935. return @data[self.index]
  3936. end
  3937.  
  3938. def refresh
  3939. if self.contents != nil
  3940. self.contents.dispose
  3941. self.contents = nil
  3942. end
  3943. @data = []
  3944. for i in 1...$data_armors.size
  3945. if $game_party.armor_number(i) > 0
  3946. for x in 0...$accessory_ids.size
  3947. if i == $accessory_ids[x]
  3948. @data.push($data_armors [i] )
  3949. end
  3950. end
  3951. end
  3952. end
  3953. @item_max = @data.size
  3954. if @item_max > 0
  3955. self.contents = Bitmap.new(width - 32, row_max * 32)
  3956. self.contents.font.name = $fontface
  3957. self.contents.font.size = 20
  3958. for i in 0...@item_max
  3959. draw_item(i)
  3960. end
  3961. end
  3962. end
  3963.  
  3964. def draw_item(index)
  3965. item = @data[index]
  3966. case item
  3967. when RPG::Item
  3968. number = $game_party.item_number(item.id)
  3969. when RPG::Weapon
  3970. number = $game_party.weapon_number(item.id)
  3971. when RPG::Armor
  3972. number = $game_party.armor_number(item.id)
  3973. end
  3974. if item.is_a?(RPG::Item) and
  3975. $game_party.item_can_use?(item.id)
  3976. self.contents.font.color = normal_color
  3977. else
  3978. self.contents.font.color = disabled_color
  3979. end
  3980. x = 4 + index % 1 * (288 + 32)
  3981. y = index / 1 * 32
  3982. rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  3983. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  3984. bitmap = RPG::Cache.icon(item.icon_name)
  3985. opacity = self.contents.font.color == normal_color ? 255 : 128
  3986. self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  3987. self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  3988. self.contents.draw_text(x + 144, y, 16, 32, ":", 1)
  3989. self.contents.draw_text(x + 160, y, 24, 32, number.to_s, 2)
  3990. end
  3991.  
  3992. def update_help
  3993. @help_window.set_text(self.item == nil ? "" : self.item.description)
  3994. end
  3995.  
  3996. end
  3997.  
  3998. #==============================================================================
  3999. # ■ Window_Accessory_Stats
  4000. #==============================================================================
  4001.  
  4002. class Window_Accessory_Stats < Window_Base
  4003.  
  4004. def initialize
  4005. super(0, 0, 352, 352)
  4006. self.contents = Bitmap.new(width - 32, height - 32)
  4007. self.contents.font.name = $fontface
  4008. self.contents.font.size = 20
  4009. @item = nil
  4010. refresh
  4011. end
  4012.  
  4013. def refresh
  4014. self.contents.clear
  4015. if @item == nil
  4016. return
  4017. end
  4018. case @item
  4019. when RPG::Item
  4020. number = $game_party.item_number(@item.id)
  4021. when RPG::Weapon
  4022. number = $game_party.weapon_number(@item.id)
  4023. when RPG::Armor
  4024. number = $game_party.armor_number(@item.id)
  4025. end
  4026. if @item.is_a?(RPG::Item)
  4027. return
  4028. end
  4029. for i in 0...$game_party.actors.size
  4030. actor = $game_party.actors[i]
  4031. if @item.is_a?(RPG::Weapon)
  4032. item1 = $data_weapons[actor.weapon_id]
  4033. elsif @item.kind == 0
  4034. item1 = $data_armors[actor.armor1_id]
  4035. elsif @item.kind == 1
  4036. item1 = $data_armors[actor.armor2_id]
  4037. elsif @item.kind == 2
  4038. item1 = $data_armors[actor.armor3_id]
  4039. else
  4040. item1 = $data_armors[actor.armor4_id]
  4041. end
  4042. if not actor.equippable?(@item)
  4043. draw_actor_graphic(actor, 16, 68 + (84 * i))
  4044. draw_actor_name(actor, 0, -6 + (84 * i))
  4045. draw_actor_level(actor, 86, -6 + (84 * i))
  4046. draw_actor_class(actor, 150, -6 + (84 * i))
  4047. draw_actor_state(actor, 230, -6 + (84 * i))
  4048. self.contents.draw_text(150, 44 + (84 * i), 150, 32, @item.name)
  4049. self.contents.font.name = $fontface
  4050. self.contents.font.size = 20
  4051. self.contents.font.color = normal_color
  4052. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Cannot Equip")
  4053. end
  4054. if actor.equippable?(@item)
  4055. draw_actor_graphic(actor, 16, 68 + (84 * i))
  4056. draw_actor_name(actor, 0, -6 + (84 * i))
  4057. draw_actor_level(actor, 86, -6 + (84 * i))
  4058. draw_actor_class(actor, 150, -6 + (84 * i))
  4059. draw_actor_state(actor, 230, -6 + (84 * i))
  4060. self.contents.draw_text(150, 44 + (84 * i), 150, 32, @item.name)
  4061. atk1 = 0
  4062. atk2 = 0
  4063. eva1 = 0
  4064. eva2 = 0
  4065. str1 = 0
  4066. str2 = 0
  4067. dex1 = 0
  4068. dex2 = 0
  4069. agi1 = 0
  4070. agi2 = 0
  4071. int1 = 0
  4072. int2 = 0
  4073. pdf1 = 0
  4074. pdf2 = 0
  4075. mdf1 = 0
  4076. mdf2 = 0
  4077. eva1 = 0
  4078. eva2 = 0
  4079. str1 = item1 != nil ? item1.str_plus : 0
  4080. str2 = @item != nil ? @item.str_plus : 0
  4081. dex1 = item1 != nil ? item1.dex_plus : 0
  4082. dex2 = @item != nil ? @item.dex_plus : 0
  4083. agi1 = item1 != nil ? item1.agi_plus : 0
  4084. agi2 = @item != nil ? @item.agi_plus : 0
  4085. int1 = item1 != nil ? item1.int_plus : 0
  4086. int2 = @item != nil ? @item.int_plus : 0
  4087. pdf1 = item1 != nil ? item1.pdef : 0
  4088. pdf2 = @item != nil ? @item.pdef : 0
  4089. mdf1 = item1 != nil ? item1.mdef : 0
  4090. mdf2 = @item != nil ? @item.mdef : 0
  4091. if @item.is_a?(RPG::Weapon)
  4092. atk1 = item1 != nil ? item1.atk : 0
  4093. atk2 = @item != nil ? @item.atk : 0
  4094. end
  4095. if @item.is_a?(RPG::Armor)
  4096. eva1 = item1 != nil ? item1.eva : 0
  4097. eva2 = @item != nil ? @item.eva : 0
  4098. end
  4099. str_change = str2 - str1
  4100. dex_change = dex2 - dex1
  4101. agi_change = agi2 - agi1
  4102. int_change = int2 - int1
  4103. pdf_change = pdf2 - pdf1
  4104. mdf_change = mdf2 - mdf1
  4105. atk_change = atk2 - atk1
  4106. eva_change = eva2 - eva1
  4107. if item1 == nil
  4108. name1 = ""
  4109. else
  4110. name1 = item1.name
  4111. end
  4112. if @item == nil
  4113. name2 = ""
  4114. else
  4115. name2 = @item.name
  4116. end
  4117. if str_change == 0 && dex_change == 0 && agi_change == 0 &&
  4118. pdf_change == 0 && mdf_change == 0 && atk_change == 0 &&
  4119. eva_change == 0 && name1 != name2
  4120. self.contents.font.name = $fontface
  4121. self.contents.font.size = 20
  4122. self.contents.draw_text(48, 18 + (84 * i), 288, 32, "Equippable")
  4123. end
  4124. if name1 == name2
  4125. self.contents.font.name = $fontface
  4126. self.contents.font.size = 20
  4127. self.contents.draw_text(48, 18 + (84 * i), 288, 32, "Currently Equipped")
  4128. end
  4129. self.contents.font.name = $fontface
  4130. self.contents.font.size = 20
  4131. self.contents.font.color = normal_color
  4132. if @item.is_a?(RPG::Weapon) && atk_change != 0
  4133. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  4134. end
  4135. if @item.is_a?(RPG::Armor) && eva_change != 0
  4136. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  4137. end
  4138. if pdf_change != 0
  4139. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  4140. end
  4141. if mdf_change != 0
  4142. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  4143. end
  4144. if str_change != 0
  4145. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  4146. end
  4147. if dex_change != 0
  4148. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  4149. end
  4150. if agi_change != 0
  4151. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  4152. end
  4153. if str_change != 0
  4154. self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  4155. end
  4156. end
  4157. end
  4158. end
  4159.  
  4160. def item=(item)
  4161. if @item != item
  4162. @item = item
  4163. refresh
  4164. end
  4165. end
  4166.  
  4167. def draw_actor_graphic(actor, x, y)
  4168. bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  4169. cw = bitmap.width / 4
  4170. ch = bitmap.height / 4
  4171. src_rect = Rect.new(0, 0, cw, ch)
  4172. self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  4173. end
  4174.  
  4175. end
  4176.  
  4177. #==============================================================================
  4178. # ■ Window_NewSkill
  4179. #==============================================================================
  4180.  
  4181. class Window_NewSkill < Window_Selectable
  4182.  
  4183. def initialize(actor)
  4184. super(0, 64, 384, 352)
  4185. @actor = actor
  4186. @column_max = 1
  4187. refresh
  4188. self.index = 0
  4189. if $game_temp.in_battle
  4190. self.y = 64
  4191. self.height = 256
  4192. self.back_opacity = 160
  4193. end
  4194. end
  4195.  
  4196. def skill
  4197. return @data[self.index]
  4198. end
  4199.  
  4200. def update_actor(actor)
  4201. @actor = actor
  4202. refresh
  4203. end
  4204.  
  4205. def refresh
  4206. if self.contents != nil
  4207. self.contents.dispose
  4208. self.contents = nil
  4209. end
  4210. @data = []
  4211. for i in 0...@actor.skills.size
  4212. skill = $data_skills[@actor.skills[i]]
  4213. if skill != nil
  4214. @data.push(skill)
  4215. end
  4216. end
  4217. @item_max = @data.size
  4218. if @item_max > 0
  4219. self.contents = Bitmap.new(width - 32, row_max * 32)
  4220. self.contents.font.name = $fontface
  4221. self.contents.font.size = 20
  4222. for i in 0...@item_max
  4223. draw_item(i)
  4224. end
  4225. end
  4226. end
  4227.  
  4228. def draw_item(index)
  4229. skill = @data[index]
  4230. if @actor.skill_can_use?(skill.id)
  4231. self.contents.font.color = normal_color
  4232. else
  4233. self.contents.font.color = disabled_color
  4234. end
  4235. x = 4 + index % 1 * (240 + 32)
  4236. y = index / 1 * 32
  4237. rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  4238. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  4239. bitmap = RPG::Cache.icon(skill.icon_name)
  4240. opacity = self.contents.font.color == normal_color ? 255 : 128
  4241. self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  4242. self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
  4243. self.contents.draw_text(x + 288, y, 48, 32, skill.sp_cost.to_s, 2)
  4244. end
  4245.  
  4246. def update_help
  4247. @help_window.set_text(self.skill == nil ? "" : self.skill.description)
  4248. end
  4249.  
  4250. end
  4251.  
  4252. #==============================================================================
  4253. # ■ Window_NewEquipLeft
  4254. #==============================================================================
  4255.  
  4256. class Window_NewEquipLeft < Window_Base
  4257.  
  4258. attr_accessor :mode
  4259. attr_accessor :changes
  4260.  
  4261. def initialize(actor)
  4262. super(32, 96, 272, 352)
  4263. self.contents = Bitmap.new(width - 32, height - 32)
  4264. self.contents.font.name = $fontface
  4265. self.contents.font.size = 20
  4266. self.z += 100
  4267. @actor = actor
  4268. @mode = 0
  4269. @changes = [0, 0, 0, 0, 0, 0, 0, 0]
  4270. @elem_text = ""
  4271. @stat_text = ""
  4272. refresh
  4273. end
  4274.  
  4275. def update_actor(actor)
  4276. @actor = actor
  4277. refresh
  4278. end
  4279.  
  4280. def refresh
  4281. self.contents.clear
  4282. draw_actor_name(@actor, 4, 0)
  4283. draw_actor_level(@actor, 180, 0)
  4284. draw_actor_parameter(@actor, 4, 24, 0)
  4285. draw_actor_parameter(@actor, 4, 48, 1)
  4286. draw_actor_parameter(@actor, 4, 72, 2)
  4287. draw_actor_parameter(@actor, 4, 96, 3)
  4288. draw_actor_parameter(@actor, 4, 120, 4)
  4289. draw_actor_parameter(@actor, 4, 144, 5)
  4290. draw_actor_parameter(@actor, 4, 168, 6)
  4291. if @mode == 0
  4292. self.contents.font.color = up_color
  4293. self.contents.draw_text(4, 216, 200, 32, "Elemental Attack:")
  4294. self.contents.draw_text(4, 264, 200, 32, "Status Attack:")
  4295. end
  4296. if @mode == 1
  4297. self.contents.font.color = up_color
  4298. self.contents.draw_text(4, 216, 200, 32, "Elemental Defense:")
  4299. self.contents.draw_text(4, 264, 200, 32, "Status Defense:")
  4300. end
  4301. self.contents.font.color = normal_color
  4302. self.contents.draw_text(24, 240, 220, 32, @elem_text)
  4303. self.contents.draw_text(24, 288, 220, 32, @stat_text)
  4304. if @new_atk != nil
  4305. self.contents.font.color = system_color
  4306. self.contents.draw_text(168, 24, 40, 32, "»»", 1)
  4307. if @changes[0] == 0
  4308. self.contents.font.color = normal_color
  4309. elsif @changes[0] == -1
  4310. self.contents.font.color = down_color
  4311. else
  4312. self.contents.font.color = up_color
  4313. end
  4314. self.contents.draw_text(200, 24, 36, 32, @new_atk.to_s, 2)
  4315. end
  4316. if @new_pdef != nil
  4317. self.contents.font.color = system_color
  4318. self.contents.draw_text(168, 48, 40, 32, "»»", 1)
  4319. if @changes[1] == 0
  4320. self.contents.font.color = normal_color
  4321. elsif @changes[1] == -1
  4322. self.contents.font.color = down_color
  4323. else
  4324. self.contents.font.color = up_color
  4325. end
  4326. self.contents.draw_text(200, 48, 36, 32, @new_pdef.to_s, 2)
  4327. end
  4328. if @new_mdef != nil
  4329. self.contents.font.color = system_color
  4330. self.contents.draw_text(168, 72, 40, 32, "»»", 1)
  4331. if @changes[2] == 0
  4332. self.contents.font.color = normal_color
  4333. elsif @changes[2] == -1
  4334. self.contents.font.color = down_color
  4335. else
  4336. self.contents.font.color = up_color
  4337. end
  4338. self.contents.draw_text(200, 72, 36, 32, @new_mdef.to_s, 2)
  4339. end
  4340. if @new_str != nil
  4341. self.contents.font.color = system_color
  4342. self.contents.draw_text(168, 96, 40, 32, "»»", 1)
  4343. if @changes[3] == 0
  4344. self.contents.font.color = normal_color
  4345. elsif @changes[3] == -1
  4346. self.contents.font.color = down_color
  4347. else
  4348. self.contents.font.color = up_color
  4349. end
  4350. self.contents.draw_text(200, 96, 36, 32, @new_str.to_s, 2)
  4351. end
  4352. if @new_dex != nil
  4353. self.contents.font.color = system_color
  4354. self.contents.draw_text(168, 120, 40, 32, "»»", 1)
  4355. if @changes[4] == 0
  4356. self.contents.font.color = normal_color
  4357. elsif @changes[4] == -1
  4358. self.contents.font.color = down_color
  4359. else
  4360. self.contents.font.color = up_color
  4361. end
  4362. self.contents.draw_text(200, 120, 36, 32, @new_dex.to_s, 2)
  4363. end
  4364. if @new_agi != nil
  4365. self.contents.font.color = system_color
  4366. self.contents.draw_text(168, 144, 40, 32, "»»", 1)
  4367. if @changes[5] == 0
  4368. self.contents.font.color = normal_color
  4369. elsif @changes[5] == -1
  4370. self.contents.font.color = down_color
  4371. else
  4372. self.contents.font.color = up_color
  4373. end
  4374. self.contents.draw_text(200, 144, 36, 32, @new_agi.to_s, 2)
  4375. end
  4376. if @new_int != nil
  4377. self.contents.font.color = system_color
  4378. self.contents.draw_text(168, 168, 40, 32, "»»", 1)
  4379. if @changes[6] == 0
  4380. self.contents.font.color = normal_color
  4381. elsif @changes[6] == -1
  4382. self.contents.font.color = down_color
  4383. else
  4384. self.contents.font.color = up_color
  4385. end
  4386. self.contents.draw_text(200, 168, 36, 32, @new_int.to_s, 2)
  4387. end
  4388. end
  4389.  
  4390. def set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex,
  4391. new_agi, new_int, new_eva, elem_text, stat_text)
  4392. flag = false
  4393. if new_atk != @new_atk || new_pdef != @new_pdef || new_mdef != @new_mdef
  4394. flag = true
  4395. end
  4396. if new_str != @new_str || new_dex != @new_dex || new_agi != @new_agi
  4397. flag = true
  4398. end
  4399. if new_eva != @new_eva || elem_text != @elem_text || stat_text != @stat_text
  4400. flag = true
  4401. end
  4402. @new_atk = new_atk
  4403. @new_pdef = new_pdef
  4404. @new_mdef = new_mdef
  4405. @new_str = new_str
  4406. @new_dex = new_dex
  4407. @new_agi = new_agi
  4408. @new_int = new_int
  4409. @new_eva = new_eva
  4410. @elem_text = elem_text
  4411. @stat_text = stat_text
  4412. if flag
  4413. refresh
  4414. end
  4415. end
  4416.  
  4417. end
  4418.  
  4419. #==============================================================================
  4420. # ■ Window_NewEquipRight
  4421. #==============================================================================
  4422.  
  4423. class Window_NewEquipRight < Window_Selectable
  4424.  
  4425. def initialize(actor)
  4426. super(304, 96, 304, 192)
  4427. self.contents = Bitmap.new(width - 32, height - 32)
  4428. self.contents.font.name = $fontface
  4429. self.contents.font.size = 20
  4430. @actor = actor
  4431. refresh
  4432. self.index = 0
  4433. end
  4434.  
  4435. def item
  4436. return @data[self.index]
  4437. end
  4438.  
  4439. def update_actor(actor)
  4440. @actor = actor
  4441. refresh
  4442. end
  4443.  
  4444. def refresh
  4445. self.contents.clear
  4446. @data = []
  4447. @data.push($data_weapons[@actor.weapon_id])
  4448. @data.push($data_armors[@actor.armor1_id])
  4449. @data.push($data_armors[@actor.armor2_id])
  4450. @data.push($data_armors[@actor.armor3_id])
  4451. @data.push($data_armors[@actor.armor4_id])
  4452. @item_max = @data.size
  4453. self.contents.font.color = system_color
  4454. self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
  4455. self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
  4456. self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
  4457. self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
  4458. self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4)
  4459. draw_item_name(@data[0], 92, 32 * 0)
  4460. draw_item_name(@data[1], 92, 32 * 1)
  4461. draw_item_name(@data[2], 92, 32 * 2)
  4462. draw_item_name(@data[3], 92, 32 * 3)
  4463. draw_item_name(@data[4], 92, 32 * 4)
  4464. end
  4465.  
  4466. def update_help
  4467. @help_window.set_text(self.item == nil ? "" : self.item.description)
  4468. end
  4469.  
  4470. end
  4471.  
  4472. #==============================================================================
  4473. # ■ Window_NewEquipItem
  4474. #==============================================================================
  4475.  
  4476. class Window_NewEquipItem < Window_Selectable
  4477.  
  4478. def initialize(actor, equip_type)
  4479. super(304, 288, 304, 160)
  4480. @actor = actor
  4481. @equip_type = equip_type
  4482. @column_max = 1
  4483. refresh
  4484. self.active = false
  4485. self.index = -1
  4486. end
  4487.  
  4488. def item
  4489. return @data[self.index]
  4490. end
  4491.  
  4492. def update_actor(actor, equip_type)
  4493. @actor = actor
  4494. @equip_type = equip_type
  4495. refresh
  4496. end
  4497.  
  4498. def refresh
  4499. if self.contents != nil
  4500. self.contents.dispose
  4501. self.contents = nil
  4502. end
  4503. @data = []
  4504. if @equip_type == 0
  4505. weapon_set = $data_classes[@actor.class_id].weapon_set
  4506. for i in 1...$data_weapons.size
  4507. if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
  4508. @data.push($data_weapons[i])
  4509. end
  4510. end
  4511. end
  4512. if @equip_type != 0
  4513. armor_set = $data_classes[@actor.class_id].armor_set
  4514. for i in 1...$data_armors.size
  4515. if $game_party.armor_number(i) > 0 and armor_set.include?(i)
  4516. if $data_armors[i].kind == @equip_type-1
  4517. @data.push($data_armors[i])
  4518. end
  4519. end
  4520. end
  4521. end
  4522. @data.push(nil)
  4523. @item_max = @data.size
  4524. self.contents = Bitmap.new(width - 32, row_max * 32)
  4525. self.contents.font.name = $fontface
  4526. self.contents.font.size = 20
  4527. for i in 0...@item_max-1
  4528. draw_item(i)
  4529. end
  4530. s = @data.size-1
  4531. self.contents.draw_text(4, s*32, 100, 32, "[Remove]")
  4532. end
  4533.  
  4534. def draw_item(index)
  4535. item = @data[index]
  4536. x = 4
  4537. y = index * 32
  4538. case item
  4539. when RPG::Weapon
  4540. number = $game_party.weapon_number(item.id)
  4541. when RPG::Armor
  4542. number = $game_party.armor_number(item.id)
  4543. end
  4544. bitmap = RPG::Cache.icon(item.icon_name)
  4545. self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  4546. self.contents.font.color = normal_color
  4547. self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  4548. self.contents.draw_text(x + 208, y, 16, 32, ":", 1)
  4549. self.contents.draw_text(x + 224, y, 24, 32, number.to_s, 2)
  4550. end
  4551.  
  4552. def update_help
  4553. @help_window.set_text(self.item == nil ? "" : self.item.description)
  4554. end
  4555.  
  4556. end
  4557.  
  4558. #==============================================================================
  4559. # ■ Window_NewStatus
  4560. #==============================================================================
  4561.  
  4562. class Window_NewStatus < Window_Base
  4563.  
  4564. def initialize(actor)
  4565. super(0, 0, 576, 416)
  4566. self.contents = Bitmap.new(width - 32, height - 32)
  4567. self.contents.font.name = $fontface
  4568. self.contents.font.size = 20
  4569. @actor = actor
  4570. refresh
  4571. end
  4572.  
  4573. def refresh
  4574. self.contents.clear
  4575. draw_actor_name(@actor, 54, 0)
  4576. draw_actor_battler(@actor, 80, 200)
  4577. draw_actor_class(@actor, 254, 0)
  4578. draw_actor_level(@actor, 184, 0)
  4579. draw_actor_state(@actor, 184, 40)
  4580. draw_actor_hp(@actor, 184, 80, 172)
  4581. draw_actor_sp(@actor, 184, 120, 172)
  4582. draw_actor_exp(@actor, 184, 160, 172)
  4583. draw_actor_parameter(@actor, 386, 0, 0)
  4584. draw_actor_parameter(@actor, 386, 24, 1)
  4585. draw_actor_parameter(@actor, 386, 48, 2)
  4586. draw_actor_parameter(@actor, 386, 72, 3)
  4587. draw_actor_parameter(@actor, 386, 96, 4)
  4588. draw_actor_parameter(@actor, 386, 120, 5)
  4589. draw_actor_parameter(@actor, 386, 144, 6)
  4590. draw_actor_parameter(@actor, 386, 168, 7)
  4591. self.contents.font.color = system_color
  4592. self.contents.draw_text(45, 196, 180, 32, "Elemental Vulnerability" )
  4593. self.contents.font.size = 16
  4594. draw_actor_element_radar_graph(@actor, 14, 204)
  4595. self.contents.font.size = 20
  4596. self.contents.font.color = system_color
  4597. self.contents.draw_text(360, 200, 96, 32, "Equipment")
  4598. self.contents.draw_text(280, 228, 96, 32, "Weapon")
  4599. self.contents.draw_text(280, 256, 96, 32, "Shield")
  4600. self.contents.draw_text(280, 284, 96, 32, "Helmet")
  4601. self.contents.draw_text(280, 312, 96, 32, "Armor")
  4602. self.contents.draw_text(280, 340, 96, 32, "Accessory")
  4603. equip = $data_weapons[@actor.weapon_id]
  4604. if @actor.equippable?(equip)
  4605. draw_item_name($data_weapons[@actor.weapon_id], 386, 228)
  4606. else
  4607. self.contents.font.color = knockout_color
  4608. self.contents.draw_text(386, 228, 192, 32, "Nothing equipped")
  4609. end
  4610. equip1 = $data_armors[@actor.armor1_id]
  4611. if @actor.equippable?(equip1)
  4612. draw_item_name($data_armors[@actor.armor1_id], 386, 256)
  4613. else
  4614. self.contents.font.color = crisis_color
  4615. self.contents.draw_text(386, 256, 192, 32, "Nothing equipped")
  4616. end
  4617. equip2 = $data_armors[@actor.armor2_id]
  4618. if @actor.equippable?(equip2)
  4619. draw_item_name($data_armors[@actor.armor2_id], 386, 284)
  4620. else
  4621. self.contents.font.color = crisis_color
  4622. self.contents.draw_text(386, 284, 192, 32, "Nothing equipped")
  4623. end
  4624. equip3 = $data_armors[@actor.armor3_id]
  4625. if @actor.equippable?(equip3)
  4626. draw_item_name($data_armors[@actor.armor3_id], 386, 312)
  4627. else
  4628. self.contents.font.color = crisis_color
  4629. self.contents.draw_text(386, 312, 192, 32, "Nothing equipped")
  4630. end
  4631. equip4 = $data_armors[@actor.armor4_id]
  4632. if @actor.equippable?(equip4)
  4633. draw_item_name($data_armors[@actor.armor4_id], 386, 340)
  4634. else
  4635. self.contents.font.color = crisis_color
  4636. self.contents.draw_text(386, 340, 192, 32, "Nothing equipped")
  4637. end
  4638. end
  4639.  
  4640. def update_actor(actor)
  4641. @actor = actor
  4642. refresh
  4643. end
  4644.  
  4645. def dummy
  4646. self.contents.font.color = system_color
  4647. self.contents.draw_text(320, 112, 96, 32, $data_system.words.weapon)
  4648. self.contents.draw_text(320, 176, 96, 32, $data_system.words.armor1)
  4649. self.contents.draw_text(320, 240, 96, 32, $data_system.words.armor2)
  4650. self.contents.draw_text(320, 304, 96, 32, $data_system.words.armor3)
  4651. self.contents.draw_text(320, 368, 96, 32, $data_system.words.armor4)
  4652. draw_item_name($data_weapons[@actor.weapon_id], 320 + 24, 144)
  4653. draw_item_name($data_armors[@actor.armor1_id], 320 + 24, 208)
  4654. draw_item_name($data_armors[@actor.armor2_id], 320 + 24, 272)
  4655. draw_item_name($data_armors[@actor.armor3_id], 320 + 24, 336)
  4656. draw_item_name($data_armors[@actor.armor4_id], 320 + 24, 400)
  4657. end
  4658.  
  4659. end
  4660.  
  4661.  
  4662. #==============================================================================
  4663. # ■ Window_NewGold
  4664. #==============================================================================
  4665.  
  4666. class Window_NewGold < Window_Base
  4667.  
  4668. def initialize
  4669. super(0, 0, 160, 64)
  4670. self.contents = Bitmap.new(width - 32, height - 32)
  4671. self.contents.font.name = $fontface
  4672. self.contents.font.size = 20
  4673. refresh
  4674. end
  4675.  
  4676. def refresh
  4677. self.contents.clear
  4678. cx = contents.text_size($data_system.words.gold).width
  4679. self.contents.font.color = normal_color
  4680. self.contents.draw_text(4, 0, 120-cx-2, 32, $game_party.gold.to_s + " ", 2)
  4681. self.contents.font.color = system_color
  4682. self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2)
  4683. end
  4684.  
  4685. end
  4686.  
  4687.  
  4688. #==============================================================================
  4689. # ■ class Window_NewTime
  4690. # written by Deke
  4691. #--------------------------------------------------------------------------------------------------------------------------------------------
  4692. #==============================================================================
  4693.  
  4694. class Window_NewTime < Window_Base
  4695.  
  4696. def initialize
  4697. super(0, 0, 160, 96)
  4698. self.contents = Bitmap.new(width - 32, height - 32)
  4699. self.contents.font.name = $fontface
  4700. self.contents.font.size = 20
  4701. refresh
  4702. end
  4703.  
  4704. def refresh
  4705. self.contents.clear
  4706. self.windowskin = RPG::Cache.windowskin($game_system.windowskin_name)
  4707. self.contents.font.name = $fontface
  4708. self.contents.font.size = 20
  4709. @total_sec = Graphics.frame_count / Graphics.frame_rate
  4710. @minute=$game_time.get_minute.floor
  4711. hour = $game_time.get_hour
  4712. pm_flag= hour >=12 ? true : false
  4713. hour= hour >= 12 ? hour-12 : hour
  4714. day=$game_time.get_day
  4715. month=$game_time.get_month
  4716. year=$game_time.get_year
  4717. if hour.floor==0
  4718. text=sprintf("%02d:%02d",12,@minute)
  4719. else
  4720. text=sprintf("%02d:%02d",hour,@minute)
  4721. end
  4722. if pm_flag
  4723. text += " PM"
  4724. else
  4725. text += " AM"
  4726. end
  4727. self.contents.font.color = normal_color
  4728. self.contents.draw_text(16, 32, 110, 32, text, 2)
  4729. text = sprintf("%02d - %02d - %02d", month, day, year)
  4730. self.contents.font.color = system_color
  4731. self.contents.draw_text(4,0,120,32,text)
  4732. end
  4733.  
  4734. def update
  4735. if $game_time.get_minute.floor != @minute
  4736. refresh
  4737. end
  4738. end
  4739.  
  4740. end
  4741.  
  4742. #==============================================================================
  4743. # ■ Window_NewLocation
  4744. #==============================================================================
  4745.  
  4746. class Window_NewLocation < Window_Base
  4747.  
  4748. def initialize
  4749. super(0, 0, 160, 96)
  4750. self.contents = Bitmap.new(width - 32, height - 32)
  4751. self.contents.font.name = $fontface
  4752. self.contents.font.size = 20
  4753. refresh
  4754. end
  4755.  
  4756. def refresh
  4757. self.contents.clear
  4758. self.contents.font.color = system_color
  4759. self.contents.draw_text(4, 0, 120, 32, "Location")
  4760. self.contents.font.color = normal_color
  4761. self.contents.draw_text(4, 32, 120, 32, $game_map.name.to_s, 2)
  4762. end
  4763.  
  4764. end
  4765.  
  4766. #==============================================================================
  4767. # ■ Window_OptionMenuCommand
  4768. #==============================================================================
  4769. class Window_OptionMenuCommand < Window_Selectable
  4770.  
  4771. def initialize(width, commands)
  4772. super(0, 0, width, commands.size * 32 + 32)
  4773. @item_max = commands.size
  4774. @commands = commands
  4775. self.contents = Bitmap.new(width - 32, @item_max * 32)
  4776. self.contents.font.name = $fontface
  4777. self.contents.font.size = 20
  4778. refresh
  4779. self.index = 0
  4780. end
  4781.  
  4782. def refresh
  4783. self.contents.clear
  4784. for i in 0...@item_max
  4785. draw_item(i, normal_color)
  4786. end
  4787. end
  4788.  
  4789. def draw_item(index, color)
  4790. self.contents.font.color = color
  4791. rect = Rect.new(12, 32 * index, self.contents.width - 8, 32)
  4792. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  4793. bitmap = RPG::Cache.icon("optionmenu" + index.to_s)
  4794. self.contents.blt(x + 3, index * 32 +4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  4795. self.contents.draw_text(rect, @commands[index])
  4796. end
  4797.  
  4798. def disable_item(index)
  4799. draw_item(index, disabled_color)
  4800. end
  4801.  
  4802. end
  4803.  
  4804. #==============================================================================
  4805. # ■ Window_CurrentWindowSkin
  4806. #==============================================================================
  4807. class Window_CurrentWindowSkin < Window_Base
  4808.  
  4809. def initialize
  4810. super(0, 0, 192, 96)
  4811. self.contents = Bitmap.new(width - 32, height - 32)
  4812. self.contents.font.name = $fontface
  4813. self.contents.font.size = 20
  4814. end
  4815.  
  4816. def refresh
  4817. self.contents.clear
  4818. self.contents.font.color = system_color
  4819. self.contents.draw_text(4, 0, 120, 32, "Current skin")
  4820. self.contents.font.color = normal_color
  4821. self.contents.draw_text(4, 32, 120, 32, $game_system.windowskin_name.to_s, 2.9)
  4822. end
  4823.  
  4824. end
  4825.  
  4826. #==============================================================================
  4827. # ■ Window_WindowSkin
  4828. #==============================================================================
  4829. class Window_WindowSkin < Window_Selectable
  4830.  
  4831. def initialize(width, commands)
  4832. super(0, 0, width, commands.size * 32 + 32)
  4833. @item_max = commands.size
  4834. @commands = commands
  4835. self.contents = Bitmap.new(width - 32, @item_max * 32)
  4836. self.contents.font.name = $fontface
  4837. self.contents.font.size = 20
  4838. refresh
  4839. self.index = 0
  4840. end
  4841.  
  4842. def refresh
  4843. self.contents.clear
  4844. for i in 0...@item_max
  4845. draw_item(i, normal_color)
  4846. end
  4847. end
  4848.  
  4849. def draw_item(index, color)
  4850. self.contents.font.color = color
  4851. rect = Rect.new(12, 32 * index, self.contents.width - 8, 32)
  4852. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  4853. bitmap = RPG::Cache.icon("skin" + index.to_s)
  4854. self.contents.blt(x + 3, index * 32 +4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  4855. self.contents.draw_text(rect, @commands[index])
  4856. end
  4857.  
  4858. def disable_item(index)
  4859. draw_item(index, disabled_color)
  4860. end
  4861.  
  4862. end
  4863.  
  4864. #==============================================================================
  4865. # ■ Window_CurrentFontType
  4866. #==============================================================================
  4867. class Window_CurrentFontType < Window_Base
  4868.  
  4869. def initialize
  4870. super(0, 0, 192, 96)
  4871. self.contents = Bitmap.new(width - 32, height - 32)
  4872. self.contents.font.name = $fontface
  4873. self.contents.font.size = 20
  4874. end
  4875.  
  4876. def refresh
  4877. self.contents.clear
  4878. self.contents.font.color = system_color
  4879. self.contents.draw_text(4, 0, 120, 32, "Current Font")
  4880. self.contents.font.color = normal_color
  4881. self.contents.draw_text(4, 32, 120, 32, $fontface.to_s, 2.9)
  4882. end
  4883.  
  4884. end
  4885.  
  4886. #==============================================================================
  4887. # ■ Window_FontType
  4888. #==============================================================================
  4889. class Window_FontType < Window_Selectable
  4890.  
  4891. def initialize(width, commands)
  4892. super(0, 0, width, commands.size * 32 + 32)
  4893. @item_max = commands.size
  4894. @commands = commands
  4895. self.contents = Bitmap.new(width - 32, @item_max * 32)
  4896. self.contents.font.name = $fontface
  4897. self.contents.font.size = 20
  4898. refresh
  4899. self.index = 0
  4900. end
  4901.  
  4902. def refresh
  4903. self.contents.clear
  4904. for i in 0...@item_max
  4905. draw_item(i, normal_color)
  4906. end
  4907. end
  4908.  
  4909. def draw_item(index, color)
  4910. self.contents.font.color = color
  4911. rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
  4912. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  4913. self.contents.draw_text(rect, @commands[index])
  4914. end
  4915.  
  4916. def disable_item(index)
  4917. draw_item(index, disabled_color)
  4918. end
  4919.  
  4920. end
  4921.  
  4922. #==============================================================================
  4923. # ■ Window_CurrentBGM_Volume
  4924. #==============================================================================
  4925. class Window_CurrentBGM_Volume < Window_Base
  4926.  
  4927. def initialize
  4928. super(0, 0, 192, 96)
  4929. self.contents = Bitmap.new(width - 32, height - 32)
  4930. self.contents.font.name = $fontface
  4931. self.contents.font.size = 20
  4932. end
  4933.  
  4934. def refresh
  4935. self.contents.clear
  4936. self.contents.font.color = system_color
  4937. self.contents.draw_text(4, 0, 160, 32, "Current BGM Volume")
  4938. self.contents.font.color = normal_color
  4939. self.contents.draw_text(4, 32, 120, 32, $game_system.bgm_volume.to_s + "%", 2.9)
  4940. end
  4941.  
  4942. end
  4943.  
  4944. #==============================================================================
  4945. # ■ Window_BGM_Volume
  4946. #==============================================================================
  4947. class Window_BGM_Volume < Window_Selectable
  4948.  
  4949. def initialize(width, commands)
  4950. super(0, 0, width, commands.size * 32 + 32)
  4951. @item_max = commands.size
  4952. @commands = commands
  4953. self.contents = Bitmap.new(width - 32, @item_max * 32)
  4954. self.contents.font.name = $fontface
  4955. self.contents.font.size = 20
  4956. refresh
  4957. self.index = 0
  4958. end
  4959.  
  4960. def refresh
  4961. self.contents.clear
  4962. self.contents.font.name = $fontface
  4963. self.contents.font.size = 20
  4964. for i in 0...@item_max
  4965. draw_item(i, normal_color)
  4966. end
  4967. end
  4968.  
  4969. def draw_item(index, color)
  4970. self.contents.font.color = color
  4971. rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
  4972. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  4973. self.contents.draw_text(rect, @commands[index])
  4974. end
  4975.  
  4976. def disable_item(index)
  4977. draw_item(index, disabled_color)
  4978. end
  4979.  
  4980. end
  4981.  
  4982. #==============================================================================
  4983. # ■ Window_CurrentSFX_Volume
  4984. #==============================================================================
  4985. class Window_CurrentSFX_Volume < Window_Base
  4986.  
  4987. def initialize
  4988. super(0, 0, 192, 96)
  4989. self.contents = Bitmap.new(width - 32, height - 32)
  4990. self.contents.font.name = $fontface
  4991. self.contents.font.size = 20
  4992. end
  4993.  
  4994. def refresh
  4995. self.contents.clear
  4996. self.contents.font.color = system_color
  4997. self.contents.draw_text(4, 0, 160, 32, "Current SFX Volume")
  4998. self.contents.font.color = normal_color
  4999. self.contents.draw_text(4, 32, 120, 32, $game_system.se_volume.to_s + "%", 2.9)
  5000. end
  5001.  
  5002. end
  5003.  
  5004. #==============================================================================
  5005. # ■ Window_SFX_Volume
  5006. #==============================================================================
  5007. class Window_SFX_Volume < Window_Selectable
  5008.  
  5009. def initialize(width, commands)
  5010. super(0, 0, width, commands.size * 32 + 32)
  5011. @item_max = commands.size
  5012. @commands = commands
  5013. self.contents = Bitmap.new(width - 32, @item_max * 32)
  5014. self.contents.font.name = $fontface
  5015. self.contents.font.size = 20
  5016. refresh
  5017. self.index = 0
  5018. end
  5019.  
  5020. def refresh
  5021. self.contents.clear
  5022. self.contents.font.name = $fontface
  5023. self.contents.font.size = 20
  5024. for i in 0...@item_max
  5025. draw_item(i, normal_color)
  5026. end
  5027. end
  5028.  
  5029. def draw_item(index, color)
  5030. self.contents.font.color = color
  5031. rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
  5032. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  5033. self.contents.draw_text(rect, @commands[index])
  5034. end
  5035.  
  5036. def disable_item(index)
  5037. draw_item(index, disabled_color)
  5038. end
  5039.  
  5040. end
  5041.  
  5042.  
  5043. #==============================================================================
  5044. # ■ Window_NewCommand
  5045. #==============================================================================
  5046.  
  5047. class Window_NewCommand < Window_Selectable
  5048.  
  5049. def initialize(width, commands)
  5050. super(0, 0, width, commands.size * 32 + 32)
  5051. @item_max = commands.size
  5052. @commands = commands
  5053. self.contents = Bitmap.new(width - 32, @item_max * 32)
  5054. self.contents.font.name = $fontface
  5055. self.contents.font.size = 20
  5056. refresh
  5057. self.index = 0
  5058. end
  5059.  
  5060. def refresh
  5061. self.contents.clear
  5062. for i in 0...@item_max
  5063. draw_item(i, normal_color)
  5064. end
  5065. end
  5066.  
  5067. def draw_item(index, color)
  5068. self.contents.font.color = color
  5069. rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
  5070. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  5071. self.contents.draw_text(rect, @commands[index])
  5072. end
  5073.  
  5074. def disable_item(index)
  5075. draw_item(index, disabled_color)
  5076. end
  5077.  
  5078. end
  5079.  
  5080. #==============================================================================
  5081. # ■ Scene_Menu
  5082. #==============================================================================
  5083.  
  5084. class Scene_Menu
  5085.  
  5086. def initialize(menu_index = 0, actor_index = 0, equip_index = 0, min_size = 1, max_size = 4)
  5087. @menu_index = menu_index
  5088. @actor_index = actor_index
  5089. @equip_index = equip_index
  5090. @min_size = [[min_size, 1].max, 4].min
  5091. @max_size = [[max_size, @min_size].max, 4].min
  5092. end
  5093.  
  5094. def main
  5095. $game_temp.enemy_book_data = Data_MonsterBook.new
  5096. @actor = $game_party.actors[@actor_index]
  5097. @spriteset = Spriteset_Map.new
  5098. s1 = " " + $data_system.words.item
  5099. s2 = " " + $data_system.words.skill
  5100. s3 = " " + $data_system.words.equip
  5101. s4 = " " + "Status"
  5102. s5 = " " + $data_system.words.gold
  5103. s6 = " " + "Time"
  5104. s7 = " " + "Location"
  5105. s8 = " " + "Options"
  5106. s9 = " " + "Party"
  5107. s10 = " " + "Bestiary"
  5108. s11 = " " + "Load"
  5109. s12 = " " + "Save"
  5110. s13 = " " + "Exit"
  5111.  
  5112. u1 = " " + "Basic"
  5113. u2 = " " + "Weapons"
  5114. u3 = " " + "Armor"
  5115. u4 = " " + "Accessory"
  5116. u5 = " " + "Quest"
  5117.  
  5118. v1 = " " + "Window Skin"
  5119. v2 = " " + "Font Type"
  5120. v3 = " " + "BGM Volume"
  5121. v4 = " " + "SFX Volume"
  5122.  
  5123. r1 = ""
  5124. r2 = ""
  5125. r3 = ""
  5126. r4 = ""
  5127. r5 = ""
  5128. r6 = ""
  5129. r7 = ""
  5130. r8 = ""
  5131.  
  5132. f1 = "Arial"
  5133. f2 = "Bookman Old Style"
  5134. f3 = "Comic Sans MS"
  5135. f4 = "Mistral"
  5136. f5 = "Papyrus"
  5137. f6 = "Tahoma"
  5138. f7 = "Times New Roman"
  5139.  
  5140. b1 = "0%"
  5141. b2 = "17%"
  5142. b3 = "34%"
  5143. b4 = "50%"
  5144. b5 = "67%"
  5145. b6 = "84%"
  5146. b7 = "100%"
  5147.  
  5148. m1 = "0%"
  5149. m2 = "17%"
  5150. m3 = "34%"
  5151. m4 = "50%"
  5152. m5 = "67%"
  5153. m6 = "84%"
  5154. m7 = "100%"
  5155.  
  5156. e1 = "To Title"
  5157. e2 = "Shutdown"
  5158. e3 = "Cancel"
  5159.  
  5160. @command_window = Window_MenuCommand.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13])
  5161. @command_window.index = @menu_index
  5162. @command_window.x = 640
  5163. @command_window.y = 32
  5164. @command_window.z = 999
  5165. if $game_party.actors.size == 0
  5166. @command_window.disable_item(0)
  5167. @command_window.disable_item(1)
  5168. @command_window.disable_item(2)
  5169. @command_window.disable_item(3)
  5170. end
  5171. if $game_system.save_disabled
  5172. @command_window.disable_item(11)
  5173. end
  5174. @item_command_window = Window_ItemMenuCommand.new(192, [u1, u2, u3, u4, u5])
  5175. @item_command_window.active = false
  5176. @item_command_window.x = -192
  5177. @item_command_window.y = 32
  5178. @item_command_window.z = 1999
  5179. @status_window = Window_NewMenuStatus.new
  5180. @status_window.active = false
  5181. @status_window.x = -432
  5182. @status_window.y = 64
  5183. @help_window = Window_NewHelp.new
  5184. @help_window.active = false
  5185. @help_window.x = 48
  5186. @help_window.y = -352
  5187. @help_window.z = 2999
  5188. @basic_item_window = Window_Basic_Item.new
  5189. @basic_item_window.active = false
  5190. @basic_item_window.x = 240
  5191. @basic_item_window.y = 480
  5192. @basic_item_window.z = 2999
  5193. @basic_item_window.help_window = @help_window
  5194. @target_window = Window_NewTarget.new
  5195. @target_window.active = false
  5196. @target_window.visible = false
  5197. @target_window.x = 48
  5198. @target_window.y = 480
  5199. @target_window.z = 2999
  5200. @weapons_window = Window_Weapons.new
  5201. @weapons_window.active = false
  5202. @weapons_window.x = 400
  5203. @weapons_window.y = 480
  5204. @weapons_window.z = 1999
  5205. @weapons_window.help_window = @help_window
  5206. @weapon_stats_window = Window_Weapon_Stats.new
  5207. @weapon_stats_window.active = false
  5208. @weapon_stats_window.x = 48
  5209. @weapon_stats_window.y = 480
  5210. @weapon_stats_window.z = 2999
  5211. @armor_window = Window_Armor.new
  5212. @armor_window.active = false
  5213. @armor_window.x = 400
  5214. @armor_window.y = 480
  5215. @armor_window.z = 1999
  5216. @armor_window.help_window = @help_window
  5217. @armor_stats_window = Window_Armor_Stats.new
  5218. @armor_stats_window.active = false
  5219. @armor_stats_window.x = 48
  5220. @armor_stats_window.y = 480
  5221. @armor_stats_window.z = 2999
  5222. @accessory_window = Window_Accessory.new
  5223. @accessory_window.active = false
  5224. @accessory_window.x = 400
  5225. @accessory_window.y = 480
  5226. @accessory_window.z = 1999
  5227. @accessory_window.help_window = @help_window
  5228. @accessory_stats_window = Window_Accessory_Stats.new
  5229. @accessory_stats_window.active = false
  5230. @accessory_stats_window.x = 48
  5231. @accessory_stats_window.y = 480
  5232. @accessory_stats_window.z = 2999
  5233. @quest_item_window = Window_Quest_Item.new
  5234. @quest_item_window.active = false
  5235. @quest_item_window.x = 48
  5236. @quest_item_window.y = 480
  5237. @quest_item_window.z = 2999
  5238. @quest_item_window.help_window = @help_window
  5239. @skill_window = Window_NewSkill.new(@actor)
  5240. @skill_window.active = false
  5241. @skill_window.x = 240
  5242. @skill_window.y = 480
  5243. @skill_window.z = 2999
  5244. @skill_window.help_window = @help_window
  5245. @skilltarget_window = Window_NewTarget.new
  5246. @skilltarget_window.active = false
  5247. @skilltarget_window.visible = false
  5248. @skilltarget_window.x = 48
  5249. @skilltarget_window.y = 480
  5250. @skilltarget_window.z = 2999
  5251. @left_window = Window_NewEquipLeft.new(@actor)
  5252. @left_window.active = false
  5253. @left_window.x = -352
  5254. @left_window.y = 96
  5255. @left_window.z = 2999
  5256. @right_window = Window_NewEquipRight.new(@actor)
  5257. @right_window.help_window = @help_window
  5258. @right_window.active = false
  5259. @right_window.x = 688
  5260. @right_window.y = 96
  5261. @right_window.z = 2999
  5262. @right_window.index = @equip_index
  5263. @item_window1 = Window_NewEquipItem.new(@actor, 0)
  5264. @item_window1.help_window = @help_window
  5265. @item_window1.visible = false
  5266. @item_window1.active = false
  5267. @item_window1.x = 304
  5268. @item_window1.y = 672
  5269. @item_window1.z = 2999
  5270. @item_window2 = Window_NewEquipItem.new(@actor, 1)
  5271. @item_window2.help_window = @help_window
  5272. @item_window2.visible = false
  5273. @item_window2.active = false
  5274. @item_window2.x = 304
  5275. @item_window2.y = 672
  5276. @item_window2.z = 2999
  5277. @item_window3 = Window_NewEquipItem.new(@actor, 2)
  5278. @item_window3.help_window = @help_window
  5279. @item_window3.visible = false
  5280. @item_window3.active = false
  5281. @item_window3.x = 304
  5282. @item_window3.y = 672
  5283. @item_window3.z = 2999
  5284. @item_window4 = Window_NewEquipItem.new(@actor, 3)
  5285. @item_window4.help_window = @help_window
  5286. @item_window4.visible = false
  5287. @item_window4.active = false
  5288. @item_window4.x = 304
  5289. @item_window4.y = 672
  5290. @item_window4.z = 2999
  5291. @item_window5 = Window_NewEquipItem.new(@actor, 4)
  5292. @item_window5.help_window = @help_window
  5293. @item_window5.visible = false
  5294. @item_window5.active = false
  5295. @item_window5.x = 304
  5296. @item_window5.y = 672
  5297. @item_window5.z = 2999
  5298. @playerstatus_window = Window_NewStatus.new(@actor)
  5299. @playerstatus_window.active= false
  5300. @playerstatus_window.x = 640
  5301. @playerstatus_window.y = 32
  5302. @playerstatus_window.z = 1999
  5303. @gold_window = Window_NewGold.new
  5304. @gold_window.active = false
  5305. @gold_window.x = -160
  5306. @gold_window.y = 160
  5307. @gold_window.z = 1999
  5308. @time_window = Window_NewTime.new
  5309. @time_window.active = false
  5310. @time_window.x = -160
  5311. @time_window.y = 192
  5312. @time_window.z = 1999
  5313. @location_window = Window_NewLocation.new
  5314. @location_window.active = false
  5315. @location_window.x = -160
  5316. @location_window.y = 224
  5317. @location_window.z = 1999
  5318. @option_command_window = Window_OptionMenuCommand.new(192, [v1, v2, v3, v4])
  5319. @option_command_window.active = false
  5320. @option_command_window.x = -208
  5321. @option_command_window.y = 256
  5322. @option_command_window.z = 1999
  5323. @windowskin_window = Window_WindowSkin.new(64, [r1, r2, r3, r4, r5, r6, r7])
  5324. @windowskin_window.active = false
  5325. @windowskin_window.x = -80
  5326. @windowskin_window.y = 160
  5327. @windowskin_window.z = 2999
  5328. @currentwindowskin_window = Window_CurrentWindowSkin.new
  5329. @currentwindowskin_window.active = false
  5330. @currentwindowskin_window.x = 208
  5331. @currentwindowskin_window.y = -288
  5332. @currentwindowskin_window.z = 1999
  5333. @fonttype_window = Window_FontType.new(192, [f1, f2, f3, f4, f5, f6, f7])
  5334. @fonttype_window.active = false
  5335. @fonttype_window.x = -208
  5336. @fonttype_window.y = 160
  5337. @fonttype_window.z = 2999
  5338. @currentfonttype_window = Window_CurrentFontType.new
  5339. @currentfonttype_window.active = false
  5340. @currentfonttype_window.x = 208
  5341. @currentfonttype_window.y = -416
  5342. @currentfonttype_window.z = 1999
  5343. @bgm_window = Window_BGM_Volume.new(80, [b1, b2, b3, b4, b5, b6, b7])
  5344. @bgm_window.active = false
  5345. @bgm_window.x = -208
  5346. @bgm_window.y = 160
  5347. @bgm_window.z = 2999
  5348. @currentbgm_window = Window_CurrentBGM_Volume.new
  5349. @currentbgm_window.active = false
  5350. @currentbgm_window.x = 208
  5351. @currentbgm_window.y = -416
  5352. @currentbgm_window.z = 1999
  5353. @sfx_window = Window_SFX_Volume.new(80, [m1, m2, m3, m4, m5, m6, m7])
  5354. @sfx_window.active = false
  5355. @sfx_window.x = -208
  5356. @sfx_window.y = 160
  5357. @sfx_window.z = 2999
  5358. @currentsfx_window = Window_CurrentSFX_Volume.new
  5359. @currentsfx_window.active = false
  5360. @currentsfx_window.x = 208
  5361. @currentsfx_window.y = -416
  5362. @currentsfx_window.z = 1999
  5363. @party_window = Window_SwitchParty.new
  5364. @party_window.active = false
  5365. @party_window.x = -352
  5366. @party_window.y = 32
  5367. @party_window.z = 2999
  5368. @reserve_window = Window_SwitchReserve.new(20)
  5369. @reserve_window.active = false
  5370. @reserve_window.visible = false
  5371. @reserve_window.x = 256
  5372. @reserve_window.y = 544
  5373. @reserve_window.z = 2999
  5374. @switchstatus_window = Window_SwitchStatus.new
  5375. @switchstatus_window.active = false
  5376. @switchstatus_window.x = 640
  5377. @switchstatus_window.y = 32
  5378. @switchstatus_window.z = 2999
  5379. if $game_party.actors.size == 0
  5380. @party_window.active = false
  5381. else
  5382. @reserve_window.active = false
  5383. end
  5384. @party_window.help_window = @switchstatus_window
  5385. @reserve_window.help_window = @switchstatus_window
  5386. @title_window = Window_Base.new(-576, 32, 576, 64)
  5387. @title_window.contents = Bitmap.new(576 - 32, 64 - 32)
  5388. @title_window.contents.font.name = $fontface
  5389. @title_window.contents.font.size = 20
  5390. @title_window.contents.draw_text(4, 0, 320, 32, "Bestiary", 0)
  5391. e_now = $game_party.enemy_book_now
  5392. e_max = $game_party.enemy_book_max
  5393. comp = $game_party.enemy_book_complete_percentage
  5394. text = e_now.to_s + " / " + e_max.to_s + " " + comp.to_s + " %"
  5395. @title_window.contents.draw_text(256, 0, 288, 32, text, 2)
  5396. @title_window.active = false
  5397. @title_window.z = 2999
  5398. @main_window = Window_MonsterBook.new
  5399. @main_window.active = false
  5400. @main_window.x = 640
  5401. @main_window.y = 96
  5402. @main_window.z = 2999
  5403. @info_window = Window_MonsterBook_Info.new
  5404. @info_window.active = false
  5405. @info_window.visible = false
  5406. @info_window.x = 640
  5407. @info_window.y = 96
  5408. @info_window.z = 3999
  5409. @end_window = Window_NewCommand.new(128, [e1, e2, e3])
  5410. @end_window.active = false
  5411. @end_window.x = -192
  5412. @end_window.y = 352
  5413. @end_window.z = 1999
  5414. Graphics.transition
  5415. loop do
  5416. Graphics.update
  5417. Input.update
  5418. update
  5419. if $scene != self
  5420. break
  5421. end
  5422. end
  5423. @spriteset.dispose
  5424. @command_window.dispose
  5425. @item_command_window.dispose
  5426. @status_window.dispose
  5427. @help_window.dispose
  5428. @basic_item_window.dispose
  5429. @target_window.dispose
  5430. @weapons_window.dispose
  5431. @weapon_stats_window.dispose
  5432. @armor_window.dispose
  5433. @armor_stats_window.dispose
  5434. @accessory_window.dispose
  5435. @accessory_stats_window.dispose
  5436. @quest_item_window.dispose
  5437. @skill_window.dispose
  5438. @skilltarget_window.dispose
  5439. @left_window.dispose
  5440. @right_window.dispose
  5441. @item_window1.dispose
  5442. @item_window2.dispose
  5443. @item_window3.dispose
  5444. @item_window4.dispose
  5445. @item_window5.dispose
  5446. @playerstatus_window.dispose
  5447. @gold_window.dispose
  5448. @time_window.dispose
  5449. @location_window.dispose
  5450. @option_command_window.dispose
  5451. @windowskin_window.dispose
  5452. @currentwindowskin_window.dispose
  5453. @fonttype_window.dispose
  5454. @currentfonttype_window.dispose
  5455. @bgm_window.dispose
  5456. @currentbgm_window.dispose
  5457. @sfx_window.dispose
  5458. @currentsfx_window.dispose
  5459. @switchstatus_window.dispose
  5460. @reserve_window.dispose
  5461. @party_window.dispose
  5462. @main_window.dispose
  5463. @info_window.dispose
  5464. @title_window.dispose
  5465. @end_window.dispose
  5466. end
  5467.  
  5468. def equip_refresh
  5469. @item_window1.visible = (@right_window.index == 0)
  5470. @item_window2.visible = (@right_window.index == 1)
  5471. @item_window3.visible = (@right_window.index == 2)
  5472. @item_window4.visible = (@right_window.index == 3)
  5473. @item_window5.visible = (@right_window.index == 4)
  5474. item1 = @right_window.item
  5475. case @right_window.index
  5476. when 0
  5477. @item_window = @item_window1
  5478. newmode = 0
  5479. when 1
  5480. @item_window = @item_window2
  5481. newmode = 1
  5482. when 2
  5483. @item_window = @item_window3
  5484. newmode = 1
  5485. when 3
  5486. @item_window = @item_window4
  5487. newmode = 1
  5488. when 4
  5489. @item_window = @item_window5
  5490. newmode = 1
  5491. end
  5492. if newmode != @left_window.mode
  5493. @left_window.mode = newmode
  5494. @left_window.refresh
  5495. end
  5496. if @right_window.active
  5497. @left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil,"", "")
  5498. end
  5499. if @item_window.active
  5500. item2 = @item_window.item
  5501. last_hp = @actor.hp
  5502. last_sp = @actor.sp
  5503. old_atk = @actor.atk
  5504. old_pdef = @actor.pdef
  5505. old_mdef = @actor.mdef
  5506. old_str = @actor.str
  5507. old_dex = @actor.dex
  5508. old_agi = @actor.agi
  5509. old_int = @actor.int
  5510. old_eva = @actor.eva
  5511. @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
  5512. new_atk = @actor.atk
  5513. new_pdef = @actor.pdef
  5514. new_mdef = @actor.mdef
  5515. new_str = @actor.str
  5516. new_dex = @actor.dex
  5517. new_agi = @actor.agi
  5518. new_int = @actor.int
  5519. new_eva = @actor.eva
  5520. @left_window.changes = [0, 0, 0, 0, 0, 0, 0, 0]
  5521. if new_atk > old_atk
  5522. @left_window.changes[0] = 1
  5523. end
  5524. if new_atk < old_atk
  5525. @left_window.changes[0] = -1
  5526. end
  5527. if new_pdef > old_pdef
  5528. @left_window.changes[1] = 1
  5529. end
  5530. if new_pdef < old_pdef
  5531. @left_window.changes[1] = -1
  5532. end
  5533. if new_mdef > old_mdef
  5534. @left_window.changes[2] = 1
  5535. end
  5536. if new_mdef < old_mdef
  5537. @left_window.changes[2] = -1
  5538. end
  5539. if new_str > old_str
  5540. @left_window.changes[3] = 1
  5541. end
  5542. if new_str < old_str
  5543. @left_window.changes[3] = -1
  5544. end
  5545. if new_dex > old_dex
  5546. @left_window.changes[4] = 1
  5547. end
  5548. if new_dex < old_dex
  5549. @left_window.changes[4] = -1
  5550. end
  5551. if new_agi > old_agi
  5552. @left_window.changes[5] = 1
  5553. end
  5554. if new_agi < old_agi
  5555. @left_window.changes[5] = -1
  5556. end
  5557. if new_int > old_int
  5558. @left_window.changes[6] = 1
  5559. end
  5560. if new_int < old_int
  5561. @left_window.changes[6] = -1
  5562. end
  5563. if new_eva > old_eva
  5564. @left_window.changes[7] = 1
  5565. end
  5566. if new_eva < old_eva
  5567. @left_window.changes[7] = -1
  5568. end
  5569. elem_text = make_elem_text(item2)
  5570. stat_text = make_stat_text(item2)
  5571. @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
  5572. @actor.hp = last_hp
  5573. @actor.sp = last_sp
  5574. @left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_str,
  5575. new_dex, new_agi, new_int, new_eva, elem_text, stat_text)
  5576. end
  5577. end
  5578.  
  5579. def make_elem_text(item)
  5580. text = ""
  5581. flag = false
  5582. if item.is_a?(RPG::Weapon)
  5583. for i in item.element_set
  5584. if flag
  5585. text += ", "
  5586. end
  5587. text += $data_system.elements[i]
  5588. flag = true
  5589. end
  5590. end
  5591. if item.is_a?(RPG::Armor)
  5592. for i in item.guard_element_set
  5593. if flag
  5594. text += ", "
  5595. end
  5596. text += $data_system.elements[i]
  5597. flag = true
  5598. end
  5599. end
  5600. return text
  5601. end
  5602.  
  5603. def make_stat_text(item)
  5604. text = ""
  5605. flag = false
  5606. if item.is_a?(RPG::Weapon)
  5607. for i in item.plus_state_set
  5608. if flag
  5609. text += ", "
  5610. end
  5611. text += $data_states[i].name
  5612. flag = true
  5613. end
  5614. end
  5615. if item.is_a?(RPG::Armor)
  5616. for i in item.guard_state_set
  5617. if flag
  5618. text += ", "
  5619. end
  5620. text += $data_states[i].name
  5621. flag = true
  5622. end
  5623. end
  5624. return text
  5625. end
  5626.  
  5627. def update
  5628. @command_window.update
  5629. @item_command_window.update
  5630. @status_window.update
  5631. @help_window.update
  5632. @basic_item_window.update
  5633. @target_window.update
  5634. @weapons_window.update
  5635. @weapon_stats_window.update
  5636. @armor_window.update
  5637. @armor_stats_window.update
  5638. @accessory_window.update
  5639. @accessory_stats_window.update
  5640. @quest_item_window.update
  5641. @skill_window.update
  5642. @skilltarget_window.update
  5643. @left_window.update
  5644. @right_window.update
  5645. @playerstatus_window.update
  5646. @gold_window.update
  5647. @time_window.update
  5648. @location_window.update
  5649. @option_command_window.update
  5650. @windowskin_window.update
  5651. @currentwindowskin_window.update
  5652. @fonttype_window.update
  5653. @currentfonttype_window.update
  5654. @bgm_window.update
  5655. @currentbgm_window.update
  5656. @sfx_window.update
  5657. @currentsfx_window.update
  5658. @party_window.update
  5659. @reserve_window.update
  5660. @switchstatus_window.update
  5661. @main_window.update
  5662. @info_window.update
  5663. @end_window.update
  5664.  
  5665. if @command_window.x > 48
  5666. @command_window.x -= 16
  5667. end
  5668. if @item_command_window.active
  5669. if @item_command_window.x < 208
  5670. @item_command_window.x += 16
  5671. end
  5672. end
  5673. if @status_window.x < 160
  5674. @status_window.x += 16
  5675. end
  5676. if @help_window.active
  5677. if @help_window.y < 32
  5678. @help_window.y += 16
  5679. end
  5680. end
  5681. if @basic_item_window.active
  5682. if @basic_item_window.y > 96
  5683. @basic_item_window.y -= 16
  5684. end
  5685. end
  5686. if @target_window.visible
  5687. if @target_window.y > 96
  5688. @target_window.y -= 16
  5689. end
  5690. end
  5691. if @weapons_window.active
  5692. if @weapons_window.y > 96
  5693. @weapons_window.y -= 16
  5694. end
  5695. end
  5696. if @weapon_stats_window.active
  5697. if @weapon_stats_window.y > 96
  5698. @weapon_stats_window.y -= 16
  5699. end
  5700. end
  5701. if @armor_window.active
  5702. if @armor_window.y > 96
  5703. @armor_window.y -= 16
  5704. end
  5705. end
  5706. if @armor_stats_window.active
  5707. if @armor_stats_window.y > 96
  5708. @armor_stats_window.y -= 16
  5709. end
  5710. end
  5711. if @accessory_window.active
  5712. if @accessory_window.y > 96
  5713. @accessory_window.y -= 16
  5714. end
  5715. end
  5716. if @accessory_stats_window.active
  5717. if @accessory_stats_window.y > 96
  5718. @accessory_stats_window.y -= 16
  5719. end
  5720. end
  5721. if @quest_item_window.active
  5722. if @quest_item_window.y > 96
  5723. @quest_item_window.y -= 16
  5724. end
  5725. end
  5726. if @skill_window.active
  5727. if @skill_window.y > 96
  5728. @skill_window.y -= 16
  5729. end
  5730. end
  5731. if @skilltarget_window.visible
  5732. if @skilltarget_window.y > 96
  5733. @skilltarget_window.y -= 16
  5734. end
  5735. end
  5736. if @item_window != nil
  5737. if @item_window.visible
  5738. equip_refresh
  5739. @item_window.update
  5740. @item_window2.y = 288
  5741. @item_window3.y = 288
  5742. @item_window4.y = 288
  5743. @item_window5.y = 288
  5744. end
  5745. end
  5746. if @item_window1.visible
  5747. if @item_window1.y > 288
  5748. @item_window1.y -= 16
  5749. end
  5750. end
  5751. if @left_window.active
  5752. if @left_window.x < 32
  5753. @left_window.x += 16
  5754. end
  5755. end
  5756. if @right_window.active
  5757. if @right_window.x > 304
  5758. @right_window.x -= 16
  5759. end
  5760. end
  5761. if @playerstatus_window.active
  5762. if @playerstatus_window.x > 32
  5763. @playerstatus_window.x -= 16
  5764. end
  5765. end
  5766. if @gold_window.active
  5767. if @gold_window.x < 198
  5768. @gold_window.x += 16
  5769. end
  5770. end
  5771. if @time_window.active
  5772. if @time_window.x < 198
  5773. @time_window.x += 16
  5774. end
  5775. end
  5776. if @location_window.active
  5777. if @location_window.x < 198
  5778. @location_window.x += 16
  5779. end
  5780. end
  5781. if @option_command_window.active
  5782. if @option_command_window.x < 208
  5783. @option_command_window.x += 16
  5784. end
  5785. end
  5786. if @windowskin_window.active
  5787. if @windowskin_window.x < 400
  5788. @windowskin_window.x += 16
  5789. end
  5790. end
  5791. if @currentwindowskin_window.active
  5792. if @currentwindowskin_window.y < 152
  5793. @currentwindowskin_window.y += 16
  5794. end
  5795. end
  5796. if @fonttype_window.active
  5797. if @fonttype_window.x < 400
  5798. @fonttype_window.x += 16
  5799. end
  5800. end
  5801. if @currentfonttype_window.active
  5802. if @currentfonttype_window.y < 160
  5803. @currentfonttype_window.y += 16
  5804. end
  5805. end
  5806. if @bgm_window.active
  5807. if @bgm_window.x < 400
  5808. @bgm_window.x += 16
  5809. end
  5810. end
  5811. if @currentbgm_window.active
  5812. if @currentbgm_window.y < 160
  5813. @currentbgm_window.y += 16
  5814. end
  5815. end
  5816. if @sfx_window.active
  5817. if @sfx_window.x < 400
  5818. @sfx_window.x += 16
  5819. end
  5820. end
  5821. if @currentsfx_window.active
  5822. if @currentsfx_window.y < 160
  5823. @currentsfx_window.y += 16
  5824. end
  5825. end
  5826. if @title_window.active
  5827. if @title_window.x < 32
  5828. @title_window.x += 16
  5829. end
  5830. end
  5831. if @switchstatus_window.active
  5832. if @switchstatus_window.x > 256
  5833. @switchstatus_window.x -= 16
  5834. end
  5835. end
  5836. if @party_window.active
  5837. if @party_window.x < 32
  5838. @party_window.x += 16
  5839. end
  5840. end
  5841. if @reserve_window.visible
  5842. if @reserve_window.y > 160
  5843. @reserve_window.y -= 16
  5844. end
  5845. end
  5846. if @main_window.active
  5847. if @main_window.x > 32
  5848. @main_window.x -= 16
  5849. end
  5850. end
  5851. if @info_window.visible
  5852. if @info_window.x > 32
  5853. @info_window.x -= 16
  5854. end
  5855. end
  5856. if @end_window.active
  5857. if @end_window.x < 208
  5858. @end_window.x += 16
  5859. end
  5860. end
  5861.  
  5862. if @command_window.active
  5863. update_command
  5864. return
  5865. end
  5866. if @item_command_window.active
  5867. update_item_command
  5868. return
  5869. end
  5870. if @status_window.active
  5871. update_status
  5872. return
  5873. end
  5874. if @basic_item_window.active
  5875. update_item
  5876. return
  5877. end
  5878. if @target_window.active
  5879. update_target
  5880. return
  5881. end
  5882. if @weapons_window.active
  5883. update_weapons
  5884. return
  5885. end
  5886. if @armor_window.active
  5887. update_armor
  5888. return
  5889. end
  5890. if @accessory_window.active
  5891. update_accessory
  5892. return
  5893. end
  5894. if @quest_item_window.active
  5895. update_quest_item
  5896. return
  5897. end
  5898. if @skill_window.active
  5899. update_skill
  5900. return
  5901. end
  5902. if @skilltarget_window.active
  5903. update_skilltarget
  5904. return
  5905. end
  5906. if @right_window.active
  5907. update_right_equip
  5908. return
  5909. end
  5910. if @item_window != nil
  5911. if @item_window.active
  5912. update_eitem
  5913. return
  5914. end
  5915. end
  5916. if @playerstatus_window.active
  5917. update_playerstatus
  5918. return
  5919. end
  5920. if @gold_window.active
  5921. update_gold
  5922. return
  5923. end
  5924. if @time_window.active
  5925. update_time
  5926. return
  5927. end
  5928. if @location_window.active
  5929. update_location
  5930. return
  5931. end
  5932. if @option_command_window.active
  5933. update_option_command
  5934. return
  5935. end
  5936. if @windowskin_window.active
  5937. update_windowskin
  5938. return
  5939. end
  5940. if @fonttype_window.active
  5941. update_fonttype
  5942. return
  5943. end
  5944. if @bgm_window.active
  5945. update_bgm
  5946. return
  5947. end
  5948. if @sfx_window.active
  5949. update_sfx
  5950. return
  5951. end
  5952. if @info_window.active
  5953. update_info
  5954. return
  5955. end
  5956. if @party_window.active
  5957. update_party
  5958. return
  5959. end
  5960. if @reserve_window.active
  5961. update_reserve
  5962. return
  5963. end
  5964. if @main_window.active
  5965. update_main
  5966. return
  5967. end
  5968. if @end_window.active
  5969. update_end
  5970. return
  5971. end
  5972. end
  5973.  
  5974. def delay(seconds)
  5975. for i in 0...(seconds * 1)
  5976. sleep 0.01
  5977. Graphics.update
  5978. end
  5979. end
  5980.  
  5981. def update_command
  5982. if Input.trigger?(Input::B)
  5983. $game_system.se_play($data_system.cancel_se)
  5984. $scene = Scene_Map.new
  5985. return
  5986. end
  5987. if Input.trigger?(Input::C)
  5988. if $game_party.actors.size == 0 and @command_window.index < 4
  5989. $game_system.se_play($data_system.buzzer_se)
  5990. return
  5991. end
  5992. case @command_window.index
  5993. when 0
  5994. $game_system.se_play($data_system.decision_se)
  5995. @item_command_window.active = true
  5996. @command_window.active = false
  5997. when 1
  5998. $game_system.se_play($data_system.decision_se)
  5999. @command_window.active = false
  6000. @status_window.active = true
  6001. @status_window.index = 0
  6002. when 2
  6003. $game_system.se_play($data_system.decision_se)
  6004. @command_window.active = false
  6005. @status_window.active = true
  6006. @status_window.index = 0
  6007. when 3
  6008. $game_system.se_play($data_system.decision_se)
  6009. @command_window.active = false
  6010. @status_window.active = true
  6011. @status_window.index = 0
  6012. when 4
  6013. $game_system.se_play($data_system.decision_se)
  6014. @gold_window.active = true
  6015. @command_window.active = false
  6016. when 5
  6017. $game_system.se_play($data_system.decision_se)
  6018. @time_window.active = true
  6019. @command_window.active = false
  6020. when 6
  6021. $game_system.se_play($data_system.decision_se)
  6022. @location_window.active = true
  6023. @command_window.active = false
  6024. when 7
  6025. $game_system.se_play($data_system.decision_se)
  6026. @option_command_window.active = true
  6027. @command_window.active = false
  6028. when 8
  6029. $game_system.se_play($data_system.decision_se)
  6030. @switchstatus_window.active = true
  6031. @party_window.active = true
  6032. @reserve_window.visible = true
  6033. @command_window.active = false
  6034. when 9
  6035. $game_system.se_play($data_system.decision_se)
  6036. @title_window.active = true
  6037. @main_window.active = true
  6038. @command_window.active = false
  6039. when 10
  6040. $game_system.se_play($data_system.decision_se)
  6041. $scene = Scene_NewLoad.new
  6042. when 11
  6043. if $game_system.save_disabled
  6044. $game_system.se_play($data_system.buzzer_se)
  6045. return
  6046. end
  6047. $game_system.se_play($data_system.decision_se)
  6048. $scene = Scene_Save.new
  6049. when 12
  6050. $game_system.se_play($data_system.decision_se)
  6051. @end_window.active = true
  6052. @command_window.active = false
  6053. end
  6054. return
  6055. end
  6056. end
  6057.  
  6058. def update_status
  6059. if Input.trigger?(Input::B)
  6060. $game_system.se_play($data_system.cancel_se)
  6061. @status_window.active = false
  6062. @command_window.active = true
  6063. @status_window.index = -1
  6064. return
  6065. end
  6066. if Input.trigger?(Input::C)
  6067. case @command_window.index
  6068. when 1
  6069. if $game_party.actors[@status_window.index].restriction >= 2
  6070. $game_system.se_play($data_system.buzzer_se)
  6071. return
  6072. end
  6073. $game_system.se_play($data_system.decision_se)
  6074. @actor = $game_party.actors[@status_window.index]
  6075. @skill_window.update_actor(@actor)
  6076. @skill_window.active = true
  6077. @skilltarget_window.visible = true
  6078. @help_window.active = true
  6079. @status_window.active = false
  6080. when 2
  6081. $game_system.se_play($data_system.decision_se)
  6082. @actor = $game_party.actors[@status_window.index]
  6083. @right_window.update_actor(@actor)
  6084. @right_window.active = true
  6085. @left_window.update_actor(@actor)
  6086. @left_window.active = true
  6087. @help_window.x = 32
  6088. @help_window.active = true
  6089. @item_window1.visible = true
  6090. @item_window2.visible = true
  6091. @item_window3.visible = true
  6092. @item_window4.visible = true
  6093. @item_window5.visible = true
  6094. @item_window1.update_actor(@actor, 0)
  6095. @item_window2.update_actor(@actor, 1)
  6096. @item_window3.update_actor(@actor, 2)
  6097. @item_window4.update_actor(@actor, 3)
  6098. @item_window5.update_actor(@actor, 4)
  6099. @status_window.active = false
  6100. equip_refresh
  6101. return
  6102. when 3
  6103. $game_system.se_play($data_system.decision_se)
  6104. @actor = $game_party.actors[@status_window.index]
  6105. @playerstatus_window.update_actor(@actor)
  6106. @playerstatus_window.active = true
  6107. @status_window.active = false
  6108. end
  6109. return
  6110. end
  6111. end
  6112.  
  6113. def update_item_command
  6114. if Input.trigger?(Input::B)
  6115. $game_system.se_play($data_system.cancel_se)
  6116. @item_command_window.active = false
  6117. @item_command_window.x = -192
  6118. @command_window.active = true
  6119. @item_command_window.index = 0
  6120. @status_window.index = -1
  6121. return
  6122. end
  6123. if Input.trigger?(Input::C)
  6124. case @item_command_window.index
  6125. when 0
  6126. $game_system.se_play($data_system.decision_se)
  6127. @item_command_window.active = false
  6128. @basic_item_window.active = true
  6129. @help_window.active = true
  6130. @target_window.visible = true
  6131. when 1
  6132. $game_system.se_play($data_system.decision_se)
  6133. @item_command_window.active = false
  6134. @weapons_window.active = true
  6135. @help_window.active = true
  6136. @weapon_stats_window.active = true
  6137. when 2
  6138. $game_system.se_play($data_system.decision_se)
  6139. @item_command_window.active = false
  6140. @armor_window.active = true
  6141. @help_window.active = true
  6142. @armor_stats_window.active = true
  6143. when 3
  6144. $game_system.se_play($data_system.decision_se)
  6145. @item_command_window.active = false
  6146. @accessory_window.active = true
  6147. @help_window.active = true
  6148. @accessory_stats_window.active = true
  6149. when 4
  6150. $game_system.se_play($data_system.decision_se)
  6151. @item_command_window.active = false
  6152. @quest_item_window.active = true
  6153. @help_window.active = true
  6154. end
  6155. return
  6156. end
  6157. end
  6158.  
  6159. def update_item
  6160. if Input.trigger?(Input::B)
  6161. $game_system.se_play($data_system.cancel_se)
  6162. @basic_item_window.active = false
  6163. @basic_item_window.y = 480
  6164. @basic_item_window.index = 0
  6165. @help_window.active = false
  6166. @help_window.y = -352
  6167. @item_command_window.active = true
  6168. @target_window.visible = false
  6169. @target_window.y = 480
  6170. return
  6171. end
  6172. if Input.trigger?(Input::C)
  6173. @item = @basic_item_window.item
  6174. unless @item.is_a?(RPG::Item)
  6175. $game_system.se_play($data_system.buzzer_se)
  6176. return
  6177. end
  6178. unless $game_party.item_can_use?(@item.id)
  6179. $game_system.se_play($data_system.buzzer_se)
  6180. return
  6181. end
  6182. $game_system.se_play($data_system.decision_se)
  6183. if @item.scope >= 3
  6184. @basic_item_window.active = false
  6185. @target_window.visible = true
  6186. @target_window.active = true
  6187. if @item.scope == 4 || @item.scope == 6
  6188. @target_window.index = -1
  6189. else
  6190. @target_window.index = 0
  6191. end
  6192. else
  6193. if @item.common_event_id > 0
  6194. $game_temp.common_event_id = @item.common_event_id
  6195. $game_system.se_play(@item.menu_se)
  6196. if @item.consumable
  6197. $game_party.lose_item(@item.id, 1)
  6198. @basic_item_window.draw_item(@basic_item_window.index)
  6199. end
  6200. $scene = Scene_Map.new
  6201. return
  6202. end
  6203. end
  6204. return
  6205. end
  6206. end
  6207.  
  6208. def update_target
  6209. if Input.trigger?(Input::B)
  6210. $game_system.se_play($data_system.cancel_se)
  6211. unless $game_party.item_can_use?(@item.id)
  6212. @basic_item_window.refresh
  6213. end
  6214. @basic_item_window.active = true
  6215. @target_window.active = false
  6216. return
  6217. end
  6218. if Input.trigger?(Input::C)
  6219. if $game_party.item_number(@item.id) == 0
  6220. $game_system.se_play($data_system.buzzer_se)
  6221. return
  6222. end
  6223. if @target_window.index == -1
  6224. used = false
  6225. for i in $game_party.actors
  6226. used |= i.item_effect(@item)
  6227. end
  6228. end
  6229. if @target_window.index >= 0
  6230. target = $game_party.actors[@target_window.index]
  6231. used = target.item_effect(@item)
  6232. end
  6233. if used
  6234. $game_system.se_play(@item.menu_se)
  6235. if @item.consumable
  6236. $game_party.lose_item(@item.id, 1)
  6237. @basic_item_window.draw_item(@basic_item_window.index)
  6238. end
  6239. @target_window.refresh
  6240. @skilltarget_window.refresh
  6241. @status_window.refresh
  6242. if $game_party.all_dead?
  6243. $scene = Scene_Gameover.new
  6244. return
  6245. end
  6246. if @item.common_event_id > 0
  6247. $game_temp.common_event_id = @item.common_event_id
  6248. $scene = Scene_Map.new
  6249. return
  6250. end
  6251. end
  6252. unless used
  6253. $game_system.se_play($data_system.buzzer_se)
  6254. end
  6255. return
  6256. end
  6257. end
  6258.  
  6259. def update_weapons
  6260. @weapon_stats_window.item = @weapons_window.item
  6261. if Input.trigger?(Input::B)
  6262. $game_system.se_play($data_system.cancel_se)
  6263. @weapons_window.active = false
  6264. @weapons_window.y = 480
  6265. @weapons_window.index = 0
  6266. @help_window.active = false
  6267. @help_window.y = -352
  6268. @item_command_window.active = true
  6269. @weapon_stats_window.active = false
  6270. @weapon_stats_window.y = 480
  6271. @weapon_stats_window.item = nil
  6272. return
  6273. end
  6274. if Input.trigger?(Input::C)
  6275. @item = @weapons_window.item
  6276. unless @item.is_a?(RPG::Item)
  6277. $game_system.se_play($data_system.buzzer_se)
  6278. return
  6279. end
  6280. unless $game_party.item_can_use?(@item.id)
  6281. $game_system.se_play($data_system.buzzer_se)
  6282. return
  6283. end
  6284. $game_system.se_play($data_system.decision_se)
  6285. return
  6286. end
  6287. end
  6288.  
  6289. def update_armor
  6290. @armor_stats_window.item = @armor_window.item
  6291. if Input.trigger?(Input::B)
  6292. $game_system.se_play($data_system.cancel_se)
  6293. @armor_window.active = false
  6294. @armor_window.y = 480
  6295. @armor_window.index = 0
  6296. @help_window.active = false
  6297. @help_window.y = -352
  6298. @item_command_window.active = true
  6299. @armor_stats_window.active = false
  6300. @armor_stats_window.y = 480
  6301. @armor_stats_window.item = nil
  6302. return
  6303. end
  6304. if Input.trigger?(Input::C)
  6305. @item = @armor_window.item
  6306. unless @item.is_a?(RPG::Item)
  6307. $game_system.se_play($data_system.buzzer_se)
  6308. return
  6309. end
  6310. unless $game_party.item_can_use?(@item.id)
  6311. $game_system.se_play($data_system.buzzer_se)
  6312. return
  6313. end
  6314. $game_system.se_play($data_system.decision_se)
  6315. return
  6316. end
  6317. end
  6318.  
  6319. def update_accessory
  6320. @accessory_stats_window.item = @accessory_window.item
  6321. if Input.trigger?(Input::B)
  6322. $game_system.se_play($data_system.cancel_se)
  6323. @accessory_window.active = false
  6324. @accessory_window.y = 480
  6325. @accessory_window.index = 0
  6326. @help_window.active = false
  6327. @help_window.y = -352
  6328. @item_command_window.active = true
  6329. @accessory_stats_window.active = false
  6330. @accessory_stats_window.y = 480
  6331. @accessory_stats_window.item = nil
  6332. return
  6333. end
  6334. if Input.trigger?(Input::C)
  6335. @item = @accessory_window.item
  6336. unless @item.is_a?(RPG::Item)
  6337. $game_system.se_play($data_system.buzzer_se)
  6338. return
  6339. end
  6340. unless $game_party.item_can_use?(@item.id)
  6341. $game_system.se_play($data_system.buzzer_se)
  6342. return
  6343. end
  6344. $game_system.se_play($data_system.decision_se)
  6345. return
  6346. end
  6347. end
  6348.  
  6349. def update_quest_item
  6350. if Input.trigger?(Input::B)
  6351. $game_system.se_play($data_system.cancel_se)
  6352. @quest_item_window.active = false
  6353. @quest_item_window.y = 480
  6354. @quest_item_window.index = 0
  6355. @help_window.active = false
  6356. @help_window.y = -352
  6357. @item_command_window.active = true
  6358. return
  6359. end
  6360. if Input.trigger?(Input::C)
  6361. @item = @quest_item_window.item
  6362. unless @item.is_a?(RPG::Item)
  6363. $game_system.se_play($data_system.buzzer_se)
  6364. return
  6365. end
  6366. unless $game_party.item_can_use?(@item.id)
  6367. $game_system.se_play($data_system.buzzer_se)
  6368. return
  6369. end
  6370. $game_system.se_play($data_system.decision_se)
  6371. return
  6372. end
  6373. end
  6374.  
  6375. def update_skill
  6376. if Input.trigger?(Input::B)
  6377. $game_system.se_play($data_system.cancel_se)
  6378. @skill_window.active = false
  6379. @skill_window.y = 480
  6380. @skill_window.index = 0
  6381. @skilltarget_window.visible = false
  6382. @skilltarget_window.y = 480
  6383. @help_window.active = false
  6384. @help_window.y = -352
  6385. @command_window.active = true
  6386. @status_window.index = -1
  6387. return
  6388. end
  6389. if Input.trigger?(Input::C)
  6390. @skill = @skill_window.skill
  6391. if @skill == nil or not @actor.skill_can_use?(@skill.id)
  6392. $game_system.se_play($data_system.buzzer_se)
  6393. return
  6394. end
  6395. $game_system.se_play($data_system.decision_se)
  6396. if @skill.scope >= 3
  6397. @skill_window.active = false
  6398. @skilltarget_window.visible = true
  6399. @skilltarget_window.active = true
  6400. if @skill.scope == 4 || @skill.scope == 6
  6401. @skilltarget_window.index = -1
  6402. elsif @skill.scope == 7
  6403. @skilltarget_window.index = @actor_index - 10
  6404. else
  6405. @skilltarget_window.index = 0
  6406. end
  6407. else
  6408. if @skill.common_event_id > 0
  6409. $game_temp.common_event_id = @skill.common_event_id
  6410. $game_system.se_play(@skill.menu_se)
  6411. @actor.sp -= @skill.sp_cost
  6412. @status_window.refresh
  6413. @skill_window.refresh
  6414. @skilltarget_window.refresh
  6415. $scene = Scene_Map.new
  6416. return
  6417. end
  6418. end
  6419. return
  6420. end
  6421. end
  6422.  
  6423. def update_skilltarget
  6424. if Input.trigger?(Input::B)
  6425. $game_system.se_play($data_system.cancel_se)
  6426. @skill_window.active = true
  6427. @skilltarget_window.active = false
  6428. return
  6429. end
  6430. if Input.trigger?(Input::C)
  6431. unless @actor.skill_can_use?(@skill.id)
  6432. $game_system.se_play($data_system.buzzer_se)
  6433. return
  6434. end
  6435. if @skilltarget_window.index == -1
  6436. used = false
  6437. for i in $game_party.actors
  6438. used |= i.skill_effect(@actor, @skill)
  6439. end
  6440. end
  6441. if @skilltarget_window.index <= -2
  6442. target = $game_party.actors[@skilltarget_window.index + 10]
  6443. used = target.skill_effect(@actor, @skill)
  6444. end
  6445. if @skilltarget_window.index >= 0
  6446. target = $game_party.actors[@skilltarget_window.index]
  6447. used = target.skill_effect(@actor, @skill)
  6448. end
  6449. if used
  6450. $game_system.se_play(@skill.menu_se)
  6451. @actor.sp -= @skill.sp_cost
  6452. @target_window.refresh
  6453. @status_window.refresh
  6454. @skill_window.refresh
  6455. @skilltarget_window.refresh
  6456. if $game_party.all_dead?
  6457. $scene = Scene_Gameover.new
  6458. return
  6459. end
  6460. if @skill.common_event_id > 0
  6461. $game_temp.common_event_id = @skill.common_event_id
  6462. $scene = Scene_Map.new
  6463. return
  6464. end
  6465. end
  6466. unless used
  6467. $game_system.se_play($data_system.buzzer_se)
  6468. end
  6469. return
  6470. end
  6471. end
  6472.  
  6473. def update_right_equip
  6474. if Input.trigger?(Input::B)
  6475. $game_system.se_play($data_system.cancel_se)
  6476. @right_window.active = false
  6477. @right_window.x = 688
  6478. @right_window.index = 0
  6479. @left_window.active = false
  6480. @left_window.x = -352
  6481. @help_window.active = false
  6482. @help_window.y = -352
  6483. @help_window.x = 48
  6484. @item_window.y = 672
  6485. @item_window.visible = false
  6486. @item_window1.y = 672
  6487. @item_window2.y = 672
  6488. @item_window3.y = 672
  6489. @item_window4.y = 672
  6490. @item_window5.y = 672
  6491. @command_window.active = true
  6492. @status_window.index = -1
  6493. return
  6494. end
  6495. if Input.trigger?(Input::C)
  6496. if @actor.equip_fix?(@right_window.index)
  6497. $game_system.se_play($data_system.buzzer_se)
  6498. return
  6499. end
  6500. $game_system.se_play($data_system.decision_se)
  6501. @right_window.active = false
  6502. @item_window.active = true
  6503. @item_window.index = 0
  6504. return
  6505. end
  6506. end
  6507.  
  6508. def update_eitem
  6509. if Input.trigger?(Input::B)
  6510. $game_system.se_play($data_system.cancel_se)
  6511. @right_window.active = true
  6512. @item_window.active = false
  6513. @item_window.index = -1
  6514. return
  6515. end
  6516. if Input.trigger?(Input::C)
  6517. $game_system.se_play($data_system.equip_se)
  6518. item = @item_window.item
  6519. @actor.equip(@right_window.index, item == nil ? 0 : item.id)
  6520. @right_window.active = true
  6521. @item_window.active = false
  6522. @item_window.index = -1
  6523. @right_window.refresh
  6524. @item_window.refresh
  6525. @item_window1.refresh
  6526. @item_window2.refresh
  6527. @item_window3.refresh
  6528. @item_window4.refresh
  6529. @item_window5.refresh
  6530. return
  6531. end
  6532. end
  6533.  
  6534. def update_playerstatus
  6535. if Input.trigger?(Input::B)
  6536. $game_system.se_play($data_system.cancel_se)
  6537. @playerstatus_window.active = false
  6538. @playerstatus_window.x = 640
  6539. @command_window.active = true
  6540. @status_window.index = -1
  6541. end
  6542. end
  6543.  
  6544. def update_gold
  6545. if Input.trigger?(Input::B)
  6546. $game_system.se_play($data_system.cancel_se)
  6547. @gold_window.active = false
  6548. @gold_window.x = -160
  6549. @command_window.active = true
  6550. end
  6551. end
  6552.  
  6553. def update_time
  6554. if Input.trigger?(Input::B)
  6555. $game_system.se_play($data_system.cancel_se)
  6556. @time_window.active = false
  6557. @time_window.x = -160
  6558. @command_window.active = true
  6559. end
  6560. end
  6561.  
  6562. def update_location
  6563. if Input.trigger?(Input::B)
  6564. $game_system.se_play($data_system.cancel_se)
  6565. @location_window.active = false
  6566. @location_window.x = -160
  6567. @command_window.active = true
  6568. end
  6569. end
  6570.  
  6571. def update_option_command
  6572. if Input.trigger?(Input::B)
  6573. $game_system.se_play($data_system.cancel_se)
  6574. @option_command_window.active = false
  6575. @option_command_window.x = -192
  6576. @option_command_window.index = 0
  6577. @command_window.active = true
  6578. return
  6579. end
  6580. if Input.trigger?(Input::C)
  6581. case @option_command_window.index
  6582. when 0
  6583. $game_system.se_play($data_system.decision_se)
  6584. @option_command_window.active = false
  6585. @windowskin_window.active = true
  6586. @currentwindowskin_window.active = true
  6587. @currentwindowskin_window.refresh
  6588. when 1
  6589. $game_system.se_play($data_system.decision_se)
  6590. @option_command_window.active = false
  6591. @fonttype_window.active = true
  6592. @currentfonttype_window.active = true
  6593. @currentfonttype_window.refresh
  6594. when 2
  6595. $game_system.se_play($data_system.decision_se)
  6596. @option_command_window.active = false
  6597. @bgm_window.active = true
  6598. @currentbgm_window.active = true
  6599. @currentbgm_window.refresh
  6600. when 3
  6601. $game_system.se_play($data_system.decision_se)
  6602. @option_command_window.active = false
  6603. @sfx_window.active = true
  6604. @currentsfx_window.active = true
  6605. @currentsfx_window.refresh
  6606. end
  6607. return
  6608. end
  6609. end
  6610.  
  6611. def update_windowskin
  6612. if Input.trigger?(Input::B)
  6613. $game_system.se_play($data_system.cancel_se)
  6614. @windowskin_window.active = false
  6615. @windowskin_window.x = -80
  6616. @windowskin_window.index = 0
  6617. @currentwindowskin_window.active = false
  6618. @currentwindowskin_window.y = -304
  6619. @option_command_window.active = true
  6620. return
  6621. end
  6622. if Input.trigger?(Input::C)
  6623. case @windowskin_window.index
  6624. when 0
  6625. $game_system.se_play($data_system.decision_se)
  6626. $game_system.windowskin_name = "Black"
  6627. @currentwindowskin_window.refresh
  6628. @time_window.refresh
  6629. when 1
  6630. $game_system.se_play($data_system.decision_se)
  6631. $game_system.windowskin_name = "Old"
  6632. @currentwindowskin_window.refresh
  6633. @time_window.refresh
  6634. when 2
  6635. $game_system.se_play($data_system.decision_se)
  6636. $game_system.windowskin_name = "Red"
  6637. @currentwindowskin_window.refresh
  6638. @time_window.refresh
  6639. when 3
  6640. $game_system.se_play($data_system.decision_se)
  6641. $game_system.windowskin_name = "Chaos"
  6642. @currentwindowskin_window.refresh
  6643. @time_window.refresh
  6644. when 4
  6645. $game_system.se_play($data_system.decision_se)
  6646. $game_system.windowskin_name = "Grey"
  6647. @currentwindowskin_window.refresh
  6648. @time_window.refresh
  6649. when 5
  6650. $game_system.se_play($data_system.decision_se)
  6651. $game_system.windowskin_name = "Sky"
  6652. @currentwindowskin_window.refresh
  6653. @time_window.refresh
  6654. when 6
  6655. $game_system.se_play($data_system.decision_se)
  6656. $game_system.windowskin_name = "Army"
  6657. @currentwindowskin_window.refresh
  6658. @time_window.refresh
  6659. end
  6660. return
  6661. end
  6662. end
  6663.  
  6664. def update_fonttype
  6665. if Input.trigger?(Input::B)
  6666. $game_system.se_play($data_system.cancel_se)
  6667. @fonttype_window.active = false
  6668. @fonttype_window.x = -192
  6669. @fonttype_window.index = 0
  6670. @currentfonttype_window.active = false
  6671. @currentfonttype_window.y = -416
  6672. @option_command_window.active = true
  6673. return
  6674. end
  6675. if Input.trigger?(Input::C)
  6676. case @fonttype_window.index
  6677. when 0
  6678. $game_system.se_play($data_system.decision_se)
  6679. $fontface = "Arial"
  6680. $scene = Scene_Menu.new
  6681. when 1
  6682. $game_system.se_play($data_system.decision_se)
  6683. $fontface = "Bookman Old Style"
  6684. $scene = Scene_Menu.new
  6685. when 2
  6686. $game_system.se_play($data_system.decision_se)
  6687. $fontface = "Comic Sans MS"
  6688. $scene = Scene_Menu.new
  6689. when 3
  6690. $game_system.se_play($data_system.decision_se)
  6691. $fontface = "Mistral"
  6692. $scene = Scene_Menu.new
  6693. when 4
  6694. $game_system.se_play($data_system.decision_se)
  6695. $fontface = "Papyrus"
  6696. $scene = Scene_Menu.new
  6697. when 5
  6698. $game_system.se_play($data_system.decision_se)
  6699. $fontface = "Tahoma"
  6700. $scene = Scene_Menu.new
  6701. when 6
  6702. $game_system.se_play($data_system.decision_se)
  6703. $fontface = "Times New Roman"
  6704. $scene = Scene_Menu.new
  6705. end
  6706. return
  6707. end
  6708. end
  6709.  
  6710. def update_bgm
  6711. if Input.trigger?(Input::B)
  6712. $game_system.se_play($data_system.cancel_se)
  6713. @bgm_window.active = false
  6714. @bgm_window.x = -192
  6715. @bgm_window.index = 0
  6716. @currentbgm_window.active = false
  6717. @currentbgm_window.y = -416
  6718. @option_command_window.active = true
  6719. return
  6720. end
  6721. if Input.trigger?(Input::C)
  6722. case @bgm_window.index
  6723. when 0
  6724. $game_system.bgm_volume = 0
  6725. $game_system.bgm_play($game_system.bgm_memorize)
  6726. @currentbgm_window.refresh
  6727. when 1
  6728. $game_system.bgm_volume = 17
  6729. $game_system.bgm_play($game_system.bgm_memorize)
  6730. @currentbgm_window.refresh
  6731. when 2
  6732. $game_system.bgm_volume = 34
  6733. $game_system.bgm_play($game_system.bgm_memorize)
  6734. @currentbgm_window.refresh
  6735. when 3
  6736. $game_system.bgm_volume = 50
  6737. $game_system.bgm_play($game_system.bgm_memorize)
  6738. @currentbgm_window.refresh
  6739. when 4
  6740. $game_system.bgm_volume = 67
  6741. $game_system.bgm_play($game_system.bgm_memorize)
  6742. @currentbgm_window.refresh
  6743. when 5
  6744. $game_system.bgm_volume = 84
  6745. $game_system.bgm_play($game_system.bgm_memorize)
  6746. @currentbgm_window.refresh
  6747. when 6
  6748. $game_system.bgm_volume = 100
  6749. $game_system.bgm_play($game_system.bgm_memorize)
  6750. @currentbgm_window.refresh
  6751. end
  6752. return
  6753. end
  6754. end
  6755.  
  6756. def update_sfx
  6757. if Input.trigger?(Input::B)
  6758. $game_system.se_play($data_system.cancel_se)
  6759. @sfx_window.active = false
  6760. @sfx_window.x = -192
  6761. @sfx_window.index = 0
  6762. @currentsfx_window.active = false
  6763. @currentsfx_window.y = -416
  6764. @option_command_window.active = true
  6765. return
  6766. end
  6767. if Input.trigger?(Input::C)
  6768. case @sfx_window.index
  6769. when 0
  6770. $game_system.se_volume = 0
  6771. $game_system.se_play($data_system.decision_se)
  6772. @currentsfx_window.refresh
  6773. when 1
  6774. $game_system.se_volume = 17
  6775. $game_system.se_play($data_system.decision_se)
  6776. @currentsfx_window.refresh
  6777. when 2
  6778. $game_system.se_volume = 34
  6779. $game_system.se_play($data_system.decision_se)
  6780. @currentsfx_window.refresh
  6781. when 3
  6782. $game_system.se_volume = 50
  6783. $game_system.se_play($data_system.decision_se)
  6784. @currentsfx_window.refresh
  6785. when 4
  6786. $game_system.se_volume = 67
  6787. $game_system.se_play($data_system.decision_se)
  6788. @currentsfx_window.refresh
  6789. when 5
  6790. $game_system.se_volume = 84
  6791. $game_system.se_play($data_system.decision_se)
  6792. @currentsfx_window.refresh
  6793. when 6
  6794. $game_system.se_volume = 100
  6795. $game_system.se_play($data_system.decision_se)
  6796. @currentsfx_window.refresh
  6797. end
  6798. return
  6799. end
  6800. end
  6801.  
  6802. def update_party
  6803. if Input.trigger?(Input::B)
  6804. new_party = @party_window.new_party.compact
  6805. n = new_party.size
  6806. if n < @min_size or n > @max_size
  6807. $game_system.se_play($data_system.buzzer_se)
  6808. return
  6809. end
  6810. $game_system.se_play($data_system.decision_se)
  6811. $game_party.actors = new_party
  6812. @status_window.refresh
  6813. @party_window.active = false
  6814. @party_window.x = -352
  6815. @switchstatus_window.active = false
  6816. @switchstatus_window.x = 640
  6817. @reserve_window.visible = false
  6818. @reserve_window.y = 544
  6819. @command_window.active = true
  6820. $game_player.refresh
  6821. return
  6822. elsif Input.trigger?(Input::C)
  6823. if(@party_window.actor != nil and @party_window.actor.mandatory)
  6824. $game_system.se_play($data_system.buzzer_se)
  6825. else
  6826. $game_system.se_play($data_system.decision_se)
  6827. @party_window.active = false
  6828. @reserve_window.active = true
  6829. end
  6830. end
  6831. end
  6832.  
  6833. def update_reserve
  6834. if Input.trigger?(Input::B)
  6835. $game_system.se_play($data_system.decision_se)
  6836. @reserve_window.active = false
  6837. @party_window.active = true
  6838. return
  6839. elsif Input.trigger?(Input::C)
  6840. $game_system.se_play($data_system.decision_se)
  6841. @party_window.change_selection(@reserve_window.swap_characters(@party_window.actor))
  6842. @reserve_window.active = false
  6843. @party_window.active = true
  6844. end
  6845. end
  6846.  
  6847.  
  6848. def update_main
  6849. if Input.trigger?(Input::B)
  6850. $game_system.se_play($data_system.cancel_se)
  6851. @title_window.active = false
  6852. @title_window.x = -576
  6853. @main_window.active = false
  6854. @main_window.x = 640
  6855. @info_window.active = false
  6856. @info_window.visible = false
  6857. @info_window.x = 640
  6858. @command_window.active = true
  6859. return
  6860. end
  6861. if Input.trigger?(Input::C)
  6862. if @main_window.item == nil or @main_window.show?(@main_window.item) == false
  6863. $game_system.se_play($data_system.buzzer_se)
  6864. return
  6865. end
  6866. $game_system.se_play($data_system.decision_se)
  6867. @main_window.active = false
  6868. @info_window.active = true
  6869. @info_window.visible = true
  6870. @visible_index = @main_window.index
  6871. @info_window.refresh(@main_window.item)
  6872. return
  6873. end
  6874. end
  6875.  
  6876. def update_info
  6877. if Input.trigger?(Input::B)
  6878. $game_system.se_play($data_system.cancel_se)
  6879. @main_window.active = true
  6880. @info_window.active = false
  6881. @info_window.x = 640
  6882. return
  6883. end
  6884. if Input.trigger?(Input::C)
  6885. $game_system.se_play($data_system.decision_se)
  6886. return
  6887. end
  6888. if Input.trigger?(Input::L)
  6889. $game_system.se_play($data_system.decision_se)
  6890. loop_end = false
  6891. while loop_end == false
  6892. if @visible_index != 0
  6893. @visible_index -= 1
  6894. else
  6895. @visible_index = @main_window.data.size - 1
  6896. end
  6897. loop_end = true if @main_window.show?(@main_window.data[@visible_index])
  6898. end
  6899. id = @main_window.data[@visible_index]
  6900. @info_window.refresh(id)
  6901. return
  6902. end
  6903. if Input.trigger?(Input::R)
  6904. $game_system.se_play($data_system.decision_se)
  6905. loop_end = false
  6906. while loop_end == false
  6907. if @visible_index != @main_window.data.size - 1
  6908. @visible_index += 1
  6909. else
  6910. @visible_index = 0
  6911. end
  6912. loop_end = true if @main_window.show?(@main_window.data[@visible_index])
  6913. end
  6914. id = @main_window.data[@visible_index]
  6915. @info_window.refresh(id)
  6916. return
  6917. end
  6918. end
  6919.  
  6920. def update_end
  6921. if Input.trigger?(Input::B)
  6922. $game_system.se_play($data_system.cancel_se)
  6923. @end_window.active = false
  6924. @end_window.x = -192
  6925. @command_window.active = true
  6926. return
  6927. end
  6928. if Input.trigger?(Input::C)
  6929. case @end_window.index
  6930. when 0
  6931. command_to_title
  6932. when 1
  6933. command_shutdown
  6934. when 2
  6935. command_cancel
  6936. end
  6937. return
  6938. end
  6939. end
  6940.  
  6941. def command_to_title
  6942. $game_system.se_play($data_system.decision_se)
  6943. Audio.bgm_fade(800)
  6944. Audio.bgs_fade(800)
  6945. Audio.me_fade(800)
  6946. $scene = Scene_Title.new
  6947. end
  6948.  
  6949. def command_shutdown
  6950. $game_system.se_play($data_system.decision_se)
  6951. Audio.bgm_fade(800)
  6952. Audio.bgs_fade(800)
  6953. Audio.me_fade(800)
  6954. $scene = nil
  6955. end
  6956.  
  6957. def command_cancel
  6958. $game_system.se_play($data_system.cancel_se)
  6959. @end_window.active = false
  6960. @end_window.x = -192
  6961. @command_window.active = true
  6962. end
  6963.  
  6964. end
  6965.  
  6966. #==============================================================================
  6967. # ■ Scene_NewLoad
  6968. #==============================================================================
  6969.  
  6970. class Scene_NewLoad < Scene_File
  6971.  
  6972. def initialize
  6973. $game_temp = Game_Temp.new
  6974. $game_temp.last_file_index = 0
  6975. latest_time = Time.at(0)
  6976. for i in 0..3
  6977. filename = make_filename(i)
  6978. if FileTest.exist?(filename)
  6979. file = File.open(filename, "r")
  6980. if file.mtime > latest_time
  6981. latest_time = file.mtime
  6982. $game_temp.last_file_index = i
  6983. end
  6984. file.close
  6985. end
  6986. end
  6987. super("Which file do you wish to load from?")
  6988. end
  6989.  
  6990. def on_decision(filename)
  6991. unless FileTest.exist?(filename)
  6992. $game_system.se_play($data_system.buzzer_se)
  6993. return
  6994. end
  6995. $game_system.se_play($data_system.load_se)
  6996. file = File.open(filename, "rb")
  6997. read_save_data(file)
  6998. file.close
  6999. $game_system.bgm_play($game_system.playing_bgm)
  7000. $game_system.bgs_play($game_system.playing_bgs)
  7001. $game_map.update
  7002. $scene = Scene_Map.new
  7003. end
  7004.  
  7005. def on_cancel
  7006. $game_system.se_play($data_system.cancel_se)
  7007. $scene = Scene_Menu.new(10)
  7008. end
  7009.  
  7010. def read_save_data(file)
  7011. characters = Marshal.load(file)
  7012. Graphics.frame_count = Marshal.load(file)
  7013. $game_system = Marshal.load(file)
  7014. $game_switches = Marshal.load(file)
  7015. $game_variables = Marshal.load(file)
  7016. $game_self_switches = Marshal.load(file)
  7017. $game_screen = Marshal.load(file)
  7018. $game_actors = Marshal.load(file)
  7019. $game_party = Marshal.load(file)
  7020. $game_troop = Marshal.load(file)
  7021. $game_map = Marshal.load(file)
  7022. $game_player = Marshal.load(file)
  7023. $game_time =Marshal.load(file)
  7024. if $game_system.magic_number != $data_system.magic_number
  7025. $game_map.setup($game_map.map_id)
  7026. $game_player.center($game_player.x, $game_player.y)
  7027. end
  7028. $game_party.refresh
  7029. end
  7030.  
  7031. end
Add Comment
Please, Sign In to add comment