Aha! I think I may get it.
When you convert a real to an integer, it rounds
down (so an armor value of 3.9 becomes 3).
A simple method of rounding up is rounding (real + 0.5) down.
My example of 3.9 becomes 4.4, rounded down, that's 4 (which is also 3.9 rounded up
).
2.4 --> 2.9 --> 2 (2.9 rounded down, 2.4 rounded up)
2.6 --> 3.1 --> 3 (3.1 rounded down, 2.6 rounded up)
Okay, so now I've made the trigger myself and this does work:
-
Defense Break
-
Events
-
Unit - A unit Starts the effect of an ability
-
Conditions
-
(Ability being cast) Equal to Shield Break
-
(Level of Shield Break Dummy for (Target unit of ability being cast)) Equal to 0
-
Actions
-
Set defenseTempReal = (Life of (Target unit of ability being cast))
-
Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing 10.00 damage of attack type Chaos and damage type Normal
-
Set defenseDamage = (defenseTempReal - (Life of (Target unit of ability being cast)))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
defenseDamage Greater than 10.00
-
Then - Actions
-
-------- Armor is a negative value, setting it to 0 would actually benefit the target... --------
-
Unit - Set life of (Target unit of ability being cast) to defenseTempReal
-
Else - Actions
-
Set defenseArmor = ((10.00 - defenseDamage) / (defenseDamage x 0.06))
-
Unit - Set life of (Target unit of ability being cast) to defenseTempReal
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
defenseArmor Greater than 0.50
-
Then - Actions
-
Unit - Add Shield Break Dummy to (Target unit of ability being cast)
-
Unit - Set level of Shield Break Dummy for (Target unit of ability being cast) to (Integer((defenseArmor + 0.50)))
-
Else - Actions
-
-------- Armor is 0, reducing it by 100% is futile (besides, the first level of the spell decreases armor by 1) --------
Up to you to see where you went wrong now
(I hope you already changed the 0.6 to 0.06).
Test-map attached.