| 赞 | 3 |
| VIP | 0 |
| 好人卡 | 0 |
| 积分 | 46 |
| 经验 | 13328 |
| 最后登录 | 2026-3-29 |
| 在线时间 | 281 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 4647
- 在线时间
- 281 小时
- 注册时间
- 2013-10-13
- 帖子
- 852
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
# 最大概率值作为 3 合计计算(0 除外)
ratings_total = 0
for action in available_actions
#ratings_total=2,5
if action.rating > rating_max - 3
ratings_total += action.rating - (rating_max - 3)
end
end
# 概率合计不为 0 的情况下
if ratings_total > 0
# 生成随机数
value = rand(ratings_total)
# 设置对应生成随机数的当前行动
for action in available_actions
if action.rating > rating_max - 3
if value < action.rating - (rating_max - 3)
self.current_action.kind = action.kind
self.current_action.basic = action.basic
self.current_action.skill_id = action.skill_id
self.current_action.decide_random_target_for_enemy
return
else
value -= action.rating - (rating_max - 3)
end
end
end
end
请问:敌人行为的概率是怎么算的? |
|