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

Project1

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

关于CP值消耗数量的问题

 关闭 [复制链接]

Lv1.梦旅人

魔星

梦石
0
星屑
50
在线时间
82 小时
注册时间
2007-7-29
帖子
707
跳转到指定楼层
1
发表于 2008-8-6 06:57:25 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我用的是这个CP条的脚本
  1. # ▼▲▼ XRXS65. CP制御ターンシステム ver.β ▼▲▼ built 201120
  2. # by 桜雅 在土

  3. #==============================================================================
  4. # □ カスタマイズポイント
  5. #==============================================================================
  6. module XRXS65
  7.   #
  8.   # 「バトルスピード」(数値が高いほど早い)
  9.   #
  10.   SPEED = 2.0
  11.   #
  12.   # 戦闘開始時 CP。 固定値と占有率
  13.   #
  14.   CP_PRESET_FIXNUM = 0
  15.   CP_PRESET_RATIO  = 2.0
  16.   #
  17.   # ターンコントローラ (nil  : カウント/ターンを有効。
  18.   #                     数値 : そのインデックスをもつエネミーが支配)
  19.   #
  20.   TC = 0
  21.   #
  22.   # カウント/ターン (TCが有効な場合は無視)
  23.   #
  24.   CPT = 40
  25.   #
  26.   # CP スキン
  27.   #
  28.   SKIN        = "123"  # スキンファイル名(Graphics/Windowskinsフォルダ)
  29.   LINE_HEIGHT =  6        # スキンの"一行"の縦幅[単位:ピクセル]
  30.   #
  31.   # 表示位置セッティング
  32.   #
  33.   X_OFFSET = 144    # 横位置
  34.   Y_OFFSET = 464    # 縦位置
  35.   ALIGN    =   1    #「位置揃え」(CPメーターの位置。0:左寄せ 1:中央 2:右寄せ)
  36.   MAX      =   4    # 確保するサイズ[単位:~人分]
  37. end
  38. #==============================================================================
  39. # --- CP メーターの描画情報の取得 --- (Game_Battlerにインクルードされます)
  40. #==============================================================================
  41. module XRXS_CP
  42.   #--------------------------------------------------------------------------
  43.   # ○ スキンライン (スキンの何行目を使うか)
  44.   #--------------------------------------------------------------------------
  45.   def cp_linetype
  46.     # CP フルの場合はスキンの 2 行目を使う
  47.     return 2 if self.cp_full?
  48.     # 通常はスキンの 1 行目を使う
  49.     return 1
  50.   end
  51.   #--------------------------------------------------------------------------
  52.   # ○ メーター量[単位:%]
  53.   #--------------------------------------------------------------------------
  54.   def cp_lineamount
  55.     # 戦闘不能の場合は 0 %として表示させる
  56.     return 0 if self.dead?
  57.     # CP値を%値に変換して返却する
  58.     return 100 * self.cp / self.max_cp
  59.   end
  60. end
  61. #
  62. # カスタマイズポイントここまで。
  63. #------------------------------------------------------------------------------



  64. #==============================================================================
  65. # --- XRXS. CP機構 ---
  66. #==============================================================================
  67. module XRXS_CP_SYSTEM
  68.   #----------------------------------------------------------------------------
  69.   # ○ 合計 AGI の取得
  70.   #----------------------------------------------------------------------------
  71.   def self.total_agi
  72.     total = 0
  73.     for battler in $game_party.actors + $game_troop.enemies
  74.       total += battler.agi
  75.     end
  76.     return total
  77.   end
  78. end
  79. #==============================================================================
  80. # --- バトラーにCP機能を追加 モジュール ---
  81. #==============================================================================
  82. module XRXS_CP
  83.   #--------------------------------------------------------------------------
  84.   # ○ 最大 CP の取得
  85.   #--------------------------------------------------------------------------
  86.   def max_cp
  87.     return 65535
  88.   end
  89.   #--------------------------------------------------------------------------
  90.   # ○ CP の取得と設定
  91.   #--------------------------------------------------------------------------
  92.   def cp
  93.     return @cp == nil ? @cp = 0 : @cp
  94.   end
  95.   def cp=(n)
  96.     @cp = [[n.to_i, 0].max, self.max_cp].min
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # ○ CP 初期設定
  100.   #--------------------------------------------------------------------------
  101.   def cp_preset
  102.     percent = self.max_cp * XRXS65::CP_PRESET_RATIO * (rand(16) + 16) * self.agi / XRXS_CP_SYSTEM.total_agi / 24
  103.     self.cp = XRXS65::CP_PRESET_FIXNUM + percent
  104.   end
  105.   #--------------------------------------------------------------------------
  106.   # ○ CP カウントアップ
  107.   #--------------------------------------------------------------------------
  108.   def cp_update
  109.     self.cp += XRXS65::SPEED * 4096 * self.agi / XRXS_CP_SYSTEM.total_agi
  110.   end
  111.   #--------------------------------------------------------------------------
  112.   # ○ CP 満タン?
  113.   #--------------------------------------------------------------------------
  114.   def cp_full?
  115.     return @cp == self.max_cp
  116.   end
  117. end
  118. class Game_Battler
  119.   include XRXS_CP
  120. end
  121. #==============================================================================
  122. # --- ガード機能 ---
  123. #==============================================================================
  124. class Game_Battler
  125.   #--------------------------------------------------------------------------
  126.   # ○ ガードフラグ
  127.   #--------------------------------------------------------------------------
  128.   def guarding=(n)
  129.     @guarding = n
  130.   end
  131.   #--------------------------------------------------------------------------
  132.   # ● 防御中判定 [再定義]
  133.   #--------------------------------------------------------------------------
  134.   def guarding?
  135.     return @guarding
  136.   end
  137. end
  138. #==============================================================================
  139. # --- アクター「コマンド入力可能判定」:CPがないとコマンドしない ---
  140. #==============================================================================
  141. module XRXS_CP_INPUTABLE
  142.   def inputable?
  143.     return (self.cp_full? and super)
  144.   end
  145. end
  146. class Game_Actor < Game_Battler
  147.   include XRXS_CP_INPUTABLE
  148. end
  149. #==============================================================================
  150. # --- エネミー「行動可能判定」:CPがないとコマンドしない ---
  151. #==============================================================================
  152. module XRXS_CP_MOVABLE
  153.   def movable?
  154.     return (self.cp_full? and super)
  155.   end
  156. end
  157. class Game_Enemy < Game_Battler
  158.   include XRXS_CP_MOVABLE
  159. end
  160. #==============================================================================
  161. # --- 戦闘時 CPカウント ---
  162. #==============================================================================
  163. module XRXS_CP_Battle
  164.   #--------------------------------------------------------------------------
  165.   # ○ パーティ全員の CP を初期設定
  166.   #--------------------------------------------------------------------------
  167.   def cp_preset_party
  168.     for actor in $game_party.actors
  169.       actor.cp_preset
  170.     end
  171.   end
  172.   #--------------------------------------------------------------------------
  173.   # ○ トループ全員の CP を初期設定
  174.   #--------------------------------------------------------------------------
  175.   def cp_preset_troop
  176.     for enemy in $game_troop.enemies
  177.       enemy.cp_preset
  178.     end
  179.   end
  180.   #--------------------------------------------------------------------------
  181.   # ○ バトラー全員の CP をカウントアップ
  182.   #--------------------------------------------------------------------------
  183.   def cp_update
  184.     for battler in $game_party.actors + $game_troop.enemies
  185.       battler.cp_update
  186.     end
  187.   end
  188. end
  189. class Scene_Battle
  190.   include XRXS_CP_Battle
  191. end
  192. #==============================================================================
  193. # ■ Scene_Battle
  194. #==============================================================================
  195. class Scene_Battle
  196.   #--------------------------------------------------------------------------
  197.   # ● メイン処理
  198.   #--------------------------------------------------------------------------
  199.   alias xrxs65_main main
  200.   def main
  201.     # エクストラスプライトの初期化
  202.     @extra_sprites = [] if @extra_sprites == nil
  203.     # CP の初期化
  204.     cp_preset_party
  205.     # CP メーターの作成
  206.     @cp_meters = CP_Meters.new
  207.     # CP メーターをエクストラスプライトへ登録
  208.     @extra_sprites.push(@cp_meters)
  209.     # 呼び戻す
  210.     xrxs65_main
  211.     # メーターの解放
  212.     @cp_meters.dispose
  213.   end
  214.   
  215.   #--------------------------------------------------------------------------
  216.   # ● パーティコマンドフェーズ開始
  217.   #--------------------------------------------------------------------------
  218.   alias xrxs65_start_phase2 start_phase2
  219.   def start_phase2
  220.     # 呼び戻す
  221.     xrxs65_start_phase2
  222.     # パーティコマンドウィンドウを無効化
  223.     @party_command_window.active  = false
  224.     @party_command_window.visible = false
  225.     # 強制的にフェイズ 2 を保持
  226.     @phase = 2
  227.     # ただし、既に行動可能者が存在する場合は 3 へ
  228.     start_phase3 if anybody_movable?
  229.   end
  230.   #--------------------------------------------------------------------------
  231.   # ○ CP制での ターンのカウント
  232.   #--------------------------------------------------------------------------
  233.   def cp_turn_count
  234.     $game_temp.battle_turn += 1
  235.     # バトルイベントの全ページを検索
  236.     for index in 0...$data_troops[@troop_id].pages.size
  237.       # このページのスパンが [ターン] の場合
  238.       if $data_troops[@troop_id].pages[index].span == 1
  239.         # 実行済みフラグをクリア
  240.         $game_temp.battle_event_flags[index] = false
  241.       end
  242.     end
  243.   end
  244.   #--------------------------------------------------------------------------
  245.   # ● フレーム更新 (パーティコマンドフェーズ)
  246.   #--------------------------------------------------------------------------
  247.   alias xrxs65_update_phase2 update_phase2
  248.   def update_phase2
  249.     # パーティコマンドウィンドウのインデックスを無効化
  250.     @party_command_window.index = -1
  251.     # 呼び戻す
  252.     xrxs65_update_phase2
  253.     # 例外補正
  254.     @turn_count_time = 1 if @turn_count_time == nil
  255.     # ターンのカウント
  256.     if @turn_count_time > 0
  257.       @turn_count_time -= 1
  258.       if @turn_count_time == 0
  259.         cp_turn_count
  260.         @turn_count_time = XRXS65::CPT if XRXS65::TC == nil
  261.       end
  262.     end
  263.     # CP のフレーム更新
  264.     cp_update
  265.     @cp_meters.refresh
  266.     # フル CP のバトラーが存在する場合、ターン開始
  267.     start_phase3 if anybody_movable?
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # ○ フル CP バトラーが存在するか?
  271.   #--------------------------------------------------------------------------
  272.   def anybody_movable?
  273.     for battler in $game_party.actors + $game_troop.enemies
  274.       return true if battler.cp_full?
  275.     end
  276.     return false
  277.   end
  278.   #--------------------------------------------------------------------------
  279.   # ● アクターコマンドウィンドウのセットアップ
  280.   #--------------------------------------------------------------------------
  281.   alias xrxs65_phase3_setup_command_window phase3_setup_command_window
  282.   def phase3_setup_command_window
  283.     # 効果音の再生
  284.     Audio.se_play(XRXS65::COMMAND_UP_SE) rescue nil
  285.     # 呼び戻す
  286.     xrxs65_phase3_setup_command_window
  287.   end
  288.   #--------------------------------------------------------------------------
  289.   # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
  290.   #--------------------------------------------------------------------------
  291.   alias xrxs_bsp1_update_phase3_basic_command update_phase3_basic_command
  292.   def update_phase3_basic_command
  293.     # C ボタンが押された場合
  294.     if Input.trigger?(Input::C)
  295.       # アクターコマンドウィンドウのカーソル位置で分岐
  296.       case @actor_command_window.index
  297.       when @cp_escape_actor_command_index # 逃げる
  298.         if $game_temp.battle_can_escape
  299.           # 決定 SE を演奏
  300.           $game_system.se_play($data_system.decision_se)
  301.           # アクションを設定
  302.           @active_battler.current_action.kind = 0
  303.           @active_battler.current_action.basic = 4
  304.           # 次のアクターのコマンド入力へ
  305.           phase3_next_actor
  306.         else
  307.           # ブザー SE を演奏
  308.           $game_system.se_play($data_system.buzzer_se)
  309.         end
  310.         return
  311.       end
  312.     end
  313.     # 呼び戻す
  314.     xrxs_bsp1_update_phase3_basic_command
  315.   end
  316.   #--------------------------------------------------------------------------
  317.   # ● メインフェーズ開始
  318.   #--------------------------------------------------------------------------
  319.   alias xrxs65_start_phase4 start_phase4
  320.   def start_phase4
  321.     # ターン数を引くことによって擬似的にカウントに変化を起こさせない
  322.     $game_temp.battle_turn -= 1
  323.     # フラグを退避
  324.     save_flags = $game_temp.battle_event_flags.dup
  325.     # 呼び戻す
  326.     xrxs65_start_phase4
  327.     # フラグを復旧
  328.     $game_temp.battle_event_flags = save_flags
  329.   end
  330.   #--------------------------------------------------------------------------
  331.   # ● 行動順序作成
  332.   #--------------------------------------------------------------------------
  333.   alias xrxs65_make_action_orders make_action_orders
  334.   def make_action_orders
  335.     # 呼び戻す
  336.     xrxs65_make_action_orders
  337.     # CPが不足している場合は @action_battlers から除外する
  338.     for battler in @action_battlers.dup
  339.       @action_battlers.delete(battler) unless battler.cp_full?
  340.     end
  341.   end
  342.   #--------------------------------------------------------------------------
  343.   # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  344.   #--------------------------------------------------------------------------
  345.   alias xrxs65_update_phase4_step2 update_phase4_step2
  346.   def update_phase4_step2
  347.     # ガードの解除
  348.     @active_battler.guarding = false
  349.     # CPの消費
  350.     @active_battler.cp = 0
  351.     # CP メーターの更新
  352.     @cp_meters.refresh
  353.     # 呼び戻す
  354.     xrxs65_update_phase4_step2
  355.     # 例外補正
  356.     return if @active_battler == nil
  357.     # ターンコントローラ
  358.     if @active_battler.is_a?(Game_Enemy) and @active_battler.index == XRXS65::TC
  359.       cp_turn_count
  360.     end
  361.   end
  362.   #--------------------------------------------------------------------------
  363.   # ● 基本アクション 結果作成
  364.   #--------------------------------------------------------------------------
  365.   alias xrxs65_make_basic_action_result make_basic_action_result
  366.   def make_basic_action_result
  367.     # 呼び戻す
  368.     xrxs65_make_basic_action_result
  369.     # 防御の場合
  370.     if @active_battler.current_action.basic == 1
  371.       @active_battler.guarding = true
  372.       return
  373.     end
  374.     # パーティの逃亡の場合
  375.     if @active_battler.current_action.basic == 4
  376.       # 逃走可能ではない場合
  377.       if $game_temp.battle_can_escape == false
  378.         # ブザー SE を演奏
  379.         $game_system.se_play($data_system.buzzer_se)
  380.         return
  381.       end
  382.       # パーティ全員の CP をクリア
  383.       for actor in $game_party.actors
  384.         actor.cp = 0
  385.       end
  386.       # CP メーターの更新
  387.       @cp_meters.refresh
  388.       # 逃走処理
  389.       update_phase2_escape
  390.       return
  391.     end
  392.   end
  393.   #--------------------------------------------------------------------------
  394.   # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  395.   #--------------------------------------------------------------------------
  396.   alias xrxs65_update_phase4_step5 update_phase4_step5
  397.   def update_phase4_step5
  398.     # 呼び戻す
  399.     xrxs65_update_phase4_step5
  400.     # CP メーターの更新
  401.     @cp_meters.refresh
  402.   end
  403. end
  404. #==============================================================================
  405. # --- CP メーターをまとめて管理するクラス、表示関係はすべてココ ---
  406. #==============================================================================
  407. class CP_Meters
  408.   #--------------------------------------------------------------------------
  409.   # ○ オブジェクト初期化
  410.   #--------------------------------------------------------------------------
  411.   def initialize
  412.     # メーター群の生成
  413.     @meters = []
  414.     for i in 0...$game_party.actors.size
  415.       make_meter(i)
  416.     end
  417.     refresh
  418.   end
  419.   #--------------------------------------------------------------------------
  420.   # ○ リフレッシュ
  421.   #--------------------------------------------------------------------------
  422.   def refresh
  423.     # 戦闘メンバー数の変更を判別
  424.     for i in @meters.size...$game_party.actors.size
  425.       make_meter(i)
  426.     end
  427.     for i in [email protected]
  428.       @meters[i].dispose
  429.       @meters[i] = nil
  430.     end
  431.     @meters.compact!
  432.     # 表示更新
  433.     for i in 0...$game_party.actors.size
  434.       actor = $game_party.actors[i]
  435.       @meters[i].line   = actor.cp_linetype
  436.       @meters[i].amount = actor.cp_lineamount
  437.     end
  438.   end
  439.   #--------------------------------------------------------------------------
  440.   # ○ メーターひとつの生成
  441.   #--------------------------------------------------------------------------
  442.   def make_meter(i)
  443.     # スキンの取得
  444.     skin = RPG::Cache.windowskin(XRXS65::SKIN)
  445.     #
  446.     space = 640 / XRXS65::MAX
  447.     case XRXS65::ALIGN
  448.     when 0
  449.       actor_x = i * space + 4
  450.     when 1
  451.       actor_x = (space * ((XRXS65::MAX - $game_party.actors.size)/2.0 + i)).floor
  452.     when 2
  453.       actor_x = (i + XRXS65::MAX - $game_party.actors.size) * space + 4
  454.     end
  455.     meter = MeterSprite.new(skin, XRXS65::LINE_HEIGHT)
  456.     meter.x = actor_x + XRXS65::X_OFFSET - skin.width
  457.     meter.y = XRXS65::Y_OFFSET
  458.     @meters[i] = meter
  459.   end
  460.   #--------------------------------------------------------------------------
  461.   # ○ 可視状態
  462.   #--------------------------------------------------------------------------
  463.   def visible=(b)
  464.     @meters.each{|sprite| sprite.visible = b }
  465.   end
  466.   #--------------------------------------------------------------------------
  467.   # ○ 解放
  468.   #--------------------------------------------------------------------------
  469.   def dispose
  470.     @meters.each{|sprite| sprite.dispose }
  471.   end
  472. end
  473. #==============================================================================
  474. # --- XRXS. レクタンギュラーメーター表示・極 ---
  475. #==============================================================================
  476. class MeterSprite < Sprite
  477.   #--------------------------------------------------------------------------
  478.   # ○ オブジェクト初期化
  479.   #--------------------------------------------------------------------------
  480.   def initialize(skin, line_height)
  481.     @skin   = skin
  482.     @width  = @skin.width
  483.     @height = line_height
  484.     @line   = 1
  485.     @amount = 0
  486.     @base_sprite = Sprite.new
  487.     @base_sprite.bitmap = @skin
  488.     @base_sprite.src_rect.set(0, 0, @width, @height)
  489.     @base_sprite.z = 601
  490.     super()
  491.     self.z = @base_sprite.z + 1
  492.     self.bitmap = @skin
  493.     self.line = 1
  494.   end
  495.   #--------------------------------------------------------------------------
  496.   # ○ 値の設定
  497.   #--------------------------------------------------------------------------
  498.   def line=(n)
  499.     @line = n
  500.     refresh
  501.   end
  502.   def amount=(n)
  503.     @amount = n
  504.     refresh
  505.   end
  506.   def refresh
  507.     self.src_rect.set(0, @line * @height, @width * @amount / 100, @height)
  508.   end
  509.   #--------------------------------------------------------------------------
  510.   # ○ 座標の設定
  511.   #--------------------------------------------------------------------------
  512.   def x=(n)
  513.     super
  514.     @base_sprite.x = n
  515.   end
  516.   def y=(n)
  517.     super
  518.     @base_sprite.y = n
  519.   end
  520.   #--------------------------------------------------------------------------
  521.   # ○ 解放
  522.   #--------------------------------------------------------------------------
  523.   def dispose
  524.     @base_sprite.dispose
  525.     super
  526.   end
  527. end

复制代码


但是无论是攻击、防御还是使用物品 消耗的CP值都是一样的  怎么能调的不同呢??
版务信息:本贴由楼主自主结贴~

                                                             『点击图片进入周小瑜的个人空间』

Lv1.梦旅人

魔星

梦石
0
星屑
50
在线时间
82 小时
注册时间
2007-7-29
帖子
707
2
 楼主| 发表于 2008-8-6 07:00:30 | 只看该作者
某个游戏的即时战斗脚本
  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 = 0
  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_THROW_ACTION = 65535 # 投掷
  38. CP_COST_BASIC_ATTACK = 65535 # 攻撃
  39. CP_COST_BASIC_GUARD = 32768 # 防御
  40. CP_COST_BASIC_NOTHING = 65535 # 不做任何事情
  41. CP_COST_BASIC_ESCAPE = 65535 # 逃跑
  42. end

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

  166. #==============================================================================
  167. # ■ Game_Battler
  168. #==============================================================================
  169. class Game_Battler
  170. attr_accessor now_guarding # 現在防御中フラグ
  171. attr_accessor cp # 現在CP
  172. attr_accessor slip_state_update_ban # スリップステート自動処理の禁止
  173. #--------------------------------------------------------------------------
  174. # ○ CP の変更
  175. #--------------------------------------------------------------------------
  176. def cp=(p)
  177. @cp = [[p, 0].max, 65535].min
  178. end
  179. #--------------------------------------------------------------------------
  180. # ● 防御中判定 [ 再定義 ]
  181. #--------------------------------------------------------------------------
  182. def guarding
  183. return @now_guarding
  184. end
  185. #--------------------------------------------------------------------------
  186. # ● コマンド入力可能判定
  187. #--------------------------------------------------------------------------
  188. alias xrxs_bp1_inputable inputable
  189. def inputable
  190. bool = xrxs_bp1_inputable
  191. return (bool and (@cp = 65535))
  192. end
  193. #--------------------------------------------------------------------------
  194. # ● ステート自然解除 (ターンごとに呼び出し)
  195. #--------------------------------------------------------------------------
  196. alias xrxs_bp1_remove_states_auto remove_states_auto
  197. def remove_states_auto
  198.   return if @slip_state_update_ban
  199.   xrxs_bp1_remove_states_auto
  200. end
  201. end
  202. #==============================================================================
  203. # ■ Game_Actor
  204. #==============================================================================
  205. class Game_Actor  Game_Battler
  206. #--------------------------------------------------------------------------
  207. # ● セットアップ
  208. #--------------------------------------------------------------------------
  209. alias xrxs_bp1_setup setup
  210.   def setup(actor_id)
  211.     xrxs_bp1_setup(actor_id)
  212.     @cp = 0
  213.     @now_guarding = false
  214.     @slip_state_update_ban = false
  215.   end
  216. end
  217. #==============================================================================
  218. # ■ Game_Enemy
  219. #==============================================================================
  220. class Game_Enemy  Game_Battler
  221. #--------------------------------------------------------------------------
  222. # ● オブジェクト初期化
  223. #--------------------------------------------------------------------------
  224. alias xrxs_bp1_initialize initialize
  225.   def initialize(troop_id, member_index)
  226.     xrxs_bp1_initialize(troop_id, member_index)
  227.     @cp = 0
  228.     @now_guarding = false
  229.     @slip_state_update_ban = false
  230.   end
  231. end
  232. #==============================================================================
  233. # ■ Window_All
  234. #==============================================================================
  235. class Window_All  Window_Base
  236.   def initialize
  237.     #super(0,0,640,480)
  238.     #..........................................................................
  239.     @enemy_cp_sprite = []
  240.     @enemy_cp_sprite_back = []
  241.     @enemy_cp_sprite_count = []
  242.     for actor in $game_troop.enemies
  243.       next if !actor.exist
  244.       @enemy_cp_sprite_count.push(actor.index)
  245.       @enemy_cp_sprite[actor.index] = Sprite.new
  246.       @enemy_cp_sprite[actor.index].bitmap = Bitmap.new(Graphicssystembattlehmcpsprite + actor.name)
  247.       @enemy_cp_sprite[actor.index].x = 450
  248.       @enemy_cp_sprite[actor.index].y = 25 + 11
  249.       @enemy_cp_sprite[actor.index].z = 102
  250.       @enemy_cp_sprite_back[actor.index] = Sprite.new
  251.       @enemy_cp_sprite_back[actor.index].bitmap = Bitmap.new(Graphicssystembattlehmcpcp_sprite)
  252.       @enemy_cp_sprite_back[actor.index].x = 450
  253.       @enemy_cp_sprite_back[actor.index].y = 25
  254.       @enemy_cp_sprite_back[actor.index].z = 102
  255.     end
  256.     refresh
  257.   end
  258.   def dispose
  259.     for actor_index in @enemy_cp_sprite_count
  260.       @enemy_cp_sprite[actor_index].bitmap.dispose
  261.       @enemy_cp_sprite[actor_index].dispose
  262.       @enemy_cp_sprite_back[actor_index].bitmap.dispose
  263.       @enemy_cp_sprite_back[actor_index].dispose
  264.     end
  265.   end
  266.   def refresh
  267.     for actor in $game_troop.enemies
  268.       next if !actor.exist
  269.       if actor.cp == nil
  270.         actor.cp = 0
  271.       end
  272.       @enemy_cp_sprite[actor.index].x = 450 + actor.cp  140 65535
  273.       @enemy_cp_sprite_back[actor.index].x = 450 + actor.cp  140 65535
  274.     end
  275.   end
  276. end

  277. #==============================================================================
  278. # ■ Window_BattleStatus
  279. #==============================================================================
  280. class Window_BattleStatus  Window_Base
  281.   #--------------------------------------------------------------------------
  282.   # ○ 公開インスタンス変数
  283.   #--------------------------------------------------------------------------
  284.   attr_accessor update_cp_only # CPメーターのみの更新
  285.   #--------------------------------------------------------------------------
  286.   # ● オブジェクト初期化
  287.   #--------------------------------------------------------------------------
  288.   alias xrxs_bp1_initialize initialize
  289.   def initialize
  290.     @update_cp_only = false
  291.     @wall = Window_All.new
  292.     xrxs_bp1_initialize
  293.    
  294.   end
  295.   def dispose
  296.     super
  297.     @wall.dispose
  298.     @hp_bitmap.dispose
  299.     @mp_bitmap.dispose
  300.     @cp_bitmap.dispose
  301.     @cp_back_bar.dispose
  302.     for actor in $game_party.actors
  303.       @actor_cp_sprite[actor.index].bitmap.dispose
  304.       @actor_cp_sprite[actor.index].dispose
  305.       @actor_cp_sprite_back[actor.index].bitmap.dispose
  306.       @actor_cp_sprite_back[actor.index].dispose
  307.     end
  308.     for actor_index in 1..$game_party.actors.size
  309.       @sta_back[actor_index].bitmap.dispose
  310.       @sta_back[actor_index].dispose
  311.       @sta_output[actor_index].bitmap.dispose
  312.       @sta_output[actor_index].dispose
  313.       @cp_output[actor_index].bitmap.dispose
  314.       @cp_output[actor_index].dispose
  315.     end
  316.   end
  317.   #--------------------------------------------------------------------------
  318.   # ● リフレッシュ
  319.   #--------------------------------------------------------------------------
  320.   alias xrxs_bp1_refresh refresh
  321.   def refresh
  322.     unless @update_cp_only
  323.       xrxs_bp1_refresh
  324.     end
  325.     refresh_cp
  326.     @wall.refresh
  327.   end
  328.   #--------------------------------------------------------------------------
  329.   # ○ リフレッシュ(CPのみ)
  330.   #--------------------------------------------------------------------------
  331.   def refresh_cp
  332.     #........................................................................
  333.     for actor in $game_party.actors
  334.       next if !actor.exist
  335.       if actor.cp == nil
  336.         actor.cp = 0
  337.       end
  338.       @actor_cp_sprite[actor.index].x = 450 + actor.cp  140 65535
  339.       @actor_cp_sprite_back[actor.index].x = 450 + actor.cp  140 65535
  340.     end
  341.     for i in 0...$game_party.actors.size
  342.       actor = $game_party.actors[i]
  343.       if actor.cp == nil
  344.         actor.cp = 0
  345.       end
  346.       @cp_output[i + 1].bitmap.clear
  347.       @cp_output[i + 1].bitmap.font.size = 11
  348.       @cp_output[i + 1].bitmap.font.name = 宋体
  349.       @cp_output[i + 1].bitmap.font.color.set(50, 50, 50)
  350.       cp_height = actor.cp  @cp_bitmap.height  65535
  351.       cp_rect = Rect.new(0, @cp_bitmap.height - cp_height, @cp_bitmap.width, cp_height)
  352.       @cp_output[i + 1].bitmap.blt(9, 6 + @cp_bitmap.height - cp_height, @cp_bitmap, cp_rect)
  353.     end
  354.     #........................................................................
  355.   end
  356. end
  357. #==============================================================================
  358. # ■ Scene_Battle
  359. #==============================================================================
  360. class Scene_Battle
  361. #--------------------------------------------------------------------------
  362. # ● フレーム更新
  363. #--------------------------------------------------------------------------
  364. alias xrxs_bp1_update update
  365. def update
  366. xrxs_bp1_update
  367. # CP更新
  368. @cp_thread.update
  369. end
  370. #--------------------------------------------------------------------------
  371. # ● バトル終了
  372. # result  結果 (0勝利 1敗北 2逃走)
  373. #--------------------------------------------------------------------------
  374. alias xrxs_bp1_battle_end battle_end
  375. def battle_end(result)
  376. # CPカウントを停止する
  377. @cp_thread.stop
  378. # 呼び戻す
  379. xrxs_bp1_battle_end(result)
  380. end
  381. #--------------------------------------------------------------------------
  382. # ● プレバトルフェーズ開始
  383. #--------------------------------------------------------------------------
  384. alias xrxs_bp1_start_phase1 start_phase1
  385. def start_phase1
  386. @agi_total = 0
  387. # CP加算を開始する
  388. @cp_thread = Scene_Battle_CP.new
  389. # インデックスを計算
  390. @cp_escape_actor_command_index = @actor_command_window.height32 - 1
  391. # アクターコマンドウィンドウに追加
  392. #@actor_command_window.add_command(逃跑)
  393. if !$game_temp.battle_can_escape
  394. #@actor_command_window.disable_item(@cp_escape_actor_command_index)
  395. end
  396. # 呼び戻す
  397. xrxs_bp1_start_phase1
  398. end
  399. #--------------------------------------------------------------------------
  400. # ● パーティコマンドフェーズ開始
  401. #--------------------------------------------------------------------------
  402. alias xrxs_bp1_start_phase2 start_phase2
  403. def start_phase2
  404. xrxs_bp1_start_phase2
  405. @party_command_window.active = false
  406. @party_command_window.visible = false
  407. # CP加算を再開する
  408. @cp_thread.stop = false
  409. # 次へ
  410. start_phase3
  411. end
  412. #--------------------------------------------------------------------------
  413. # ● アクターコマンドウィンドウのセットアップ
  414. #--------------------------------------------------------------------------
  415. alias xrxs_bp1_phase3_setup_command_window phase3_setup_command_window
  416. def phase3_setup_command_window
  417. # CPスレッドを一時停止する
  418. @cp_thread.stop = true
  419. # ウィンドウのCP更新
  420. @status_window.refresh_cp
  421. # @active_battlerの防御を解除
  422. @active_battler.now_guarding = false
  423. # 効果音の再生
  424. Audio.se_play(DATA_SYSTEM_COMMAND_UP_SE) if DATA_SYSTEM_COMMAND_UP_SE !=
  425. # 呼び戻す
  426. xrxs_bp1_phase3_setup_command_window
  427. end
  428. #--------------------------------------------------------------------------
  429. # ● フレーム更新 (アクターコマンドフェーズ  基本コマンド)
  430. #--------------------------------------------------------------------------
  431. alias xrxs_bsp1_update_phase3_basic_command update_phase3_basic_command
  432. def update_phase3_basic_command
  433. # C ボタンが押された場合
  434. if Input.trigger(InputC)
  435. # アクターコマンドウィンドウのカーソル位置で分岐
  436. case @actor_command_window.index
  437. when @cp_escape_actor_command_index # 逃げる
  438. if $game_temp.battle_can_escape
  439. # 決定 SE を演奏
  440. $game_system.se_play($data_system.decision_se)
  441. # アクションを設定
  442. @active_battler.current_action.kind = 0
  443. @active_battler.current_action.basic = 4
  444. # 次のアクターのコマンド入力へ
  445. end_atk(@active_battler.index)
  446. phase3_next_actor
  447. else
  448. # ブザー SE を演奏
  449. $game_system.se_play($data_system.buzzer_se)
  450. end
  451. return
  452. end
  453. end
  454. xrxs_bsp1_update_phase3_basic_command
  455. end
  456. #--------------------------------------------------------------------------
  457. # ● メインフェーズ開始
  458. #--------------------------------------------------------------------------
  459. alias xrxs_bp1_start_phase4 start_phase4
  460. def start_phase4
  461. # 呼び戻す
  462. xrxs_bp1_start_phase4
  463. # CPスレッドを一時停止する
  464. unless @action_battlers.empty
  465. @cp_thread.stop = true
  466. end
  467. end
  468. #--------------------------------------------------------------------------
  469. # ● 行動順序作成
  470. #--------------------------------------------------------------------------
  471. alias xrxs_bp1_make_action_orders make_action_orders
  472. def make_action_orders
  473.   xrxs_bp1_make_action_orders
  474.   # 全員のCPを確認
  475.   exclude_battler = []
  476.   for battler in @action_battlers
  477.   # CPが不足している場合は @action_battlers から除外する
  478.     if battler.cp  65535
  479.     exclude_battler.push(battler)
  480.     end
  481.   end
  482.   @action_battlers -= exclude_battler
  483. end
  484. #--------------------------------------------------------------------------
  485. # ● フレーム更新 (メインフェーズ ステップ 1  アクション準備)
  486. #--------------------------------------------------------------------------
  487. alias xrxs_bp1_update_phase4_step1 update_phase4_step1
  488. def update_phase4_step1
  489. # 初期化
  490. @phase4_act_continuation = 0
  491. # 勝敗判定
  492. if judge
  493. @cp_thread.stop
  494. # 勝利または敗北の場合  メソッド終了
  495. return
  496. end
  497. # 未行動バトラー配列の先頭から取得
  498. @active_battler = @action_battlers[0]
  499. # ステータス更新をCPだけに限定。
  500. @status_window.update_cp_only = true
  501. # ステート更新を禁止。
  502. # 戻す
  503. xrxs_bp1_update_phase4_step1
  504. # @status_windowがリフレッシュされなかった場合は手動でリフレッシュ(CPのみ)
  505. if @phase4_step != 2
  506. # リフレッシュ
  507. @status_window.refresh
  508. # 軽量化:たったコレだけΣ(w
  509. Graphics.frame_reset
  510. end
  511. # 禁止を解除
  512. @status_window.update_cp_only = false
  513. end
  514. #--------------------------------------------------------------------------
  515. # ● フレーム更新 (メインフェーズ ステップ 2  アクション開始)
  516. #--------------------------------------------------------------------------
  517. alias xrxs_bp1_update_phase4_step2 update_phase4_step2
  518. def update_phase4_step2
  519. # 強制アクションでなければ
  520. unless @active_battler.current_action.forcing
  521. # 制約が [敵を通常攻撃する] か [味方を通常攻撃する] の場合
  522. if @active_battler.restriction == 2 or @active_battler.restriction == 3
  523. # アクションに攻撃を設定
  524. @active_battler.current_action.kind = 0
  525. @active_battler.current_action.basic = 0
  526. end
  527. # 制約が [行動できない] の場合
  528. if @active_battler.restriction == 4
  529. # アクション強制対象のバトラーをクリア
  530. $game_temp.forcing_battler = nil
  531. if @phase4_act_continuation == 0 and @active_battler.cp = 65535
  532. # ステート自然解除
  533. @active_battler.remove_states_auto
  534. # CP消費
  535. @active_battler.cp -= 65535
  536. # ステータスウィンドウをリフレッシュ
  537. @status_window.refresh
  538. end
  539. # ステップ 1 に移行
  540. @phase4_step = 1
  541. return
  542. end
  543. end
  544. # アクションの種別で分岐
  545. case @active_battler.current_action.kind
  546. when 0
  547. # 攻撃防御逃げる何もしない時の共通消費CP
  548. @active_battler.cp -= CP_COST_BASIC_ACTIONS if @phase4_act_continuation == 0
  549. when 1
  550. # スキル使用時の消費CP
  551. @active_battler.cp -= CP_COST_SKILL_ACTION if @phase4_act_continuation == 0
  552. when 2
  553. # アイテム使用時の消費CP
  554. @active_battler.cp -= CP_COST_ITEM_ACTION if @phase4_act_continuation == 0
  555. when 11
  556. @active_battler.cp -= CP_COST_THROW_ACTION if @phase4_act_continuation == 0
  557. end
  558. # ステート自然解除
  559. @active_battler.remove_states_auto
  560. # 呼び戻す
  561. xrxs_bp1_update_phase4_step2
  562. end
  563.   #--------------------------------------------------------------------------
  564.   # ● 基本アクション 結果作成
  565.   #--------------------------------------------------------------------------
  566.   alias xrxs_bp1_make_basic_action_result make_basic_action_result
  567.   def make_basic_action_result
  568.     # 攻撃の場合
  569.     if @active_battler.current_action.basic == 0 and @phase4_act_continuation == 0
  570.       @active_battler.cp -= CP_COST_BASIC_ATTACK # 攻撃時のCP消費
  571.     end
  572.     # 防御の場合
  573.     if @active_battler.current_action.basic == 1 and @phase4_act_continuation == 0
  574.       @active_battler.cp -= CP_COST_BASIC_GUARD # 防御時のCP消費
  575.       # @active_battlerの防御をON
  576.       @active_battler.now_guarding = true
  577.     end
  578.     # 敵の逃げるの場合
  579.     if @active_battler.is_a(Game_Enemy) and
  580.       @active_battler.current_action.basic == 2 and @phase4_act_continuation == 0
  581.       @active_battler.cp -= CP_COST_BASIC_ESCAPE # 逃走時のCP消費
  582.     end
  583.     # 何もしないの場合
  584.     if @active_battler.current_action.basic == 3 and @phase4_act_continuation == 0
  585.       @active_battler.cp -= CP_COST_BASIC_NOTHING # 何もしない時のCP消費
  586.     end
  587.     # 逃げるの場合
  588.     if @active_battler.current_action.basic == 4 and @phase4_act_continuation == 0
  589.       @active_battler.cp -= CP_COST_BASIC_ESCAPE # 逃走時のCP消費
  590.       # 逃走可能ではない場合
  591.       if $game_temp.battle_can_escape == false
  592.         # ブザー SE を演奏
  593.         $game_system.se_play($data_system.buzzer_se)
  594.         return
  595.       end
  596.       # 逃走処理
  597.       update_phase2_escape
  598.       return
  599.     end
  600.     # 呼び戻す
  601.     xrxs_bp1_make_basic_action_result
  602.   end
  603. end


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

下面设置了怎样使消耗的CP值不同  但是我脚本不大好  不会搬到上面的脚本里面去

希望大家帮帮忙

                                                             『点击图片进入周小瑜的个人空间』
回复 支持 反对

使用道具 举报

Lv1.梦旅人

辉瑞中国首席研究员<

梦石
0
星屑
50
在线时间
142 小时
注册时间
2008-1-18
帖子
2129
3
发表于 2008-8-6 23:49:53 | 只看该作者
alias xrxs65_update_phase4_step2 update_phase4_step2
  def update_phase4_step2
    # ガードの解除
    @active_battler.guarding = false
    # CPの消
      @active_battler.cp = 0
    # CP メーターの更新
    @cp_meters.refresh
    # 呼び戻す
    xrxs65_update_phase4_step2
    # 例外補正
    return if @active_battler == nil
    # ターンコントローラ
    if @active_battler.is_a?(Game_Enemy) and @active_battler.index == XRXS65::TC
      cp_turn_count
    end
  end

CASE @actor_command_window.index
  WHEN 0
   @active_battler.cp -= 数值
  WHEN 1
   .........
来6r就是等某位仁兄的巨坑

褴褛着身行无端,囊中羞涩空心酸。
平生几无得意事,倒塔泡面宅寝室。
惟羡隔壁高帅富,雨露春风月夜声。
青丝无处觅其踪,只有硬盘苍井空。
莫云男儿空悲愁,鸿鹄岂不天际游。
坐断天下执鹿首,千百金帛万兜鍪。
夜深忽梦某年月,再见女神欲语迟。
吊丝终有逆袭日,木耳再无回粉时。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

魔星

梦石
0
星屑
50
在线时间
82 小时
注册时间
2007-7-29
帖子
707
4
 楼主| 发表于 2008-8-7 04:54:41 | 只看该作者
加到什么地方。。。。

就一个这给版在这儿了^

                                                             『点击图片进入周小瑜的个人空间』
回复 支持 反对

使用道具 举报

Lv1.梦旅人

辉瑞中国首席研究员<

梦石
0
星屑
50
在线时间
142 小时
注册时间
2008-1-18
帖子
2129
5
发表于 2008-8-7 04:59:39 | 只看该作者
alias xrxs65_update_phase4_step2 update_phase4_step2
def update_phase4_step2
   # ガードの解除
   @active_battler.guarding = false
  

  CASE @actor_command_window.index
WHEN 0
  @active_battler.cp -= 数值
WHEN 1
  .........



   # CP メーターの更新
   @cp_meters.refresh
   # 呼び戻す
   xrxs65_update_phase4_step2
   # 例外補正
   return if @active_battler == nil
   # ターンコントローラ
   if @active_battler.is_a?(Game_Enemy) and @active_battler.index == XRXS65::TC
     cp_turn_count
   end
end

我都把脚本写出来了,还不满足....
不要当伸手党

http://rpg.blue/viewthread.php?tid=74862

系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
来6r就是等某位仁兄的巨坑

褴褛着身行无端,囊中羞涩空心酸。
平生几无得意事,倒塔泡面宅寝室。
惟羡隔壁高帅富,雨露春风月夜声。
青丝无处觅其踪,只有硬盘苍井空。
莫云男儿空悲愁,鸿鹄岂不天际游。
坐断天下执鹿首,千百金帛万兜鍪。
夜深忽梦某年月,再见女神欲语迟。
吊丝终有逆袭日,木耳再无回粉时。
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-8-14 03:11

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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