Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Bubble shield
#3
I looked around a bit and found this.
I haven't tested it but maybe it works for you?

Code:
#==============================================================================
# ** Power Word: Shield Status Effect
#------------------------------------------------------------------------------
# The_Falcon
# 1.0
# 1.1.07
# SDK Version : 2.3 - Parts 1
#==============================================================================
# This script overwrites the following methods:
#------------------------------------------------------------------------------
# Game_Battler : attack_effect , skill_effect , slip_damage_effect
#------------------------------------------------------------------------------
# This script aliases the following methods:
#------------------------------------------------------------------------------
# Game Battler : initialize , add_state
#==============================================================================
#How to use:
#
#Add the script under the SDK. Then you'll need to make a new state and change the PWS_ID #in the script to the ID of the effect. Then make the skills and whatnot so you can use the #new effect goofy
#Also, keep in mind, the shield is NOT meant to be dispelled, so any dispel effects will #probably screw the system up a bit.
#==============================================================================
#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log('Power Word: Shield Status Effect', 'The_Falcon', 1.0, '01.01.08')
SDK.check_requirements(2.3, [], [])
#--------------------------------------------------------------------------
# Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.enabled?('Power Word: Shield Status Effect')
 PWS_ID = 17 #ID of the power word shield state
 PWS_PERCENT = 0.2 #The percent of health you want PWS to absorb
#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
#  This class deals with battlers. It's used as a superclass for the Game_Actor
#  and Game_Enemy classes.
#==============================================================================
class Game_Battler
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_reader   :pws_hp           # Strength of PWS
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 alias pws_init initialize
 SDK.log_alias(:Game_Battler, :initialize, :pws_init)
 #--------------------------------------------------------------------------
 def initialize
   pws_init
   @pws_hp = 0
 end
 #--------------------------------------------------------------------------
 # * Add State
 #     state_id : state ID
 #     force    : forcefully added flag (used to deal with auto state)
 #--------------------------------------------------------------------------
 alias pws_add_state add_state
 SDK.log_alias(:Game_Battler, :add_state, :pws_add_state)
 #--------------------------------------------------------------------------
 def add_state(state_id, force = false)
   if state_id == PWS_ID
     @pws_hp = Integer(self.maxhp * PWS_PERCENT)
   end
   pws_add_state(state_id, force)
 end
 # log the overwrite
 SDK.log_overwrite(:Game_Battler, :attack_effect)
 #--------------------------------------------------------------------------
 # * Applying Normal Attack Effects
 #     attacker : battler
 #--------------------------------------------------------------------------
 def attack_effect(attacker)
   # Clear critical flag
   self.critical = false
   # First hit detection
   hit_result = (rand(100) < attacker.hit)
   # If hit occurs
   if hit_result == true
     # Calculate basic damage
     atk = [attacker.atk - self.pdef / 2, 0].max
     self.damage = atk * (20 + attacker.str) / 20
     # Element correction
     self.damage *= elements_correct(attacker.element_set)
     self.damage /= 100
     # If damage value is strictly positive
     if self.damage > 0
       # Critical correction
       if rand(100) < 4 * attacker.dex / self.agi
         self.damage *= 2
         self.critical = true
       end
       # Guard correction
       if self.guarding?
         self.damage /= 2
       end
     end
     # Dispersion
     if self.damage.abs > 0
       amp = [self.damage.abs * 15 / 100, 1].max
       self.damage += rand(amp+1) + rand(amp+1) - amp
     end
     # Second hit detection
     eva = 8 * self.agi / attacker.dex + self.eva
     hit = self.damage < 0 ? 100 : 100 - eva
     hit = self.cant_evade? ? 100 : hit
     hit_result = (rand(100) < hit)
   end
   # If hit occurs
   if hit_result == true
     # State Removed by Shock
     remove_states_shock
     #-------------------------------------------
     #If the shield has strength
     if state?(PWS_ID)
       if pws_hp > self.damage
         # Substract damage from the shield's strength
         @pws_hp -= self.damage
         self.damage = "Absorb"
       else
         # Substract remaining strength from damage
         self.damage -= @pws_hp
         # Substract damage from HP
         self.hp -= self.damage
         remove_state(PWS_ID)
       end
     else
       # Substract damage from HP
       self.hp -= self.damage
     end
     #-------------------------------------------
     # State change
     @state_changed = false
     states_plus(attacker.plus_state_set)
     states_minus(attacker.minus_state_set)
   # When missing
   else
     # Set damage to "Miss"
     self.damage = "Miss"
     # Clear critical flag
     self.critical = false
   end
   # End Method
   return true
 end
 # log the overwrite
 SDK.log_overwrite(:Game_Battler, :skill_effect)
 #--------------------------------------------------------------------------
 # * Apply Skill Effects
 #     user  : the one using skills (battler)
 #     skill : skill
 #--------------------------------------------------------------------------
 def skill_effect(user, skill)
   # Clear critical flag
   self.critical = false
   # If skill scope is for ally with 1 or more HP, and your own HP = 0,
   # or skill scope is for ally with 0, and your own HP = 1 or more
   if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
      ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
     # End Method
     return false
   end
   # Clear effective flag
   effective = false
   # Set effective flag if common ID is effective
   effective |= skill.common_event_id > 0
   # First hit detection
   hit = skill.hit
   if skill.atk_f > 0
     hit *= user.hit / 100
   end
   hit_result = (rand(100) < hit)
   # Set effective flag if skill is uncertain
   effective |= hit < 100
   # If hit occurs
   if hit_result == true
     # Calculate power
     power = skill.power + user.atk * skill.atk_f / 100
     if power > 0
       power -= self.pdef * skill.pdef_f / 200
       power -= self.mdef * skill.mdef_f / 200
       power = [power, 0].max
     end
     # Calculate rate
     rate = 20
     rate += (user.str * skill.str_f / 100)
     rate += (user.dex * skill.dex_f / 100)
     rate += (user.agi * skill.agi_f / 100)
     rate += (user.int * skill.int_f / 100)
     # Calculate basic damage
     self.damage = power * rate / 20
     # Element correction
     self.damage *= elements_correct(skill.element_set)
     self.damage /= 100
     # If damage value is strictly positive
     if self.damage > 0
       # Guard correction
       if self.guarding?
         self.damage /= 2
       end
     end
     # Dispersion
     if skill.variance > 0 and self.damage.abs > 0
       amp = [self.damage.abs * skill.variance / 100, 1].max
       self.damage += rand(amp+1) + rand(amp+1) - amp
     end
     # Second hit detection
     eva = 8 * self.agi / user.dex + self.eva
     hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
     hit = self.cant_evade? ? 100 : hit
     hit_result = (rand(100) < hit)
     # Set effective flag if skill is uncertain
     effective |= hit < 100
   end
   # If hit occurs
   if hit_result == true
     # If physical attack has power other than 0
     if skill.power != 0 and skill.atk_f > 0
       # State Removed by Shock
       remove_states_shock
       # Set to effective flag
       effective = true
     end
     #-------------------------------------------
     #If the shield has strength
     if state?(PWS_ID)
       if pws_hp > self.damage
         last_hp = @pws_hp
         # Substract damage from the shield's strength
         @pws_hp -= self.damage
         self.damage = "Absorb"
         effective |= @pws_hp != last_hp
       else
         # Substract damage from HP
         last_hp = @pws_hp
         # Subtract shield's last strength from damage
         self.damage -= @pws_hp
         self.hp -= self.damage
         remove_state(PWS_ID)
         effective |= self.hp != last_hp
       end
     else
       # Substract damage from HP
       last_hp = self.hp
       self.hp -= self.damage
       effective |= self.hp != last_hp
     end
     #-------------------------------------------
     # State change
     @state_changed = false
     effective |= states_plus(skill.plus_state_set)
     effective |= states_minus(skill.minus_state_set)
     # If power is 0
     if skill.power == 0
       # Set damage to an empty string
       self.damage = ""
       # If state is unchanged
       unless @state_changed
         # Set damage to "Miss"
         self.damage = "Miss"
       end
     end
   # If miss occurs
   else
     # Set damage to "Miss"
     self.damage = "Miss"
   end
   # If not in battle
   unless $game_temp.in_battle
     # Set damage to nil
     self.damage = nil
   end
   # End Method
   return effective
 end
 # log the overwrite
 SDK.log_overwrite(:Game_Battler, :slip_damage_effect)
 #--------------------------------------------------------------------------
 # * Application of Slip Damage Effects
 #--------------------------------------------------------------------------
 def slip_damage_effect
   # Set damage
   self.damage = self.maxhp / 10
   # Dispersion
   if self.damage.abs > 0
     amp = [self.damage.abs * 15 / 100, 1].max
     self.damage += rand(amp+1) + rand(amp+1) - amp
   end
   #-------------------------------------------
   #If the shield has strength
   if state?(PWS_ID)
     if pws_hp > self.damage
       # Substract damage from the shield's strength
       @pws_hp -= self.damage
       self.damage = "Absorb"
     else
       # Subtract shield's last strength from damage
       self.damage -= @pws_hp
       self.hp -= self.damage
       remove_state(PWS_ID)
     end
   else
     # Substract damage from HP
     last_hp = self.hp
     self.hp -= self.damage
   end
   #-------------------------------------------
   # End Method
   return true
 end
end
#--------------------------------------------------------------------------
# End SDK Enabled Test
#--------------------------------------------------------------------------
end
Reply }


Messages In This Thread
Bubble shield - by Fenriswolf - 12-14-2019, 11:51 PM
RE: Bubble shield - by Fenriswolf - 12-18-2019, 02:29 PM
RE: Bubble shield - by Melana - 12-19-2019, 04:05 AM
RE: Bubble shield - by DerVVulfman - 12-19-2019, 04:12 AM
RE: Bubble shield - by Fenriswolf - 12-19-2019, 01:21 PM
RE: Bubble shield - by Fenriswolf - 12-19-2019, 08:18 PM
RE: Bubble shield - by DerVVulfman - 12-20-2019, 04:42 AM
RE: Bubble shield - by Fenriswolf - 12-22-2019, 01:03 AM
RE: Bubble shield - by Fenriswolf - 12-27-2019, 11:27 PM



Users browsing this thread: