ID:160583

Well, i had this idea for Magic attacks.

You have 2 stats that determine how much damage you do.
Mana
Mana Aptitude(or control)

Now, I already have a pretty good idea on how the system is going to be done, but i need some advice.

For magic attack, each move will do a certain amount of your current mana(in perecntage)...for example.

 ```var/damage = mana.value * 0.02 // 2 % of your current mana ```

With Mana Aptitude(or Control, which will be based on a ascale of 0.01 to 1)...

 ```var/damage = (mana.value * 0.02) * mana_apt ```

now that seems pretty simple, but i want to take it a step further by making it so that there's a small chance it's going to do a large amount of damage(possibly 2 or 3 times the original damage), but only if the aptitude is pretty low.

 ```var/damage = (mana.value * 0.02) * (mana_apt < 0.75 && prob(x) ? rand(2,4) : mana_apt) ```

I have no idea what to put in for x, but there's still more. When creating your character, i would like the results for the initial aptitude to be completly random. The way i was thinking....was to create a system that makes it more probable of having a lower aptitude than a higher one. I'm just not sure how to go about programming it(i'd rather not use a bunch of if statements to do this)
 #1 Aug 18 2008, 1:01 pm Ok Rob since i been through this code be4 You set it as a crit ( critical or how u want it to be ) and u can set crit set of usr tai nin and mana ( depends on how u code it in ) it will end like this if u have it for damage if(prob(crit)) //Change crit to wat ur damage is off of either mana from your topic flick("attack",src) /* view(4) << "[M] recieves a Critical Hit for [damage] from [src]" (optional ) */ src.doing = 1 M.health -= (damage * 2) M.DEATH() spawn(15) src.doing = 0 return
 #2 Aug 18 2008, 1:02 pm In response to Hokage Yondaime (#1) ..that isn't what i asked for, try reading my post.
 #3 Aug 18 2008, 1:07 pm O my bad sorry wasnt thinking ( bu in prob (x) ) // x = Damge ratio and or type of damage and for the damage system u can use ur tai systems just copy and paste as mana ( then change the inside things cuz u prob want mana to increase from senbon , or doing magic instead of hitting log xD
 #4 Aug 18 2008, 1:13 pm In response to Hokage Yondaime (#3) Get your head out of your ass, just because you're Naruto-obsessed doesn't mean everyone else is. Anyways, I'm not sure what you mean at the moment Axerob, be a little more specific.
 #5 Aug 18 2008, 1:13 pm In response to Hokage Yondaime (#3) ... What are you even talking about? I don't see anything in his post relating to "nin", "tai" and "log"... And Rob, I think because of the && , the value that will return is either 1 or 0 instead of any other #... and see Glad's post as well >_>
In response to GhostAnime (#5)
The way i was thinking....was to create a system that makes it more probable of having a lower aptitude than a higher one. I'm just not sure how to go about programming it(i'd rather not use a bunch of if statements to do this)

Something like this..
 ``` if(prob(3)) chakracontrol=chakraconversion chakraconversion+=rand(100,150) else if(prob(50)) chakracontrol+=rand(300,500) chakraconversion+=rand(200,400) else if(prob(50)) chakracontrol+=rand(100,300) chakraconversion+=rand(500,600) else chakracontrol=100 chakraconversion=600 ```

Without all the if statements and only 1 var...lol
 #7 Aug 18 2008, 1:50 pm 1) Try a probability of ten. 2) var/A = (rand(1,6)) var/G=(rand(20,35)) var/H=(rand(36,75)) var/F=(rand(76,100)) var/Aplitude switch(A) if(1) Aplitude=Aplitude+G if(2) Aplitude=Aplitude+G if(3) Aplitude+G if(4) Aplitude=Aplitude+G if(5) Aplitude=Aplitude+H if(6) Aplitude=Aplitude+F
In response to Genius_boy001 (#7)
He said he wants to avoid if()s.

 ```Aplitude=Aplitude+G ```
You could've used the shorthand +=:
 ```Aplitude += G ```

<hr>
 ```Aplitude=(rand(20,35)) ```
could have easily been
 ```Aplitude = G ```
since G is rand(20,35)
<hr>
And since the first snippet (+ G) is shown for 1,2,5, you could've had it as
 ```switch(X) if(1,2,5) Aplitude += G ```
... Look up switch() and read the whole thing, interesting tricks to it.
 #9 Aug 18 2008, 2:03 pm In response to GhostAnime (#8) It was quickly done on the forum itself, and I don't usually program in DM sinse I'm more of a web programmer. =/. But if I do pick up in DM again I'll keep those in mind thanks. =).
Axerob wrote:
now that seems pretty simple, but i want to take it a step further by making it so that there's a small chance it's going to do a large amount of damage(possibly 2 or 3 times the original damage), but only if the aptitude is pretty low.

First step, make a general procedure so it is flexible in any attacks and any changes you want to make can be done easily, such as
 ```proc/Damage(Amount of damage, Critical Aplitude = 0.10 (default value), Chance of Critical = 1 (1%), Minimum Increased Damage = 1.1, Maximum Increased Damage = 2.5) ```

That way you can make it add up what you want it to do...
 ```proc/Damage(amt, crit_req = 0.10, chance = 1, min_crit = 1.1, max_crit = 2.5) // I assume you can figure out what they refer to . = max(0, amt * (mana_apt <= crit_req && prob(chance))? rand(min_crit,max_crit) : 1)) ```
... but you had probably thought of this earlier neh?
In response to GhostAnime (#10)
GhostAnime wrote:
Axerob wrote:
now that seems pretty simple, but i want to take it a step further by making it so that there's a small chance it's going to do a large amount of damage(possibly 2 or 3 times the original damage), but only if the aptitude is pretty low.

First step, make a general procedure so it is flexible in any attacks and any changes you want to make can be done easily, such as
 ```prob/Damage(Amount of damage, Critical Aplitude = 0.10 (default value), Chance of Critical = 1 (1%), Minimum Increased Damage = 2, Maximum Increased Damage = 2.5) ```

That way you can make it add up what you want it to do...
 ```proc/Damage(amt, crit_req = 0.10, chance = 1, min_crit, max_crit) // I assume you can figure out what they refer to> . = max(0, amt * (mana_apt <= crit_req && prob(chance))? rand(min_crit,max_crit) : 1) ```
... but you had probably thought of this earlier neh?

No actually, i didn't think of that :D.

I'll be adding that in. Thanks a bunch.
 #12 Aug 18 2008, 2:08 pm In response to Axerob (#11) No problem (I did a small edit to that post, forgot to add the default values for min_ and max_)