#=============================================================================== # # Yanfly Engine RD - Custom Skill Effects ReDONE # Last Date Updated: 2009.06.23 # Level: Normal, Hard, Lunatic # # This script's been redone from the ground up to combine two scripts that share # a common construction but different effects. All in all, a very big script has # been created to do many things. # # - Added the rage stat to every battler. Rage increases each time an action is # performed or whenever the battler takes damage. Used as a skill currency. # - Change skill costs to require something other than MP. Examples include HP, # gold, rage, and more. # - Skills can now have a preparation period after a battle starts before they # can be used at all. # - Some skills can now be charged a few turns before they're actually casted. # Works on enemies as well. # - A recharge system after a skill is used that requires the players to wait # a few turns before allowing them to use that skill again. # - A mix items system for unique effects when choosing certain combinations of # items and throwing them together into a pool. # - A subskill selection menu to open up more options and reduce clutter on the # main skill menu end. # - Skills can be instantly casted without wasting a turn. # - Skills can now be chain casted in proper order. # - Skills can be learned upon hit for certain actors and classes. # # - Custom effects for lunatic scripters. These effects can happen before a # skill is cast, charging skill, during the cast, or after the skill is cast. # - Custom animations for lunatic scripters. This can make a skill use different # animations depending on various conditions being fulfilled. # #=============================================================================== # Updates: # ---------------------------------------------------------------------------- # o 2009.06.23 - Upgrade Pack 3 # Added Require Any/All Item # Added Require Any/All Weapon # Added Require Any/All Armour # Added Suicide property # Added Throw Item property # o 2009.05.31 - Mix Skills and Chain Skills now reset charging properly. # o 2009.05.30 - Scene Battle ReDux compatibility. # o 2009.05.28 - Changed to # Added for subskills and chainskills. # o 2009.05.25 - Upgrade Pack 2 # Added Mix Items ability # Added Instant Cast property # Added Subskills extension # Added Chain Skill functionality # Added Learn skills upon being hit # o 2009.05.18 - Equip Skill Slots compatibility # o 2009.05.15 - Battler Stat: Morale compatibility # o 2009.05.12 - More efficient skill window. # Added # Bugfix so that enemies don't use the party's gold. # o 2009.04.22 - Enemies are now affected by Recharge. # Enemies are now affected by Limited Usage. # Enemies are now affected by Prepare. # Reflect now bounces to opposing parties if reflected from the # same party. Party to enemy and enemy to party. # o 2009.04.19 - Upgrade Pack 1 # Added Rage Boost modifiers. # Added Unreflect property for skills. # Added skill cost modifiers. # Added Charge Skill Effect for Lunatics. # o 2009.04.15 - Added Scene_Skill functionality. Can't believe I forgot that. # Fixed battlers using skills even if MP cost isn't met. # Added another return for cost_custom. # Added singularity for recharge turns. # o 2009.04.14 - Compatibility update with KGC Equip Learn Skill. # Added an option for wait time after critical hit. # Added common before, common during, and common after effects. # Added calc_common_cost. # o 2009.04.12 - This update merged the script with Custom Skill Properties. # Added a cast time property to charge spells. # Critical hits no longer waste a full line in message window. # o 2009.04.09 - Note that these are for Custom Skill Properties originally. # Added costs for CurMP, MaxMP, CurHP, MaxHP, gold, max gold, # custom costs, and script templates for custom costs. # Added rage system. # 0 2009.02.18 - Started script and finished. #=============================================================================== # How to Use: Normal Mode #=============================================================================== # # Input these into your skill's notebox to have them produce this script's # effects. They will take priority over one another in a top to bottom fashion. # You cannot have two different costs for two different things. # # x is the MP cost of the skill. Can go over 9,999 MP cost. # x is the percentage of user's max MP. If x is 80, then 80%. # x is the HP cost of the skill. This will take life from user. # x is the percentage of user's max HP. If x is 50, then 50%. # x is the amount of gold used for the skill. # x is the percentage of the gold used. If x is 30, then 30%. # x is the amount of rage required by the user to possess. # x is the amount of rage given to the user. # #=============================================================================== # How to Use: Hard Mode #=============================================================================== # # These can be added on to the notebox and they won't take priority over another # but they can potentially affect whether or not a skill can be used for the # current battle duration. # # x is the amount ot turns before skill is usable in battle. # x is the amount of turns needed before the skill is cast. # x is the amount of fatigue generated after a skill is cast. # x is the amount of turns needed to recharge after using. # x is the amount of times the skill can be used during battle. # # ---------------------------------------------------------------------------- # The follow are unique effects for your skills. # ---------------------------------------------------------------------------- # # or # This requires the battler (actor only) to have element x in their weapon set. # If the battler doesn't, the skill cannot be used. If this requires the sword # element, the actor needs a weapon with the sword element attached to it. To # use multiple elements, put in more of these tags. # # or # This requires the battler (actor only) to have at least one of the elements # listed in the array above. So long as one meets the requirements, the skill # can be cast and used. # # or # This requires the battler (actor only) to have all the x status effects active # before the skill can be used. # # or # This requires the battler (actor only) to have at least one of the states # listed in the array above. So long as one meets the requirements, the skill # can be cast and used. # # or # or # or # This requires the party to have all items x. If the party doesn't have them, # the skill cannot be used. This will not consume items x. # # or # or # or # This requires the party to have any of the above items before it can be used. # If none of them are available, the skill cannot be used. So long as one is # present, that item can be used. Items, Weapons, and Armours are independent # of each other when determining whether or not the items can be used. # # # This has been changed from for subskills and chain skills. # By default, skills have to be learned before they can be accessible inside # the skill menu. With this tag, the subskill or chainskill does not have to # be learned in order for it to appear. # # # This will require the actor to be at least level x before it can appear in # a subskill or chain skill window. This will not override the need to learn # the skill before it can be used. # # ---------------------------------------------------------------------------- # # # Makes a skill unreflectable from battlers with a reflect status effect. # # # User dies after performing the skill. # # # The skill will be instantly cast the moment it's selected and the actor will # not waste a turn. This does not require the actor to enter battle phase to # cast the skill. # # or # or # Skills with this tag will teach actor x the skill once hit. Hit learn actor # will designate specific actors to be targetted for the skill. Hit learn class # will designate actors with that class equipped to learn the skill. # # ---------------------------------------------------------------------------- # # # Allows the actor to mix items and produce a new effect. This tag will enable # the actor to use all items available to the game party except for those with # the tag. # # or # Allows the actor to mix items of type x. Items with the same tag will be # selectable for this form of item mixing. Include more of this tag to enable # more item mixing types or use the following tag: . # # # This is included in for items. If the item has this tag, the item cannot be # mixed at all. Used for key items. # # ---------------------------------------------------------------------------- # # or # The skill, if selected from the skill window, will pull up a subskills window # that can store extra skills. These skills can be skills that the actor hasn't # learned and skills that the actor can possibly never learn. # # # This skill can only be shown if it's inside the subskill window. Otherwise, # it will not appear. # # ---------------------------------------------------------------------------- # # # This creates an open chain casting for the actor. The actor is able to select # any skills it has learned outside of skills with specific properties. These # skills are the skills available to it in the skill window. x is the number of # skills that the chain skill may continuously cast. # # or # This creates a closed chain. Closed chains can only chain skills of certain # closed types. x marks the number of skills the chain skill can continuously # cast. y marks the closed types the chain skill is allowed select from. # # or # This is the closed type that is available for specific chains. Closed chains # of the match closed type will select these skills from the actor's skill list # to choose for chain casting. # # # These give a very specific set of skills that the actor is allowed to chain # cast. These skills will appear on the list regardless of whether or not the # actor has learned the skill with the exception of . # # # This allows the chain skill to reselect skills it has already choosen. # # # This causes a skill to be not chainable. # # ---------------------------------------------------------------------------- # # # Skill has the throw property. Any item that can be thrown can be used by # this skill. Throw skills have unique damage formulas that can be adjusted # below in the module. # # or # Skill has the throw property. The skill can only throw item, weapon, and # armour types of x. If this tag is used on an item, it will tag that item as # type x and it becomes throwable. If you want the skill or item to have more # than one throw type, insert more tags or use the x,x tag. # # or # The item becomes throwable or unthrowable depending on which tag you use # inside the item's notebox. # # ---------------------------------------------------------------------------- # The follow are unique effects for your status effects. # ---------------------------------------------------------------------------- # And as odd as I know it may seem, I'm going to put in a couple of status # effect tags here since they provide direct effects on skill effects and would # be useless without this script. # # # Makes the battler reflect skills back at the user unless the skill has the # unreflectable tag on it. # # , , # Increases and decreases overall rage boost dependent on x. # # # # # # # Increases and decreases skill costs for those respective skills. Increase and # decrease depends on x. # #=============================================================================== # # Compatibility # - Works With: KGC_OnScreenStatus, KGC_Steal # - Works With: Yanfly's Battler Stat: Morale # - Alias: Game_Actor, setup # - Alias: Game_Battler, inputable?, attack_effect, skill_effect # - Alias: Game_BattleAction, valid? # - Alias: Game_Enemy, initialize # - Alias: Scene_Battle, process_battle_start, display_hp_damage, execute_action # - Alias: Scene_Skill, use_skill_nontarget # - Overwrites: Game_Battler, calc_mp_cost, skill_can_use? # - Overwrites: Scene_Battle, execute_action_skill, display_action_effects # - Overwrites: Scene_Skill, apply_skill_cost # #=============================================================================== $imported = {} if $imported == nil $imported["CustomSkillEffects"] = true module YE module BATTLE #------------------------------------------------------------------------- # Basic Properties #------------------------------------------------------------------------- # This sets the default message wait times and critical hit wait times. MSGWAIT = 60 CRITWAIT = 30 # This affects whether or not you wish to use icons to follow MP, HP, or # whatever else the cost is. USE_ICONS = true MP_ICON = 100 # This is the icon used for MP cost. HP_ICON = 99 # This is the icon used for HP cost. GOLD_ICON = 205 # This is the icon used for gold costs. WINCOLUMN = 2 # This is the number of columns used in the skill window. # If you're not going to use icons, fill these out to distinguish cost types # in your skill menu. MP_COST = "%d MP" # This is for worded MP cost. HP_COST = "%d HP" # This is for worded HP cost. GOLD_COST = "%d Gold" # This is for gold cost. MGOLD_COST = "%d%% Gold" # This is for percentile of gold cost. # This allows your players to use HP sacrificing abilities even if it'll # normally kill them. ALLOW_DEATH_HP_COST = false # This part sets up rage. How would you like to increase rage? INC_RAGE_ATTACK = true # Rage increases when actor attacks. NUM_RAGE_ATTACK = 2 # Increases by this much when actor attacks. INC_RAGE_DAMAGED = true # Rage increases when actor is damaged. NUM_RAGE_DAMAGED = 1 # Increases by this much when actor is damaged. INC_RAGE_SKILL = true # Rage increases when actor uses a skill. NUM_RAGE_SKILL = 1 # Increases by this much when actor uses a skill. RAGE_ICON = 132 # This is the icon used for rage costs. RAGE_COST = "%d Rage" # This is for the worded rage cost. MAX_RAGE = 12 # This sets the highest rage can go. RAGE_RESET_BATTLE = true # This causes rage to be reset each battle. # This is the message to be displayed when using a skill that requires # casting time and what sound to play. CHARGE_MSG = "%s begins charging %s!" CHARGE_CON = "%s continues charging %s!" CHARGE_SND = RPG::SE.new("Up", 80, 100) # Do you wish to replace cost with recharge if the skill is recharging? # And if so, how would you like the icon or message to be displayed? REPLACE_ICON_RECHARGE = true RECHARGE_ICON = 142 RECHARGE_MSG = "%d Turns" RECHARGE_MSG1 = "%d Turn" # This part controls fatigue. If a skill causes fatigue, that character # can't act until the fatigue wears off. FATIGUE_MSG = "%s becomes fatigued." FATIGUE_SND = RPG::SE.new("Down", 80, 100) # This part modifies the limited uses per battle amounts. The icon displayed # is the one that will replace the cost once all of the uses are up. REPLACE_ICON_USAGE = true USAGE_ICON = 143 USAGE_MSG = "Can't Use" # This is what's displayed if a skill was reflected. REFLECT_MSG = "%s reflects %s." REFLECT_SND = RPG::SE.new("Flash2", 80, 100) #------------------------------------------------------------------------- # Item Mixing Properties #------------------------------------------------------------------------- # The following below dictate the rules governing mixing items. Adjust them # properly to determine what kinds of effects you would like. # If the player has selected a designated combination, you can use this # sound effect to indicate a successful item pairing. SUCCESSFUL_ITEM_MIX = RPG::SE.new("Decision2", 80, 150) # This is the message that appears if there aren't enough items. NOT_ENOUGH_ITEMS = "There are insufficient items." ITEM_COLOUR1 = 14 # Adjusts colour for first item picked. ITEM_COLOUR2 = 14 # Adjusts colour for second item picked. ITEM_COLOUR3 = 18 # Adjusts colour if same item picked both times. # The following determiens the random skills that will be choosen for each # type if the combination does not exist in the dedicated hash. Do not # remove type 0 and make sure it has skill ID's in it. If a random type # does not exist, it will pull out of type 0. RANDOM_ITEM_MIX_TYPES ={ # Type => [Skill ID's] 0 => [15, 17, 19, 21, 23, 25], 2 => [ 9, 10, 11, 12, 13, 14], } # Do not remove this. # The following hash will determine what item combinations will yield what # skill effect. The item combinations are backwards compatible, meaning that # you don't have to get both orders right in order to produce a specific # outcome. Inside the skill result array, insert the ID's you want the item # combination to randomly choose. ITEM_MIX_COMBO_HASH ={ # [Item, Item] => [Skill.ID Result] [ 15, 15] => [60], # Fire Scroll + Fire Scroll = Fire 2 [ 15, 16] => [60, 62], # Fire Scroll + Flame Scroll = Either [ 16, 16] => [62], # Flame Scroll + Flame Scroll = Flame 2 [ 17, 17] => [64], # Ice Scroll + Ice Scroll = Ice 2 [ 17, 18] => [64, 66], # Ice Scroll + Blizzard Scroll = Either [ 18, 18] => [66], # Blizzard Scroll + Blizzard Scroll = Blizzard 2 [ 19, 19] => [68], # Thunder Scroll + Thunder Scroll = Thunder 2 [ 19, 20] => [68, 70], # Thunder Scroll + Spark Scroll = Either [ 20, 20] => [70], # Spark Scroll + Spark Scroll = Spark II } # Do not remove this. #------------------------------------------------------------------------- # Hit Learn Properties #------------------------------------------------------------------------- # The following will determine some rules governed for learning skills # upon being struck by them. Note that only actors can learn skills this # way and not enemies. HIT_LEARN_MESSAGE = "%s has learned %s!" SUBCLASS_HIT_LEARN = true # If you have Subclass Selection System. #------------------------------------------------------------------------- # Chain Casting Properties #------------------------------------------------------------------------- # The following sets how a selected chain total appears inside the # select chain window. CHAIN_MAX_TEXT = "%d/%d" #------------------------------------------------------------------------- # Throw Properties #------------------------------------------------------------------------- # The following allows you to set by default which items are throwable. # To change this property manually, you can use the and # tags in the item, weapon, or armour's notebox. DEFAULT_THROW_ITEM = false DEFAULT_THROW_WEAPON = true DEFAULT_THROW_ARMOUR = false # The following determines how the text is shown for the action. # 1st %s - Battler's name # 2nd %s - Item's name THROW_TEXT = "%s throws %s!" # The following adjusts the damage formulas used for throw skills. # By default, regular items are base off of their base_damage, while equips # are based off of their attack values. THROW_POWER = "(item.is_a?(RPG::Item) ? item.base_damage : item.atk)" THROW_ATTACKER = "user.agi * 3 + throw_power * 6 + rand(20)" THROW_DEFENDER = "self.def / 3" end end #=============================================================================== # How to Use: Lunatic Mode #=============================================================================== # # You can adjust the default wait time with YE::BATTLE::MSGWAIT. Just be sure to # use the following code if you decide to make your messages wait a bit. # msgwait # # # Adding that tag into the notebox of a skill would give it the extra effect # before the damage is dealt. Find "def effect_before" to begin adding in your # own before skill effects. "def common_before" will occur for each skill # regardless of BSE tags. Input those common before effects there. # # # This can only occur when the skill is one that requires charging. This is here # mainly because chargable skills don't activate any before, during, or after # effects and that sometimes, scripters would like to produce effects simply # from charing a skill. "def common_charge" will occur for each charge skill. # # # Adding that tag into the notebox of a skill would give it the extra effect # during the damage being dealt. Note that the damage still takes place, but # the extra effect will occur in between each enemy taking damage. To use this, # find "def effect_during" to begin adding in your own during skill effects. # "def common_during" will occur for each skill regardless of DSE tags. Input # those common during effects there. # # # Adding that tag into the notebox of a skill would give it the extra effect # after the damage is dealt. Find "def effect_after" to begin adding in your own # after skill effects. "def common_after" will occur for each skill regardless # of ASE tags. Input those common during effects there. # # # Adding that tag into the notebox of a skill would allow it to have conditional # skill animations played. You can choose what animations would be played and # under what conditions. Find "def custom_ani" to begin adding in your own # conditional skill animations. # # # Adding that tag into the notebox of a skill would allow it to have different # (and conditional) costs. Follow the template and you should be okay regarding # how it's composed. Find "cost_custom" to change the visual aspects of the # costs and "apply_custom_cost" for the mechanical aspects. The new definition # "def calc_cost_common" will alter costs regardless of their type. # #=============================================================================== class Scene_Battle < Scene_Base def effect_before(skill, beforeskill) line_number = @message_window.line_number case beforeskill #--------------------------------------------------------------------------- # ////////////////////////////////////////////////////////////////////////// # This is where you begin adding in your own before skill effects. #--------------------------------------------------------------------------- when 1 @active_battler.maxmp = 10000 @active_battler.mp = 10000 sound = RPG::SE.new("Item2", 80, 100) sound.play refresh_onscreenstatus # if KGC_OnScreenStatus is imported text = sprintf("%s somehow gets a whole lot of MP.", @active_battler.name) @message_window.add_instant_text(text) msgwait @message_window.back_to(line_number) when 2 when 3 #--------------------------------------------------------------------------- # This is the part you guys shouldn't touch afterwards. # ////////////////////////////////////////////////////////////////////////// #--------------------------------------------------------------------------- end end #----------------------------------------------------------------------------- #-----This is the common before effect. It'll occur regardless of BSE tagging. def common_before(skill) end #----------------------------------------------------------------------------- def effect_charge(skill, chargeskill) line_number = @message_window.line_number case chargeskill #--------------------------------------------------------------------------- # ////////////////////////////////////////////////////////////////////////// # This is where you begin adding in your own charge skill effects. #--------------------------------------------------------------------------- when 1 # when 2 when 3 #--------------------------------------------------------------------------- # This is the part you guys shouldn't touch afterwards. # ////////////////////////////////////////////////////////////////////////// #--------------------------------------------------------------------------- end end #----------------------------------------------------------------------------- #-----This is the common charge effect. It'll occur regardless of CSE tagging. def common_charge(skill) end #----------------------------------------------------------------------------- def effect_during(target, skill, duringskill) line_number = @message_window.line_number case duringskill #--------------------------------------------------------------------------- # ////////////////////////////////////////////////////////////////////////// # This is where you begin adding in your own during skill effects. #--------------------------------------------------------------------------- when 1 target.maxmp = 0 target.mp = 0 sound = RPG::SE.new("Bow2", 80, 100) sound.play text = sprintf("%s loses all MP!", target.name) @message_window.add_instant_text(text) msgwait when 2 target.hp = 1 sound = RPG::SE.new("Down", 80, 100) sound.play text = sprintf("%s becomes near death!", target.name) @message_window.replace_instant_text(text) when 3 #@active_battler.remove_state(17) #--------------------------------------------------------------------------- # This is the part you guys shouldn't touch afterwards. # ////////////////////////////////////////////////////////////////////////// #--------------------------------------------------------------------------- end end #----------------------------------------------------------------------------- #-----This is the common during effect. It'll occur regardless of DSE tagging. def common_during(target, skill) #--- if skill == nil # Regular Attack else # Skill Effect end #--- end #----------------------------------------------------------------------------- def effect_after(skill, afterskill) line_number = @message_window.line_number case afterskill #--------------------------------------------------------------------------- # ////////////////////////////////////////////////////////////////////////// # This is where you begin adding in your own after skill effects. #--------------------------------------------------------------------------- when 1 @active_battler.maxhp = 10000 @active_battler.hp = 10000 sound = RPG::SE.new("Item1", 80, 100) sound.play refresh_onscreenstatus # if KGC_OnScreenStatus is imported text = sprintf ("%s becomes really awesome!", @active_battler.name) @message_window.add_instant_text(text) msgwait @message_window.back_to(line_number) when 2 when 3 #--------------------------------------------------------------------------- # This is the part you guys shouldn't touch afterwards. # ////////////////////////////////////////////////////////////////////////// #--------------------------------------------------------------------------- end end #----------------------------------------------------------------------------- #-----This is the common after effect. It'll occur regardless of ASE tagging. def common_after(skill) end #----------------------------------------------------------------------------- def custom_ani(targets, customani) case customani #--------------------------------------------------------------------------- # ////////////////////////////////////////////////////////////////////////// # This is where you begin adding in your own custom skill animations. #--------------------------------------------------------------------------- when 1 # Plays a fire sword animation if user's current HP is above 50%. if @active_battler.hp > (@active_battler.maxhp / 2) display_normal_animation(targets, 8) else display_normal_animation(targets, 7) end when 2 when 3 #--------------------------------------------------------------------------- # This is the part you guys shouldn't touch afterwards. # ////////////////////////////////////////////////////////////////////////// #--------------------------------------------------------------------------- end wait(20) wait_for_animation end end # Scene_Battle class Game_Battler def cost_custom(skill, return_value) cost_icon = 0 cost_name = "" cost_name2 = "" cost_value = 0 can_use = true skill_case = skill.cost_custom case skill_case #--------------------------------------------------------------------------- # ////////////////////////////////////////////////////////////////////////// # This is where you begin editting your own custom costs. #--------------------------------------------------------------------------- when 1 cost_icon = 1 cost_name = "Mastery" cost_name2 = "Mastery Requirement" cost_value = 10 if cost_value > $game_variables[1] can_use = false end when 2 cost_icon = 64 cost_name = "Pots" cost_name2 = "Requires" cost_value = 3 if cost_value > $game_party.item_number($data_items[1]) can_use = false end when 3 cost_icon = 65 cost_name = "Ether" cost_name2 = "Requires" cost_value = 0 if cost_value > $game_party.item_number($data_items[1]) can_use = false end #--------------------------------------------------------------------------- # This is the part you guys shouldn't touch afterwards. # ////////////////////////////////////////////////////////////////////////// #--------------------------------------------------------------------------- end return cost_icon if return_value == 1 return cost_name if return_value == 2 return cost_value if return_value == 3 return can_use if return_value == 4 return cost_name2 if return_value == 5 end #----------------------------------------------------------------------------- #-----This is where all undergo one final cost calculation before returning. def calc_cost_common(cost, skill) return cost end #----------------------------------------------------------------------------- end # Game_Battler class Scene_Battle < Scene_Base def apply_custom_cost(battler, skill) skill_case = skill.cost_custom case skill_case #--------------------------------------------------------------------------- # ////////////////////////////////////////////////////////////////////////// # This is where you perform the custom costs. #--------------------------------------------------------------------------- when 1 $game_variables[1] -= 10 when 2 $game_party.gain_item($data_items[1], -3) when 3 $game_party.gain_item($data_items[1], -1) #--------------------------------------------------------------------------- # This is the part you guys shouldn't touch afterwards. # ////////////////////////////////////////////////////////////////////////// #--------------------------------------------------------------------------- end end end # Scene_Battle #=============================================================================== # Editting anything past this point may potentially result in causing computer # damage, incontinence, explosion of user's head, coma, death, and/or halitosis. # Therefore, edit at your own risk. #=============================================================================== module YE module REGEXP module BASEITEM # These affect the skill costs. COST_CURMP = /<(?:COST_CURMP|cost curmp|cost cur mp)[ ]*(\d+)>/i COST_MAXMP = /<(?:COST_MAXMP|cost maxmp|cost max mp)[ ]*(\d+)>/i COST_CURHP = /<(?:COST_CURMP|cost curhp|cost cur hp)[ ]*(\d+)>/i COST_MAXHP = /<(?:COST_MAXMP|cost maxhp|cost max hp)[ ]*(\d+)>/i COST_GOLD = /<(?:COST_GOLD|cost gold)[ ]*(\d+)>/i COST_MGOLD = /<(?:COST_MAXGOLD|cost maxgold|cost max gold)[ ]*(\d+)>/i COST_RAGE = /<(?:COST_RAGE|cost rage)[ ]*(\d+)>/i RAGE_BOOST = /<(?:RAGE_BOOST|rage boost)[ ]*(\d+)>/i COST_CUSTOM = /<(?:COST_CUSTOM|cost custom)[ ]*(\d+)>/i # This affects other skill properties. UNREFLECT = /<(?:UNREFLECT|unreflectable)>/i SUICIDE = /<(?:SUICIDE|self destruct)>/i # This affects skill requirements REQUIRE_LEVEL = /<(?:REQUIRE_LEVEL|require level)[ ]*(\d+)>/i REQUIRE_LEARN = /<(?:NOT_REQUIRE_LEARN|not require learn)>/i REQUIRE_ELE_ALL = /<(?:REQUIRE_ALL_ELEMENTS|require all elements)[ ]*(\d+(?:\s*,\s*\d+)*)>/i REQUIRE_ELE_ANY = /<(?:REQUIRE_ANY_ELEMENTS|require any elements)[ ]*(\d+(?:\s*,\s*\d+)*)>/i REQUIRE_STATE_ALL = /<(?:REQUIRE_ALL_STATES|require all states)[ ]*(\d+(?:\s*,\s*\d+)*)>/i REQUIRE_STATE_ANY = /<(?:REQUIRE_ANY_STATES|require any states)[ ]*(\d+(?:\s*,\s*\d+)*)>/i REQUIRE_ITEM_ALL = /<(?:REQUIRE_ALL_ITEMS|require all items)[ ]*(\d+(?:\s*,\s*\d+)*)>/i REQUIRE_ITEM_ANY = /<(?:REQUIRE_ANY_ITEMS|require any items)[ ]*(\d+(?:\s*,\s*\d+)*)>/i REQUIRE_WPN_ALL = /<(?:REQUIRE_ALL_WEAPONS|require all weapons)[ ]*(\d+(?:\s*,\s*\d+)*)>/i REQUIRE_WPN_ANY = /<(?:REQUIRE_ANY_WEAPONS|require any weapons)[ ]*(\d+(?:\s*,\s*\d+)*)>/i REQUIRE_ARM_ALL = /<(?:REQUIRE_ALL_ARMOURS|require all armours|require all armors)[ ]*(\d+(?:\s*,\s*\d+)*)>/i REQUIRE_ARM_ANY = /<(?:REQUIRE_ANY_ARMOURS|require any armours|require any armors)[ ]*(\d+(?:\s*,\s*\d+)*)>/i MIX_ITEMS_ALL = /<(?:MIX_ITEMS_ALL|MIX_TYPE_ALL|mix items all|mix type all)>/i MIX_ITEMS = /<(?:MIX_TYPE|mix type)[ ]*(\d+(?:\s*,\s*\d+)*)>/i DONT_MIX = /<(?:DONT_MIX|DO_NOT_MIX|dont mix|do not mix)>/i INSTANT_CAST = /<(?:INSTANT_CAST|instant cast)>/i SUBSKILLS = /<(?:SUBSKILLS|sub skills)[ ]*(\d+(?:\s*,\s*\d+)*)>/i SUBSKILL_ONLY = /<(?:SUBSKILL_ONLY|subskill only)>/i # Hit Learn skill properties HIT_LEARN_ACTOR = /<(?:HIT_LEARN_ACTOR|hit learn actor)[ ]*(\d+(?:\s*,\s*\d+)*)>/i HIT_LEARN_CLASS = /<(?:HIT_LEARN_CLASS|hit learn class)[ ]*(\d+(?:\s*,\s*\d+)*)>/i # Chain skill properties UNCHAINABLE = /<(?:UNCHAINABLE|nonchainable)>/i RESELECT_CHAIN = /<(?:RESELECTABLE|reselect chain)>/i OPEN_CHAIN = /<(?:OPEN_CHAIN|open chain)[ ]*(\d+)>/i CLOSED_CHAIN = /<(?:CLOSED_CHAIN|closed chain)[ ]*(\d+):(\d+(?:\s*,\s*\d+)*)>/i CLOSED_TYPE = /<(?:CLOSED_TYPE|closed type)[ ]*(\d+(?:\s*,\s*\d+)*)>/i FORCED_CHAIN = /<(?:FORCED_CHAIN|forced chain)[ ]*(\d+):(\d+(?:\s*,\s*\d+)*)>/i # Throw Item skill properties THROW_ALL = /<(?:THROW_ALL|throw all)>/i THROW_TYPE = /<(?:THROW_TYPE|throw type)[ ]*(\d+(?:\s*,\s*\d+)*)>/i THROWABLE = /<(?:THROWABLE|can throw)>/i UNTHROWABLE = /<(?:UNTHROWABLE|can not throw)>/i # These affect other parts of the skill. CAST_TIME = /<(?:CAST_TIME|cast time)[ ]*(\d+)>/i RECHARGE = /<(?:RECHARGE|cooldown)[ ]*(\d+)>/i LIMITUSES = /<(?:LIMIT_USES|limit uses)[ ]*(\d+)>/i FATIGUEVAL = /<(?:FATIGUE|tired)[ ]*(\d+)>/i PREPARE = /<(?:PREPARE|warmup)[ ]*(\d+)>/i # These are for custom skill effects. EFFECT_BEFORE = /<(?:EFFECT_BEFORE|effect before|before effect|bse)[ ]*(\d+)>/i EFFECT_CHARGE = /<(?:EFFECT_CHARGE|effect charge|charge effect|cse)[ ]*(\d+)>/i EFFECT_DURING = /<(?:EFFECT_DURING|effect during|during effect|dse)[ ]*(\d+)>/i EFFECT_AFTER = /<(?:EFFECT_AFTER|effect after|after effect|ase)[ ]*(\d+)>/i # These are for conditional skill animations. CUSTOM_ANI = /<(?:CUSTOM_ANI|custom ani|custom animation|csa)[ ]*(\d+)>/i end #module BASEITEM module STATE # This affects other skill properties. REFLECT = /<(?:REFLECT|reflectable)>/i RAGE_BOOST_PER = /<(?:RAGE_BOOST_PER|rage boost per)[ ]*(\d+)>/i RAGE_BOOST_ADD = /<(?:RAGE_BOOST_ADD|rage boost add)[ ]*(\d+)>/i RAGE_BOOST_SUB = /<(?:RAGE_BOOST_SUB|rage boost sub)[ ]*(\d+)>/i # This affects the skill cost modifiers. COST_HP_PER = /<(?:COST_HP_PER|cost hp per)[ ]*(\d+)>/i COST_HP_ADD = /<(?:COST_HP_ADD|cost hp add)[ ]*(\d+)>/i COST_HP_SUB = /<(?:COST_HP_SUB|cost hp sub)[ ]*(\d+)>/i COST_MP_PER = /<(?:COST_MP_PER|cost mp per)[ ]*(\d+)>/i COST_MP_ADD = /<(?:COST_MP_ADD|cost mp add)[ ]*(\d+)>/i COST_MP_SUB = /<(?:COST_MP_SUB|cost mp sub)[ ]*(\d+)>/i COST_GOLD_PER = /<(?:COST_GOLD_PER|cost gold per)[ ]*(\d+)>/i COST_GOLD_ADD = /<(?:COST_GOLD_ADD|cost gold add)[ ]*(\d+)>/i COST_GOLD_SUB = /<(?:COST_GOLD_SUB|cost gold sub)[ ]*(\d+)>/i COST_MAXG_PER = /<(?:COST_MAXGOLD_PER|cost maxgold per)[ ]*(\d+)>/i COST_MAXG_ADD = /<(?:COST_MAXGOLD_ADD|cost maxgold add)[ ]*(\d+)>/i COST_MAXG_SUB = /<(?:COST_MAXGOLD_SUB|cost maxgold sub)[ ]*(\d+)>/i COST_RAGE_PER = /<(?:COST_RAGE_PER|cost rage per)[ ]*(\d+)>/i COST_RAGE_ADD = /<(?:COST_RAGE_ADD|cost rage add)[ ]*(\d+)>/i COST_RAGE_SUB = /<(?:COST_RAGE_SUB|cost rage sub)[ ]*(\d+)>/i end # STATE end # REGEXP end # YE #=============================================================================== # RPG::State #=============================================================================== class RPG::State #-------------------------------------------------------------------------- # Yanfly_Cache_CSE #-------------------------------------------------------------------------- def yanfly_cache_state_cse @reflect = false; @rage_boost_per = 100; @rage_boost_set = 0 @cost_hp_per = 100; @cost_hp_set = 0; @cost_mp_per = 100; @cost_mp_set = 0 @cost_gold_per = 100; @cost_gold_set = 0; @cost_maxgold_per = 100; @cost_maxgold_set = 0; @cost_rage_per = 100; @cost_rage_set = 0 self.note.split(/[\r\n]+/).each { |line| case line when YE::REGEXP::STATE::REFLECT @reflect = true when YE::REGEXP::STATE::RAGE_BOOST_PER @rage_boost_per = $1.to_i when YE::REGEXP::STATE::RAGE_BOOST_ADD @rage_boost_set = $1.to_i when YE::REGEXP::STATE::RAGE_BOOST_SUB @rage_boost_set = $1.to_i * -1 when YE::REGEXP::STATE::COST_HP_PER @cost_hp_per = $1.to_i when YE::REGEXP::STATE::COST_HP_ADD @cost_hp_set = $1.to_i when YE::REGEXP::STATE::COST_HP_SUB @cost_hp_set = $1.to_i *-1 when YE::REGEXP::STATE::COST_MP_PER @cost_mp_per = $1.to_i when YE::REGEXP::STATE::COST_MP_ADD @cost_mp_set = $1.to_i when YE::REGEXP::STATE::COST_MP_SUB @cost_mp_set = $1.to_i * -1 when YE::REGEXP::STATE::COST_GOLD_PER @cost_gold_per = $1.to_i when YE::REGEXP::STATE::COST_GOLD_ADD @cost_gold_set = $1.to_i when YE::REGEXP::STATE::COST_GOLD_SUB @cost_gold_set = $1.to_i * -1 when YE::REGEXP::STATE::COST_MAXG_PER @cost_maxgold_per = $1.to_i when YE::REGEXP::STATE::COST_MAXG_ADD @cost_maxgold_set = $1.to_i when YE::REGEXP::STATE::COST_MAXG_SUB @cost_maxgold_set = $1.to_i * -1 when YE::REGEXP::STATE::COST_RAGE_PER @cost_rage_per = $1.to_i when YE::REGEXP::STATE::COST_RAGE_ADD @cost_rage_set = $1.to_i when YE::REGEXP::STATE::COST_RAGE_SUB @cost_rage_set = $1.to_i * -1 end } end # end yanfly_cache_state_cse #-------------------------------------------------------------------------- # Reflect #-------------------------------------------------------------------------- def reflect yanfly_cache_state_cse if @reflect == nil return @reflect end #-------------------------------------------------------------------------- # Rage Boost States #-------------------------------------------------------------------------- def rage_boost_per yanfly_cache_state_cse if @rage_boost_per == nil return @rage_boost_per end def rage_boost_set yanfly_cache_state_cse if @rage_boost_set == nil return @rage_boost_set end #-------------------------------------------------------------------------- # Cost HP States #-------------------------------------------------------------------------- def cost_hp_per yanfly_cache_state_cse if @cost_hp_per == nil return @cost_hp_per end def cost_hp_set yanfly_cache_state_cse if @cost_hp_set == nil return @cost_hp_set end #-------------------------------------------------------------------------- # Cost MP States #-------------------------------------------------------------------------- def cost_mp_per yanfly_cache_state_cse if @cost_mp_per == nil return @cost_mp_per end def cost_mp_set yanfly_cache_state_cse if @cost_mp_set == nil return @cost_mp_set end #-------------------------------------------------------------------------- # Cost Gold States #-------------------------------------------------------------------------- def cost_gold_per yanfly_cache_state_cse if @cost_gold_per == nil return @cost_gold_per end def cost_gold_set yanfly_cache_state_cse if @cost_gold_set == nil return @cost_gold_set end #-------------------------------------------------------------------------- # Cost Gold States #-------------------------------------------------------------------------- def cost_maxgold_per yanfly_cache_state_cse if @cost_maxgold_per == nil return @cost_maxgold_per end def cost_maxgold_set yanfly_cache_state_cse if @cost_maxgold_set == nil return @cost_maxgold_set end #-------------------------------------------------------------------------- # Cost Rage States #-------------------------------------------------------------------------- def cost_rage_per yanfly_cache_state_cse if @cost_rage_per == nil return @cost_rage_per end def cost_rage_set yanfly_cache_state_cse if @cost_rage_set == nil return @cost_rage_set end end # end RPG::State #=============================================================================== # RPG::BaseItem #=============================================================================== class RPG::BaseItem #-------------------------------------------------------------------------- # Yanfly_Cache_CSE #-------------------------------------------------------------------------- def yanfly_cache_baseitem_cse @unreflectable = false; @bse = 0; @cse = 0; @dse = 0; @ase = 0; @csa = 0 @cur_mp_cost = 0; @max_mp_cost = 0; @cur_hp_cost = 0; @max_hp_cost = 0 @gold_cost = 0; @maxgold_cost = 0; @rage_cost = 0; @cost_custom = 0 @cast_time = 0; @recharge = 0; @prepare = 0; @usage = 0; @rage_boost = 0 @fatigue = 0; @mix_items = false; @mix_types = []; @mix_items_all = false; @dont_mix = false; @subskills = []; @instant_cast = false @hit_learn_actor = []; @hit_learn_class = []; @hit_learnable = false @subskill_only = false; @require_learn = true; @suicide = false @required_all_elements = []; @required_any_elements = []; @require_level = 0 @required_all_states = []; @required_any_states = [] @required_all_items = []; @required_any_items = []; @required_all_weapons = []; @required_any_weapons = []; @required_all_armours = []; @required_any_armours = []; @unchainable = false; @reselect_chain = false; @closed_type = [] @chain_type = 0 # 0:none 1:open 2:limit 3:forced @chain_times = 0; @chain_array = [] @throw_all = false; @throw_type = []; @throw_skill = false if self.is_a?(RPG::Item) @throwable = YE::BATTLE::DEFAULT_THROW_ITEM elsif self.is_a?(RPG::Weapon) @throwable = YE::BATTLE::DEFAULT_THROW_WEAPON elsif self.is_a?(RPG::Armor) @throwable = YE::BATTLE::DEFAULT_THROW_ARMOUR else @throwable = false end self.note.split(/[\r\n]+/).each { |line| case line when YE::REGEXP::BASEITEM::UNREFLECT @unreflectable = true when YE::REGEXP::BASEITEM::SUICIDE @suicide = true when YE::REGEXP::BASEITEM::REQUIRE_LEVEL @require_level = $1.to_i when YE::REGEXP::BASEITEM::REQUIRE_LEARN @require_learn = false when YE::REGEXP::BASEITEM::REQUIRE_ELE_ALL $1.scan(/\d+/).each { |num| if num.to_i > 0 @required_all_elements.push(num.to_i) end } when YE::REGEXP::BASEITEM::REQUIRE_ELE_ANY $1.scan(/\d+/).each { |num| if num.to_i > 0 @required_any_elements.push(num.to_i) end } when YE::REGEXP::BASEITEM::REQUIRE_STATE_ALL $1.scan(/\d+/).each { |num| if num.to_i > 0 @required_all_states.push(num.to_i) end } when YE::REGEXP::BASEITEM::REQUIRE_STATE_ANY $1.scan(/\d+/).each { |num| if num.to_i > 0 @required_any_states.push(num.to_i) end } when YE::REGEXP::BASEITEM::REQUIRE_ITEM_ALL $1.scan(/\d+/).each { |num| if num.to_i > 0 @required_all_items.push(num.to_i) end } when YE::REGEXP::BASEITEM::REQUIRE_ITEM_ANY $1.scan(/\d+/).each { |num| if num.to_i > 0 @required_any_items.push(num.to_i) end } when YE::REGEXP::BASEITEM::REQUIRE_WPN_ALL $1.scan(/\d+/).each { |num| if num.to_i > 0 @required_all_weapons.push(num.to_i) end } when YE::REGEXP::BASEITEM::REQUIRE_WPN_ANY $1.scan(/\d+/).each { |num| if num.to_i > 0 @required_any_weapons.push(num.to_i) end } when YE::REGEXP::BASEITEM::REQUIRE_ARM_ALL $1.scan(/\d+/).each { |num| if num.to_i > 0 @required_all_armours.push(num.to_i) end } when YE::REGEXP::BASEITEM::REQUIRE_ARM_ANY $1.scan(/\d+/).each { |num| if num.to_i > 0 @required_any_armours.push(num.to_i) end } when YE::REGEXP::BASEITEM::MIX_ITEMS @instant_cast = false @mix_items = true $1.scan(/\d+/).each { |num| if num.to_i > 0 @mix_types.push(num.to_i) end } when YE::REGEXP::BASEITEM::MIX_ITEMS_ALL @instant_cast = false @mix_items = true @mix_items_all = true when YE::REGEXP::BASEITEM::DONT_MIX @dont_mix = true when YE::REGEXP::BASEITEM::INSTANT_CAST @instant_cast = true when YE::REGEXP::BASEITEM::SUBSKILLS $1.scan(/\d+/).each { |num| if num.to_i > 0 @subskills.push(num.to_i) end } when YE::REGEXP::BASEITEM::SUBSKILL_ONLY @subskill_only = true when YE::REGEXP::BASEITEM::HIT_LEARN_ACTOR @hit_learnable = true $1.scan(/\d+/).each { |num| if num.to_i > 0 @hit_learn_actor.push(num.to_i) end } when YE::REGEXP::BASEITEM::HIT_LEARN_CLASS @hit_learnable = true $1.scan(/\d+/).each { |num| if num.to_i > 0 @hit_learn_class.push(num.to_i) end } when YE::REGEXP::BASEITEM::UNCHAINABLE @unchainable = true when YE::REGEXP::BASEITEM::RESELECT_CHAIN @reselect_chain = true when YE::REGEXP::BASEITEM::OPEN_CHAIN @instant_cast = false @chain_type = 1 @chain_times = $1.to_i when YE::REGEXP::BASEITEM::CLOSED_CHAIN @instant_cast = false @chain_type = 2 @chain_times = $1.to_i $2.scan(/\d+/).each { |num| if num.to_i > 0 @chain_array.push(num.to_i) end } when YE::REGEXP::BASEITEM::CLOSED_TYPE $1.scan(/\d+/).each { |num| if num.to_i > 0 @closed_type.push(num.to_i) end } when YE::REGEXP::BASEITEM::FORCED_CHAIN @instant_cast = false @chain_type = 3 @chain_times = $1.to_i $2.scan(/\d+/).each { |num| if num.to_i > 0 @chain_array.push(num.to_i) end } when YE::REGEXP::BASEITEM::THROW_ALL @throw_skill = true @throw_all = true when YE::REGEXP::BASEITEM::THROW_TYPE @throw_skill = true @throwable = true $1.scan(/\d+/).each { |num| if num.to_i > 0 @throw_type.push(num.to_i) end } when YE::REGEXP::BASEITEM::THROWABLE @throwable = true when YE::REGEXP::BASEITEM::UNTHROWABLE @throwable = false when YE::REGEXP::BASEITEM::EFFECT_BEFORE @bse = $1.to_i when YE::REGEXP::BASEITEM::EFFECT_CHARGE @cse = $1.to_i when YE::REGEXP::BASEITEM::EFFECT_DURING @dse = $1.to_i when YE::REGEXP::BASEITEM::EFFECT_AFTER @ase = $1.to_i when YE::REGEXP::BASEITEM::CUSTOM_ANI @csa = $1.to_i when YE::REGEXP::BASEITEM::COST_CURMP @cur_mp_cost = $1.to_i when YE::REGEXP::BASEITEM::COST_MAXMP @max_mp_cost = $1.to_i when YE::REGEXP::BASEITEM::COST_CURHP @cur_hp_cost = $1.to_i when YE::REGEXP::BASEITEM::COST_MAXHP @max_hp_cost = $1.to_i when YE::REGEXP::BASEITEM::COST_GOLD @gold_cost = $1.to_i when YE::REGEXP::BASEITEM::COST_MGOLD @maxgold_cost = $1.to_i when YE::REGEXP::BASEITEM::COST_RAGE @rage_cost = $1.to_i when YE::REGEXP::BASEITEM::COST_CUSTOM @cost_custom = $1.to_i when YE::REGEXP::BASEITEM::CAST_TIME @cast_time = $1.to_i when YE::REGEXP::BASEITEM::RECHARGE @recharge = $1.to_i when YE::REGEXP::BASEITEM::PREPARE @prepare = $1.to_i when YE::REGEXP::BASEITEM::LIMITUSES @usage = $1.to_i when YE::REGEXP::BASEITEM::RAGE_BOOST @rage_boost = $1.to_i when YE::REGEXP::BASEITEM::FATIGUEVAL @fatigue = $1.to_i end } end # end yanfly_cache_cse #-------------------------------------------------------------------------- # Misc Properties #-------------------------------------------------------------------------- def unreflectable yanfly_cache_baseitem_cse if @unreflectable == nil return @unreflectable end def suicide yanfly_cache_baseitem_cse if @suicide == nil return @suicide end #-------------------------------------------------------------------------- # Requirements #-------------------------------------------------------------------------- def require_level yanfly_cache_baseitem_cse if @require_level == nil return @require_level end def require_learn yanfly_cache_baseitem_cse if @require_learn == nil return @require_learn end def required_all_elements yanfly_cache_baseitem_cse if @required_all_elements == nil return @required_all_elements end def required_any_elements yanfly_cache_baseitem_cse if @required_any_elements == nil return @required_any_elements end def required_all_states yanfly_cache_baseitem_cse if @required_all_states == nil return @required_all_states end def required_any_states yanfly_cache_baseitem_cse if @required_any_states == nil return @required_any_states end def required_all_items yanfly_cache_baseitem_cse if @required_all_items == nil return @required_all_items end def required_any_items yanfly_cache_baseitem_cse if @required_any_items == nil return @required_any_items end def required_all_weapons yanfly_cache_baseitem_cse if @required_all_weapons == nil return @required_all_weapons end def required_any_weapons yanfly_cache_baseitem_cse if @required_any_weapons == nil return @required_any_weapons end def required_all_armours yanfly_cache_baseitem_cse if @required_all_armours == nil return @required_all_armours end def required_any_armours yanfly_cache_baseitem_cse if @required_any_armours == nil return @required_any_armours end #-------------------------------------------------------------------------- # Mix Items #-------------------------------------------------------------------------- def mix_items yanfly_cache_baseitem_cse if @mix_items == nil return @mix_items end def mix_items_all yanfly_cache_baseitem_cse if @mix_items_all == nil return @mix_items_all end def mix_types yanfly_cache_baseitem_cse if @mix_types == nil return @mix_types end def dont_mix yanfly_cache_baseitem_cse if @dont_mix == nil return @dont_mix end #-------------------------------------------------------------------------- # Instant Cast #-------------------------------------------------------------------------- def instant_cast yanfly_cache_baseitem_cse if @instant_cast == nil return @instant_cast end #-------------------------------------------------------------------------- # Subskills #-------------------------------------------------------------------------- def subskills yanfly_cache_baseitem_cse if @subskills == nil return @subskills end def subskill_only yanfly_cache_baseitem_cse if @subskill_only == nil return @subskill_only end #-------------------------------------------------------------------------- # Hit Learn #-------------------------------------------------------------------------- def hit_learnable? yanfly_cache_baseitem_cse if @hit_learnable == nil return @hit_learnable end def hit_learn_actor yanfly_cache_baseitem_cse if @hit_learn_actor == nil return @hit_learn_actor end def hit_learn_class yanfly_cache_baseitem_cse if @hit_learn_class == nil return @hit_learn_class end #-------------------------------------------------------------------------- # Chain Skills #-------------------------------------------------------------------------- def unchainable yanfly_cache_baseitem_cse if @unchainable == nil return @unchainable end def reselect_chain yanfly_cache_baseitem_cse if @reselect_chain == nil return @reselect_chain end def chain_type yanfly_cache_baseitem_cse if @chain_type == nil return @chain_type end def closed_type yanfly_cache_baseitem_cse if @closed_type == nil return @closed_type end def chain_times yanfly_cache_baseitem_cse if @chain_times == nil return @chain_times end def chain_array yanfly_cache_baseitem_cse if @chain_array == nil return @chain_array end #-------------------------------------------------------------------------- # Throw Skill #-------------------------------------------------------------------------- def throw_skill yanfly_cache_baseitem_cse if @throw_skill == nil return @throw_skill end def throw_all yanfly_cache_baseitem_cse if @throw_all == nil return @throw_all end def throw_type yanfly_cache_baseitem_cse if @throw_type == nil return @throw_type end def throwable? yanfly_cache_baseitem_cse if @throwable == nil return @throwable end #-------------------------------------------------------------------------- # Before/During/After Checks. Conditional Animation Check. #-------------------------------------------------------------------------- def bse yanfly_cache_baseitem_cse if @bse == nil return @bse end def cse yanfly_cache_baseitem_cse if @cse == nil return @cse end def dse yanfly_cache_baseitem_cse if @dse == nil return @dse end def ase yanfly_cache_baseitem_cse if @ase == nil return @ase end def csa yanfly_cache_baseitem_cse if @csa == nil return @csa end #-------------------------------------------------------------------------- # Cost Checks #-------------------------------------------------------------------------- def cur_mp_cost yanfly_cache_baseitem_cse if @cur_mp_cost == nil return @cur_mp_cost end def max_mp_cost yanfly_cache_baseitem_cse if @max_mp_cost == nil return @max_mp_cost end def cur_hp_cost yanfly_cache_baseitem_cse if @cur_hp_cost == nil return @cur_hp_cost end def max_hp_cost yanfly_cache_baseitem_cse if @max_hp_cost == nil return @max_hp_cost end def gold_cost yanfly_cache_baseitem_cse if @gold_cost == nil return @gold_cost end def maxgold_cost yanfly_cache_baseitem_cse if @maxgold_cost == nil return @maxgold_cost end def rage_cost yanfly_cache_baseitem_cse if @rage_cost == nil return @rage_cost end def cost_custom yanfly_cache_baseitem_cse if @cost_custom == nil return @cost_custom end #-------------------------------------------------------------------------- # Charge Time/Recharge/Prepare/Usage/Rage Boost/Fatigue #-------------------------------------------------------------------------- def cast_time yanfly_cache_baseitem_cse if @cast_time == nil return @cast_time end def recharge yanfly_cache_baseitem_cse if @recharge == nil return @recharge end def prepare yanfly_cache_baseitem_cse if @prepare == nil return @prepare end def usage yanfly_cache_baseitem_cse if @usage == nil return @usage end def rage_boost yanfly_cache_baseitem_cse if @rage_boost == nil return @rage_boost end def fatigue yanfly_cache_baseitem_cse if @fatigue == nil return @fatigue end end # RPG::BaseItem #=============================================================================== # Game_Actor #=============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # alias setup #-------------------------------------------------------------------------- alias setup_cse setup unless $@ def setup(actor_id) setup_cse(actor_id) @mix_flag = false @scd = {} reset_recharge @slu = {} reset_usage end #-------------------------------------------------------------------------- # set_chain #-------------------------------------------------------------------------- def set_chain(array1 = nil, array2 = nil) @chain_skills = array1 @chain_targets = array2 end #-------------------------------------------------------------------------- # reset mix items #-------------------------------------------------------------------------- def reset_mix_items @mix_item_1 = nil @mix_item_2 = nil @mix_item_skill = nil end #-------------------------------------------------------------------------- # recharge definitions #-------------------------------------------------------------------------- def reset_recharge @scd = {} if @scd == nil for skill in skills @scd[skill.id] = 0 end end #-------------------------------------------------------------------------- # limited uses definitions #-------------------------------------------------------------------------- def reset_usage @slu = {} if @slu == nil for skill in skills @slu[skill.id] = 0 end end #-------------------------------------------------------------------------- # alias skills #-------------------------------------------------------------------------- alias skills_cse skills unless $@ def skills result = skills_cse for skill in result result -= [skill] if skill.subskill_only end return result end #-------------------------------------------------------------------------- # alias skill_can_use? #-------------------------------------------------------------------------- alias skill_can_use_actor_cse skill_can_use? unless $@ def skill_can_use?(skill) if skill == nil return false elsif @subskill_flag == true return super elsif skill.subskills != [] and @subskill_flag != true return true else return skill_can_use_actor_cse(skill) end end end # Game_Actor #=============================================================================== # Game_Enemy #=============================================================================== class Game_Enemy < Game_Battler #-------------------------------------------------------------------------- # alias initialize #-------------------------------------------------------------------------- alias initialize_enemy_cse initialize unless $@ def initialize(index, enemy_id) initialize_enemy_cse(index, enemy_id) @scd = {} reset_recharge @slu = {} reset_usage end #-------------------------------------------------------------------------- # recharge definitions #-------------------------------------------------------------------------- def reset_recharge @scd = {} if @scd == nil for action in enemy.actions next if action.kind != 1 skill = $data_skills[action.skill_id] @scd[skill.id] = 0 end end #-------------------------------------------------------------------------- # limited uses definitions #-------------------------------------------------------------------------- def reset_usage @slu = {} if @slu == nil for action in enemy.actions next if action.kind != 1 skill = $data_skills[action.skill_id] @slu[skill.id] = 0 end end end # Game_Enemy #=============================================================================== # Game_Battler #=============================================================================== class Game_Battler #-------------------------------------------------------------------------- # Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :mix_item_1 attr_accessor :mix_item_2 attr_accessor :mix_item_skill attr_accessor :chain_skills attr_accessor :chain_targets attr_accessor :subskill_flag attr_accessor :throw_item #-------------------------------------------------------------------------- # alias initialize #-------------------------------------------------------------------------- alias initialize_cse initialize unless $@ def initialize @rage = 0 @charge_turns = 0 @charge_skill = nil @fatigue = 0 initialize_cse end #-------------------------------------------------------------------------- # recharge definitions #-------------------------------------------------------------------------- def recharge(skill_id) @scd = {} if @scd == nil return 0 if skill_id == nil @scd[skill_id] = 0 if @scd[skill_id] == nil x = @scd[skill_id] return x end def make_recharge(skill, amount) amount = 0 if amount < 0 @scd = {} if @scd == nil @scd[skill.id] = amount end def update_recharge @scd = {} if @scd == nil @scd.each_key {|key| @scd[key] = 0 if @scd[key] == nil @scd[key] -= 1 @scd[key] = 0 if @scd[key] < 0 } end #-------------------------------------------------------------------------- # limited uses definitions #-------------------------------------------------------------------------- def usage(skill_id) @slu = {} if @slu == nil return 0 if skill_id == nil @slu[skill_id] = 0 if @slu[skill_id] == nil x = @slu[skill_id] return x end def update_usage(skill_id) @slu = {} if @slu == nil @slu[skill_id] = 0 if @slu[skill_id] == nil @slu[skill_id] = @slu[skill_id] + 1 end #-------------------------------------------------------------------------- # alias inputable? #-------------------------------------------------------------------------- alias inputable_cse inputable? unless $@ def inputable? return false if @fatigue >= 1 return false if (@charge_skill != nil) and (@charge_turns > 0) inputable_cse end #-------------------------------------------------------------------------- # reflect #-------------------------------------------------------------------------- def reflect for state in states return true if state.reflect end return false end #-------------------------------------------------------------------------- # Cost Mods #-------------------------------------------------------------------------- def cost_hp_mod(value) states.each { |state| value = value * state.cost_hp_per / 100 value += state.cost_hp_set } return value end def cost_mp_mod(value) states.each { |state| value = value * state.cost_mp_per / 100 value += state.cost_mp_set } return value end def cost_gold_mod(value) states.each { |state| value = value * state.cost_gold_per / 100 value += state.cost_gold_set } return value end def cost_maxgold_mod(value) states.each { |state| value = value * state.cost_maxgold_per / 100 value += state.cost_maxgold_set } return value end def cost_rage_mod(value) states.each { |state| value = value * state.cost_rage_per / 100 value += state.cost_rage_set } return value end #-------------------------------------------------------------------------- # rage definitions #-------------------------------------------------------------------------- def rage @rage = 0 if @rage == nil or @rage < 0 @rage = YE::BATTLE::MAX_RAGE if @rage > YE::BATTLE::MAX_RAGE return @rage end def rage=(new_rage) @rage = new_rage @rage = 0 if @rage < 0 @rage = YE::BATTLE::MAX_RAGE if @rage > YE::BATTLE::MAX_RAGE end def rage_boost_mod(value) states.each { |state| value = value * state.rage_boost_per / 100 value += state.rage_boost_set } value = 0 if value < 0 return value end #-------------------------------------------------------------------------- # cast time definitions #-------------------------------------------------------------------------- def charge_turns return @charge_turns end def charge_turns=(new_charge_turn) @charge_turns = (new_charge_turn) end def charge_skill return @charge_skill end def charge_skill=(new_skill) @charge_skill = new_skill end def make_charge(skill) @charge_turns = skill.cast_time @charge_skill = skill end def reset_charging if @charge_skill != nil make_recharge(@charge_skill, @charge_skill.recharge) end @charge_turns = 0 @charge_skill = nil end def update_charging if @charge_skill != nil @charge_turns -= 1 csekeep = true csekeep = false if dead? csekeep = false if !exist? csekeep = false if !movable? csekeep = false if berserker? csekeep = false if confusion? if !csekeep reset_charging end end end #-------------------------------------------------------------------------- # fatigue definitions #-------------------------------------------------------------------------- def fatigue return @fatigue end def fatigue=(new_fatigue) @fatigue = new_fatigue @fatigue = 0 if fatigue < 0 end def make_fatigue(skill) @fatigue = skill.fatigue end def update_fatigue @fatigue -= 1 end #-------------------------------------------------------------------------- # Create Cost Icon #-------------------------------------------------------------------------- def create_cost_icon(skill) if skill.cost_custom > 0 icon = cost_custom(skill, 1) elsif skill.cur_mp_cost > 0 icon = YE::BATTLE::MP_ICON elsif skill.max_mp_cost > 0 icon = YE::BATTLE::MP_ICON elsif skill.cur_hp_cost > 0 icon = YE::BATTLE::HP_ICON elsif skill.max_hp_cost > 0 icon = YE::BATTLE::HP_ICON elsif skill.gold_cost > 0 icon = YE::BATTLE::GOLD_ICON elsif skill.maxgold_cost > 0 icon = YE::BATTLE::GOLD_ICON elsif skill.rage_cost > 0 icon = YE::BATTLE::RAGE_ICON else icon = YE::BATTLE::MP_ICON end if skill.subskills != [] and self.subskill_flag != true icon = 0 end return icon end #-------------------------------------------------------------------------- # Calculation of MP Consumed for Skills #-------------------------------------------------------------------------- def calc_mp_cost(skill) recharge = self.recharge(skill.id) if recharge > 0 and YE::BATTLE::REPLACE_ICON_RECHARGE cost = recharge elsif skill.cost_custom > 0 cost = cost_custom(skill, 3) elsif skill.cur_mp_cost > 0 cost = skill.cur_mp_cost cost /= 2 if half_mp_cost cost = cost_mp_mod(cost) elsif skill.max_mp_cost > 0 cost = skill.max_mp_cost * maxmp cost /= 100 cost /= 2 if half_mp_cost cost = cost_mp_mod(cost) elsif skill.cur_hp_cost > 0 cost = skill.cur_hp_cost cost = cost_hp_mod(cost) elsif skill.max_hp_cost > 0 cost = skill.max_hp_cost * maxhp cost /= 100 cost = cost_hp_mod(cost) elsif skill.gold_cost > 0 cost = skill.gold_cost cost = cost_gold_mod(cost) cost = 0 unless self.actor? elsif skill.maxgold_cost > 0 cost = skill.maxgold_cost cost = cost_maxgold_mod(cost) cost = 0 unless self.actor? elsif skill.rage_cost > 0 cost = skill.rage_cost cost = cost_rage_mod(cost) else cost = skill.mp_cost cost /= 2 if half_mp_cost cost = cost_mp_mod(cost) end cost = 0 if cost <= 0 return calc_cost_common(cost, skill) end #-------------------------------------------------------------------------- # overwrite skill_can_use? #-------------------------------------------------------------------------- def skill_can_use?(skill) return false unless skill.is_a?(RPG::Skill) return false unless movable? return false if silent? and skill.spi_f > 0 #--- if $imported["BattlerStatMorale"] and skill.requires_morale if skill.required_morale >= 0 return false if skill.required_morale > self.morale elsif skill.required_morale < 0 return false if skill.required_morale < self.morale end end if $imported["EquipSkillSlots"] return false unless can_use_limit_type?(skill) end #--- return false unless custom_skill_requirements(skill) #--- if skill.throw_skill return false if @throw_item != nil and !$game_party.has_item?(@throw_item) end recharge = self.recharge(skill.id) recharge = 0 unless $scene.is_a?(Scene_Battle) usage = self.usage(skill.id) usage = 0 unless $scene.is_a?(Scene_Battle) cost = calc_mp_cost(skill) if recharge > 0 return false elsif skill.cost_custom > 0 can_use = cost_custom(skill, 4) return false if can_use == false elsif skill.usage > 0 return false if usage >= skill.usage elsif skill.cur_mp_cost > 0 return false if cost > mp elsif skill.max_mp_cost > 0 return false if cost > mp elsif skill.cur_hp_cost > 0 if !YE::BATTLE::ALLOW_DEATH_HP_COST return false if cost > self.hp end elsif skill.max_hp_cost > 0 if !YE::BATTLE::ALLOW_DEATH_HP_COST return false if cost > self.hp end elsif skill.gold_cost > 0 return false if cost > $game_party.gold elsif skill.maxgold_cost > 0 cost *= $game_party.gold cost /= 100 return false if $game_party.gold < cost return false if cost == 0 elsif skill.rage_cost > 0 return false if cost > self.rage else return false if cost > mp end #--- if $game_temp.in_battle return skill.battle_ok? else return skill.menu_ok? end end #-------------------------------------------------------------------------- # custom_skill_requirements #-------------------------------------------------------------------------- def custom_skill_requirements(skill) return true if !self.actor? #--- if skill.required_all_elements != [] for ele_id in skill.required_all_elements next if self.element_set.include?(ele_id) return false end end if skill.required_any_elements != [] possess_element = false for ele_id in skill.required_any_elements possess_element = true if self.element_set.include?(ele_id) end return false unless possess_element end #--- if skill.required_all_states != [] for state_id in skill.required_all_states return false unless self.states.include?($data_states[state_id]) end end if skill.required_any_states != [] possess_state = false for state_id in skill.required_any_states possess_state = true if self.states.include?($data_states[state_id]) end return false unless possess_state end #--- if skill.required_all_items != [] for item_id in skill.required_all_items return false unless $game_party.has_item?($data_items[item_id]) end end if skill.required_any_items != [] possess_item = false for item_id in skill.required_any_states possess_item = true if $game_party.has_item?($data_items[item_id]) end return false unless possess_item end #--- if skill.required_all_weapons != [] for item_id in skill.required_all_weapons return false unless $game_party.has_item?($data_weapons[item_id]) end end if skill.required_any_weapons != [] possess_item = false for item_id in skill.required_any_weapons possess_item = true if $game_party.has_item?($data_weapons[item_id]) end return false unless possess_item end #--- if skill.required_all_armours != [] for item_id in skill.required_all_armours return false unless $game_party.has_item?($data_armors[item_id]) end end if skill.required_any_armours != [] possess_item = false for item_id in skill.required_any_armours possess_item = true if $game_party.has_item?($data_armors[item_id]) end return false unless possess_item end #--- return true end #-------------------------------------------------------------------------- # alias attack_effect #-------------------------------------------------------------------------- alias attack_effect_cse attack_effect unless $@ def attack_effect(attacker) attack_effect_cse(attacker) if YE::BATTLE::INC_RAGE_ATTACK attacker.rage += YE::BATTLE::NUM_RAGE_ATTACK end end #-------------------------------------------------------------------------- # alias skill_effect #-------------------------------------------------------------------------- alias skill_effect_cse skill_effect unless $@ def skill_effect(user, skill) if skill.throw_skill and user.throw_item != nil throw_effect(user, skill, user.throw_item) else skill_effect_cse(user, skill) end if $scene.is_a?(Scene_Battle) user.rage += YE::BATTLE::NUM_RAGE_SKILL if YE::BATTLE::INC_RAGE_SKILL rb = user.rage_boost_mod(skill.rage_boost) user.rage += rb end if $scene.is_a?(Scene_Battle) user.make_recharge(skill, skill.recharge) user.update_usage(skill.id) unless $scene.usage_flag $scene.set_usage end end #-------------------------------------------------------------------------- # throw_effect #-------------------------------------------------------------------------- def throw_effect(user, skill, item) clear_action_results if rand(100) >= calc_hit(user) @missed = true return end if rand(100) < calc_eva(user) @evaded = true return end make_throw_damage_value(user, skill, item) make_obj_absorb_effect(user, skill) execute_damage(user) if skill.physical_attack and @hp_damage == 0 return end apply_state_changes(skill) end #-------------------------------------------------------------------------- # make_throw_damage_value #-------------------------------------------------------------------------- def make_throw_damage_value(user, skill, item) damage = skill.base_damage throw_power = eval(YE::BATTLE::THROW_POWER) damage += eval(YE::BATTLE::THROW_ATTACKER) damage -= eval(YE::BATTLE::THROW_DEFENDER) damage *= elements_max_rate(item.element_set) damage /= 100 damage = apply_variance(damage, skill.variance) damage = apply_guard(damage) if skill.damage_to_mp @mp_damage = damage else @hp_damage = damage end end #-------------------------------------------------------------------------- # hit_learn? #-------------------------------------------------------------------------- def hit_learn?(skill) return false unless self.actor? return false unless skill.hit_learnable? return false if self.skill_learn?(skill) return false if self.dead? return true if skill.hit_learn_actor.include?(self.id) return true if skill.hit_learn_class.include?(self.class.id) if $imported["SubclassSelectionSystem"] and self.subclass != nil and YE::BATTLE::SUBCLASS_HIT_LEARN return true if skill.hit_learn_class.include?(self.subclass.id) end return false end end #class Game_Battler #=============================================================================== # Game_BattleAction #=============================================================================== class Game_BattleAction #-------------------------------------------------------------------------- # alias valid #-------------------------------------------------------------------------- alias valid_cse valid? unless $@ def valid? battler.update_recharge if battler.fatigue >= 1 battler.update_fatigue return false end return true if battler.charge_turns >= 1 and battler.charge_skill != nil and !battler.dead? valid_cse end #-------------------------------------------------------------------------- # perform_charge_skill #-------------------------------------------------------------------------- def perform_charge_skill @forcing = true decide_last_target set_skill(battler.charge_skill.id) $game_troop.forcing_battler = @active_battler end end #=============================================================================== # Scene Battle #=============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # Refresh OnScreenStatus #-------------------------------------------------------------------------- def refresh_onscreenstatus @onscreen_status_window.refresh if $imported["OnScreenStatus"] end #-------------------------------------------------------------------------- # Message Wait #-------------------------------------------------------------------------- def msgwait wait(YE::BATTLE::MSGWAIT) end #-------------------------------------------------------------------------- # alias process_battle_start #-------------------------------------------------------------------------- alias process_battle_start_cps process_battle_start unless $@ def process_battle_start for actor in $game_party.members actor_reset(actor) create_prep_charge_actor(actor) end for battler in $game_troop.members create_prep_charge_enemy(battler) end process_battle_start_cps end #-------------------------------------------------------------------------- # alias battle_end #-------------------------------------------------------------------------- alias battle_end_cse battle_end unless $@ def battle_end(result) for actor in $game_party.members actor_reset(actor) end battle_end_cse(result) end #-------------------------------------------------------------------------- # actor reset #-------------------------------------------------------------------------- def actor_reset(actor) actor.rage = 0 if YE::BATTLE::RAGE_RESET_BATTLE actor.charge_turns = 0 actor.charge_skill = nil actor.fatigue = 0 actor.reset_recharge actor.subskill_flag = nil actor.set_chain end #-------------------------------------------------------------------------- # create preparation charging #-------------------------------------------------------------------------- def create_prep_charge_actor(actor) for skill in actor.skills next if skill == nil actor.make_recharge(skill, skill.prepare) end end #-------------------------------------------------------------------------- # create preparation charging #-------------------------------------------------------------------------- def create_prep_charge_enemy(battler) for action in battler.enemy.actions if action.kind == 1 skill = $data_skills[action.skill_id] battler.make_recharge(skill, skill.prepare) end end end #-------------------------------------------------------------------------- # alias update_actor_command_selection #-------------------------------------------------------------------------- alias update_actor_command_selection_cse update_actor_command_selection unless $@ def update_actor_command_selection if Input.trigger?(Input::B) @active_battler.reset_mix_items @active_battler.subskill_flag = nil @active_battler.set_chain elsif Input.trigger?(Input::C) and !$imported["CustomBattleActions"] @active_battler.reset_mix_items @active_battler.subskill_flag = nil @active_battler.set_chain end update_actor_command_selection_cse end #-------------------------------------------------------------------------- # alias update_target_enemy_selection #-------------------------------------------------------------------------- alias update_target_enemy_selection_cse update_target_enemy_selection unless $@ def update_target_enemy_selection if Input.trigger?(Input::B) if @mix_item_window != nil @mix_item_window.active = true @active_battler.mix_item_2 = nil @mix_item_window.refresh elsif @subskill_window != nil @subskill_window.active = true elsif @chain_window != nil @chain_window.active = true @chain_array.delete_at (@chain_array.size - 1) @chain_targets.delete_at (@chain_targets.size - 1) @chain_info.refresh(@chain_array) @chain_window.refresh(@chain_array) else @active_battler.reset_mix_items end end if Input.trigger?(Input::C) and @chain_window != nil add_chain_targets else update_target_enemy_selection_cse end end #-------------------------------------------------------------------------- # alias update_target_actor_selection #-------------------------------------------------------------------------- alias update_target_actor_selection_cse update_target_actor_selection unless $@ def update_target_actor_selection if Input.trigger?(Input::B) if @mix_item_window != nil @mix_item_window.active = true @active_battler.mix_item_2 = nil @mix_item_window.refresh elsif @subskill_window != nil @subskill_window.active = true elsif @chain_window != nil @chain_window.active = true @chain_array.delete_at (@chain_array.size - 1) @chain_targets.delete_at (@chain_targets.size - 1) @chain_info.refresh(@chain_array) @chain_window.refresh(@chain_array) else @active_battler.reset_mix_items end end if Input.trigger?(Input::C) and @chain_window != nil add_chain_targets else update_target_actor_selection_cse end end #-------------------------------------------------------------------------- # alias next_actor #-------------------------------------------------------------------------- alias next_actor_cse next_actor unless $@ def next_actor if instant_cast_skill? perform_instant_cast if @active_battler.inputable? start_actor_command_selection else next_actor_cse end else next_actor_cse end end #-------------------------------------------------------------------------- # instant_cast_skill? #-------------------------------------------------------------------------- def instant_cast_skill? return false if @active_battler == nil return false unless @active_battler.action.skill? return false unless @active_battler.action.skill.instant_cast return true end #-------------------------------------------------------------------------- # perform instant cast #-------------------------------------------------------------------------- def perform_instant_cast @message_window.clear @message_window.visible = true unless $imported["SceneBattleReDux"] and @redux_msg @info_viewport.visible = false end cast_the_skill(@active_battler.action.skill) unless $imported["SceneBattleReDux"] and @redux_msg @info_viewport.visible = true end @message_window.visible = false @status_window.refresh end #-------------------------------------------------------------------------- # alias determine skill #-------------------------------------------------------------------------- alias determine_skill_cse determine_skill unless $@ def determine_skill if @skill.mix_items create_mix_item_windows elsif @skill.subskills != [] create_subskill_windows elsif @skill.chain_type > 0 create_chain_windows elsif @skill.throw_skill create_throw_windows else determine_skill_cse end end #-------------------------------------------------------------------------- # alias end_skill_selection #-------------------------------------------------------------------------- alias end_skill_selection_cse end_skill_selection unless $@ def end_skill_selection if @mix_item_window != nil @mix_item_window.dispose @mix_item_window = nil end if @subskill_window != nil @subskill_window.dispose @subskill_window = nil end if @chain_window != nil @chain_window.dispose @chain_window = nil end if @chain_info != nil @chain_info.dispose @chain_info = nil end if @throw_window != nil @throw_window.dispose @throw_window = nil end end_skill_selection_cse end #-------------------------------------------------------------------------- # create_mix_item_windows #-------------------------------------------------------------------------- def create_mix_item_windows sk = @skill @active_battler.action.set_skill(@skill.id) @mix_item_window = Window_Mix_Item.new(0, 56, 544, 232, @active_battler, sk) @mix_item_window.help_window = @help_window if $imported["HelpExtension"] @mix_item_window.y = @help_window.height @mix_item_window.height = Graphics.height - (@help_window.height + @status_window.height) @mix_item_window.refresh end @mix_item_window.active = true @skill_window.active = false @skill_window.visible = false end #-------------------------------------------------------------------------- # end_mix_item #-------------------------------------------------------------------------- def end_mix_item if $imported["CustomBattleActions"] if @active_battler.custom_action_flag == true end_skill_selection end end if @skill_window != nil @skill_window.active = true @skill_window.visible = true end if @mix_item_window != nil @mix_item_window.dispose @mix_item_window = nil end @active_battler.reset_mix_items end #-------------------------------------------------------------------------- # alias update_skill_selection #-------------------------------------------------------------------------- alias update_skill_selection_cse update_skill_selection unless $@ def update_skill_selection if @mix_item_window != nil and @mix_item_window.active update_mix_item elsif @subskill_window != nil and @subskill_window.active update_subskill elsif @chain_window != nil and @chain_window.active update_chain_skill elsif @throw_window != nil and @throw_window.active update_throw_skill else update_skill_selection_cse end end #-------------------------------------------------------------------------- # update_mix_item #-------------------------------------------------------------------------- def update_mix_item @mix_item_window.update @help_window.update if Input.trigger?(Input::B) if @active_battler.mix_item_1 == nil and @active_battler.mix_item_2 == nil Sound.play_cancel end_mix_item elsif @active_battler.mix_item_2 != nil Sound.play_cancel @active_battler.mix_item_2 = nil @mix_item_window.refresh elsif @active_battler.mix_item_1 != nil Sound.play_cancel @active_battler.mix_item_1 = nil @mix_item_window.refresh end elsif Input.trigger?(Input::C) item = @mix_item_window.item if item == nil Sound.play_buzzer elsif @active_battler.mix_item_1 == nil Sound.play_decision @active_battler.mix_item_1 = item.id elsif @active_battler.mix_item_2 == nil if item.id == @active_battler.mix_item_1 and $game_party.item_number(item) < 2 Sound.play_buzzer else @active_battler.mix_item_2 = item.id determine_mix_item end end @mix_item_window.refresh if @mix_item_window != nil end end #-------------------------------------------------------------------------- # determine_mix_item #-------------------------------------------------------------------------- def determine_mix_item item1 = @active_battler.mix_item_1 item2 = @active_battler.mix_item_2 combo_hash = YE::BATTLE::ITEM_MIX_COMBO_HASH if combo_hash.include?([item1, item2]) if YE::BATTLE::SUCCESSFUL_ITEM_MIX != nil YE::BATTLE::SUCCESSFUL_ITEM_MIX.play else Sound.play_decision end combo_array = combo_hash[[item1, item2]] @active_battler.mix_item_skill = combo_array[rand(combo_array.size)] elsif combo_hash.include?([item2, item1]) if YE::BATTLE::SUCCESSFUL_ITEM_MIX != nil YE::BATTLE::SUCCESSFUL_ITEM_MIX.play else Sound.play_decision end combo_array = combo_hash[[item2, item1]] @active_battler.mix_item_skill = combo_array[rand(combo_array.size)] else Sound.play_decision select_random_mix_item_skill(item1, item2) end item_skill = $data_skills[@active_battler.mix_item_skill] if item_skill.need_selection? if item_skill.for_opponent? start_target_enemy_selection else start_target_actor_selection end else end_skill_selection next_actor end end #-------------------------------------------------------------------------- # select_random_mix_item_skill #-------------------------------------------------------------------------- def select_random_mix_item_skill(item1, item2) random_hash = YE::BATTLE::RANDOM_ITEM_MIX_TYPES random_array = [] for type in $data_items[item1].mix_types random_array += random_hash[type] if random_hash.include?(type) end for type in $data_items[item2].mix_types random_array += random_hash[type] if random_hash.include?(type) end random_array = random_hash[0] if random_array == [] @active_battler.mix_item_skill = random_array[rand(random_array.size)] end #-------------------------------------------------------------------------- # create_subskill_windows #-------------------------------------------------------------------------- def create_subskill_windows sk = @skill @active_battler.subskill_flag = true @active_battler.action.set_skill(@skill.id) @subskill_window = Window_Subskills.new(0,56,544,232,@active_battler, sk) @subskill_window.help_window = @help_window if $imported["HelpExtension"] @subskill_window.y = @help_window.height @subskill_window.height = Graphics.height - (@help_window.height + @status_window.height) @subskill_window.refresh end @subskill_window.active = true @skill_window.active = false @skill_window.visible = false end #-------------------------------------------------------------------------- # update subskill #-------------------------------------------------------------------------- def update_subskill @subskill_window.update @help_window.update if $imported["DisplaySkillQuery"] and YE::MENU::SKILL::BATTLE_HELP_SHOW if @skill_data_window.active @help_info_window.visible = false elsif @subskill_window.active @help_info_window.visible = true else @help_info_window.visible = false end else @help_info_window.visible = false if $imported["DisplaySkillQuery"] end if Input.trigger?(Input::B) Sound.play_cancel @subskill_window.dispose @subskill_window = nil @skill_window.active = true @skill_window.visible = true @active_battler.subskill_flag = nil if $imported["CustomBattleActions"] if @active_battler.custom_action_flag == true @help_info_window.visible = false if $imported["DisplaySkillQuery"] end_skill_selection end end elsif Input.trigger?(Input::C) @skill = @subskill_window.skill if @active_battler.skill_can_use?(@skill) Sound.play_decision @help_info_window.visible = false if $imported["DisplaySkillQuery"] determine_subskill else Sound.play_buzzer end elsif $imported["DisplaySkillQuery"] and Input.trigger?(YE::MENU::SKILL::SKILL_QUERY_BATTLE_BUTTON) skill = @subskill_window.skill if skill != nil Sound.play_decision @skill_data_window.appear(skill, @subskill_window, @active_battler) @subskill_window.active = false else Sound.play_buzzer end end end #-------------------------------------------------------------------------- # determine_subskill #-------------------------------------------------------------------------- def determine_subskill @active_battler.action.set_skill(@skill.id) @subskill_window.active = false if @skill.need_selection? if @skill.for_opponent? start_target_enemy_selection else start_target_actor_selection end else end_skill_selection next_actor end end #-------------------------------------------------------------------------- # create chain windows #-------------------------------------------------------------------------- def create_chain_windows sk = @skill @chain_array = [] @chain_targets = [] @active_battler.subskill_flag = true @active_battler.action.set_skill(@skill.id) @chain_window = Window_Chain_Skill.new(0,56,272,232,@active_battler, sk) @chain_window.help_window = @help_window @chain_info = Window_Chain_Info.new(272,56,272,232,@active_battler, sk) if $imported["HelpExtension"] @chain_window.y = @help_window.height @chain_info.y = @help_window.height @chain_window.height = Graphics.height - (@help_window.height + @status_window.height) @chain_info.height = Graphics.height - (@help_window.height + @status_window.height) @chain_window.refresh @chain_window.refresh(@chain_array) @chain_info.refresh(@chain_array) end @chain_window.active = true @skill_window.active = false @skill_window.visible = false end #-------------------------------------------------------------------------- # update chain skill #-------------------------------------------------------------------------- def update_chain_skill @chain_window.update @help_window.update if $imported["DisplaySkillQuery"] and YE::MENU::SKILL::BATTLE_HELP_SHOW if @skill_data_window.active @help_info_window.visible = false elsif @chain_window.active @help_info_window.visible = true else @help_info_window.visible = false end else @help_info_window.visible = false if $imported["DisplaySkillQuery"] end if Input.trigger?(Input::B) Sound.play_cancel if @chain_array == [] @active_battler.set_chain @chain_window.dispose @chain_window = nil @chain_info.dispose @chain_info = nil @skill_window.active = true @skill_window.visible = true if $imported["CustomBattleActions"] if @active_battler.custom_action_flag == true @help_info_window.visible = false if $imported["DisplaySkillQuery"] end_skill_selection end end else @chain_array.delete_at (@chain_array.size - 1) @chain_targets.delete_at (@chain_targets.size - 1) @chain_info.refresh(@chain_array) @chain_window.refresh(@chain_array) end elsif Input.trigger?(Input::C) skill = @chain_window.skill if select_chain_valid?(skill) @help_info_window.visible = false if $imported["DisplaySkillQuery"] determine_chain(skill) else Sound.play_buzzer end elsif $imported["DisplaySkillQuery"] and Input.trigger?(YE::MENU::SKILL::SKILL_QUERY_BATTLE_BUTTON) skill = @chain_window.skill if skill != nil Sound.play_decision @skill_data_window.appear(skill, @chain_window, @active_battler, 2) @chain_window.active = false else Sound.play_buzzer end end end #-------------------------------------------------------------------------- # select chain valid #-------------------------------------------------------------------------- def select_chain_valid?(skill) return false if !@skill.reselect_chain and @chain_array.include?(skill.id) return false if @chain_array.size >= @skill.chain_times return true end #-------------------------------------------------------------------------- # determine chain #-------------------------------------------------------------------------- def determine_chain(skill) Sound.play_decision skill = @chain_window.skill @chain_array.push(skill.id) @chain_window.refresh(@chain_array) @chain_info.refresh(@chain_array) if skill.need_selection? @chain_window.active = false if skill.for_opponent? start_target_enemy_selection else start_target_actor_selection end else add_chain_targets end end #-------------------------------------------------------------------------- # add chain targets #-------------------------------------------------------------------------- def add_chain_targets if @target_actor_window != nil and @target_actor_window.visible Sound.play_decision @chain_targets.push(@target_actor_window.index) end_target_actor_selection elsif @target_enemy_window != nil and @target_enemy_window.visible Sound.play_decision @chain_targets.push(@target_enemy_window.index) end_target_enemy_selection else @chain_targets.push(0) end @active_battler.set_chain(@chain_array, @chain_targets) if @chain_array.size >= @skill.chain_times end_skill_selection end_item_selection next_actor else @chain_window.active = true end end #-------------------------------------------------------------------------- # create_throw_windows #-------------------------------------------------------------------------- def create_throw_windows sk = @skill @active_battler.throw_item = nil @active_battler.action.set_skill(@skill.id) @throw_window = Window_Throw.new(0, 56, 544, 232, sk) @throw_window.help_window = @help_window if $imported["HelpExtension"] @throw_window.y = @help_window.height @throw_window.height = Graphics.height - (@help_window.height + @status_window.height) @throw_window.refresh end @throw_window.active = true @skill_window.active = false @skill_window.visible = false end #-------------------------------------------------------------------------- # update_throw_skill #-------------------------------------------------------------------------- def update_throw_skill @throw_window.update @help_window.update if Input.trigger?(Input::B) Sound.play_cancel @throw_window.dispose @throw_window = nil @skill_window.active = true @skill_window.visible = true if $imported["CustomBattleActions"] if @active_battler.custom_action_flag == true @help_info_window.visible = false if $imported["DisplaySkillQuery"] end_skill_selection end end elsif Input.trigger?(Input::C) item = @throw_window.item if item == nil Sound.play_buzzer return end @active_battler.throw_item = @throw_window.item Sound.play_decision determine_throw_skill end end #-------------------------------------------------------------------------- # determine_throw_skill #-------------------------------------------------------------------------- def determine_throw_skill @active_battler.action.set_skill(@skill.id) @throw_window.active = false if @skill.need_selection? if @skill.for_opponent? start_target_enemy_selection else start_target_actor_selection end else end_skill_selection next_actor end end #-------------------------------------------------------------------------- # alias display_hp_damage #-------------------------------------------------------------------------- alias display_hp_damage_cse display_hp_damage unless $@ def display_hp_damage(target, obj = nil) if target.hp_damage > 0 and YE::BATTLE::INC_RAGE_DAMAGED target.rage += YE::BATTLE::NUM_RAGE_DAMAGED end display_hp_damage_cse(target, obj) end #-------------------------------------------------------------------------- # alias execute_action #-------------------------------------------------------------------------- alias execute_action_cse execute_action unless $@ def execute_action if @active_battler.charge_skill != nil @active_battler.update_charging if @active_battler.charge_turns <= 0 @active_battler.action.perform_charge_skill else name = @active_battler.name skill = @active_battler.charge_skill.name text = sprintf(YE::BATTLE::CHARGE_CON, name, skill) @message_window.add_instant_text(text) wait(60) end end execute_action_cse end #-------------------------------------------------------------------------- # usage flag #-------------------------------------------------------------------------- def usage_flag @usage_flag = false if @usage_flag == nil return @usage_flag end def set_usage @usage_flag = true end #-------------------------------------------------------------------------- # perform_suicide #-------------------------------------------------------------------------- def perform_suicide(skill) return unless skill.suicide return if @active_battler.dead? @active_battler.add_state(1) @active_battler.perform_collapse if $imported["SceneBattleReDux"] and @enable_popup popup_value = state.name @active_battler.popup_rules = 6 @active_battler.popup_value = sprintf(YE::REDUX::BATTLE::POPUP_ADD_ST, popup_value) end end #-------------------------------------------------------------------------- # Execute Battle Action: Skill #-------------------------------------------------------------------------- def execute_action_skill skill = @active_battler.action.skill charged = @active_battler.action.forcing @mix_item_flag = nil if skill.cast_time >= 1 and @active_battler.charge_skill == nil and !charged charge_the_skill(skill) elsif !@active_battler.actor? and @active_battler.charge_turns >= 1 #do nothing since monsters don't have an inputable? check elsif @active_battler.actor? and skill.mix_items and @active_battler.mix_item_skill != nil set_mix_skill(skill) elsif @active_battler.actor? and skill.chain_type > 0 chain_cast_skill(skill) elsif @active_battler.actor? and skill.throw_skill execute_throw_skill(skill) else cast_the_skill(skill) end end # end execute_action_skill #-------------------------------------------------------------------------- # charge_the_skill #-------------------------------------------------------------------------- def charge_the_skill(skill) sound = YE::BATTLE::CHARGE_SND sound.play unless $imported["SceneBattleReDux"] and !YE::REDUX::BATTLE::MSG_CURRENT_ACTION text = sprintf(YE::BATTLE::CHARGE_MSG, @active_battler.name, skill.name) @message_window.add_instant_text(text) end apply_skill_cost(@active_battler, skill) @active_battler.make_charge(skill) refresh_onscreenstatus effect_charge(skill, skill.cse) if skill.cse > 0 common_charge(skill) msgwait end #-------------------------------------------------------------------------- # set_mix_skill #-------------------------------------------------------------------------- def set_mix_skill(skill) unless $imported["SceneBattleReDux"] and !YE::REDUX::BATTLE::MSG_CURRENT_ACTION unless skill.message1.empty? text = @active_battler.name + skill.message1 @message_window.add_instant_text(text) end unless skill.message2.empty? wait(10) @message_window.add_instant_text(skill.message2) end msgwait end effect_before(skill, skill.bse) if skill.bse > 0 common_before(skill) apply_skill_cost(@active_battler, skill) refresh_onscreenstatus @message_window.clear @mix_item_flag = true item1 = $data_items[@active_battler.mix_item_1] item2 = $data_items[@active_battler.mix_item_2] #--- if @active_battler.mix_item_1 == @active_battler.mix_item_1 @mix_item_flag = false if $game_party.item_number(item1) < 2 else @mix_item_flag = false if $game_party.item_number(item1) < 1 @mix_item_flag = false if $game_party.item_number(item2) < 1 end #--- if @mix_item_flag $game_party.gain_item(item1, -1) $game_party.gain_item(item2, -1) skill = $data_skills[@active_battler.mix_item_skill] @active_battler.action.set_skill(skill.id) cast_the_skill(skill) else text = YE::BATTLE::NOT_ENOUGH_ITEMS @message_window.add_instant_text(text) end @message_window.clear effect_after(skill, skill.ase) if skill.ase > 0 common_after(skill) @active_battler.reset_mix_items @active_battler.reset_charging perform_suicide(skill) end #-------------------------------------------------------------------------- # chain_cast_skill #-------------------------------------------------------------------------- def chain_cast_skill(skill) unless $imported["SceneBattleReDux"] and !YE::REDUX::BATTLE::MSG_CURRENT_ACTION unless skill.message1.empty? text = @active_battler.name + skill.message1 @message_window.add_instant_text(text) end unless skill.message2.empty? wait(10) @message_window.add_instant_text(skill.message2) end msgwait end effect_before(skill, skill.bse) if skill.bse > 0 common_before(skill) #--- for i in 0..(@active_battler.chain_skills.size - 1) chainskill = $data_skills[@active_battler.chain_skills[i]] next if chainskill == nil @active_battler.action.set_skill(chainskill.id) @active_battler.action.target_index = @active_battler.chain_targets[i] next unless @active_battler.action.valid? @message_window.clear cast_the_skill(@active_battler.action.skill) end #--- @message_window.clear apply_skill_cost(@active_battler, skill) refresh_onscreenstatus effect_after(skill, skill.ase) if skill.ase > 0 common_after(skill) @active_battler.set_chain @active_battler.reset_charging perform_suicide(skill) end #-------------------------------------------------------------------------- # execute_throw_skill #-------------------------------------------------------------------------- def execute_throw_skill(skill) unless $imported["SceneBattleReDux"] and !YE::REDUX::BATTLE::MSG_CURRENT_ACTION a1 = @active_battler.name a2 = @active_battler.throw_item.name text = sprintf(YE::BATTLE::THROW_TEXT, a1, a2) @message_window.add_instant_text(text) msgwait end targets = @active_battler.action.make_targets if skill.csa > 0 custom_ani(targets, skill.csa) elsif @active_battler.throw_item.is_a?(RPG::Armor) display_animation(targets, skill.animation_id) else display_animation(targets, @active_battler.throw_item.animation_id) end apply_skill_cost(@active_battler, skill) refresh_onscreenstatus effect_before(skill, skill.bse) if skill.bse > 0 common_before(skill) @usage_flag = false for target in targets target.skill_effect(@active_battler, skill) display_action_effects(target, skill) end for target in targets target.perform_collapse if !target.collapse and $imported["SceneBattleReDux"] if $imported["SceneBattleReDux"] and @redux_msg and target.actor? @status_window.draw_item(target.index) if target.collapse end end effect_after(skill, skill.ase) if skill.ase > 0 common_after(skill) @active_battler.make_fatigue(skill) if @active_battler.fatigue > 0 sound = YE::BATTLE::FATIGUE_SND sound.play text = sprintf(YE::BATTLE::FATIGUE_MSG, @active_battler.name) @message_window.add_instant_text(text) wait(60) end @active_battler.reset_charging $game_party.lose_item(@active_battler.throw_item, 1) perform_suicide(skill) end #-------------------------------------------------------------------------- # cast_the_skill #-------------------------------------------------------------------------- def cast_the_skill(skill) @mix_item_flag = false if @mix_item_flag == nil unless $imported["SceneBattleReDux"] and !YE::REDUX::BATTLE::MSG_CURRENT_ACTION unless skill.message1.empty? text = @active_battler.name + skill.message1 @message_window.add_instant_text(text) end unless skill.message2.empty? wait(10) @message_window.add_instant_text(skill.message2) end end targets = @active_battler.action.make_targets if skill.csa > 0 custom_ani(targets, skill.csa) else display_animation(targets, skill.animation_id) end apply_skill_cost(@active_battler, skill) unless @mix_item_flag refresh_onscreenstatus effect_before(skill, skill.bse) if skill.bse > 0 common_before(skill) @usage_flag = false for target in targets target = reflect_check(target, skill) target.skill_effect(@active_battler, skill) display_action_effects(target, skill) end for target in targets target.perform_collapse if !target.collapse and $imported["SceneBattleReDux"] if $imported["SceneBattleReDux"] and @redux_msg and target.actor? @status_window.draw_item(target.index) if target.collapse end end effect_after(skill, skill.ase) if skill.ase > 0 common_after(skill) @active_battler.make_fatigue(skill) if @active_battler.fatigue > 0 sound = YE::BATTLE::FATIGUE_SND sound.play text = sprintf(YE::BATTLE::FATIGUE_MSG, @active_battler.name) @message_window.add_instant_text(text) wait(60) end @active_battler.reset_charging if $imported["EquipSkillSlots"] and skill.skill_copy? create_skill_copy_window(skill, targets) if @active_battler.actor? else $game_temp.common_event_id = skill.common_event_id end @mix_item_flag = nil perform_suicide(skill) end #-------------------------------------------------------------------------- # Reflect Check #-------------------------------------------------------------------------- def reflect_check(target, skill) @reflected = false @origtarget = target unless skill.unreflectable if target.reflect @reflected = true if target.actor? and @active_battler.actor? target = $game_troop.random_target elsif !target.actor? and !@active_battler.actor? target = $game_party.random_target else target = @active_battler end end end return target end #-------------------------------------------------------------------------- # Show Action Results #-------------------------------------------------------------------------- def display_action_effects(target, obj = nil) unless target.skipped line_number = @message_window.line_number anti_no_effect = false wait(5) if @reflected sound = YE::BATTLE::REFLECT_SND sound.play text = sprintf(YE::BATTLE::REFLECT_MSG, @origtarget.name, obj.name) unless $imported["SceneBattleReDux"] and !@misc_msg @reflected = false @message_window.add_instant_text(text) msgwait @message_window.back_to(line_number) end end if target.critical display_critical(target, obj) wait(YE::BATTLE::CRITWAIT) @message_window.back_to(line_number) end display_damage(target, obj) if $imported["Steal"] and obj.is_a?(RPG::Skill) if obj.steal? display_stole_object(target, obj) end end if obj.is_a?(RPG::Skill) if obj.dse > 0 and !target.missed and !target.evaded effect_during(target, obj, obj.dse) anti_no_effect = true end end if $imported["EquipSkillSlots"] and obj.is_a?(RPG::Skill) anti_no_effect = true if obj.skill_copy? end common_during(target, obj) if obj.is_a?(RPG::Skill) if target.hit_learn?(obj) target.learn_skill(obj.id) text = sprintf(YE::BATTLE::HIT_LEARN_MESSAGE, target.name, obj.name) @message_window.add_instant_text(text) msgwait end end display_state_changes(target, obj) anti_no_effect = true if target.states_active? if line_number == @message_window.line_number display_failure(target, obj) unless anti_no_effect end if line_number != @message_window.line_number wait(YE::BATTLE::MSGWAIT) end @message_window.back_to(line_number) end end #-------------------------------------------------------------------------- # Apply Skill Cost #-------------------------------------------------------------------------- def apply_skill_cost(battler, skill) if battler.charge_skill == nil cost = battler.calc_mp_cost(skill) if skill.cost_custom > 0 apply_custom_cost(battler, skill) elsif skill.cur_mp_cost > 0 battler.mp -= cost elsif skill.max_mp_cost > 0 battler.mp -= cost elsif skill.cur_hp_cost > 0 battler.hp -= cost elsif skill.max_hp_cost > 0 battler.hp -= cost elsif skill.gold_cost > 0 return unless battler.actor? cost *= -1 $game_party.gain_gold(cost) elsif skill.maxgold_cost > 0 return unless battler.actor? cost *= $game_party.gold cost /= 100 cost *= -1 $game_party.gain_gold(cost) elsif skill.rage_cost > 0 battler.rage -= cost else battler.mp -= cost end end if $imported["SceneBattleReDux"] and battler.actor? @status_window.draw_item(battler.index) end end end # Scene_Battle #=============================================================================== # Scene_Skill #=============================================================================== class Scene_Skill < Scene_Base #-------------------------------------------------------------------------- # use_skill_nontarget #-------------------------------------------------------------------------- def use_skill_nontarget Sound.play_use_skill apply_skill_cost(@actor, @skill) @status_window.refresh @skill_window.refresh @target_window.refresh if $game_party.all_dead? $scene = Scene_Gameover.new elsif @skill.common_event_id > 0 $game_temp.common_event_id = @skill.common_event_id $scene = Scene_Map.new end end #-------------------------------------------------------------------------- # Apply Skill Cost #-------------------------------------------------------------------------- def apply_skill_cost(actor, skill) if actor.charge_skill == nil cost = actor.calc_mp_cost(skill) if skill.cost_custom > 0 apply_custom_cost(actor, skill) elsif skill.cur_mp_cost > 0 actor.mp -= cost elsif skill.max_mp_cost > 0 actor.mp -= cost elsif skill.cur_hp_cost > 0 actor.hp -= cost elsif skill.max_hp_cost > 0 actor.hp -= cost elsif skill.gold_cost > 0 cost *= -1 $game_party.gain_gold(cost) elsif skill.maxgold_cost > 0 cost *= $game_party.gold cost /= 100 cost *= -1 $game_party.gain_gold(cost) elsif skill.rage_cost > 0 actor.rage -= cost else actor.mp -= cost end end end #-------------------------------------------------------------------------- # use_skill_nontarget #-------------------------------------------------------------------------- def use_skill_nontarget if @skill.subskills != [] and @actor.subskill_flag == nil Sound.play_decision create_subskill_window return end Sound.play_use_skill apply_skill_cost(@actor, @skill) @status_window.refresh @skill_window.refresh @target_window.refresh if $game_party.all_dead? $scene = Scene_Gameover.new elsif @skill.common_event_id > 0 $game_temp.common_event_id = @skill.common_event_id $scene = Scene_Map.new end end #-------------------------------------------------------------------------- # create subskill window #-------------------------------------------------------------------------- def create_subskill_window y = @help_window.height + @status_window.height height = Graphics.height - @help_window.height - @status_window.height if $imported["DisplaySkillQuery"] and YE::MENU::SKILL::MENU_HELP_SHOW height -= 56 end skill = @skill @actor.subskill_flag = true @subskill_window = Window_Subskills.new(0, y, 544, height, @actor, skill) @subskill_window.active = true @subskill_window.z = 1 @subskill_window.help_window = @help_window @subskill_window.viewport = @viewport @skill_window.active = false @skill_window.visible = false end #-------------------------------------------------------------------------- # alias update #-------------------------------------------------------------------------- alias update_skill_submenu_cse update unless $@ def update if @subskill_window != nil and @subskill_window.active update_subskill_window else update_skill_submenu_cse end end #-------------------------------------------------------------------------- # update_subskill_window #-------------------------------------------------------------------------- def update_subskill_window @subskill_window.update @help_window.update if Input.trigger?(Input::B) Sound.play_cancel @actor.subskill_flag = nil @skill_window.active = true @skill_window.visible = true @subskill_window.dispose @subskill_window = nil elsif Input.trigger?(Input::R) Sound.play_cursor next_actor elsif Input.trigger?(Input::L) Sound.play_cursor prev_actor elsif Input.trigger?(Input::C) @skill = @subskill_window.skill if @actor.skill_can_use?(@skill) Sound.play_decision @subskill_window.active = false determine_skill @actor.subskill_flag = nil else Sound.play_buzzer end elsif $imported["DisplaySkillQuery"] and Input.trigger?(YE::MENU::SKILL::SKILL_QUERY_MENU_BUTTON) skill = @subskill_window.skill if skill != nil Sound.play_decision @skill_data_window.appear(skill, @subskill_window, @actor) @subskill_window.active = false else Sound.play_buzzer end end end #-------------------------------------------------------------------------- # alias hide_target_window #-------------------------------------------------------------------------- alias hide_target_window_cse hide_target_window unless $@ def hide_target_window hide_target_window_cse if @subskill_window != nil @subskill_window.active = true end end end # Scene_Skill #=============================================================================== # Window_Base #=============================================================================== class Window_Selectable < Window_Base #-------------------------------------------------------------------------- # Draw Skill #-------------------------------------------------------------------------- def draw_skill(index) rect = item_rect(index) self.contents.clear_rect(rect) skill = @data[index] if skill != nil skill_id = @data[index].id actor_id = @actor.id recharge = $game_actors[actor_id].recharge(skill_id) #--- usage = $game_actors[actor_id].usage(skill_id) if skill.usage > 0 and YE::BATTLE::REPLACE_ICON_USAGE if usage >= skill.usage usagecheck = true else usagecheck = false end end #--- rect.width -= 4 x = rect.x y = rect.y enabled = @actor.skill_can_use?(skill) #--- draw_icon(skill.icon_index, x, y, enabled) self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(x + 24, y, rect.width-84, WLH, skill.name, 0) #--- cost = @actor.calc_mp_cost(skill) if YE::BATTLE::USE_ICONS #--- Use icons rect.width -= 24 x = rect.x + rect.width y = rect.y #--- if usagecheck self.contents.draw_text(rect, "", 2) elsif recharge > 0 and YE::BATTLE::REPLACE_ICON_RECHARGE self.contents.draw_text(x-30, y, 30, WLH, recharge, 2) elsif cost == 0 self.contents.draw_text(rect, "", 2) elsif skill.maxgold_cost > 0 self.contents.draw_text(x-30, y, 30, WLH, sprintf("%d%%",cost), 2) else self.contents.draw_text(x-30, y, 30, WLH, cost, 2) end #--- if usagecheck icon = YE::BATTLE::USAGE_ICON elsif recharge > 0 and YE::BATTLE::REPLACE_ICON_RECHARGE icon = YE::BATTLE::RECHARGE_ICON elsif skill.cost_custom > 0 icon = @actor.create_cost_icon(skill) elsif cost == 0 icon = 0 else icon = @actor.create_cost_icon(skill) end draw_icon(icon, x, y, enabled) #--- else #--- Don't use icons if usagecheck text = sprintf(YE::BATTLE::USAGE_MSG, recharge) elsif recharge > 0 and YE::BATTLE::REPLACE_ICON_RECHARGE if recharge == 1 text = sprintf(YE::BATTLE::RECHARGE_MSG1, recharge) else text = sprintf(YE::BATTLE::RECHARGE_MSG, recharge) end elsif skill.cost_custom > 0 text = @actor.cost_custom(skill, 1) elsif cost == 0 text = "" elsif skill.cur_mp_cost > 0 text = sprintf(YE::BATTLE::MP_COST, cost) elsif skill.max_mp_cost > 0 text = sprintf(YE::BATTLE::MP_COST, cost) elsif skill.cur_hp_cost > 0 text = sprintf(YE::BATTLE::HP_COST, cost) elsif skill.max_hp_cost > 0 text = sprintf(YE::BATTLE::HP_COST, cost) elsif skill.gold_cost > 0 text = sprintf(YE::BATTLE::GOLD_COST, cost) elsif skill.maxgold_cost > 0 text = sprintf(YE::BATTLE::MGOLD_COST, cost) elsif skill.rage_cost > 0 text = sprintf(YE::BATTLE::RAGE_COST, cost) else text = sprintf(YE::BATTLE::MP_COST, cost) end x = rect.x + rect.width - 54 self.contents.draw_text(x, y, 54, WLH, text, 2) #--- end end end end #=============================================================================== # Window_Skill #=============================================================================== class Window_Skill < Window_Selectable #-------------------------------------------------------------------------- # Draw Item #-------------------------------------------------------------------------- def draw_item(index) draw_skill(index) end end # class Window_Skill < Window_Selectable #============================================================================== # Window_Mix_Item #============================================================================== class Window_Mix_Item < Window_Selectable #-------------------------------------------------------------------------- # initialize #-------------------------------------------------------------------------- def initialize(x, y, width, height, actor, skill) super(x, y, width, height) @column_max = 2 @actor = actor @skill = skill self.index = 0 refresh end #-------------------------------------------------------------------------- # item #-------------------------------------------------------------------------- def item return @data[self.index] end #-------------------------------------------------------------------------- # refresh #-------------------------------------------------------------------------- def refresh @data = [] for item in $game_party.items @data.push(item) if include?(item) end @item_max = @data.size create_contents for i in 0...@item_max draw_item(i) end end #-------------------------------------------------------------------------- # include? #-------------------------------------------------------------------------- def include?(item) return false unless item.is_a?(RPG::Item) return false if item.dont_mix return true if @skill.mix_items_all for type in @skill.mix_types return true if item.mix_types.include?(type) end return false end #-------------------------------------------------------------------------- # draw_item #-------------------------------------------------------------------------- def draw_item(index) self.contents.font.color = normal_color rect = item_rect(index) self.contents.clear_rect(rect) item = @data[index] if item != nil number = $game_party.item_number(item) rect.width -= 4 draw_item_name(item, rect.x, rect.y, true) self.contents.draw_text(rect, sprintf("×%2d", number), 2) end end #-------------------------------------------------------------------------- # draw item name #-------------------------------------------------------------------------- def draw_item_name(item, x, y, enabled = true) if item != nil draw_icon(item.icon_index, x, y, enabled) if item.id == @actor.mix_item_1 and item.id == @actor.mix_item_2 self.contents.font.color = text_color(YE::BATTLE::ITEM_COLOUR3) elsif item.id == @actor.mix_item_1 self.contents.font.color = text_color(YE::BATTLE::ITEM_COLOUR1) elsif item.id == @actor.mix_item_2 self.contents.font.color = text_color(YE::BATTLE::ITEM_COLOUR2) else self.contents.font.color = normal_color end self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(x + 24, y, 172, WLH, item.name) end end #-------------------------------------------------------------------------- # update help #-------------------------------------------------------------------------- def update_help @help_window.set_text(item == nil ? "" : item.description) end end #=============================================================================== # Window Subskills #=============================================================================== class Window_Subskills < Window_Selectable #-------------------------------------------------------------------------- # initialize #-------------------------------------------------------------------------- def initialize(x, y, width, height, actor, sk) super(x, y, width, height) @superskill = sk @actor = actor @column_max = 2 self.index = 0 refresh end #-------------------------------------------------------------------------- # refresh #-------------------------------------------------------------------------- def refresh @data = [] for skill_id in @superskill.subskills sk = $data_skills[skill_id] next if sk == nil @data.push(sk) if include?(sk) end @item_max = @data.size create_contents for i in 0...@item_max draw_skill(i) end end #-------------------------------------------------------------------------- # skill #-------------------------------------------------------------------------- def skill return @data[self.index] end #-------------------------------------------------------------------------- # include? #-------------------------------------------------------------------------- def include?(sk) return false if sk == nil return false if sk.require_level > @actor.level return false if sk.require_learn and !@actor.skill_learn?(sk) return false if sk.mix_items return false if sk.throw_skill return false if sk.subskills != [] return false if sk.chain_type > 0 return true end #-------------------------------------------------------------------------- # update_help #-------------------------------------------------------------------------- def update_help @help_window.set_text(skill == nil ? "" : skill.description) end end # Window_Subskills #=============================================================================== # Window Chain Skill #=============================================================================== class Window_Chain_Skill < Window_Selectable #-------------------------------------------------------------------------- # initialize #-------------------------------------------------------------------------- def initialize(x, y, width, height, actor, sk) super(x, y, width, height) @skill = sk @actor = actor @column_max = 1 self.index = 0 refresh end #-------------------------------------------------------------------------- # refresh #-------------------------------------------------------------------------- def refresh(chain_array = []) @data = [] @chain_array = chain_array array = [] #---------------------------- if @skill.chain_type == 1 for skill in @actor.skills array.push(skill.id) end end #---------------------------- if @skill.chain_type == 2 allowed_types = @skill.chain_array for sk in @actor.skills for type in sk.closed_type array.push(sk.id) if allowed_types.include?(type) end end end #---------------------------- if @skill.chain_type == 3 for skill_id in @skill.chain_array array.push(skill_id) end end #---------------------------- for skill_id in array sk = $data_skills[skill_id] next if sk == nil @data.push(sk) if include?(sk) end @item_max = @data.size create_contents for i in 0...@item_max draw_skill(i) end end #-------------------------------------------------------------------------- # skill #-------------------------------------------------------------------------- def skill return @data[self.index] end #-------------------------------------------------------------------------- # include? #-------------------------------------------------------------------------- def include?(sk) return false if sk == nil return false if sk.mix_items return false if sk.throw_skill return false if sk.require_level > @actor.level return false if sk.require_learn and !@actor.skill_learn?(sk) return false if sk.subskills != [] return false if sk.chain_type > 0 return true end #-------------------------------------------------------------------------- # Draw Skill #-------------------------------------------------------------------------- def draw_skill(index) rect = item_rect(index) self.contents.clear_rect(rect) skill = @data[index] if skill != nil skill_id = @data[index].id actor_id = @actor.id recharge = $game_actors[actor_id].recharge(skill_id) #--- usage = $game_actors[actor_id].usage(skill_id) if skill.usage > 0 and YE::BATTLE::REPLACE_ICON_USAGE if usage >= skill.usage usagecheck = true else usagecheck = false end end #--- rect.width -= 4 x = rect.x y = rect.y enabled = skill_can_use?(skill) #--- draw_icon(skill.icon_index, x, y, enabled) self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(x + 24, y, rect.width-84, WLH, skill.name, 0) #--- cost = @actor.calc_mp_cost(skill) rect.width -= 24 x = rect.x + rect.width y = rect.y #--- if usagecheck self.contents.draw_text(rect, "", 2) elsif recharge > 0 and YE::BATTLE::REPLACE_ICON_RECHARGE self.contents.draw_text(x-30, y, 30, WLH, recharge, 2) elsif cost == 0 self.contents.draw_text(rect, "", 2) elsif skill.maxgold_cost > 0 self.contents.draw_text(x-30, y, 30, WLH, sprintf("%d%%",cost), 2) else self.contents.draw_text(x-30, y, 30, WLH, cost, 2) end #--- if usagecheck icon = YE::BATTLE::USAGE_ICON elsif recharge > 0 and YE::BATTLE::REPLACE_ICON_RECHARGE icon = YE::BATTLE::RECHARGE_ICON elsif skill.cost_custom > 0 icon = @actor.create_cost_icon(skill) elsif cost == 0 icon = 0 else icon = @actor.create_cost_icon(skill) end draw_icon(icon, x, y, enabled) end end #-------------------------------------------------------------------------- # skill_can_use? #-------------------------------------------------------------------------- def skill_can_use?(sk) return false if @chain_array.include?(sk.id) and !@skill.reselect_chain return true end #-------------------------------------------------------------------------- # update_help #-------------------------------------------------------------------------- def update_help @help_window.set_text(skill == nil ? "" : skill.description) end end # Window_Chain_Skill #============================================================================== # Window_Chain_Info #============================================================================== class Window_Chain_Info < Window_Base #-------------------------------------------------------------------------- # initialize #-------------------------------------------------------------------------- def initialize(x, y, width, height, actor, sk) super(x, y, width, height) @actor = actor @skill = sk refresh end #-------------------------------------------------------------------------- # refresh #-------------------------------------------------------------------------- def refresh(array = []) self.contents.clear self.contents.font.color = normal_color @array = array draw_icon(@skill.icon_index, 0, 0) self.contents.draw_text(24, 0, 166, WLH, @skill.name, 0) text = sprintf(YE::BATTLE::CHAIN_MAX_TEXT, @array.size, @skill.chain_times) self.contents.draw_text(190, 0, 50, WLH, text, 2) draw_costs dx = 0 dy = WLH * 2 for skill_id in @array skill = $data_skills[skill_id] draw_item_name(skill, dx, dy) cost = @actor.calc_mp_cost(skill) icon = @actor.create_cost_icon(skill) draw_icon(icon, 216, dy) self.contents.draw_text(186, dy, 30, WLH, cost, 2) dy += WLH break if dy + WLH > self.height - 32 end end #-------------------------------------------------------------------------- # draw costs #-------------------------------------------------------------------------- def draw_costs icon = YE::BATTLE::MP_ICON draw_icon(icon, 44, 24) icon = YE::BATTLE::HP_ICON draw_icon(icon, 124, 24) icon = YE::BATTLE::RAGE_ICON draw_icon(icon, 204, 24) mpcost = 0; hpcost = 0; ragecost = 0 for skill_id in @array sk = $data_skills[skill_id] next if sk == nil if sk.cur_mp_cost > 0 mpcost += @actor.calc_mp_cost(sk) elsif sk.max_mp_cost > 0 mpcost += @actor.calc_mp_cost(sk) elsif sk.cur_hp_cost > 0 hpcost += @actor.calc_mp_cost(sk) elsif sk.max_hp_cost > 0 hpcost += @actor.calc_mp_cost(sk) elsif sk.rage_cost > 0 hpcost += @actor.calc_mp_cost(sk) else mpcost += @actor.calc_mp_cost(sk) end end self.contents.draw_text(12, 24, 32, WLH, mpcost, 2) self.contents.draw_text(92, 24, 32, WLH, hpcost, 2) self.contents.draw_text(172, 24, 32, WLH, ragecost, 2) end end # Window_Chain_Info #============================================================================== # Window_Throw #============================================================================== class Window_Throw < Window_Item #-------------------------------------------------------------------------- # initialize #-------------------------------------------------------------------------- def initialize(x, y, width, height, skill) @skill = skill super(x, y, width, height) end #-------------------------------------------------------------------------- # include? #-------------------------------------------------------------------------- def include?(item) return false if item == nil return false unless item.throwable? return true if @skill.throw_all for type in item.throw_type return true if @skill.throw_type.include?(type) end return false end #-------------------------------------------------------------------------- # enable? #-------------------------------------------------------------------------- def enable?(item) return true end end # Window_Throw #=============================================================================== # # END OF FILE # #===============================================================================