Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Slip Damage Change Script, version 1.0
- # Author: bgillisp
- # Released: 9/3/2014
- # This script allows you to set up certain states to not cause
- # fatal slip damage, and others which do cause fatal slip damage.
- # To use:
- # Place the script in the materials section, above main, but below
- # any scripts which overwrite add_state and remove_state. Also, this
- # script overwrites the max_slip_damage function of the Game_Battler
- # class, place this above any scripts which alias this function
- # to ensure those scripts continue to work.
- # To make a state cause fatal slip damage:
- # Add the notetag <KO on Slip> to the note box of the state which
- # is to cause the fatal slip damage. Copy and paste that notetag
- # exactly as written here.
- # To make a state not cause fatal slip damage:
- # Do nothing. The default in this script is non-fatal slip damage,
- # regardless of the setting in the database.
- # Terms of use:
- # Free for use in commercial and non-commercial games, with credit
- # given
- #--------------------------------------------------------------------------
- #Do not edit anything below here unless you know what you are doing.
- #Failure to ahead to this warning may result in unpredictable behavior in
- #your game. Consider yourself warned
- #__________________________________________________________________________
- module DataManager
- #--------------------------------------------------------------------------
- # alias method: load_database
- #--------------------------------------------------------------------------
- class <<self; alias load_database_bg_slip_damage_change load_database; end
- def self.load_database
- load_database_bg_slip_damage_change
- load_notetags_slip_damage_change
- end
- #--------------------------------------------------------------------------
- # new method: load_notetags_bg_bpbarrier
- #--------------------------------------------------------------------------
- def self. load_notetags_slip_damage_change
- groups = [$data_states]
- for group in groups
- for obj in group
- next if obj.nil?
- obj.load_notetages_slip_damage
- end
- end
- end
- end # DataManager
- class RPG::BaseItem
- attr_accessor :ko_on_slip
- def load_notetages_slip_damage
- #Set to the default
- self.ko_on_slip = false
- if(self.note[/<KO on Slip>/im])
- self.ko_on_slip = true
- end
- end
- end #End of class RPG::BaseItem
- class Game_Battler < Game_BattlerBase
- attr_accessor :ko_on_slip
- alias bg_slip_damage_change_initialize initialize
- alias bg_slip_damage_change_remove_state remove_state
- alias bg_slip_damage_change_add_state add_state
- #Alias method, initialize
- def initialize
- #Start all battlers with being unable to be KO'd on slip damage
- self.ko_on_slip = false
- #Call aliased method
- bg_slip_damage_change_initialize
- end
- #Alias method, add state
- def add_state(state_id)
- #Call aliased method
- bg_slip_damage_change_add_state(state_id)
- #Turn on ko on slip damage if the state is to do that.
- if($data_states[state_id].ko_on_slip == true)
- self.ko_on_slip = true
- end #End if statement
- end #End add state.
- #Aliased method, remove_state
- def remove_state(state_id)
- if state?(state_id)
- #Call aliased method
- bg_slip_damage_change_remove_state(state_id)
- #Turn back off slip damage if we are supposed to do that now
- if($data_states[state_id].ko_on_slip == true)
- #Check to see if other states are on that would still need slip
- #damage to be fatal
- states.each do |tempstate|
- #If we find another state that causes fatal slip damage, abort, as all
- #other work is done.
- if($data_states[tempstate.id].ko_on_slip == true && tempstate.id != state_id)
- return
- end #End of foor loop
- end #End of for loop
- self.ko_on_slip = false
- end #End if statement
- end #End check if the state is on the battler
- end #end of remove_state
- #Overwritten method max_slip_damage
- def max_slip_damage
- value_to_return = 0
- #Check to see if inflicted with something that allows ko on slip. If
- #not, then cap it at 1 HP. If so, cap is the target's hp
- if(self.ko_on_slip == true)
- value_to_return = hp
- elsif
- value_to_return = [hp - 1, 0].max
- end
- return value_to_return
- end #End of max_slip_damage
- end #End of Game_Battler Class
Advertisement
Add Comment
Please, Sign In to add comment