Need a formula

Dinowc

don't expect anything, prepare for everything
Reaction score
223
I'm completely stuck as I can't figure out a proper formula for this scaling

Ability Level | Damage

1 | 80
2 | 120
3 | 175
4 | 245
5 | 330

as you can see, the increase is exponential, each time it deals +15 more damage than on previous bonus

so:
80 + 40 = 120
120 + 55 = 175 (since 40 + 15 = 55)
175 + 70 = 245 (since 55 + 15 = 70)
245 + 85 = 330

and so on...

my current formula is this:
JASS:
private function Damage takes integer level returns real
    return DAMAGE_BASE + (level - 1) * (DAMAGE_LEVEL + DAMAGE_INCREASE)
endfunction

where:
DAMAGE_BASE = 80
DAMAGE_LEVEL = 40
DAMAGE_INCREASE = 15

obviously it returns wrong values :/
 

Dinowc

don't expect anything, prepare for everything
Reaction score
223
thx but how would I make it configurable?

cause I can't just use 7.5, 17.5 and 55 :/
I need a constant formula so I can easily change the scaling later

is there a way to do it with exponentiation or something?
 

Laiev

Hey Listen!!
Reaction score
188
JASS:
globals
    private integer array myDamage
endglobals

function onInit takes nothing returns nothing
    set myDamage[1] = 80
    set myDamage[2] = 120
    set myDamage[3] = 175
    set myDamage[4] = 245
    set myDamage[5] = 330
endfunction
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
612
Damage = 80 + 40*(Level-1) + 15*(3^(Level-2))

Is that what you're looking for?
EDIT: Thats not right yet. Level-2 still turns up negative. Let me think of something else.
EDIT2: Here. This should work.
Code:
function CalculatePower takes integer Int returns integer
    local integer Power = ((Int*(Int+1))/2)
    if ( Power <= 0 ) then
        return 0
    endif
    return Power
endfunction

function CastSpell takes integer Level returns nothing
    local integer Damage = (80 + (40*(Level-1)) + (15*CalculatePower(Level-2)))
endfunction
Damage dealt is the same as the local "Damage". The first function only checks if there is any power of 15 to add. Results:
Code:
1).  80 + 40*0(  0) + 15* 0(  0) =  80
2).  80 + 40*1( 40) + 15* 0(  0) = 120
3).  80 + 40*2( 80) + 15* 1( 15) = 175
4).  80 + 40*3(120) + 15* 3( 45) = 245
5).  80 + 40*4(160) + 15* 6( 90) = 330
6).  80 + 40*5(200) + 15*10(150) = 430
7).  80 + 40*6(240) + 15*15(225) = 545
8).  80 + 40*7(280) + 15*21(315) = 675
9).  80 + 40*8(320) + 15*28(420) = 820
10). 80 + 40*9(360) + 15*36(540) = 980
 

Dinowc

don't expect anything, prepare for everything
Reaction score
223
EDIT2: Here. This should work.
Code:
function CalculatePower takes integer Int returns integer
    local integer Power = ((Int*(Int+1))/2)
    if ( Power <= 0 ) then
        return 0
    endif
    return Power
endfunction

function CastSpell takes integer Level returns nothing
    local integer Damage = (80 + (40*(Level-1)) + (15*CalculatePower(Level-2)))
endfunction

you're the man :thup:
 

SouLEDGE

Damn you advanced calculus
Reaction score
75
If you want the formula for the sequence its:

Damage = (7,5)(n)^2 + 22,5(n)+ 55 < where n is the level of the skill

All you need is the level of the ability and you've got the damage

EDIT 1: Not quite correct, tried to work it out in my head
Did it the right way and got a piece of paper and now I got it:

Damage = (7,5)(n)^2 + 17,5(n) + 55 < again, n is the level of the skill:

lvl 1 - Damage = (7,5)(1)^2 + 17,5(1) + 55 = 80
lvl 2 - Damage = (7,5)(2)^2 + 17,5(2) + 55 = 120
lvl 3 - Damage = (7,5)(3)^2 + 17,5(3) + 55 = 175
lvl 4 - Damage = (7,5)(4)^2 + 17,5(4) + 55 = 245
lvl 5 - Damage = (7,5)(5)^2 + 17,5(5) + 55 = 330
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
612
So the commas are supposed to be periods, from "," to "."? I think some people use commas instead of decimal points when doing sums.
 

keychup

Active Member
Reaction score
34
that's silly. if i were to use fullstops instead of commas my number would look like this:

300.000,000

what does that look like? a 300?
 

SouLEDGE

Damn you advanced calculus
Reaction score
75
7,5 >>> seven and a half :D
Because mathematically . can be interpreted as x (multiply)
So: 7.5 could be read as 7x5 that's why I write seven and a half with a ,

and besides, 300,000,000.99 just makes it easier to read, not that important in maths, I would rather write it as 300 000 000,99
 

SouLEDGE

Damn you advanced calculus
Reaction score
75
* is used for programming syntax, on paper though, which is where I do my calculations, "." means multiply
It's too much of a luss to write x every time you need to multiply, plus X is a common variable name, so you don't really
write: Xx2x33xX, for sanity's sake you'd rather write x.2.33.x = 66x^2
 

WolfieeifloW

WEHZ Helper
Reaction score
372
Still, someone that wants to use your numbers will have to change all the , to ..
And even more, if they don't make the assumption that's the change, has to reply to the thread asking if , is supposed to be ., then wait for you or someone else to reply.
I never said use x, I said * :p
 

Romek

Super Moderator
Reaction score
963
> Because mathematically . can be interpreted as x (multiply)
a·b, not a.b. And this only applies to unknowns/variables. You don't use 'dots' for multiplication when you know the values, because of the ambiguity with a decimal point (such as your value of 7·5). Also, commas are used to separate thousands when writing large numbers (10,000,000 vs 10000000), so they're not the best alternative either.
I know in some countries ',' is used as a decimal point instead of '.', though in all programming languages, including JASS and GUI, '.' is used for a decimal point, and '*' for multiplication.

Let's not start trying to change the standard. :p
 

SouLEDGE

Damn you advanced calculus
Reaction score
75
Very true, but I just happen to be in one of those countries :p
when I do programming I switch to the standard syntax, just math where I use a , :p

Anyways, did he come right with the formula?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/
  • The Helper The Helper:
    Here is another comfort food favorite - Million Dollar Casserole - https://www.thehelper.net/threads/recipe-million-dollar-casserole.193614/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top