Project1
标题:
【仿VA任重而道远】TP战斗(RTAB版完美显示怒气更及时)
[打印本页]
作者:
阿尔西斯的马甲
时间:
2012-1-18 11:40
标题:
【仿VA任重而道远】TP战斗(RTAB版完美显示怒气更及时)
本帖最后由 阿尔西斯的马甲 于 2012-1-20 19:07 编辑
class Game_Battler
attr_reader :tp
alias beforetp_init initialize
def initialize
beforetp_init
@tp = 0
end
def maxtp
return 100
end
def tp
return [[@tp, self.maxtp].min, 0].max
end
def tp=(tp)
@tp = [[tp, self.maxtp].min, 0].max
end
def skill_can_use?(skill_id)#重写了skill_can_use?,注意整合
if $data_skills[skill_id].element_set.include?(28)#此处是消耗TP属性的编号
if $data_skills[skill_id].sp_cost > self.tp
return false
end
if not $game_temp.in_battle
return false
end
else
if $data_skills[skill_id].sp_cost > self.sp
return false
end
end
if dead?
return false
end
if $data_skills[skill_id].atk_f == 0 and self.restriction == 1
return false
end
occasion = $data_skills[skill_id].occasion
if $game_temp.in_battle
return (occasion == 0 or occasion == 1)
else
return (occasion == 0 or occasion == 2)
end
return true
end
alias beforetp_aft attack_effect
def attack_effect(attacker)
a=beforetp_aft(attacker)
if (self.damage!="Miss")and(self.damage!="")and(self.damage!=nil)
attacker.tp+=5
a=50*(self.damage/(self.maxhp.to_f))
self.tp+=a.to_i
end
return a
end
alias beforetp_sft skill_effect
def skill_effect(user, skill)
a=beforetp_sft(user, skill)
if (self.damage!="Miss")and(self.damage!="")and(self.damage!=nil)
a=50*(self.damage/(self.maxhp.to_f))
self.tp+=a.to_i
end
return a
end
alias beforetp_ift item_effect
def item_effect(item)
a=beforetp_ift(item)
if (self.damage!="Miss")and(self.damage!="")and(self.damage!=nil)
a=50*(self.damage/(self.maxhp.to_f))
self.tp+=a.to_i
end
return a
end
def recover_all#重写了recover_all,注意整合
@hp = maxhp
@sp = maxsp
@tp = 0
for i in @states.clone
remove_state(i)
end
end
end
##########以下非原创!!!非原创!!!作者zhong,来自66RPG.com
class Window_Base
def draw_hp_store_bar(actor,x,y)
width = 100
w = actor.hp_store
white = Color.new(225,225,225,225)
black = Color.new(0,0,0,200)
self.contents.font.color = Color.new(225,-215,-225,200)
self.contents.fill_rect(x+40,y,width,1,white)
self.contents.fill_rect(x+40,y+12, width, 1,white)
self.contents.fill_rect(x+40,y,1,12,white)
self.contents.fill_rect(x+139,y,1,12,white)
self.contents.fill_rect(x+42,y+2,width-4,10,black)
val = 245*actor.tp/100
green = 255 - val
blue = 255 - val
color = Color.new(255,green,blue,200)
top_color = Color.new(255,green+10,blue+20,200)
back_color = Color.new(255,green-10,blue-10,200)
self.contents.fill_rect(x+41,y+5,w-2,3,color)
self.contents.fill_rect(x+41,y+1,w-2,4,top_color)
self.contents.fill_rect(x+41,y+7,w-2,5,back_color)
self.contents.draw_text(x+120,y-10,20,20,"TP")
end
def draw_hp_store_bar2(actor,x,y)
width = 100
w = actor.tp
self.contents.fill_rect(x+39,y,width+1,1,Color.new(225,225,225,200))
self.contents.fill_rect(x+39,y+5,width+2,1,Color.new(225,225,225,200))
self.contents.fill_rect(x+39,y,1,5,Color.new(225,225,225,200))
self.contents.fill_rect(x+140,y,1,5,Color.new(225,225,225,200))
self.contents.fill_rect(x+40,y+1,width,4,Color.new(0,0,0,200))
self.contents.fill_rect(x+40, y+1, w,1, Color.new(255, 96, 96, 255))
self.contents.fill_rect(x+40, y+2, w,1, Color.new(255, 0, 0, 255))
self.contents.fill_rect(x+40, y+3, w,1, Color.new(128, 0, 0, 255))
self.contents.fill_rect(x+40, y+4, w,1, Color.new(0, 0, 0, 255))
end
end
class Window_BattleStatus < Window_Base
def refresh#重写了refresh,注意整合
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
actor_x = i * 160 + 4
draw_actor_name(actor, actor_x, 0)
draw_actor_hp(actor, actor_x, 32, 120)
draw_actor_sp(actor, actor_x, 64, 120)
draw_hp_store_bar2(actor, actor_x-40,113)
if @level_up_flags[i]
self.contents.font.color = normal_color
self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
else
draw_actor_state(actor, actor_x, 96)
end
end
end
end
class Scene_Battle
def make_skill_action_result
@skill = $data_skills[@active_battler.current_action.skill_id]
unless @active_battler.current_action.forcing
unless @active_battler.skill_can_use?(@skill.id)
$game_temp.forcing_battler = nil
@phase4_step = 1
return
end
end
if @skill.element_set.include?(28)
@active_battler.tp -= @skill.sp_cost
else
@active_battler.sp -= @skill.sp_cost
end
@status_window.refresh
@help_window.set_text(@skill.name, 1)
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
@common_event_id = @skill.common_event_id
set_target_battlers(@skill.scope)
for target in @target_battlers
target.skill_effect(@active_battler, @skill)
end
end
end
复制代码
打人获得的TP与被打获得的TP数量完全与VA一致。
加了一个非原创的TP条。
选中“TP”属性(范例中为28号)后,消耗SP选项的意义就会变为消耗TP。
以上系统没有经过RTAB兼容性处理。
class Game_Battler
attr_reader :tp
alias beforetp_init initialize
def initialize
beforetp_init
@tp = 0
end
def maxtp
return 100
end
def tp
return [[@tp, self.maxtp].min, 0].max
end
def tp=(tp)
@tp = [[tp, self.maxtp].min, 0].max
end
def skill_can_use?(skill_id)#重写了skill_can_use?,注意整合
if $data_skills[skill_id].element_set.include?(28)#此处是消耗TP属性的编号
if $data_skills[skill_id].sp_cost > self.tp
return false
end
if not $game_temp.in_battle
return false
end
else
if $data_skills[skill_id].sp_cost > self.sp
return false
end
end
if dead?
return false
end
if $data_skills[skill_id].atk_f == 0 and self.restriction == 1
return false
end
occasion = $data_skills[skill_id].occasion
if $game_temp.in_battle
return (occasion == 0 or occasion == 1)
else
return (occasion == 0 or occasion == 2)
end
return true
end
alias beforetp_aft attack_effect
def attack_effect(attacker)
a=beforetp_aft(attacker)
if (self.damage[attacker]!="Miss")and(self.damage[attacker]!="")and(self.damage[attacker]!=nil)
attacker.tp+=5
a=50*(self.damage[attacker]/(self.maxhp.to_f))
self.tp+=a.to_i
end
return a
end
alias beforetp_sft skill_effect
def skill_effect(user, skill)
a=beforetp_sft(user, skill)
if (self.damage[user]!="Miss")and(self.damage[user]!="")and(self.damage[user]!=nil)
a=50*(self.damage[user]/(self.maxhp.to_f))
self.tp+=a.to_i
end
return a
end
alias beforetp_ift item_effect
def item_effect(item,user)
a=beforetp_ift(item,user)
if (self.damage[user]!="Miss")and(self.damage[user]!="")and(self.damage[user]!=nil)
a=50*(self.damage[user]/(self.maxhp.to_f))
self.tp+=a.to_i
end
return a
end
def recover_all#重写了recover_all,注意整合
@hp = maxhp
@sp = maxsp
@tp = 0
for i in @states.clone
remove_state(i)
end
end
end
class Scene_Battle
def make_skill_action_preparation(battler)
# スキルを取得
@skill = $data_skills[battler.current_action.skill_id]
# 連携スキルであるかどうか確認
speller = synthe?(battler)
# 強制アクションでなければ
unless battler.current_action.forcing
# SP 切れなどで使用できなくなった場合
if speller == nil
unless battler.skill_can_use?(@skill.id)
# ステップ 6 に移行
battler.phase = 6
return false
end
end
end
# SP 消費
temp = false
if speller != nil
for spell in speller
if spell.current_action.spell_id == 0
if @skill.element_set.include?(28)
spell.tp -= @skill.sp_cost
else
spell.sp -= @skill.sp_cost
end
else
if @skill.element_set.include?(28)
spell.tp -= $data_skills[spell.current_action.spell_id].sp_cost
else
spell.sp -= $data_skills[spell.current_action.spell_id].sp_cost
end
end
# ステータスウィンドウをリフレッシュ
status_refresh(spell)
end
else
if @skill.element_set.include?(28)
battler.tp -= @skill.sp_cost
else
battler.sp -= @skill.sp_cost
end
# ステータスウィンドウをリフレッシュ
status_refresh(battler)
end
# アニメーション ID を設定
battler.anime1 = @skill.animation1_id
battler.anime2 = @skill.animation2_id
# コモンイベント ID を設定
battler.event = @skill.common_event_id
# 対象側バトラーを設定
set_target_battlers(@skill.scope, battler)
return true
end
end
class Window_Base < Window
#--------------------------------------------------------------------------
# ● ATG の描画
# actor : アクター
# x : 描画先 X 座標
# y : 描画先 Y 座標
# width : 描画先の幅
#--------------------------------------------------------------------------
def draw_actor_atg(actor, x, y, width = 144)
if @at_gauge == nil
# plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
# plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
# align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
# align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
# align3:ゲージタイプ 0:左詰め 1:右詰め
@plus_x = 0
@rate_x = 0
@plus_y = 24
@plus_width = 0
@rate_width = 100
@width = @plus_width + width * @rate_width / 100
@height = 16
@align1 = 0
@align2 = 1
@align3 = 0
# グラデーション設定 grade1:空ゲージ grade2:実ゲージ
# (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション)
grade1 = 1
grade2 = 0
# 色設定。color1:最外枠,color2:中枠
# color3:空枠ダークカラー,color4:空枠ライトカラー
color1 = Color.new(0, 0, 0)
color2 = Color.new(255, 255, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(0, 0, 64, 192)
# ゲージの色設定
# 通常時の色設定
color5 = Color.new(0, 64, 80)
color6 = Color.new(0, 128, 160)
# ゲージがMAXの時の色設定
color7 = Color.new(80, 0, 0)
color8 = Color.new(240, 0, 0)
# 連携スキル使用時の色設定
color9 = Color.new(80, 64, 32)
color10 = Color.new(240, 192, 96)
# スキル詠唱時の色設定
color11 = Color.new(80, 0, 64)
color12 = Color.new(240, 0, 192)
# ゲージの描画
gauge_rect_at(@width, @height, @align3, color1, color2,
color3, color4, color5, color6, color7, color8,
color9, color10, color11, color12, grade1, grade2)
end
# 変数atに描画するゲージの幅を代入
if actor.rtp == 0
at = (width + @plus_width) * actor.atp * @rate_width / 10000
else
at = (width + @plus_width) * actor.rt * @rate_width / actor.rtp / 100
end
if at > width
at = width
end
# ゲージの左詰・中央構え等の補正
case @align1
when 1
x += (@rect_width - width) / 2
when 2
x += @rect_width - width
end
case @align2
when 1
y -= @height / 2
when 2
y -= @height
end
self.contents.blt(x + @plus_x + width * @rate_x / 100, y + @plus_y,
@at_gauge, Rect.new(0, 0, @width, @height))
if @align3 == 0
rect_x = 0
else
x += @width - at - 1
rect_x = @width - at - 1
end
# ゲージの色設定
if at == width
# MAX時のゲージ描画
self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
@at_gauge, Rect.new(rect_x, @height * 2, at, @height))
else
if actor.rtp == 0
# 通常時のゲージ描画
self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
@at_gauge, Rect.new(rect_x, @height, at, @height))
else
if actor.spell == true
# 連携スキル使用時のゲージ描画
self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
@at_gauge, Rect.new(rect_x, @height * 3, at, @height))
else
# スキル詠唱時のゲージ描画
self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
@at_gauge, Rect.new(rect_x, @height * 4, at, @height))
end
end
end
end
end
class Window_Base
def draw_cr(x,y,current,max,txt='',width=100,height=6)
c1=[219, 222, 223];c2=[186, 20, 7]
bk_color = Color.new(255,255,255,255)
num = true
num_align = 1
bl = current.to_f / max
w = (width*bl).round
r = c1[0];g = c1[1];b = c1[2]
plus_r = (c2[0]-c1[0])/(width*bl)
plus_g = (c2[1]-c1[1])/(width*bl)
plus_b = (c2[2]-c1[2])/(width*bl)
w.times {|i|
contents.fill_rect(x+i, y, 1, height, Color.new(r,g,b,255))
r+=plus_r;g+=plus_g;b+=plus_b}
contents.fill_rect(x-1, y-1, width+2, 1, bk_color)
contents.fill_rect(x-1, y+height, width+2, 1, bk_color)
contents.fill_rect(x-1, y, 1, height, bk_color)
contents.fill_rect(x+width, y, 1, height, bk_color)
txt_w = contents.text_size(txt).width + 2
contents.draw_text(x-txt_w,y+height/2-12, width, 24, txt)
contents.draw_text(x,y+height/2-12, width, 24,
current.to_s+'/'+max.to_s,num_align) if num
end
end
class Window_DetailsStatus < Window_Base
def refresh(actor, level_up_flags = false)
self.contents.clear
case @status_id
when 0
draw_actor_name(actor, 4, 0)
when 1
draw_actor_hp(actor, 4, 0, 120)
when 2
draw_actor_sp(actor, 4, 0, 120)
when 3
if level_up_flags
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120, 32, "LEVEL UP!")
else
draw_actor_state(actor, 4, 0)
end
when 4
draw_actor_atg(actor, 4, 0, 120)
draw_cr(25,8,actor.tp,actor.maxtp,"TP")
end
end
end
复制代码
@orzfly
额,注释。。。。。。RTAB原本的注释也被我去掉了。不过我是去掉之后才看到你说的话
以上系统兼容RTAB1.07整合大量特效豪华版。请把这脚本放在XRXS38. 属性修正计算数限制的下面,XRXS19. 特殊効果詰め合わせ DamageEX ver.2的上面
以上RTAB版已经修正显示TP。一定要使用RTAB1.07整合大量特效豪华版,不兼容原版RTAB.注意如果希望敌人也能发动TP技能,一定要加一个概率1的不行动选项。否则有可能出错。。。。。
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1