Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- #** Quasi Passive Skills v 1.04
- #==============================================================================
- # Edited - Fixed a bug after battle turns
- # Edited - Added an option to hide passive skills during battle
- # Edited - Fixed bug with clear all
- # Edited - Forgot to change a value, which allowed non passive skills to gain a
- # passive~
- # Allows Skills to give you passive traits.
- #==============================================================================
- # Instructions:
- # Very simple to use, just needs 2 notes tags!~
- # The State(Passive) is added when the skill is learned, it is also removed
- # when the skill is forgoten.
- #-----------------------------------------------------------------------------
- module Quasi
- module Passive
- #--------------------------------------------------------------------------
- # Change this value to the Skill Type ID that you wish to hide
- # Skills with this skill type id, aren't shown in battle.
- #--------------------------------------------------------------------------
- TYPE = 3
- end
- end
- #------------------------------------------------------------------------------
- # * Skill Note Tag
- #------------------------------------------------------------------------------
- # <passive: state_id>
- # Replace state_id with the state you wish to add
- #
- #------------------------------------------------------------------------------
- # * State Note Tag
- #------------------------------------------------------------------------------
- # <passive>
- # Just checks if the state is a passive state, if it is, it doesn't display on
- # State icons, and can not be removed.
- #
- # Alias :
- # Game_Actor
- # learn_skill
- # forget_skill
- #
- # Overwrites:
- # Game_Battler
- # remove_states
- #
- # Game_BattlerBase
- # state_icons
- #==============================================================================#
- # By Quasi (http://quasixi.wordpress.com/)
- # - 3/23/14
- #==============================================================================#
- # ** Stop! Do not edit anything below, unless you know what you **
- # ** are doing! **
- #==============================================================================#
- $imported = {} if $imported.nil?
- $imported["Quasi_Passive"] = 1.04
- #==============================================================================
- # ** Game_Actor
- #------------------------------------------------------------------------------
- # This class handles actors. It is used within the Game_Actors class
- # ($game_actors) and is also referenced from the Game_Party class ($game_party).
- #==============================================================================
- class Game_Actor < Game_Battler
- alias qpassive_learn learn_skill
- alias qpassive_forget forget_skill
- #--------------------------------------------------------------------------
- # * Learn Skill
- #--------------------------------------------------------------------------
- def learn_skill(skill_id)
- learn_passive(skill_id)
- qpassive_learn(skill_id)
- end
- #--------------------------------------------------------------------------
- # * Forget Skill
- #--------------------------------------------------------------------------
- def forget_skill(skill_id)
- forget_passive(skill_id)
- qpassive_forget(skill_id)
- end
- def learn_passive(skill_id)
- unless skill_learn?($data_skills[skill_id])
- passive = $data_skills[skill_id].passive
- add_new_state(passive.to_i) if passive
- reset_state_counts(passive.to_i) if passive
- end
- end
- def forget_passive(skill_id)
- passive = $data_skills[skill_id].passive
- remove_passive(passive.to_i) if passive
- end
- end
- #==============================================================================
- # ** Game_Battler
- #------------------------------------------------------------------------------
- # A battler class with methods for sprites and actions added. This class
- # is used as a super class of the Game_Actor class and Game_Enemy class.
- #==============================================================================
- class Game_Battler < Game_BattlerBase
- #--------------------------------------------------------------------------
- # * OVERWRITE Remove State
- #--------------------------------------------------------------------------
- def remove_state(state_id)
- if state?(state_id) && !$data_states[state_id].passive?
- revive if state_id == death_state_id
- erase_state(state_id)
- refresh
- @result.removed_states.push(state_id).uniq!
- end
- end
- #--------------------------------------------------------------------------
- # * NEW Remove State
- #--------------------------------------------------------------------------
- def remove_passive(state_id)
- if state?(state_id) && $data_states[state_id].passive?
- revive if state_id == death_state_id
- erase_state(state_id)
- refresh
- @result.removed_states.push(state_id).uniq!
- end
- end
- end
- #==============================================================================
- # ** Game_BattlerBase
- #------------------------------------------------------------------------------
- # This base class handles battlers. It mainly contains methods for calculating
- # parameters. It is used as a super class of the Game_Battler class.
- #==============================================================================
- class Game_BattlerBase
- #--------------------------------------------------------------------------
- # * OVERWRITE Get Current States as an Array of Icon Numbers
- #--------------------------------------------------------------------------
- def state_icons
- icons = states.collect { |state| state.passive? ? nil : state.icon_index }
- icons.delete(nil)
- icons.delete(0)
- icons
- end
- #--------------------------------------------------------------------------
- # * OVERWRITE Clear State Information
- #--------------------------------------------------------------------------
- def clear_states
- @states = [] if @states.nil?
- @states.keep_if{|state| $data_states[state].passive?} if !@states.nil?
- @state_turns = {} if @state_turns.nil?
- @state_turns.delete_if{|state| !$data_states[state].passive?} if !@state_turns.nil?
- @state_steps = {} if @state_steps.nil?
- @state_steps.delete_if{|state| !$data_states[state].passive?} if !@state_steps.nil?
- end
- end
- #==============================================================================
- # ** Window_ActorCommand
- #------------------------------------------------------------------------------
- # This window is for selecting an actor's action on the battle screen.
- #==============================================================================
- class Window_ActorCommand < Window_Command
- #--------------------------------------------------------------------------
- # * Add Skill Command to List
- #--------------------------------------------------------------------------
- def add_skill_commands
- @actor.added_skill_types.sort.each do |stype_id|
- next if stype_id == Quasi::Passive::TYPE
- name = $data_system.skill_types[stype_id]
- add_command(name, :skill, true, stype_id)
- end
- end
- end
- #==============================================================================
- # ** RPG::Skill
- #==============================================================================
- class RPG::Skill
- def passive
- if @passive.nil?
- if @note =~ /<(?:passive):(.*)>/i
- @passive = $1
- else
- @passive = false
- end
- end
- @passive
- end
- end
- #==============================================================================
- # ** RPG::State
- #==============================================================================
- class RPG::State
- def passive?
- if @passive.nil?
- if @note =~ /<(?:passive)>/
- @passive = true
- else
- @passive = false
- end
- end
- @passive
- end
- end
RAW Paste Data