设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1584|回复: 1
打印 上一主题 下一主题

[已经过期] CP制战斗CP条位置修改

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
101 小时
注册时间
2009-10-7
帖子
146
跳转到指定楼层
1
发表于 2010-6-24 16:52:44 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
我游戏是单人的所以我将人物调到中间去,但是CP条却没了怎么办?还有怎么让敌人也显示CP条
脚本:
  1. #==============================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #===============================================================


  4. # ———————————————————————————————

  5. # ▼▲▼ XRXS_BP 1. CP制導入 ver..23 ▼▲▼
  6. # by 桜雅 在土, 和希

  7. #===================================================================
  8. # □ カスタマイズポイント
  9. #====================================================================
  10. module XRXS_BP1
  11. #
  12. # 对齐方式。0:左 1:中央 2:右
  13. #
  14. ALIGN = 0
  15. #
  16. # 人数
  17. #
  18. MAX = 4
  19. end
  20. class Scene_Battle_CP
  21. #
  22. # 战斗速度
  23. #
  24. BATTLE_SPEED = 2.0
  25. #
  26. # 战斗开始的时候气槽百分比
  27. #
  28. START_CP_PERCENT = 100
  29. end

  30. class Scene_Battle

  31. # 效果音效,可以自己添加
  32. DATA_SYSTEM_COMMAND_UP_SE = ""

  33. # 各项数值功能消耗的CP值
  34. CP_COST_BASIC_ACTIONS = 0 # 基础共同
  35. CP_COST_SKILL_ACTION = 65535 # 技能
  36. CP_COST_ITEM_ACTION = 65535 # 物品
  37. CP_COST_BASIC_ATTACK = 65535 # 攻撃
  38. CP_COST_BASIC_GUARD = 32768 # 防御
  39. CP_COST_BASIC_NOTHING = 65535 # 不做任何事情
  40. CP_COST_BASIC_ESCAPE = 65535 # 逃跑
  41. end

  42. #============================================================
  43. # --- XRXS.コマンドウィンドウ?コマンド追加機構 ---
  44. #-----------------------------------------------------------
  45. # Window_Commandクラスに add_command メソッドを追加します。
  46. #=============================================================
  47. module XRXS_Window_Command_Add_Command
  48. #-------------------------------------------------
  49. # ○ コマンドを追加
  50. #----------------------------------------------------
  51. def add_command(command)
  52. # 初期化されていない場合、無効化判別用の配列 @disabled の初期化
  53. #
  54. if @disabled == nil
  55. @disabled = []
  56. end
  57. if @commands.size != @disabled.size
  58. for i in [email protected]
  59. @disabled[i] = false
  60. end
  61. end
  62. #
  63. # 追加
  64. #
  65. @commands.push(command)
  66. @disabled.push(false)
  67. @item_max = @commands.size
  68. self.y -= 32
  69. self.height += 32
  70. self.contents.dispose
  71. self.contents = nil
  72. self.contents = Bitmap.new(self.width - 32, @item_max * 32)
  73. refresh
  74. for i in [email protected]
  75. if @disabled[i]
  76. disable_item(i)
  77. end
  78. end
  79. end
  80. #-------------------------------------------------------
  81. # ○ 項目の無効化
  82. # index : 項目番号
  83. #----------------------------------------------------
  84. def disable_item(index)
  85. if @disabled == nil
  86. @disabled = []
  87. end
  88. @disabled[index] = true
  89. draw_item(index, disabled_color)
  90. end
  91. end
  92. class Window_Command < Window_Selectable
  93. #------------------------------------------------------
  94. # ○ インクルード
  95. #------------------------------------------------
  96. include XRXS_Window_Command_Add_Command
  97. #---------------------------------------------------------
  98. # ● 項目の無効化
  99. # index : 項目番号
  100. #------------------------------------------------------
  101. def disable_item(index)
  102. super
  103. end
  104. end
  105. #==============================================================
  106. # □ Scene_Battle_CP
  107. #==============================================================
  108. class Scene_Battle_CP
  109. #----------------------------------------------------------
  110. # ○ 公開インスタンス変数
  111. #-------------------------------------------------------
  112. attr_accessor :stop # CP加算ストップ
  113. #-------------------------------------------------------------
  114. # ○ オブジェクトの初期化
  115. #-----------------------------------------------------------
  116. def initialize
  117. @battlers = []
  118. @cancel = false
  119. @stop = false
  120. @agi_total = 0
  121. # 配列 count_battlers を初期化
  122. count_battlers = []
  123. # エネミーを配列 count_battlers に追加
  124. for enemy in $game_troop.enemies
  125. count_battlers.push(enemy)
  126. end
  127. # アクターを配列 count_battlers に追加
  128. for actor in $game_party.actors
  129. count_battlers.push(actor)
  130. end
  131. for battler in count_battlers
  132. @agi_total += battler.agi
  133. end
  134. for battler in count_battlers
  135. battler.cp = [[65535 * START_CP_PERCENT * (rand(15) + 85) * 4 * battler.agi / @agi_total / 10000, 0].max, 65535].min
  136. end
  137. end
  138. #---------------------------------------------------------------
  139. # ○ CPカウントアップ
  140. #--------------------------------------------------------------
  141. def update
  142. # ストップされているならリターン
  143. return if @stop
  144. #
  145. for battler in $game_party.actors + $game_troop.enemies
  146. # 行動出来なければ無視
  147. if battler.dead? == true
  148. battler.cp = 0
  149. next
  150. end
  151. battler.cp = [[battler.cp + BATTLE_SPEED * 4096 * battler.agi / @agi_total, 0].max, 65535].min
  152. end
  153. end
  154. #--------------------------------------------------------------
  155. # ○ CPカウントの開始
  156. #---------------------------------------------------------------
  157. def stop
  158. @cancel = true
  159. if @cp_thread != nil then
  160. @cp_thread.join
  161. @cp_thread = nil
  162. end
  163. end
  164. end

  165. #===================================================================
  166. # ■ Game_Battler
  167. #=================================================================
  168. class Game_Battler
  169. attr_accessor :now_guarding # 現在防御中フラグ
  170. attr_accessor :cp # 現在CP
  171. attr_accessor :slip_state_update_ban # スリップ?ステート自動処理の禁止
  172. #-------------------------------------------------------------
  173. # ○ CP の変更
  174. #------------------------------------------------------------
  175. def cp=(p)
  176. @cp = [[p, 0].max, 65535].min
  177. end
  178. #----------------------------------------------------------
  179. # ● 防御中判定 [ 再定義 ]
  180. #---------------------------------------------------------
  181. def guarding?
  182. return @now_guarding
  183. end
  184. #------------------------------------------------------------
  185. # ● コマンド入力可能判定
  186. #---------------------------------------------------------
  187. alias xrxs_bp1_inputable? inputable?
  188. def inputable?
  189. bool = xrxs_bp1_inputable?
  190. return (bool and (@cp >= 65535))
  191. end
  192. #------------------------------------------------------------
  193. # ● ステート [スリップダメージ] 判定
  194. #-------------------------------------------------------------
  195. alias xrxs_bp1_slip_damage? slip_damage?
  196. def slip_damage?
  197. return false if @slip_state_update_ban
  198. return xrxs_bp1_slip_damage?
  199. end
  200. #--------------------------------------------------------------
  201. # ● ステート自然解除 (ターンごとに呼び出し)
  202. #----------------------------------------------------------
  203. alias xrxs_bp1_remove_states_auto remove_states_auto
  204. def remove_states_auto
  205. return if @slip_state_update_ban
  206. xrxs_bp1_remove_states_auto
  207. end
  208. end
  209. #==================================================================
  210. # ■ Game_Actor
  211. #==================================================================
  212. class Game_Actor < Game_Battler
  213. #---------------------------------------------------------
  214. # ● セットアップ
  215. #--------------------------------------------------------
  216. alias xrxs_bp1_setup setup
  217. def setup(actor_id)
  218. xrxs_bp1_setup(actor_id)
  219. @cp = 0
  220. @now_guarding = false
  221. @slip_state_update_ban = false
  222. end
  223. end
  224. #===================================================================
  225. # ■ Game_Enemy
  226. #===================================================================
  227. class Game_Enemy < Game_Battler
  228. #-----------------------------------------------------------
  229. # ● オブジェクト初期化
  230. #----------------------------------------------------------
  231. alias xrxs_bp1_initialize initialize
  232. def initialize(troop_id, member_index)
  233. xrxs_bp1_initialize(troop_id, member_index)
  234. @cp = 0
  235. @now_guarding = false
  236. @slip_state_update_ban = false
  237. end
  238. end
  239. #==================================================================
  240. # ■ Window_BattleStatus
  241. #==================================================================
  242. class Window_BattleStatus < Window_Base
  243. #---------------------------------------------------------
  244. # ○ 公開インスタンス変数
  245. #------------------------------------------------------------
  246. attr_accessor :update_cp_only # CPメーターのみの更新
  247. #------------------------------------------------------------
  248. # ● オブジェクト初期化
  249. #-------------------------------------------------------------
  250. alias xrxs_bp1_initialize initialize
  251. def initialize
  252. @update_cp_only = false
  253. xrxs_bp1_initialize
  254. end
  255. #------------------------------------------------------------
  256. # ● リフレッシュ
  257. #-------------------------------------------------------------
  258. alias xrxs_bp1_refresh refresh
  259. def refresh
  260. unless @update_cp_only
  261. xrxs_bp1_refresh
  262. end
  263. refresh_cp
  264. end
  265. #---------------------------------------------------------------
  266. # ○ リフレッシュ(CPのみ)
  267. #------------------------------------------------------------
  268. def refresh_cp
  269. for i in 0...$game_party.actors.size
  270. actor = $game_party.actors[i]
  271. width = [self.width*3/4 / XRXS_BP1::MAX, 80].max
  272. space = self.width / XRXS_BP1::MAX
  273. case XRXS_BP1::ALIGN
  274. when 0
  275. actor_x = i * space + 4
  276. when 1
  277. actor_x = (space * ((XRXS_BP1::MAX - $game_party.actors.size)/2.0 + i)).floor
  278. when 2
  279. actor_x = (i + XRXS_BP1::MAX - $game_party.actors.size) * space + 4
  280. end
  281. actor_x += self.x
  282. draw_actor_cp_meter(actor, actor_x, 96, width, 0)
  283. end
  284. end
  285. #-----------------------------------------------------------
  286. # ○ CPメーター の描画
  287. #-------------------------------------------------------------
  288. def draw_actor_cp_meter(actor, x, y, width = 156, type = 0)
  289. self.contents.font.color = system_color
  290. self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 255))
  291. if actor.cp == nil
  292. actor.cp = 0
  293. end
  294. w = width * [actor.cp,65535].min / 65535
  295. self.contents.fill_rect(x, y+28, w,1, Color.new(255, 255, 128, 255))
  296. self.contents.fill_rect(x, y+29, w,1, Color.new(255, 255, 0, 255))
  297. self.contents.fill_rect(x, y+30, w,1, Color.new(192, 192, 0, 255))
  298. self.contents.fill_rect(x, y+31, w,1, Color.new(128, 128, 0, 255))
  299. end
  300. end
  301. #==================================================================
  302. # ■ Scene_Battle
  303. #==================================================================
  304. class Scene_Battle
  305. #------------------------------------------------------------
  306. # ● フレーム更新
  307. #---------------------------------------------------------------
  308. alias xrxs_bp1_update update
  309. def update
  310. xrxs_bp1_update
  311. # CP更新
  312. @cp_thread.update
  313. end
  314. #------------------------------------------------------------
  315. # ● バトル終了
  316. # result : 結果 (0:勝利 1:敗北 2:逃走)
  317. #-------------------------------------------------------------
  318. alias xrxs_bp1_battle_end battle_end
  319. def battle_end(result)
  320. # CPカウントを停止する
  321. @cp_thread.stop
  322. # 呼び戻す
  323. xrxs_bp1_battle_end(result)
  324. end
  325. #------------------------------------------------------------
  326. # ● プレバトルフェーズ開始
  327. #----------------------------------------------------------
  328. alias xrxs_bp1_start_phase1 start_phase1
  329. def start_phase1
  330. @agi_total = 0
  331. # CP加算を開始する
  332. @cp_thread = Scene_Battle_CP.new
  333. # インデックスを計算
  334. @cp_escape_actor_command_index = @actor_command_window.height/32 - 1
  335. # アクターコマンドウィンドウに追加
  336. @actor_command_window.add_command("逃跑")
  337. if !$game_temp.battle_can_escape
  338. @actor_command_window.disable_item(@cp_escape_actor_command_index)
  339. end
  340. # 呼び戻す
  341. xrxs_bp1_start_phase1
  342. end
  343. #---------------------------------------------------------------
  344. # ● パーティコマンドフェーズ開始
  345. #----------------------------------------------------------
  346. alias xrxs_bp1_start_phase2 start_phase2
  347. def start_phase2
  348. xrxs_bp1_start_phase2
  349. @party_command_window.active = false
  350. @party_command_window.visible = false
  351. # CP加算を再開する
  352. @cp_thread.stop = false
  353. # 次へ
  354. start_phase3
  355. end
  356. #---------------------------------------------------------
  357. # ● アクターコマンドウィンドウのセットアップ
  358. #----------------------------------------------------------
  359. alias xrxs_bp1_phase3_setup_command_window phase3_setup_command_window
  360. def phase3_setup_command_window
  361. # CPスレッドを一時停止する
  362. @cp_thread.stop = true
  363. # ウィンドウのCP更新
  364. @status_window.refresh_cp
  365. # @active_battlerの防御を解除
  366. @active_battler.now_guarding = false
  367. # 効果音の再生
  368. Audio.se_play(DATA_SYSTEM_COMMAND_UP_SE) if DATA_SYSTEM_COMMAND_UP_SE != ""
  369. # 呼び戻す
  370. xrxs_bp1_phase3_setup_command_window
  371. end
  372. #---------------------------------------------------------
  373. # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
  374. #--------------------------------------------------------
  375. alias xrxs_bsp1_update_phase3_basic_command update_phase3_basic_command
  376. def update_phase3_basic_command
  377. # C ボタンが押された場合
  378. if Input.trigger?(Input::C)
  379. # アクターコマンドウィンドウのカーソル位置で分岐
  380. case @actor_command_window.index
  381. when @cp_escape_actor_command_index # 逃げる
  382. if $game_temp.battle_can_escape
  383. # 決定 SE を演奏
  384. $game_system.se_play($data_system.decision_se)
  385. # アクションを設定
  386. @active_battler.current_action.kind = 0
  387. @active_battler.current_action.basic = 4
  388. # 次のアクターのコマンド入力へ
  389. phase3_next_actor
  390. else
  391. # ブザー SE を演奏
  392. $game_system.se_play($data_system.buzzer_se)
  393. end
  394. return
  395. end
  396. end
  397. xrxs_bsp1_update_phase3_basic_command
  398. end
  399. #-------------------------------------------------------------
  400. # ● メインフェーズ開始
  401. #-------------------------------------------------------------
  402. alias xrxs_bp1_start_phase4 start_phase4
  403. def start_phase4
  404. # 呼び戻す
  405. xrxs_bp1_start_phase4
  406. # CPスレッドを一時停止する
  407. unless @action_battlers.empty?
  408. @cp_thread.stop = true
  409. end
  410. end
  411. #-------------------------------------------------------
  412. # ● 行動順序作成
  413. #-------------------------------------------------------
  414. alias xrxs_bp1_make_action_orders make_action_orders
  415. def make_action_orders
  416. xrxs_bp1_make_action_orders
  417. # 全員のCPを確認
  418. exclude_battler = []
  419. for battler in @action_battlers
  420. # CPが不足している場合は @action_battlers から除外する
  421. if battler.cp < 65535
  422. exclude_battler.push(battler)
  423. end
  424. end
  425. @action_battlers -= exclude_battler
  426. end
  427. #-----------------------------------------------------------
  428. # ● フレーム更新 (メインフェーズ ステップ 1 : アクション準備)
  429. #------------------------------------------------------------
  430. alias xrxs_bp1_update_phase4_step1 update_phase4_step1
  431. def update_phase4_step1
  432. # 初期化
  433. @phase4_act_continuation = 0
  434. # 勝敗判定
  435. if judge
  436. @cp_thread.stop
  437. # 勝利または敗北の場合 : メソッド終了
  438. return
  439. end
  440. # 未行動バトラー配列の先頭から取得
  441. @active_battler = @action_battlers[0]
  442. # ステータス更新をCPだけに限定。
  443. @status_window.update_cp_only = true
  444. # ステート更新を禁止。
  445. @active_battler.slip_state_update_ban = true if @active_battler != nil
  446. # 戻す
  447. xrxs_bp1_update_phase4_step1
  448. # @status_windowがリフレッシュされなかった場合は手動でリフレッシュ(CPのみ)
  449. if @phase4_step != 2
  450. # リフレッシュ
  451. @status_window.refresh
  452. # 軽量化:たったコレだけΣ(?w?
  453. Graphics.frame_reset
  454. end
  455. # 禁止を解除
  456. @status_window.update_cp_only = false
  457. @active_battler.slip_state_update_ban = false if @active_battler != nil
  458. end
  459. #-------------------------------------------------------------
  460. # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  461. #----------------------------------------------------------
  462. alias xrxs_bp1_update_phase4_step2 update_phase4_step2
  463. def update_phase4_step2
  464. # 強制アクションでなければ
  465. unless @active_battler.current_action.forcing
  466. # 制約が [敵を通常攻撃する] か [味方を通常攻撃する] の場合
  467. if @active_battler.restriction == 2 or @active_battler.restriction == 3
  468. # アクションに攻撃を設定
  469. @active_battler.current_action.kind = 0
  470. @active_battler.current_action.basic = 0
  471. end
  472. # 制約が [行動できない] の場合
  473. if @active_battler.restriction == 4
  474. # アクション強制対象のバトラーをクリア
  475. $game_temp.forcing_battler = nil
  476. if @phase4_act_continuation == 0 and @active_battler.cp >= 65535
  477. # ステート自然解除
  478. @active_battler.remove_states_auto
  479. # CP消費
  480. @active_battler.cp -= 65535
  481. # ステータスウィンドウをリフレッシュ
  482. @status_window.refresh
  483. end
  484. # ステップ 1 に移行
  485. @phase4_step = 1
  486. return
  487. end
  488. end
  489. # アクションの種別で分岐
  490. case @active_battler.current_action.kind
  491. when 0
  492. # 攻撃?防御?逃げる?何もしない時の共通消費CP
  493. @active_battler.cp -= CP_COST_BASIC_ACTIONS if @phase4_act_continuation == 0
  494. when 1
  495. # スキル使用時の消費CP
  496. @active_battler.cp -= CP_COST_SKILL_ACTION if @phase4_act_continuation == 0
  497. when 2
  498. # アイテム使用時の消費CP
  499. @active_battler.cp -= CP_COST_ITEM_ACTION if @phase4_act_continuation == 0
  500. end
  501. # ステート自然解除
  502. @active_battler.remove_states_auto
  503. # 呼び戻す
  504. xrxs_bp1_update_phase4_step2
  505. end
  506. #-----------------------------------------------------------
  507. # ● 基本アクション 結果作成
  508. #-----------------------------------------------------------
  509. alias xrxs_bp1_make_basic_action_result make_basic_action_result
  510. def make_basic_action_result
  511. # 攻撃の場合
  512. if @active_battler.current_action.basic == 0 and @phase4_act_continuation == 0
  513. @active_battler.cp -= CP_COST_BASIC_ATTACK # 攻撃時のCP消費
  514. end
  515. # 防御の場合
  516. if @active_battler.current_action.basic == 1 and @phase4_act_continuation == 0
  517. @active_battler.cp -= CP_COST_BASIC_GUARD # 防御時のCP消費
  518. # @active_battlerの防御をON
  519. @active_battler.now_guarding = true
  520. end
  521. # 敵の逃げるの場合
  522. if @active_battler.is_a?(Game_Enemy) and
  523. @active_battler.current_action.basic == 2 and @phase4_act_continuation == 0
  524. @active_battler.cp -= CP_COST_BASIC_ESCAPE # 逃走時のCP消費
  525. end
  526. # 何もしないの場合
  527. if @active_battler.current_action.basic == 3 and @phase4_act_continuation == 0
  528. @active_battler.cp -= CP_COST_BASIC_NOTHING # 何もしない時のCP消費
  529. end
  530. # 逃げるの場合
  531. if @active_battler.current_action.basic == 4 and @phase4_act_continuation == 0
  532. @active_battler.cp -= CP_COST_BASIC_ESCAPE # 逃走時のCP消費
  533. # 逃走可能ではない場合
  534. if $game_temp.battle_can_escape == false
  535. # ブザー SE を演奏
  536. $game_system.se_play($data_system.buzzer_se)
  537. return
  538. end
  539. # 逃走処理
  540. update_phase2_escape
  541. return
  542. end
  543. # 呼び戻す
  544. xrxs_bp1_make_basic_action_result
  545. end
  546. #-------------------------------------------------------------
  547. # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  548. #-----------------------------------------------------------
  549. alias xrxs_bp1_update_phase4_step6 update_phase4_step6
  550. def update_phase4_step6
  551. # スリップダメージ
  552. if @active_battler.hp > 0 and @active_battler.slip_damage?
  553. @active_battler.slip_damage_effect
  554. @active_battler.damage_pop = true
  555. # ステータスウィンドウをリフレッシュ
  556. @status_window.refresh
  557. end
  558. # 呼び戻す
  559. xrxs_bp1_update_phase4_step6
  560. end
  561. end


  562. #==============================================================
  563. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  564. #==============================================================
复制代码

Lv1.梦旅人

梦石
0
星屑
50
在线时间
101 小时
注册时间
2009-10-7
帖子
146
2
 楼主| 发表于 2010-6-25 15:13:36 | 只看该作者
苍天就没人帮忙下吗?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-5 20:14

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表