monster.go 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // Code generated by excel export. DO NOT EDIT.
  2. package data
  3. import (
  4. "f1-game/internal/types"
  5. )
  6. var Monster = &monsterConfig{}
  7. func init() {
  8. _allList = append(_allList, Monster)
  9. }
  10. type (
  11. MonsterRow struct {
  12. ID int32 `json:"ID"` // ID
  13. Level int32 `json:"Level"` // 等级
  14. Job int32 `json:"Job"` // 职业
  15. SkillLevels types.PairList[int32, int32] `json:"SkillLevels"` // 技能等级
  16. MinAttack int64 `json:"MinAttack"` // 最小攻击
  17. MaxAttack int64 `json:"MaxAttack"` // 最大攻击
  18. AttackSpeed int64 `json:"AttackSpeed"` // 攻击速度
  19. Speed int64 `json:"Speed"` // 移动速度
  20. MinDefense int64 `json:"MinDefense"` // 最小防御
  21. MaxDefense int64 `json:"MaxDefense"` // 最大防御
  22. Hp int64 `json:"Hp"` // 血量
  23. CriticalHitChance int64 `json:"CriticalHitChance"` // 暴击率
  24. CriticalHitResistance int64 `json:"CriticalHitResistance"` // 暴击抵抗
  25. CriticalHitDamage int64 `json:"CriticalHitDamage"` // 暴击伤害
  26. CriticalHitDamageResistance int64 `json:"CriticalHitDamageResistance"` // 暴伤抵抗
  27. Luck int64 `json:"Luck"` // 幸运值
  28. DamageBonus int64 `json:"DamageBonus"` // 伤害加成
  29. DamageReduction int64 `json:"DamageReduction"` // 伤害减免
  30. SquadAttackBonus int64 `json:"SquadAttackBonus"` // 兵团攻击加成
  31. SquadHealthBonus int64 `json:"SquadHealthBonus"` // 兵团生命加成
  32. }
  33. monsterConfig struct {
  34. baseConfig
  35. list []*MonsterRow // all list
  36. idUniMaps map[int32]*MonsterRow // key:id
  37. }
  38. )
  39. func (p *monsterConfig) Name() string {
  40. return "monster"
  41. }
  42. func (p *monsterConfig) Init() {
  43. p.idUniMaps = map[int32]*MonsterRow{}
  44. }
  45. func (p *monsterConfig) OnLoad(maps interface{}, reload bool) (int, error) {
  46. if reload && p.denyLoad {
  47. return 0, nil
  48. }
  49. var list []*MonsterRow
  50. if err := DecodeData(maps, &list); err != nil {
  51. return 0, err
  52. }
  53. p.list = list
  54. idUniMaps := map[int32]*MonsterRow{}
  55. for _, row := range list {
  56. idUniMaps[row.ID] = row
  57. }
  58. p.idUniMaps = idUniMaps
  59. return len(list), nil
  60. }
  61. // func (p *monsterConfig) OnAfterLoad(_ bool) {
  62. // }
  63. func (p *monsterConfig) List() []*MonsterRow {
  64. return p.list
  65. }
  66. func (p *monsterConfig) GetByID(id int32) (*MonsterRow, bool) {
  67. value, found := p.idUniMaps[id]
  68. return value, found
  69. }
  70. func (p *monsterConfig) ContainID(id int32) bool {
  71. _, found := p.idUniMaps[id]
  72. return found
  73. }