2025-06-06 18:31:44 +08:00
|
|
|
package logic
|
|
|
|
|
|
|
|
import "ecs/proto/pb"
|
|
|
|
|
2025-06-07 18:31:00 +08:00
|
|
|
type PlayerLineupHero struct {
|
2025-06-06 18:31:44 +08:00
|
|
|
HeroUid uint64 `bson:"hero_uid"`
|
2025-06-07 18:31:00 +08:00
|
|
|
Position uint32 `bson:"position"`
|
2025-06-06 18:31:44 +08:00
|
|
|
Equip [4]uint64 `bson:"equip"`
|
|
|
|
Treasure [2]uint64 `bson:"treasure"`
|
|
|
|
Artifact [1]uint64 `bson:"artifact"`
|
|
|
|
Mounts [1]uint64 `bson:"mounts"`
|
|
|
|
General [1]uint64 `bson:"general"`
|
|
|
|
Ornament [1]uint64 `bson:"ornament"`
|
|
|
|
Sack [10]uint64 `bson:"sack"`
|
|
|
|
FateChart [6]uint64 `bson:"fate_chart"`
|
|
|
|
Tetris [36]uint64 `bson:"tetris"`
|
|
|
|
|
|
|
|
Capacity uint64 `bson:"-"`
|
|
|
|
}
|
|
|
|
|
2025-06-07 18:31:00 +08:00
|
|
|
func (this *PlayerLineupHero) BuildMsgLineupHero(index uint32) *pb.LineupHero {
|
|
|
|
var msg = &pb.LineupHero{
|
|
|
|
Index: index,
|
2025-06-06 18:31:44 +08:00
|
|
|
HeroUid: this.HeroUid,
|
2025-06-07 18:31:00 +08:00
|
|
|
Position: this.Position,
|
2025-06-06 18:31:44 +08:00
|
|
|
Capacity: this.Capacity,
|
|
|
|
}
|
|
|
|
if this.HeroUid != 0 {
|
2025-06-06 18:49:30 +08:00
|
|
|
msg.Equip = this.Equip[:]
|
2025-06-06 18:31:44 +08:00
|
|
|
msg.Treasure = this.Treasure[:]
|
|
|
|
msg.Artifact = this.Artifact[:]
|
|
|
|
msg.Mounts = this.Mounts[:]
|
|
|
|
msg.General = this.General[:]
|
|
|
|
msg.Ornament = this.Ornament[:]
|
|
|
|
msg.Sack = this.Sack[:]
|
|
|
|
msg.FateChart = this.FateChart[:]
|
|
|
|
msg.Tetris = this.Tetris[:]
|
|
|
|
}
|
|
|
|
return msg
|
|
|
|
}
|
2025-06-09 18:33:52 +08:00
|
|
|
|
|
|
|
func (this *Player) UpdateBattleHeroCapacity(lineupHero *PlayerLineupHero) {
|
|
|
|
if lineupHero == nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
var hero = this.Hero[lineupHero.HeroUid]
|
|
|
|
if hero == nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2025-06-20 15:34:32 +08:00
|
|
|
lineupHero.Capacity = this.calcAttrsCapacity(hero.attrs)
|
2025-06-09 18:33:52 +08:00
|
|
|
}
|