Parallel Fantasy VII
Iniziato da
Rehim McMoon
, set 11 2007 05:56
43 risposte a questa discussione
#21
Inviato 11 settembre 2007 - 06:50
Uno script per il negoziodi magia,nuova classe sopra main e chiamala
skills shop
#==============================================================================
# ** Skill Shop
#------------------------------------------------------------------------------
# SephirothSpawn
# 2006-04-06
# Version 1
#------------------------------------------------------------------------------
# * Instrucions :
#
# ~ Gaining Skill Points
# - $game_party.actors[actor_index].skill_shop_points +-*/= x
# OR
# - $game_actors[actor_id].skill_shop_points +-*/= x
#
# ~ Setting Up Aviable Skills
# - $game_temp.skill_shop_skills[actor_id] = [skill_id, ... ]
# OR
# - $game_temp.skill_shop_skills[actor_id] = nil
# - $game_temp.skill_shop_skills[0] = [skill_id, ...]
# (0 is used as the default. Any actor ID not defined will use this list for the skills)
#
# ~ Calling Skill Shop
# - $scene = Scene_SkillShop.new(actor_index)
#
# ~ Switching Actor In Skill Shop
# - Press L or R
#------------------------------------------------------------------------------
# * Customization :
#
# ~ Purchasing Types (Must Use 1, can Use 2)
# - Spend_Gold = true (On) or false (Off)
# - Spend_Skill_Points = true (On) or false (Off)
#
# ~ Skill Cost
# - Gold Cost
# Skill_Gold_Cost = { skill_id => cost, ... }
# - Skill Point Cost
# Skill_Point_Cost = { skill_id => cost, ... }
#
# ~ Actor Requirements
# - Actor_Requirements = { skill_id => [actor_id, ...], ... }
#
# ~ Level Requirements
# - Level_Requirements = { skill_id => req_level, ... }
#
# ~ Previous Skill Requirements
# - Previous_Skill_Requirments = { skill_id => [req_skill, ...], ... }
#==============================================================================
#==============================================================================
# ** Skill_Shop
#==============================================================================
module Skill_Shop
#--------------------------------------------------------------------------
# * Purchasing Types
#--------------------------------------------------------------------------
Spend_Gold = true
Spend_Skill_Points = true
#--------------------------------------------------------------------------
# * Skill Cost
# ~ Skill_Gold_Cost = { skill_id => cost, ... }
# ~ Skill_Point_Cost = { skill_id => cost, ... }
#--------------------------------------------------------------------------
Default_Skill_Gold_Cost = 500
Skill_Gold_Cost = {}
Default_SP_Cost = 500
Skill_Point_Cost = {}
#--------------------------------------------------------------------------
# * Actor Requirements
# ~ Actor_Requirements = { skill_id => [actor_id, ...], ... }
#--------------------------------------------------------------------------
Actor_Requirements = {
57 => [1], 58 => [1], 59 => [1], 60 => [1],
61 => [2], 62 => [2], 63 => [2], 64 => [2],
65 => [3], 66 => [3], 67 => [3], 68 => [3],
69 => [4], 70 => [4], 71 => [4], 72 => [4],
73 => [5], 74 => [5], 75 => [5], 76 => [5],
77 => [6], 78 => [6], 79 => [6], 80 => [6],
}
#--------------------------------------------------------------------------
# * Level Requirements
# ~ Level_Requirements = { skill_id => req_level, ... }
#--------------------------------------------------------------------------
Level_Requirements = {}
#--------------------------------------------------------------------------
# * Previous Skill Requirements
# ~ Previous_Skill_Requirments = { skill_id => [req_skill, ...], ... }
#--------------------------------------------------------------------------
Previous_Skill_Requirments = {
2 => [1], 3 => [1, 2],
5 => [4],
8 => [7], 9 => [7, 8],
11 => [10], 12 => [10, 11],
14 => [13], 15 => [13, 14],
17 => [16], 18 => [16, 17],
20 => [19], 21 => [19, 20],
23 => [22], 24 => [22, 23],
26 => [25], 27 => [25, 26],
29 => [28], 30 => [28, 29], 32 => [31],
58 => [57], 59 => [57, 58], 60 => [57, 58, 59],
62 => [61], 63 => [61, 62], 64 => [61, 62, 63],
66 => [65], 67 => [65, 66], 68 => [65, 66, 67],
70 => [69], 71 => [69, 70], 72 => [69, 70, 71],
74 => [73], 75 => [73, 74], 76 => [73, 74, 75],
78 => [77], 79 => [77, 78], 80 => [77, 78, 79]
}
end
#==============================================================================
# ** Game_Temp
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :skill_shop_skills
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_skillshop_gtemp_init initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Original Initialization
seph_skillshop_gtemp_init
# Sets Skills Shop Skills List
@skill_shop_skills = {0 => (1...$data_skills.size).to_a}
end
end
#==============================================================================
# ** Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :skill_shop_points
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_skillshop_gactor_setup setup
alias seph_skillshop_gactor_skills skills
#--------------------------------------------------------------------------
# * Setup
#--------------------------------------------------------------------------
def setup(actor_id)
# Sets Up Skill Shop Skills Array
@skill_shop_skills = []
# Sets Up Skill Points
@skill_shop_points = 0
# Original Setup Method
seph_skillshop_gactor_setup(actor_id)
end
#--------------------------------------------------------------------------
# * Skills
#--------------------------------------------------------------------------
def skills
# Gets Original Skills
s = seph_skillshop_gactor_skills.dup
# Adds Skill Shop Skills
s << @skill_shop_skills
# Returns Skills
return s.flatten.uniq.sort.dup
end
#--------------------------------------------------------------------------
# * Learn Shop Skill
#--------------------------------------------------------------------------
def learn_shop_skill(skill_id)
# Unless Skill Already Learned
unless @skill_shop_skills.include?(skill_id)
# Learn Shop Skill
@skill_shop_skills << skill_id
end
end
#--------------------------------------------------------------------------
# * Can Learn Shop Skill Check
#--------------------------------------------------------------------------
def can_learn_shop_skill?(skill_id)
# If Skill Learned
if self.skills.include?(skill_id)
return false
end
# If Gold Cost
if Skill_Shop::Spend_Gold
if Skill_Shop::Skill_Gold_Cost.has_key?(skill_id)
if $game_party.gold < Skill_Shop::Skill_Gold_Cost[skill_id]
return false
end
else
if $game_party.gold < Skill_Shop::Default_Skill_Gold_Cost
return false
end
end
end
# If Skill Point Cost
if Skill_Shop::Spend_Skill_Points
if Skill_Shop::Skill_Point_Cost.has_key?(skill_id)
if @skill_shop_points < Sklll_Shop::Skill_Point_Cost[skill_id]
p 'Not Enough SP'
return false
end
else
if @skill_shop_points < Skill_Shop::Default_SP_Cost
return false
end
end
end
# Actor Requirement
if Skill_Shop::Actor_Requirements.has_key?(skill_id)
unless Skill_Shop::Actor_Requirements[skill_id].include?(@actor_id)
return false
end
end
# Level Requirement
if Skill_Shop::Level_Requirements.has_key?(skill_id)
if @level < Skill_Shop::Level_Requirements[skill_id]
return false
end
end
# Previous Skill Requirement
if Skill_Shop::Previous_Skill_Requirments.has_key?(skill_id)
for s_id in Skill_Shop::Previous_Skill_Requirments[skill_id]
unless self.skills.include?(s_id)
return false
end
end
end
return true
end
end
#==============================================================================
# ** Window_SkillShop_SkillList
#==============================================================================
class Window_SkillShop_SkillList < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor_id)
super(0, 64, 224, 320)
@actor = $game_party.actors[actor_id]
create_skills_list
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Create Skills List
#--------------------------------------------------------------------------
def create_skills_list
# Check for Personalize Skills List
if $game_temp.skill_shop_skills.has_key?(@actor.id)
unless $game_temp.skill_shop_skills[@actor.id].nil?
@skills = $game_temp.skill_shop_skills[@actor.id]
end
end
# Default Skill List
if @skills.nil?
@skills = $game_temp.skill_shop_skills[0]
end
# Sets Item Max
@item_max = @skills.size
if @item_max > 0
self.contents = Bitmap.new(192, @item_max * 32)
end
end
#--------------------------------------------------------------------------
# * Return Skill Id
#--------------------------------------------------------------------------
def skill_id
return @skills[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
# Sets Skill
skill = $data_skills[@skills[index]]
# Can Learn Flag
can_learn = @actor.can_learn_shop_skill?(skill.id)
# Skill Icon
bitmap = RPG::Cache.icon(skill.icon_name)
# Draws Skill Icon
self.contents.blt(4, index * 32 + 4, bitmap, Rect.new(0, 0, 24, 24), can_learn ? 255 : 160)
# Font Color
self.contents.font.color = can_learn ? normal_color : disabled_color
# Draws Skill Name
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.draw_text(32, index * 32, 160, 32, skill.name)
end
end
#==============================================================================
# ** Window_SkillShop_Cost
#==============================================================================
class Window_SkillShop_Cost < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor_id, skill_id)
super(0, 384, 224, 96)
self.contents = Bitmap.new(192, 64)
@actor = $game_party.actors[actor_id]
refresh(skill_id)
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(skill_id)
self.contents.clear
# Gold & SP Cost
if Skill_Shop::Spend_Gold && Skill_Shop::Spend_Skill_Points
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 192, 32, "#{$data_system.words.gold} Cost:")
self.contents.draw_text(4, 32, 192, 32, 'Skill Point Cost:')
gold = $game_party.gold - (Skill_Shop::Skill_Gold_Cost.has_key?(skill_id) ?
Skill_Shop::Skill_Gold_Cost[skill_id] : Skill_Shop::Default_Skill_Gold_Cost)
self.contents.font.color = gold >= 0 ? text_color(1) : text_color(2)
self.contents.draw_text(- 4, 0, 192, 32, gold.to_s, 2)
sp = @actor.skill_shop_points - (Skill_Shop::Skill_Point_Cost.has_key?(skill_id) ?
Skill_Shop::Skill_Point_Cost[skill_id] : Skill_Shop::Default_SP_Cost)
self.contents.font.color = sp >= 0 ? text_color(1) : text_color(2)
self.contents.draw_text(- 4, 32, 192, 32, sp.to_s, 2)
# Only Gold Cost
elsif Skill_Shop::Spend_Gold
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 192, 32, "#{$data_system.words.gold} Cost:")
gold = $game_party.gold - (Skill_Shop::Skill_Gold_Cost.has_key?(skill_id) ?
Skill_Shop::Skill_Gold_Cost[skill_id] : Skill_Shop::Default_Skill_Gold_Cost)
self.contents.font.color = gold >= 0 ? text_color(1) : text_color(2)
self.contents.draw_text(- 4, 32, 192, 32, gold.to_s, 2)
elsif Skill_Shop::Spend_Skill_Points
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 192, 32, 'Skill Point Cost')
self.contents.font.color = normal_color
sp = @actor.skill_shop_points - Skill_Shop::Skill_Point_Cost.has_key?(skill_id) ?
Skill_Shop::Skill_Point_Cost[skill_id] : Skill_Shop::Default_SP_Cost
self.contents.font.color = sp >= 0 ? text_color(1) : text_color(2)
self.contents.draw_text(- 4, 32, 192, 32, sp.to_s, 2)
end
end
end
#==============================================================================
# ** Window_SkillShop_SkillData
#==============================================================================
class Window_SkillShop_SkillData < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor_index, skill_id)
super(224, 64, 416, 416)
self.contents = Bitmap.new(384, 384)
@actor = $game_party.actors[actor_index]
refresh(skill_id)
end
#--------------------------------------------------------------------------
# * Disabled System Color
#--------------------------------------------------------------------------
def disabled_system_color
color = system_color
color.alpha = disabled_color.alpha
return color
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(skill_id)
self.contents.clear
# Gets Skills
skill = $data_skills[skill_id]
# Can Learn Flag
can_learn = @actor.can_learn_shop_skill?(skill.id)
# Gets Icon
bitmap = RPG::Cache.icon(skill.icon_name)
# Draws Skill Icon
self.contents.blt(4, 4, bitmap, Rect.new(0, 0, 24, 24), can_learn ? 255 : 160)
# Draws Skill Name
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = can_learn ? normal_color : disabled_color
self.contents.draw_text(32, 0, 352, 32, skill.name)
# Draws SP Cost
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = can_learn ? system_color : disabled_system_color
self.contents.draw_text(272, 0, 112, 32, "#{$data_system.words.sp} :")
self.contents.font.color = can_learn ? normal_color : disabled_color
self.contents.draw_text(- 4, 0, 384, 32, skill.sp_cost.to_s, 2)
# Draws Descritpion
self.contents.font.color = can_learn ? system_color : disabled_system_color
self.contents.draw_text(4, 32, 60, 32, 'Desc. :')
self.contents.font.color = can_learn ? normal_color : disabled_color
self.contents.draw_text(64, 32, 320, 32, skill.description)
# Draws Scope
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
case skill.scope
when 0 ; scope = 'None'
when 1 ; scope = 'One Enemy'
when 2 ; scope = 'All Enemies'
when 3 ; scope = 'One Ally'
when 4 ; scope = 'All Allies'
when 5 ; scope = "KO'd Ally"
when 6 ; scope = "All KO'd Allies"
when 7 ; scope = 'User'
end
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = can_learn ? system_color : disabled_system_color
self.contents.draw_text(4, 64, 186, 32, 'Scope :')
self.contents.font.color = can_learn ? normal_color : disabled_color
self.contents.draw_text(- 4, 64, 190, 32, scope, 2)
# Draws Occassion
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
case skill.occasion
when 0 ; occ = 'Sempre'
when 1 ; occ = 'In battaglia'
when 2 ; occ = 'Nel Menu'
when 3 ; occ = 'Mai'
end
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = can_learn ? system_color : disabled_system_color
self.contents.draw_text(194, 64, 186, 32, 'Occassion :')
self.contents.font.color = can_learn ? normal_color : disabled_color
self.contents.draw_text(190, 64, 190, 32, occ, 2)
# Draws Skill Power & Hit Probability
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = can_learn ? system_color : disabled_system_color
self.contents.draw_text(4, 96, 186, 32, 'Potenza :')
self.contents.draw_text(194, 96, 186, 32, 'Attacco %')
self.contents.font.color = can_learn ? normal_color : disabled_color
self.contents.draw_text(- 4, 96, 190, 32, skill.power.to_s, 2)
self.contents.draw_text(190, 96, 190, 32, skill.hit.to_s, 2)
# Cash Cost
if Skill_Shop::Spend_Gold
cost = Skill_Shop::Skill_Gold_Cost.has_key?(skill_id) ?
Skill_Shop::Skill_Gold_Cost[skill_id] : Skill_Shop::Default_Skill_Gold_Cost
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = can_learn ? system_color : disabled_system_color
self.contents.draw_text(4, 128, 186, 32, "#{$data_system.words.gold} Cost:")
self.contents.font.color = can_learn ? normal_color : disabled_color
self.contents.draw_text(- 4, 128, 190, 32, cost.to_s, 2)
end
# Skill Points Cost
if Skill_Shop::Spend_Skill_Points
cost = Skill_Shop::Skill_Point_Cost.has_key?(skill_id) ?
Skill_Shop::Skill_Point_Cost[skill_id] : Skill_Shop::Default_SP_Cost
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = can_learn ? system_color : disabled_system_color
self.contents.draw_text(194, 128, 186, 32, "Costo Mp:")
self.contents.font.color = can_learn ? normal_color : disabled_color
self.contents.draw_text(190, 128, 190, 32, cost.to_s, 2)
end
# Draws Level Requried
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = can_learn ? system_color : disabled_system_color
self.contents.draw_text(95, 160, 190, 32, 'Livello richiesto :')
req_lvl = Skill_Shop::Level_Requirements.has_key?(skill_id) ?
Skill_Shop::Level_Requirements[skill_id].to_s : 'Niente'
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = can_learn ? normal_color : disabled_color
self.contents.draw_text(95, 160, 190, 32, req_lvl, 2)
# Actor Requirment
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = can_learn ? system_color : disabled_system_color
self.contents.draw_text(0, 192, 384, 32, 'Actor allowed skills', 1)
self.contents.font.color = can_learn ? normal_color : disabled_color
if Skill_Shop::Actor_Requirements.has_key?(skill_id)
actors = Skill_Shop::Actor_Requirements[skill_id].dup
actors.collect! { |x| $data_actors[x].name}
actors = actors.join(' - ')
else
actors = 'Tutti gli alleti'
end
self.contents.draw_text(0, 224, 384, 32, actors, 1)
# Draws Previous Skill Requirements
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = can_learn ? system_color : disabled_system_color
self.contents.draw_text(0, 256, 384, 32, 'Magie richieste', 1)
self.contents.font.color = can_learn ? normal_color : disabled_color
if Skill_Shop::Previous_Skill_Requirments.has_key?(skill_id)
skills = Skill_Shop::Previous_Skill_Requirments[skill_id].dup
skills.collect! {|x| $data_skills[x]}
for i in 0...skills.size
skill = skills[i]
x = 4 + i % 2 * 190
y = i / 2 * 32 + 288
bitmap = RPG::Cache.icon(skill.icon_name)
self.contents.blt(x + 4, y + 4, bitmap, Rect.new(0, 0, 24, 24), can_learn ? 255 : 160)
self.contents.draw_text(x + 32, y, 154, 32, skill.name)
end
else
self.contents.draw_text(0, 288, 384, 32, 'Niente magie', 1)
end
end
end
#==============================================================================
# ** Scene_SkillShop
#==============================================================================
class Scene_SkillShop
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor_index = 0)
@actor_index = actor_index
@actor = $game_party.actors[actor_index]
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Creates Help Window
@help_window = Window_Help.new
@help_window.set_text("Benvenuto nel negozio di magia! #{@actor.name} ~ Scegli magia da imparare", 1)
# Creates Skill List
@skill_list_window = Window_SkillShop_SkillList.new(@actor_index)
# Creates Skill Shop Cost Window
@skill_cost_window = Window_SkillShop_Cost.new(@actor_index, @skill_list_window.skill_id)
# Creates Skill Data Window
@skill_data_window = Window_SkillShop_SkillData.new(@actor_index, @skill_list_window.skill_id)
# Confirmation Window
@confirmation_window = Window_Command.new(128, ['Si', 'No'])
@confirmation_window.x, @confirmation_window.y = 256, 208
@confirmation_window.z = 1000
@confirmation_window.visible = @confirmation_window.active = false
# Scene Objects
@scene_objects = [@help_window, @skill_list_window, @skill_cost_window,
@skill_data_window, @confirmation_window]
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Updates Scene Objects
@scene_objects.each { |x| x.update }
# Frame update
update
# Abort loop if screen is changed
break if $scene != self
end
# Prepare for transition
Graphics.freeze
# Dispose Scene Objects
@scene_objects.each { |x| x.dispose }
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# If Skill List Window Active
if @skill_list_window.active
update_skill_select
return
# If Confirmation Window Active
elsif @confirmation_window.active
update_confirmation
return
end
end
#--------------------------------------------------------------------------
# * Frame Update : Skill Select
#--------------------------------------------------------------------------
def update_skill_select
# If Up or Down Is Pressed
if Input.repeat?(Input::UP) || Input.repeat?(Input::DOWN)
# Refresh Windows
@skill_cost_window.refresh(@skill_list_window.skill_id)
@skill_data_window.refresh(@skill_list_window.skill_id)
end
# If B Button Is Pressed
if Input.trigger?(Input::
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Map.new
return
end
# If C Button Is Pressed
if Input.trigger?(Input::C)
# Can learn Check
unless @actor.can_learn_shop_skill?(@skill_list_window.skill_id)
# Play Buzzer SE
$game_system.se_play($data_system.buzzer_se)
# Set Help Text
@help_window.set_text('Non pu
skills shop
#==============================================================================
# ** Skill Shop
#------------------------------------------------------------------------------
# SephirothSpawn
# 2006-04-06
# Version 1
#------------------------------------------------------------------------------
# * Instrucions :
#
# ~ Gaining Skill Points
# - $game_party.actors[actor_index].skill_shop_points +-*/= x
# OR
# - $game_actors[actor_id].skill_shop_points +-*/= x
#
# ~ Setting Up Aviable Skills
# - $game_temp.skill_shop_skills[actor_id] = [skill_id, ... ]
# OR
# - $game_temp.skill_shop_skills[actor_id] = nil
# - $game_temp.skill_shop_skills[0] = [skill_id, ...]
# (0 is used as the default. Any actor ID not defined will use this list for the skills)
#
# ~ Calling Skill Shop
# - $scene = Scene_SkillShop.new(actor_index)
#
# ~ Switching Actor In Skill Shop
# - Press L or R
#------------------------------------------------------------------------------
# * Customization :
#
# ~ Purchasing Types (Must Use 1, can Use 2)
# - Spend_Gold = true (On) or false (Off)
# - Spend_Skill_Points = true (On) or false (Off)
#
# ~ Skill Cost
# - Gold Cost
# Skill_Gold_Cost = { skill_id => cost, ... }
# - Skill Point Cost
# Skill_Point_Cost = { skill_id => cost, ... }
#
# ~ Actor Requirements
# - Actor_Requirements = { skill_id => [actor_id, ...], ... }
#
# ~ Level Requirements
# - Level_Requirements = { skill_id => req_level, ... }
#
# ~ Previous Skill Requirements
# - Previous_Skill_Requirments = { skill_id => [req_skill, ...], ... }
#==============================================================================
#==============================================================================
# ** Skill_Shop
#==============================================================================
module Skill_Shop
#--------------------------------------------------------------------------
# * Purchasing Types
#--------------------------------------------------------------------------
Spend_Gold = true
Spend_Skill_Points = true
#--------------------------------------------------------------------------
# * Skill Cost
# ~ Skill_Gold_Cost = { skill_id => cost, ... }
# ~ Skill_Point_Cost = { skill_id => cost, ... }
#--------------------------------------------------------------------------
Default_Skill_Gold_Cost = 500
Skill_Gold_Cost = {}
Default_SP_Cost = 500
Skill_Point_Cost = {}
#--------------------------------------------------------------------------
# * Actor Requirements
# ~ Actor_Requirements = { skill_id => [actor_id, ...], ... }
#--------------------------------------------------------------------------
Actor_Requirements = {
57 => [1], 58 => [1], 59 => [1], 60 => [1],
61 => [2], 62 => [2], 63 => [2], 64 => [2],
65 => [3], 66 => [3], 67 => [3], 68 => [3],
69 => [4], 70 => [4], 71 => [4], 72 => [4],
73 => [5], 74 => [5], 75 => [5], 76 => [5],
77 => [6], 78 => [6], 79 => [6], 80 => [6],
}
#--------------------------------------------------------------------------
# * Level Requirements
# ~ Level_Requirements = { skill_id => req_level, ... }
#--------------------------------------------------------------------------
Level_Requirements = {}
#--------------------------------------------------------------------------
# * Previous Skill Requirements
# ~ Previous_Skill_Requirments = { skill_id => [req_skill, ...], ... }
#--------------------------------------------------------------------------
Previous_Skill_Requirments = {
2 => [1], 3 => [1, 2],
5 => [4],
8 => [7], 9 => [7, 8],
11 => [10], 12 => [10, 11],
14 => [13], 15 => [13, 14],
17 => [16], 18 => [16, 17],
20 => [19], 21 => [19, 20],
23 => [22], 24 => [22, 23],
26 => [25], 27 => [25, 26],
29 => [28], 30 => [28, 29], 32 => [31],
58 => [57], 59 => [57, 58], 60 => [57, 58, 59],
62 => [61], 63 => [61, 62], 64 => [61, 62, 63],
66 => [65], 67 => [65, 66], 68 => [65, 66, 67],
70 => [69], 71 => [69, 70], 72 => [69, 70, 71],
74 => [73], 75 => [73, 74], 76 => [73, 74, 75],
78 => [77], 79 => [77, 78], 80 => [77, 78, 79]
}
end
#==============================================================================
# ** Game_Temp
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :skill_shop_skills
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_skillshop_gtemp_init initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Original Initialization
seph_skillshop_gtemp_init
# Sets Skills Shop Skills List
@skill_shop_skills = {0 => (1...$data_skills.size).to_a}
end
end
#==============================================================================
# ** Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :skill_shop_points
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_skillshop_gactor_setup setup
alias seph_skillshop_gactor_skills skills
#--------------------------------------------------------------------------
# * Setup
#--------------------------------------------------------------------------
def setup(actor_id)
# Sets Up Skill Shop Skills Array
@skill_shop_skills = []
# Sets Up Skill Points
@skill_shop_points = 0
# Original Setup Method
seph_skillshop_gactor_setup(actor_id)
end
#--------------------------------------------------------------------------
# * Skills
#--------------------------------------------------------------------------
def skills
# Gets Original Skills
s = seph_skillshop_gactor_skills.dup
# Adds Skill Shop Skills
s << @skill_shop_skills
# Returns Skills
return s.flatten.uniq.sort.dup
end
#--------------------------------------------------------------------------
# * Learn Shop Skill
#--------------------------------------------------------------------------
def learn_shop_skill(skill_id)
# Unless Skill Already Learned
unless @skill_shop_skills.include?(skill_id)
# Learn Shop Skill
@skill_shop_skills << skill_id
end
end
#--------------------------------------------------------------------------
# * Can Learn Shop Skill Check
#--------------------------------------------------------------------------
def can_learn_shop_skill?(skill_id)
# If Skill Learned
if self.skills.include?(skill_id)
return false
end
# If Gold Cost
if Skill_Shop::Spend_Gold
if Skill_Shop::Skill_Gold_Cost.has_key?(skill_id)
if $game_party.gold < Skill_Shop::Skill_Gold_Cost[skill_id]
return false
end
else
if $game_party.gold < Skill_Shop::Default_Skill_Gold_Cost
return false
end
end
end
# If Skill Point Cost
if Skill_Shop::Spend_Skill_Points
if Skill_Shop::Skill_Point_Cost.has_key?(skill_id)
if @skill_shop_points < Sklll_Shop::Skill_Point_Cost[skill_id]
p 'Not Enough SP'
return false
end
else
if @skill_shop_points < Skill_Shop::Default_SP_Cost
return false
end
end
end
# Actor Requirement
if Skill_Shop::Actor_Requirements.has_key?(skill_id)
unless Skill_Shop::Actor_Requirements[skill_id].include?(@actor_id)
return false
end
end
# Level Requirement
if Skill_Shop::Level_Requirements.has_key?(skill_id)
if @level < Skill_Shop::Level_Requirements[skill_id]
return false
end
end
# Previous Skill Requirement
if Skill_Shop::Previous_Skill_Requirments.has_key?(skill_id)
for s_id in Skill_Shop::Previous_Skill_Requirments[skill_id]
unless self.skills.include?(s_id)
return false
end
end
end
return true
end
end
#==============================================================================
# ** Window_SkillShop_SkillList
#==============================================================================
class Window_SkillShop_SkillList < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor_id)
super(0, 64, 224, 320)
@actor = $game_party.actors[actor_id]
create_skills_list
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Create Skills List
#--------------------------------------------------------------------------
def create_skills_list
# Check for Personalize Skills List
if $game_temp.skill_shop_skills.has_key?(@actor.id)
unless $game_temp.skill_shop_skills[@actor.id].nil?
@skills = $game_temp.skill_shop_skills[@actor.id]
end
end
# Default Skill List
if @skills.nil?
@skills = $game_temp.skill_shop_skills[0]
end
# Sets Item Max
@item_max = @skills.size
if @item_max > 0
self.contents = Bitmap.new(192, @item_max * 32)
end
end
#--------------------------------------------------------------------------
# * Return Skill Id
#--------------------------------------------------------------------------
def skill_id
return @skills[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
# Sets Skill
skill = $data_skills[@skills[index]]
# Can Learn Flag
can_learn = @actor.can_learn_shop_skill?(skill.id)
# Skill Icon
bitmap = RPG::Cache.icon(skill.icon_name)
# Draws Skill Icon
self.contents.blt(4, index * 32 + 4, bitmap, Rect.new(0, 0, 24, 24), can_learn ? 255 : 160)
# Font Color
self.contents.font.color = can_learn ? normal_color : disabled_color
# Draws Skill Name
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.draw_text(32, index * 32, 160, 32, skill.name)
end
end
#==============================================================================
# ** Window_SkillShop_Cost
#==============================================================================
class Window_SkillShop_Cost < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor_id, skill_id)
super(0, 384, 224, 96)
self.contents = Bitmap.new(192, 64)
@actor = $game_party.actors[actor_id]
refresh(skill_id)
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(skill_id)
self.contents.clear
# Gold & SP Cost
if Skill_Shop::Spend_Gold && Skill_Shop::Spend_Skill_Points
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 192, 32, "#{$data_system.words.gold} Cost:")
self.contents.draw_text(4, 32, 192, 32, 'Skill Point Cost:')
gold = $game_party.gold - (Skill_Shop::Skill_Gold_Cost.has_key?(skill_id) ?
Skill_Shop::Skill_Gold_Cost[skill_id] : Skill_Shop::Default_Skill_Gold_Cost)
self.contents.font.color = gold >= 0 ? text_color(1) : text_color(2)
self.contents.draw_text(- 4, 0, 192, 32, gold.to_s, 2)
sp = @actor.skill_shop_points - (Skill_Shop::Skill_Point_Cost.has_key?(skill_id) ?
Skill_Shop::Skill_Point_Cost[skill_id] : Skill_Shop::Default_SP_Cost)
self.contents.font.color = sp >= 0 ? text_color(1) : text_color(2)
self.contents.draw_text(- 4, 32, 192, 32, sp.to_s, 2)
# Only Gold Cost
elsif Skill_Shop::Spend_Gold
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 192, 32, "#{$data_system.words.gold} Cost:")
gold = $game_party.gold - (Skill_Shop::Skill_Gold_Cost.has_key?(skill_id) ?
Skill_Shop::Skill_Gold_Cost[skill_id] : Skill_Shop::Default_Skill_Gold_Cost)
self.contents.font.color = gold >= 0 ? text_color(1) : text_color(2)
self.contents.draw_text(- 4, 32, 192, 32, gold.to_s, 2)
elsif Skill_Shop::Spend_Skill_Points
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 192, 32, 'Skill Point Cost')
self.contents.font.color = normal_color
sp = @actor.skill_shop_points - Skill_Shop::Skill_Point_Cost.has_key?(skill_id) ?
Skill_Shop::Skill_Point_Cost[skill_id] : Skill_Shop::Default_SP_Cost
self.contents.font.color = sp >= 0 ? text_color(1) : text_color(2)
self.contents.draw_text(- 4, 32, 192, 32, sp.to_s, 2)
end
end
end
#==============================================================================
# ** Window_SkillShop_SkillData
#==============================================================================
class Window_SkillShop_SkillData < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor_index, skill_id)
super(224, 64, 416, 416)
self.contents = Bitmap.new(384, 384)
@actor = $game_party.actors[actor_index]
refresh(skill_id)
end
#--------------------------------------------------------------------------
# * Disabled System Color
#--------------------------------------------------------------------------
def disabled_system_color
color = system_color
color.alpha = disabled_color.alpha
return color
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(skill_id)
self.contents.clear
# Gets Skills
skill = $data_skills[skill_id]
# Can Learn Flag
can_learn = @actor.can_learn_shop_skill?(skill.id)
# Gets Icon
bitmap = RPG::Cache.icon(skill.icon_name)
# Draws Skill Icon
self.contents.blt(4, 4, bitmap, Rect.new(0, 0, 24, 24), can_learn ? 255 : 160)
# Draws Skill Name
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = can_learn ? normal_color : disabled_color
self.contents.draw_text(32, 0, 352, 32, skill.name)
# Draws SP Cost
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = can_learn ? system_color : disabled_system_color
self.contents.draw_text(272, 0, 112, 32, "#{$data_system.words.sp} :")
self.contents.font.color = can_learn ? normal_color : disabled_color
self.contents.draw_text(- 4, 0, 384, 32, skill.sp_cost.to_s, 2)
# Draws Descritpion
self.contents.font.color = can_learn ? system_color : disabled_system_color
self.contents.draw_text(4, 32, 60, 32, 'Desc. :')
self.contents.font.color = can_learn ? normal_color : disabled_color
self.contents.draw_text(64, 32, 320, 32, skill.description)
# Draws Scope
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
case skill.scope
when 0 ; scope = 'None'
when 1 ; scope = 'One Enemy'
when 2 ; scope = 'All Enemies'
when 3 ; scope = 'One Ally'
when 4 ; scope = 'All Allies'
when 5 ; scope = "KO'd Ally"
when 6 ; scope = "All KO'd Allies"
when 7 ; scope = 'User'
end
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = can_learn ? system_color : disabled_system_color
self.contents.draw_text(4, 64, 186, 32, 'Scope :')
self.contents.font.color = can_learn ? normal_color : disabled_color
self.contents.draw_text(- 4, 64, 190, 32, scope, 2)
# Draws Occassion
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
case skill.occasion
when 0 ; occ = 'Sempre'
when 1 ; occ = 'In battaglia'
when 2 ; occ = 'Nel Menu'
when 3 ; occ = 'Mai'
end
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = can_learn ? system_color : disabled_system_color
self.contents.draw_text(194, 64, 186, 32, 'Occassion :')
self.contents.font.color = can_learn ? normal_color : disabled_color
self.contents.draw_text(190, 64, 190, 32, occ, 2)
# Draws Skill Power & Hit Probability
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = can_learn ? system_color : disabled_system_color
self.contents.draw_text(4, 96, 186, 32, 'Potenza :')
self.contents.draw_text(194, 96, 186, 32, 'Attacco %')
self.contents.font.color = can_learn ? normal_color : disabled_color
self.contents.draw_text(- 4, 96, 190, 32, skill.power.to_s, 2)
self.contents.draw_text(190, 96, 190, 32, skill.hit.to_s, 2)
# Cash Cost
if Skill_Shop::Spend_Gold
cost = Skill_Shop::Skill_Gold_Cost.has_key?(skill_id) ?
Skill_Shop::Skill_Gold_Cost[skill_id] : Skill_Shop::Default_Skill_Gold_Cost
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = can_learn ? system_color : disabled_system_color
self.contents.draw_text(4, 128, 186, 32, "#{$data_system.words.gold} Cost:")
self.contents.font.color = can_learn ? normal_color : disabled_color
self.contents.draw_text(- 4, 128, 190, 32, cost.to_s, 2)
end
# Skill Points Cost
if Skill_Shop::Spend_Skill_Points
cost = Skill_Shop::Skill_Point_Cost.has_key?(skill_id) ?
Skill_Shop::Skill_Point_Cost[skill_id] : Skill_Shop::Default_SP_Cost
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = can_learn ? system_color : disabled_system_color
self.contents.draw_text(194, 128, 186, 32, "Costo Mp:")
self.contents.font.color = can_learn ? normal_color : disabled_color
self.contents.draw_text(190, 128, 190, 32, cost.to_s, 2)
end
# Draws Level Requried
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = can_learn ? system_color : disabled_system_color
self.contents.draw_text(95, 160, 190, 32, 'Livello richiesto :')
req_lvl = Skill_Shop::Level_Requirements.has_key?(skill_id) ?
Skill_Shop::Level_Requirements[skill_id].to_s : 'Niente'
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = can_learn ? normal_color : disabled_color
self.contents.draw_text(95, 160, 190, 32, req_lvl, 2)
# Actor Requirment
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = can_learn ? system_color : disabled_system_color
self.contents.draw_text(0, 192, 384, 32, 'Actor allowed skills', 1)
self.contents.font.color = can_learn ? normal_color : disabled_color
if Skill_Shop::Actor_Requirements.has_key?(skill_id)
actors = Skill_Shop::Actor_Requirements[skill_id].dup
actors.collect! { |x| $data_actors[x].name}
actors = actors.join(' - ')
else
actors = 'Tutti gli alleti'
end
self.contents.draw_text(0, 224, 384, 32, actors, 1)
# Draws Previous Skill Requirements
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 24
self.contents.font.color = can_learn ? system_color : disabled_system_color
self.contents.draw_text(0, 256, 384, 32, 'Magie richieste', 1)
self.contents.font.color = can_learn ? normal_color : disabled_color
if Skill_Shop::Previous_Skill_Requirments.has_key?(skill_id)
skills = Skill_Shop::Previous_Skill_Requirments[skill_id].dup
skills.collect! {|x| $data_skills[x]}
for i in 0...skills.size
skill = skills[i]
x = 4 + i % 2 * 190
y = i / 2 * 32 + 288
bitmap = RPG::Cache.icon(skill.icon_name)
self.contents.blt(x + 4, y + 4, bitmap, Rect.new(0, 0, 24, 24), can_learn ? 255 : 160)
self.contents.draw_text(x + 32, y, 154, 32, skill.name)
end
else
self.contents.draw_text(0, 288, 384, 32, 'Niente magie', 1)
end
end
end
#==============================================================================
# ** Scene_SkillShop
#==============================================================================
class Scene_SkillShop
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor_index = 0)
@actor_index = actor_index
@actor = $game_party.actors[actor_index]
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Creates Help Window
@help_window = Window_Help.new
@help_window.set_text("Benvenuto nel negozio di magia! #{@actor.name} ~ Scegli magia da imparare", 1)
# Creates Skill List
@skill_list_window = Window_SkillShop_SkillList.new(@actor_index)
# Creates Skill Shop Cost Window
@skill_cost_window = Window_SkillShop_Cost.new(@actor_index, @skill_list_window.skill_id)
# Creates Skill Data Window
@skill_data_window = Window_SkillShop_SkillData.new(@actor_index, @skill_list_window.skill_id)
# Confirmation Window
@confirmation_window = Window_Command.new(128, ['Si', 'No'])
@confirmation_window.x, @confirmation_window.y = 256, 208
@confirmation_window.z = 1000
@confirmation_window.visible = @confirmation_window.active = false
# Scene Objects
@scene_objects = [@help_window, @skill_list_window, @skill_cost_window,
@skill_data_window, @confirmation_window]
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Updates Scene Objects
@scene_objects.each { |x| x.update }
# Frame update
update
# Abort loop if screen is changed
break if $scene != self
end
# Prepare for transition
Graphics.freeze
# Dispose Scene Objects
@scene_objects.each { |x| x.dispose }
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# If Skill List Window Active
if @skill_list_window.active
update_skill_select
return
# If Confirmation Window Active
elsif @confirmation_window.active
update_confirmation
return
end
end
#--------------------------------------------------------------------------
# * Frame Update : Skill Select
#--------------------------------------------------------------------------
def update_skill_select
# If Up or Down Is Pressed
if Input.repeat?(Input::UP) || Input.repeat?(Input::DOWN)
# Refresh Windows
@skill_cost_window.refresh(@skill_list_window.skill_id)
@skill_data_window.refresh(@skill_list_window.skill_id)
end
# If B Button Is Pressed
if Input.trigger?(Input::
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Map.new
return
end
# If C Button Is Pressed
if Input.trigger?(Input::C)
# Can learn Check
unless @actor.can_learn_shop_skill?(@skill_list_window.skill_id)
# Play Buzzer SE
$game_system.se_play($data_system.buzzer_se)
# Set Help Text
@help_window.set_text('Non pu
#22
Inviato 11 settembre 2007 - 06:56
boh,vadiamo che ne pensa vaan..e magari se qualcun altro volesse unirsi,ma ora torniamo a parlare del gioco se no si va OT..quindi,avendo gia un probblema,del tipo che nel 7,le abilit
Messaggio modificato da Rehim McMoon, 11 settembre 2007 - 06:57
--->grazie Morgana
----->grazie Dax
Splendida immagine,splendido gioco!!!
Vincent,mio idolo!!!
----->grazie Dax
Splendida immagine,splendido gioco!!!
Vincent,mio idolo!!!
#33
Inviato 11 settembre 2007 - 07:30
aspettate tutti...io intendevo solo sevensoft,niente warriors...solo seven soft..xo anche the seven warriors non sta male^^...cmq che immi sta facendo caios? x tutti,avete pmXD
EDIT:ho trovato un immi troppo figa per nn farla vedere al mondo...sto sbavandoXD
EDIT:ho trovato un immi troppo figa per nn farla vedere al mondo...sto sbavandoXD
Messaggio modificato da Rehim McMoon, 11 settembre 2007 - 07:35
--->grazie Morgana
----->grazie Dax
Splendida immagine,splendido gioco!!!
Vincent,mio idolo!!!
----->grazie Dax
Splendida immagine,splendido gioco!!!
Vincent,mio idolo!!!
#35
Inviato 11 settembre 2007 - 07:43
allora,per tutti i membri dello staff!
si continua nel forum del team,per non rovinare la sorpresa ai lettori,ok?
se nn conoscete il forum,guardate nei PMXD
per tutti gli altri,se vi interessa il progetto e volete far parte del team,postate qui,e vi informeremo..
infine,useremo questo post per aggiornare man mano..
si continua nel forum del team,per non rovinare la sorpresa ai lettori,ok?
se nn conoscete il forum,guardate nei PMXD
per tutti gli altri,se vi interessa il progetto e volete far parte del team,postate qui,e vi informeremo..
infine,useremo questo post per aggiornare man mano..
--->grazie Morgana
----->grazie Dax
Splendida immagine,splendido gioco!!!
Vincent,mio idolo!!!
----->grazie Dax
Splendida immagine,splendido gioco!!!
Vincent,mio idolo!!!
#36
Inviato 11 settembre 2007 - 07:45
CITAZIONE (Rehim McMoon @ Sep 11 2007, 09:30 PM) <{POST_SNAPBACK}>
ho trovato un immi troppo figa per nn farla vedere al mondo...sto sbavandoXD
E' bellissima!
0 utente(i) stanno leggendo questa discussione
0 utenti, 0 visitatori, 0 utenti anonimi