1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-06-06 03:37:13 +08:00

feat: 增加Chick角色的远程攻击逻辑,优化攻击方式选择

This commit is contained in:
2025-09-06 18:45:05 +08:00
parent 6b66cef6cb
commit b8027d1c7e
3 changed files with 23 additions and 7 deletions
+6
View File
@@ -9,6 +9,12 @@ static func randv2_range(offset: float):
)
static func randc_from(array: Array):
return array[randi() % array.size()]
static func randc_from_weights(indexes: Array, weights: Array[int]):
var totals: Array = []
for i in indexes:
for j in range(weights[i]):
totals.append(i)
return randc_from(totals)
static func signBeforeStr(value: float):
return ("+" if value > 0 else "-" if value < 0 else "") + str(abs(value))
static func percent(value: float):