I'm using a customized battle formula and I want there to make fighting without a weapon a very bad idea without making it impossible (the default battle system makes unarmed attacks do 0 damage) since the default battle system calculates damage in a weird way, it doesn't check if the character has a weapon, only their ATK stat, which, without a weapon, is 0 of course. I want to make damage dealt without a weapon do either half as much, or 1/4 as much (haven't decided) so I need to know how to say, in the Game_Battler class... "if the attacker is not an enemy and has no weapon, divide self.damage by 2"
All I need is the simplest way to do it. please dont try to explain how everything works, because i wont understand. here is my battle formula script if you need it:
class Game_Battler
#--------------------------------------------------------------------------
# * 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 + attacker.str) - ((self.dex + self.pdef) / 2)), 0].max
self.damage = atk
# If actor is unarmed
def check_weapon
weapon = $data_weapons[@weapon_id]
return weapon != nil ? self.damage : [atk / 2]
end
check_weapon
# 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.crt / self.crt
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.agi + 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
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
#--------------------------------------------------------------------------
# * 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)
if hit_result == true
# if atk is used
if skill.atk_f > 0
self.damage = [((attacker.atk + attacker.str + skill.power) - ((self.dex + self.pdef) / 2)), 0].max
end
# if int is used
if skill.int_f > 0
self.damage = [((attacker.int + skill.power) - (self.mdef / 2)), 0].max
end
# 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 / attacker.agi + self.eva
hit = self.damage < 0 ? 100 : 100 - eva
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
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
I'm using a customized battle formula and I want there to make fighting without a weapon a very bad idea without making it impossible (the default battle system makes unarmed attacks do 0 damage) since the default battle system calculates damage in a weird way, it doesn't check if the character has a weapon, only their ATK stat, which, without a weapon, is 0 of course.
I want to make damage dealt without a weapon do either half as much, or 1/4 as much (haven't decided) so I need to know how to say, in the Game_Battler class...
"if the attacker is not an enemy and has no weapon, divide self.damage by 2"
All I need is the simplest way to do it. please dont try to explain how everything works, because i wont understand. here is my battle formula script if you need it:
Share this post
Link to post
Share on other sites