重击体力消耗

This commit is contained in:
huangxiaolei
2022-12-12 19:13:32 +08:00
parent 62b08c2ac7
commit 3e9e375e19
10 changed files with 228 additions and 101 deletions

View File

@@ -27,3 +27,10 @@ func TestAesCFB(t *testing.T) {
dec, _ := AesCFBDecrypt(enc, key, key[0:16])
fmt.Printf("dec: %v\n", dec)
}
func TestHk4eAbilityHashCode(t *testing.T) {
hashCode := Hk4eAbilityHashCode("Avatar_Ayato_ExtraAttack")
fmt.Printf("Avatar_Ayato_ExtraAttack hashCode: %v\n", hashCode)
hashCode = Hk4eAbilityHashCode("Avatar_Ayato_ExtraAttack_CreateBullet")
fmt.Printf("Avatar_Ayato_ExtraAttack_CreateBullet hashCode: %v\n", hashCode)
}

View File

@@ -4,14 +4,32 @@ import (
"bytes"
"encoding/gob"
"fmt"
"github.com/vmihailenco/msgpack/v5"
)
func DeepCopy(src, dest any) error {
func DeepCopy(dst, src any) error {
var buf bytes.Buffer
if err := gob.NewEncoder(&buf).Encode(src); err != nil {
err := gob.NewEncoder(&buf).Encode(src)
if err != nil {
return err
}
return gob.NewDecoder(bytes.NewBuffer(buf.Bytes())).Decode(dest)
err = gob.NewDecoder(bytes.NewBuffer(buf.Bytes())).Decode(dst)
if err != nil {
return err
}
return nil
}
func FastDeepCopy(dst, src any) error {
data, err := msgpack.Marshal(src)
if err != nil {
return err
}
err = msgpack.Unmarshal(data, dst)
if err != nil {
return err
}
return nil
}
func ConvBoolToInt64(v bool) int64 {