Skip to content

Commit

Permalink
pull blizzardsorc configs back into blizzard_sorceress.go
Browse files Browse the repository at this point in the history
  • Loading branch information
jasorello committed Feb 26, 2025
1 parent 87ade39 commit 2b5b715
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
41 changes: 26 additions & 15 deletions internal/character/blizzard_sorceress.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ type BlizzardSorceress struct {
BaseCharacter
}

func (s BlizzardSorceress) attackConfig() map[string]int {
// Avoiding constants that pollute the other characters in the package
return map[string]int{
"maxAttacksLoop": 100,
"leftSkillMinimumDistance": 8,
"leftSkillMaximumDistance": 20,
"blizzardMinimumDistance": 6,
"blizzardMaximumDistance": 15,
}
}

func (s BlizzardSorceress) CheckKeyBindings() []skill.ID {
requireKeybindings := []skill.ID{skill.Blizzard, skill.Teleport, skill.TomeOfTownPortal, skill.ShiverArmor, skill.StaticField}

Expand Down Expand Up @@ -93,15 +104,15 @@ func (s BlizzardSorceress) KillMonsterSequence(
) error {
completedAttackLoops := 0
previousUnitID := 0
// previousSelfBlizzard := time.Time{}
previousSelfBlizzard := time.Time{}

blizzOpts := step.StationaryDistance(
s.Data.CharacterCfg.Character.Sorceress.BlizzardSorceress.BlizzardMinDist,
s.Data.CharacterCfg.Character.Sorceress.BlizzardSorceress.BlizzardMaxDist,
s.attackConfig()["blizzardMinimumDistance"],
s.attackConfig()["blizzardMaximumDistance"],
)
lsOpts := step.Distance(
s.Data.CharacterCfg.Character.Sorceress.BlizzardSorceress.LeftSkillMinDist,
s.Data.CharacterCfg.Character.Sorceress.BlizzardSorceress.LeftSkillMaxDist,
s.attackConfig()["leftSkillMinimumDistance"],
s.attackConfig()["leftSkillMaximumDistance"],
)

for {
Expand All @@ -117,7 +128,7 @@ func (s BlizzardSorceress) KillMonsterSequence(
return nil
}

if completedAttackLoops >= s.Data.CharacterCfg.Character.Sorceress.BlizzardSorceress.MaxAttacksLoop {
if completedAttackLoops >= s.attackConfig()["maxAttacksLoop"] {
s.Logger.Error("Exceeded MaxAttacksLoop", slog.String("completedAttackLoops", fmt.Sprintf("%v", completedAttackLoops)))
return nil
}
Expand All @@ -131,15 +142,15 @@ func (s BlizzardSorceress) KillMonsterSequence(
return nil
}

// // Cast a Blizzard on very close mobs, in order to clear possible trash close the player, every two attack rotations
// if time.Since(previousSelfBlizzard) > time.Second*4 && !s.Data.PlayerUnit.States.HasState(state.Cooldown) {
// for _, m := range s.Data.Monsters.Enemies() {
// if dist := s.PathFinder.DistanceFromMe(m.Position); dist < 4 {
// previousSelfBlizzard = time.Now()
// step.SecondaryAttack(skill.Blizzard, m.UnitID, 1, blizzOpts)
// }
// }
// }
// Cast a Blizzard on very close mobs, in order to clear possible trash close the player, every two attack rotations
if time.Since(previousSelfBlizzard) > time.Second*4 && !s.Data.PlayerUnit.States.HasState(state.Cooldown) {
for _, m := range s.Data.Monsters.Enemies() {
if dist := s.PathFinder.DistanceFromMe(m.Position); dist < 4 {
previousSelfBlizzard = time.Now()
step.SecondaryAttack(skill.Blizzard, m.UnitID, 1, blizzOpts)
}
}
}

for s.Data.PlayerUnit.States.HasState(state.Cooldown) {
step.PrimaryAttack(id, 2, true, lsOpts)
Expand Down
7 changes: 0 additions & 7 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,6 @@ type CharacterCfg struct {
Sorceress struct {
StaticFieldMinDist int `yaml:"static_field_minimum_distance"`
StaticFieldMaxDist int `yaml:"static_field_maximum_distance"`
BlizzardSorceress struct {
MaxAttacksLoop int `yaml:"max_attacks_loop"`
LeftSkillMinDist int `yaml:"left_skill_minimum_distance"`
LeftSkillMaxDist int `yaml:"left_skill_maximum_distance"`
BlizzardMinDist int `yaml:"blizzard_minimum_distance"`
BlizzardMaxDist int `yaml:"blizzard_maximum_distance"`
} `yaml:"blizzard"`
} `yaml:"sorceress"`
NovaSorceress struct {
BossStaticThreshold int `yaml:"boss_static_threshold"`
Expand Down

0 comments on commit 2b5b715

Please sign in to comment.