MOG TP System V1.8

MOG TP System é um script para  RPG Maker XP criado pelo Moghunter que permite que certas habilidades tenham o custo de TP (Talent Points) no lugar do SP (Spell Points).


22 de maio de 2015

MOG TP System é um script para RPG Maker XP criado pelo Moghunter que permite que certas habilidades tenham o custo de TP (Talent Points) no lugar do SP (Spell Points).

O sistema é útil para quando queremos, por exemplo, que habilidades físicas não gastem SP, mas tenha um outro tipo de custo, o que pode deixar o jogo mais coerente.

TP System

#_______________________________________________________________________________
# MOG TP System V1.8         
#_______________________________________________________________________________
# By Moghunter            
# http://www.atelier-rgss.com
#_______________________________________________________________________________
# Troca o custo de SP por TP, ou seja, é possível definir
#que certas habilidades tenham o custo de TP no lugar do SP, 
# O sistema é útil quando quisermos, por exemplo, que habilidades
#físicas não gastem SP mas outro parâmetro.
#_______________________________________________________________________________
module MOG
#Definição do nome do TP (Talent Points).  
TP_NAME = "TP " 
#NOTA - Para mudar o nome do SP basta entrar no banco
#de dados na parte de System e mudar o nome de SP para outro
#nome, por exemplo, MP.
#-------------------------------------------------------------------------------
#Definição de quais habilidades terão o custo de TP.
#
#TP_COST = {A=>B, A=>B, ...}
#
#A = ID da SKILL.
#B = Custo de TP.
TP_COST = {
57=>5,    #Cross Cut
58=>12,   #Feint Attack
59=>26,   #Hurricane
60=>40,   #Spiral Blade
61=>7,    #Leag Sweep
62=>15,   #Beast Slayer
63=>32,   #Thunder Pierce
64=>50,   #Screw Thrust
65=>6,    #Power Break 
66=>13,   #Mind Break
67=>28,   #Aqua Buster 
68=>32    #Rolling Axe
          }  
#-------------------------------------------------------------------------------          
#Definição da quantidade inicial de TP.
#(Caso não especificado TP inicial igual a 1)
#
#A=>B
#
#A = ID do personagem.
#B = Quantidade inicial de TP.
INITP = {
1=>50,
2=>70,
7=>15,
8=>20 
         } 
#-------------------------------------------------------------------------------
#Definição da quantidade de TP ganho ao fazer LV-UP.
#(Caso não especificado TP ganho igual a 1)
#
#A=>B
#
#A = ID do personagem.
#B = Quantidade de TP ganho.
TP_EXP = {
1=>6,
2=>8,
7=>3,
8=>2
         }
#-------------------------------------------------------------------------------
#Itens que recuperam o TP.
#A=>B
#
#A = ID do Item
#B = Quantidade de TP recuperado.
ITEM_TP_RECOVER = {
1=>10,
2=>50,
3=>100
}   
#-------------------------------------------------------------------------------
end
$mogscript = {} if $mogscript == nil
$mogscript["TP_System"] = true        
##############
# Game_Actor #
##############
class Game_Actor < Game_Battler
attr_accessor   :tp
attr_accessor   :maxtp
alias mog45_setup setup
def setup(actor_id)
ini_tp = MOG::INITP[actor_id]
@tp_exp = MOG::TP_EXP[actor_id]
if ini_tp != nil
@maxtp = ini_tp
else
@maxtp = 1 
end
@tp = @maxtp
if @tp > @maxtp
@tp = @maxtp
end
mog45_setup(actor_id)  
end
def maxtp  
if @tp_exp != nil and @level > 1  
cal =  @tp_exp * @level 
return @maxtp + cal - @tp_exp
else
if @level > 1 
cal = 1 * @level
return @maxtp + cal - 1
else
return @maxtp
end
end
end
def tp
return @tp
end
end
################
# Game_Battler #
################
class Game_Battler
alias mog45_skill_can_use? skill_can_use?  
def skill_can_use?(skill_id)
tp_cost = MOG::TP_COST[skill_id] 
if tp_cost != nil and self.is_a?(Game_Actor) 
if tp_cost > self.tp
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
mog45_skill_can_use?(skill_id)    
end
end
################
# Scene_Battle #
################
class Scene_Battle
alias mog45_make_skill_action_result make_skill_action_result
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
tp_cost = MOG::TP_COST[@skill.id] 
if tp_cost != nil and @active_battler.is_a?(Game_Actor) 
@active_battler.tp -= tp_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
return
mog45_make_skill_action_result
end
end  
################
# Game_Battler #
################
class Game_Battler
alias mog45_item_effect item_effect
def item_effect(item)
item_tp_recover = MOG::ITEM_TP_RECOVER[item.id]
if item_tp_recover != nil 
if self.tp < self.maxtp
self.tp += item_tp_recover
self.damage = "TP " + item_tp_recover.to_s
self.damage_pop = true
Audio.se_play("Audio/SE/106-Heal02" , 150, 150)
if self.tp > self.maxtp
self.tp = self.maxtp
end
return true
else
Audio.se_play("Audio/SE/004-System04" , 150, 100) 
return false
end
return false
end
mog45_item_effect(item)
end
end
class Interpreter
alias mog45_command_314 command_314
def command_314
mog45_command_314
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
actor.tp += actor.maxtp
if actor.tp > actor.maxtp
actor.tp = actor.maxtp
end
end
return true
end
end
###############
# Window_Base #
###############
class Window_Base < Window
def draw_actor_tp(actor, x, y,type)
self.contents.font.color = system_color  
self.contents.draw_text(x, y, 32, 32, MOG::TP_NAME)
self.contents.font.color = normal_color
case type
when 0
self.contents.draw_text(x - 40, y, 198, 32, actor.tp.to_s + " / " + actor.maxtp.to_s, 2)
when 1
self.contents.draw_text(x - 70, y, 198, 32, actor.tp.to_s + " / " + actor.maxtp.to_s, 2)
when 2
self.contents.draw_text(x + 40, y, 80, 32, actor.tp.to_s,2)
when 3
self.contents.draw_text(x - 20, y, 150, 32, actor.tp.to_s + " / " + actor.maxtp.to_s, 2)
when 4
self.contents.font.name = "Georgia"
self.contents.draw_text(x - 55, y, 130, 32, actor.tp.to_s, 2)
end  
end
def draw_actor_tp2(actor, x, y)
self.contents.font.name = "Georgia"
back = RPG::Cache.picture("STBAR_Back")    
cw = back.width  
ch = back.height 
src_rect = Rect.new(0, 0, cw, ch)    
self.contents.blt(x + 86, y - ch + 40, back, src_rect)  
meter = RPG::Cache.picture("STBAR.png")    
cw2 = meter.width * actor.tp / actor.maxtp
ch2 = meter.height 
src_rect2 = Rect.new(0, 0, cw2, ch2)    
self.contents.blt(x + 86, y - ch + 40, meter, src_rect2)  
self.contents.font.color = normal_color  
self.contents.draw_text(x - 40, y, 198, 32, MOG::TP_NAME + actor.tp.to_s, 2)
end
end
###############
# Window_Help #
###############
class Window_Help < Window_Base
alias mog45_set_actor set_actor
def set_actor(actor)
if actor != @actor
self.contents.clear
draw_actor_name(actor, 4, 0)
draw_actor_hp(actor, 110, 0)
draw_actor_sp(actor, 460, 0)
draw_actor_tp(actor, 284, 0,0) 
@actor = actor
@text = nil
self.visible = true
end
return
mog45_set_actor(actor)
end
end
######################
# Window_SkillStatus #
######################
class Window_SkillStatus < Window_Base
alias mog45_refresh refresh
def refresh
self.contents.clear
draw_actor_name(@actor, 4, 0)
draw_actor_hp(@actor, 110, 0)
draw_actor_sp(@actor, 460, 0)
draw_actor_tp(@actor, 284, 0,0) 
return
mog45_refresh
end
end  
#################
# Window Status #
#################
class Window_Status < Window_Base
alias mog45_refresh refresh
def refresh
mog45_refresh
if $mogscript["menu_eva"] == true
draw_actor_tp2(@actor, 435, 250)    
else
draw_actor_tp(@actor, 96, 170,0)  
end  
end  
end
########################
# Window_Battle_Status #
########################
class Window_BattleStatus < Window_Base
alias mog45_refresh refresh
def 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, 24, 120)
draw_actor_sp(actor, actor_x, 48, 120)
draw_actor_tp(actor, actor_x, 72,2)
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
#####################
# Window_MenuStatus #
#####################
class Window_MenuStatus < Window_Selectable
alias mog45_refresh refresh
def refresh
self.contents.clear  
mog45_refresh
for i in 0...$game_party.actors.size
x = 64
y = i * 116
actor = $game_party.actors[i]
draw_actor_tp(actor, x + 236, y,1 )
end
end
end
#################
# Window_Target #
#################
class Window_Target < Window_Selectable
alias mog45_refresh refresh
def refresh
self.contents.clear
for i in 0...$game_party.actors.size
x = 4
y = i * 116
actor = $game_party.actors[i]
draw_actor_name(actor, x, y)
draw_actor_level(actor, x + 8, y + 32)
draw_actor_state(actor, x + 8, y + 64)
draw_actor_hp(actor, x + 152, y + 0)
draw_actor_tp(actor, x + 152, y + 32,3)
draw_actor_sp(actor, x + 152, y + 64)
end 
return
mog45_refresh  
end
end
################
# Window_Skill #
################
class Window_Skill < Window_Selectable
alias mog45_draw_item draw_item
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
tp_cost = MOG::TP_COST[skill.id] 
if tp_cost != nil 
self.contents.font.color = Color.new(50,250,150,255)
self.contents.draw_text(x + 180, y, 48, 32,MOG::TP_NAME, 2) 
self.contents.font.color = Color.new(255,255,255,255)
self.contents.draw_text(x + 232, y, 48, 32,tp_cost.to_s, 2)
else
self.contents.font.color = Color.new(250,150,50,255)  
self.contents.draw_text(x + 180, y, 48, 32,$data_system.words.sp, 2) 
self.contents.font.color = Color.new(255,255,255,255)
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)  
end
return
mog45_draw_item(index)
end
end
###############
# Scene_Skill #
###############
class Scene_Skill
alias mog45_update_target update_target
def update_target
if Input.trigger?(Input::C)
unless @actor.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
if @target_window.index == -1
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
if @target_window.index <= -2
target = $game_party.actors[@target_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
if @target_window.index >= 0
target = $game_party.actors[@target_window.index]
used = target.skill_effect(@actor, @skill)
end
if used
$game_system.se_play(@skill.menu_se)
tp_cost = MOG::TP_COST[@skill.id] 
if tp_cost != nil  
@actor.tp -= tp_cost
else
@actor.sp -= @skill.sp_cost
end        
@status_window.refresh
@skill_window.refresh
@target_window.refresh
if $game_party.all_dead?
$scene = Scene_Gameover.new
return
end
if @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$scene = Scene_Map.new
return
end
end
unless used
$game_system.se_play($data_system.buzzer_se)
end
return
end
mog45_update_target    
end
end

Mais programação XP

Informações adicionais

Observação: se você gostou deste post ou ele lhe foi útil de alguma forma, por favor considere apoiar financeiramente a Gaming Room. Fico feliz só de ajudar, mas a contribuição do visitante é muito importante para que este site continua existindo e para que eu possa continuar provendo este tipo de conteúdo e melhorar cada vez mais. Acesse aqui e saiba como. Obrigado!

Deixe um comentário

Inscreva-se na nossa newsletter!