A state that decreases damage?

● ARCHIVED · READ-ONLY
Started by ChrisCrossAppleSauce 19 posts View original ↗
  1. Hello everyone, I was wondering if their way to make a state that decreases the amount of damage the inflicted person can deal. I know normally you could just do something along the lines of a debuff type effect that lowers a stat, but for my project, I am working with skills that deal exact numbers and don't rely on stats as part of the damage formula. Is there a way that I could make a state that did something along the lines of "This would hit for 10 damage, but now it's only going to hit for 8" or something like that?
  2. put
    user.isStateAffected(1) ? 10 : 8

    inside the skill's damage formula.
  3. I guess I should go into a tad bit more detail as far as how the skills work. They are almost sort of like rolling a 6 sided die for damage. So say using Skill A could have a damage output that looks like [0-1-1-2-2-3] With it working like you having a 1/3 chance to get either a 1 or a 2. So its a bit hard to put an exact number like the 10: 8 in the damage formula and have it work correctly
  4. put
    [0,1,1,2,2,3][Math.randomInt(6)]
    in the damage formula then.
  5. There is still the issue that I have a lot more than just that one attack in the game. I mean I could, in theory, put every damage output possibility in it for this one skill, but that seems like there should, in theory, be an easier way. Or maybe I just sorta screwed myself by doing a damage formula the way I did, IDK to be honest.
  6. If your damage formulas follow any common pattern, it can be simplified.
    For example:
    [1,2,3]
    [1,2,2,2,2,3]
    [0,2,2,3,3,4]
    [50,20,20,20,20,80]
    [200, 300, 300, 600, 600, 900, 900, 300]

    These arrays of numbers, despite representing different sets of dice (one is a d3, another is a d6, the last one is a d8), have a common pattern.
    The first and last numbers are there only once.
    The numbers in between , regardless of how many dice sides are there and how many numbers are there, are evenly spreaded through. The first example - one 2.
    Second example - four 2s.
    Third example - two 2s, two 3s
    fourth example - four 20s
    fifth example - two 300s, two 600s, two 900s
    So this can be simplified into a function you'd save as a custom plugin. Then it would just be calling that function inside the damage formula instead.
  7. I do apologize, and will fully admit I don't know all too much about the damage formulas, or coding, or even the math behind it all. I guess to put it simply, Im looking for some formula or something that I can attach on states for simple effects like + or - 1 to your roll.
  8. Let just throw away math and coding. Do you want something like ...
    Roll a dice for damage. And with the dice of [1,2,3,4,5,6], you will get one of these numbers.
    If a state is present, reduce/increase damage by 1.

    So if you roll and get 5 as damage, and you get a state that reduces the damage, the final damage will be 5 - 1
    Correct?
  9. Yes that is right
  10. Based on my example, it should be something like this.
    Code:
    [1,2,3,4,5,6][Math.randomInt(6)] + (user.isStateAffected(99) ? -1 : 0)
    Not sure if syntax correct in JS, but should be close.
    By looking at the formula itself, do you know where to edit?
  11. I don't think I do, if you would not mind showing, I would be greatly appreciative
  12. The example is like this
    Code:
    [1,2,3,4,5,6][Math.randomInt(6)] + (user.isStateAffected(99) ? -1 : 0)
    The template goes like this
    Code:
    [<all possible damage value>][Math.randomInt(<size of the possibility>)] + (user.isStateAffected(<state id>) ? <if state exist, what to do?> : <if state doesn't exist, what to do?>)
    Here's the breakdown:
    • <all possible damage value> = can be replaced by [1,2,3,4,5,6], or [0,1,1,2,2,3]. In later case, a damage value of 2 will have 1/3 chance to be picked.
    • <size of the possibility> = is depends on the <all possible damage value>, means [1,2,3,4,5,6] has the size of 6, so does [0,1,1,2,2,3]. In this case, you put 6.
    • <state id> = is the state affecting the damage
    • <if state exist, what to do?> = In my example above, I put minus 1, means the final damage will be reduced by 1
    • <if state doesn't exist, what to do?> = In my (edited) example, I put 0, means the damage will not be changed.
    Any question?
  13. yes I do have a question about this. Now I will have multiple attacks, each with their own damage numbers, so while one may be [0,1,1,2,2,4] another could be [0,0,0,8,9,10], [0,1,5,5,6,7] and so on. So as far as the first bracket of all possible damage values, I just have to put numbers as high as the strongest attack goes?
  14. Multiple hits attack will share the same damage formula. So if you want the first hit use [1,2,3] and the second hit use [4,5,6], it can't be done by the damage formula alone. It may need an external plugin.
  15. Not really multiple hit moves, I just mean every skill I am using for my game uses that same sort of damage formula, with 6 possible damage outcomes. Like say Skill A is [1-2-3-4-5-6] And Skill B is [7-8-9-10-11-12] and no attack in the entire skill list had a number higher than 12. Would it look like [1,2,3,4,5,6,7,8,9,10,11,12] [Math.randomInt(6)] + (user.isStateAffected(99) ? -1 : 0)
  16. You just put a different number for each skill formula, like skill ID 1 will be
    Code:
    [1,2,3,4,5,6][Math.randomInt(6)] + (user.isStateAffected(99) ? -1 : 0)
    And skill ID 2 will be
    Code:
    [0,1,1,2,2,3][Math.randomInt(6)] + (user.isStateAffected(99) ? -1 : 0)
  17. Wait I think I been misunderstanding what you have been saying.
    So lets say Skill C is the one that inflicts this state.
    I would put this formula in every skill then right?
  18. Correct. If you want this process to be automated for ALL of the skill, someone needs to modify function that handles makeDamageValue() in the script. But, I'm not knowledgeable about it. It should be easy though.
  19. Alright! I thought that I needed to put that same formula for every skill inside the skill that inflicted that State, and all I could think was "this seems like a bit much just to reduce the damage of something by 1.

    Now there is one final thing I would like to ask as I am getting ready to say my issue is completed. My game has 2 main skill types, Physical and Magical. Is there something I can add if I should want to increase or decrease the damage of a skill that uses either one or the other?