@@ -458,28 +458,24 @@ func init() {
458458 }
459459 }
460460 }
461- // --- 修改开始:分组独立判定合成成功率 ---
462461 groupCount := len (list ) / 3
463462 successCount := 0
464463 failCount := 0
465- successAttributes := []string {} // 存储成功鱼竿的属性描述
464+ successAttributes := []string {}
466465
467466 for g := 0 ; g < groupCount ; g ++ {
468467 idx1 := list [g * 3 ]
469468 idx2 := list [g * 3 + 1 ]
470469 idx3 := list [g * 3 + 2 ]
471470
472- // 取出三个材料
473471 thingInfo1 := articles [idx1 ]
474472 thingInfo2 := articles [idx2 ]
475473 thingInfo3 := articles [idx3 ]
476474
477- // 删除材料(假设每个数量为1)
478475 thingInfo1 .Number = 0
479476 thingInfo2 .Number = 0
480477 thingInfo3 .Number = 0
481478
482- // 更新数据库,删除这三个材料
483479 err = dbdata .updateUserThingInfo (uid , thingInfo1 )
484480 if err != nil {
485481 ctx .SendChain (message .Text ("[ERROR at pole.go.12]:" , err ))
@@ -496,18 +492,15 @@ func init() {
496492 return
497493 }
498494
499- // 随机判定,成功率90%
500495 if rand .Intn (100 ) >= 90 {
501496 failCount ++
502497 continue
503498 }
504499
505- // 计算平均附魔等级
506500 favorLevel := (poles [idx1 ].Favor + poles [idx2 ].Favor + poles [idx3 ].Favor ) / 3
507501 induceLevel := (poles [idx1 ].Induce + poles [idx2 ].Induce + poles [idx3 ].Induce ) / 3
508502 attribute := strconv .Itoa (durationList [thingName ]) + "/0/" + strconv .Itoa (induceLevel ) + "/" + strconv .Itoa (favorLevel )
509503
510- // 生成合成后的鱼竿
511504 newthing := article {
512505 Duration : time .Now ().Unix () + int64 (g * 10 ), // 加偏移避免主键冲突
513506 Type : "pole" ,
@@ -524,11 +517,9 @@ func init() {
524517 successAttributes = append (successAttributes , attribute )
525518 }
526519
527- // 构造结果消息
528520 resultMsg := ""
529521 if successCount > 0 {
530522 resultMsg += "成功合成 " + strconv .Itoa (successCount ) + " 个" + thingName + "\n "
531- // 显示属性,如果太多则只显示前几个
532523 if len (successAttributes ) <= 5 {
533524 for _ , attr := range successAttributes {
534525 resultMsg += "属性: " + attr + "\n "
@@ -549,6 +540,5 @@ func init() {
549540 message .Text (resultMsg ),
550541 ),
551542 )
552- // --- 修改结束 ---
553543})
554544}
0 commit comments