-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2220 from jarveson/jake/exclusive-overwrite
ee: dont overwrite same priority with less duration
- Loading branch information
Showing
2 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package core | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
) | ||
|
||
func TestSingleAuraExclusiveDurationNoOverwrite(t *testing.T) { | ||
sim := &Simulation{} | ||
|
||
target := Unit{ | ||
Type: EnemyUnit, | ||
Index: 0, | ||
Level: 83, | ||
auraTracker: newAuraTracker(), | ||
} | ||
mangle := MangleAura(&target) | ||
trauma := MakePermanent(TraumaAura(&target, 2)) | ||
|
||
// Trauma in this case should *never* be overwritten | ||
// as its duration from 'MakePermanent' should make it non overwritable by 1 min duration mangles | ||
trauma.Activate(sim) | ||
|
||
sim.CurrentTime = 1 * time.Second | ||
|
||
mangle.Activate(sim) | ||
|
||
if !(trauma.IsActive() && !mangle.IsActive()) { | ||
t.Fatalf("lower duration exclusive aura overwrote previous!") | ||
} | ||
} | ||
|
||
func TestSingleAuraExclusiveDurationOverwrite(t *testing.T) { | ||
sim := &Simulation{} | ||
|
||
target := Unit{ | ||
Type: EnemyUnit, | ||
Index: 0, | ||
Level: 83, | ||
auraTracker: newAuraTracker(), | ||
} | ||
mangle := MangleAura(&target) | ||
trauma := TraumaAura(&target, 2) | ||
|
||
trauma.Activate(sim) | ||
|
||
sim.CurrentTime = 1 * time.Second | ||
|
||
mangle.Activate(sim) | ||
|
||
// In this case mangle should overwrite trauma as mangle will give a greater duration | ||
|
||
if !(mangle.IsActive() && !trauma.IsActive()) { | ||
t.Fatalf("longer duration exclusive aura failed to overwrite") | ||
} | ||
} |