mirror of
https://github.com/Walter-Sparrow/lunar-tear.git
synced 2026-07-02 05:43:41 +03:00
Fix enhance campaign bonus scale and int32 overflow
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:
@@ -82,7 +82,7 @@ func loadEnhanceRows() ([]enhanceRow, error) {
|
|||||||
}
|
}
|
||||||
rows = append(rows, enhanceRow{
|
rows = append(rows, enhanceRow{
|
||||||
effectType: EnhanceCampaignEffectType(c.EnhanceCampaignEffectType),
|
effectType: EnhanceCampaignEffectType(c.EnhanceCampaignEffectType),
|
||||||
effectValue: c.EnhanceCampaignEffectValue,
|
effectValue: c.EnhanceCampaignEffectValue / 10,
|
||||||
targets: grp,
|
targets: grp,
|
||||||
startMillis: c.StartDatetime,
|
startMillis: c.StartDatetime,
|
||||||
endMillis: c.EndDatetime,
|
endMillis: c.EndDatetime,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ func (b RateBonus) Apply(basePermil int32) int32 {
|
|||||||
if b.override > 0 {
|
if b.override > 0 {
|
||||||
base = b.override
|
base = b.override
|
||||||
}
|
}
|
||||||
return clampPermil(base + b.bonusPermil)
|
return clampPermil(int32(int64(base) + int64(b.bonusPermil)))
|
||||||
}
|
}
|
||||||
|
|
||||||
type ExpBonus struct {
|
type ExpBonus struct {
|
||||||
@@ -18,7 +18,7 @@ type ExpBonus struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b ExpBonus) Apply(base int32) int32 {
|
func (b ExpBonus) Apply(base int32) int32 {
|
||||||
return base * (1000 + b.bonusPermil) / 1000
|
return int32(int64(base) * int64(1000+b.bonusPermil) / 1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
type StaminaMul struct {
|
type StaminaMul struct {
|
||||||
@@ -29,7 +29,7 @@ func (m StaminaMul) Apply(base int32) int32 {
|
|||||||
if m.permil == 1000 {
|
if m.permil == 1000 {
|
||||||
return base
|
return base
|
||||||
}
|
}
|
||||||
return base * m.permil / 1000
|
return int32(int64(base) * int64(m.permil) / 1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
type DropRateMul struct {
|
type DropRateMul struct {
|
||||||
@@ -37,7 +37,7 @@ type DropRateMul struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m DropRateMul) Apply(base int32) int32 {
|
func (m DropRateMul) Apply(base int32) int32 {
|
||||||
return (base*(1000+m.bonusPermil) + 999) / 1000
|
return int32((int64(base)*int64(1000+m.bonusPermil) + 999) / 1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
type BonusDrop struct {
|
type BonusDrop struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user