package attribute
func NewAttributeNumeric(pData float32) *AttributeNumeric {
attribute := &AttributeNumeric{
BaseValue: NewFixedNumeric(pData),
ProValue: NewFixedNumeric(pData),
AppendValue: NewFixedNumeric(pData),
BuffProValue: NewFixedNumeric(pData),
BuffValue: NewFixedNumeric(pData),
}
attribute.SetBase(pData)
return attribute
}
type AttributeNumeric struct {
fixedValue *FixedPoint
///
/// 基础数值
///
BaseValue *FixedNumeric
///
/// 附加数值
///
AppendValue *FixedNumeric
///
/// 附加百分比数值
///
ProValue *FixedNumeric
///
/// Buff附加数值
///
BuffValue *FixedNumeric
///
/// Buff附加百分比数值
///
BuffProValue *FixedNumeric
}
func (this *AttributeNumeric) SetBase(value float32) float32 {
this.BaseValue.Set(value)
this.onChange()
return this.BaseValue.Value()
}
func (this *AttributeNumeric) onChange() {
// this.FixedValue = (BaseValue.Fixed*(1+ProValue.Fixed)+AppendValue.Fixed)*(1+BuffProValue.Fixed) + BuffValue.Fixed
}