playroom优化
This commit is contained in:
parent
0db815ba45
commit
ca0efb53dd
@ -18,6 +18,8 @@ func init() {
|
||||
gamedata.InitCfg(CFG_PLAYROOM_CONST)
|
||||
gamedata.InitCfg(CFG_PLAYROOM_DECORATE)
|
||||
gamedata.InitCfg(CFG_PLAYROOM_MOOD)
|
||||
gamedata.InitCfg(CFG_PLAYROOM_PHYSIOLOGY)
|
||||
gamedata.InitCfg(CFG_PLAYROOM_PHYSIOLOGY_TYPE)
|
||||
}
|
||||
|
||||
func GetUnLockLv() int {
|
||||
|
||||
@ -268,17 +268,17 @@ func (p *PlayroomMod) AddMood(Id, Num int) {
|
||||
}
|
||||
|
||||
func (p *PlayroomMod) AddPhysiology(Id, Num int) {
|
||||
Physiology := p.GetPhysiology(Id)
|
||||
if Physiology == nil {
|
||||
return
|
||||
Phy := p.GetPhysiology(Id)
|
||||
if Phy == nil {
|
||||
Phy = &Physiology{Id: Id, Num: 0, Time: 0}
|
||||
}
|
||||
Max := playroomCfg.GetPhysiologyMax(Id)
|
||||
Physiology.Num = max(0, min(Physiology.Num+Num, Max))
|
||||
if Physiology.Num != 0 && Physiology.Time == 0 {
|
||||
Physiology.Time = GoUtil.Now()
|
||||
Phy.Num = max(0, min(Phy.Num+Num, Max))
|
||||
if Phy.Num != 0 && Phy.Time == 0 {
|
||||
Phy.Time = GoUtil.Now()
|
||||
}
|
||||
if Physiology.Num == 0 {
|
||||
Physiology.Time = 0
|
||||
if Phy.Num == 0 {
|
||||
Phy.Time = 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user