104 lines
3.9 KiB
Ruby
104 lines
3.9 KiB
Ruby
|
||
|
||
=begin
|
||
|
||
トリス クリティカルポップ ver1
|
||
|
||
=end
|
||
|
||
|
||
module CriticalPop
|
||
|
||
# クリティカルポップの画像 Graphics/Systemフォルダ内
|
||
NUM_FILE = "damage_num2-" # 数値
|
||
BACK_FILE = "emo1" # 吹き出し
|
||
|
||
|
||
# 吹き出し画像の座標補正 [x, y]
|
||
# 吹き出し画像の基本x座標(左端)は「中央の数値(12345なら3)」のx座標(左端)
|
||
BACK_POS = [-50 , 0]
|
||
|
||
|
||
# 動作確認機能 内部ダメージには影響なし
|
||
# trueなら常にクリティカルポップになり、TEST_DAMAGEが有効 使わないならfalse
|
||
TEST_CRITICAL = false
|
||
# ポップアップする数値を指定 TEST_CRITICALがtrueの時のみ有効
|
||
TEST_DAMAGE = 12345
|
||
|
||
end
|
||
|
||
#==============================================================================
|
||
# ■ Sprite_Damage
|
||
#==============================================================================
|
||
class Sprite_Damage < Sprite
|
||
#--------------------------------------------------------------------------
|
||
# ● ダメージ表示
|
||
#--------------------------------------------------------------------------
|
||
def set_damage
|
||
return @action_end = true if !N03::DAMAGE_POP
|
||
damage = @battler.result.hp_damage if @battler.result.hp_damage != 0
|
||
damage = @battler.result.hp_drain if @battler.result.hp_drain != 0
|
||
damage = @battler.result.mp_damage if @battler.result.mp_damage != 0
|
||
damage = @battler.result.mp_drain if @battler.result.mp_drain != 0
|
||
damage = @battler.result.tp_damage if @battler.result.tp_damage != 0
|
||
damage = CriticalPop::TEST_DAMAGE if CriticalPop::TEST_CRITICAL and
|
||
CriticalPop::TEST_DAMAGE
|
||
if !damage or damage == 0
|
||
@action_end = true if @st == nil
|
||
return # ステートだけPOPする設定を考慮して@action_endは返さない
|
||
end
|
||
hit_count
|
||
#@hit = @battler.sv.hit
|
||
#@battler.sv.hit += 1 if damage != 0
|
||
critical = @battler.result.critical
|
||
critical = true if CriticalPop::TEST_CRITICAL
|
||
file = N03::DAMAGE_PLUS if damage > 0
|
||
file = N03::DAMAGE_MINUS if damage < 0
|
||
file = CriticalPop::NUM_FILE if critical
|
||
add_file = N03::DAMAGE_MP if @battler.result.mp_damage != 0
|
||
add_file = N03::DAMAGE_TP if @battler.result.tp_damage != 0
|
||
adjust_x = N03::DAMAGE_ADJUST
|
||
@num = []
|
||
@num_base = []
|
||
damage = damage.abs
|
||
max_num = damage.to_s.size
|
||
base_num = max_num - 1
|
||
if add_file != nil
|
||
add_file_num = max_num
|
||
max_num += 1
|
||
end
|
||
if critical
|
||
critical_num = max_num
|
||
max_num += 1
|
||
end
|
||
for i in 0...max_num
|
||
@num[i] = Sprite.new
|
||
if i == critical_num
|
||
@num[i].bitmap = Cache.system(CriticalPop::BACK_FILE)
|
||
cw = (damage % (10 * 10 ** i))/(10 ** i)
|
||
sw = 0 if sw == nil
|
||
elsif i == add_file_num
|
||
@num[i].bitmap = Cache.system(add_file)
|
||
cw = (damage % (10 * 10 ** i))/(10 ** i)
|
||
sw = 0 if sw == nil
|
||
else
|
||
@num[i].bitmap = Cache.system(file)
|
||
cw = (damage % (10 * 10 ** i))/(10 ** i)
|
||
sw = @num[i].bitmap.width / 10
|
||
@num[i].src_rect.set(cw * sw, 0, sw, @num[i].bitmap.height)
|
||
end
|
||
@num_base[i] = []
|
||
@num_base[i][0] = (sw + adjust_x) * i * -1 + (@battler.sv.x / 100)
|
||
@num_base[i][1] = -(@num[i].bitmap.height / 3) - i * 2 - @hit * 2 + (@battler.sv.y - @battler.sv.h - @battler.sv.j - @battler.sv.oy_adjust)/ 150#紅茶走
|
||
@num_base[i][0] -= @num[i].bitmap.width / 2 - adjust_x if i == add_file_num
|
||
@num[i].z = 1000 + i + @hit * 10
|
||
if i == critical_num
|
||
@num_base[i][0] = (sw + adjust_x) * base_num * -1 / 2 + (@battler.sv.x / 100)
|
||
@num_base[i][0] += CriticalPop::BACK_POS[0]
|
||
@num_base[i][1] += CriticalPop::BACK_POS[1]
|
||
@num[i].z = 1000 - 1 + @hit * 10
|
||
end
|
||
end
|
||
@time = @pop_time = 80
|
||
end
|
||
end
|