Advertisement
Guest User

Sideview Tankentai 2

a guest
Sep 23rd, 2017
534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 102.20 KB | None | 0 0
  1. #==============================================================================
  2. # ■ Scene_Battle for Sideview Ver3.4d
  3. #------------------------------------------------------------------------------
  4. #  バトル画面の処理を行うクラスです。
  5. #==============================================================================
  6. class Scene_Battle < Scene_Base
  7. #--------------------------------------------------------------------------
  8. # ● 終了処理
  9. #--------------------------------------------------------------------------
  10. alias terminate_n01 terminate
  11. def terminate
  12. terminate_n01
  13. # 二刀流の持ち替え処理を戻す
  14. for member in $game_party.members
  15. if member.two_swords_change
  16. member.change_equip_by_id(1, member.weapon_id)
  17. member.change_equip_by_id(0, 0)
  18. member.two_swords_change = false
  19. end
  20. end
  21. end
  22. #--------------------------------------------------------------------------
  23. # ● 戦闘開始の処理
  24. #--------------------------------------------------------------------------
  25. alias process_battle_start_n01 process_battle_start
  26. def process_battle_start
  27. process_battle_start_n01
  28. # 二刀流で左(下部表示)に武器を持ち右(上部表示)に武器を持たないように
  29. # している場合、ここで強制的に持ち替えさせる
  30. for member in $game_party.members
  31. if member.weapons[0] == nil and member.weapons[1] != nil
  32. member.change_equip_by_id(0, member.armor1_id)
  33. member.change_equip_by_id(1, 0)
  34. member.two_swords_change = true
  35. end
  36. end
  37. end
  38. #--------------------------------------------------------------------------
  39. # ● フレーム更新
  40. #--------------------------------------------------------------------------
  41. alias update_n01 update
  42. def update
  43. reset_stand_by_action
  44. super
  45. update_n01
  46. end
  47. #--------------------------------------------------------------------------
  48. # ● イベント操作によるHP変動でキャラクターアクションを再設定
  49. #--------------------------------------------------------------------------
  50. def reset_stand_by_action
  51. if $game_temp.status_window_refresh
  52. $game_temp.status_window_refresh = false
  53. for member in $game_party.members + $game_troop.members
  54. @spriteset.set_stand_by_action(member.actor?, member.index)
  55. # 自動復活チェック
  56. resurrection(member) if member.hp == 0
  57. end
  58. @status_window.refresh
  59. end
  60. end
  61. #--------------------------------------------------------------------------
  62. # ● 敗北の処理
  63. #--------------------------------------------------------------------------
  64. alias process_defeat_n01 process_defeat
  65. def process_defeat
  66. for member in $game_party.members
  67. @spriteset.set_stand_by_action(member.actor?, member.index)
  68. end
  69. process_defeat_n01
  70. end
  71. #--------------------------------------------------------------------------
  72. # ● ヘルプウインドウの表示
  73. #--------------------------------------------------------------------------
  74. def pop_help(obj)
  75. return if obj.extension.include?("HELPHIDE")
  76. @help_window = Window_Help.new if @help_window == nil
  77. @help_window.set_text(obj.name, 1)
  78. @help_window.visible = true
  79. end
  80. #--------------------------------------------------------------------------
  81. # ● 情報表示ビューポートの移動
  82. #--------------------------------------------------------------------------
  83. def move1_info_viewport
  84. @info_viewport.ox = 128
  85. loop do
  86. update_basic
  87. @info_viewport.ox -= 8
  88. @party_command_window.x -= 8
  89. @actor_command_window.x += 8
  90. break if @info_viewport.ox == 64
  91. end
  92. end
  93. #--------------------------------------------------------------------------
  94. # ● 情報表示ビューポートの移動
  95. #--------------------------------------------------------------------------
  96. def move2_info_viewport
  97. @info_viewport.ox = 64
  98. loop do
  99. update_basic
  100. @info_viewport.ox -= 8
  101. @party_command_window.x += 8
  102. @actor_command_window.x -= 8
  103. break if @info_viewport.ox == 0
  104. end
  105. end
  106. #--------------------------------------------------------------------------
  107. # ● 次のアクターのコマンド入力へ
  108. #--------------------------------------------------------------------------
  109. alias next_actor_n01 next_actor
  110. def next_actor
  111. # 動けるキャラのみコマンドアクションを
  112. if @active_battler != nil && @active_battler.inputable? && @active_battler.actor?
  113. @spriteset.set_action(true, @actor_index,@active_battler.command_a)
  114. end
  115. # 最後のアクターの場合、アクションが終わるまで待つ
  116. @wait_count = 32 if @actor_index == $game_party.members.size-1
  117. next_actor_n01
  118. # 動けるキャラのみコマンドアクションを
  119. if @active_battler != nil && @active_battler.inputable? && @active_battler.actor?
  120. @spriteset.set_action(true, @actor_index,@active_battler.command_b)
  121. end
  122. end
  123. #--------------------------------------------------------------------------
  124. # ● 前のアクターのコマンド入力へ
  125. #--------------------------------------------------------------------------
  126. alias prior_actor_n01 prior_actor
  127. def prior_actor
  128. # 動けるキャラのみコマンドアクションを
  129. if @active_battler != nil && @active_battler.inputable? && @active_battler.actor?
  130. @active_battler.action.clear
  131. @spriteset.set_action(true, @actor_index,@active_battler.command_a)
  132. end
  133. prior_actor_n01
  134. # 動けるキャラのみコマンドアクションを
  135. if @active_battler != nil && @active_battler.inputable? && @active_battler.actor?
  136. @active_battler.action.clear
  137. @spriteset.set_action(true, @actor_index,@active_battler.command_b)
  138. end
  139. end
  140. #--------------------------------------------------------------------------
  141. # ● ターゲット選択の開始 ※再定義
  142. #--------------------------------------------------------------------------
  143. def start_target_enemy_selection
  144. start_target_selection
  145. end
  146. #--------------------------------------------------------------------------
  147. # ● ターゲット選択の開始 ※再定義
  148. #--------------------------------------------------------------------------
  149. def start_target_actor_selection
  150. start_target_selection(true)
  151. end
  152. #--------------------------------------------------------------------------
  153. # ● ターゲット選択の開始
  154. #--------------------------------------------------------------------------
  155. def start_target_selection(actor = false)
  156. members = $game_party.members if actor
  157. members = $game_troop.members unless actor
  158. # カーソルスプライトの作成
  159. @cursor = Sprite.new
  160. @cursor.bitmap = Cache.character("cursor")
  161. @cursor.src_rect.set(0, 0, 32, 32)
  162. @cursor_flame = 0
  163. @cursor.x = -200
  164. @cursor.y = -200
  165. @cursor.ox = @cursor.width
  166. @cursor.oy = @cursor.height
  167. # ターゲット名を表示するヘルプウインドウを作成
  168. @help_window.visible = false if @help_window != nil
  169. @help_window2 = Window_Help.new if @help_window2 == nil
  170. # 不要なウインドウを消す
  171. @actor_command_window.active = false
  172. @skill_window.visible = false if @skill_window != nil
  173. @item_window.visible = false if @item_window != nil
  174. # 存在しているターゲットで最も番号の低い対象を最初に指すように
  175. @index = 0
  176. @max_index = members.size - 1
  177. # アクターは戦闘不能者でもターゲットできるようにエネミーと区別
  178. unless actor
  179. members.size.times do
  180. break if members[@index].exist?
  181. @index += 1
  182. end
  183. end
  184. # @help_window2.set_text(members[@index].name, 1) # 3.4a
  185. @help_window2.set_text_n01add(members[@index])
  186. select_member(actor)
  187. end
  188. #--------------------------------------------------------------------------
  189. # ● ターゲット選択
  190. #--------------------------------------------------------------------------
  191. def select_member(actor = false)
  192. members = $game_party.members if actor
  193. members = $game_troop.members unless actor
  194. loop do
  195. update_basic
  196. @cursor_flame = 0 if @cursor_flame == 30
  197. @cursor.src_rect.set(0, 0, 32, 32) if @cursor_flame == 29
  198. @cursor.src_rect.set(0, 32, 32, 32) if @cursor_flame == 15
  199. point = @spriteset.set_cursor(actor, @index)
  200. # point is the screen coordinate of the target
  201. @cursor.x = point[0] # Cursor X
  202. @cursor.y = point[1] # Cursor Y
  203. @cursor_flame += 1
  204. if Input.trigger?(Input::B)
  205. Sound.play_cancel
  206. end_target_selection
  207. break
  208. elsif Input.trigger?(Input::C)
  209. Sound.play_decision
  210. @active_battler.action.target_index = @index # if you get an error on this line, remove the Enemy Gauge Add-on script
  211. end_target_selection
  212. end_skill_selection
  213. end_item_selection
  214. next_actor
  215. break
  216. end
  217. if Input.repeat?(Input::LEFT)
  218. if actor
  219. cursor_down(members, actor) if $back_attack
  220. cursor_up(members, actor) unless $back_attack
  221. else
  222. cursor_up(members, actor) if $back_attack
  223. cursor_down(members, actor) unless $back_attack
  224. end
  225. end
  226. if Input.repeat?(Input::RIGHT)
  227. if actor
  228. cursor_up(members, actor) if $back_attack
  229. cursor_down(members, actor) unless $back_attack
  230. else
  231. cursor_down(members, actor) if $back_attack
  232. cursor_up(members, actor) unless $back_attack
  233. end
  234. end
  235. cursor_up(members, actor) if Input.repeat?(Input::UP)
  236. cursor_down(members, actor) if Input.repeat?(Input::DOWN)
  237. end
  238. end
  239. #--------------------------------------------------------------------------
  240. # ● Move Cursor Target Up
  241. #--------------------------------------------------------------------------
  242. def cursor_up(members, actor)
  243. Sound.play_cursor
  244. members.size.times do
  245. @index += members.size - 1
  246. @index %= members.size
  247. break if actor
  248. break if members[@index].exist?
  249. end
  250. @help_window2.set_text_n01add(members[@index])
  251. end
  252. #--------------------------------------------------------------------------
  253. # ● Move Cursor Target Down
  254. #--------------------------------------------------------------------------
  255. def cursor_down(members, actor)
  256. Sound.play_cursor
  257. members.size.times do
  258. @index += 1
  259. @index %= members.size
  260. break if actor
  261. break if members[@index].exist? && !actor
  262. end
  263. @help_window2.set_text_n01add(members[@index])
  264. end
  265. #--------------------------------------------------------------------------
  266. # ● ターゲット選択の終了
  267. #--------------------------------------------------------------------------
  268. def end_target_selection
  269. @actor_command_window.active = true if @actor_command_window.index == 0
  270. @skill_window.visible = true if @skill_window != nil
  271. @item_window.visible = true if @item_window != nil
  272. @cursor.dispose
  273. @cursor = nil
  274. if @help_window2 != nil
  275. @help_window2.dispose
  276. @help_window2 = nil
  277. end
  278. @help_window.visible = true if @help_window != nil
  279. end
  280. #--------------------------------------------------------------------------
  281. # ● 逃走の処理 ※再定義
  282. #--------------------------------------------------------------------------
  283. def process_escape
  284. @info_viewport.visible = false
  285. @message_window.visible = true
  286. text = sprintf(Vocab::EscapeStart, $game_party.name)
  287. $game_message.texts.push(text)
  288. if $game_troop.preemptive
  289. success = true
  290. else
  291. success = (rand(100) < @escape_ratio)
  292. end
  293. Sound.play_escape
  294. # 動けないアクターを除いて逃走成功アクション
  295. if success
  296. for actor in $game_party.members
  297. unless actor.restriction >= 4
  298. @spriteset.set_action(true, actor.index,actor.run_success)
  299. end
  300. end
  301. wait_for_message
  302. battle_end(1)
  303. # 動けないアクターを除いて逃走失敗アクション
  304. else
  305. for actor in $game_party.members
  306. unless actor.restriction >= 4
  307. @spriteset.set_action(true, actor.index,actor.run_ng)
  308. end
  309. end
  310. @escape_ratio += 10
  311. $game_message.texts.push('\.' + Vocab::EscapeFailure)
  312. wait_for_message
  313. $game_party.clear_actions
  314. start_main
  315. end
  316. end
  317. #--------------------------------------------------------------------------
  318. # ● 勝利の処理
  319. #--------------------------------------------------------------------------
  320. alias process_victory_n01 process_victory
  321. def process_victory
  322. @status_window.visible = true
  323. @message_window.visible = false
  324. # ボスコラプスはウエイトを長く挟む
  325. for enemy in $game_troop.members
  326. break boss_wait = true if enemy.collapse_type == 3
  327. end
  328. wait(440) if boss_wait
  329. wait(N01::WIN_WAIT) unless boss_wait
  330. # 動けないアクターを除いて勝利アクション
  331. for actor in $game_party.members
  332. unless actor.restriction >= 4
  333. @spriteset.set_action(true, actor.index,actor.win)
  334. end
  335. end
  336. process_victory_n01
  337. end
  338. #--------------------------------------------------------------------------
  339. # ● 戦闘処理の実行開始 ※再定義
  340. #--------------------------------------------------------------------------
  341. def start_main
  342. $game_troop.increase_turn
  343. @info_viewport.visible = true
  344. @info_viewport.ox = 0
  345. @party_command_window.active = false
  346. @actor_command_window.active = false
  347. @status_window.index = @actor_index = -1
  348. @active_battler = nil
  349. @message_window.clear
  350. $game_troop.make_actions
  351. make_action_orders
  352. # 情報表示ビューポートの移動
  353. move1_info_viewport
  354. # スキル名を表示するヘルプウインドウを作成
  355. @help_window = Window_Help.new
  356. @help_window.visible = false
  357. process_battle_event
  358. end
  359. #--------------------------------------------------------------------------
  360. # ● バトルイベントの処理 ※再定義
  361. #--------------------------------------------------------------------------
  362. def process_battle_event
  363. loop do
  364. return if judge_win_loss
  365. return if $game_temp.next_scene != nil
  366. $game_troop.interpreter.update
  367. $game_troop.setup_battle_event
  368. @message_window.update
  369. if $game_message.visible
  370. @message_window.visible = true
  371. @status_window.visible = false
  372. end
  373. wait_for_message
  374. @message_window.visible = false
  375. @status_window.visible = true
  376. if $game_troop.forcing_battler != nil
  377. process_action
  378. end
  379. return unless $game_troop.interpreter.running?
  380. update_basic
  381. end
  382. end
  383. #--------------------------------------------------------------------------
  384. # ● 行動順序作成
  385. #--------------------------------------------------------------------------
  386. alias make_action_orders_n01 make_action_orders
  387. def make_action_orders
  388. make_action_orders_n01
  389. # エネミーの行動回数チェック
  390. for enemy in $game_troop.members
  391. enemy.act_time = 0
  392. if enemy.action_time[0] != 1
  393. action_time = 0
  394. # 確率から回数を取得
  395. for i in 1...enemy.action_time[0]
  396. action_time += 1 if rand(100) < enemy.action_time[1]
  397. end
  398. enemy.act_time = action_time
  399. action_time.times do
  400. enemy_order_time(enemy)
  401. action_time -= 1
  402. break if action_time == 0
  403. end
  404. enemy.adj_speed = nil
  405. end
  406. end
  407. end
  408. #--------------------------------------------------------------------------
  409. # ● エネミーの行動回数作成
  410. #--------------------------------------------------------------------------
  411. def enemy_order_time(enemy)
  412. enemy.make_action_speed2(enemy.action_time[2])
  413. select_time = 0
  414. for member in @action_battlers
  415. select_time += 1
  416. break @action_battlers.push(enemy) if member.action.speed < enemy.adj_speed
  417. break @action_battlers.push(enemy) if select_time == @action_battlers.size
  418. end
  419. end
  420. #--------------------------------------------------------------------------
  421. # ● 戦闘行動の実行
  422. #--------------------------------------------------------------------------
  423. alias execute_action_n01 execute_action
  424. def execute_action
  425. # スキル、アイテム拡張で行動前にフラッシュさせない設定があるなら
  426. if @active_battler.action.kind != 0
  427. obj = @active_battler.action.skill if @active_battler.action.kind == 1
  428. obj = @active_battler.action.item if @active_battler.action.kind == 2
  429. if obj.extension.include?("NOFLASH")
  430. @active_battler.white_flash = false
  431. end
  432. end
  433. # バトラーをアクティブ化
  434. @active_battler.active = true
  435. # 強制行動中のスキル派生
  436. @active_battler.derivation = 0 if @active_battler.action.forcing
  437. execute_action_n01
  438. # スキル派生がある場合、行動続行
  439. if @active_battler.derivation != 0
  440. @active_battler.action.kind = 1
  441. @active_battler.action.skill_id = @active_battler.derivation
  442. # we dont need the derivation variable anymore, its already been set
  443. @active_battler.derivation = 0 # Derivation fix, 1.1e
  444. @action_battlers.unshift(@active_battler)
  445. return process_action
  446. end
  447. # 複数回行動のエネミーがいる場合、次の行動を決定
  448. if !@active_battler.actor? && @active_battler.act_time != 0
  449. @active_battler.make_action
  450. @active_battler.act_time -= 1
  451. end
  452. end
  453. #--------------------------------------------------------------------------
  454. # ● ターン終了 ※再定義
  455. #--------------------------------------------------------------------------
  456. def turn_end
  457. for member in $game_party.members + $game_troop.members
  458. member.clear_action_results
  459. next unless member.exist?
  460. member.slip_damage = false
  461. actor = member.actor?
  462. damage = 0
  463. slip_pop = true
  464. slip_dead = true
  465. # 0ターン解除のステートがあるかチェック
  466. for state in member.states
  467. member.remove_state(state.id) if state.extension.include?("ZEROTURNLIFT")
  468. # スリップダメージ実行 state = [ 対象, 定数, 割合, POP, 戦闘不能許可]
  469. next unless state.slip_damage #state.extension.include?("SLIPDAMAGE")
  470. for ext in state.slip_extension
  471. if ext[0] == "hp"
  472. base_damage = ext[1] + member.maxhp * ext[2] / 100
  473. damage += base_damage #+ base_damage / 100 # * (rand(5) - rand(5)) / 100
  474. slip_pop = ext[3] unless ext[3] == nil
  475. slip_dead = ext[4] unless ext[4] == nil
  476. slip_damage_flug = true
  477. member.slip_damage = true
  478. end
  479. end
  480. end
  481. # デフォルトのスリップダメージ
  482. # if member.slip_damage? && member.exist? && !slip_damage_flug
  483. # damage += member.apply_variance(member.maxhp / 10, 10)
  484. # slip_dead = false
  485. # slip_pop = true
  486. # slip_damage_flug = true
  487. # member.slip_damage = true
  488. # end
  489. damage = member.hp - 1 if damage >= member.hp && slip_dead = false
  490. member.hp -= damage
  491. @spriteset.set_damage_pop(actor, member.index, damage) if slip_pop
  492. member.perform_collapse if member.dead? && member.slip_damage
  493. member.clear_action_results
  494. end
  495. @status_window.refresh
  496. # HPとMPのタイミングをずらす
  497. wait(55) if slip_damage_flug
  498. slip_damage_flug = false
  499. for member in $game_party.members + $game_troop.members
  500. member.clear_action_results
  501. next unless member.exist?
  502. actor = member.actor?
  503. mp_damage = 0
  504. for state in member.states
  505. next unless state.slip_damage #state.extension.include?("SLIPDAMAGE")
  506. for ext in state.slip_extension
  507. if ext[0] == "mp"
  508. base_damage = ext[1] + member.maxmp * ext[2] / 100
  509. mp_damage += base_damage #+ base_damage / 100 # * (rand(5) - rand(5)) / 100
  510. slip_pop = ext[2]
  511. slip_damage_flug = true
  512. end
  513. end
  514. member.mp_damage = mp_damage
  515. member.mp -= mp_damage
  516. @spriteset.set_damage_pop(actor, member.index, mp_damage) if slip_pop
  517. end
  518. member.clear_action_results
  519. end
  520. @status_window.refresh
  521. # ダメージと回復のタイミングをずらす
  522. wait(55) if slip_damage_flug
  523. # 自動回復があるか
  524. for member in $game_party.members
  525. if member.auto_hp_recover and member.exist?
  526. plus_hp = member.maxhp / 20
  527. member.hp += plus_hp
  528. @spriteset.set_damage_pop(true, member.index, plus_hp * -1)
  529. plus_hp_flug = true
  530. end
  531. member.clear_action_results
  532. end
  533. @status_window.refresh
  534. wait(55) if plus_hp_flug
  535. @help_window.dispose if @help_window != nil
  536. @help_window = nil
  537. move2_info_viewport
  538. $game_troop.turn_ending = true
  539. $game_troop.preemptive = false
  540. $game_troop.surprise = false
  541. process_battle_event
  542. $game_troop.turn_ending = false
  543. start_party_command_selection
  544. end
  545. #--------------------------------------------------------------------------
  546. # ● 戦闘行動の実行 : 攻撃 ※再定義
  547. #--------------------------------------------------------------------------
  548. def execute_action_attack
  549. if @active_battler.actor?
  550. if @active_battler.weapon_id == 0
  551. action = @active_battler.non_weapon
  552. # 行動中に死なないようメンバー全員を不死身化
  553. immortaling
  554. else
  555. action = $data_weapons[@active_battler.weapon_id].base_action
  556. # 戦闘不能付与の武器で不死身設定を分岐
  557. if $data_weapons[@active_battler.weapon_id].state_set.include?(1)
  558. for member in $game_party.members + $game_troop.members
  559. next if member.immortal
  560. next if member.dead?
  561. member.dying = true
  562. end
  563. else
  564. immortaling
  565. end
  566. end
  567. else
  568. if @active_battler.weapon == 0
  569. action = @active_battler.base_action
  570. immortaling
  571. else
  572. action = $data_weapons[@active_battler.weapon].base_action
  573. if $data_weapons[@active_battler.weapon].state_set.include?(1)
  574. for member in $game_party.members + $game_troop.members
  575. next if member.immortal
  576. next if member.dead?
  577. member.dying = true
  578. end
  579. else
  580. immortaling
  581. end
  582. end
  583. end
  584. target_decision
  585. @spriteset.set_action(@active_battler.actor?, @active_battler.index, action)
  586. playing_action
  587. end
  588. #--------------------------------------------------------------------------
  589. # ● 戦闘行動の実行 : 防御 ※再定義
  590. #--------------------------------------------------------------------------
  591. def execute_action_guard
  592. @help_window.set_text(N01::GUARD_HELP_TEXT, 1)
  593. @help_window.visible = true
  594. # バトラーのアクティブ化を解除
  595. @active_battler.active = false
  596. wait(45)
  597. @help_window.visible = false
  598. end
  599. #--------------------------------------------------------------------------
  600. # ● 戦闘行動の実行 : 逃走
  601. #--------------------------------------------------------------------------
  602. def execute_action_escape
  603. @spriteset.set_action(false, @active_battler.index, @active_battler.run_success)
  604. @help_window.set_text(N01::ESCAPED_HELP_TEXT, 1)
  605. @help_window.visible = true
  606. # バトラーのアクティブ化を解除
  607. @active_battler.active = false
  608. @active_battler.escape
  609. Sound.play_escape
  610. wait(45)
  611. @help_window.visible = false
  612. end
  613. #--------------------------------------------------------------------------
  614. # ● 戦闘行動の実行 : 待機 ※再定義
  615. #--------------------------------------------------------------------------
  616. def execute_action_wait
  617. # バトラーのアクティブ化を解除
  618. @active_battler.active = false
  619. wait(45)
  620. end
  621. #--------------------------------------------------------------------------
  622. # ● 戦闘行動の実行 : スキル ※再定義
  623. #--------------------------------------------------------------------------
  624. def execute_action_skill
  625. skill = @active_battler.action.skill
  626. return unless @active_battler.action.valid? # 3.3d, Force action bug fix
  627. # 戦闘不能付与のスキルで不死身設定を分岐
  628. if skill.plus_state_set.include?(1)
  629. for member in $game_party.members + $game_troop.members
  630. next if member.immortal
  631. next if member.dead?
  632. member.dying = true
  633. end
  634. else
  635. # 行動中に死なないようメンバー全員を不死身化
  636. immortaling
  637. end
  638. # ターゲット決定
  639. target_decision(skill)
  640. # アクション開始
  641. @spriteset.set_action(@active_battler.actor?, @active_battler.index, skill.base_action)
  642. # ヘルプウインドウにスキル名表示
  643. pop_help(skill)
  644. # アクション中
  645. playing_action
  646. # Calculate skill cost and remove MP. 3.4a
  647. @active_battler.mp -= @active_battler.calc_mp_cost(skill)
  648. # ステータスウインドウをリフレッシュ
  649. @status_window.refresh
  650. # コモンイベント取得
  651. $game_temp.common_event_id = skill.common_event_id
  652. end
  653. #--------------------------------------------------------------------------
  654. # ● 戦闘行動の実行 : アイテム ※再定義
  655. #--------------------------------------------------------------------------
  656. def execute_action_item
  657. item = @active_battler.action.item
  658. # 戦闘不能付与のアイテムで不死身設定を分岐
  659. if item.plus_state_set.include?(1)
  660. for member in $game_party.members + $game_troop.members
  661. next if member.immortal
  662. next if member.dead?
  663. member.dying = true
  664. end
  665. else
  666. # 行動中に死なないようメンバー全員を不死身化
  667. immortaling
  668. end
  669. $game_party.consume_item(item)
  670. target_decision(item)
  671. @spriteset.set_action(@active_battler.actor?, @active_battler.index, item.base_action)
  672. pop_help(item)
  673. playing_action
  674. $game_temp.common_event_id = item.common_event_id
  675. end
  676. #--------------------------------------------------------------------------
  677. # ● ターゲット決定
  678. #--------------------------------------------------------------------------
  679. def target_decision(obj = nil)
  680. @targets = @active_battler.action.make_targets
  681. # ターゲットがいない場合、アクション中断
  682. if @targets.size == 0
  683. action = @active_battler.recover_action
  684. @spriteset.set_action(@active_battler.actor?, @active_battler.index, action)
  685. end
  686. if obj != nil
  687. # デフォルトの複数回攻撃が設定されていれば単体ターゲットに変換
  688. if obj.for_two? or obj.for_three? or obj.dual?
  689. @targets = [@targets[0]]
  690. end
  691. # ランダムターゲットの場合、一体を選択しランダム範囲を保持
  692. if obj.extension.include?("RANDOMTARGET")
  693. randum_targets = @targets.dup
  694. @targets = [randum_targets[rand(randum_targets.size)]]
  695. end
  696. end
  697. # ターゲット情報をバトラースプライトに送る
  698. @spriteset.set_target(@active_battler.actor?, @active_battler.index, @targets)
  699. end
  700. #--------------------------------------------------------------------------
  701. # ● アクション実行中
  702. #--------------------------------------------------------------------------
  703. def playing_action
  704. loop do
  705. update_basic
  706. # Action order is stored from the active battler
  707. action = @active_battler.play
  708. next if action == 0
  709. @active_battler.play = 0
  710. if action[0] == "Individual"
  711. individual
  712. elsif action == "Can Collapse"
  713. unimmortaling
  714. elsif action == "Cancel Action"
  715. break action_end
  716. elsif action == "End"
  717. break action_end
  718. elsif action[0] == "OBJ_ANIM"
  719. damage_action(action[1])
  720. end
  721. end
  722. end
  723. #--------------------------------------------------------------------------
  724. # ● 個別処理
  725. #--------------------------------------------------------------------------
  726. def individual
  727. # ターゲット情報を保持
  728. @individual_target = @targets
  729. @stand_by_target = @targets.dup
  730. end
  731. #--------------------------------------------------------------------------
  732. # ● コラプス禁止
  733. #--------------------------------------------------------------------------
  734. def immortaling # for sideview 2
  735. for member in $game_party.members + $game_troop.members
  736. # everyone currently in the battle
  737. next if member.dead? # skip if they are dead
  738. member.set_temp_immortal
  739. # set the immortal flag
  740. end
  741. end
  742. #--------------------------------------------------------------------------
  743. # ● コラプス許可
  744. #--------------------------------------------------------------------------
  745. def unimmortaling
  746. # 個別処理中はコラプス許可しない
  747. return if @active_battler.individual
  748. # 全員の不死身化解除(イベント等で不死身設定がされていれば除く)
  749. for member in $game_party.members + $game_troop.members
  750. if member.dying
  751. member.dying = false
  752. if member.dead? or member.hp == 0
  753. member.add_state(1)
  754. member.perform_collapse
  755. end
  756. end
  757. next if member.non_dead
  758. next if member.dead?
  759. member.set_temp_immortal(false) # only changed this line, 3.3c
  760. member.add_state(1) if member.hp == 0
  761. member.perform_collapse
  762. end
  763. # この時点で待機アクションに即反映させる
  764. @targets = @stand_by_target if @stand_by_target != nil
  765. return if @targets == nil or @targets.size == 0
  766. for target in @targets
  767. @spriteset.set_stand_by_action(target.actor?, target.index)
  768. # 自動復活チェック
  769. next unless target.hp == 0
  770. resurrection(target)
  771. end
  772. end
  773. #--------------------------------------------------------------------------
  774. # ● 自動復活
  775. #--------------------------------------------------------------------------
  776. def resurrection(target)
  777. for state in target.states
  778. for ext in state.extension
  779. name = ext.split('')
  780. next unless name[0] == "A"
  781. wait(50)
  782. name = name.join
  783. name.slice!("AUTOLIFE/")
  784. target.hp = target.maxhp * name.to_i / 100
  785. target.remove_state(1)
  786. target.remove_state(state.id)
  787. target.animation_id = N01::RESURRECTION
  788. target.animation_mirror = true if $back_attack
  789. @status_window.refresh
  790. wait($data_animations[N01::RESURRECTION].frame_max * 4)
  791. end
  792. end
  793. end
  794. #--------------------------------------------------------------------------
  795. # ● 魔法反射・無効
  796. #--------------------------------------------------------------------------
  797. def magic_reflection(target, obj)
  798. return if obj.physical_attack
  799. for state in target.states
  800. for ext in state.extension
  801. name = ext.split('')
  802. next unless name[0] == "M"
  803. if name[3] == "R"
  804. name = name.join
  805. name.slice!("MAGREFLECT/")
  806. target.animation_id = name.to_i
  807. target.animation_mirror = true if $back_attack
  808. @reflection = true
  809. else
  810. name = name.join
  811. name.slice!("MAGNULL/")
  812. target.animation_id = name.to_i
  813. target.animation_mirror = true if $back_attack
  814. @invalid = true
  815. end
  816. end
  817. end
  818. end
  819. #--------------------------------------------------------------------------
  820. # ● 物理反射・無効
  821. #--------------------------------------------------------------------------
  822. def physics_reflection(target, obj)
  823. return if obj != nil && !obj.physical_attack
  824. for state in target.states
  825. for ext in state.extension
  826. name = ext.split('')
  827. next unless name[0] == "P"
  828. if name[3] == "R"
  829. name = name.join
  830. name.slice!("PHYREFLECT/")
  831. target.animation_id = name.to_i
  832. target.animation_mirror = true if $back_attack
  833. @reflection = true
  834. else
  835. name = name.join
  836. name.slice!("PHYNULL/")
  837. target.animation_id = name.to_i
  838. target.animation_mirror = true if $back_attack
  839. @invalid = true
  840. end
  841. end
  842. end
  843. end
  844. #--------------------------------------------------------------------------
  845. # ● Absorb Skill MP/HP Cost
  846. #--------------------------------------------------------------------------
  847. def absorb_cost(target, obj)
  848. for state in target.states
  849. if state.extension.include?("COSTABSORB")
  850. cost = @active_battler.calc_mp_cost(obj)
  851. if $imported["MPCostAlter"] # KGC_MPCostAlter
  852. hp_cost = @active_battler.calc_hp_cost(obj)
  853. # Return cost of skill if has an HP cost
  854. return target.hp += hp_cost if hp_cost > 0
  855. end
  856. # Return MP cost of skill that battler was hit by
  857. return target.mp += cost
  858. end
  859. end
  860. end
  861. #--------------------------------------------------------------------------
  862. # ● 吸収処理
  863. #--------------------------------------------------------------------------
  864. def absorb_attack(obj, target, index, actor)
  865. absorb = target.hp_damage
  866. absorb = target.mp_damage if target.mp_damage != 0
  867. # ターゲットが複数同時の吸収処理
  868. @wide_attack = true if obj.scope == 2 or obj.scope == 4 or obj.scope == 6 or obj.extension.include?("TARGETALL")
  869. if @wide_attack && @absorb == nil && @targets.size != 1
  870. # 吸収した分を戻す
  871. @active_battler.hp -= @active_battler.hp_damage
  872. @active_battler.mp -= @active_battler.mp_damage
  873. # 後で吸い戻す数値として加算
  874. @absorb = absorb
  875. @absorb_target_size = @targets.size - 2
  876. elsif @absorb != nil && @absorb_target_size > 0
  877. @active_battler.hp -= @active_battler.hp_damage
  878. @active_battler.mp -= @active_battler.mp_damage
  879. @absorb += absorb
  880. @absorb_target_size -= 1
  881. # 複数ターゲットの最終吸収処理
  882. elsif @absorb != nil
  883. # 吸収した分を戻す
  884. @active_battler.hp -= @active_battler.hp_damage
  885. @active_battler.mp -= @active_battler.mp_damage
  886. @absorb += absorb
  887. # ここで全吸収分を反映
  888. @active_battler.hp_damage = -@absorb
  889. @active_battler.mp_damage = -@absorb if target.mp_damage != 0
  890. @active_battler.hp -= @active_battler.hp_damage
  891. @active_battler.mp -= @active_battler.mp_damage
  892. # 吸収量が0の場合の吸収者側処理
  893. absorb_action = ["absorb", nil, false] if @absorb == 0
  894. absorb_action = [nil, nil, false] if @absorb != 0
  895. @spriteset.set_damage_action(actor, index, absorb_action)
  896. @active_battler.perform_collapse
  897. @absorb = nil
  898. @absorb_target_size = nil
  899. # 単体での吸収処理
  900. else
  901. # 吸収量が0の場合の吸収者側処理
  902. absorb_action = ["absorb", nil, false] if absorb == 0
  903. absorb_action = [nil, nil, false] if absorb != 0
  904. @spriteset.set_damage_action(actor, index, absorb_action)
  905. # 逆吸収でHP0になった場合
  906. @absorb_dead = true if @active_battler.hp == 0 && !@active_battler.non_dead
  907. end
  908. # 吸収量が0の場合の対象者側処理
  909. return 0 if absorb == 0
  910. end
  911. #--------------------------------------------------------------------------
  912. # ● アクション終了
  913. #--------------------------------------------------------------------------
  914. def action_end
  915. # 初期化
  916. @individual_target = nil
  917. @help_window.visible = false if @help_window != nil && @help_window.visible
  918. @active_battler.active = false
  919. @active_battler.clear_action_results
  920. # 念のため不死身化解除
  921. unimmortaling
  922. # 反射されていた場合
  923. if @active_battler.reflex != nil
  924. if @active_battler.action.skill?
  925. obj = @active_battler.action.skill
  926. @active_battler.perfect_skill_effect(@active_battler, obj)
  927. elsif @active_battler.action.item?
  928. obj = @active_battler.action.item
  929. @active_battler.item_effect(@active_battler, obj)
  930. else
  931. @active_battler.perfect_attack_effect(@active_battler)
  932. end
  933. pop_damage(@active_battler, obj, @active_battler.reflex)
  934. @active_battler.perform_collapse
  935. @active_battler.reflex = nil
  936. wait(N01::COLLAPSE_WAIT)
  937. end
  938. # 逆吸収で戦闘不能になった場合
  939. if @absorb_dead
  940. @active_battler.perform_collapse
  941. @absorb_dead = false
  942. wait(N01::COLLAPSE_WAIT)
  943. end
  944. # 次の行動までウエイトを挟む
  945. wait(N01::ACTION_WAIT)
  946. end
  947. #--------------------------------------------------------------------------
  948. # ● ダメージ処理
  949. #--------------------------------------------------------------------------
  950. def damage_action(action)
  951. # 個別処理の場合ターゲットを一つずつ抜き出す
  952. @targets = [@individual_target.shift] if @active_battler.individual
  953. # スキルの場合
  954. if @active_battler.action.skill?
  955. obj = @active_battler.action.skill
  956. for target in @targets
  957. return if target == nil
  958. return if target.dead? && !obj.for_dead_friend?
  959. # HPが0なら戦闘不能復活以外はミスしない
  960. target.revival = true if obj.for_dead_friend?
  961. if target.hp == 0 && !obj.for_dead_friend?
  962. target.perfect_skill_effect(@active_battler, obj)
  963. # 必中確認
  964. elsif obj.extension.include?("PERFECTHIT")
  965. target.perfect_skill_effect(@active_battler, obj)
  966. else
  967. # 反射確認
  968. magic_reflection(target, obj) unless obj.extension.include?("IGNOREREFLECT")
  969. physics_reflection(target, obj) unless obj.extension.include?("IGNOREREFLECT")
  970. # ダメージ計算
  971. target.skill_effect(@active_battler, obj) unless @reflection or @invalid
  972. end
  973. pop_damage(target, obj, action) unless @reflection or @invalid
  974. # コスト吸収確認
  975. absorb_cost(target, obj)
  976. # 反射アクション取得
  977. @active_battler.reflex = action if @reflection
  978. @reflection = false
  979. @invalid = false
  980. end
  981. # アイテムの場合
  982. elsif @active_battler.action.item?
  983. obj = @active_battler.action.item
  984. for target in @targets
  985. return if target == nil
  986. return if target.dead? && !obj.for_dead_friend?
  987. target.revival = true if obj.for_dead_friend?
  988. if target.hp == 0 && !obj.for_dead_friend?
  989. target.perfect_item_effect(@active_battler, obj)
  990. elsif obj.extension.include?("PERFECTHIT")
  991. target.perfect_item_effect(@active_battler, obj)
  992. else
  993. magic_reflection(target, obj) unless obj.extension.include?("IGNOREREFLECT")
  994. physics_reflection(target, obj) unless obj.extension.include?("IGNOREREFLECT")
  995. target.item_effect(@active_battler, obj) unless @reflection or @invalid
  996. end
  997. pop_damage(target, obj, action) unless @reflection or @invalid
  998. @active_battler.reflex = action if @reflection
  999. @reflection = false
  1000. @invalid = false
  1001. end
  1002. # 通常攻撃の場合
  1003. else
  1004. for target in @targets
  1005. return if target == nil or target.dead?
  1006. physics_reflection(target, nil)
  1007. target.perfect_attack_effect(@active_battler) if target.hp <= 0
  1008. target.attack_effect(@active_battler) unless target.hp <= 0 or @reflection or @invalid
  1009. pop_damage(target, nil, action) unless @reflection or @invalid
  1010. # 反射アクション取得
  1011. @active_battler.reflex = action if @reflection
  1012. @reflection = false
  1013. @invalid = false
  1014. end
  1015. end
  1016. # ステータスウインドウをリフレッシュ
  1017. @status_window.refresh
  1018. # 連続行動中のランダムターゲットを考慮し、すぐに次のターゲットを選択
  1019. return if obj == nil
  1020. target_decision(obj) if obj.extension.include?("RANDOMTARGET")
  1021. end
  1022. #--------------------------------------------------------------------------
  1023. # ● Pop Damage action = [Animation ID, Invert Flag, Allow Reaction]
  1024. #--------------------------------------------------------------------------
  1025. def pop_damage(target, obj, action)
  1026. index = @active_battler.index
  1027. actor = @active_battler.actor?
  1028. if obj != nil
  1029. # スキルやアイテムが吸収属性なら
  1030. absorb = absorb_attack(obj, target, index, actor) if obj.absorb_damage
  1031. action.push(true) if absorb == 0
  1032. # 拡張設定でダメージアクション禁止なら
  1033. action[2] = false if obj.extension.include?("NOOVERKILL")
  1034. end
  1035. # 対象のリアクション
  1036. @spriteset.set_damage_action(target.actor?, target.index, action)
  1037. end
  1038. end
  1039. #==============================================================================
  1040. # ■ Game_BattleAction
  1041. #------------------------------------------------------------------------------
  1042. #  戦闘行動を扱うクラスです。
  1043. #==============================================================================
  1044. class Game_BattleAction
  1045. #--------------------------------------------------------------------------
  1046. # * Game_BattleAction#valid? is no longer redefined
  1047. #--------------------------------------------------------------------------
  1048.  
  1049. #--------------------------------------------------------------------------
  1050. # * Create Target Array -redefinition
  1051. #--------------------------------------------------------------------------
  1052. def make_targets
  1053. if attack?
  1054. return make_attack_targets
  1055. elsif skill?
  1056. targets = make_obj_targets(skill)
  1057. targets = make_obj_targets2(skill, targets) if skill.extension != ["NONE"]
  1058. return targets
  1059. elsif item?
  1060. targets = make_obj_targets(item)
  1061. targets = make_obj_targets2(item, targets) if item.extension != ["NONE"]
  1062. return targets
  1063. end
  1064. end
  1065. #--------------------------------------------------------------------------
  1066. # ● スキルまたはアイテムのターゲット作成の拡張
  1067. #--------------------------------------------------------------------------
  1068. def make_obj_targets2(obj, targets)
  1069. if obj.extension.include?("TARGETALL")
  1070. targets = []
  1071. targets += opponents_unit.existing_members
  1072. targets += friends_unit.existing_members
  1073. end
  1074. if obj.extension.include?("OTHERS")
  1075. targets.delete($game_party.members[battler.index]) if battler.actor?
  1076. targets.delete($game_troop.members[battler.index]) unless battler.actor?
  1077. end
  1078. return targets.compact
  1079. end
  1080. end
  1081. #==============================================================================
  1082. # ■ Sprite_Base
  1083. #------------------------------------------------------------------------------
  1084. # A sprite class with animation display processing added.
  1085. #==============================================================================
  1086. class Sprite_Base < Sprite
  1087. #--------------------------------------------------------------------------
  1088. # ● Update Animation -aliased
  1089. # Allows animation to follow target if animation position is "Center"
  1090. #--------------------------------------------------------------------------
  1091. alias update_animation_n01 update_animation
  1092. def update_animation
  1093. if @animation.position == 1 # 3.4a
  1094. @animation_ox = x - ox + width / 2
  1095. @animation_oy = y - oy + height / 2
  1096. end
  1097. update_animation_n01
  1098. end
  1099. end
  1100. #==============================================================================
  1101. # ■ Spriteset_Battle
  1102. #------------------------------------------------------------------------------
  1103. # This class brings together battle screen sprites. It's used within the
  1104. # Scene_Battle class.
  1105. #==============================================================================
  1106. class Spriteset_Battle
  1107. #--------------------------------------------------------------------------
  1108. # ● エネミースプライトの作成
  1109. #--------------------------------------------------------------------------
  1110. def create_enemies
  1111. @enemy_sprites = []
  1112. for i in 0...$game_troop.members.size
  1113. @enemy_sprites.push(Sprite_Battler.new(@viewport1, $game_troop.members[i]))
  1114. @enemy_sprites[i].opacity = 0 if $game_troop.members[i].hidden
  1115. end
  1116. end
  1117. #--------------------------------------------------------------------------
  1118. # ● アクタースプライトの作成
  1119. #--------------------------------------------------------------------------
  1120. def create_actors
  1121. @actor_sprites = []
  1122. # メンバー最大数スプライトを用意
  1123. for i in 0...N01::MAX_MEMBER
  1124. @actor_sprites.push(Sprite_Battler.new(@viewport1, $game_party.members[i]))
  1125. if $game_party.members[i] != nil
  1126. @actor_sprites[i].make_battler
  1127. @actor_sprites[i].first_action
  1128. end
  1129. end
  1130. end
  1131. #--------------------------------------------------------------------------
  1132. # * Create Battlefloor Sprite -aliased
  1133. #--------------------------------------------------------------------------
  1134. alias create_battlefloor_n01 create_battlefloor
  1135. def create_battlefloor
  1136. create_battlefloor_n01
  1137. @battlefloor_sprite.x = N01::FLOOR[0]
  1138. @battlefloor_sprite.y = N01::FLOOR[1]
  1139. @battlefloor_sprite.opacity = N01::FLOOR[2]
  1140. # Mirror BattleFloor and Battleback when a surprise attack
  1141. back_attack
  1142. if $back_attack
  1143. @battlefloor_sprite.mirror = true
  1144. @battleback_sprite.mirror = true
  1145. $game_troop.surprise = true
  1146. else
  1147. $game_troop.surprise = false
  1148. end
  1149. end
  1150. #--------------------------------------------------------------------------
  1151. # ● Back Attack
  1152. #--------------------------------------------------------------------------
  1153. def back_attack
  1154. # 強制バックアタックならフラグオン
  1155. for i in 0...N01::BACK_ATTACK_SWITCH.size
  1156. return $back_attack = true if $game_switches[N01::BACK_ATTACK_SWITCH[i]]
  1157. end
  1158. # 不意打ちが発生していなければ処理を中断
  1159. return $back_attack = false unless $game_troop.surprise && N01::BACK_ATTACK
  1160. # 装備等によるバックアタック無効化をチェック
  1161. for actor in $game_party.members
  1162. return $back_attack = false if N01::NON_BACK_ATTACK_WEAPONS.include?(actor.weapon_id)
  1163. return $back_attack = false if N01::NON_BACK_ATTACK_ARMOR1.include?(actor.armor1_id)
  1164. return $back_attack = false if N01::NON_BACK_ATTACK_ARMOR2.include?(actor.armor2_id)
  1165. return $back_attack = false if N01::NON_BACK_ATTACK_ARMOR3.include?(actor.armor3_id)
  1166. return $back_attack = false if N01::NON_BACK_ATTACK_ARMOR4.include?(actor.armor4_id)
  1167. for i in 0...N01::NON_BACK_ATTACK_SKILLS.size
  1168. return $back_attack = false if actor.skill_id_learn?(N01::NON_BACK_ATTACK_SKILLS[i])
  1169. end
  1170. end
  1171. # バックアタック発生
  1172. $back_attack = true
  1173. end
  1174. #--------------------------------------------------------------------------
  1175. # ● Update Actors -redefined
  1176. #--------------------------------------------------------------------------
  1177. def update_actors
  1178. for i in 0...@actor_sprites.size
  1179. if $party_change
  1180. $party_change = false
  1181. dispose_actors
  1182. return create_actors
  1183. end
  1184. if @actor_sprites[i].battler.id != $game_party.members[i].id
  1185. dispose_actors
  1186. return create_actors
  1187. end
  1188. @actor_sprites[i].update
  1189. end
  1190. end
  1191. #--------------------------------------------------------------------------
  1192. # ● ダメージアクションセット 
  1193. #--------------------------------------------------------------------------
  1194. def set_damage_action(actor, index, action)
  1195. @actor_sprites[index].damage_action(action) if actor
  1196. @enemy_sprites[index].damage_action(action) unless actor
  1197. end
  1198. #--------------------------------------------------------------------------
  1199. # ● ダメージPOPセット 
  1200. #--------------------------------------------------------------------------
  1201. def set_damage_pop(actor, index, damage)
  1202. @actor_sprites[index].damage_pop(damage) if actor
  1203. @enemy_sprites[index].damage_pop(damage) unless actor
  1204. end
  1205. #--------------------------------------------------------------------------
  1206. # ● ターゲットセット
  1207. #--------------------------------------------------------------------------
  1208. def set_target(actor, index, target)
  1209. @actor_sprites[index].get_target(target) if actor
  1210. @enemy_sprites[index].get_target(target) unless actor
  1211. end
  1212. #--------------------------------------------------------------------------
  1213. # ● アクションセット
  1214. #--------------------------------------------------------------------------
  1215. def set_action(actor, index, kind)
  1216. @actor_sprites[index].start_action(kind) if actor
  1217. @enemy_sprites[index].start_action(kind) unless actor
  1218. end
  1219. #--------------------------------------------------------------------------
  1220. # ● 待機アクションセット
  1221. #--------------------------------------------------------------------------
  1222. def set_stand_by_action(actor, index)
  1223. @actor_sprites[index].push_stand_by if actor
  1224. @enemy_sprites[index].push_stand_by unless actor
  1225. end
  1226. #--------------------------------------------------------------------------
  1227. # ● カーソル移動のセット
  1228. #--------------------------------------------------------------------------
  1229. def set_cursor(actor, index)
  1230. return [@actor_sprites[index].x + N01::CURSOR_X_PLUS, @actor_sprites[index].y + N01::CURSOR_Y_PLUS] if actor
  1231. return [@enemy_sprites[index].x + N01::CURSOR_X_PLUS, @enemy_sprites[index].y + N01::CURSOR_Y_PLUS] unless actor
  1232. end
  1233. end
  1234. #==============================================================================
  1235. # ■ Sprite_MoveAnime
  1236. #------------------------------------------------------------------------------
  1237. #  アニメ飛ばし用のスプライトです。
  1238. #==============================================================================
  1239. class Sprite_MoveAnime < Sprite_Base
  1240. #--------------------------------------------------------------------------
  1241. # ● 公開インスタンス変数
  1242. #--------------------------------------------------------------------------
  1243. attr_accessor :battler
  1244. attr_accessor :base_x # Base X coordinate
  1245. attr_accessor :base_y # Base Y coordinate
  1246. #--------------------------------------------------------------------------
  1247. # ● オブジェクト初期化
  1248. #--------------------------------------------------------------------------
  1249. def initialize(viewport,battler = nil)
  1250. super(viewport)
  1251. @battler = battler
  1252. self.visible = false
  1253. @base_x = 0
  1254. @base_y = 0
  1255. @move_x = 0 # 動かしたX座標
  1256. @move_y = 0 # 動かしたY座標
  1257. @moving_x = 0 # 1フレーム当たり動かすX座標
  1258. @moving_y = 0 # 1フレーム当たり動かすY座標
  1259. @orbit = 0 # 円軌道
  1260. @orbit_plus = 0 # 加算する円軌道
  1261. @orbit_time = 0 # 円軌道計算時間
  1262. @through = false # 貫通するかどうか
  1263. @finish = false # 移動終了フラグ
  1264. @time = 0 # 移動時間
  1265. @angle = 0 # 武器の角度
  1266. @angling = 0 # 1フレーム当たり動かす武器の角度
  1267. end
  1268. #--------------------------------------------------------------------------
  1269. # ● アクションを取得
  1270. #--------------------------------------------------------------------------
  1271. def anime_action(id,mirror,distanse_x,distanse_y,type,speed,orbit,weapon,icon_index,icon_weapon)
  1272. # Distance calculation per frame
  1273. @time = speed
  1274. @moving_x = distanse_x / speed
  1275. @moving_y = distanse_y / speed
  1276. # Can animation can pass through target?
  1277. @through = true if type == 1
  1278. # 円軌道を取得
  1279. @orbit_plus = orbit
  1280. @orbit_time = @time
  1281. # If a weapon graphic is used
  1282. if weapon != ""
  1283. action = N01::ANIME[weapon].dup
  1284. @angle = action[0]
  1285. end_angle = action[1]
  1286. time = action[2]
  1287. # if battler is an enemy and not in a back attack 3.4a
  1288. if !battler.actor? && !$back_attack
  1289. # Invert angles of flying graphic and mirror it
  1290. @angle *= -1
  1291. end_angle *= -1
  1292. mirror = true
  1293. end
  1294. # if back attack, invert defined angles 3.4a
  1295. if $back_attack
  1296. @angle *= -1 unless !battler.actor?
  1297. end_angle *= -1 unless !battler.actor?
  1298. mirror = true if battler.actor?
  1299. mirror = false if !battler.actor?
  1300. end
  1301. # 1フレームあたりの回転角度を出す
  1302. @angling = (end_angle - @angle)/ time
  1303. # 開始角度を取る
  1304. self.angle = @angle
  1305. # 武器グラフィックを表示
  1306. self.mirror = mirror
  1307. if icon_weapon
  1308. self.bitmap = Cache.system("Iconset")
  1309. self.src_rect.set(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  1310. self.ox = 12
  1311. self.oy = 12
  1312. else
  1313. self.bitmap = Cache.character(icon_index)
  1314. self.ox = self.bitmap.width / 2
  1315. self.oy = self.bitmap.height / 2
  1316. end
  1317. self.visible = true
  1318. # バトラーより手前に表示
  1319. self.z = 1000
  1320. end
  1321. # 最初は動かさず一回だけ表示
  1322. self.x = @base_x + @move_x
  1323. self.y = @base_y + @move_y + @orbit
  1324. if id != 0
  1325. animation = $data_animations[id]
  1326. start_animation(animation, mirror)
  1327. end
  1328. end
  1329. #--------------------------------------------------------------------------
  1330. # ● 変化した動きをリセット
  1331. #--------------------------------------------------------------------------
  1332. def action_reset
  1333. @moving_x = @moving_y = @move_x = @move_y = @base_x = @base_y = @orbit = 0
  1334. @orbit_time = @angling = @angle = 0
  1335. @through = self.visible = @finish = false
  1336. dispose_animation
  1337. end
  1338. #--------------------------------------------------------------------------
  1339. # ● 貫通終了
  1340. #--------------------------------------------------------------------------
  1341. def finish?
  1342. return @finish
  1343. end
  1344. #--------------------------------------------------------------------------
  1345. # ● フレーム更新
  1346. #--------------------------------------------------------------------------
  1347. def update
  1348. super
  1349. # 時間消費
  1350. @time -= 1
  1351. # 時間まで指定の動きを
  1352. if @time >= 0
  1353. @move_x += @moving_x
  1354. @move_y += @moving_y
  1355. # 円軌道計算
  1356. if @time < @orbit_time / 2
  1357. @orbit_plus = @orbit_plus * 5 / 4
  1358. elsif @time == @orbit_time / 2
  1359. @orbit_plus *= -1
  1360. else
  1361. @orbit_plus = @orbit_plus * 2 / 3
  1362. end
  1363. @orbit += @orbit_plus
  1364. end
  1365. # 時間がきても貫通ならそのまま直進
  1366. @time = 100 if @time < 0 && @through
  1367. @finish = true if @time < 0 && !@through
  1368. # スプライトの座標を更新
  1369. self.x = @base_x + @move_x
  1370. self.y = @base_y + @move_y + @orbit
  1371. # 貫通の場合、画面から消えたら終了フラグオン
  1372. if self.x < -200 or self.x > 840 or self.y < -200 or self.y > 680
  1373. @finish = true
  1374. end
  1375. # 武器グラフィック更新
  1376. if self.visible
  1377. @angle += @angling
  1378. self.angle = @angle
  1379. end
  1380. end
  1381. end
  1382. #==============================================================================
  1383. # ■ Sprite_Weapon
  1384. #------------------------------------------------------------------------------
  1385. #  ウエポン表示用のスプライトです。
  1386. #==============================================================================
  1387. class Sprite_Weapon < Sprite_Base
  1388. #--------------------------------------------------------------------------
  1389. # ● 公開インスタンス変数
  1390. #--------------------------------------------------------------------------
  1391. attr_accessor :battler
  1392. #--------------------------------------------------------------------------
  1393. # ● オブジェクト初期化
  1394. #--------------------------------------------------------------------------
  1395. def initialize(viewport,battler = nil)
  1396. super(viewport)
  1397. @battler = battler
  1398. @action = [] # 武器のアクション情報
  1399. @move_x = 0 # 動かしたX座標
  1400. @move_y = 0 # 動かしたY座標
  1401. @move_z = 0 # 動かしたZ座標
  1402. @plus_x = 0 # 微調整分のX座標
  1403. @plus_y = 0 # 微調整分のY座標
  1404. @angle = 0 # 武器の回転角度
  1405. @zoom_x = 1 # 武器の横拡大率
  1406. @zoom_y = 1 # 武器の縦拡大率
  1407. @moving_x = 0 # 1フレーム当たり動かすX座標
  1408. @moving_y = 0 # 1フレーム当たり動かすY座標
  1409. @angling = 0 # 1フレーム当たりの回転角度
  1410. @zooming_x = 1 # 1フレーム当たりの横拡大率
  1411. @zooming_y = 1 # 1フレーム当たりの縦拡大率
  1412. @freeze = -1 # 固定アニメ用武器位置
  1413. @mirroring = false # バトラーが反転しているか
  1414. @time = N01::ANIME_PATTERN + 1 # 更新回数
  1415. # 武器を取得
  1416. weapon_graphics
  1417. end
  1418. #--------------------------------------------------------------------------
  1419. # ● 解放
  1420. #--------------------------------------------------------------------------
  1421. def dispose
  1422. self.bitmap.dispose if self.bitmap != nil
  1423. super
  1424. end
  1425. #--------------------------------------------------------------------------
  1426. # ● 武器を取得
  1427. #--------------------------------------------------------------------------
  1428. def weapon_graphics(left = false)
  1429. if @battler.actor?
  1430. weapon = @battler.weapons[0] unless left
  1431. weapon = @battler.weapons[1] if left
  1432. else
  1433. weapon = $data_weapons[@battler.weapon]
  1434. end
  1435. # 武器がなければ処理をキャンセル
  1436. return if weapon == nil
  1437. # アイコンを利用するなら
  1438. if weapon.graphic == ""
  1439. icon_index = weapon.icon_index
  1440. self.bitmap = Cache.system("Iconset")
  1441. self.src_rect.set(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  1442. @weapon_width = @weapon_height = 24
  1443. # ID指定があったら、アイコンではなくそのグラフィックを取得
  1444. else
  1445. self.bitmap = Cache.character(weapon.graphic)
  1446. @weapon_width = self.bitmap.width
  1447. @weapon_height = self.bitmap.height
  1448. end
  1449. end
  1450. #--------------------------------------------------------------------------
  1451. # ● アニメ固定時の武器位置を取得
  1452. #--------------------------------------------------------------------------
  1453. def freeze(action)
  1454. @freeze = action
  1455. end
  1456. #--------------------------------------------------------------------------
  1457. # ● 武器アクションを取得 freeze
  1458. #--------------------------------------------------------------------------
  1459. def weapon_action(action,loop)
  1460. # 名称がない場合は非表示に
  1461. if action == ""
  1462. self.visible = false
  1463. # 素手なら非表示に
  1464. elsif @weapon_id == 0
  1465. self.visible = false
  1466. # 武器アクション情報を受け取る
  1467. else
  1468. @action = N01::ANIME[action]
  1469. act0 = @action[0]
  1470. act1 = @action[1]
  1471. act2 = @action[2]
  1472. act3 = @action[3]
  1473. act4 = @action[4]
  1474. act5 = @action[5]
  1475. act6 = @action[6]
  1476. act7 = @action[7]
  1477. act8 = @action[8]
  1478. act9 = @action[9]
  1479. act10 = @action[10]
  1480. # バトラーが反転してる場合、X軸の動きを逆に
  1481. if @mirroring
  1482. act0 *= -1
  1483. act3 *= -1
  1484. act4 *= -1
  1485. act9 *= -1
  1486. end
  1487. # キャラのアニメパターン数をチェック
  1488. time = N01::ANIME_PATTERN
  1489. # Z座標をチェック
  1490. if act2
  1491. self.z = @battler.position_z + 1
  1492. else
  1493. self.z = @battler.position_z - 1
  1494. end
  1495. # 反転はここで実行し、すでに反転している場合は元に戻す
  1496. if act6
  1497. if self.mirror
  1498. self.mirror = false
  1499. else
  1500. self.mirror = true
  1501. end
  1502. end
  1503. # バトラーの反転を反映
  1504. if @mirroring
  1505. if self.mirror
  1506. self.mirror = false
  1507. else
  1508. self.mirror = true
  1509. end
  1510. end
  1511. # アニメパターン数で割った変化を計算
  1512. @moving_x = act0 / time
  1513. @moving_y = act1 / time
  1514. # 最初の角度を代入 Assign first angle
  1515. @angle = act3
  1516. self.angle = @angle
  1517. # 更新角度を計算 Update angle calculation
  1518. @angling = (act4 - act3)/ time
  1519. # 角度が割り切れない場合、ここで余り分を回転加算 If angle is divided evenly
  1520. @angle += (act4 - act3) % time
  1521. # Weapon sprite scaling
  1522. @zooming_x = (1 - act7) / time
  1523. @zooming_y = (1 - act8) / time
  1524. # 反転してる場合、回転元の原点を逆に
  1525. if self.mirror
  1526. case act5
  1527. when 1 # 左上→右上に
  1528. act5 = 2
  1529. when 2 # 右上→左上に
  1530. act5 = 1
  1531. when 3 # 左下→右下に
  1532. act5 = 4
  1533. when 4 # 右下→左下に
  1534. act5 = 3
  1535. end
  1536. end
  1537. # 回転元の原点を設定
  1538. case act5
  1539. when 0 # 中心
  1540. self.ox = @weapon_width / 2
  1541. self.oy = @weapon_height / 2
  1542. when 1 # 左上
  1543. self.ox = 0
  1544. self.oy = 0
  1545. when 2 # 右上
  1546. self.ox = @weapon_width
  1547. self.oy = 0
  1548. when 3 # 左下
  1549. self.ox = 0
  1550. self.oy = @weapon_height
  1551. when 4 # 右下
  1552. self.ox = @weapon_width
  1553. self.oy = @weapon_height
  1554. end
  1555. # 座標微調整
  1556. @plus_x = act9
  1557. @plus_y = act10
  1558. # 往復ループならフラグオン
  1559. @loop = true if loop == 0
  1560. # 初回で0から始まるように、この時点で-1回の動きをさせる
  1561. @angle -= @angling
  1562. @zoom_x -= @zooming_x
  1563. @zoom_y -= @zooming_y
  1564. # スプライトの座標を更新
  1565. @move_x -= @moving_x
  1566. @move_y -= @moving_y
  1567. @move_z = 1000 if act2
  1568. # 固定アニメの場合、この時点で動きを消化
  1569. if @freeze != -1
  1570. for i in 0..@freeze + 1
  1571. @angle += @angling
  1572. @zoom_x += @zooming_x
  1573. @zoom_y += @zooming_y
  1574. # スプライトの座標を更新
  1575. @move_x += @moving_x
  1576. @move_y += @moving_y
  1577. end
  1578. @angling = 0
  1579. @zooming_x = 0
  1580. @zooming_y = 0
  1581. @moving_x = 0
  1582. @moving_y = 0
  1583. end
  1584. # 可視
  1585. self.visible = true
  1586. end
  1587. end
  1588. #--------------------------------------------------------------------------
  1589. # ● 変化した動きを全部リセット
  1590. #--------------------------------------------------------------------------
  1591. def action_reset
  1592. @moving_x = @moving_y = @move_x = @move_y = @plus_x = @plus_y = 0
  1593. @angling = @zooming_x = @zooming_y = @angle = self.angle = @move_z = 0
  1594. @zoom_x = @zoom_y = self.zoom_x = self.zoom_y = 1
  1595. self.mirror = self.visible = @loop = false
  1596. @freeze = -1
  1597. @action = []
  1598. @time = N01::ANIME_PATTERN + 1
  1599. end
  1600. #--------------------------------------------------------------------------
  1601. # ● 往復ループさせる
  1602. #--------------------------------------------------------------------------
  1603. def action_loop
  1604. # 動きを反対に
  1605. @angling *= -1
  1606. @zooming_x *= -1
  1607. @zooming_y *= -1
  1608. @moving_x *= -1
  1609. @moving_y *= -1
  1610. end
  1611. #--------------------------------------------------------------------------
  1612. # ● アクターが反転している場合、自身も反転させる
  1613. #--------------------------------------------------------------------------
  1614. def mirroring
  1615. return @mirroring = false if @mirroring
  1616. @mirroring = true
  1617. end
  1618. #--------------------------------------------------------------------------
  1619. # ● アクターアニメが更新された時のみ武器アクションの変化を更新
  1620. #--------------------------------------------------------------------------
  1621. def action
  1622. return if @time <= 0
  1623. @time -= 1
  1624. # 回転、拡大縮小を更新
  1625. @angle += @angling
  1626. @zoom_x += @zooming_x
  1627. @zoom_y += @zooming_y
  1628. # スプライトの座標を更新
  1629. @move_x += @moving_x
  1630. @move_y += @moving_y
  1631. # 往復ループなら動きを反転
  1632. if @loop && @time == 0
  1633. @time = N01::ANIME_PATTERN + 1
  1634. action_loop
  1635. end
  1636. end
  1637. #--------------------------------------------------------------------------
  1638. # ● フレーム更新
  1639. #--------------------------------------------------------------------------
  1640. def update
  1641. super
  1642. # 回転、拡大縮小を更新
  1643. self.angle = @angle
  1644. self.zoom_x = @zoom_x
  1645. self.zoom_y = @zoom_y
  1646. # スプライトの座標を更新
  1647. self.x = @battler.position_x + @move_x + @plus_x
  1648. self.y = @battler.position_y + @move_y + @plus_y
  1649. self.z = @battler.position_z + @move_z - 1
  1650. end
  1651. end
  1652.  
  1653. #==============================================================================
  1654. # ■ Game_Battler (分割定義 1)
  1655. #------------------------------------------------------------------------------
  1656. #  バトラーを扱うクラスです。
  1657. #==============================================================================
  1658. class Game_Battler
  1659. #--------------------------------------------------------------------------
  1660. # ● 公開インスタンス変数
  1661. #--------------------------------------------------------------------------
  1662. attr_accessor :hp_damage # 行動結果: HP ダメージ
  1663. attr_accessor :mp_damage # 行動結果: MP ダメージ
  1664. attr_accessor :move_x # X方向の移動補正
  1665. attr_accessor :move_y # Y方向の移動補正
  1666. attr_accessor :move_z # Z方向の移動補正
  1667. attr_accessor :jump # ジャンプ補正
  1668. attr_accessor :active # アクティブか
  1669. attr_accessor :non_dead # 不死身フラグ
  1670. attr_accessor :dying # 即死フラグ
  1671. attr_accessor :slip_damage # スリップダメージフラグ
  1672. attr_accessor :derivation # スキル派生ID
  1673. attr_accessor :individual # スキル派生ID
  1674. attr_accessor :play # アクション情報
  1675. attr_accessor :force_action # 強制されるアクション情報
  1676. attr_accessor :force_target # ターゲット変更情報
  1677. attr_accessor :revival # 復活
  1678. attr_accessor :double_damage # HPMP両方同時ダメージ
  1679. attr_accessor :reflex # スキル反射情報
  1680. attr_accessor :absorb # スキルコスト吸収
  1681. attr_reader :base_position_x # 初期配置X座標
  1682. attr_reader :base_position_y # 初期配置Y座標
  1683. attr_accessor :force_damage # イベントでのダメージ
  1684. attr_accessor :graphics_width # Battler graphic width per cell (from ATB)
  1685. attr_accessor :graphics_height # Battler graphic height per cell (from ATB)
  1686. #--------------------------------------------------------------------------
  1687. # ● オブジェクト初期化
  1688. #--------------------------------------------------------------------------
  1689. alias initialize_n01 initialize
  1690. def initialize
  1691. initialize_n01
  1692. @move_x = @move_y = @move_z = @plus_y = @jump = @derivation = @play = 0
  1693. @force_action = @force_target = @base_position_x = @base_position_y = 0
  1694. @absorb = @act_time = @force_damage = 0 # 3.4a
  1695. @active = @individual = @slip_damage = @revival = false # removed ref to @non_dead 3.3c
  1696. @double_damage = @dying = false
  1697. @non_dead = @immortal # object initilization, sync @non_dead and @immortal 3.3c
  1698. end
  1699. #--------------------------------------------------------------------------
  1700. # ● Set Immortality Temporarily
  1701. #--------------------------------------------------------------------------
  1702. def set_temp_immortal(flag = true) # New method, 3.3c
  1703. # set immortality temporarily, used from the SBS scripts
  1704. @immortal = flag # ONLY @immortal is set, @non_dead is not touched
  1705. end
  1706. #--------------------------------------------------------------------------
  1707. # ● standard accessor for @immortal
  1708. #--------------------------------------------------------------------------
  1709. alias immortal_set_SBS immortal=
  1710. def immortal=(flag) # standard accessor for @immortal
  1711. @immortal = flag
  1712. @non_dead = flag # when the standard accessor is used (eg., from OUTSIDE the
  1713. # SBS scripts, Game_Troop#setup, etc.), the @non_dead flag is also set.
  1714. end
  1715. N01::IMMORTALITY_CHANGING_METHODS.each {|m|
  1716. aStr = %Q(
  1717. if method_defined?(:#{m}) && !method_defined?(:aliased_immortal_#{m})
  1718. alias :aliased_immortal_#{m} :#{m}
  1719. def #{m}(*args)
  1720. val = aliased_immortal_#{m}(*args)
  1721. @non_dead = @immortal
  1722. return val
  1723. end
  1724. end
  1725. )
  1726. module_eval(aStr)
  1727. # makes an alias for the given methods, syncs @non_dead with
  1728. # @immortal after the method is run, and perserves the return value and argv
  1729. }
  1730. #--------------------------------------------------------------------------
  1731. # ● 一番新しいステートIDを返す
  1732. #--------------------------------------------------------------------------
  1733. def state_id
  1734. return @states[@states.size - 1]
  1735. end
  1736. #--------------------------------------------------------------------------
  1737. # ++ Consume skill cost
  1738. # No longer used in execute_action_skill and is replaced by the default
  1739. # method of consuming MP.
  1740. #--------------------------------------------------------------------------
  1741. # def consum_skill_cost(skill)
  1742. # return false unless skill_can_use?(skill)
  1743. # cost = calc_mp_cost(skill)
  1744. # return self.hp -= cost if skill.extension.include?("CONSUMEHP")
  1745. # return self.mp -= cost
  1746. # end
  1747. #--------------------------------------------------------------------------
  1748. # ● 通常攻撃によるダメージ計算 二刀流補正
  1749. #--------------------------------------------------------------------------
  1750. # alias make_attack_damage_value_n01 make_attack_damage_value
  1751. # def make_attack_damage_value(attacker)
  1752. # make_attack_damage_value_n01(attacker)
  1753. # # 二本の武器を装備しているときのみ補正を有効に
  1754. # return unless attacker.actor?
  1755. # return if attacker.weapons[0] == nil
  1756. # return if attacker.weapons[1] == nil
  1757. # @hp_damage = @hp_damage * N01::TWO_SWORDS_STYLE[0] / 100
  1758. # end
  1759. #--------------------------------------------------------------------------
  1760. # ● スキルまたはアイテムによるダメージ計算 二刀流補正
  1761. #--------------------------------------------------------------------------
  1762. # alias make_obj_damage_value_n01 make_obj_damage_value
  1763. # def make_obj_damage_value(user, obj)
  1764. # make_obj_damage_value_n01(user, obj)
  1765. # # 二本の武器を装備しているときのみ補正を有効に
  1766. # return unless user.actor?
  1767. # return if user.weapons[0] == nil
  1768. # return if user.weapons[1] == nil
  1769. # Edited 3.4a
  1770. # if obj is a normal attack
  1771. # if obj == nil
  1772. # if obj.damage_to_mp
  1773. # @mp_damage = @mp_damage * N01::TWO_SWORDS_STYLE[1] / 100 # MP にダメージ
  1774. # else
  1775. # @hp_damage = @hp_damage * N01::TWO_SWORDS_STYLE[1] / 100 # HP にダメージ
  1776. # end
  1777. # end
  1778. # end
  1779. #--------------------------------------------------------------------------
  1780. # ● 通常攻撃の効果適用 すでに戦闘不能で絶対に回避できない処理
  1781. #--------------------------------------------------------------------------
  1782. def perfect_attack_effect(attacker)
  1783. clear_action_results
  1784. make_attack_damage_value(attacker) # ダメージ計算
  1785. execute_damage(attacker) # ダメージ反映
  1786. apply_state_changes(attacker) # ステート変化
  1787. end
  1788. #--------------------------------------------------------------------------
  1789. # ● スキルの効果適用 すでに戦闘不能で絶対に回避できない処理
  1790. #--------------------------------------------------------------------------
  1791. def perfect_skill_effect(user, skill)
  1792. clear_action_results
  1793. make_obj_damage_value(user, skill) # ダメージ計算
  1794. make_obj_absorb_effect(user, skill) # 吸収効果計算
  1795. execute_damage(user) # ダメージ反映
  1796. apply_state_changes(skill) # ステート変化
  1797. end
  1798. #--------------------------------------------------------------------------
  1799. # ● アイテムの効果適用 すでに戦闘不能で絶対に回避できない処理
  1800. #--------------------------------------------------------------------------
  1801. def perfect_item_effect(user, item)
  1802. clear_action_results
  1803. hp_recovery = calc_hp_recovery(user, item) # HP 回復量計算
  1804. mp_recovery = calc_mp_recovery(user, item) # MP 回復量計算
  1805. make_obj_damage_value(user, item) # ダメージ計算
  1806. @hp_damage -= hp_recovery # HP 回復量を差し引く
  1807. @mp_damage -= mp_recovery # MP 回復量を差し引く
  1808. make_obj_absorb_effect(user, item) # 吸収効果計算
  1809. execute_damage(user) # ダメージ反映
  1810. item_growth_effect(user, item) # 成長効果適用
  1811. if item.physical_attack and @hp_damage == 0 # 物理ノーダメージ判定
  1812. return
  1813. end
  1814. apply_state_changes(item) # ステート変化
  1815. end
  1816. #--------------------------------------------------------------------------
  1817. # ● ダメージの反映
  1818. #--------------------------------------------------------------------------
  1819. alias execute_damage_n01 execute_damage
  1820. def execute_damage(user)
  1821. execute_damage_n01(user)
  1822. # 吸収の場合ここで処理を相殺
  1823. if @absorbed
  1824. user.hp_damage = -@hp_damage
  1825. user.mp_damage = -@mp_damage
  1826. end
  1827. end
  1828. #--------------------------------------------------------------------------
  1829. # * Apply Skill Effects
  1830. # user : Skill user
  1831. # obj : skill
  1832. #--------------------------------------------------------------------------
  1833. alias skill_effect_n01 skill_effect
  1834. def skill_effect(user, obj)
  1835. # 変化前のHPMPを保持
  1836. nowhp = self.hp
  1837. nowmp = self.mp
  1838. # 現在HPMP威力計算用に変化前の使用者HPMPを取得
  1839. # 拡張設定チェック
  1840. # check_extension(obj)
  1841. # ダメージ計算
  1842. skill_effect_n01(user, obj)
  1843. # ダメージ系の拡張がある場合ここで処理を相殺
  1844. if @extension
  1845. self.hp = nowhp
  1846. self.mp = nowmp
  1847. end
  1848. # 攻撃が当たっていない場合は処理中断
  1849. return if self.evaded or self.missed
  1850. # ダメージ属性変換
  1851. damage = @hp_damage unless obj.damage_to_mp
  1852. damage = @mp_damage if obj.damage_to_mp
  1853. # 割合ダメージ
  1854. if @ratio_maxdamage != nil
  1855. damage = self.maxhp * @ratio_maxdamage / 100 unless obj.damage_to_mp
  1856. damage = self.maxmp * @ratio_maxdamage / 100 if obj.damage_to_mp
  1857. damage = damage * elements_max_rate(obj.element_set) / 100 # 3.3c, elemental adjustment
  1858. end
  1859. if @ratio_nowdamage != nil
  1860. damage = self.hp * @ratio_nowdamage / 100 unless obj.damage_to_mp
  1861. damage = self.mp * @ratio_nowdamage / 100 if obj.damage_to_mp
  1862. damage = damage * elements_max_rate(obj.element_set) / 100 # 3.3c, elemental adjustment
  1863. end
  1864. # # コスト威力
  1865. # if @cost_damage
  1866. # cost = user.calc_mp_cost(obj)
  1867. # if obj.extension.include?("CONSUMEHP")
  1868. # damage = damage * cost / user.maxhp
  1869. # else
  1870. # damage = damage * cost / user.maxmp
  1871. # end
  1872. # end
  1873. # 現在HP威力
  1874. # damage = damage * user_hp / user.maxhp if @nowhp_damage
  1875. # 現在MP威力
  1876. # damage = damage * user_mp / user.maxmp if @nowmp_damage
  1877. # ダメージ属性変換戻し
  1878. @hp_damage = damage unless obj.damage_to_mp
  1879. @mp_damage = damage if obj.damage_to_mp
  1880. # 拡張反映
  1881. if @extension
  1882. self.hp -= @hp_damage
  1883. self.mp -= @mp_damage
  1884. end
  1885. # 初期化
  1886. @extension = false
  1887. @cost_damage = false
  1888. @nowhp_damage = false
  1889. @nowmp_damage = false
  1890. @ratio_maxdamage = nil
  1891. @ratio_nowdamage = nil
  1892. end
  1893. #--------------------------------------------------------------------------
  1894. # ● Check Skill Extentions
  1895. #--------------------------------------------------------------------------
  1896. # def check_extension(skill)
  1897. # for ext in skill.extension
  1898. # # コスト威力
  1899. # if ext == "COSTPOWER"
  1900. # @extension = true
  1901. # next @cost_damage = true
  1902. # # 現在HP威力
  1903. # if ext == "HPNOWPOWER"
  1904. # @extension = true
  1905. # next @nowhp_damage = true
  1906. # # 現在MP威力
  1907. # elsif ext == "MPNOWPOWER"
  1908. # @extension = true
  1909. # next @nowmp_damage = true
  1910. # else
  1911. # # 割合ダメージ
  1912. # name = ext.split('')
  1913. # if name[7] == "M"
  1914. # name = name.join
  1915. # name.slice!("%DAMAGEMAX/")
  1916. # @extension = true
  1917. # next @ratio_maxdamage = name.to_i
  1918. # elsif name[7] == "N"
  1919. # name = name.join
  1920. # name.slice!("%DAMAGENOW/")
  1921. # @extension = true
  1922. # next @ratio_nowdamage = name.to_i
  1923. # end
  1924. # end
  1925. # end
  1926. # end
  1927. #--------------------------------------------------------------------------
  1928. # ● 初期配置の変更
  1929. #--------------------------------------------------------------------------
  1930. def change_base_position(x, y)
  1931. @base_position_x = x
  1932. @base_position_y = y
  1933. end
  1934. #--------------------------------------------------------------------------
  1935. # ● 初期化
  1936. #--------------------------------------------------------------------------
  1937. def reset_coordinate
  1938. @move_x = @move_y = @move_z = @jump = @derivation = 0
  1939. @active = @individual = false # removed reference to non_dead, 3.3c
  1940. end
  1941. #--------------------------------------------------------------------------
  1942. # ● スリップダメージの効果適用
  1943. #--------------------------------------------------------------------------
  1944. def slip_damage_effect
  1945. if slip_damage? and @hp > 0
  1946. @hp_damage = apply_variance(maxhp / 10, 10)
  1947. @hp_damage = @hp - 1 if @hp_damage >= @hp
  1948. self.hp -= @hp_damage
  1949. end
  1950. end
  1951. #--------------------------------------------------------------------------
  1952. # ● イベントでのダメージPOP
  1953. #--------------------------------------------------------------------------
  1954. def damage_num(num = nil)
  1955. return if dead? or !$game_temp.in_battle or num == 0
  1956. @force_damage = num
  1957. end
  1958. end
  1959.  
  1960. #==============================================================================
  1961. # ■ Game_Actor
  1962. #------------------------------------------------------------------------------
  1963. #  アクターを扱うクラスです。
  1964. #==============================================================================
  1965. class Game_Actor < Game_Battler
  1966. #--------------------------------------------------------------------------
  1967. # ● 公開インスタンス変数
  1968. #--------------------------------------------------------------------------
  1969. attr_accessor :two_swords_change # 二刀流強制持ち替えフラグ
  1970. #--------------------------------------------------------------------------
  1971. # ● IDによるスキルの習得済み判定
  1972. #--------------------------------------------------------------------------
  1973. def skill_id_learn?(skill_id)
  1974. return @skills.include?(skill_id)
  1975. end
  1976. #--------------------------------------------------------------------------
  1977. # ● スキルの使用可能判定 ※再定義
  1978. #--------------------------------------------------------------------------
  1979. def skill_can_use?(skill)
  1980. return super
  1981. end
  1982. #--------------------------------------------------------------------------
  1983. # ● グラフィックの変更
  1984. #--------------------------------------------------------------------------
  1985. def graphic_change(character_name)
  1986. @character_name = character_name
  1987. end
  1988. #--------------------------------------------------------------------------
  1989. # ● コラプスの実行 ※再定義
  1990. #--------------------------------------------------------------------------
  1991. def perform_collapse
  1992. Sound.play_actor_collapse if $game_temp.in_battle and dead?
  1993. end
  1994. #--------------------------------------------------------------------------
  1995. # ++ Battle Start Positioning
  1996. #--------------------------------------------------------------------------
  1997. def base_position
  1998. base = N01::ACTOR_POSITION[self.index]
  1999. @base_position_x = base[0]
  2000. @base_position_y = base[1]
  2001. # バックアタック時はX軸を逆に
  2002. @base_position_x = Graphics.width - base[0] if $back_attack && N01::BACK_ATTACK
  2003. end
  2004. #--------------------------------------------------------------------------
  2005. # ● バトル画面 X 座標の取得
  2006. #--------------------------------------------------------------------------
  2007. def position_x
  2008. return 0 if self.index == nil
  2009. return @base_position_x + @move_x
  2010. end
  2011. #--------------------------------------------------------------------------
  2012. # ● バトル画面 Y 座標の取得
  2013. #--------------------------------------------------------------------------
  2014. def position_y
  2015. return 0 if self.index == nil
  2016. return @base_position_y + @move_y + @jump
  2017. end
  2018. #--------------------------------------------------------------------------
  2019. # ● バトル画面 Z 座標の取得
  2020. #--------------------------------------------------------------------------
  2021. def position_z
  2022. return 0 if self.index == nil
  2023. return self.index + @base_position_y + @move_y + @move_z - @jump + 200
  2024. end
  2025. end
  2026. #==============================================================================
  2027. # ■ Game_Enemy
  2028. #------------------------------------------------------------------------------
  2029. #  エネミーを扱うクラスです。
  2030. #==============================================================================
  2031. class Game_Enemy < Game_Battler
  2032. #--------------------------------------------------------------------------
  2033. # ● 公開インスタンス変数
  2034. #--------------------------------------------------------------------------
  2035. attr_accessor :adj_speed # 複数回行動の速度補正
  2036. attr_accessor :act_time # 行動数回
  2037. #--------------------------------------------------------------------------
  2038. # ● アクションスピードの決定 複数回行動用
  2039. #--------------------------------------------------------------------------
  2040. def make_action_speed2(adj)
  2041. @adj_speed = self.action.speed if @adj_speed == nil
  2042. @adj_speed = @adj_speed * adj / 100
  2043. end
  2044. #--------------------------------------------------------------------------
  2045. # ● コラプスの実行 ※再定義
  2046. #--------------------------------------------------------------------------
  2047. def perform_collapse
  2048. @force_action = ["N01collapse"] if $game_temp.in_battle and dead?
  2049. end
  2050. #--------------------------------------------------------------------------
  2051. # ++ Base Screen Position (and bitmap height)
  2052. #--------------------------------------------------------------------------
  2053. def base_position
  2054. return if self.index == nil
  2055. # バトラー画像のサイズをチェックしY座標を修正
  2056. bitmap = Bitmap.new("Graphics/Battlers/" + @battler_name) if !self.anime_on
  2057. bitmap = Bitmap.new("Graphics/Characters/" + @battler_name) if self.anime_on && N01::WALK_ANIME
  2058. bitmap = Bitmap.new("Graphics/Characters/" + @battler_name + "_1") if self.anime_on && !N01::WALK_ANIME
  2059. height = bitmap.height
  2060. @base_position_x = self.screen_x + self.position_plus[0]
  2061. # 3.4a
  2062. # Animated enemies
  2063. if self.anime_on
  2064. frame_height = height / N01::ANIME_KIND
  2065. @base_position_y = self.screen_y + self.position_plus[1] - frame_height / 3 # 3.4a
  2066. # Default battlers
  2067. else
  2068. @base_position_y = self.screen_y + self.position_plus[1] - height / 3 # 3.4a
  2069. end
  2070. bitmap.dispose
  2071. # バックアタック時はX軸を逆に
  2072. if $back_attack && N01::BACK_ATTACK
  2073. @base_position_x = Graphics.width - self.screen_x - self.position_plus[0]
  2074. end
  2075. end
  2076. #--------------------------------------------------------------------------
  2077. # ● バトル画面 X 座標の取得
  2078. #--------------------------------------------------------------------------
  2079. def position_x
  2080. return @base_position_x - @move_x
  2081. end
  2082. #--------------------------------------------------------------------------
  2083. # ● バトル画面 Y 座標の取得
  2084. #--------------------------------------------------------------------------
  2085. def position_y
  2086. return @base_position_y + @move_y + @jump
  2087. end
  2088. #--------------------------------------------------------------------------
  2089. # ● バトル画面 Z 座標の取得
  2090. #--------------------------------------------------------------------------
  2091. def position_z
  2092. return position_y + @move_z - @jump + 200
  2093. end
  2094. end
  2095. #==============================================================================
  2096. # ■ Sprite_Damage
  2097. #------------------------------------------------------------------------------
  2098. #  ダメージ表示のスプライトです。
  2099. #==============================================================================
  2100. class Sprite_Damage < Sprite_Base
  2101. #--------------------------------------------------------------------------
  2102. # ● 公開インスタンス変数
  2103. #--------------------------------------------------------------------------
  2104. attr_accessor :battler
  2105. #--------------------------------------------------------------------------
  2106. # ● オブジェクト初期化
  2107. #--------------------------------------------------------------------------
  2108. def initialize(viewport,battler = nil)
  2109. super(viewport)
  2110. @battler = battler
  2111. @damage = 0
  2112. @duration = 0
  2113. @x = 0
  2114. @y = 0
  2115. @z_plus = 0
  2116. @minus = false
  2117. @num1 = Sprite.new(viewport)
  2118. @num2 = Sprite.new(viewport)
  2119. @num3 = Sprite.new(viewport)
  2120. @num4 = Sprite.new(viewport)
  2121. @num5 = Sprite.new(viewport)
  2122. @num6 = Sprite.new(viewport)
  2123. @num1.visible = false
  2124. @num2.visible = false
  2125. @num3.visible = false
  2126. @num4.visible = false
  2127. @num5.visible = false
  2128. @num6.visible = false
  2129. end
  2130. #--------------------------------------------------------------------------
  2131. # ● フレーム更新
  2132. #--------------------------------------------------------------------------
  2133. def update
  2134. force_damage
  2135. move_damage(@num6, @pop_time) if @num6.visible
  2136. move_damage(@num5, @pop_time - 2) if @num5.visible
  2137. move_damage(@num4, @pop_time - 4) if @num4.visible
  2138. move_damage(@num3, @pop_time - 6) if @num3.visible
  2139. move_damage(@num2, @pop_time - 8) if @num2.visible
  2140. move_damage(@num1, @pop_time - 10) if @num1.visible
  2141. move_window if @window != nil
  2142. @duration -= 1 if @duration > 0
  2143. end
  2144. #--------------------------------------------------------------------------
  2145. # ● イベントでのダメージPOP
  2146. #--------------------------------------------------------------------------
  2147. def force_damage
  2148. if @battler.force_damage != 0
  2149. damage_pop(@battler.force_damage)
  2150. @battler.hp -= @battler.force_damage
  2151. @force_damage = true
  2152. @battler.force_damage = 0
  2153. $game_temp.status_window_refresh = true
  2154. end
  2155. end
  2156. #--------------------------------------------------------------------------
  2157. # ● 数値の動き
  2158. #--------------------------------------------------------------------------
  2159. def move_damage(num, min)
  2160. case @duration
  2161. when min-1..min
  2162. num.x -= 1
  2163. num.y -= 4
  2164. when min-3..min-2
  2165. num.x -= 1
  2166. num.y -= 3
  2167. when min-6..min-4
  2168. num.y -= 2
  2169. when min-14..min-7
  2170. num.y += 2
  2171. when min-17..min-15
  2172. num.y -= 2
  2173. when min-23..min-18
  2174. num.y += 1
  2175. when min-27..min-24
  2176. num.y -= 1
  2177. when min-30..min-28
  2178. num.y += 1
  2179. when min-33..min-31
  2180. num.y -= 1
  2181. when min-36..min-34
  2182. num.y += 1
  2183. end
  2184. next_damage if @battler.double_damage && @duration == min-34
  2185. num.opacity = 256 - (12 - @duration) * 32
  2186. num.visible = false if @duration == 0
  2187. if @force_damage && @duration == 0
  2188. @force_damage = false
  2189. @battler.perform_collapse
  2190. end
  2191. end
  2192. #--------------------------------------------------------------------------
  2193. # ● 文字ウインドウの動き
  2194. #--------------------------------------------------------------------------
  2195. def move_window
  2196. @window.x -= 6 if @window_time > 0 && @window.x > 0
  2197. @window_time -= 1
  2198. if @duration == 0
  2199. @window.dispose
  2200. @window = nil
  2201. end
  2202. end
  2203. #--------------------------------------------------------------------------
  2204. # ● HPMP両方同時ダメージ
  2205. #--------------------------------------------------------------------------
  2206. def next_damage
  2207. @battler.hp_damage = 0
  2208. @battler.double_damage = false
  2209. damage_pop
  2210. end
  2211. #--------------------------------------------------------------------------
  2212. # ● ダメージPOP準備
  2213. #--------------------------------------------------------------------------
  2214. def damage_pop(num = nil)
  2215. reset
  2216. damage = battler.hp_damage
  2217. # ステートの変化を抜き出す
  2218. states = battler.added_states
  2219. text = ""
  2220. # MPダメージ用テキスト(HPMP両方同時ダメージは除く)
  2221. if !@battler.double_damage && @battler.mp_damage != 0
  2222. text = N01::POP_MP_DAM if battler.mp_damage > 0
  2223. text = N01::POP_MP_REC if battler.mp_damage < 0
  2224. damage = battler.mp_damage
  2225. end
  2226. # スリップダメージはMPダメージ以外文字を表示させない
  2227. if num == nil
  2228. text = N01::POP_DAMAGE0 if damage == 0 && states == [] && !battler.revival
  2229. text = N01::POP_MISS if battler.missed && states == []
  2230. text = N01::POP_EVA if battler.evaded
  2231. text = N01::POP_CRI if battler.critical
  2232. for state in states
  2233. # POPなし設定のステートは表示させない
  2234. unless state.extension.include?("NOPOP")
  2235. text += " " if text != ""
  2236. text += state.name
  2237. end
  2238. end
  2239. else
  2240. damage = num
  2241. end
  2242. # ダメージと回復を分ける
  2243. @minus = false
  2244. @minus = true if damage < 0
  2245. damage = damage.abs
  2246. # POP位置微調整
  2247. adjust = -16
  2248. adjust = 16 if $back_attack
  2249. adjust = 0 if damage == 0
  2250. @x = battler.position_x + adjust
  2251. @y = battler.position_y
  2252. window(text) if text != ""
  2253. @pop_time = N01::NUM_DURATION
  2254. # ダメージがなければ数字のPOPをさせない
  2255. return @duration = @pop_time if damage == 0
  2256. @num_time = -1
  2257. damage_file(@num1, damage % 10, @pop_time - 7) if damage >= 0
  2258. damage_file(@num2, (damage % 100)/10, @pop_time - 5) if damage >= 10
  2259. damage_file(@num3, (damage % 1000)/100, @pop_time - 3) if damage >= 100
  2260. damage_file(@num4, (damage % 10000)/1000, @pop_time - 1) if damage >= 1000
  2261. damage_file(@num5, (damage % 100000)/10000, @pop_time + 1) if damage >= 10000
  2262. damage_file(@num6, (damage % 1000000)/100000, @pop_time + 3) if damage >= 100000
  2263. end
  2264. #--------------------------------------------------------------------------
  2265. # ● 情報ウインドウ準備
  2266. #--------------------------------------------------------------------------
  2267. def window(text)
  2268. @window = Window_Damage.new(@x - 64, @y - 22)
  2269. @window.pop_text(text)
  2270. @window_time = 5
  2271. end
  2272. #--------------------------------------------------------------------------
  2273. # ● 数字画像準備
  2274. #--------------------------------------------------------------------------
  2275. def damage_file(num, cw, dur)
  2276. num.visible = true
  2277. # ファイル判別
  2278. file = N01::DAMAGE_GRAPHICS
  2279. file = N01::RECOVER_GRAPHICS if @minus
  2280. file = N01::MP_DAMAGE_GRAPHICS if battler.mp_damage > 0 && !@battler.double_damage && N01::USE_MP_POP_GRAPHICS # v3.3b
  2281. file = N01::MP_RECOVER_GRAPHICS if battler.mp_damage < 0 && !@battler.double_damage && N01::USE_MP_POP_GRAPHICS# v3.3b
  2282. # 数字
  2283. num.bitmap = Cache.system(file)
  2284. @num_time += 1
  2285. sx = num.bitmap.width / 10
  2286. num.src_rect.set(cw * sx, 0, sx, num.height)
  2287. num.x = @x - (num.width + N01::NUM_INTERBAL) * @num_time
  2288. num.y = @y
  2289. num.z = 2000 - @num_time
  2290. @duration = dur
  2291. @window.x = num.x - @window.width + 64 if @window != nil && N01::NON_DAMAGE_WINDOW
  2292. @window.x = num.x - @window.width + 26 if @window != nil && !N01::NON_DAMAGE_WINDOW
  2293. @window.x = 0 if @window != nil && @window.x < 0
  2294. end
  2295. #--------------------------------------------------------------------------
  2296. # ● ダメージリセット
  2297. #--------------------------------------------------------------------------
  2298. def reset
  2299. @num6.visible = @num5.visible = @num4.visible = @num3.visible = @num2.visible = @num1.visible = false
  2300. @window.dispose if @window != nil
  2301. @window = nil
  2302. end
  2303. #--------------------------------------------------------------------------
  2304. # ● 開放
  2305. #--------------------------------------------------------------------------
  2306. def dispose
  2307. super
  2308. @num1.dispose
  2309. @num2.dispose
  2310. @num3.dispose
  2311. @num4.dispose
  2312. @num5.dispose
  2313. @num6.dispose
  2314. @window.dispose if @window != nil
  2315. end
  2316. end
  2317. #==============================================================================
  2318. # ■ Window_Damage
  2319. #------------------------------------------------------------------------------
  2320. # Pop-up window that displays state names and hit confirmation effects.
  2321. #==============================================================================
  2322. class Window_Damage < Window_Base
  2323. #--------------------------------------------------------------------------
  2324. # ● オブジェクト初期化
  2325. #--------------------------------------------------------------------------
  2326. def initialize(x, y)
  2327. super(x, y, 160, 46)
  2328. self.opacity = 0 if N01::NON_DAMAGE_WINDOW
  2329. end
  2330. #--------------------------------------------------------------------------
  2331. # ● ウィンドウ内容の作成
  2332. #--------------------------------------------------------------------------
  2333. def create_contents
  2334. self.contents.dispose
  2335. self.contents = Bitmap.new(width - 32, height - 32)
  2336. end
  2337. #--------------------------------------------------------------------------
  2338. # ● テキスト設定
  2339. #--------------------------------------------------------------------------
  2340. def pop_text(text, align = 1)
  2341. self.contents.clear
  2342. self.width = self.contents.text_size(text).width + 36
  2343. self.contents = Bitmap.new(width - 32, height - 32)
  2344. self.contents.font.color = normal_color
  2345. self.contents.font.bold = true
  2346. self.contents.font.size = 16
  2347. self.contents.draw_text(0,-8, width - 32, 32, text, align)
  2348. end
  2349. end
  2350. #==============================================================================
  2351. # ■ Game_Temp
  2352. #------------------------------------------------------------------------------
  2353. #  セーブデータに含まれない、一時的なデータを扱うクラスです。
  2354. #==============================================================================
  2355. class Game_Temp
  2356. #--------------------------------------------------------------------------
  2357. # ● 公開インスタンス変数
  2358. #--------------------------------------------------------------------------
  2359. attr_accessor :status_window_refresh # ステータスウインドウのリフレッシュフラグ
  2360. #--------------------------------------------------------------------------
  2361. # ● オブジェクト初期化
  2362. #--------------------------------------------------------------------------
  2363. alias initialize_n01 initialize
  2364. def initialize
  2365. initialize_n01
  2366. @status_window_refresh = false
  2367. end
  2368. end
  2369. #==============================================================================
  2370. # ■ Game_Interpreter
  2371. #------------------------------------------------------------------------------
  2372. #  イベントコマンドを実行するインタプリタです。
  2373. #==============================================================================
  2374. class Game_Interpreter
  2375. #--------------------------------------------------------------------------
  2376. # ● Change Actor HP -alias
  2377. #--------------------------------------------------------------------------
  2378. alias command_311_n01 command_311
  2379. def command_311
  2380. if $game_temp.in_battle
  2381. value = operate_value(@params[1], @params[2], @params[3])
  2382. iterate_actor_id(@params[0]) do |actor|
  2383. next if actor.dead?
  2384. if @params[4] == false and actor.hp + value <= 0
  2385. actor.damage_num(actor.hp - 1) # If incapacitation is not allowed, make 1
  2386. else
  2387. actor.damage_num(-value)
  2388. end
  2389. end
  2390. return true
  2391. else
  2392. command_311_n01
  2393. end
  2394. end
  2395. #--------------------------------------------------------------------------
  2396. # ● Change Enemy HP -rewrite
  2397. #--------------------------------------------------------------------------
  2398. def command_331
  2399. value = operate_value(@params[1], @params[2], @params[3])
  2400. iterate_enemy_index(@params[0]) do |enemy|
  2401. if enemy.hp > 0
  2402. if @params[4] == false and enemy.hp + value <= 0
  2403. enemy.damage_num(enemy.hp - 1) # If incapacitation is not allowed, make 1
  2404. else
  2405. enemy.damage_num(-value)
  2406. end
  2407. end
  2408. end
  2409. return true
  2410. end
  2411. end
  2412.  
  2413. #==============================================================================
  2414. # ■ Window_Help
  2415. #------------------------------------------------------------------------------
  2416. #  スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。
  2417. #==============================================================================
  2418.  
  2419. class Window_Help < Window_Base
  2420. #--------------------------------------------------------------------------
  2421. # ● テキスト設定
  2422. #--------------------------------------------------------------------------
  2423. def set_text_n01add(member)
  2424. self.contents.clear
  2425. return if member == nil || member.dead?
  2426. self.contents.font.color = normal_color
  2427. if !member.actor? && N01::ENEMY_NON_DISPLAY.include?(member.enemy_id)
  2428. return self.contents.draw_text(4, 0, self.width - 40, WLH, member.name, 1)
  2429. elsif member.actor? && !N01::ACTOR_DISPLAY
  2430. return self.contents.draw_text(4, 0, self.width - 40, WLH, member.name, 1)
  2431. end
  2432. if N01::WORD_STATE_DISPLAY && N01::HP_DISPLAY
  2433. self.contents.draw_text(0, 0, 180, WLH, member.name, 1)
  2434. draw_actor_hp(member, 182, 0, 120)
  2435. text = "["
  2436. for state in member.states
  2437. next if N01::STATE_NON_DISPLAY.include?(state.id)
  2438. text += " " if text != "["
  2439. text += state.name
  2440. end
  2441. text += N01::WORD_NORMAL_STATE if text == "["
  2442. text += "]"
  2443. text = "" if text == "[]"
  2444. self.contents.draw_text(315, 0, 195, WLH, text, 0)
  2445. elsif N01::WORD_STATE_DISPLAY
  2446. text = member.name + " ["
  2447. for state in member.states
  2448. next if N01::STATE_NON_DISPLAY.include?(state.id)
  2449. text += " " if text != member.name + " ["
  2450. text += state.name
  2451. end
  2452. text += N01::WORD_NORMAL_STATE if text == member.name + " ["
  2453. text += "]"
  2454. text = "" if text == "[]"
  2455. self.contents.draw_text(4, 0, self.width - 40, WLH, text, 1)
  2456. elsif N01::HP_DISPLAY
  2457. self.contents.draw_text(4, 0, 240, WLH, member.name, 1)
  2458. draw_actor_hp(member, 262, 0, 120)
  2459. end
  2460. end
  2461. end
  2462.  
  2463. #==============================================================================
  2464. # ■ Sprite_Battler
  2465. #------------------------------------------------------------------------------
  2466. # This sprite is used to display battlers. It observes a instance of the
  2467. # Game_Battler class and automatically changes sprite conditions.
  2468. #==============================================================================
  2469. class Sprite_Battler < Sprite_Base
  2470. #------------------------------------------------------------------------------
  2471. # This method was taken from the ATB and moved to Sideview 2 to help
  2472. # enable head and feet targeting.
  2473. #------------------------------------------------------------------------------
  2474. alias make_battler_hw_from_atb make_battler
  2475. def make_battler
  2476. make_battler_hw_from_atb
  2477.  
  2478. @battler.graphics_width = @width
  2479. @battler.graphics_height = @height
  2480. end
  2481. end
  2482.  
  2483. #==============================================================================
  2484. # ■ Game_Party
  2485. #------------------------------------------------------------------------------
  2486. #  パーティを扱うクラスです。
  2487. #==============================================================================
  2488. class Game_Party < Game_Unit
  2489. #--------------------------------------------------------------------------
  2490. # ● アクターを加える
  2491. # actor_id : アクター ID
  2492. #--------------------------------------------------------------------------
  2493. alias add_actor_n01 add_actor
  2494. def add_actor(actor_id)
  2495. add_actor_n01(actor_id)
  2496. $party_change = true if actor_id == 4
  2497. end
  2498. #--------------------------------------------------------------------------
  2499. # ● アクターを外す
  2500. # actor_id : アクター ID
  2501. #--------------------------------------------------------------------------
  2502. alias remove_actor_n01 remove_actor
  2503. def remove_actor(actor_id)
  2504. remove_actor_n01(actor_id)
  2505. $party_change = true if actor_id == 4
  2506. end
  2507. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement