Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if true # << Make true to use this script, false to disable.
- #===============================================================================
- #
- # ☆ $D13x - Badges (achievements)
- # -- Author : Dekita
- # -- Version : 1.1
- # -- Level : Easy / Normal
- # -- Requires : $D13x Core v2.7+
- # -- Engine : RPG Maker VX Ace.
- #
- #===============================================================================
- # ☆ Import
- #-------------------------------------------------------------------------------
- $D13x={}if$D13x==nil
- $D13x[:Badges]=true
- #===============================================================================
- # ☆ Updates
- #-------------------------------------------------------------------------------
- # D /M /Y
- # 19/o4/2o14 - Bugfixx, (typo caused error with restricted skills items etc..)
- # 17/o4/2o14 - Finished,
- # 15/o4/2o14 - Started
- #
- #===============================================================================
- # ☆ Introduction
- #-------------------------------------------------------------------------------
- # This script was inspired by Pokemons 'Badges' system. Cause I could, I made
- # a script to recreate it (this script) and when I had done that, I made it a
- # MUCH more powerful feature...
- #
- # Obviously, the standard pokemon badge system is a widely known feature;
- # however, for those that do not know this system - a badge is basically an
- # achievement that is gained throughout the course of gameplay.
- #
- # Badges are not only for showing off, they can also be used to control various
- # aspects of your game... Dramatically...
- #
- # In pokemon, you would not be able to use certain HM's (items) if you did not
- # have [x] badge. Therefore, I have included the ability to restrict item usage
- # when certain badges have not yet been obtained.
- # You can also restrict skills being used and weapons/armor from being equipped.
- # This restriction is automatic and you must gain the badge before it is lifted.
- #
- # Obviously, being able to use an item/skill/weapon or armor after gaining a
- # badge is great, but what if you want a badge to toggle a switch, modify a
- # variable, give gold / items / weapons / armor or maybe even run a custom
- # script call... Well... It can!
- #
- # Another feature within the pokemon badge system, in earlier generations, was
- # that your pokemons stats would increase if you owned [x] badge.
- # This could be done by doing a simple script call to increase each
- # party members stats; maybe something along the lines of
- # "$game_party.members.each {|m| m.add_param(id) }"
- # - Alternatively, you can have stats increase and learn skills for all members.
- # eg. badge 1 gives 50mhp, when badge one has been earned, all party members will
- # always gain 50mhp. Regardless of when they joined the party.
- #
- # Use simple script calls to gain badges and unlock the rewards.
- # But wait, what if you dont want to use script calls to gain badges? Well...
- # You dont have to...
- # Depending on the badge's settings, you can enable it to track a certain
- # object (such as a variable/switch/your own code) and once the 'gain badge'
- # condition has been met the achievment will automatically unlock.
- #
- # Couple this with some of my other scripts - such as Actor Effect Blocks/
- # Gold Tracker/ Items Tracker and you can enable badges to unlock when the player
- # has performed certain actions throught gameplay, such as; winning fights,
- # fleeing battle, dying, leveling, after party has earned / spent [x] amount of
- # gold or even when party has used [x] amount of [x] item.
- #
- # Arent I a clever fucker ^_^
- #
- #===============================================================================
- # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
- #===============================================================================
- # 1. You MUST give credit to "Dekita" !!
- # 2. You are NOT allowed to repost this script.(or modified versions)
- # 3. You are NOT allowed to convert this script.
- # 4. You are NOT allowed to use this script for Commercial games.
- # 5. ENJOY!
- #
- # "FINE PRINT"
- # By using this script you hereby agree to the above terms and conditions,
- # if any violation of the above terms occurs "legal action" may be taken.
- # Not understanding the above terms and conditions does NOT mean that
- # they do not apply to you.
- # If you wish to discuss the terms and conditions in further detail you can
- # contact me at http://dekitarpg.wordpress.com/
- #
- #===============================================================================
- # ☆ Instructions
- #-------------------------------------------------------------------------------
- # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
- #
- #===============================================================================
- # ☆ Script Calls
- #-------------------------------------------------------------------------------
- # SceneManager.call(Scene_Achievement)
- # Use to call the scene.
- #
- #-------------------------------------------------------------------------------
- # $game_player.gain_achii(Badge_ID)
- # Unlocks Badge ID.
- #
- #-------------------------------------------------------------------------------
- # $game_player.achiiz.progress
- # Returns a value equal to the amount of badges player has unlocked.
- #
- #-------------------------------------------------------------------------------
- # $game_player.achiiz.completed
- # Returns true / false depending on whether all badges have been unlocked.
- #
- #-------------------------------------------------------------------------------
- # -- NOTICE --
- # I recommend to only use the following script calls if you REALLY know what
- # you are doing, otherwise you could cause errors.
- #
- #-------------------------------------------------------------------------------
- # $game_player.achiiz.last_gained
- # Returns the last gained badge object.
- #
- #-------------------------------------------------------------------------------
- # $game_player.achiiz.item_restrictions
- # Returns an array containing restricted item id's
- #
- #-------------------------------------------------------------------------------
- # $game_player.achiiz.skill_restrictions
- # Returns an array containing restricted skill id's
- #
- #-------------------------------------------------------------------------------
- # $game_player.achiiz.weapon_restrictions
- # Returns an array containing restricted weapon id's
- #
- #-------------------------------------------------------------------------------
- # $game_player.achiiz.armor_restrictions
- # Returns an array containing restricted armor id's
- #
- #-------------------------------------------------------------------------------
- # $game_player.achiiz.unlock(id)
- # $game_player.achiiz.lock(id)
- # unlocks/lock an achievement accordingly.
- # Safer to use gain_achii script calls outwith of other scripts - ie on the map.
- #
- #===============================================================================
- # ☆ Notetags ( default )
- #-------------------------------------------------------------------------------
- # N/A
- #
- #===============================================================================
- # ☆ HELP
- #-------------------------------------------------------------------------------
- # N/A
- #
- #===============================================================================
- module Achievement ; Badge=[] # << DO NOT DELETE !!
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Basic Vocab
- #-----------------------------------------------------------------------------
- Vocab={
- :comA => 'View Badges',
- :comB => 'Exit Scene',
- :prog => 'Progress:',
- :last => 'Last gained:',
- } # << Vocab
- #-----------------------------------------------------------------------------
- # Show on menu
- #-----------------------------------------------------------------------------
- Menu_Access = true
- #-----------------------------------------------------------------------------
- # (not seen in achievement screen)
- # = ['Name' , icon, hue, Text Color::Color]
- #-----------------------------------------------------------------------------
- Vocanicon = ["Badges", 0, 0, Text_Color::White]
- #-----------------------------------------------------------------------------
- # Sets last gained information. See F1 -> Index -> Time for more information.
- #-----------------------------------------------------------------------------
- def self.gained_on
- hour = Time.now.strftime("%I")
- minu = Time.now.strftime("%M")
- ampm = Time.now.strftime("%p")
- date = Time.now.strftime("%d")
- mont = Time.now.strftime("%B")
- year = Time.now.strftime("%Y")
- return "#{hour}:#{minu}#{ampm} on #{date} #{mont} #{year}"
- end
- #-----------------------------------------------------------------------------
- # Badge[ id ] = { #<- Begins Badge[ id ] Hash
- # :name => "The name of the badge",
- # :icon => icon index,
- # :ihue => icon hue,
- # :text => "Text shown in help window. \n gets a new line",
- # :mods => [ Array of effects triggered when badge unlocks ],
- # # Consult My $D13x Core script for info on effect blocks.
- # :cond => [ Array of conditions before badge can be gained ],
- # :rest => [ Array of restrictions caused when badge is not owned ],
- # } #-< Ends Badge[ id ] Hash
- #-----------------------------------------------------------------------------
- # ★ Possible :mods ;
- # [:common, id],
- # [:switch, id, true], <| Switches are pointless to use as you can
- # [:switch, id, false], <| use script calls to check if a badge has
- # [:switch, id, :alternate], <| been earned or not. But the option is there...
- # [:variable, id, :set, value],
- # [:variable, id, :add, value],
- # [:variable, id, :sub, value],
- # [:variable, id, :div, value],
- # [:variable, id, :mul, value],
- # [:variable, id, :mod, value],
- # [:gold, :gain, value],
- # [:gold, :lose, value],
- # [:item, id, amount, include equip(bool)],
- # [:weapon, id, amount, include equip(bool)],
- # [:armor, id, amount, include equip(bool)],
- # [:script, "code to evaluate"],
- #-----------------------------------------------------------------------------
- # ★ Possible :cond ;
- # [:variable, id, value],
- # [:switch, id],
- # [:script, "code to evaluate"],
- #-----------------------------------------------------------------------------
- # ★ Possible :rest ;
- # [:skill, id],
- # [:items, id],
- # [:weap, id],
- # [:armr, id],
- #-----------------------------------------------------------------------------
- # ★ Possible :stat ;
- # [:param , id, value],
- # [:x_param , id, value],
- # [:s_param , id, value],
- # [:atk_ele , id, value],
- # [:def_ele , id, value],
- # [:spds_stat , id, value]
- # [:atk_lvl , value],
- # [:def_lvl , value],
- # [:max_tp , value],
- # [:skill, id],
- #-----------------------------------------------------------------------------
- Badge[0] = {
- :name => 'Boulder',
- :icon => 864,
- :ihue => 0,
- :text => "Gained from Brock of Pewter City."+
- "\nEffects: Stat[atk] && HM[flash].",
- :mods => [
- [:gold, :gain, 100]
- ],#<< :mods
- :cond => [],
- :rest => [],
- :stat => [
- [:param , 0, 10],
- [:param , 1, 10],
- [:atk_lvl , 1],
- ],# <- :stat
- } # << Badge[0]
- #-----------------------------------------------------------------------------
- Badge[1] = {
- :name => 'Cascade',
- :icon => 865,
- :ihue => 0,
- :text => "Gained from Misty of Cerulean City."+
- "\nEffects: Stat[N/A] && HM[cut].",
- :mods => [
- [:gold, :gain, 100]
- ],#<< :mods
- :cond => [],
- :rest => [],
- :stat => [
- [:param , 2, 10],
- [:param , 3, 10],
- [:def_lvl , 1],
- ],# <- :stat
- } # << Badge[1]
- #-----------------------------------------------------------------------------
- Badge[2] = {
- :name => 'Thunder',
- :icon => 866,
- :ihue => 0,
- :text => "Gained from Lt. Surge of Vermilion City."+
- "\nEffects: Stat[speed] && HM[fly].",
- :mods => [
- [:gold, :gain, 100]
- ],#<< :mods
- :cond => [],
- :rest => [],
- :stat => [],
- } # << Badge[2]
- #-----------------------------------------------------------------------------
- Badge[3] = {
- :name => 'Rainbow',
- :icon => 867,
- :ihue => 0,
- :text => "Gained from Erika of Celadon City."+
- "\nEffects: Stat[N/A] && HM[stength].",
- :mods => [
- [:gold, :gain, 100]
- ],#<< :mods
- :cond => [],
- :rest => [],
- :stat => [],
- } # << Badge[3]
- #-----------------------------------------------------------------------------
- Badge[4] = {
- :name => 'Soul',
- :icon => 868,
- :ihue => 0,
- :text => "Gained from Koga of Fuchsia City."+
- "\nEffects: Stat[def] && HM[surf].",
- :mods => [
- [:gold, :gain, 100]
- ],#<< :mods
- :cond => [],
- :rest => [],
- :stat => [],
- } # << Badge[4]
- #-----------------------------------------------------------------------------
- Badge[5] = {
- :name => 'Marsh',
- :icon => 869,
- :ihue => 0,
- :text => "Gained from Sabrina of Saffron City."+
- "\nEffects: Stat[N/A] && HM[rock smash].",
- :mods => [
- [:gold, :gain, 100]
- ],#<< :mods
- :cond => [],
- :rest => [],
- :stat => [],
- } # << Badge[5]
- #-----------------------------------------------------------------------------
- Badge[6] = {
- :name => 'Volcano',
- :icon => 870,
- :ihue => 0,
- :text => "Gained from Blane of Cinnabar Island."+
- "\nEffects: Stat[sp atk & sp def] && HM[waterfall].",
- :mods => [
- [:gold, :gain, 100]
- ],#<< :mods
- :cond => [],
- :rest => [],
- :stat => [],
- } # << Badge[6]
- #-----------------------------------------------------------------------------
- Badge[7] = {
- :name => 'Earth',
- :icon => 871,
- :ihue => 0,
- :text => "Gained from Giovanni of Viridian City."+
- "\nEffects: Stat[N/A] && HM[rock climb].",
- :mods => [
- [:gold, :gain, 100]
- ],#<< :mods
- :cond => [],
- :rest => [],
- :stat => [],
- } # << Badge[7]
- #-----------------------------------------------------------------------------
- #-----------------------------------------------------------------------------
- # << Add more Badge[ id ] here. Follow the format from above.
- #-----------------------------------------------------------------------------
- #####################
- # CUSTOMISATION END #
- end #####################
- #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
- # #
- # http://dekitarpg.wordpress.com/ #
- # #
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
- #===============================================================================#
- # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
- # YES?\.\. #
- # OMG, REALLY? \| #
- # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
- # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
- #===============================================================================#
- class Achii_BADGE
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- include Achievement
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- attr_accessor :id
- attr_accessor :name
- attr_accessor :icon
- attr_accessor :ihue
- attr_accessor :text
- attr_accessor :mods
- attr_accessor :cond
- attr_accessor :rest
- attr_accessor :stats
- attr_accessor :locked
- attr_accessor :date_gained
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def initialize(index)
- init_main index
- init_addi
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def init_main(i)
- @id = i
- @name = Badge[i][:name]
- @icon = Badge[i][:icon]
- @ihue = Badge[i][:ihue]
- @text = Badge[i][:text]
- @mods = Badge[i][:mods]
- @cond = Badge[i][:cond]
- @rest = Badge[i][:rest]
- @stats = Badge[i][:stat]
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def init_addi
- @locked = true
- @date_gained = ""
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def do_unlock
- @locked = false
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def do_lock
- @locked = true
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def do_unlock_mods
- @mods.each do |block|
- Effect_Blocks.trigger(block)
- end
- @date_gained = Achievement.gained_on
- end
- end
- #===============================================================================
- class Achiiz
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- include Achievement
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- attr_accessor :badges
- attr_accessor :unlocked
- attr_accessor :last_gained
- attr_accessor :sndlast_gained
- attr_accessor :skill_rest
- attr_accessor :items_rest
- attr_accessor :weap_rest
- attr_accessor :armr_rest
- attr_accessor :param
- attr_accessor :xparam
- attr_accessor :sparam
- attr_accessor :atk_ele
- attr_accessor :def_ele
- attr_accessor :atl_dfl
- attr_accessor :spds_stats
- attr_accessor :max_tp
- attr_accessor :skills
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def initialize
- @badges = []
- @unlocked = [false] * Badge.size
- @last_gained = nil
- @sndlast_gained = nil
- Badge.size.times { |id| @badges << Achii_BADGE.new(id) }
- reset_rest
- reset_statz
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def reset_rest
- @skill_rest = []
- @items_rest = []
- @weap_rest = []
- @armr_rest = []
- @badges.each do |b|
- next unless b.locked
- b.rest.each do |r|
- next unless r
- case r[0]
- when :skill then @skill_rest << r[1]
- when :items then @items_rest << r[1]
- when :weap then @weap_rest << r[1]
- when :armr then @armr_rest << r[1]
- end
- end
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def reset_statz
- @param = [0] * 8
- @xparam = [0] * 10
- @sparam = [0] * 10
- @atk_ele = [0] * $data_system.elements.size
- @def_ele = [0] * $data_system.elements.size
- @atl_dfl = [0] * 2
- @spds_stats = [0] * 8
- @spds_stats = [0] * SPDS::Commands.size if $D13x[:ISPDS]
- @max_tp = 0
- @skills = []
- calc_stat_mods
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def calc_stat_mods
- @badges.each do |b|
- next if b.locked
- b.stats.each do |s|
- next unless s
- case s[0]
- when :param then @param [s[1]] += s[2] if $D13x[:Stats_Control]
- when :x_param then @xparam [s[1]] += s[2] if $D13x[:Stats_Control]
- when :s_param then @sparam [s[1]] += s[2] if $D13x[:Stats_Control]
- when :atk_ele then @atk_ele[s[1]] += s[2] if $D13x[:Elems_Control]
- when :def_ele then @def_ele[s[1]] += s[2] if $D13x[:Elems_Control]
- when :atk_lvl then @atl_dfl[0] += s[1] if $D13x[:Atk_Def_Lvs]
- when :def_lvl then @atl_dfl[1] += s[1] if $D13x[:Atk_Def_Lvs]
- when :spds_stat then @spds_stats[s[1]] += s[2] if $D13x[:ISPDS]
- when :max_tp then @max_tp += s[1] if $D13x[:TP_Control]
- when :skill then @skills << s[1]
- end
- end
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def unlock(id)
- @badges[id].do_unlock
- @badges[id].do_unlock_mods unless @unlocked[id]
- @unlocked[id] = true
- @sndlast_gained = @last_gained
- @last_gained = @badges[id]
- reset_rest
- reset_statz
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def lock(id)
- @badges[id].do_unlock
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def has_badge?(id)
- @badges[id].locked
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def progress
- unlocked = 0
- @unlocked.each { |i| unlocked += 1 if i}
- unlocked
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def completed
- @unlocked.all?
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def check_auto_unlock
- return if completed
- @badges.each do |b|
- next unless b.locked
- b.cond.each do |c|
- next unless c
- case c[0]
- when :variable then next unless $game_variables[c[1]] >= c[2]
- when :switch then next unless $game_switches[c[1]]
- when :script then next unless (eval(c[1]) rescue caul_fail(b.id,c[1]))
- end
- unlock(b.id)
- end
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def caul_fail(id,code)
- line_1 = "The achievement activation script code failed for badge[#{id}]."
- line_2 = "\nCode in question is;\n"
- msgbox(line_1+line_2+code)
- return false
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def skill_restrictions
- @skill_rest
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def item_restrictions
- @items_rest
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def weapon_restrictions
- @weap_rest
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def armor_restrictions
- @armr_rest
- end
- end
- #===============================================================================
- module Badge_Stat_Mods
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def parp_badge_stat(id)
- $game_player.achiiz.param[id]
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def xpar_badge_stat(id)
- $game_player.achiiz.xparam[id]
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def spar_badge_stat(id)
- $game_player.achiiz.sparam[id]
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def def_ele_badge_stat(id)
- $game_player.achiiz.def_ele[id]
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def atk_ele_badge_stat(id)
- $game_player.achiiz.atk_ele[id]
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def atl_dfl_badge_stat(id)
- $game_player.achiiz.atl_dfl[id]
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def spds_badge_stat(id)
- $game_player.achiiz.spds_stats[id]
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def max_tp_badge_stat
- $game_player.achiiz.max_tp
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def badge_skills
- $game_player.achiiz.skills.sort.collect{|id| $data_skills[id]}
- end
- end
- #===============================================================================
- class Game_Actor < Game_Battler
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- include Badge_Stat_Mods
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- alias :parp_badge :param_plus
- alias :xpar_badge :xparam_plus if $D13x[:Stats_Control]
- alias :spar_badge :sparam_plus if $D13x[:Stats_Control]
- alias :atke_badge :atk_ele_plus if $D13x[:Elems_Control]
- alias :defe_badge :def_ele_plus if $D13x[:Elems_Control]
- alias :atdf_badge :atl_dfl_plus if $D13x[:Atk_Def_Lvs]
- alias :spds_badge :spds_plus if $D13x[:ISPDS]
- alias :max_tp_badge :max_tp_plus if $D13x[:TP_Control]
- alias :skillbadge :skills
- #-----------------------------------------------------------------------------
- # Get Added Value of Parameter
- #-----------------------------------------------------------------------------
- def param_plus(param_id)
- parp_badge(param_id) + parp_badge_stat(param_id)
- end
- if $D13x[:Stats_Control]
- #---------------------------------------------------------------------------
- # Get Added Value of x-Parameter
- #---------------------------------------------------------------------------
- def xparam_plus(xparam_id)
- xpar_badge(xparam_id) + xpar_badge_stat(xparam_id)
- end
- #---------------------------------------------------------------------------
- # Get Added Value of s-Parameter
- #---------------------------------------------------------------------------
- def sparam_plus(sparam_id)
- spar_badge(sparam_id) + spar_badge_stat(sparam_id)
- end
- end # if $D13x[:Stats_Control]
- if $D13x[:Elems_Control]
- #---------------------------------------------------------------------------
- # Get Added Value of def-Element
- #---------------------------------------------------------------------------
- def def_ele_plus(element_id)
- defe_badge(element_id) + def_ele_badge_stat(element_id)
- end
- #---------------------------------------------------------------------------
- # Get Added Value of atk-Element
- #---------------------------------------------------------------------------
- def atk_ele_plus(element_id)
- atke_badge(element_id) + atk_ele_badge_stat(element_id)
- end
- end # if $D13x[:Elems_Control]
- if $D13x[:Atk_Def_Lvs]
- #---------------------------------------------------------------------------
- # Atk Lv | Def Lv ++
- #---------------------------------------------------------------------------
- def atl_dfl_plus(id)
- atdf_badge(id) + atl_dfl_badge_stat(id)
- end
- end # if $D13x[:Atk_Def_Lvs]
- if $D13x[:ISPDS]
- #---------------------------------------------------------------------------
- # Get SPDS Stats Plus
- #---------------------------------------------------------------------------
- def spds_plus(id)
- spds_badge(id) + spds_badge_stat(id)
- end
- end # if $D13x[:ISPDS]
- if $D13x[:TP_Control]
- #---------------------------------------------------------------------------
- # Atk Lv | Def Lv ++
- #---------------------------------------------------------------------------
- def max_tp_plus
- max_tp_badge + max_tp_badge_stat
- end
- end # if $D13x[:TP_Control]
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def skills
- skillbadge + badge_skills
- end
- end
- #===============================================================================
- class Game_Player < Game_Character
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- alias :init_achiiz :initialize
- alias :refr_achiiz :refresh
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def initialize
- init_achiiz
- reset_achiiz
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def refresh
- refr_achiiz
- refresh_auto_unlock_badge
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def achiiz
- @achievements ||= Achiiz.new
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def reset_achiiz
- @achievements = nil
- @achievements = Achiiz.new
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def gain_achii(id)
- return unless @achievements
- @achievements.unlock id
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def achii_prog
- return 0 unless @achievements
- return @achievements.progress
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def refresh_auto_unlock_badge
- return unless @achievements
- @achievements.check_auto_unlock
- end
- end
- #===============================================================================
- class Window_ItemList < Window_Selectable
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- alias :achii_enable? :enable?
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def enable?(item)
- achii_enable?(item) && achi_enabled(item)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def achi_enabled(item)
- return false unless item
- !$game_player.achiiz.items_restrictions.include?(item.id)
- end
- end
- #===============================================================================
- class Window_SkillList < Window_Selectable
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- alias :achii_enable? :enable?
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def enable?(item)
- achii_enable?(item) && achi_enabled(item)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def achi_enabled(item)
- return false unless item
- !$game_player.achiiz.skill_restrictions.include?(item.id)
- end
- end
- #==============================================================================
- class Window_EquipItem < Window_ItemList
- #==============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def enable?(item)
- return false unless item
- return achi_enabled_weap(item) if item.is_a?(RPG::Weapon)
- return achi_enabled_armr(item) if item.is_a?(RPG::Armor)
- return true
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def achi_enabled_weap(item)
- return false unless item
- !$game_player.achiiz.weapon_restrictions.include?(item.id)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def achi_enabled_armr(item)
- return false unless item
- !$game_player.achiiz.armor_restrictions.include?(item.id)
- end
- end
- #===============================================================================
- class Window_AchiiCommand < Window_Command
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def initialize
- super(0,0)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def window_width
- return Graphics.width/4
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def alignment
- return 0
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def make_command_list
- add_command(Achievement::Vocab[:comA], :badges)
- add_command(Achievement::Vocab[:comB], :exit)
- end
- end
- #===============================================================================
- class Window_StatusAchii < Window_Selectable
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Initialization
- #-----------------------------------------------------------------------------
- def initialize(y)
- super(0, y, Graphics.width/2, 104)
- refresh
- end
- #-----------------------------------------------------------------------------
- # Line Height
- #-----------------------------------------------------------------------------
- def line_height
- return 22
- end
- #-----------------------------------------------------------------------------
- # Window Padding
- #-----------------------------------------------------------------------------
- def standard_padding
- return 8
- end
- #-----------------------------------------------------------------------------
- # Do Refresh
- #-----------------------------------------------------------------------------
- def refresh
- contents.clear
- refresh_fonts
- draw_badge_prog
- draw_last_achii
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_badge_prog
- x = 0
- y = 0
- w = self.width-24
- h = line_height
- draw_text(x,y,w,h,Achievement::Vocab[:prog])
- valu = "#{$game_player.achii_prog} / #{$game_player.achiiz.badges.size}"
- draw_text(x,y,w-4,h,valu,2)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_last_achii
- x = 0
- y = line_height
- w = self.width-24
- h = line_height
- draw_text(x,y,w,h,Achievement::Vocab[:last])
- canc = $game_player.achiiz.last_gained
- return unless canc
- draw_last_badge(canc)
- draw_last_gain_date(canc)
- canc = $game_player.achiiz.sndlast_gained
- return unless canc
- draw_2last_badge(canc)
- draw_2last_gain_date(canc)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_last_badge(badg)
- x = 0
- y = line_height*2
- w = self.width-24
- h = line_height
- draw_de_icon(badg.icon,x,y,badg.ihue,!badg.locked)
- draw_text(x+24,y,w,h,badg.name)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_last_gain_date(badg)
- x = 0
- y = line_height*2
- w = self.width-24
- h = line_height
- draw_text(x,y,w-4,h,badg.date_gained,2)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_2last_badge(badg)
- x = 0
- y = line_height*3
- w = self.width-24
- h = line_height
- draw_de_icon(badg.icon,x,y,badg.ihue,!badg.locked)
- draw_text(x+24,y,w,h,badg.name)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_2last_gain_date(badg)
- x = 0
- y = line_height*3
- w = self.width-24
- h = line_height
- draw_text(x,y,w-4,h,badg.date_gained,2)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def module_data
- Achievement::Vocanicon
- end
- end
- #===============================================================================
- class Badge_Status < Dekita_Core_Status
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def standard_padding
- return 4
- end
- #-----------------------------------------------------------------------------
- # Refresh
- #-----------------------------------------------------------------------------
- def refresh
- contents.clear
- refresh_fonts
- draw_status_inf
- end
- #-----------------------------------------------------------------------------
- # Get Setup Info
- #-----------------------------------------------------------------------------
- def setup_info
- return Array.new unless @actor
- return @actor.stats # @actor.mods
- end
- #-----------------------------------------------------------------------------
- # Draw Status Page Info
- #-----------------------------------------------------------------------------
- def draw_status_inf
- x = 0 ; y = 0
- data = setup_info
- for i in data
- case i[0]
- # [:header, "TEXT", Text_Color, icon_id, icon_hue, alignment],
- when :param then y = draw_parameters(x,y,i[1],i[2])
- when :x_param then y = draw_xparameters(x,y,i[1],i[2])
- when :s_param then y = draw_sparameters(x,y,i[1],i[2])
- when :atk_ele then y = draw_atk_eles(x,y,i[1],i[2])
- when :def_ele then y = draw_def_eles(x,y,i[1],i[2])
- when :atk_lvl then y = draw_atk_level(x,y,i[1])
- when :def_lvl then y = draw_def_level(x,y,i[1])
- when :tp_info then y = draw_tp_info(x,y,i[1])
- when :spds_stat then y = draw_spds_info(x,y,i[1],i[2])
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Draw Parameters
- #-----------------------------------------------------------------------------
- def draw_parameters(x,y,i,v)
- data = Vocanicon.param(i)
- text = data[0]
- colo = data[1]
- icon = data[2]
- ihue = data[3]
- valu = sprintf("%s",v)
- y = draw_data(x,y,text,colo,icon,ihue,valu,2)
- return y
- end
- #-----------------------------------------------------------------------------
- # Draw x Parameters
- #-----------------------------------------------------------------------------
- def draw_xparameters(x,y,i,v)
- data = Vocanicon.xparam(i)
- text = data[0]
- colo = data[1]
- icon = data[2]
- ihue = data[3]
- valu = sprintf("%1.2f%%",v*100)
- y = draw_data(x,y,text,colo,icon,ihue,valu,2)
- return y
- end
- #-----------------------------------------------------------------------------
- # Draw sParameters
- #-----------------------------------------------------------------------------
- def draw_sparameters(x,y,i,v)
- data = Vocanicon.sparam(i)
- text = data[0]
- colo = data[1]
- icon = data[2]
- ihue = data[3]
- valu = sprintf("%1.2f%%",v*100)
- y = draw_data(x,y,text,colo,icon,ihue,valu,2)
- return y
- end
- #-----------------------------------------------------------------------------
- # Draw Attack Elements
- #-----------------------------------------------------------------------------
- def draw_atk_eles(x,y,i,v)
- return y unless $D13x[:Elems_Control]
- data = Vocanicon.atk_element(i)
- text = data[0]
- colo = data[1]
- icon = data[2]
- ihue = data[3]
- valu = sprintf("%1.2f%%",v*100)
- y = draw_data(x,y,text,colo,icon,ihue,valu,2)
- return y
- end
- #-----------------------------------------------------------------------------
- # Draw Defence Elements
- #-----------------------------------------------------------------------------
- def draw_def_eles(x,y,i,v)
- return y unless $D13x[:Elems_Control]
- data = Vocanicon.def_element(i)
- text = data[0]
- colo = data[1]
- icon = data[2]
- ihue = data[3]
- valu = sprintf("%1.2f%%",v*100)
- y = draw_data(x,y,text,colo,icon,ihue,valu,2)
- return y
- end
- #-----------------------------------------------------------------------------
- # Draw Attack Level
- #-----------------------------------------------------------------------------
- def draw_atk_level(x,y,v)
- return y unless $D13x[:Atk_Def_Lvs]
- data = Vocanicon::Atk_Level
- text = data[0]
- colo = data[1]
- icon = data[2]
- ihue = data[3]
- valu = sprintf("%s",v.to_i)
- y = draw_data(x,y,text,colo,icon,ihue,valu,2)
- return y
- end
- #-----------------------------------------------------------------------------
- # Draw Defence Level
- #-----------------------------------------------------------------------------
- def draw_def_level(x,y,v)
- return y unless $D13x[:Atk_Def_Lvs]
- data = Vocanicon::Def_Level
- text = data[0]
- colo = data[1]
- icon = data[2]
- ihue = data[3]
- valu = sprintf("%s",v.to_i)
- y = draw_data(x,y,text,colo,icon,ihue,valu,2)
- return y
- end
- #-----------------------------------------------------------------------------
- # Draw TP Info
- #-----------------------------------------------------------------------------
- def draw_tp_info(x,y,v)
- return y unless $D13x[:TP_Control]
- data = Vocanicon::TP
- text = data[0]
- colo = data[1]
- icon = data[2]
- ihue = data[3]
- valu = sprintf("%s",v.to_i)
- y = draw_data(x,y,text,colo,icon,ihue,valu,2)
- return y
- end
- #-----------------------------------------------------------------------------
- # Draw TP Info
- #-----------------------------------------------------------------------------
- def draw_spds_info(x,y,i,v)
- return y unless $D13x[:ISPDS]
- data = Vocanicon.spds_stat($game_party.leader,i)
- text = data[0]
- colo = data[1]
- icon = data[2]
- ihue = data[3]
- valu = sprintf("%s",v.to_i)
- y = draw_data(x,y,text,colo,icon,ihue,valu,2)
- return y
- end
- end
- #===============================================================================
- class Window_Achievement < Window_Command
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def initialize(y)
- super(0,y)
- deactivate
- unselect
- refresh
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def window_width
- return Graphics.width
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def col_max
- return 4
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def spacing
- return 0
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def make_command_list
- $game_player.achiiz.badges.each do |i|
- add_command(i.name, :badge, !i.locked, i)
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def visible_line_number
- return 9
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_item(index)
- change_color(normal_color, command_enabled?(index))
- data = @list[index][:ext]
- rect = item_rect_for_text(index)
- x = rect.x-1
- y = rect.y+1
- w = rect.width+2
- h = rect.height-2
- contents.fill_rect(x,y,w,h,General::Box_Color)
- draw_de_icon(data.icon,x,y,0,!data.locked)
- draw_text(x+24,y,w,h,command_name(index))
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_badges
- $game_player.achiiz.badges.each do |i|
- add_command(i.name, :badge, true, i)
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def help_info
- @list[index][:ext].text
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def badge
- @list[@index][:ext] || nil
- end
- end
- #===============================================================================
- class Scene_Achievement < Scene_MenuBase
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def start
- super
- start_shit
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def start_shit
- create_command_window
- create_help_window
- create_status_window
- create_achii_window
- create_badge_window
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def create_command_window
- @command_window = Window_AchiiCommand.new
- @command_window.set_handler(:cancel, method(:return_scene))
- @command_window.set_handler(:exit, method(:return_scene))
- @command_window.set_handler(:badges, method(:check_badges))
- @command_window.viewport = @viewport
- end
- #-----------------------------------------------------------------------------
- # Create Halp Window
- #-----------------------------------------------------------------------------
- def create_help_window
- @help_window = Deki_Help.new
- @help_window.viewport = @viewport
- @help_window.x = Graphics.width / 4
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def create_status_window
- @status_window = Window_StatusAchii.new(@help_window.height)
- @status_window.viewport = @viewport
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def create_achii_window
- y = @status_window.y+@status_window.height
- @achii_window = Window_Achievement.new(y)
- @achii_window.set_handler(:cancel,method(:return_to_com))
- @achii_window.viewport = @viewport
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def create_badge_window
- x = Graphics.width/2
- y = @status_window.y
- w = Graphics.width/2
- h = @status_window.height
- b = @achii_window.badge
- @badge_window = Badge_Status.new(x,y,w,h,b)
- @badge_window.viewport = @viewport
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def on_actor_change
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def update
- super
- update_help
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def update_help
- @help_window.set_text(@achii_window.help_info)
- @badge_window.actor = @achii_window.badge
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def check_badges
- @command_window.unselect
- @achii_window.activate
- @achii_window.select(0)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def return_to_com
- @achii_window.unselect
- @command_window.activate
- @command_window.select(0)
- end
- end
- if Achievement::Menu_Access
- #===============================================================================
- class Window_MenuCommand < Window_Command
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- alias :aoc_scene_badge :add_original_commands
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def add_original_commands
- aoc_scene_badge
- add_badge_command
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def add_badge_command
- add_command(Achievement::Vocanicon[0],:badges)
- end
- end
- #===============================================================================
- class Scene_Menu < Scene_MenuBase
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- alias :ccw_scene_badge :create_command_window
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def create_command_window
- ccw_scene_badge
- @command_window.set_handler(:badges, method(:open_badge_scene))
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def open_badge_scene
- SceneManager.call(Scene_Achievement)
- end
- end
- end# if Game_Storage::Menu_Access[0]
- #==============================================================================#
- # http://dekitarpg.wordpress.com/ #
- #==============================================================================#
- end # if true # << Make true to use this script, false to disable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement