NOT does not work properly in SpellRequire function
Hemario opened this issue ยท 9 comments
SpellRequire(execute unusable set=1 enabled=(target.healthpercent()>20))
SpellRequire(execute unusable set=1 enabled=(not(target.healthpercent()<=20)))
Both lines should be equivalent, but they are not.
Can you make the simplest script possible that demonstrates the problem? I'd like to test it out on a target dummy and make use of the debug tools in-game.
If you have a full test case, I have a local change that I am testing that I believe solves this issue.
This commit from pullup #778 may fix this issue, but I need a repeatable test case that I can try.
indeed, it can never happen, so it should not set "unusable" to 1. Therefor, it should always be usable.
Expectation is that both icons are shown at all times.
This is a script for Brewmaster monk
Define(tiger_palm 100780)
SpellInfo(tiger_palm energy=25)
Define(spinning_crane_kick 322729)
SpellInfo(spinning_crane_kick energy=25 channel=1.5)
SpellRequire(tiger_palm unusable set=1 enabled=(target.healthpercent()>100))
SpellRequire(spinning_crane_kick unusable set=1 enabled=(not(target.healthpercent()<=100)))
AddIcon {
Spell(tiger_palm)
}
AddIcon {
Spell(spinning_crane_kick)
}
Expectation would be that both will be usable, but that is not the case.
The difference is highlighted here.
For Icon 1:
[12] >>> Computing 'compare' at time=261865.934000
[10] >>> Computing 'target.healthpercent()' at time=261865.934000
[10] condition 'healthpercent' returns 261865.934, inf, 100, 261865.934, -0
[10] <<< 'target.healthpercent()' returns (261865.934, inf) with value = value 100 + (t - 261865.934) * -0
[12] 100+(t-261865.934)*-0 > 100+(t-0)*0
[12] compare '>' returns empty set
[12] <<< 'compare' returns empty set with value = none
For Icon 2:
[17] >>> Computing 'logical' at time=261865.934000
[16] >>> Computing 'compare' at time=261865.934000
[10] >>> Computing 'target.healthpercent()' at time=261865.934000
[10] condition 'healthpercent' returns 261865.934, inf, 100, 261865.934, -0
[10] <<< 'target.healthpercent()' returns (261865.934, inf) with value = value 100 + (t - 261865.934) * -0
[16] 100+(t-261865.934)*-0 <= 100+(t-0)*0
[16] compare '<=' returns (261865.934, inf)
[16] <<< 'compare' returns (261865.934, inf) with value = none
[17] logical 'not' returns (0, 261865.934)
[17] <<< 'logical' returns (0, 261865.934) with value = none
Spell ID '322729' is flagged as unusable.
OvaleSpells:IsUsableSpell(322729, 261865.934000, Creature-0-3103-2222-25330-174569-00007045A8) returned false, false
This is the full log:
Reset state with current time = 261865.934000
nextCast = 261865.934000
+++ Icon 1
[21] >>> Computing 'spell(tiger_palm)' at time=261865.934000
[21] evaluating action: spell()
[20] >>> Computing 'tiger_palm' at time=261865.934000
[20] value is 100780
[20] <<< 'tiger_palm' returns (0, inf) with value = value 100780 + (t - 0) * 0
Found spell info about 100780 (isKnown = true)
[12] >>> Computing 'compare' at time=261865.934000
[10] >>> Computing 'target.healthpercent()' at time=261865.934000
[10] condition 'healthpercent' returns 261865.934, inf, 100, 261865.934, -0
[10] <<< 'target.healthpercent()' returns (261865.934, inf) with value = value 100 + (t - 261865.934) * -0
[12] 100+(t-261865.934)*-0 > 100+(t-0)0
[12] compare '>' returns empty set
[12] <<< 'compare' returns empty set with value = none
spell ID '100780' has cost of 25 energy
spell ID '100780' requires 0.000000 seconds for 25 energy
Spell ID '100780' requires 0.000000 seconds for power requirements.
Spell ID '100780' passed power requirements.
OvaleSpells:IsUsableSpell(100780, 261865.934000, Creature-0-3103-2222-25330-174569-00007045A8) returned true, false
Didn't find an existing cd in next, look for one in current
Call GetSpellCooldown which returned 0.000000, 0.000000, 1
It returned -0.100000, 0.000000
Spell cooldown is in the past
Cooldown of spell 100780 is 0.000000 + 0.000000
GetSpellCooldown returned 0.000000, 0.000000
Spell cooldown is in the past
Cooldown of spell 100780 is 0.000000 + 0.000000
spell ID '100780' requires 0.000000 seconds for 25 energy
Spell ID '100780' requires 0.000000 seconds for power requirements.
[21] Action spell still has 0.000000 charges but is on GCD (start=0.000000).
[21] start=0.000000 atTime=261865.934000
[21] Action spell is waiting for the global cooldown.
[21] Action spell can start at 261865.934000.
[21] <<< 'spell(tiger_palm)' returns (261865.934, inf) with value = action spell 100780
[19] >>> Computing 'group' at time=261865.934000
[19] group checking child [21-spell(tiger_palm)]
[21] >>> Returning for 'spell(tiger_palm)' cached value action spell 100780 at (261865.934, inf)
[19] group checking child [21-spell(tiger_palm)] result: (261865.934, inf)
[19] group first best is [21-spell(tiger_palm)]: (261865.934, inf)
[19] group best action remains action spell 100780 at (261865.934, inf)
[19] <<< 'group' returns (261865.934, inf) with value = action spell 100780
GetAction: start=261865.934, id=100780
+++ Icon 2
[25] >>> Computing 'spell(spinning_crane_kick)' at time=261865.934000
[25] evaluating action: spell()
[24] >>> Computing 'spinning_crane_kick' at time=261865.934000
[24] value is 322729
[24] <<< 'spinning_crane_kick' returns (0, inf) with value = value 322729 + (t - 0) * 0
Found spell info about 322729 (isKnown = true)
[17] >>> Computing 'logical' at time=261865.934000
[16] >>> Computing 'compare' at time=261865.934000
[10] >>> Computing 'target.healthpercent()' at time=261865.934000
[10] condition 'healthpercent' returns 261865.934, inf, 100, 261865.934, -0
[10] <<< 'target.healthpercent()' returns (261865.934, inf) with value = value 100 + (t - 261865.934) * -0
[16] 100+(t-261865.934)-0 <= 100+(t-0)*0
[16] compare '<=' returns (261865.934, inf)
[16] <<< 'compare' returns (261865.934, inf) with value = none
[17] logical 'not' returns (0, 261865.934)
[17] <<< 'logical' returns (0, 261865.934) with value = none
Spell ID '322729' is flagged as unusable.
OvaleSpells:IsUsableSpell(322729, 261865.934000, Creature-0-3103-2222-25330-174569-00007045A8) returned false, false
[25] <<< 'spell(spinning_crane_kick)' returns empty set with value = none
[23] >>> Computing 'group' at time=261865.934000
[23] group checking child [25-spell(spinning_crane_kick)]
[25] >>> Returning for 'spell(spinning_crane_kick)' cached value none at empty set
[23] group checking child [25-spell(spinning_crane_kick)] result: empty set
[23] child [25] measure is 0, skipping
[23] group no best action returns none at empty set
[23] <<< 'group' returns empty set with value = none
There is something I'm not understanding in engine/data.ts
that could be related to this. Look at this conditional in getSpellInfoProperty()
:
if (named.enabled === undefined || named.enabled) {
Doesn't that always evaluate to true? named.enabled
is computed by engine/runner.ts:computeAsValue()
.
@Hemario In your script above, it's unsaid, but I would expect both icons to be empty, right? target.HealthPercent() > 100
can never happen, so I'd expect Tiger Palm to have unusable == 1
.
@Hemario I think this is fixed in Ovale 9.0.34. Can you verify?