• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Strength determines spell damage

Status
Not open for further replies.
Level 28
Joined
Feb 18, 2014
Messages
3,579
  • Storm bolt
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Storm bolt
    • Actions
      • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (Real((Strength of (Triggering unit) (Include bonuses)))) damage of attack type Spells and damage type Normal
Something like this?
Oh yeah... And how can I make a spell folder? Thanks
Use a Spellbook?
 
Level 9
Joined
Jul 30, 2018
Messages
445
  • Spell Damage Scaling
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Storm Bolt
        • Then - Actions
          • Ability - Set Ability: (Unit: (Triggering unit)'s Ability with Ability Code: Storm Bolt)'s Real Level Field: Damage ('Htb1') of Level: 0 to ((Real((Strength of (Triggering unit) (Include bonuses)))) x 3.00)
        • Else - Actions
Do note, that the level is 0-indexed, meaning that level 0 in the trigger is level 1 in the ability and level 1 in the trigger is level 2 in the ability, etc.

And what do you mean by a "spell folder"?
 
Level 7
Joined
Oct 3, 2014
Messages
657
  • Storm bolt
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Storm bolt
    • Actions
      • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (Real((Strength of (Triggering unit) (Include bonuses)))) damage of attack type Spells and damage type Normal
oops sorry, I meant the attack damage determines the spell damage.

@Sabe spellbook
 
Level 39
Joined
Feb 27, 2007
Messages
5,012
Same concept, just use compute the unit's attack damage range by querying its base damage, number of dice, and sides per die. MAX = Base + (Num Sides)*(Num Dice). You can get all these values with triggers now, just look for it. There's no way to get 'green' damage numbers.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Since attack damage depends on randomness, one would need to simulate the dice rolls using a loop such as for integer a in range. This is to accurately simulate the random probability distribution without getting into complicated mathematics.

Using the obvious random integer in range function between the minimum and maximum damage is only correct for attacks with a single dice. This is due to the sum outcome of multiple dice rolls having a gaussian probability distribution.
 
Level 7
Joined
Jul 4, 2007
Messages
249
oops sorry, I meant the attack damage determines the spell damage.
  • Set real = (Real((Base Damage of unit for weapon index 1)))
  • For each (Integer A) from 1 to (Dice Number of unit for weapon index 1), do (Actions)
    • Loop - Actions
      • Set real = (real + (Random real number between 1.00 and (Real((Dice Sides of unit for weapon index 1)))))
  • Else - Actions
This gets you the correct attack damage
 
Level 8
Joined
May 21, 2019
Messages
435
...without getting into complicated mathematics.
This is due to the sum outcome of multiple dice rolls having a gaussian probability distribution.
YOU PROMISED NOT TO!

Jokes aside... in laymans terms (i.e. my half-assed understanding), what this means is that multiple dice rolls will end up closer to the average damage than fewer rolls as the distribution starts to even out. Kinda like if you were to roll a dice 6 million times vs 6 times, where certain outcomes would in all likelihood not even present themselves at 6 rolls, but where the distribution would start looking relatively even at 6 million.... or even 600k. Taking stuff like that into consideration may be a bit overkill for simulating a handful of dice rolls though.
You can also opt for the far lighter method of simply calculating the average damage, but that removes the randomness completely. Personally, I don't mind that, but to each their own. If the gap between min and max damage is relatively small, then I'd recommend just calculating the average.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
YOU PROMISED NOT TO!
I did not get into the complicated maths. In theory one could correctly calculate a random damage number with linear complexity with respect to die count by getting a constant probability random number in a range, then transforming it based on the probability distribution and finally rounding. There may be precision issues when very large numbers are involved but the overall damage characteristics would be a lot more accurate than a constant probability in range approach or just taking the average.

This is similar to how one calculates a random point within a circle. The random radius value has to be transformed such that it is more likely to be a higher number than a low one.
 
Status
Not open for further replies.
Top