PP_skill = 11#消耗PP的技能属性
PP_recover = 12 #带有该属性的技能/物品将具有PP恢复/扣除属性,不过技能的脚本还没写所以只有物品能用了ORZ
class Game_System
attr_accessor :PP # 特技的点数
alias vince initialize
def initialize
vince
@PP = []
a = $data_skills.size - 1
for i in 1..a
@PP[i] = $data_skills[i].sp_cost
end
end
#--------------------------------------------------------------------------
# ● PP校正
#--------------------------------------------------------------------------
def PP_correcting
a = $data_skills.size - 1
for i in 1..a
@PP[i] = [@PP[i],$data_skills[i].sp_cost].min
end
end
end
class Game_Battler
#--------------------------------------------------------------------------
# ● 可以使用特技的判定
# skill_id : 特技 ID
#--------------------------------------------------------------------------
alias skill_can_use2? skill_can_use?
def skill_can_use?(skill_id)
skill_can_use2?(skill_id)
# PP 不足的限定技不能使用
if $game_system.PP[skill_id] < 1 and $data_skills[skill_id].element_set.include?(PP_skill)
return false
end
return true
end
alias item_effect2 item_effect
def item_effect(item)
item_effect2(item)
if item.element_set.include?(PP_recover)
for i in 0..self.skills.size-1
a = self.skills[i]
$game_system.PP[a] += recover_sp
end
self.sp -= recover_sp
$game_system.PP_correcting
end
end
end
class Scene_Battle
alias make_skill_result2 make_skill_result
def make_skill_result
make_skill_result2
if @skill.element_set.include?(PP_skill)
@active_battler.sp += @skill.sp_cost
$game_system.PP[@skill.id] -= 1
end
end
end
class Window_Skill < Wnd_Selectable
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
y = index * 24
self.contents.font.size = 16
self.contents.font.color = Color.new(69, 39, 0, 255)
self.contents.font.name = ["方正粗活意简体", "黑体"]
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 == Color.new(69, 39, 0, 255) ? 255 : 128
self.contents.blt(x, y+2, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y-2, 204, 32, skill.name)
#############################################################################
if skill.element_set.include?(PP_skill)
self.contents.draw_text(x + 200, y-2, 48, 32, $game_system.PP[skill.id].to_s + "/" + skill.sp_cost.to_s, 2)
else
self.contents.draw_text(x + 220, y-2, 48, 32, skill.sp_cost.to_s)
end
##########################################################################
end
end
class Scene_Battle
alias prepare2 prepare
def prepare
prepare2
#-----------------------------------
# PP恢复
#-----------------------------------
for index in 0...$game_party.actors.size
battler = $game_party.actors[index]
for i in 0..battler.skills.size-1
a = battler.skills[i]
$game_system.PP[a] = [battler.hp*$data_skills[a].sp_cost/battler.maxhp,$game_system.PP[a]].max
end
end
end
end