-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #762 from k0l11/add-missing-weapons
add missing weapons
- Loading branch information
Showing
19 changed files
with
698 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package messenger | ||
|
||
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/keys" | ||
"github.com/genshinsim/gcsim/pkg/core/player/character" | ||
"github.com/genshinsim/gcsim/pkg/core/player/weapon" | ||
) | ||
|
||
func init() { | ||
core.RegisterWeaponFunc(keys.Messenger, NewWeapon) | ||
} | ||
|
||
type Weapon struct { | ||
Index int | ||
} | ||
|
||
func (w *Weapon) SetIndex(idx int) { w.Index = idx } | ||
func (w *Weapon) Init() error { return nil } | ||
|
||
// Charged Attack hits on weak spots deal an additional 100/125/150/175/200% ATK DMG as CRIT DMG. | ||
// Can only occur once every 10s. | ||
func NewWeapon(c *core.Core, char *character.CharWrapper, p weapon.WeaponProfile) (weapon.Weapon, error) { | ||
w := &Weapon{} | ||
r := p.Refine | ||
|
||
dmg := 0.75 + float64(r)*0.25 | ||
const icdKey = "messenger-icd" | ||
|
||
c.Events.Subscribe(event.OnDamage, func(args ...interface{}) bool { | ||
atk := args[1].(*combat.AttackEvent) | ||
trg := args[0].(combat.Target) | ||
// don't proc if dmg not from weapon holder | ||
if atk.Info.ActorIndex != char.Index { | ||
return false | ||
} | ||
// don't proc if off-field | ||
if c.Player.Active() != char.Index { | ||
return false | ||
} | ||
// don't proc if not hitting weakspot | ||
if !atk.Info.HitWeakPoint { | ||
return false | ||
} | ||
// don't proc if on icd | ||
if char.StatusIsActive(icdKey) { | ||
return false | ||
} | ||
// set icd | ||
char.AddStatus(icdKey, 10*60, true) // 10s icd | ||
|
||
// queue single target proc | ||
ai := combat.AttackInfo{ | ||
ActorIndex: char.Index, | ||
Abil: "Messenger Proc", | ||
AttackTag: combat.AttackTagNone, | ||
ICDTag: combat.ICDTagNone, | ||
ICDGroup: combat.ICDGroupDefault, | ||
Element: attributes.Physical, | ||
Durability: 100, | ||
Mult: dmg, | ||
HitWeakPoint: true, // ensure crit by marking it as hitting weakspot | ||
} | ||
c.QueueAttack(ai, combat.NewDefSingleTarget(trg.Index(), combat.TargettableEnemy), 0, 1) | ||
|
||
return false | ||
}, fmt.Sprintf("messenger-%v", char.Base.Key.String())) | ||
|
||
return w, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package raven | ||
|
||
import ( | ||
"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/keys" | ||
"github.com/genshinsim/gcsim/pkg/core/player/character" | ||
"github.com/genshinsim/gcsim/pkg/core/player/weapon" | ||
"github.com/genshinsim/gcsim/pkg/enemy" | ||
"github.com/genshinsim/gcsim/pkg/modifier" | ||
) | ||
|
||
func init() { | ||
core.RegisterWeaponFunc(keys.RavenBow, NewWeapon) | ||
} | ||
|
||
type Weapon struct { | ||
Index int | ||
} | ||
|
||
func (w *Weapon) SetIndex(idx int) { w.Index = idx } | ||
func (w *Weapon) Init() error { return nil } | ||
|
||
// Increases DMG against opponents affected by Hydro or Pyro by 12/15/18/21/24%. | ||
func NewWeapon(c *core.Core, char *character.CharWrapper, p weapon.WeaponProfile) (weapon.Weapon, error) { | ||
w := &Weapon{} | ||
r := p.Refine | ||
|
||
dmg := 0.09 + float64(r)*0.03 | ||
m := make([]float64, attributes.EndStatType) | ||
m[attributes.DmgP] = dmg | ||
char.AddAttackMod(character.AttackMod{ | ||
Base: modifier.NewBase("ravenbow", -1), | ||
Amount: func(atk *combat.AttackEvent, t combat.Target) ([]float64, bool) { | ||
x, ok := t.(*enemy.Enemy) | ||
if !ok { | ||
return nil, false | ||
} | ||
if x.AuraContains(attributes.Hydro, attributes.Pyro) { | ||
return m, true | ||
} | ||
return nil, false | ||
}, | ||
}) | ||
|
||
return w, nil | ||
} |
11 changes: 11 additions & 0 deletions
11
internal/weapons/bow/seasonedhuntersbow/seaonedhuntersbow.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package seasonedhuntersbow | ||
|
||
import ( | ||
"github.com/genshinsim/gcsim/internal/weapons/common" | ||
"github.com/genshinsim/gcsim/pkg/core" | ||
"github.com/genshinsim/gcsim/pkg/core/keys" | ||
) | ||
|
||
func init() { | ||
core.RegisterWeaponFunc(keys.SeasonedHuntersBow, common.NewNoEffect) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package emeraldorb | ||
|
||
import ( | ||
"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/keys" | ||
"github.com/genshinsim/gcsim/pkg/core/player/character" | ||
"github.com/genshinsim/gcsim/pkg/core/player/weapon" | ||
"github.com/genshinsim/gcsim/pkg/modifier" | ||
) | ||
|
||
func init() { | ||
core.RegisterWeaponFunc(keys.EmeraldOrb, NewWeapon) | ||
} | ||
|
||
type Weapon struct { | ||
Index int | ||
} | ||
|
||
func (w *Weapon) SetIndex(idx int) { w.Index = idx } | ||
func (w *Weapon) Init() error { return nil } | ||
|
||
//Upon causing a Vaporize, Electro-Charged, Frozen, or a Hydro-infused Swirl reaction, increases ATK by 20/25/30/35/40% for 12s. | ||
func NewWeapon(c *core.Core, char *character.CharWrapper, p weapon.WeaponProfile) (weapon.Weapon, error) { | ||
w := &Weapon{} | ||
r := p.Refine | ||
|
||
m := make([]float64, attributes.EndStatType) | ||
m[attributes.ATKP] = 0.15 + float64(r)*0.05 | ||
|
||
addBuff := func(args ...interface{}) bool { | ||
atk := args[1].(*combat.AttackEvent) | ||
// don't proc if dmg not from weapon holder | ||
if atk.Info.ActorIndex != char.Index { | ||
return false | ||
} | ||
// don't proc if off-field | ||
if c.Player.Active() != char.Index { | ||
return false | ||
} | ||
|
||
// add buff | ||
char.AddStatMod(character.StatMod{ | ||
Base: modifier.NewBaseWithHitlag("emeraldorb", 720), | ||
AffectedStat: attributes.NoStat, | ||
Amount: func() ([]float64, bool) { | ||
return m, true | ||
}, | ||
}) | ||
|
||
return false | ||
} | ||
|
||
c.Events.Subscribe(event.OnVaporize, addBuff, "emeraldorb-"+char.Base.Key.String()) | ||
c.Events.Subscribe(event.OnElectroCharged, addBuff, "emeraldorb-"+char.Base.Key.String()) | ||
c.Events.Subscribe(event.OnFrozen, addBuff, "emeraldorb-"+char.Base.Key.String()) | ||
c.Events.Subscribe(event.OnSwirlHydro, addBuff, "emeraldorb-"+char.Base.Key.String()) | ||
|
||
return w, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package otherworldly | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/genshinsim/gcsim/pkg/core" | ||
"github.com/genshinsim/gcsim/pkg/core/event" | ||
"github.com/genshinsim/gcsim/pkg/core/keys" | ||
"github.com/genshinsim/gcsim/pkg/core/player" | ||
"github.com/genshinsim/gcsim/pkg/core/player/character" | ||
"github.com/genshinsim/gcsim/pkg/core/player/weapon" | ||
) | ||
|
||
func init() { | ||
core.RegisterWeaponFunc(keys.OtherworldlyStory, NewWeapon) | ||
} | ||
|
||
type Weapon struct { | ||
Index int | ||
} | ||
|
||
func (w *Weapon) SetIndex(idx int) { w.Index = idx } | ||
func (w *Weapon) Init() error { return nil } | ||
|
||
// Each Elemental Orb or Particle collected restores 1/1.25/1.5/1.75/2% HP. | ||
func NewWeapon(c *core.Core, char *character.CharWrapper, p weapon.WeaponProfile) (weapon.Weapon, error) { | ||
w := &Weapon{} | ||
r := p.Refine | ||
|
||
c.Events.Subscribe(event.OnParticleReceived, func(args ...interface{}) bool { | ||
// ignore if character not on field | ||
if c.Player.Active() != char.Index { | ||
return false | ||
} | ||
c.Player.Heal(player.HealInfo{ | ||
Type: player.HealTypePercent, | ||
Message: "Otherworldly Story (Proc)", | ||
Src: 0.0075 + float64(r)*0.0025, | ||
}) | ||
|
||
return false | ||
}, fmt.Sprintf("otherworldlystory-%v", char.Base.Key.String())) | ||
|
||
return w, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package pocket | ||
|
||
import ( | ||
"github.com/genshinsim/gcsim/internal/weapons/common" | ||
"github.com/genshinsim/gcsim/pkg/core" | ||
"github.com/genshinsim/gcsim/pkg/core/keys" | ||
) | ||
|
||
func init() { | ||
core.RegisterWeaponFunc(keys.PocketGrimoire, common.NewNoEffect) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package twin | ||
|
||
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/keys" | ||
"github.com/genshinsim/gcsim/pkg/core/player/character" | ||
"github.com/genshinsim/gcsim/pkg/core/player/weapon" | ||
"github.com/genshinsim/gcsim/pkg/enemy" | ||
"github.com/genshinsim/gcsim/pkg/modifier" | ||
) | ||
|
||
func init() { | ||
core.RegisterWeaponFunc(keys.TwinNephrite, NewWeapon) | ||
} | ||
|
||
type Weapon struct { | ||
Index int | ||
} | ||
|
||
func (w *Weapon) SetIndex(idx int) { w.Index = idx } | ||
func (w *Weapon) Init() error { return nil } | ||
|
||
// Defeating an opponent increases Movement SPD and ATK by 12/14/16/18/20% for 15s. | ||
func NewWeapon(c *core.Core, char *character.CharWrapper, p weapon.WeaponProfile) (weapon.Weapon, error) { | ||
w := &Weapon{} | ||
r := p.Refine | ||
|
||
m := make([]float64, attributes.EndStatType) | ||
m[attributes.ATKP] = 0.10 + float64(r)*0.02 | ||
|
||
c.Events.Subscribe(event.OnTargetDied, func(args ...interface{}) bool { | ||
_, ok := args[0].(*enemy.Enemy) | ||
// ignore if not an enemy | ||
if !ok { | ||
return false | ||
} | ||
atk := args[1].(*combat.AttackEvent) | ||
// don't proc if someone else defeated the enemy | ||
if atk.Info.ActorIndex != char.Index { | ||
return false | ||
} | ||
// don't proc if off-field | ||
if c.Player.Active() != char.Index { | ||
return false | ||
} | ||
// add buff | ||
char.AddStatMod(character.StatMod{ | ||
Base: modifier.NewBaseWithHitlag("twinnephrite", 900), // 15s | ||
AffectedStat: attributes.ATKP, | ||
Amount: func() ([]float64, bool) { | ||
return m, true | ||
}, | ||
}) | ||
return false | ||
}, fmt.Sprintf("twinnephrite-%v", char.Base.Key.String())) | ||
|
||
return w, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package bloodtainted | ||
|
||
import ( | ||
"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/keys" | ||
"github.com/genshinsim/gcsim/pkg/core/player/character" | ||
"github.com/genshinsim/gcsim/pkg/core/player/weapon" | ||
"github.com/genshinsim/gcsim/pkg/enemy" | ||
"github.com/genshinsim/gcsim/pkg/modifier" | ||
) | ||
|
||
func init() { | ||
core.RegisterWeaponFunc(keys.BloodtaintedGreatsword, NewWeapon) | ||
} | ||
|
||
type Weapon struct { | ||
Index int | ||
} | ||
|
||
func (w *Weapon) SetIndex(idx int) { w.Index = idx } | ||
func (w *Weapon) Init() error { return nil } | ||
|
||
// Increases DMG against opponents affected by Pyro or Electro by 12/15/18/21/24%. | ||
func NewWeapon(c *core.Core, char *character.CharWrapper, p weapon.WeaponProfile) (weapon.Weapon, error) { | ||
w := &Weapon{} | ||
r := p.Refine | ||
|
||
dmg := 0.09 + float64(r)*0.03 | ||
m := make([]float64, attributes.EndStatType) | ||
m[attributes.DmgP] = dmg | ||
char.AddAttackMod(character.AttackMod{ | ||
Base: modifier.NewBase("bloodtaintedgreatsword", -1), | ||
Amount: func(atk *combat.AttackEvent, t combat.Target) ([]float64, bool) { | ||
x, ok := t.(*enemy.Enemy) | ||
if !ok { | ||
return nil, false | ||
} | ||
if x.AuraContains(attributes.Pyro, attributes.Electro) { | ||
return m, true | ||
} | ||
return nil, false | ||
}, | ||
}) | ||
|
||
return w, nil | ||
} |
Oops, something went wrong.