mirror of
https://github.com/Walter-Sparrow/lunar-tear.git
synced 2026-07-02 05:43:41 +03:00
Add campaign bonuses; fix parts variant/sub-stat grants and menu-pick quest resume state
Build and Push Docker images to Docker Hub / build-and-push (push) Has been cancelled
Build and Push Docker images to Docker Hub / build-and-push (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
package campaign
|
||||
|
||||
type RateBonus struct {
|
||||
override int32
|
||||
bonusPermil int32
|
||||
}
|
||||
|
||||
func (b RateBonus) Apply(basePermil int32) int32 {
|
||||
base := basePermil
|
||||
if b.override > 0 {
|
||||
base = b.override
|
||||
}
|
||||
return clampPermil(base + b.bonusPermil)
|
||||
}
|
||||
|
||||
type ExpBonus struct {
|
||||
bonusPermil int32
|
||||
}
|
||||
|
||||
func (b ExpBonus) Apply(base int32) int32 {
|
||||
return base * (1000 + b.bonusPermil) / 1000
|
||||
}
|
||||
|
||||
type StaminaMul struct {
|
||||
permil int32
|
||||
}
|
||||
|
||||
func (m StaminaMul) Apply(base int32) int32 {
|
||||
if m.permil == 1000 {
|
||||
return base
|
||||
}
|
||||
return base * m.permil / 1000
|
||||
}
|
||||
|
||||
type DropRateMul struct {
|
||||
bonusPermil int32
|
||||
}
|
||||
|
||||
func (m DropRateMul) Apply(base int32) int32 {
|
||||
return (base*(1000+m.bonusPermil) + 999) / 1000
|
||||
}
|
||||
|
||||
type BonusDrop struct {
|
||||
PossessionType int32
|
||||
PossessionId int32
|
||||
Count int32
|
||||
}
|
||||
|
||||
func clampPermil(v int32) int32 {
|
||||
if v < 0 {
|
||||
return 0
|
||||
}
|
||||
if v > 1000 {
|
||||
return 1000
|
||||
}
|
||||
return v
|
||||
}
|
||||
Reference in New Issue
Block a user