aliens

Author Topic: [DONE] [Suggestion] 50-200% damage spread option  (Read 10422 times)

Offline Ethereal

  • Commander
  • *****
  • Posts: 684
    • View Profile
[DONE] [Suggestion] 50-200% damage spread option
« on: July 27, 2018, 06:43:53 pm »
Somewhere I briefly saw something about the damage Range. After playing "damageRange: 75" I realized that the ideal spread of damage would be = 50% -200%. Is it possible?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9101
    • View Profile
Re: [DONE] [Suggestion] 50-200% damage spread option
« Reply #1 on: July 27, 2018, 06:50:44 pm »
Somewhere I briefly saw something about the damage Range. After playing "damageRange: 75" I realized that the ideal spread of damage would be = 50% -200%. Is it possible?

It might be possible with scripts, I don't know.

But several people asked for this kind of spread already, I'll put it on my todolist.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: [DONE] [Suggestion] 50-200% damage spread option
« Reply #2 on: July 27, 2018, 08:45:56 pm »
It might be possible with scripts, I don't know.

But several people asked for this kind of spread already, I'll put it on my todolist.
Yes this indeed possible using script, first you need remove any randomes in attack (have flat atack).
Then use `hitUnit` script in item you use (or add global script that will affect all items):
Code: [Select]
extended:
  scripts:
    hitUnit:
      - offset: -90 #probably first script to run
        code: |
          var int upper power;
          var int lower power;
          mul upper 2;
          div lower 2;
          battle_game.randomRange power lower  upper; #change current power to 50% - 200%
          return;
This will set for all weapons this behavior, you can expand this script to add this only for selected weapons.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9101
    • View Profile
Re: [DONE] [Suggestion] 50-200% damage spread option
« Reply #3 on: July 28, 2018, 11:51:27 am »
I have added the option via the ruleset too, so that all the in-game damage indicators and pedia articles/stats work correctly.

Code: [Select]
items:
  - type: STR_LASER_RIFLE
    damageAlter:
      RandomType: 7      # DRT_EASY, 50-200% spread

Default translation for "stats for nerds":

Code: [Select]
  DRT_EASY: "50-200% spread"

Enjoy your easy mode...

Offline Ethereal

  • Commander
  • *****
  • Posts: 684
    • View Profile
Re: [DONE] [Suggestion] 50-200% damage spread option
« Reply #4 on: July 28, 2018, 07:01:15 pm »
Thank you very much.

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
Re: [DONE] [Suggestion] 50-200% damage spread option
« Reply #5 on: July 29, 2018, 09:08:44 pm »
If you do it completely random, 50-200% yields a median and average damage of 125%. To get 100% as a median, you could do something more like this:

Roll floating point from 1. to 2. = A
Random bit 0 or 1 = B
Weapon power = C
Weapon damage = D
If B = 1 then:
 CA = D
If B = 0 then:
 C/A = D

- - - - -

You can adjust the range by changing the top value of A.

For example, if A were 1.6824431, and we have a weapon power of 60:
 
  • If B=1 then the damage is 60*~1.68 = 101.
  • If B=0 then the damage is 60/~1.68 = 36.


This equation will prevent the low value from ever going beneath 0% no matter how high the high value goes. The average won't stay at 100% but the median will, and the average will be closer to 100% than with a linear equation. In the above case, the average damage would be 112.5%.
Linear median/average: 125/125
Suggestion median/average: 100/112.5


To add another more extreme example, I'll use the same 60 power as before but a range of 10-1000% damage.
A is a random floating point from 1. to 10.. Say we roll 8.7296503
 
  • If B=1 then the damage is 60*~8.73 = 524.
  • If B=0 then the damage is 60/~8.73 = 7.

Linear median/average: 505/505
Suggestion median/average: 100/302.5

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9101
    • View Profile
Re: [DONE] [Suggestion] 50-200% damage spread option
« Reply #6 on: July 29, 2018, 09:17:26 pm »
If you do it completely random, 50-200% yields a median and average damage of 125%. To get 100% as a median, you could do something more like this:

I am not aware of anyone requesting a 100 median.

As far as I can say, people wanted completely random damage, with 125 median.

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
Re: [DONE] [Suggestion] 50-200% damage spread option
« Reply #7 on: July 29, 2018, 11:08:09 pm »
It was just a suggestion, feel free to ignore it.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: [DONE] [Suggestion] 50-200% damage spread option
« Reply #8 on: July 30, 2018, 01:58:20 am »
write it yourself, scripts have all needed data to do this, even I posted example of this.