-
Notifications
You must be signed in to change notification settings - Fork 138
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 #3255 from wowsims/apl
Add lots of common APL values
- Loading branch information
Showing
7 changed files
with
346 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
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,63 @@ | ||
package core | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/wowsims/wotlk/sim/core/proto" | ||
) | ||
|
||
type APLValueCurrentTime struct { | ||
defaultAPLValueImpl | ||
} | ||
|
||
func (unit *Unit) newValueCurrentTime(config *proto.APLValueCurrentTime) APLValue { | ||
return &APLValueCurrentTime{} | ||
} | ||
func (value *APLValueCurrentTime) Type() proto.APLValueType { | ||
return proto.APLValueType_ValueTypeDuration | ||
} | ||
func (value *APLValueCurrentTime) GetDuration(sim *Simulation) time.Duration { | ||
return sim.CurrentTime | ||
} | ||
|
||
type APLValueCurrentTimePercent struct { | ||
defaultAPLValueImpl | ||
} | ||
|
||
func (unit *Unit) newValueCurrentTimePercent(config *proto.APLValueCurrentTimePercent) APLValue { | ||
return &APLValueCurrentTimePercent{} | ||
} | ||
func (value *APLValueCurrentTimePercent) Type() proto.APLValueType { | ||
return proto.APLValueType_ValueTypeFloat | ||
} | ||
func (value *APLValueCurrentTimePercent) GetFloat(sim *Simulation) float64 { | ||
return sim.CurrentTime.Seconds() / sim.Duration.Seconds() | ||
} | ||
|
||
type APLValueRemainingTime struct { | ||
defaultAPLValueImpl | ||
} | ||
|
||
func (unit *Unit) newValueRemainingTime(config *proto.APLValueRemainingTime) APLValue { | ||
return &APLValueRemainingTime{} | ||
} | ||
func (value *APLValueRemainingTime) Type() proto.APLValueType { | ||
return proto.APLValueType_ValueTypeDuration | ||
} | ||
func (value *APLValueRemainingTime) GetDuration(sim *Simulation) time.Duration { | ||
return sim.GetRemainingDuration() | ||
} | ||
|
||
type APLValueRemainingTimePercent struct { | ||
defaultAPLValueImpl | ||
} | ||
|
||
func (unit *Unit) newValueRemainingTimePercent(config *proto.APLValueRemainingTimePercent) APLValue { | ||
return &APLValueRemainingTimePercent{} | ||
} | ||
func (value *APLValueRemainingTimePercent) Type() proto.APLValueType { | ||
return proto.APLValueType_ValueTypeFloat | ||
} | ||
func (value *APLValueRemainingTimePercent) GetFloat(sim *Simulation) float64 { | ||
return sim.GetRemainingDurationPercent() | ||
} |
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,105 @@ | ||
package core | ||
|
||
import ( | ||
"github.com/wowsims/wotlk/sim/core/proto" | ||
) | ||
|
||
type APLValueCurrentMana struct { | ||
defaultAPLValueImpl | ||
unit *Unit | ||
} | ||
|
||
func (unit *Unit) newValueCurrentMana(config *proto.APLValueCurrentMana) APLValue { | ||
if !unit.HasManaBar() { | ||
return nil | ||
} | ||
return &APLValueCurrentMana{ | ||
unit: unit, | ||
} | ||
} | ||
func (value *APLValueCurrentMana) Type() proto.APLValueType { | ||
return proto.APLValueType_ValueTypeFloat | ||
} | ||
func (value *APLValueCurrentMana) GetFloat(sim *Simulation) float64 { | ||
return value.unit.CurrentMana() | ||
} | ||
|
||
type APLValueCurrentManaPercent struct { | ||
defaultAPLValueImpl | ||
unit *Unit | ||
} | ||
|
||
func (unit *Unit) newValueCurrentManaPercent(config *proto.APLValueCurrentManaPercent) APLValue { | ||
if !unit.HasManaBar() { | ||
return nil | ||
} | ||
return &APLValueCurrentManaPercent{ | ||
unit: unit, | ||
} | ||
} | ||
func (value *APLValueCurrentManaPercent) Type() proto.APLValueType { | ||
return proto.APLValueType_ValueTypeFloat | ||
} | ||
func (value *APLValueCurrentManaPercent) GetFloat(sim *Simulation) float64 { | ||
return value.unit.CurrentManaPercent() | ||
} | ||
|
||
type APLValueCurrentRage struct { | ||
defaultAPLValueImpl | ||
unit *Unit | ||
} | ||
|
||
func (unit *Unit) newValueCurrentRage(config *proto.APLValueCurrentRage) APLValue { | ||
if !unit.HasRageBar() { | ||
return nil | ||
} | ||
return &APLValueCurrentRage{ | ||
unit: unit, | ||
} | ||
} | ||
func (value *APLValueCurrentRage) Type() proto.APLValueType { | ||
return proto.APLValueType_ValueTypeFloat | ||
} | ||
func (value *APLValueCurrentRage) GetFloat(sim *Simulation) float64 { | ||
return value.unit.CurrentRage() | ||
} | ||
|
||
type APLValueCurrentEnergy struct { | ||
defaultAPLValueImpl | ||
unit *Unit | ||
} | ||
|
||
func (unit *Unit) newValueCurrentEnergy(config *proto.APLValueCurrentEnergy) APLValue { | ||
if !unit.HasEnergyBar() { | ||
return nil | ||
} | ||
return &APLValueCurrentEnergy{ | ||
unit: unit, | ||
} | ||
} | ||
func (value *APLValueCurrentEnergy) Type() proto.APLValueType { | ||
return proto.APLValueType_ValueTypeFloat | ||
} | ||
func (value *APLValueCurrentEnergy) GetFloat(sim *Simulation) float64 { | ||
return value.unit.CurrentEnergy() | ||
} | ||
|
||
type APLValueCurrentComboPoints struct { | ||
defaultAPLValueImpl | ||
unit *Unit | ||
} | ||
|
||
func (unit *Unit) newValueCurrentComboPoints(config *proto.APLValueCurrentComboPoints) APLValue { | ||
if !unit.HasEnergyBar() { | ||
return nil | ||
} | ||
return &APLValueCurrentComboPoints{ | ||
unit: unit, | ||
} | ||
} | ||
func (value *APLValueCurrentComboPoints) Type() proto.APLValueType { | ||
return proto.APLValueType_ValueTypeInt | ||
} | ||
func (value *APLValueCurrentComboPoints) GetInt(sim *Simulation) int32 { | ||
return value.unit.ComboPoints() | ||
} |
Oops, something went wrong.