Project1
标题:
关于CP制在战斗中新加入队伍人员的判断
[打印本页]
作者:
zgm1100
时间:
2011-10-20 09:02
标题:
关于CP制在战斗中新加入队伍人员的判断
# ▼▲▼ XRXS65. CP制御ターンシステム ver.β ▼▲▼ built 201120
# by 桜雅 在土
#==============================================================================
# □ カスタマイズポイント
#==============================================================================
module XRXS65
#
# “速度战”(数字越大更快)
#
SPEED = 1.0
#
# CP在战斗开始。固定值和占用
#
CP_PRESET_FIXNUM = 0
CP_PRESET_RATIO = 2.0
#
# 转动控制器(零:计数使能/关闭。
# 数値 : 该指数已主宰敌人)
#
TC = 0
#
# 数/转(如果启用TC被忽略。)
#
CPT = 40
#
# 皮肤CP
#
SKIN = "asd" # 窗口图形名称(Graphics/Windowskins中添加)
LINE_HEIGHT = 5 # スキンの"一行"の縦幅[単位:ピクセル]
#
# 表示位置セッティング
#
X_OFFSET = 140 # 横位置
Y_OFFSET = 467 # 縦位置
Y_FF = 10
ALIGN = 0 #对齐方式(CP条的位置。0:左对齐 1:中央 2:右对齐)
MAX = 4 # 確保するサイズ[単位:~人分]
#
# アクターコマンドがポップしたときの効果音
#
COMMAND_UP_SE = "Audio/SE/046-Book01.ogg"
end
#==============================================================================
# --- CP メーターの描画情報の取得 --- (Game_Battlerにインクルードされます)
#==============================================================================
module XRXS_CP
#--------------------------------------------------------------------------
# ○ 皮肤线(或使用排至皮肤)
#--------------------------------------------------------------------------
def cp_linetype
# 对于第二行使用的全部CP皮肤
return 2 if self.cp_full?
# 通常使用的皮肤的第一行
return 1
end
#--------------------------------------------------------------------------
# ○ 米卷[单位:%]
#--------------------------------------------------------------------------
def cp_lineamount
# 对于非战斗显示为0%
return 0 if self.dead?
# 要返回转换到%CP值
return 100 * self.cp / self.max_cp
end
end
#
# 定制点为止。
#------------------------------------------------------------------------------
#==============================================================================
# --- XRXS. CP機構 ---
#==============================================================================
module XRXS_CP_SYSTEM
#----------------------------------------------------------------------------
# ○ AGI的总收购
#----------------------------------------------------------------------------
def self.total_agi
total = 0
for battler in $game_party.actors + $game_troop.enemies
total += battler.agi
end
return total
end
end
#==============================================================================
# --- 模块的功能添加到巴特勒CP---
#==============================================================================
module XRXS_CP
#--------------------------------------------------------------------------
# ○ 最大 CP の取得
#--------------------------------------------------------------------------
def max_cp
return 65535
end
#--------------------------------------------------------------------------
# ○ 获取和设置CP
#--------------------------------------------------------------------------
def cp
return @cp == nil ? @cp = 0 : @cp
end
def cp=(n)
@cp = [[n.to_i, 0].max, self.max_cp].min
end
#--------------------------------------------------------------------------
# ○ CP 初期設定
#--------------------------------------------------------------------------
def cp_preset
percent = self.max_cp * XRXS65::CP_PRESET_RATIO * (rand(16) + 16) * self.agi / XRXS_CP_SYSTEM.total_agi / 24
self.cp = XRXS65::CP_PRESET_FIXNUM #+ percent
end
#--------------------------------------------------------------------------
# ○ CP 计数
#--------------------------------------------------------------------------
def cp_update
self.cp += XRXS65::SPEED * 4096 * self.agi / XRXS_CP_SYSTEM.total_agi
end
#--------------------------------------------------------------------------
# ○ CP 填写?
#--------------------------------------------------------------------------
def cp_full?
return @cp == self.max_cp
end
end
class Game_Battler
include XRXS_CP
end
#==============================================================================
# --- 保护功能 ---
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ○ 国旗卫士
#--------------------------------------------------------------------------
def guarding=(n)
@guarding = n
end
#--------------------------------------------------------------------------
# ● 防御中判定 [再定義]
#--------------------------------------------------------------------------
def guarding?
return @guarding
end
end
#==============================================================================
# --- 员的决定可以输入命令“:未经CP没有命令 ---
#==============================================================================
module XRXS_CP_INPUTABLE
def inputable?
return (self.cp_full? and super)
end
end
class Game_Actor < Game_Battler
include XRXS_CP_INPUTABLE
end
#==============================================================================
# --- 敌人“采取行动的决定”:没有不带CP命令 ---
#==============================================================================
module XRXS_CP_MOVABLE
def movable?
return (self.cp_full? and super)
end
end
class Game_Enemy < Game_Battler
include XRXS_CP_MOVABLE
end
#==============================================================================
# --- 计数打击CP ---
#==============================================================================
module XRXS_CP_Battle
#--------------------------------------------------------------------------
# ○ 初始化各方CP
#--------------------------------------------------------------------------
def cp_preset_party
for actor in $game_party.actors
actor.cp_preset
end
end
#--------------------------------------------------------------------------
# ○ 初始化所有的部队CP
#--------------------------------------------------------------------------
def cp_preset_troop
for enemy in $game_troop.enemies
enemy.cp_preset
end
end
#--------------------------------------------------------------------------
# ○ 统计了所有的CP巴特勒
#--------------------------------------------------------------------------
def cp_update
for battler in $game_party.actors + $game_troop.enemies
battler.cp_update
end
end
end
class Scene_Battle
include XRXS_CP_Battle
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
alias xrxs65_main main
def main
# 初期化
@extra_sprites = [] if @extra_sprites == nil
# CP の初期化
cp_preset_party
# CP 创建一米
@cp_meters = CP_Meters.new
# CP 额外的电表登记精灵
@extra_sprites.push(@cp_meters)
# 呼び戻す
xrxs65_main
# メーターの解放
@cp_meters.dispose
end
#--------------------------------------------------------------------------
# ● 前战斗阶段开始
#--------------------------------------------------------------------------
alias xrxs65_start_phase1 start_phase1
def start_phase1
# 召回
xrxs65_start_phase1
#初始化的CP
cp_preset_troop
#更新的CP米
@cp_meters.refresh
# 计算指数
@cp_escape_actor_command_index = @actor_command_window.height/32 - 1
end
#--------------------------------------------------------------------------
# ● 党指挥阶段开始
#--------------------------------------------------------------------------
alias xrxs65_start_phase2 start_phase2
def start_phase2
# 召回
xrxs65_start_phase2
# 禁用党指挥窗口
# @party_command_window.active = false
# @party_command_window.visible = false
# 强制保持第2期
@phase = 2
# 但是,如果已经有一个动作获得3
start_phase3 if anybody_movable?
end
#--------------------------------------------------------------------------
# ○ 打开系统计数CP
#--------------------------------------------------------------------------
def cp_turn_count
$game_temp.battle_turn += 1
# 搜索之战事件的所有网页
for index in 0...$data_troops[@troop_id].pages.size
# 跨度此网页转,如果
if $data_troops[@troop_id].pages[index].span == 1
# 清除hasBeenDone
$game_temp.battle_event_flags[index] = false
end
end
end
#--------------------------------------------------------------------------
# ●新帧(党的指挥阶段)。
#--------------------------------------------------------------------------
alias xrxs65_update_phase2 update_phase2
def update_phase2
# 党的命令窗口中禁用索引
# @party_command_window.index = -1
# 召回
xrxs65_update_phase2
# 例外補正
@turn_count_time = 1 if @turn_count_time == nil
# 关闭数
if @turn_count_time > 0
@turn_count_time -= 1
if @turn_count_time == 0
cp_turn_count
@turn_count_time = XRXS65::CPT if XRXS65::TC == nil
end
end
#CP帧更新
cp_update
@cp_meters.refresh
# 如果你有一个完整的巴特勒CP,回合开始
start_phase3 if anybody_movable?
end
#--------------------------------------------------------------------------
# ○ 是否有一个完整的CP巴特勒?
#--------------------------------------------------------------------------
def anybody_movable?
for battler in $game_party.actors + $game_troop.enemies
return true if battler.cp_full?
end
return false
end
#--------------------------------------------------------------------------
# ● 演员成立了一个命令窗口
#--------------------------------------------------------------------------
alias xrxs65_phase3_setup_command_window phase3_setup_command_window
def phase3_setup_command_window
# 効果音の再生
Audio.se_play(XRXS65::COMMAND_UP_SE) rescue nil
# 呼び戻す
xrxs65_phase3_setup_command_window
end
#--------------------------------------------------------------------------
# ● 帧更新(演员命令阶段:基本命令)
#--------------------------------------------------------------------------
alias xrxs_bsp1_update_phase3_basic_command update_phase3_basic_command
def update_phase3_basic_command
xrxs_bsp1_update_phase3_basic_command
end
#--------------------------------------------------------------------------
# ● 主要阶段开始
#--------------------------------------------------------------------------
alias xrxs65_start_phase4 start_phase4
def start_phase4
# 不会造成减去圈数在数人为改变
$game_temp.battle_turn -= 1
# 保存标志
save_flags = $game_temp.battle_event_flags.dup
# 召回
xrxs65_start_phase4
# 恢复的标志
$game_temp.battle_event_flags = save_flags
end
#--------------------------------------------------------------------------
# ● 行動順序作成
#--------------------------------------------------------------------------
alias xrxs65_make_action_orders make_action_orders
def make_action_orders
# 召回
xrxs65_make_action_orders
# 如果CP是从@缺少排除action_battlers
for battler in @action_battlers.dup
@action_battlers.delete(battler) unless battler.cp_full?
end
end
#--------------------------------------------------------------------------
# ● 帧更新 (第2步主要阶段:动作開始)
#--------------------------------------------------------------------------
alias xrxs65_update_phase4_step2 update_phase4_step2
def update_phase4_step2
# 守卫解除
@active_battler.guarding = false
a = @actor_command_window.index
case a
when 0
@active_battler.cp -= 30000
when 1
if skill.element_set.include?($data_system.elements.index("无CD"))
@active_battler.cp -= 30000
else
@active_battler.cp -= 65535
end
when 2
@active_battler.cp -= 30000
when 3
if item.element_set.include?($data_system.elements.index("无CD"))
@active_battler.cp -= 0
else
@active_battler.cp -= 65535
end
when 4
@active_battler.cp -= 65535
end
# 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
#--------------------------------------------------------------------------
# ● 创建基本动作结果
#--------------------------------------------------------------------------
alias xrxs65_make_basic_action_result make_basic_action_result
def make_basic_action_result
# 召回
xrxs65_make_basic_action_result
# 防御の場合
@active_battler.guarding = false
if @active_battler.current_action.basic == 1
@active_battler.guarding = true
return
end
# 如果党的逃逸
if @active_battler.current_action.basic == 4
# 如果你无法逃避
if $game_temp.battle_can_escape == false
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 清除各方CP
for actor in $game_party.actors
actor.cp = 0
end
# 更新的CP米
@cp_meters.refresh
# 逃走処理
update_phase2_escape
return
end
end
#--------------------------------------------------------------------------
# ● 更新帧(步骤5个主要阶段:查看伤害)
#--------------------------------------------------------------------------
alias xrxs65_update_phase4_step5 update_phase4_step5
def update_phase4_step5
# 召回
xrxs65_update_phase4_step5
#更新的CP米
@cp_meters.refresh
end
end
#==============================================================================
# --- 米级的CP,所有的关系都显示管理集 ---
#==============================================================================
class CP_Meters
#--------------------------------------------------------------------------
# ○ 对象初始化
#--------------------------------------------------------------------------
def initialize
# 仪表组发电
@meters = []
for i in 0...$game_party.actors.size
make_meter(i)
end
refresh
end
#--------------------------------------------------------------------------
# ○ 刷新
#--------------------------------------------------------------------------
def refresh
#更改成员的数量来确定打击
for i in @meters.size...$game_party.actors.size
make_meter(i)
end
for i in
[email protected]
@meters[i].dispose
@meters[i] = nil
end
@meters.compact!
# 表示更新
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
@meters[i].line = actor.cp_linetype
@meters[i].amount = actor.cp_lineamount
end
end
#--------------------------------------------------------------------------
# ○ 一代米
#--------------------------------------------------------------------------
def make_meter(i)
# スキンの取得
skin = RPG::Cache.windowskin(XRXS65::SKIN)
#
space = 640 / XRXS65::MAX
case XRXS65::ALIGN
when 0
actor_x = i * space + 4
when 1
actor_x = (space * ((XRXS65::MAX - $game_party.actors.size)/2.0 + i)).floor
when 2
actor_x = (i + XRXS65::MAX - $game_party.actors.size) * space + 4
end
meter = MeterSprite.new(skin,XRXS65::LINE_HEIGHT)
meter.x = actor_x + XRXS65::X_OFFSET - skin.width
meter.y = XRXS65::Y_OFFSET
@meters[i] = meter
end
#--------------------------------------------------------------------------
# ○ 可視状態
#--------------------------------------------------------------------------
def visible=(b)
@meters.each{|sprite| sprite.visible = b }
end
#--------------------------------------------------------------------------
# ○ 解放
#--------------------------------------------------------------------------
def dispose
@meters.each{|sprite| sprite.dispose }
end
end
#==============================================================================
# --- XRXS。矩形仪表显示?极 ---
#==============================================================================
class MeterSprite < Sprite
#--------------------------------------------------------------------------
# ○ 对象初期化
#--------------------------------------------------------------------------
def initialize(skin, line_height)
@skin = skin
@width = @skin.width
@height = line_height
@line = 1
@amount = 0
@base_sprite = Sprite.new
@base_sprite.bitmap = @skin
@base_sprite.src_rect.set(0, 0, @width, @height)
@base_sprite.z = 9000 #601
super()
self.z = @base_sprite.z + 1
self.bitmap = @skin
self.line = 1
end
#--------------------------------------------------------------------------
# ○ 値の設定
#--------------------------------------------------------------------------
def line=(n)
@line = n
refresh
end
def amount=(n)
@amount = n
refresh
end
def refresh
self.src_rect.set(0, @line * @height, @width * @amount / 100, @height)
end
#--------------------------------------------------------------------------
# ○ 座標の設定
#--------------------------------------------------------------------------
def x=(n)
super
@base_sprite.x = n
end
def y=(n)
super
@base_sprite.y = n
end
#--------------------------------------------------------------------------
# ○ 解放
#--------------------------------------------------------------------------
def dispose
@base_sprite.dispose
super
end
end
复制代码
在这个脚本中新加入队伍的人员可以马上行动。在哪里改。??
还有从696行开始是消耗CP的判断。skill.element_set.include?($data_system.elements.index("无CD"))
是判断技能的属性。我想再加个判断物品的。但item.element_set.include?($data_system.elements.index("无CD"))
不正确,。。,该怎么改?
zgm1100于2011-10-21 13:08补充以下内容:
坐等一天。。无人甩我、。、、、、、、、、、、、、、、、、
zgm1100于2011-10-21 13:08补充以下内容:
坐等中
zgm1100于2011-10-22 00:43补充以下内容:
zgm1100于2011-10-22 00:44补充以下内容:
..................................没人。。。。
zgm1100于2011-10-22 02:59补充以下内容:
{:4_113:}{:4_113:}{:4_113:} dsu_plus_rewardpost_czw
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1