- 好友
- 18
- 在线时间
- 95 小时
- 最后登录
- 2026-8-5
见习骑士

- UID
- 2462463
- 第纳尔
- 1667
- 精华
- 0
- 互助
- 25
- 荣誉
- 0
- 贡献
- 0
- 魅力
- 107
- 注册时间
- 2015-3-3
 鲜花( 68)  鸡蛋( 0)
|
本帖最后由 战争傀儡阿格兰 于 2026-8-1 21:33 编辑
代码环境1.171。
补充:考虑工资情况后的,周工资除以战力得到的单价等级排序:
(意思是,想凑战力守城,塞哪种兵,周工资总价低。想不到5级和8级最贵)
等级 Lv 战力单价(周工资除以战力
1 1
2 1
3 2
6 2.5
4 3
7 3
9 3
12 3
15 3
16 3
26 3.111111111
30 3.130434783
22 3.153846154
36 3.15625
27 3.157894737
14 3.166666667
21 3.166666667
20 3.181818182
33 3.185185185
45 3.1875
47 3.192307692
44 3.195652174
19 3.2
24 3.2
28 3.2
35 3.2
38 3.2
46 3.2
48 3.203703704
43 3.204545455
31 3.208333333
37 3.212121212
23 3.214285714
42 3.214285714
49 3.214285714
18 3.222222222
50 3.224137931
41 3.225
40 3.236842105
29 3.238095238
32 3.24
11 3.25
17 3.25
25 3.25
34 3.25
39 3.25
13 3.4
10 3.666666667
5 4
8 4
代码是怎么判断攻防时候双方军事力量对比?具体的数据是用module_scripts.py里"party_calculate_strength"脚本计算得出。概括一下:设一个兵种等级为x,那么其战斗力y=(x+4)*(x+4)/50,如果y小于1,则直接取1。所有兵种的y加起来就是部队战斗力值,储存在目标party的 slot_party_cached_strength,slot代号56。
应用实例:
1、为啥海寇一个飞斧就能带走一个汉子,ai领主却能无伤解决?因为海寇等级低;
2、为什么ai喜欢烧村子?因为村子战斗力直接为10,相当于1个19级的兵;
(try_begin),
(is_between, ":potential_target", villages_begin, villages_end),
(assign, ":enemy_strength", 10),
3、城堡什么肯定不光光算守军,还要算驻军;
(else_try),
(party_get_slot, ":enemy_strength", ":potential_target", slot_party_cached_strength),
(party_get_slot, ":enemy_strength_nearby", ":potential_target", slot_party_nearby_friend_strength),
(val_add, ":enemy_strength", ":enemy_strength_nearby"),
(try_end),
【END】
研究代码ing,希望战团还有研究代码的人吧!
("party_calculate_strength",
[
(store_script_param_1, ":party"), #Party_id
(store_script_param_2, ":exclude_leader"), #Party_id
(assign, reg0,0),
(party_get_num_companion_stacks, ":num_stacks", ":party"),
(assign, ":first_stack", 0),
(try_begin),
(neq, ":exclude_leader", 0),
(assign, ":first_stack", 1),
(try_end),
(try_for_range, ":i_stack", ":first_stack", ":num_stacks"),
(party_stack_get_troop_id, ":stack_troop",":party", ":i_stack"),
(store_character_level, ":stack_strength", ":stack_troop"),
(val_add, ":stack_strength", 4), #new was 12 (patch 1.125)
(val_mul, ":stack_strength", ":stack_strength"),
(val_mul, ":stack_strength", 2), #new (patch 1.125)
(val_div, ":stack_strength", 100),
(val_max, ":stack_strength", 1), #new (patch 1.125)
(try_begin),
(neg|troop_is_hero, ":stack_troop"),
(party_stack_get_size, ":stack_size",":party",":i_stack"),
(party_stack_get_num_wounded, ":num_wounded",":party",":i_stack"),
(val_sub, ":stack_size", ":num_wounded"),
(val_mul, ":stack_strength", ":stack_size"),
(else_try),
(troop_is_wounded, ":stack_troop"), #hero & wounded
(assign, ":stack_strength", 0),
(try_end),
(val_add, reg0, ":stack_strength"),
(try_end),
(party_set_slot, ":party", slot_party_cached_strength, reg0),
]),
|
评分
-
查看全部评分
|