Due to personal problems and me not being motivated to doing anything, rather stay in bed all day wishing I could sleep for the next three weeks, I've had to postpone work on this. If anyone else wants to take off where I left off, this is what I have.
module SP
ACTOR_MAXSP = [80, 100, 100, 110]
SP_TEXT = "SP"
SP_ABB = "S"
SKILLFUL = [true, false, false, true]
SHOWN_SP_TYPE = 2
end
module Vocab
def self.sp
return SP::SP_TEXT
end
def self.sp_a
return SP::SP_ABB
end
end
module RPG
class UsableItem < BaseItem
attr_accessor :sp_recovery_rate
attr_accessor :sp_recovery
attr_accessor :sp_cost
attr_accessor :damage_to_sp
alias dual_mpsp_initialize initialize
def initialize
dual_mpsp_initialize
@sp_recovery_rate = 0
@sp_recovery = 0
@sp_cost = 0
@damage_to_sp = false
end
def sp_cost
return @sp_cost if @sp_cost != nil
@sp_cost = 0
self.note.split(/[\r\n]+/).each { |line|
case line
when /<(?:SP_COST|SP COST):[ ](\d+)>/i
@sp_cost = $1.to_i
end
}
return @sp_cost
end
def sp_recovery
return @sp_recovery if @sp_recovery != nil
@sp_recovery = 0
self.note.split(/[\r\n]+/).each { |line|
case line
when /<(?:SP_RECOVERY|SP RECOVERY):[ ](\d+)>/i
@sp_recovery = $1.to_i
end
}
return @sp_recovery
end
def sp_recovery_rate
return @sp_recovery_rate if @sp_recovery_rate != nil
@sp_recovery_rate = 0
self.note.split(/[\r\n]+/).each { |line|
case line
when /<(?:SP_RECOVERY_RATE|SP RECOVERY RATE):[ ](\d+)>/i
@sp_recovery_rate = $1.to_i
end
}
return @sp_recovery_rate
end
end
class Actor
attr_accessor :skillful
alias dual_mpsp_initialize initialize
def initialize
dual_mpsp_initialize
for i in 1..99
@parameters[6,i] = 80+i*10
end
@skillful = false
end
def maxsp
for i in actor
i.maxsp = SP::ACTOR_MAXSP[i]
end
end
def skillful
for i in actor
i.skillful = SP::SKILLFUL[i]
end
end
end
class Enemy
def base_maxsp
return 0 # Not for enemies.
end
end
class BaseItem
attr_accessor :half_sp_cost
alias dual_mpsp_initialize initialize
def initialize
dual_mpsp_initialize
@half_sp_cost = false
end
def half_sp_cost
return if self.is_a?(RPG::Item) or self.is_a?(RPG::Skill)
@half_sp_cost = !self.note[/\\HALF_SP_COST/i].nil? if @half_sp_cost.nil?
return @half_sp_cost
end
end
class System
class Terms
attr_accessor :sp
attr_accessor :sp_a
alias dual_mpsp_initialize initialize
def initialize
dual_mpsp_initialize
@sp = SP::SP_TEXT
@sp_a = SP::SP_ABB
end
end
end
end
class Game_Battler
attr_accessor :sp
attr_accessor :sp_damage
alias dual_mpsp_initialize initialize
def initialize
dual_mpsp_initialize
@sp = 0
end
alias dual_mpsp_clractnres clear_action_results
def clear_action_results
dual_mpsp_clractnres
@sp_damage = 0
end
alias dual_mpsp_clrextval clear_extra_values
def clear_extra_values
dual_mpsp_clrextval
@maxsp_plus = 0
end
def maxsp
maxsp = 0
if self.is_a?(Game_Actor)
maxsp += actor.maxsp
elsif self.is_a?(Game_Enemy)
maxsp += enemy.base_maxsp
end
maxsp += @maxsp_plus
return [[maxsp, 0].max, 9999].min
end
def half_sp_cost
return false
end
def maxsp=(new_maxsp)
@maxsp_plus += new_maxsp - self.maxsp
@maxsp_plus = [[@maxsp_plus, -9999].max, 9999].min
@sp = [@sp, self.maxsp].min
end
def sp=(sp)
@sp = [[sp, maxsp].min, 0].max
end
alias dual_mpsp_recall recover_all
def recover_all
@sp = maxsp
dual_mpsp_recall
end
def calc_sp_cost(skill)
if half_sp_cost
return skill.sp_cost / 2
else
return skill.sp_cost
end
end
alias dual_mpsp_sklcnus skill_can_use?
def skill_can_use?(skill)
return false if calc_sp_cost(skill) > sp
dual_mpsp_sklcnus(skill)
end
alias dual_mpsp_mkdmgal make_obj_damage_value
def make_obj_damage_value(user, obj)
dual_mpsp_mkdmgal(user, obj)
if obj.damage_to_sp
@sp_damage = damage
end
end
def calc_sp_recovery(user, item)
result = maxsp * item.sp_recovery_rate / 100 + item.sp_recovery
result *= 2 if user.skillful # Skillful doubles the effect
return result
end
alias dual_mpsp_exctdmg execute_damage
def execute_damage(user)
dual_mpsp_exctdmg(user)
self.sp -= @sp_damage
end
alias dual_mpsp_skltst skill_test
def skill_test(user, skill)
tester = self.clone
tester.make_obj_damage_value(user, skill)
tester.apply_state_changes(skill)
return true if tester.sp_damage < 0 && tester.sp < tester.maxsp
dual_mpsp_skltst(user, skill)
end
alias dual_mpsp_itmtst item_test
def item_test(user, item)
tester = self.clone
tester.make_obj_damage_value(user, item)
tester.apply_state_changes(item)
if tester.sp_damage < 0 or tester.calc_sp_recovery(user, item) > 0
return true if tester.sp < tester.maxsp
end
dual_mpsp_itmtst(user, item)
end
alias dual_mpsp_itmefct item_effect
def item_effect(user, item)
dual_mpsp_itmefct(user, item)
sp_recovery = calc_sp_recovery(user, item)
@sp_damage -= sp_recovery
end
alias dual_mpsp_itmgrthtp item_growth_effect
def item_growth_effect(user, item)
dual_mpsp_itmgrthtp
if item.parameter_type > 0 and item.parameter_points != 0
case item.parameter_type
when 7 # SP
@maxsp_plus += item.parameter_points
end
end
end
end
class Game_Actor < Game_Battler
def base_maxsp
return SP::ACTOR_MAXSP[actor[@level]]
end
def skillful
return actor.skillful
end
def half_sp_cost
for armor in armors.compact
return true if armor.half_sp_cost
end
for weapon in weapons.compact
return true if weapon.half_sp_cost
end
return false
end
alias dual_mpsp_chngexp change_exp
def change_exp(exp, show)
dual_mpsp_chngexp(exp, show)
@sp = [@sp, maxsp].min
end
end
class Game_Enemy < Game_Battler
def base_maxsp
return 0
end
end
class Window_Base < Window
def sp_gauge_color1
return text_color(24)
end
def sp_gauge_color2
return text_color(28)
end
def sp_color(actor)
return crisis_color if actor.sp < actor.maxsp / 4
return normal_color
end
def draw_actor_sp(actor, x, y, width = 120)
draw_actor_sp_gauge(actor, x, y, width)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 30, WLH, Vocab::sp_a)
self.contents.font.color = sp_color(actor)
last_font_size = self.contents.font.size
xr = x + width
if width < 120
self.contents.draw_text(xr - 44, y, 44, WLH, actor.sp, 2)
else
self.contents.draw_text(xr - 99, y, 44, WLH, actor.sp, 2)
self.contents.font.color = normal_color
self.contents.draw_text(xr - 55, y, 11, WLH, "/", 2)
self.contents.draw_text(xr - 44, y, 44, WLH, actor.maxsp, 2)
end
end
def draw_actor_sp_gauge(actor, x, y, width = 120)
gw = width * actor.sp / [actor.maxsp, 1].max
gc1 = sp_gauge_color1
gc2 = sp_gauge_color2
self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
end
end
class Window_MenuStatus < Window_Selectable
alias dual_mpsp_refresh refresh
def refresh
dual_mpsp_refresh
if $scene.is_a?(Scene_Menu)
for actor in $game_party.members
y = actor.index * 96 + WLH / 2
draw_actor_sp(actor, x - 64, y + WLH * 2)
end
elsif $scene.is_a?(Scene_Skill)
for actor in $game_party.members
y = actor.index * 96 + WLH / 2
draw_actor_sp(actor, x + 96, y + WLH * 2)
end
end
end
end
class Window_Skill < Window_Selectable
alias dual_mpsp_drwitm draw_item
def draw_item(index)
dual_mpsp_drwitm(index)
sp_rect = item_rect(index)
if skill != nil
self.contents.draw_text(sp_rect, @actor.calc_sp_cost(skill), 1)
end
end
end
class Window_SkillStatus < Window_Base
def refresh
self.contents.clear
draw_actor_name(@actor, 4, 0)
draw_actor_level(@actor, 140, 0)
draw_actor_mp(@actor, 240, 0)
draw_actor_sp(@actor, 392, 0)
end
end
class Window_Status < Window_Base
alias dual_mpsp_drwbscinf draw_basic_info
def draw_basic_info(x, y)
dual_mpsp_drwbscinf(x, y)
sx = x; sy = y
draw_actor_sp(@actor, sx, sy + WLH * 4)
end
end
class Window_BattleStatus < Window_Selectable
if self.method_defined?(:draw_party_morale)
alias dual_mpsp_yerd_item draw_item
def draw_item(index)
dual_mpsp_yerd_item(index)
draw_party_sp(index)
end
def draw_party_hp(index)
dx = index * 96 + 2
dy = WLH * 2.5 - YE::BATTLE::DISPLAY::STAT_FONT_SIZE + 2
if $imported["BattlerStatMorale"] and YE::BATTLE::DISPLAY::GAUGE_MORALE
dy -= YE::BATTLE::DISPLAY::STAT_FONT_SIZE
end
dw = 92
draw_actor_hp_gauge(@actor, dx, dy, dw)
self.contents.font.size = YE::BATTLE::DISPLAY::STAT_FONT_SIZE
self.contents.font.color = system_color
self.contents.draw_text(dx + 2, dy + 4, 28, WLH, Vocab::hp_a, 0)
self.contents.font.color = hp_color(@actor)
text = sprintf("%d/%d", @actor.hp, @actor.maxhp)
percent = @actor.hp * 100.0 / @actor.maxhp
case YE::BATTLE::DISPLAY::SHOWN_HP_TYPE
when 1; text = @actor.hp
when 2; text = sprintf("%d/%d", @actor.hp, @actor.maxhp)
when 3; text = sprintf("%d%%", percent)
when 4; text = sprintf("%d %d%%", @actor.hp, percent)
when 5; text = sprintf("%d/%d %d%%", @actor.hp, @actor.maxhp, percent)
end
self.contents.draw_text(dx + 30, dy + 4, dw - 32, WLH, text, 2)
end
def draw_party_mp(index)
dx = index * 96 + 2
dy = WLH * 3 - YE::BATTLE::DISPLAY::STAT_FONT_SIZE + 2
if $imported["BattlerStatMorale"] and YE::BATTLE::DISPLAY::GAUGE_MORALE
dy -= YE::BATTLE::DISPLAY::STAT_FONT_SIZE
end
dw = 92
#---
move_mp_bar = false
if $imported["CustomSkillEffects"]
if YE::BATTLE::DISPLAY::RAGE_CLASSES.include?(@actor.class.id)
move_mp_bar = true
end
if $imported["SubclassSelectionSystem"] and @actor.subclass != nil
if YE::BATTLE::DISPLAY::RAGE_CLASSES.include?(@actor.subclass.id)
move_mp_bar = true
end
end
end
if move_mp_bar and YE::BATTLE::DISPLAY::RAGE_DISPLAY == 1
dw /= 2
dx += dw
draw_party_rage(index)
elsif move_mp_bar and YE::BATTLE::DISPLAY::RAGE_DISPLAY == 1
dw /= 2
draw_party_rage(index)
end
#---
draw_actor_mp_gauge(@actor, dx, dy, dw)
self.contents.font.size = YE::BATTLE::DISPLAY::STAT_FONT_SIZE
self.contents.font.color = system_color
self.contents.draw_text(dx + 2, dy + 4, 28, WLH, Vocab::mp_a, 0)
self.contents.font.color = mp_color(@actor)
text = sprintf("%d/%d", @actor.mp, @actor.maxmp)
unless @actor.maxmp == 0
percent = @actor.mp * 100.0 / @actor.maxmp
else
percent = 0
end
case YE::BATTLE::DISPLAY::SHOWN_MP_TYPE
when 1; text = @actor.mp
when 2; text = sprintf("%d/%d", @actor.mp, @actor.maxmp)
when 3; text = sprintf("%d%%", percent)
when 4; text = sprintf("%d %d%%", @actor.mp, percent)
when 5; text = sprintf("%d/%d %d%%", @actor.mp, @actor.maxmp, percent)
end
self.contents.draw_text(dx + 30, dy + 4, dw - 32, WLH, text, 2)
end
def draw_party_sp(index)
dx = index * 96 + 2
dy = WLH * 3
if $imported["BattlerStatMorale"] and YE::BATTLE::DISPLAY::GAUGE_MORALE
dy -= YE::BATTLE::DISPLAY::STAT_FONT_SIZE
end
dw = 92
#---
move_sp_bar = false
if $imported["CustomSkillEffects"]
if YE::BATTLE::DISPLAY::RAGE_CLASSES.include?(@actor.class.id)
move_sp_bar = true
end
if $imported["SubclassSelectionSystem"] and @actor.subclass != nil
if YE::BATTLE::DISPLAY::RAGE_CLASSES.include?(@actor.subclass.id)
move_sp_bar = true
end
end
end
if move_sp_bar and YE::BATTLE::DISPLAY::RAGE_DISPLAY == 1
dw /= 2
dx += dw
draw_party_rage(index)
elsif move_sp_bar and YE::BATTLE::DISPLAY::RAGE_DISPLAY == 1
dw /= 2
draw_party_rage(index)
end
#---
draw_actor_sp_gauge(@actor, dx, dy, dw)
self.contents.font.size = YE::BATTLE::DISPLAY::STAT_FONT_SIZE
self.contents.font.color = system_color
self.contents.draw_text(dx + 2, dy + 4, 28, WLH, Vocab::sp_a, 0)
self.contents.font.color = sp_color(@actor)
text = sprintf("%d/%d", @actor.sp, @actor.maxsp)
unless @actor.maxsp == 0
percent = @actor.sp * 100.0 / @actor.maxsp
else
percent = 0
end
case SP::SHOWN_SP_TYPE
when 1; text = @actor.sp
when 2; text = sprintf("%d/%d", @actor.sp, @actor.maxmp)
when 3; text = sprintf("%d%%", percent)
when 4; text = sprintf("%d %d%%", @actor.sp, percent)
when 5; text = sprintf("%d/%d %d%%", @actor.sp, @actor.maxsp, percent)
end
self.contents.draw_text(dx + 30, dy + 4, dw - 32, WLH, text, 2)
end
else
def draw_item(index)
rect = item_rect(index)
rect.x += 4
rect.width -= 8
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
actor = $game_party.members[index]
y = rect.y
draw_actor_name(actor, 4, y)
draw_actor_state(actor, 114, y, 48)
draw_actor_hp(actor, 174, y, 70)
draw_actor_mp(actor, 260, y, 50)
draw_actor_sp(actor, 326, y, 50)
end
end
end
There are some small problems with that code, but it is almost done. I'll try to continue work on it, but it doesn't seem very likely. I deeply apologize for any inconvenience. And to any scripter who feels like completing this, make sure it's below YERD Party Display. Otherwise a method would be overwritten.
Sorry for the lack of completion and notes.