Jump to content
Sign in to follow this  
jevydecky

Damage formula help

Recommended Posts

Posted (edited)

Hello,

 

I need help with the damage formula that takes 75% of the target's current hp. I know that b.hp/2 will divide the current hp in half. Any help will be greatly appreciated

Edited by jevydecky

Share this post


Link to post
Share on other sites

Hi,

(b.hp*0.75).to_i

-should deal 75 damage if the target would have 100 HP remaining, for example.

The (x).to_i thing is to make sure, that the output is an integer, as I suspect it could end up throwing floats.

Share this post


Link to post
Share on other sites
48 minutes ago, Rikifive said:

Hi,


(b.hp*0.75).to_i

-should deal 75 damage if the target would have 100 HP remaining, for example.

The (x).to_i thing is to make sure, that the output is an integer, as I suspect it could end up throwing floats.

Thank you

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted