Jump to content
Rpg²S Forum

*Danno Limite


friday666
 Share

Recommended Posts

Danno Limite

Descrizione
Permette di limitare i danni ad una certa quantità.

Autore
Synthesize

Allegati

Screenshot: N/d

Script:

 

 

#============================================================================
# Limiting Damage
#----------------------------------------------------------------------------
# Written by Synthesize
# Version 100
# October 1st, 2007
#============================================================================
# Compatibility:
# Rewrites:
# Game_Battler::attack_effect
# Game_Battler::skill_effect
#--------------------------------------------------------------------------
# Begin Customization Section
#--------------------------------------------------------------------------
module LimitDamage
	Maximum_Damage = 9999
	Minimum_Damage = 1
	Maximum_SkillDamage = 9999
	Minimum_SkillDamage = 1
	# Change these values to your expected setting.
	# Note: By default minimum damage is 0.
end
#--------------------------------------------------------------------------
# End Customization Section
#--------------------------------------------------------------------------
# Begin Game_Battler Rewrite
#--------------------------------------------------------------------------
class Game_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
			# Substract damage from HP
			if self.damage < LimitDamage::Minimum_Damage
				self.damage = LimitDamage::Minimum_Damage
			elsif self.damage > LimitDamage::Maximum_Damage
				self.damage = LimitDamage::Maximum_Damage
			end
			self.hp -= self.damage
			# 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
	#---------------------------------------------------------------------
	# Begin Skill Adjustment
	#---------------------------------------------------------------------
	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
			# Substract damage from HP
			if self.damage < LimitDamage::Minimum_SkillDamage
				self.damage = LimitDamage::Minimum_SkillDamage
			elsif self.damage > LimitDamage::Maximum_SkillDamage
				self.damage = LimitDamage::Maximum_SkillDamage
			end
			last_hp = self.hp
			self.hp -= self.damage
			effective |= self.hp != last_hp
			# 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
end

#============================================================================
# Written by Synthesize
# Special Thanks: Peter for the request
#----------------------------------------------------------------------------
# Limiting Damage
#============================================================================

 

 

 

 

Scarica: N/d

Istruzioni per l'uso

Per modificare i limiti dei danni inserite la cifra che desiderate in questi spazi:

module LimitDamage
Maximum_Damage = 9999
Minimum_Damage = 1
Maximum_SkillDamage = 9999
Minimum_SkillDamage = 1

(\__/)

(='.'=)

(")_(")

Questo è Bunny. Ho deciso di aiutarlo nella sua missione di conquista del mondo.

Compagni di Bunny unitevi a me!

 

http://img170.imageshack.us/img170/1858/pizzelartzzennm9.png

I chara da me postati: CLICCA QUI! PER XP - CLICCA QUI! PER XP(2) - CLICCA QUI! PER VX - CLICCA QUI! PER 2K/2K3!

I tileset da me postati:CLICCA QUI! PER XP

I Personaggi Completi da me postati: CLICCA QUI! PER XP

I Face da me postati: CLICCA QUI! PER XP

I Battlers da me postati: CLICCA QUI! PER XP!

Le Windowskin da me postate: CLICCA QUI! PER XP!

Risorse sonore da me postate: CLICCA QUI! PER SCARICARLE!

Guida al Ruby: CLICCA QUI! PER SCARICARLA!

Vi prego di inserirmi nei crediti...Grazie!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...