Skip to content

Commit

Permalink
Improve panic message for invalid talents, and fix prot warrior bug w…
Browse files Browse the repository at this point in the history
…ith Rend not being registered
  • Loading branch information
jimmyt857 committed Dec 2, 2023
1 parent 65471fb commit 054068f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sim/core/character.go
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,11 @@ func FillTalentsProto(data protoreflect.Message, talentsStr string, treeSizes [3
for treeIdx, treeStr := range treeStrs {
for talentIdx, talentValStr := range treeStr {
talentVal, _ := strconv.Atoi(string(talentValStr))
fd := fieldDescriptors.ByNumber(protowire.Number(offset + talentIdx + 1))
talentOffset := offset + talentIdx + 1
fd := fieldDescriptors.ByNumber(protowire.Number(talentOffset))
if fd == nil {
panic(fmt.Sprintf("Couldn't find proto field for talent #%d, full string: %s", talentOffset, talentsStr))
}
if fd.Kind() == protoreflect.BoolKind {
data.Set(fd, protoreflect.ValueOfBool(talentVal == 1))
} else { // Int32Kind
Expand Down
1 change: 1 addition & 0 deletions sim/warrior/protection/protection_warrior.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func (war *ProtectionWarrior) Initialize() {
war.Warrior.Initialize()

war.RegisterHSOrCleave(false, war.Rotation.HsRageThreshold)
war.RegisterRendSpell(0, 0)
war.RegisterShieldWallCD()
war.RegisterShieldBlockCD()
war.DefensiveStanceAura.BuildPhase = core.CharacterBuildPhaseTalents
Expand Down

0 comments on commit 054068f

Please sign in to comment.