Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##
- # Copyright (c) 2016 Zeriab
- #
- # This software is provided 'as-is', without any express or implied
- # warranty. In no event will the authors be held liable for any damages
- # arising from the use of this software.
- #
- # Permission is granted to anyone to use this software for any purpose,
- # including commercial applications, and to alter it and redistribute it
- # freely, subject to the following restrictions:
- #
- # 1. The origin of this software must not be misrepresented; you must not
- # claim that you wrote the original software. If you use this software
- # in a product, an acknowledgement in the product documentation would be
- # appreciated but is not required.
- # 2. Altered source versions must be plainly marked as such, and must not be
- # misrepresented as being the original software.
- # 3. This notice may not be removed or altered from any source distribution.
- #
- ##
- # Interpreter command
- #
- # Use in a script call to set current geomancy tag:
- # set_geomancy_tag(1)
- #
- # To disable geomancy use
- # set_geomancy_tag(0)
- #
- def set_geomancy_tag(tag)
- $game_player.geomancy_tag = tag
- end
- ##
- # Add geomancy tags to skills
- #
- class RPG::Skill < RPG::UsableItem
- attr_writer :geomancy_tags
- def geomancy_tags
- @geomancy_tags ||= []
- return @geomancy_tags
- end
- def add_tag(tag)
- self.geomancy_tags << tag
- end
- def geomancy?
- !geomancy_tags.empty?
- end
- end
- ##
- # Player has a specific geomancy tag
- #
- class Game_Player < Game_Character
- attr_accessor :geomancy_tag
- def geomancy?
- return geomancy_tag != nil && geomancy_tag > 0
- end
- ##
- # Clear geomancy tag upon transfer
- #
- alias_method :geomancy_clear_transfer_info, :clear_transfer_info
- def clear_transfer_info
- geomancy_clear_transfer_info
- self.geomancy_tag = 0
- end
- end
- ##
- # Geomancy skill check
- #
- class Game_BattlerBase
- alias_method :geomancy_skill_conditions_met?, :skill_conditions_met?
- def skill_conditions_met?(skill)
- enabled = geomancy_skill_conditions_met?(skill)
- # Geomancy conditions check
- if enabled && skill.geomancy? && $game_player.geomancy?
- enabled = skill.geomancy_tags.include?($game_player.geomancy_tag)
- end
- return enabled
- end
- end
- ##
- # Setup skill geomancy as post-processing part of loading the database
- #
- module DataManager
- class << self
- alias_method :geomancy_load_database, :load_database
- def load_database(*args)
- geomancy_load_database(*args)
- database_post_process
- end
- def database_post_process
- setup_geomancy
- end
- ##
- # User interface for adding geomancy tags
- #
- def add_geomancy_tag(hash)
- skill_id = hash[:skill_id]
- tag = hash[:tag]
- skill = $data_skills[skill_id]
- unless skill.nil? || tag.nil?
- skill.add_tag(tag)
- end
- end
- end
- end
- __END__
- # Configuration section - I recommend putting this code in a different section of the script editor
- module DataManager
- module_function
- def setup_geomancy
- # Specify geomancy tags here
- # Note: Tags using 0 will be ignored
- add_geomancy_tag(:skill_id => 80, :tag => 1)
- add_geomancy_tag(:skill_id => 81, :tag => 2)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement