go_dreamfactory/modules/battle/fight/attribute/fixednumeric.go
2022-09-15 15:56:39 +08:00

34 lines
698 B
Go

package attribute
func NewFixedNumeric(pData float32) *FixedNumeric {
fixed := &FixedNumeric{}
fixed.Set(pData)
return fixed
}
type FixedNumeric struct {
baseValue *FixedPoint
}
func (this *FixedNumeric) Set(value float32) float32 {
this.baseValue = NewFixedPoint(value)
return this.baseValue.Scalar()
}
func (this *FixedNumeric) Fixed() *FixedPoint {
return this.baseValue
}
func (this *FixedNumeric) Value() float32 {
return this.baseValue.Scalar()
}
/// <summary>
/// 减少基本值
/// </summary>
func (this *FixedNumeric) Minus(value float32) float32 {
// this.baseValue -= value
// if this.baseValue.Scalar < 0 {
// this.baseValue = 0
// }
return this.baseValue.Scalar()
}