Skip to content

Commit

Permalink
fixed twilight weapon bug (#578)
Browse files Browse the repository at this point in the history
https://gcsim.app/viewer/share/perm_cF80JZ-dO3qVKnFKMFZn9

Tested, applying the buff as intended, assumed dynamic
  • Loading branch information
IvanHdzF authored Jun 1, 2022
1 parent a2dfa72 commit 1bf01c6
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions internal/weapons/bow/twilight/twilight.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,30 @@ func init() {
}

//Has three states, Evengleam, Afterglow, and Dawnblaze, which increase DMG dealt by 7.5%/12.5%/17.5% respectively.
// When attacks hit opponents, this weapon will switch to the next state. This weapon can change states once every 7s.
// When attacks hit opponents, this weapon will switch to the next state. This weapon can change states once every 7s.
//The character equipping this weapon can still trigger the state switch while not on the field.
func weapon(char core.Character, c *core.Core, r int, param map[string]int) string {
m := make([]float64, core.EndStatType)
cycle:=0
cycle := 0
base := 0.0

m[core.DmgP] = base
//buff is assumed to be dynamic but idk
//TODO: buff is assumed to be dynamic but idk
char.AddPreDamageMod(core.PreDamageMod{
Expiry: -1,
Key: "twilight-bonus-dmg",
Amount: func(atk *core.AttackEvent, t core.Target) ([]float64, bool) {
switch cycle {
case 2:
base = 0.14 + float64(r)*0.035
base = 0.105 + float64(r)*0.035
case 1:
base = 0.10 + float64(r)*0.025
base = 0.075 + float64(r)*0.025
default:
base = 0.06 + float64(r)*0.015
base = 0.045 + float64(r)*0.015
}


m[core.DmgP] = base
return nil, false
return m, true
},
})

Expand All @@ -53,7 +52,8 @@ func weapon(char core.Character, c *core.Core, r int, param map[string]int) stri
}
icd = c.F + 420 //once every 7 seconds #smokeweedeveryday
cycle++
cycle=cycle%3
cycle = cycle % 3
c.Log.NewEvent("Twilight cycle changed", core.LogWeaponEvent, char.CharIndex(), "cycle", cycle, "next cycle", icd)

return false
}, fmt.Sprintf("fadingtwilight-%v", char.Name()))
Expand Down

0 comments on commit 1bf01c6

Please sign in to comment.