Skip to content

Commit

Permalink
Merge pull request #887 from k0l11/endoftheline
Browse files Browse the repository at this point in the history
add endoftheline
  • Loading branch information
skippi authored Aug 31, 2022
2 parents bcf8e22 + eabe082 commit 2b6b695
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 0 deletions.
Binary file added assets/weapons/endoftheline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
108 changes: 108 additions & 0 deletions internal/weapons/bow/endoftheline/endoftheline.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
package endoftheline

import (
"fmt"

"github.com/genshinsim/gcsim/pkg/core"
"github.com/genshinsim/gcsim/pkg/core/attributes"
"github.com/genshinsim/gcsim/pkg/core/combat"
"github.com/genshinsim/gcsim/pkg/core/event"
"github.com/genshinsim/gcsim/pkg/core/glog"
"github.com/genshinsim/gcsim/pkg/core/keys"
"github.com/genshinsim/gcsim/pkg/core/player/character"
"github.com/genshinsim/gcsim/pkg/core/player/weapon"
)

func init() {
core.RegisterWeaponFunc(keys.EndOfTheLine, NewWeapon)
}

type Weapon struct {
Index int
procCount int
}

func (w *Weapon) SetIndex(idx int) { w.Index = idx }
func (w *Weapon) Init() error { return nil }

// Triggers the Flowrider effect after using an Elemental Skill, dealing 80% ATK as AoE DMG upon hitting an opponent with an attack.
// Flowrider will be removed after 15s or after causing 3 instances of AoE DMG.
// Only 1 instance of AoE DMG can be caused every 2s in this way.
// Flowrider can be triggered once every 12s.
func NewWeapon(c *core.Core, char *character.CharWrapper, p weapon.WeaponProfile) (weapon.Weapon, error) {
w := &Weapon{}
r := p.Refine

flowriderDmg := 0.60 + float64(r)*0.20
const effectKey = "endoftheline-effect"
const effectIcdKey = "endoftheline-effect-icd"
const dmgIcdKey = "endoftheline-dmg-icd"

c.Events.Subscribe(event.OnSkill, func(args ...interface{}) bool {
// do nothing if holder is off-field
if c.Player.Active() != char.Index {
return false
}
// do nothing if flowrider is on icd
if char.StatusIsActive(effectIcdKey) {
return false
}
// add flowrider status and proc flowrider icd
char.AddStatus(effectKey, 15*60, true)
char.AddStatus(effectIcdKey, 12*60, true)
// reset icd
if char.StatusIsActive(dmgIcdKey) {
char.DeleteStatus(dmgIcdKey)
}
// reset proc count
w.procCount = 0
return false
}, fmt.Sprintf("endoftheline-effect-%v", char.Base.Key.String()))

c.Events.Subscribe(event.OnDamage, func(args ...interface{}) bool {
atk := args[1].(*combat.AttackEvent)
// do nothing if holder is off-field
if c.Player.Active() != char.Index {
return false
}
// do nothing if attack not from holder
if atk.Info.ActorIndex != char.Index {
return false
}
// do nothing if flowrider is not active
if !char.StatusIsActive(effectKey) {
return false
}
// do nothing if flowrider dmg is on icd
if char.StatusIsActive(dmgIcdKey) {
return false
}
// queue up flowrider proc
ai := combat.AttackInfo{
ActorIndex: char.Index,
Abil: "End of the Line Proc",
AttackTag: combat.AttackTagWeaponSkill,
ICDTag: combat.ICDTagNone,
ICDGroup: combat.ICDGroupDefault,
StrikeType: combat.StrikeTypeDefault,
Element: attributes.Physical,
Durability: 100,
Mult: flowriderDmg,
}
trg := args[0].(combat.Target)
c.QueueAttack(ai, combat.NewCircleHit(trg, 2.5, false, combat.TargettableEnemy), 0, 1)

w.procCount++
c.Log.NewEvent("endoftheline proc", glog.LogWeaponEvent, char.Index).
Write("procCount", w.procCount)
if w.procCount == 3 {
char.DeleteStatus(effectKey)
} else {
char.AddStatus(dmgIcdKey, 2*60, true)
}

return false
}, fmt.Sprintf("endoftheline-dmg-%v", char.Base.Key.String()))

return w, nil
}
37 changes: 37 additions & 0 deletions pkg/core/curves/weaponcurves.go
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,43 @@ var WeaponBaseMap = map[keys.Weapon]WeaponBase{
},
},
},
keys.EndOfTheLine: {
AtkCurve: GROW_CURVE_ATTACK_201,
SpecializedCurve: GROW_CURVE_CRITICAL_201,
BaseAtk: 42.4010009765625,
BaseSpecialized: 0.10000000149011612,
Specialized: attributes.ER,
PromotionBonus: []PromoData{
{
MaxLevel: 20,
Atk: 0,
},
{
MaxLevel: 40,
Atk: 25.899999618530273,
},
{
MaxLevel: 50,
Atk: 51.900001525878906,
},
{
MaxLevel: 60,
Atk: 77.80000305175781,
},
{
MaxLevel: 70,
Atk: 103.69999694824219,
},
{
MaxLevel: 80,
Atk: 129.6999969482422,
},
{
MaxLevel: 90,
Atk: 155.60000610351562,
},
},
},
keys.EngulfingLightning: {
AtkCurve: GROW_CURVE_ATTACK_301,
SpecializedCurve: GROW_CURVE_CRITICAL_301,
Expand Down
2 changes: 2 additions & 0 deletions pkg/core/keys/weapon.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ var weaponNames = []string{
"dullblade",
"elegyfortheend",
"emeraldorb",
"endoftheline",
"engulfinglightning",
"everlastingmoonglow",
"eyeofperception",
Expand Down Expand Up @@ -201,6 +202,7 @@ const (
DullBlade
ElegyForTheEnd
EmeraldOrb
EndOfTheLine
EngulfingLightning
EverlastingMoonglow
EyeOfPerception
Expand Down
1 change: 1 addition & 0 deletions pkg/shortcut/weapons.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ var WeaponNameToKey = map[string]keys.Weapon{
"elegyfortheend": keys.ElegyForTheEnd,
"elegy": keys.ElegyForTheEnd,
"emeraldorb": keys.EmeraldOrb,
"endoftheline": keys.EndOfTheLine,
"engulfinglightning": keys.EngulfingLightning,
"engulfing": keys.EngulfingLightning,
"everlastingmoonglow": keys.EverlastingMoonglow,
Expand Down
1 change: 1 addition & 0 deletions pkg/simulation/imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ import (
_ "github.com/genshinsim/gcsim/internal/weapons/bow/blackcliff"
_ "github.com/genshinsim/gcsim/internal/weapons/bow/compound"
_ "github.com/genshinsim/gcsim/internal/weapons/bow/elegy"
_ "github.com/genshinsim/gcsim/internal/weapons/bow/endoftheline"
_ "github.com/genshinsim/gcsim/internal/weapons/bow/favonius"
_ "github.com/genshinsim/gcsim/internal/weapons/bow/hamayumi"
_ "github.com/genshinsim/gcsim/internal/weapons/bow/huntersbow"
Expand Down

0 comments on commit 2b6b695

Please sign in to comment.