PHP код:
module Skill_Level
#--------------------------------------------------------------------
# Skill_Default_Beginning_Level
#--------------------------------------------------------------------
Beginning_Default = 0
#--------------------------------------------------------------------
# Skill default max level
#--------------------------------------------------------------------
Max_Default = 20
#--------------------------------------------------------------------
# Actor Level Requirements
# skill_id => actor.level
#--------------------------------------------------------------------
Level_Req = {
2 => 2
}
#--------------------------------------------------------------------
# Skill Level Requirements
# skill_id => [required skill_id, required skill_level, skill name of required skill]
#--------------------------------------------------------------------
Skill_Req = {
57 => [1, 2, "Heal"]
}
Skill_Req = {
6 => [4, 4, "Heal"]
}
#--------------------------------------------------------------------
# Skill Infliction Status Additions
# skill_id => [skill_level, plus_state_set id]
#--------------------------------------------------------------------
Skill_Add = {
57 => [2, 3]
}
#--------------------------------------------------------------------
# Skill Cure Status Removals
# skill_id => [skill_level, minus_state_set id]
#--------------------------------------------------------------------
Skill_Minus = {
1 => [2, 2]
}
#--------------------------------------------------------------------
# Skill Element Addition
# skill_id => [skill_level, element_set]
#--------------------------------------------------------------------
Skill_Element = {
1 => [2, 4]
}
#--------------------------------------------------------------------
# Increase % per level
#--------------------------------------------------------------------
INCREASE_PER_LEVEL = 25
#--------------------------------------------------------------------
# Base_MaxHP skills
# skill_id => % hp added
#--------------------------------------------------------------------
Base_hp = {
81 => 5,
82 => 7
}
#--------------------------------------------------------------------
# Base_MaxSP skills
# skill_id => % sp added
#--------------------------------------------------------------------
Base_sp = {
81 => 5
}
#--------------------------------------------------------------------
# Base_Str skills
# skill_id => % str added
#--------------------------------------------------------------------
Base_str = {
81 => 5
}
#--------------------------------------------------------------------
# Base_Dex skills
# skill_id => % dex added
#--------------------------------------------------------------------
Base_dex = {
81 => 5
}
#--------------------------------------------------------------------
# Base_Int skills
# skill_id => % int added
#--------------------------------------------------------------------
Base_int = {
81 => 5
}
#--------------------------------------------------------------------
# Base_Agi skills
# skill_id => % agi added
#--------------------------------------------------------------------
Base_agi = {
81 => 5
}
#--------------------------------------------------------------------
# Weapon proficiency crossover switch
#--------------------------------------------------------------------
Weapon_Cross = true
#--------------------------------------------------------------------
# Weapon Proficiencies
# set only if you use the weapon proficiency crossover.
#--------------------------------------------------------------------
Weapon_Skills = [82, 83, 84, 85, 86, 87, 88, 89, 90]
end
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
# Steal Module
#//////////////////////////////////////////////////////////////////////
module Steal_Script
#--------------------------------------------------------------------
# Common_Item
# enemy.id => [item_id, item identifier, # to add]
# 0 = item, 1 = weapon, 2 = armor
#--------------------------------------------------------------------
Common_Item = {
1 => [3, 1, 2]
}
#--------------------------------------------------------------------
# Rare_Item
# enemy.id => [item_id, item identifier, # to add]
# 0 = item, 1 = weapon, 2 = armor
#--------------------------------------------------------------------
Rare_Item = {
1 => [3, 0, 2]
}
Failed_Message = "Couldn't Steal"
Nothing_To_Steal = "Nothing to Steal"
Steal_ID = 20
Gold_ID = 21
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Game_Battler
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Game_Battler
#--------------------------------------------------------------------
# Set's Percentage Increase
# Set each INCREASE_PER_LEVEL in the script to the same number
#--------------------------------------------------------------------
INCREASE_PER_LEVEL = 25
#--------------------------------------------------------------------
# Alias Listings
#--------------------------------------------------------------------
alias leon_gb_skilleffect skill_effect
#--------------------------------------------------------------------
# Skill Effect
#--------------------------------------------------------------------
def skill_effect(user, skill)
ss = Steal_Script
reqs = Skill_Level
self.critical = false
if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
return false
end
effective = false
effective |= skill.common_event_id > 0
hit = skill.hit
if skill.atk_f > 0
hit *= user.hit / 100
end
hit_result = (rand(100) < hit)
effective |= hit < 100
if hit_result == true
if skill.element_set.include?(ss::Steal_ID)
if self.is_a?(Game_Enemy)
steal = (rand(100) + user.skill_level[skill.id] * reqs::INCREASE_PER_LEVEL)
if ss::Rare_Item.keys.include?(self.id)
if steal > 90
if ss::Rare_Item[self.id][1] == 0
$game_party.gain_item(ss::Rare_Item[self.id][0], ss::Rare_Item[self.id][2])
self.damage = "Stole #{ss::Rare_Item[self.id][2].to_i} #{$data_items[ss::Rare_Item[self.id][0]].name}"
return
elsif ss::Rare_Item[self.id][1] == 1
$game_party.gain_weapon(ss::Rare_Item[self.id][0], ss::Rare_Item[self.id][2])
self.damage = "Stole #{ss::Rare_Item[self.id][2].to_i} #{$data_weapons[ss::Rare_Item[self.id][0]].name}"
return
elsif ss::Rare_Item[self.id][1] == 2
$game_party.gain_armor(ss::Rare_Item[self.id][0], ss::Rare_Item[self.id][2])
self.damage = "Stole #{ss::Rare_Item[self.id][2].to_i} #{$data_armors[ss::Rare_Item[self.id][0]].name}"
return
end
end
end
if ss::Common_Item.keys.include?(self.id)
if ss::Rare_Item.keys.include?(self.id)
if steal > 50
if steal < 90
if ss::Common_Item[self.id][1] == 0
$game_party.gain_item(ss::Common_Item[self.id][0], ss::Common_Item[self.id][2])
self.damage = "Stole #{ss::Common_Item[self.id][2].to_i} #{$data_items[ss::Common_Item[self.id][0]].name}"
return
elsif ss::Common_Item[self.id][1] == 1
$game_party.gain_weapon(ss::Common_Item[self.id][0], ss::Common_Item[self.id][2])
self.damage = "Stole #{ss::Common_Item[self.id][2].to_i} #{$data_weapons[ss::Common_Item[self.id][0]].name}"
return
elsif ss::Common_Item[self.id][1] == 2
$game_party.gain_armor(ss::Common_Item[self.id][0], ss::Common_Item[self.id][2])
self.damage = "Stole #{ss::Common_Item[self.id][2].to_i} #{$data_armors[ss::Common_Item[self.id][0]].name}"
return
end
end
else
self.damage = "#{ss::Failed_Message}"
return
end
else
if steal > 50
if ss::Common_Item[self.id][1] == 0
$game_party.gain_item(ss::Common_Item[self.id][0], ss::Common_Item[self.id][2])
self.damage = "Stole #{ss::Common_Item[self.id][2].to_i} #{$data_items[ss::Common_Item[self.id][0]].name}"
return
elsif ss::Common_Item[self.id][1] == 1
$game_party.gain_weapon(ss::Common_Item[self.id][0], ss::Common_Item[self.id][2])
self.damage = "Stole #{ss::Common_Item[self.id][2].to_i} #{$data_weapons[ss::Common_Item[self.id][0]].name}"
return
elsif ss::Common_Item[self.id][1] == 2
$game_party.gain_armor(ss::Common_Item[self.id][0], ss::Common_Item[self.id][2])
self.damage = "Stole #{ss::Common_Item[self.id][2].to_i} #{$data_armors[ss::Common_Item[self.id][0]].name}"
return
end
end
end
else
self.damage = "#{ss::Nothing_To_Steal}"
return
end
end
end
if skill.element_set.include?(ss::Gold_ID)
if self.is_a?(Game_Enemy)
gold_steal = (rand(100))
if gold_steal > 45
gold_total = 0
gold = self.gold
gold1 = gold
gold_var = (rand(gold1 / 2) * user.skill_level[skill.id])
gold_pm = (rand(3))
if gold_pm > 1
gold_total = gold + gold_var
$game_party.gain_gold(gold_total)
self.damage = "Stole #{gold_total} #{$data_system.words.gold}"
return
else
gold_total = gold - gold_var
if gold_total < 0
gold_total = 0
end
$game_party.gain_gold(gold_total)
self.damage = "Stole #{gold_total} #{$data_system.words.gold}"
return
end
else
self.damage = "#{ss::Failed_Message}"
return
end
end
end
if user.is_a?(Game_Actor)
power = (skill.power + (reqs::INCREASE_PER_LEVEL * user.skill_level[skill.id] * 0.01 * skill.power)) + user.atk * skill.atk_f / 100
else
power = skill.power + user.atk * skill.atk_f / 100
end
power = power.round
if power > 0
power -= self.pdef * skill.pdef_f / 200
power -= self.mdef * skill.mdef_f / 200
power = [power, 0].max
end
rate = 20
rate += (user.str * skill.str_f / 100)
rate += (user.dex * skill.dex_f / 100)
rate += (user.agi * skill.agi_f / 100)
rate += (user.int * skill.int_f / 100)
self.damage = power * rate / 20
self.damage *= elements_correct(skill.element_set)
self.damage /= 100
if self.damage > 0
if self.guarding?
self.damage /= 2
end
end
if skill.variance > 0 and self.damage.abs > 0
amp = [self.damage.abs * skill.variance / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
eva = 8 * self.agi / user.dex + self.eva
hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
hit = self.cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)
effective |= hit < 100
end
if hit_result == true
if skill.power != 0 and skill.atk_f > 0
remove_states_shock
effective = true
end
last_hp = self.hp
self.hp -= self.damage
effective |= self.hp != last_hp
@state_changed = false
effective |= states_plus(skill.plus_state_set)
effective |= states_minus(skill.minus_state_set)
if skill.power == 0
self.damage = ""
unless @state_changed
self.damage = "Промах"
end
end
else
self.damage = "Промах"
end
unless $game_temp.in_battle
self.damage = nil
end
return effective
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Game_Actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Game_Actor < Game_Battler
#--------------------------------------------------------------------
# Constant Variables
# Leon_Edit
# Set SKILL_POINTS equal to the number of skill points per level.
# Set SKILL_POINTS equal to 0 if none are to be earned.
#--------------------------------------------------------------------
SKILL_POINTS = 2
#--------------------------------------------------------------------
# Attribute Listings
#--------------------------------------------------------------------
attr_accessor :skill_level
attr_accessor :skill_max
attr_accessor :skill_points
#--------------------------------------------------------------------
# Alias Listings
#--------------------------------------------------------------------
alias leon_ga_skill_level_setup setup
alias leon_ga_skill_level_skill_learn? skill_learn?
alias leon_ga_skill_level_exp exp
alias leon_ga_skill_level_basehp base_maxhp
alias leon_ga_skill_level_basesp base_maxsp
alias leon_ga_skill_level_basestr base_str
alias leon_ga_skill_level_basedex base_dex
alias leon_ga_skill_level_baseagi base_agi
alias leon_ga_skill_level_baseint base_int
#--------------------------------------------------------------------
# Setup
#--------------------------------------------------------------------
def setup(actor_id)
#--------------------------------------------------------------------
# Leon_Edit
# Put in unique beginning levels here.
# skill_id => starting_level
#--------------------------------------------------------------------
@skill_level = {
1 => 2,
57 => 0,
81 => 0
}
#--------------------------------------------------------------------
# Leon_Edit
# Put unique max levels here.
# skill_id => skill_end
#--------------------------------------------------------------------
@skill_max = {
1 => 3,
57 => 7
}
@hp_skills = []
@hp_percent = []
@sp_skills = []
@sp_percent = []
@str_skills = []
@str_percent = []
@dex_skills = []
@dex_percent = []
@int_skills = []
@int_percent = []
@agi_skills = []
@agi_percent = []
@skill_points = 0
@hp_bonus = 0
@sp_bonus = 0
@str_bonus = 0
@dex_bonus = 0
@int_bonus = 0
@agi_bonus = 0
leon_ga_skill_level_setup(actor_id)
end
def bonus(skill_id)
# HP calculations
reqs = Skill_Level
@hp_bonus = 0
if reqs::Base_hp.keys.include?(skill_id)
unless @hp_skills.include?(skill_id)
@hp_skills.push(skill_id)
@hp_percent.push(reqs::Base_hp[skill_id])
end
end
if @hp_skills.size != nil
for i in 0...@hp_skills.size
@hp_bonus += @hp_percent[i] * skill_level[@hp_skills[i]]
end
end
# SP calculations
@sp_bonus = 0
if reqs::Base_sp.keys.include?(skill_id)
unless @sp_skills.include?(skill_id)
@sp_skills.push(skill_id)
@sp_percent.push(reqs::Base_sp[skill_id])
end
end
if @sp_skills.size != nil
for i in 0...@sp_skills.size
@sp_bonus += @sp_percent[i] * skill_level[@sp_skills[i]]
end
end
# STR calculations
@str_bonus = 0
if reqs::Base_str.keys.include?(skill_id)
unless @str_skills.include?(skill_id)
@str_skills.push(skill_id)
@str_percent.push(reqs::Base_str[skill_id])
end
end
if @str_skills.size != nil
for i in 0...@str_skills.size
@str_bonus += @str_percent[i] * skill_level[@str_skills[i]]
end
end
# DEX calculations
@dex_bonus = 0
if reqs::Base_dex.keys.include?(skill_id)
unless @dex_skills.include?(skill_id)
@dex_skills.push(skill_id)
@dex_percent.push(reqs::Base_dex[skill_id])
end
end
if @dex_skills.size != nil
for i in 0...@dex_skills.size
@dex_bonus += @dex_percent[i] * skill_level[@dex_skills[i]]
end
end
# INT calculations
@int_bonus = 0
if reqs::Base_int.keys.include?(skill_id)
unless @int_skills.include?(skill_id)
@int_skills.push(skill_id)
@int_percent.push(reqs::Base_int[skill_id])
end
end
if @int_skills.size != nil
for i in 0...@int_skills.size
@int_bonus += @int_percent[i] * skill_level[@int_skills[i]]
end
end
# AGI calculations
@agi_bonus = 0
if reqs::Base_agi.keys.include?(skill_id)
unless @agi_skills.include?(skill_id)
@agi_skills.push(skill_id)
@agi_percent.push(reqs::Base_agi[skill_id])
end
end
if @agi_skills.size != nil
for i in 0...@agi_skills.size
@agi_bonus += @agi_percent[i] * skill_level[@agi_skills[i]]
end
end
end
def base_maxhp
n = leon_ga_skill_level_basehp
o = @hp_bonus
if o != nil
p = o * 0.01 * n + n
return p
else
return n
end
end
def base_maxsp
n = leon_ga_skill_level_basesp
o = @sp_bonus
if o != nil
p = o * 0.01 * n + n
return p
else
return n
end
end
def base_str
n = leon_ga_skill_level_basestr
o = @str_bonus
if o != nil
p = o * 0.01 * n + n
return p
else
return n
end
end
def base_dex
n = leon_ga_skill_level_basedex
o = @dex_bonus
if o != nil
p = o * 0.01 * n + n
return p
else
return n
end
end
def base_int
n = leon_ga_skill_level_baseint
o = @int_bonus
if o != nil
p = o * 0.01 * n + n
return p
else
return n
end
end
def base_agi
n = leon_ga_skill_level_baseint
o = @agi_bonus
if o != nil
p = o * 0.01 * n + n
return p
else
return n
end
end
def skill_learn?(skill_id)
reqs = Skill_Level
unless @skill_level.include?(skill_id)
@skill_level[skill_id] = reqs::Beginning_Default
end
unless @skill_max.include?(skill_id)
@skill_max[skill_id] = reqs::Max_Default
end
leon_ga_skill_level_skill_learn?(skill_id)
end
def skill_can_learn?(skill_id)
reqs = Skill_Level
if reqs::Level_Req.has_key?(skill_id)
unless level >= reqs::Level_Req[skill_id]
return false
end
end
if reqs::Skill_Req.has_key?(skill_id)
skill_number = reqs::Skill_Req[skill_id][0]
unless skill_level[skill_number] >= reqs::Skill_Req[skill_id][1]
return false
end
end
return true
end
def skill_can_use?(skill_id)
reqs = Skill_Level
if reqs::Skill_Add.has_key?(skill_id)
if skill_level[skill_id] >= reqs::Skill_Add[skill_id][0]
$data_skills[skill_id].plus_state_set.push(reqs::Skill_Add[skill_id][1])
end
end
if reqs::Skill_Minus.has_key?(skill_id)
if skill_level[skill_id] >= reqs::Skill_Minus[skill_id][0]
$data_skills[skill_id].minus_state_set.push(reqs::Skill_Minus[skill_id][1])
end
end
if reqs::Skill_Element.has_key?(skill_id)
if skill_level[skill_id] >= reqs::Skill_Element[skill_id][0]
unless $data_skills[skill_id].element_set.include?(reqs::Skill_Element[skill_id][1])
$data_skills[skill_id].element_set.push(reqs::Skill_Element[skill_id][1])
end
end
end
return false unless leon_skill_level_levelcheck(skill_id)
return false unless leon_skill_level_skillcheck(skill_id)
if not skill_learn?(skill_id)
return false
end
if skill_level[skill_id] == 0
return false
end
return super
end
def leon_skill_level_levelcheck(skill_id)
reqs = Skill_Level
if reqs::Level_Req.has_key?(skill_id)
unless level >= reqs::Level_Req[skill_id]
return false
end
end
return true
end
def leon_skill_level_skillcheck(skill_id)
reqs = Skill_Level
if reqs::Skill_Req.has_key?(skill_id)
skill_number = reqs::Skill_Req[skill_id][0]
unless skill_level[skill_number] >= reqs::Skill_Req[skill_id][1]
return false
end
end
return true
end
def exp=(exp)
@exp = [[exp, 9999999].min, 0].max
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
@level += 1
@skill_points += SKILL_POINTS
for j in $data_classes[@class_id].learnings
if j.level == @level
learn_skill(j.skill_id)
end
end
end
while @exp < @exp_list[@level]
@level -= 1
end
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Window_Skill
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Window_Skill
#--------------------------------------------------------------------
# Constant Listings
#--------------------------------------------------------------------
PASSIVE_SKILL_ID = 500
#--------------------------------------------------------------------
# Alias Listings
#--------------------------------------------------------------------
alias leon_ws_skill_level_refresh refresh
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills[i]]
if skill != nil
if @actor.skill_level[skill.id] > 0
unless skill.element_set.include?(PASSIVE_SKILL_ID)
@data.push(skill)
end
end
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = 18
for i in 0...@item_max
draw_item(i)
end
end
end
end
#----------------------------------------------------------------------
# Window_Skillinfo Info Window
#----------------------------------------------------------------------
class Window_Skillinfo < Window_Base
def initialize
super(0, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 18
end
def update(help_text)
self.contents.clear
self.contents.draw_text(0, 0, 600, 32, help_text)
end
end
#----------------------------------------------------------------------
# Window_Skillhero Hero Window
#----------------------------------------------------------------------
class Window_Skillhero < Window_Base
def initialize(actor)
super(0, 64, 180, 128)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 18
@actor = actor
refresh
end
def refresh
self.contents.clear
draw_actor_name(@actor, 50, 0)
draw_actor_class(@actor, 50, 32)
self.contents.draw_text(100, 64, 40, 32, @actor.skill_points.to_s)
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 45, 32, "Имя:")
self.contents.draw_text(0, 32, 45, 32, "Класс:")
self.contents.draw_text(0, 64, 95, 32, "Очки умения:")
end
end
#----------------------------------------------------------------------
# Window_Skilllist List Window
#----------------------------------------------------------------------
class Window_Skilllist < Window_Selectable
#--------------------------------------------------------------------
# Set Passive Skill ID here.
#--------------------------------------------------------------------
PASSIVE_SKILL_ID = 500
def initialize(actor)
super(180, 64, 460, 416)
@column_max = 2
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 18
@actor = actor
self.active = false
self.index = -1
end
def skill
if @data !=nil
return @data[@index]
end
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills[i]]
if skill != nil
unless skill.element_set.include?(PASSIVE_SKILL_ID)
@data.push(skill)
end
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 18
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
skill = @data[index]
if @actor.skill_can_learn?(skill.id) == true
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
unless skill.element_set.include?(PASSIVE_SKILL_ID)
x = 4 + index % 2 * (195 + 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, 134, 32, skill.name, 0)
if @actor.skill_level[skill.id] == @actor.skill_max[skill.id]
self.contents.font.color = Color.new(40, 250, 40, 255)
self.contents.draw_text(x +155, y, 100, 32, "Max")
else
self.contents.font.color = Color.new(250, 250, 13, 255)
self.contents.draw_text(x + 159, y, 100, 32,
(@actor.skill_level[skill.id].to_s) + "/" + (@actor.skill_max[skill.id].to_s))
end
end
end
def refresh1
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills[i]]
if skill != nil
if skill.element_set.include?(PASSIVE_SKILL_ID)
@data.push(skill)
end
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 18
for i in 0...@item_max
draw_item1(i)
end
end
end
def draw_item1(index)
skill = @data[index]
if @actor.skill_can_learn?(skill.id) == true
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
if skill.element_set.include?(PASSIVE_SKILL_ID)
x = 4 + index % 2 * (195 + 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, 134, 32, skill.name, 0)
if @actor.skill_level[skill.id] == @actor.skill_max[skill.id]
self.contents.font.color = Color.new(40, 250, 40, 255)
self.contents.draw_text(x +155, y, 100, 32, "Максимом")
else
self.contents.font.color = Color.new(250, 250, 13, 255)
self.contents.draw_text(x + 159, y, 100, 32,
(@actor.skill_level[skill.id].to_s) + "/" + (@actor.skill_max[skill.id].to_s))
end
end
end
end
#----------------------------------------------------------------------
# Window_Skilldesc
#----------------------------------------------------------------------
class Window_Skilldesc < Window_Base
#--------------------------------------------------------------------
# Set Passive skill ID to the same as above.
# Set INCREASE_PER_LEVEL the same as the ones above
#--------------------------------------------------------------------
PASSIVE_SKILL_ID = 500
INCREASE_PER_LEVEL = 25
def initialize(actor, skill)
super(45, 40, 550, 400)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 18
@actor = actor
self.visible = false
self.z = 1000
end
def refresh(skill)
self.contents.clear
reqs = Skill_Level
for i in 0...reqs::Weapon_Skills.length
if skill.id == reqs::Weapon_Skills[i]
refresh2(skill)
return
end
end
@actor.skill_can_use?(skill.id)
bitmap = RPG::Cache.icon(skill.icon_name)
self.contents.font.color = system_color
#Draws 'Elements:'
self.contents.draw_text(127, 96, 120, 32, "Стихия:")
#Draws the word for SP
self.contents.draw_text(410, 0, 80, 32, $data_system.words.sp + ":")
#Draws 'Skill Level:'
self.contents.draw_text(160, 0, 180, 32, "Уровень умения:")
#Draws 'Cures:'
self.contents.draw_text(0, 96, 120, 32, "Лечебное:")
#Draws 'Inflicts:'
self.contents.draw_text(0, 228, 120, 32, "Атакующее:")
#Draws 'Next Level's Range:'
self.contents.draw_text(364, 96, 165, 32, "Мощь на следующем уровне:", 1)
#Attack Influence
self.contents.font.size = 18
#Draws 'Increase per Level:'
self.contents.draw_text(127, 304, 150, 32, "Усиление с уровнем:")
#Draws 'Range'
self.contents.draw_text(345, 304, 165, 32, "Мощь:")
#Draws Attack Type
self.contents.draw_text(345, 324, 120, 32, "Тип:")
#Draws 'Attack' influence
self.contents.draw_text(127, 228, 120, 32, "Влияние атаки:")
#Draws 'PDEF' influence
self.contents.draw_text(127, 247, 120, 32, "Влияние ф.защ:")
#Draws 'MDEF' influence
self.contents.draw_text(127, 266, 120, 32, "Влияние М.защ:")
#Draws 'Accuracy'
self.contents.draw_text(127, 285, 120, 32, "Разброс:")
self.contents.font.size = 18
self.contents.font.color = normal_color
#Sets Icon Opacity
opacity = self.contents.font.color == normal_color ? 255 : 128
#Draws Icon
self.contents.blt(0, 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
#Draws Skill Name
self.contents.draw_text(28, 0, 184, 32, skill.name, 0)
#Draws SP cost
self.contents.draw_text(450, 0, 90, 32, skill.sp_cost.to_s)
#Draws Skill Level Number
self.contents.font.color = Color.new(250, 250, 13, 255)
self.contents.draw_text(290, 0, 50, 32,
(@actor.skill_level[skill.id]).to_s + "/" + (@actor.skill_max[skill.id]).to_s)
self.contents.font.color = normal_color
#Draws Skill Description
self.contents.draw_text(4, 48, 330, 32, skill.description)
#Draws Atk Influence
self.contents.font.size = 18
#Draws Skill Type
if skill.atk_f > 0
self.contents.draw_text(399, 324, 80, 32, "Физический")
else
self.contents.draw_text(399, 324, 80, 32, "Магический")
end
self.contents.draw_text(235, 228, 30, 32, skill.atk_f.to_s, 2)
self.contents.draw_text(235, 247, 30, 32, skill.pdef_f.to_s, 2)
self.contents.draw_text(235, 266, 30, 32, skill.mdef_f.to_s, 2)
self.contents.draw_text(235, 285, 30, 32, skill.hit.to_s, 2)
#Draws % increase
self.contents.draw_text(277, 304, 50, 32, "+" + INCREASE_PER_LEVEL.to_s + "%")
#Draws Range
case skill.scope
when 0
self.contents.draw_text(399, 304, 165, 32, "Нету")
when 1
self.contents.draw_text(399, 304, 165, 32, "Один враг")
when 2
self.contents.draw_text(399, 304, 165, 32, "Все враги")
when 3
self.contents.draw_text(399, 304, 165, 32, "Один союзник")
when 4
self.contents.draw_text(399, 304, 165, 32, "Все союзники")
when 5
self.contents.draw_text(399, 304, 165, 32, "Мёртвые союзники")
when 6
self.contents.draw_text(399, 304, 165, 32, "Использующий")
end
self.contents.font.size = 18
#Formulas for Next Level Range #Formula for when skills level up
power1 = (((INCREASE_PER_LEVEL * 0.01 * @actor.skill_level[skill.id])* skill.power) + skill.power)
power2 = (((INCREASE_PER_LEVEL * 0.01 * (@actor.skill_level[skill.id] +1))* skill.power) + skill.power)
#Draws Range
next_level_range = (power2 * (skill.variance * -0.01) + power2).to_s + " - " + (power2 * (skill.variance * 0.01) + power2).to_s
next_level_range2 = ((power2 * (skill.variance * -0.01) + power2) * -1).to_s + " - " + ((power2 * (skill.variance * 0.01) + power2) * -1).to_s
#Draws skill elements.
elements = []
skill.element_set.each do |i|
unless [PASSIVE_SKILL_ID].include?(i)
elements << $data_system.elements[i]
end
end
for i in 0...elements.size
self.contents.font.size = 16
self.contents.draw_text(165 + ((i % 2) * 94), 120 + (i / 2 * 12), 120, 32, elements[i])
end
#Draws negated effects
minus_status_data = []
for i in 1...$data_states.size
if skill.minus_state_set.include?(i)
minus_status_data.push($data_states[i].name)
end
end
for i in 0...minus_status_data.size
self.contents.font.size = 16
self.contents.draw_text(0 + ((i % 2) * 85), 120 + (i / 2 * 12), 120, 32, minus_status_data[i])
end
#Draws added statuses
plus_status_data = []
for i in 1...$data_states.size
if skill.plus_state_set.include?(i)
plus_status_data.push($data_states[i].name)
end
end
for i in 0...plus_status_data.size
self.contents.font.size = 16
self.contents.draw_text(0 + ((i % 2) * 85), 252 + (i / 2 * 12), 120, 32, plus_status_data[i])
end
#If skill is a heal skill...
if skill.power < 0
self.contents.font.size = 18
self.contents.font.color = system_color
self.contents.draw_text(355, 32, 165, 32, "Лечебная мощь:", 1)
self.contents.draw_text(355, 160, 170, 32, "Средняя мощь:")
self.contents.draw_text(355, 228, 165, 32, "Следующий уровень:", 1)
self.contents.font.color = Color.new(64, 245, 128, 255)
#If skill_level is higher than 0...
if @actor.skill_level[skill.id] > 0
#Draw level's Heal Range
self.contents.draw_text(355, 64, 165, 32, (((skill.variance * -0.01) * power1 + power1) * -1).to_s + " - " + (((skill.variance * 0.01) * power1 + power1) * -1).to_s, 1)
else
#Draw level 0's heal range
self.contents.draw_text(355, 64, 165, 32, 0.to_s + " - " + 0.to_s, 1)
end
#If skill_level is higher than 0...
if @actor.skill_level[skill.id] > 0
#Draw's Level's current average power
self.contents.draw_text(355, 192, 165, 32, (power1 * -1).to_s, 1)
else
#Draws Level's Healing Average Power
self.contents.draw_text(355, 192, 165, 32, 0.to_s, 1)
end
#Draws Next level's Healing Average
if @actor.skill_level[skill.id] == @actor.skill_max[skill.id]
self.contents.draw_text(355, 260, 165, 32, "----------", 1)
else
self.contents.draw_text(355, 260, 165, 32, (power2 * -1).to_s, 1)
end
#Draws Next level's range
if @actor.skill_level[skill.id] == @actor.skill_max[skill.id]
self.contents.draw_text(355, 128, 165, 32, "----------", 1)
else
self.contents.draw_text(355, 128, 165, 32, next_level_range2, 1)
end
self.contents.font.color = normal_color
else
self.contents.font.size = 18
self.contents.font.color = system_color
self.contents.draw_text(355, 32, 165, 32, "Мощь:", 1)
self.contents.draw_text(355, 160, 165, 32, "Средняя мощь:", 1)
self.contents.draw_text(355, 228, 165, 32, "Следующий уровень:", 1)
self.contents.font.color = Color.new(210, 37, 2, 255)
#If skill_level is higher than 0...
if @actor.skill_level[skill.id] > 0
#Draw Damage Range
self.contents.draw_text(355, 64, 165, 32, ((skill.variance * -0.01) * power1 + power1).to_s + " - " + ((skill.variance * 0.01) * power1 + power1).to_s, 1)
else
#Draw level 0's range
self.contents.draw_text(355, 64, 165, 32, 0.to_s + " - " + 0.to_s, 1)
end
#If skill_level is higher than 0...
if @actor.skill_level[skill.id] > 0
#Draw Damage Average
self.contents.draw_text(355, 192, 165, 32, power1.to_s, 1)
else
#Draw level 0's Avg
self.contents.draw_text(355, 192, 165, 32, 0.to_s, 1)
end
#Draw's Next Level's Avg.
if @actor.skill_level[skill.id] == @actor.skill_max[skill.id]
self.contents.draw_text(355, 260, 165, 32, "----------", 1)
else
self.contents.draw_text(355, 260, 165, 32, power2.to_s, 1)
end
#Draw's Next Level's Range
if @actor.skill_level[skill.id] == @actor.skill_max[skill.id]
self.contents.draw_text(355, 128, 165, 32, "----------", 1)
else
self.contents.draw_text(355, 128, 165, 32, next_level_range, 1)
end
self.contents.font.color = normal_color
end
end
def refresh2(skill)
self.contents.font.color = system_color
#Draws 'Skill Level:'
self.contents.draw_text(200, 0, 120, 32, "Уровень умения:")
self.contents.draw_text(355, 32, 165, 32, "Процент атаки:", 1)
self.contents.draw_text(355, 96, 165, 32, "На следующем уровне:", 1)
#Draws Attack Type
self.contents.draw_text(335, 324, 120, 32, "Тип:")
#Draws Skill Name
self.contents.draw_text(28, 0, 184, 32, skill.name, 0)
#Draws Skill Level Number
self.contents.font.color = Color.new(250, 250, 13, 255)
self.contents.draw_text(290, 0, 50, 32,
(@actor.skill_level[skill.id]).to_s + "/" + (@actor.skill_max[skill.id]).to_s)
#Draws Skill Description
self.contents.font.color = normal_color
self.contents.draw_text(4, 48, 330, 32, skill.description)
self.contents.draw_text(420, 324, 80, 32, "Опытность")
reqs = Skill_Level
case @actor.skill_level[skill.id]
when 0
self.contents.draw_text(355, 64, 165, 32, ((@actor.rankd * 100).round).to_s + "%", 1)
self.contents.draw_text(355, 128, 165, 32, ((@actor.rankc * 100).round).to_s + "%", 1)
when 1
self.contents.draw_text(355, 64, 165, 32, ((@actor.rankc * 100).round).to_s + "%", 1)
self.contents.draw_text(355, 128, 165, 32, ((@actor.rankb * 100).round).to_s + "%", 1)
when 2
self.contents.draw_text(355, 64, 165, 32, ((@actor.rankb * 100).round).to_s + "%", 1)
self.contents.draw_text(355, 128, 165, 32, ((@actor.ranka * 100).round).to_s + "%", 1)
when 3
self.contents.draw_text(355, 64, 165, 32, ((@actor.ranka * 100).round).to_s + "%", 1)
self.contents.draw_text(355, 128, 165, 32, ((@actor.ranks * 100).round).to_s + "%", 1)
when 4
self.contents.draw_text(355, 64, 165, 32, ((@actor.ranks * 100).round).to_s + "%", 1)
self.contents.draw_text(355, 128, 165, 32, "Нет", 1)
end
#Draws Icon
bitmap = RPG::Cache.icon(skill.icon_name)
self.contents.blt(0, 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
end
end
#===================================
# Window_Confirm
#===================================
class Window_Skillconfirm < Window_Selectable
def initialize
super(256, 192, 128, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 18
self.visible = false
self.z = -1000
self.index = -1
self.active = false
end
def refresh
self.contents.clear
@data = [self.contents.draw_text(0, 0, 96, 32, "Да", 1), self.contents.draw_text(0, 32, 96, 32, "Нет", 1)]
@item_max = @data.size
end
end
#+++++++++++++++++++++++++++++++++++
# Scene_Skilllevel
#+++++++++++++++++++++++++++++++++++
class Scene_Skill_level
def initialize(actor_index = 0, skilltype_index = 0)
@actor_index = actor_index
@skilltype_index = skilltype_index
end
def main
@actor = $game_party.actors[@actor_index]
@skillinfo_window = Window_Skillinfo.new
@skillhero_window = Window_Skillhero.new(@actor)
@skilllist_window = Window_Skilllist.new(@actor)
@skilldesc_window = Window_Skilldesc.new(@actor, @skilllist_window.skill)
@confirm_window = Window_Skillconfirm.new
@skill = @skilllist_window.skill
c1 = "Умения"
c2 = ""
@skilltype_window = Window_Command.new(180, [c1])
@skilltype_window.y = 415
@skilltype_window.index = @skilltype_index
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@skillinfo_window.dispose
@skillhero_window.dispose
@skilllist_window.dispose
@skilltype_window.dispose
@skilldesc_window.dispose
@confirm_window.dispose
end
def update
@skillhero_window.update
@skilltype_window.update
@skilldesc_window.update
if @skilltype_window.active
update_skilltype
return
end
if @skilllist_window.active
update_skilllist
return
end
if @skilldesc_window.visible
update_skilldesc
return
end
if @confirm_window.active
update_confirm
return
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill_level.new
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill_level.new
end
end
def update_skilltype
if @skilltype_window.index == 0
@skillinfo_window.update("Умения.")
@skilllist_window.refresh
if Input.trigger?(Input::C)
@skilltype_window.active = false
@skilllist_window.active = true
@skilllist_window.index = 0
end
else
@skillinfo_window.update("-")
@skilllist_window.refresh1
if Input.trigger?(Input::C)
@skilltype_window.active = false
@skilllist_window.active = true
@skilllist_window.index = 0
end
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill_level.new(@actor_index)
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill_level.new(@actor_index)
end
if Input.trigger?(Input::B)
$scene = Scene_Map.new
end
end
def update_skilllist
@skilllist_window.update
@confirm_window.z = -1000
@skillinfo_window.update("Нажми 'SHIFT', чтобы увидеть подробное описание")
if Input.trigger?(Input::B)
@skilllist_window.index = -1
@skilllist_window.active = false
@skilltype_window.active = true
return
end
if Input.trigger?(Input::A)
if @skilllist_window.skill != nil
@skilldesc_window.refresh(@skilllist_window.skill)
@skilllist_window.active = false
@skilldesc_window.visible = true
else
$game_system.se_play($data_system.buzzer_se)
end
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill_level.new(@actor_index)
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill_level.new(@actor_index)
end
if Input.trigger?(Input::C)
skill = @skilllist_window.skill
if skill != nil
if @actor.skill_can_learn?(skill.id) == true
if @actor.skill_level[@skilllist_window.skill.id] < @actor.skill_max[@skilllist_window.skill.id]
if @actor.skill_points > 0
@confirm_window.refresh
@skilllist_window.active = false
@confirm_window.active = true
@confirm_window.visible = true
@confirm_window.index = 0
else
$game_system.se_play($data_system.buzzer_se)
end
else
$game_system.se_play($data_system.buzzer_se)
end
else
$game_system.se_play($data_system.buzzer_se)
end
end
end
end
def update_skilldesc
if @skilldesc_window.visible == true
@skilllist_window.active = false
if Input.trigger?(Input::B)
@skilldesc_window.visible = false
@skilllist_window.active = true
end
end
end
def update_confirm
@confirm_window.z = 1000
@confirm_window.update
@skillinfo_window.update("Are you sure?")
if Input.trigger?(Input::B)
@confirm_window.active = false
@confirm_window.visible = false
@skilllist_window.active = true
end
if Input.trigger?(Input::C)
if @skilltype_window.index == 0
case @confirm_window.index
when 0
@actor.skill_level[@skilllist_window.skill.id] += 1
@actor.skill_points -= 1
@skillhero_window.refresh
@skilllist_window.refresh
@confirm_window.visible = false
@skilllist_window.active = true
@confirm_window.index = -1
@actor.bonus(@skilllist_window.skill.id)
return
when 1
@confirm_window.visible = false
@skilllist_window.active = true
@confirm_window.index = -1
end
else
case @confirm_window.index
when 0
@actor.skill_level[@skilllist_window.skill.id] += 1
@actor.skill_points -= 1
@skillhero_window.refresh
@skilllist_window.refresh1
@confirm_window.visible = false
@skilllist_window.active = true
@confirm_window.index = -1
@actor.bonus(@skilllist_window.skill.id)
return
when 1
@confirm_window.visible = false
@skilllist_window.active = true
@confirm_window.index = -1
end
end
end
end
end
Пока что много багов и глюков но я его возможно подправлю(создал его не я)
Социальные закладки