#==============================================================================
# ** Party Points - Configuration
#------------------------------------------------------------------------------
# By Sasuke89 9-21-07
#------------------------------------------------------------------------------
# Setup the skill and item settings used in-game.
#==============================================================================
#=begin
$skills = {}
$items = {}
#==============================================================================
# ** Start Edits
#==============================================================================
#==============================================================================
# ** Skill Edits
#------------------------------------------------------------------------------
# Setup : $skills = {"Skill Name" => Consumed PP}
#==============================================================================
$skills = {
"Cross Cut" => 3,
"Sword's Stance" => 3,
"Celestial Thrust" => 3,
"Courageous" => 4,
"Celestial Cross" => 4,
"Courageous Stance" => 5,
"Bite" => 3,
"Super Fang" => 3,
"Aqua Fang" => 4,
"Isabella's Reign" => 4,
"Earth Reflect" => 3,
"Antidote Fang" => 6,
"Remedy" => 6,
"Earth Reflect" => 6,
"Water Reflect" => 6
}
#==============================================================================
# ** Item Edits
#------------------------------------------------------------------------------
# Setup : $items = {"Item Name" => Consumed PP}
#==============================================================================
$items = {
"Golden Sand" => 3
}
#==============================================================================
# ** Default Variables
#==============================================================================
$skills_costdefault = 2 #The Default Skill Cost
$attack = [true,1] #If true, attack takes 1 party point
$defend = [true,1] #If true, attack takes 1 party point
$items_costdefault = 1 #The Default Item Cost
$power_points_word = "PP"
$magic_capacity = "COST"
$quantity_word = "QTY"
#==============================================================================
# ** End Edits
#==============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
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)
if $skills.include?(skill.name)
self.contents.draw_text(x + 220, y, 60, 32, $power_points_word + ":" + $skills[skill.name].to_s + " " + $magic_capacity + ":" + skill.sp_cost.to_s, 2)
else
self.contents.draw_text(x + 220, y, 60, 32, $power_points_word + ":" + $skills_costdefault.to_s + " " + $magic_capacity + ":" + skill.sp_cost.to_s, 2)
end
end
end
class Window_Item < Window_Selectable
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.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(item.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, 212, 32, item.name, 0)
self.contents.draw_text(x + 204, y, 16, 32, ":", 1)
if $items.include?(item.name)
self.contents.draw_text(x + 220, y, 60, 32, $power_points_word + ":" + $items[item.name].to_s + " " + $quantity_word + ":" + number.to_s, 2)
else
self.contents.draw_text(x + 220, y, 60, 32, $power_points_word + ":" + $items_costdefault.to_s + " " + $quantity_word + ":" + number.to_s, 2)
end
end
end
class Game_Actor < Game_Battler
def skill_can_use?(skill_id, party = false)
if party == false
if $scene.is_a?(Scene_Battle)
if $skills.include?($data_skills[skill_id].name)
if $skills[$data_skills[skill_id].name] > $game_party.party_points
return false
end
else
end
end
end
if not skill_learn?(skill_id)
return false
end
return super
end
end
class Game_Battler
#--------------------------------------------------------------------------
# * Determine Usable Skills
# skill_id : skill ID
#--------------------------------------------------------------------------
def skill_can_use?(skill_id, party = false)
# If there's not enough SP, the skill cannot be used.
if $data_skills[skill_id].sp_cost > self.sp
return false
end
# Unusable if incapacitated
if dead?
return false
end
# If silent, only physical skills can be used
if $data_skills[skill_id].atk_f == 0 and self.restriction == 1
return false
end
# Get usable time
occasion = $data_skills[skill_id].occasion
# If in battle
if $game_temp.in_battle
# Usable with [Normal] and [Only Battle]
return (occasion == 0 or occasion == 1)
# If not in battle
else
# Usable with [Normal] and [Only Menu]
return (occasion == 0 or occasion == 2)
end
end
end
class Game_Party
alias s89item_can_use? item_can_use?
def item_can_use?(item_id, party = false)
if party == false
if $scene.is_a?(Scene_Battle)
if $items.include?($data_items[item_id].name)
if $items[$data_items[item_id].name] > $game_party.party_points
return false
end
end
end
end
s89item_can_use?(item_id)
end
end
class Scene_Battle
attr_accessor :startingpp
attr_accessor :help_window
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
alias sd_main2 main
def main
@startingpp = $game_party.party_points
# Perform the Original Call
sd_main2
end
alias s89end_skill_select end_skill_select
#--------------------------------------------------------------------------
# * End Skill Selection
#--------------------------------------------------------------------------
def end_skill_select(max = false)
#(true)
# Dispose of skill window
s89end_skill_select
@active_skill = @skill
if max == true
$game_party.party_points = @max
return
else
if @active_battler.current_action.kind == 1
@active_skill = @skill
if @active_skill != nil
if $skills.include?(@active_skill.name)
if $skills[@active_skill.name] != nil
$game_party.party_points -= $skills[@active_skill.name]
else
end
@showpoint_window.update if @showpoint_window != nil
else
$game_party.party_points -= $skills_costdefault
#print("Default")
@showpoint_window.update if @showpoint_window != nil
end
end
elsif @active_battler.current_action.kind == 0 && @active_battler.current_action.basic = 0
if $attack.include?(true)
$game_party.party_points -= $attack[1]
@showpoint_window.update if @showpoint_window != nil
end
end
end
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : basic command)
#--------------------------------------------------------------------------
def update_phase3_basic_command
if $command_height != nil
if Input.trigger?(Input::C)
# Branch by actor command window cursor position
case @actor_command_window.index
when @escape_actor_command_index # Escape
# Play Decision SE
$game_system.se_play($data_system.decision_se)
if $game_temp.battle_can_escape == false
# Play Buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 2
phase3_next_actor
return
end
end
end
if $game_party.party_points < 1
#next player
phase3_next_actor
end
if $game_party.party_points < $attack[1]
@actor_command_window.disable_item(0)
@attack_disable = true
else
@actor_command_window.draw_item(0, Color.new(255, 255, 255, 255))
@attack_disable = false
end
if $game_party.party_points < $defend[1]
@actor_command_window.disable_item(2)
@defend_disable = true
else
@actor_command_window.draw_item(2, Color.new(255, 255, 255, 255))
@defend_disable = false
end
if $game_party.party_points < $items_costdefault
@actor_command_window.disable_item(3)
@item_disable = true
else
@actor_command_window.draw_item(3, Color.new(255, 255, 255, 255))
@item_disable = false
end
@item_disable
#$defend
#$item
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by actor command window cursor position
case @actor_command_window.index
when 0 # attack
if $delayed_skills != nil
@active_battler.skill_select = false
end
@max = $game_party.party_points
if $attack.include?(true)
if @attack_disable == true
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
end
#@attack_disable = false
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
# Start enemy selection
start_enemy_select
when 1 # skill
@max = $game_party.party_points
#@var = 1
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 1
# Start skill selection
start_skill_select
when 2 # guard
if $delayed_skills != nil
@active_battler.skill_select = false
end
@max = $game_party.party_points
if $defend.include?(true)
if @defend_disable == true
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
end
$game_party.party_points -= $defend[1]
@showpoint_window.update if @showpoint_window != nil
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 1
# Go to command input for next actor
phase3_next_actor
when 3 # item
if $delayed_skills != nil
@active_battler.skill_select = false
end
@max = $game_party.party_points
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 2
# Start item selection
start_item_select
end
return
end
end
alias s89update_phase4_step6 update_phase4_step6
def update_phase4_step6
@var = 0
for i in 0...$game_party.actors.size
@var += $game_party.actors[i].level
end
$game_party.party_points = $default_partypoints
$game_party.party_points += @var / $default_division
$game_party.max_party_pp = $game_party.party_points
@showpoint_window.update if @showpoint_window != nil
#@party_points = @max_party_pp
s89update_phase4_step6
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : enemy selection)
#--------------------------------------------------------------------------
def update_phase3_enemy_select
# Update enemy arrow
@enemy_arrow.update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# End enemy selection
end_enemy_select#(true)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.target_index = @enemy_arrow.index
# End enemy selection
end_enemy_select
# If skill window is showing
if @skill_window != nil
# End skill selection
end_skill_select
end
# If item window is showing
if @item_window != nil
# End item selection
end_item_select
end
# Go to command input for next actor
phase3_next_actor
end
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : actor selection)
#--------------------------------------------------------------------------
def update_phase3_actor_select
# Update actor arrow
@actor_arrow.update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# End actor selection
end_actor_select#(true)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.target_index = @actor_arrow.index
# End actor selection
end_actor_select
# If skill window is showing
if @skill_window != nil
# End skill selection
end_skill_select
end
# If item window is showing
if @item_window != nil
# End item selection
end_item_select
end
# Go to command input for next actor
phase3_next_actor
end
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : skill selection)
#--------------------------------------------------------------------------
def update_phase3_skill_select
# Make skill window visible
@skill_window.visible = true
# Update skill window
@skill_window.update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# End skill selection
end_skill_select(true)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Get currently selected data on the skill window
@skill = @skill_window.skill
# If it can't be used
if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.skill_id = @skill.id
# Make skill window invisible
@skill_window.visible = false
# If effect scope is single enemy
if @skill.scope == 1
# Start enemy selection
start_enemy_select
# If effect scope is single ally
elsif @skill.scope == 3 or @skill.scope == 5
# Start actor selection
start_actor_select
# If effect scope is not single
else
# End skill selection
end_skill_select
# Go to command input for next actor
phase3_next_actor
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : item selection)
#--------------------------------------------------------------------------
def update_phase3_item_select
# Make item window visible
@item_window.visible = true
# Update item window
@item_window.update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# End item selection
end_item_select(true)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Get currently selected data on the item window
@item = @item_window.item
# If it can't be used
unless $game_party.item_can_use?(@item.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.item_id = @item.id
# Make item window invisible
@item_window.visible = false
# If effect scope is single enemy
if @item.scope == 1
# Start enemy selection
start_enemy_select
# If effect scope is single ally
elsif @item.scope == 3 or @item.scope == 5
# Start actor selection
start_actor_select
# If effect scope is not single
else
# End item selection
end_item_select
# Go to command input for next actor
phase3_next_actor
end
return
end
end
alias s89end_item_select end_item_select
def end_item_select(max = false)
# If targetted with a skill/spell
#if @active_battler.skill_select
s89end_item_select
if max == true
$game_party.party_points = @max
@showpoint_window.update if @showpoint_window != nil
else
@active_item = @item
if @active_item != nil
if $items.include?(@active_item.name)
if $items[@active_item.name] != nil
$game_party.party_points -= $items[@active_item.name]
@showpoint_window.update if @showpoint_window != nil
else
@showpoint_window.update if @showpoint_window != nil
end
else
$game_party.party_points -= $items_costdefault
@showpoint_window.update if @showpoint_window != nil
end
end
end
end
#--------------------------------------------------------------------------
# * Make Skill Action Results
#--------------------------------------------------------------------------
def make_skill_action_result
# Get skill
@skill = $data_skills[@active_battler.current_action.skill_id]
# If not a forcing action
unless @active_battler.current_action.forcing
# If unable to use due to SP running out
unless @active_battler.skill_can_use?(@skill.id, true)
# Clear battler being forced into action
$game_temp.forcing_battler = nil
# Shift to step 1
@phase4_step = 1
return
end
end
# Use up SP
@active_battler.sp -= @skill.sp_cost
# Refresh status window
@status_window.refresh
# Show skill name on help window
@help_window.set_text(@skill.name, 1)
# Set animation ID
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
# Set command event ID
@common_event_id = @skill.common_event_id
# Set target battlers
set_target_battlers(@skill.scope)
# Apply skill effect
for target in @target_battlers
target.skill_effect(@active_battler, @skill)
end
end
end
#=end