def rare_item
return get_item_from_name("r")#オプション"r"の文字列から取得
end
#===================================================
#*Nameからアイテムを抜き出す処理
#===================================================
def get_item_from_name(opt)
names = $data_enemies[@enemy_id].name.split(/-/)
if names.size > 1
for i in 1...names.size
if names[0,1] != opt
next
end
names.sub!(/^.(.*)/){$1}
ary = names.split(/ /)
if ary[0][0,1] == "g"
cgy = "g"
id = 0
if ary[1].nil?
ary[1] = "1"
elsif ary[1].sub!(/^([0-9]+)/){$1}.nil?
ary[1] = "1"
end
possession = {"Category"=>cgy, "ID"=>id, "Num"=>ary[1].to_i}
return possession
elsif ary[0][0,1] == "d"
cgy = ""
id = 0
if self.item_id != 0
cgy = "i"
id = self.item_id
elsif self.weapon_id != 0
cgy = "w"
id = self.weapon_id
elsif self.armor_id != 0
cgy = "a"
id = self.armor_id
else
return nil
end
if ary[1].nil?
ary[1] = "1"
elsif ary[1].sub!(/^([0-9]+)/){$1}.nil?
ary[1] = "1"
end
possession = {"Category"=>cgy, "ID"=>id, "Num"=>ary[1].to_i}
return possession
elsif !ary[0].sub!(/^([iwa])/){$1}.nil? && !ary[1].sub!(/^([0-9]+)/){$1}.nil?
if ary[2].nil? || ary[2].sub!(/^([0-9]+)/){$1}.nil?
ary[2] = "1"
end
possession = {"Category"=>ary[0], "ID"=>ary[1].to_i, "Num"=>ary[2].to_i}
return possession
if !@item_possession || pos.nil?
@effect_message = "没有东西可偷。"
#self.damage = "Miss"
return false
end
#盗み成功判定 アジリティが同一で50%、2倍で100%
if rand(100) <= ((user.agi+0.01)/(self.agi+0.01))*100/2
r_pos = self.rare_item
#レアアイテム判定
if !r_pos.nil? && rand(10) <= 1
pos = r_pos
end
case pos["Category"]
when "i"
item = $data_items[pos["ID"]]
if item.nil?
print "这个物品不存在!"
return false
end
$game_party.gain_item(item.id, pos["Num"])
when "w"
item = $data_weapons[pos["ID"]]
if item.nil?
print "这个物品不存在!"
return false
end
$game_party.gain_weapon(item.id, pos["Num"])
when "a"
item = $data_armors[pos["ID"]]
if item.nil?
print "这个物品不存在!"
return false
end
$game_party.gain_armor(item.id, pos["Num"])
when "g"
# ゴールド獲得
$game_party.gain_gold(pos["Num"])
end
if pos["Category"] == "g"
@effect_message = "#{pos["Num"]}#{$data_system.words.gold}偷到!"
else
@effect_message = "#{item.name}#{pos["Num"]}个偷到!"
end
@item_possession = false
self.damage = "Steal!" if self.damage == "Miss"
return true
else
@effect_message = "没有东西可偷???"
#self.damage = "Miss
return false
end
return false # 念のためfalse返す処理追加
# 多分なくてもifの結果(false)が返ると思うけど…
end
end
#=============================================================================
# ■ ライブラ スキル実装スクリプト 2004/09/24 - 0.1α
#=============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 追加公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :libla_reserve # ライブラ予約
#--------------------------------------------------------------------------
# ● 初期化
#--------------------------------------------------------------------------
alias before_libra_initialize initialize
def initialize
before_libra_initialize
# 「ライブラ」属性のID取得
@libra_element_id = $data_system.elements.index(LIBLA_SKILL_ELEMENT_NAME)
@libra_element_id = 0 if @libra_element_id.nil?
# 今回の行動フェイズでライブラを受けたかどうかフラグ、初期化
@libla_reserve = false
end
#--------------------------------------------------------------------------
# ● スキルの効果適用
# user : 使用者 (バトラー)
# skill: スキル
#--------------------------------------------------------------------------
alias before_libra_skill_effect skill_effect
def skill_effect(user, skill)
#「ライブラ」スキルかどうかの判定。
if skill.element_set.include?(@libra_element_id)
# 命中率を適用する場合は下のif文のコメントを外してください
#if rand(100) < skill.hit
# このバトラーがエネミーなら情報ウィンドウを表示する
if self.is_a?(Game_Enemy)
self.libla_reserve = true
end
# 命中率を適用する場合は下のelse~endのコメントを外してください
#else
# self.damage = "Miss"
#end
# 普通のスキル判定は行わない。
return true
else
return before_libra_skill_effect(user, skill)
end
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
#--------------------------------------------------------------------------
alias before_libra_update_phase4_step5 update_phase4_step5
def update_phase4_step5
# ダメージ表示
for target in @target_battlers
if target.libla_reserve
libra_window = Window_EnemyStatus.new(target)
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# ボタンが押されたら情報ウィンドウを閉じてループを中断
if Input.trigger?(Input::C) or Input.trigger?(Input::B)
libra_window.dispose
libra_window = nil
break
end
end
end
# ライブラ予約フラグを解除
target.libla_reserve = false
end
before_libra_update_phase4_step5
end
end
#==============================================================================
# ■ Window_EnemyStatus
#------------------------------------------------------------------------------
# エネミーのステータスを表示するステータスウィンドウです。
#==============================================================================
class Window_EnemyStatus < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# enemy : エネミー
#--------------------------------------------------------------------------
def initialize(enemy)
super(0, 64, 640, 256)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 127
@enemy = enemy
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_enemy_name(@enemy, 4, 0)
draw_enemy_state(@enemy, 4, 48)
draw_enemy_hp(@enemy,196, 48, 172)
draw_enemy_sp(@enemy,196, 72, 172)
draw_enemy_parameter(@enemy, 4, 120, 0)
draw_enemy_parameter(@enemy, 4, 144, 1)
draw_enemy_parameter(@enemy, 4, 168, 2)
draw_enemy_parameter(@enemy, 4, 192, 7)
draw_enemy_parameter(@enemy,196, 120, 3)
draw_enemy_parameter(@enemy,196, 144, 4)
draw_enemy_parameter(@enemy,196, 168, 5)
draw_enemy_parameter(@enemy,196, 192, 6)
self.contents.font.color = system_color
self.contents.draw_text(384, 24, 80, 32, "EXP")
self.contents.draw_text(384, 48, 80, 32, "金钱")
self.contents.draw_text(384, 96, 96, 32, "战利品")
self.contents.draw_text(384, 144, 96, 32, "偷窃物")
self.contents.font.color = normal_color
self.contents.draw_text(384 + 80, 24, 84, 32, @enemy.exp.to_s, 2)
self.contents.draw_text(384 + 80, 48, 84, 32, @enemy.gold.to_s, 2)
draw_item_name(get_enemy_item(@enemy,1), 384 + 16, 120)
draw_item_name(get_enemy_item(@enemy,2), 384 + 16, 168)
draw_item_name(get_enemy_item(@enemy,3), 384 + 16, 192)
end
#--------------------------------------------------------------------------
# ○ アイテムの取得
#--------------------------------------------------------------------------
def get_enemy_item( enemy, type )
case type
when 1:
if enemy.item_id != nil and enemy.item_id != 0
return $data_items[enemy.item_id]
elsif enemy.weapon_id != nil and enemy.weapon_id != 0
return $data_weapons[enemy.weapon_id]
elsif enemy.armor_id != nil and enemy.armor_id != 0
return $data_armors[enemy.armor_id]
else
return nil
end
when 2:
info = enemy.get_item_from_name("n")
return nil if info == nil
case info["Category"]
when "i"
return $data_items[info["ID"]]
when "w"
return $data_weapons[info["ID"]]
when "a"
return $data_armors[info["ID"]]
otherwise
return nil
end
when 3:
info = enemy.get_item_from_name("r")
return nil if info == nil
case info["Category"]
when "i"
return $data_items[info["ID"]]
when "w"
return $data_weapons[info["ID"]]
when "a"
return $data_armors[info["ID"]]
otherwise
return nil
end
otherwise
return nil
end
end
#--------------------------------------------------------------------------
# ● 名前の描画
# enemy : エネミー
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_enemy_name(enemy, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 120, 32, enemy.name)
end
#--------------------------------------------------------------------------
# ● ステートの描画
# enemy : エネミー
# x : 描画先 X 座標
# y : 描画先 Y 座標
# width : 描画先の幅
#--------------------------------------------------------------------------
def draw_enemy_state(enemy, x, y, width = 120)
text = make_battler_state_text(enemy, width, true)
self.contents.font.color = enemy.hp == 0 ? knockout_color : normal_color
self.contents.draw_text(x, y, width, 32, text)
end
#--------------------------------------------------------------------------
# ● HP の描画
# enemy : エネミー
# x : 描画先 X 座標
# y : 描画先 Y 座標
# width : 描画先の幅
#--------------------------------------------------------------------------
def draw_enemy_hp(enemy, x, y, width = 144)
# 文字列 "HP" を描画
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
# MaxHP を描画するスペースがあるか計算
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
# HP を描画
self.contents.font.color = enemy.hp == 0 ? knockout_color :
enemy.hp <= enemy.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x, y, 48, 32, enemy.hp.to_s, 2)
# MaxHP を描画
if flag
self.contents.font.color = normal_color
self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 60, y, 48, 32, enemy.maxhp.to_s)
end
end
#--------------------------------------------------------------------------
# ● SP の描画
# enemy : エネミー
# x : 描画先 X 座標
# y : 描画先 Y 座標
# width : 描画先の幅
#--------------------------------------------------------------------------
def draw_enemy_sp(enemy, x, y, width = 144)
# 文字列 "SP" を描画
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
# MaxSP を描画するスペースがあるか計算
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
# SP を描画
self.contents.font.color = enemy.sp == 0 ? knockout_color :
enemy.sp <= enemy.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(sp_x, y, 48, 32, enemy.sp.to_s, 2)
# MaxSP を描画
if flag
self.contents.font.color = normal_color
self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 60, y, 48, 32, enemy.maxsp.to_s)
end
end
#--------------------------------------------------------------------------
# ● パラメータの描画
# enemy : エネミー
# x : 描画先 X 座標
# y : 描画先 Y 座標
# type : パラメータの種類 (0~6)
#--------------------------------------------------------------------------
def draw_enemy_parameter(enemy, x, y, type)
case type
when 0
parameter_name = $data_system.words.atk
parameter_value = enemy.atk
when 1
parameter_name = $data_system.words.pdef
parameter_value = enemy.pdef
when 2
parameter_name = $data_system.words.mdef
parameter_value = enemy.mdef
when 3
parameter_name = $data_system.words.str
parameter_value = enemy.str
when 4
parameter_name = $data_system.words.dex
parameter_value = enemy.dex
when 5
parameter_name = $data_system.words.agi
parameter_value = enemy.agi
when 6
parameter_name = $data_system.words.int
parameter_value = enemy.int
when 7
parameter_name = "回避"
parameter_value = enemy.eva
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, parameter_name)
self.contents.font.color = normal_color
self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
end
end
#=============================================================================
# ◇ ちからため スキル実装スクリプト by 和希
#=============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 追加公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :powerstock # 「ちからため」回数
attr_accessor :action_message # ヘルプウィンドウに表示する文字
#--------------------------------------------------------------------------
# ● 初期化
#--------------------------------------------------------------------------
alias before_powerstock_original_initialize initialize
def initialize
before_powerstock_original_initialize
@powerstock = 0
@powerstock_skill_id = $data_system.elements.index(POWERSTOCK_SKILL_ELEMENT_NAME)
@powerstock_skill_id = 0 if @powerstock_skill_id == nil
@effect_message = nil
end
#--------------------------------------------------------------------------
# ● 通常攻撃の効果適用
# attacker : 攻撃者 (バトラー)
#--------------------------------------------------------------------------
alias before_powerstock_original_attack_effect attack_effect
def attack_effect(attacker)
$se_skill_id = 1
# 攻撃者が「ちからため」しているか?
if attacker.powerstock > 0
bool_powerstock = true
# 攻撃者の力を一時的に上昇させる
stock_attacker_str = attacker.str
attacker.str += ( stock_attacker_str * POWERSTOCK_BASE_RATE * attacker.powerstock ).to_i
# ヘルプメッセージに「ちからためx?」を出す
@action_message = POWERSTOCK_SKILL_ELEMENT_NAME
@action_message += " x"
@action_message += attacker.powerstock.to_s
# ストックを消す
attacker.powerstock = 0
else
bool_powerstock = false
end
# fukuyamaさん↓のミス発見ありがとうございました
result = before_powerstock_original_attack_effect(attacker)
# 力を上昇させていた場合、元に戻す
if bool_powerstock
attacker.str = stock_attacker_str
end
return result
end
#--------------------------------------------------------------------------
# ● スキルの効果適用
# user : 使用者 (バトラー)
# skill: スキル
#--------------------------------------------------------------------------
alias before_powerstock_original_skill_effect skill_effect
def skill_effect(user, skill)
#「ちからため」スキルかどうかの判定。
$se_skill_id = skill.id
if skill.element_set.include?(@powerstock_skill_id)
# 命中率を適用する場合は下のif文のコメントを外してください
#if rand(100) < skill.hit
@powerstock += 1 # 「ちからため」回数を1増やす
# ダメージに"Charge"をセットする
self.damage = "Charge"
# 命中率を適用する場合は下のelse~endのコメントを外してください
#else
# self.damage = "Miss"
#end
# 普通のスキル判定は行わない。
return true
else
return before_powerstock_original_skill_effect(user, skill)
end
end
end
#=============================================================================
# ◇ 見切りステート by 和希
#=============================================================================
class Game_Battler
# 見切りステートの名前
ABANDONS_SKILL_STATE_NAME = "断念"
#--------------------------------------------------------------------------
# ● 通常攻撃の効果適用
#--------------------------------------------------------------------------
alias before_abandons_original_attack_effect attack_effect
def attack_effect(attacker)
# 見切りステートが存在するか?
if nil != (abandons_skill = get_abandons_id)
# 見切りステートにかかっているか?
if self.state?(abandons_skill)
## 避ける!
# クリティカルフラグをクリア
self.critical = false
# ダメージに "Avoid!!" を設定
self.damage = "Avoid!!"
# 見切りステートを解除
self.remove_state(abandons_skill,true)
# メソッド終了
return false
end
end
# 見切りステート状態でなかった時は通常どおり
return before_abandons_original_attack_effect(attacker)
end
#--------------------------------------------------------------------------
# ● 見切りステータスのID取得
#--------------------------------------------------------------------------
def get_abandons_id
result = nil
if @abandons_status_id == nil
for i in 1 ... $data_states.size
if $data_states.name[/\A#{ABANDONS_SKILL_STATE_NAME}\Z/]
result = $data_states.id
break
end
end
@abandons_status_id = ( result != nil ? result : 0 )
elsif @abandons_status_id > 0
result = @abandons_status_id
end
return result
end
end
#=============================================================================
# ◇ かばう by シムナフ
#=============================================================================
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
#追加
attr_reader :active_battler
#ここまで
##新メソッド
def make_cover_skill_action_result
cover_num = 0
cover_bool = false
for i in @skill.element_set
if !($data_system.elements[/^#{ELEMENT_NAME_COVER}/].nil?)
cover_bool = true
elm_num = $data_system.elements[/([+-]*[0-9]+)/]
if !(elm_num.nil?)
cover_num += elm_num.to_i
end
end
end
if cover_bool.equal?(true)
##自分のみが対象だった場合は味方からランダムに1人をかばう
if @target_battlers.include?(@active_battler)
if @target_battlers.size == 1
if @target_battlers[0].is_a?(Game_Actor)
friends = $game_party.actors.dup
friends.delete(@active_battler)
@target_battlers = [friends[rand(friends.size)]]
elsif @target_battlers[0].is_a?(Game_Enemy)
friends = $game_troop.enemies.dup
friends.delete(@active_battler)
@target_battlers = [friends[rand(friends.size)]]
end
else
@target_battlers.delete(@active_battler)
end
end
for target in @target_battlers
if (cover_num > 0)
target.covered_friends = @target_battlers.dup
target.add_state(get_cover_state_id())##ステート付加時にデフォルト回数で発動回数が設定される
target.cover_remain = cover_num#発動回数が有った場合はその回数で上書き
end
target.damage = COVER_EFFECT_CHAR + target.damage.to_s + "伤害" if target.cover_remain > 0 and get_cover_state_id and $coverer_falg == true
$coverer_falg = false
end
end
end
##ここまで
end
class Game_Party
##追加エイリアス
include Cover_Module
#--------------------------------------------------------------------------
# ● 対象アクターのスムーズな決定
# actor_index : アクターインデックス
#--------------------------------------------------------------------------
alias before_cover_original_smooth_target_actor smooth_target_actor
def smooth_target_actor(actor_index)
if $scene.is_a?(Scene_Battle)
battler = $scene.active_battler()
else
battler = nil
end
#==============================================================================
# ◇ 付加属性名称判定モジュール
#==============================================================================
module Check_ElementName_Set
#--------------------------------------------------------------------------
# ● スキルが指定名の属性を持つか判定
#--------------------------------------------------------------------------
def skill_element_include?(skill, element_name)
@one = @two = nil
return false if skill == nil or !skill.is_a?(RPG::Skill)
for i in skill.element_set
if $data_system.elements =~ /#{element_name}([+-]?[0-9]+)?(%)?/
@one = $1
@two = $2
return true
end
end
return false
end
#--------------------------------------------------------------------------
# ● アイテムが指定名の属性を持つか判定
#--------------------------------------------------------------------------
def item_element_include?(item, element_name)
@one = @two = nil
return false if item == nil or !item.is_a?(RPG::Item)
for i in item.element_set
if $data_system.elements =~ /#{element_name}([+-]?[0-9]+)?(%)?/
@one = $1
@two = $2
return true
end
end
return false
end
#--------------------------------------------------------------------------
# ● 武器が指定名の属性を持つか判定
#--------------------------------------------------------------------------
def weapon_element_include?(weapon_id, element_name)
@one = @two = nil
return false if weapon_id == nil or weapon_id <= 0
for i in $data_weapons[weapon_id].element_set
if $data_system.elements =~ /#{element_name}([+-]?[0-9]+)?(%)?/
@one = $1
@two = $2
return true
end
end
return false
end
#--------------------------------------------------------------------------
# ● 防具が指定名の属性を持つか判定
#--------------------------------------------------------------------------
def armor_element_include?(armor_id, element_name)
@one = @two = nil
return false if armor_id == nil or armor_id <= 0
for i in $data_armors[armor_id].guard_element_set
if $data_system.elements =~ /#{element_name}([+-]?[0-9]+)?(%)?/
@one = $1
@two = $2
return true
end
end
return false
end
#--------------------------------------------------------------------------
# ● 防具が指定名の属性を持つ場合その後に付く接尾テキストを取得
#--------------------------------------------------------------------------
def armor_element_suftext(armor_id, element_name)
return nil if armor_id == nil or armor_id <= 0
for i in $data_armors[armor_id].guard_element_set
if $data_system.elements =~ /#{element_name}(.*)/
return $1
end
end
return nil
end
#--------------------------------------------------------------------------
# ● アクターが指定名の属性を持つ武器を装備しているかか判定
#--------------------------------------------------------------------------
def equip_weapon_element_include?(actor, element_name)
@one = @two = nil
return false if !actor.is_a?(Game_Actor)
return false if actor.weapon_id == nil or actor.weapon_id <= 0
bool = false
one_total = 0
for i in $data_weapons[actor.weapon_id].element_set
if $data_system.elements =~ /#{element_name}([+-]?[0-9]+)?(%)?/
one_total += $1.to_i
@two = $2
bool = true
end
end
# 武器管理システムXC.が導入されている場合
if $xrxs24_weapon_property_system_work
for i in [PROPERTY_ELEMENT_GRANT_1st, PROPERTY_ELEMENT_GRANT_2nd,
PROPERTY_ELEMENT_GRANT_3rd, PROPERTY_ELEMENT_GRANT_4th]
if $data_system.elements[actor.weapon_property] =~ /#{element_name}([+-]?[0-9]+)?(%)?/
one_total += $1.to_i
@two = $2
bool = true
end
end
end
@one = one_total
return bool
end
#--------------------------------------------------------------------------
# ● アクターが指定名の属性を持つ武器/防具を装備中か判定 数値の合計も保持
#--------------------------------------------------------------------------
def actor_element_equip?(actor, element_name)
one_total = 0
bool = false
return false if !actor.is_a?(Game_Actor)
weapon = $data_weapons[actor.weapon_id]
armor1 = $data_armors[actor.armor1_id]
armor2 = $data_armors[actor.armor2_id]
armor3 = $data_armors[actor.armor3_id]
armor4 = $data_armors[actor.armor4_id]
if equip_weapon_element_include?(actor, element_name)
one_total += @one.to_i
bool = true
end
if armor_element_include?(armor1.id, element_name)
one_total += @one.to_i
bool = true
end
if armor_element_include?(armor2.id, element_name)
one_total += @one.to_i
bool = true
end
if armor_element_include?(armor3.id, element_name)
one_total += @one.to_i
bool = true
end
if armor_element_include?(armor4.id, element_name)
one_total += @one.to_i
bool = true
end
@one = one_total
return bool
end
end
#=============================================================================
# ◇ かばうModule
#=============================================================================
####以下新規追加Module
module Cover_Module
#--------------------------------------------------------------------------
# ● かばう 後のターゲット配列生成
#--------------------------------------------------------------------------
def get_target_battlers_after_cover!(target_battlers, active_battler = nil)
#HP割合の低い順にソート
#target_battlers.sort_by!{|b| (b.hp.to_f/b.maxhp.to_f)}
target_battlers.sort!{|a,b| (a.hp.to_f/a.maxhp.to_f) <=> (b.hp.to_f/b.maxhp.to_f)}
#HP割合の多い順にソート
actors = $game_party.actors.sort_by{|b| (b.hp.to_f/b.maxhp.to_f)}.reverse
enemies = $game_troop.enemies.sort_by{|b| (b.hp.to_f/b.maxhp.to_f)}.reverse
for i in 0...target_battlers.size
if target_battlers.is_a?(Game_Actor)
for actor in actors
new_target = get_target_after_cover(active_battler,target_battlers,actor)
if !new_target.equal?(target_battlers) && new_target.current_friend.nil? #かばう人がすでにかばっていた場合かばえない
new_target.effect_message = "#{new_target.name}は#{target_battlers.name}をかばった!"
new_target.current_friend = target_battlers
new_target.current_friend.damage = COVER_EFFECT_CHAR
target_battlers = new_target
break
end
end
end
if target_battlers.is_a?(Game_Enemy)
for enemy in enemies
new_target = get_target_after_cover(active_battler,target_battlers,enemy)
if !new_target.equal?(target_battlers) && new_target.current_friend.nil? #かばう人がすでにかばっていた場合かばえない
new_target.effect_message = "#{new_target.name}は#{target_battlers.name}をかばった!"
new_target.current_friend = target_battlers
new_target.current_friend.damage = COVER_EFFECT_CHAR
target_battlers = new_target
break
end
end
end
end
#ターゲット重複を排除する(かばった人が2度ダメージを受けない)
target_battlers.uniq!()
#「かばう」ステートの解除判定
for target in target_battlers
if !target.current_friend.nil?
#かばう 残り回数がなくなった場合
target.cover_remain -= 1
if target.cover_remain <= 0
target.remove_state(get_cover_state_id())
target.cover_remain = 0
end
end
end
end
#--------------------------------------------------------------------------
# ● かばう の発動判定
#--------------------------------------------------------------------------
def get_target_after_cover(battler, target, coverer)
#味方からのターゲットは庇わない
if battler.is_a?(Game_Actor)
if target.is_a?(Game_Actor)
return target
end
end
if battler.is_a?(Game_Enemy)
if target.is_a?(Game_Enemy)
return target
end
end
#庇う人が動けない時は庇わない
if !(coverer.movable? && coverer.exist?)
return target
end
#庇う人が かばう のステートになっている時のみ
if !coverer.state?(get_cover_state_id())
return target
end
#ターゲットが既に他の人を庇っている時は無効
if target.state?(get_cover_state_id())
return target
end
#ターゲットと庇う人が同じの場合は無効
if target.equal?(coverer)
return target
end
#発動確率判定
if !(rand(100) <= COVER_EFFECT_PERCENT)
return taget
end
#ターゲットのHP割合判定
if !(100.0*target.hp.to_f/target.maxhp.to_f <= COVER_HP_PERCENT)
return target
end
#「かばっている味方配列」が空だったら、全ての味方を庇う
if coverer.covered_friends.size.zero?
$coverer_falg = true
return coverer
else
for covered_friend in coverer.covered_friends
if target.equal?(covered_friend)
$coverer_falg = true
return coverer
end
end
end
$coverer_falg = true
return coverer
end
#--------------------------------------------------------------------------
# ● かばう のStateID
#--------------------------------------------------------------------------
def get_cover_state_id
result = nil
if @cover_status_id == nil
for i in 1 ... $data_states.size
if $data_states.name[/\A#{STATE_NAME_COVER}\Z/]
result = $data_states.id
break
end
end
@cover_status_id = ( result != nil ? result : 0 )
elsif @cover_status_id > 0
result = @cover_status_id
end
return result
end
end
####Module End
#//////////////////////////////////////////////////////////////////////////////
# ◇ インクルード
#//////////////////////////////////////////////////////////////////////////////
module Check_ElementName_Set
include Fixed_PropertyNumber if $xrxs24_weapon_property_system_work
end
class Game_Battler
include Check_ElementName_Set
include Cover_Module
end
class Window_Item #< Window_Selectable
include Check_ElementName_Set
end
class Scene_Battle
include Check_ElementName_Set
include Cover_Module
end
#==============================================================================
# ◇ RPG::再定義「"SP "を含む場合SPダメージとして色を変更」
#==============================================================================
module RPG
class Sprite < ::Sprite
alias xrxs19_damage damage
def damage(value, critical)
if value.is_a?(String) and value.include?($data_system.words.sp)
# 解放
dispose_damage
# 数値部分を抜き取る
value = value.scan(/[+-]?[0-9]+/)[0].to_i
# 表示文字列の設定
damage_string = $data_system.words.sp + " " + value.abs.to_s
# 描写
bitmap = Bitmap.new(160, 48)
bitmap.font.name = "黑体"
bitmap.font.size = 32
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
if value < 0
bitmap.font.color.set(128, 255, 255)
else
bitmap.font.color.set(255, 176, 144)
end
bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
if critical
bitmap.font.size = 20
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
bitmap.font.color.set(255, 255, 255)
bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
end
@_damage_sprite = ::Sprite.new(self.viewport)
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = 80
@_damage_sprite.oy = 20
@_damage_sprite.x = self.x
@_damage_sprite.y = self.y - self.oy / 2
@_damage_sprite.z = 3000
@_damage_duration = 40
else
# 通常時?戻す
xrxs19_damage(value, critical)
end
end
end
end 作者: 18649119621 时间: 2018-7-11 13:31
说1989行冲突
if $data_states.name[/\A#{ABANDONS_SKILL_STATE_NAME}\Z/]作者: guoxiaomi 时间: 2018-7-11 20:40 本帖最后由 guoxiaomi 于 2018-7-11 20:42 编辑