cocicookie
Member
Hi guys, I'm cocicookie, and I'm the NEW account for Zeldabud (I'm now bored TOTALLY of that name). Now thats out of the way, onto my problem: A stupid, good for nothing, sysntax error :/
I've been modifying the battle alogimths to be set up so it plays like Dungeons and Dragons. But for some reason, now I've put in all the Normal Hit and Critical Hit code, I get a syntax error for no apparent reason...
Here is the modified alogrimth code:
Anyone see the problem with it?
I've been modifying the battle alogimths to be set up so it plays like Dungeons and Dragons. But for some reason, now I've put in all the Normal Hit and Critical Hit code, I get a syntax error for no apparent reason...
Here is the modified alogrimth code:
Code:
#--------------------------------------------------------------------------
# * Applying Normal Attack Effects
# attacker : battler
#--------------------------------------------------------------------------
def attack_effect(attacker)
# Reset critical hit
critical_chance = false
critical_result = false
# Hit detection
hit_roll = rand(19) + 1
if hit_roll = 1
hit_result == false
else if hit_roll = 20
hit_result == true
critical_chance == true
else
hit_result = (hit_roll + attacker.dex >= self.agi)
end
# Check for critical
if critical_chance = true
critical_roll = rand(19) + 1
if critical_roll = 1
critical_result == false
else if hit_roll = 20
critical_result == true
else
critical_result = (hit_roll + attacker.dex >= self.agi)
end
end
# If hit occurs
if hit_result == true
# Calculate basic damage
atk = rand(attacker.dice)
if atk <= 1
atk = 1
end
self.damage = (atk + attacker.atk) - self.pdef
end
# If critical hit occurs
if critical_result == true
self.damage * 2
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
critical_chance = false
critical_result = false
end
# End Method
return true
end
Anyone see the problem with it?