请选择 进入手机版 | 继续访问电脑版

骑马与砍杀中文站论坛

 找回密码
 注册(Register!)

QQ登录

只需一步,快速开始

搜索
购买CDKEY

查看: 460|回复: 4

[分享] 针对战团坐镇指挥不合理的简单改进

[复制链接]

2

主题

15

帖子

50

积分

扈从

Rank: 2Rank: 2

UID
3304622
第纳尔
318
精华
0
互助
7
荣誉
1
贡献
0
魅力
5
注册时间
2021-12-28
鲜花(5) 鸡蛋(0)
发表于 2022-4-6 19:23:23 | 显示全部楼层 |阅读模式
本帖最后由 杰喵喵 于 2022-4-8 18:29 编辑

最近刚刚开始学习如何制作骑砍战团MOD,以下是本人的对坐镇指挥的的改进。
首先,引用R大的教程与思路。
关于战术技能与战场优势详解 :https://bbs.mountblade.com.cn/forum.php?mod=viewthread&tid=102969

坐镇指挥更加合理:https://bbs.mountblade.com.cn/fo ... B%B8%FC%BA%CF%C0%ED

首先,如果用计算模拟玩家进入战场,全部冲锋,让士兵们自动战斗,战斗结果,基于两个方面:1.双方人数  2.双方参战个体单位质量。代码编写主要基于这两个方面处理进行处理。
问题一:如何知道双方上传交战人数比例呢?根据R大<<关于战术技能与战场优势详解”>>:
我方人数 大于 敌方人数时:
战场优势 = (我方人数/敌方人数 - 1)*2 + (我方战术技能 - 敌方战术技能)*0.3

我方人数 小于 敌方人数时:
战场优势 = (1 - 敌方人数/我方人数)*2 + (我方战术技能 - 敌方战术技能)*0.3
战场优势    我方/敌方(人数)       近似比值
5(及以上)       53:27                     2
4                        51:29                     1.76
3                        48:32                     1.5
2                       45:35                     1.29
1                       43:37                     1.16
0                       40:40                     1
-1                      37:43                     0.86
-2                      35:45                     0.78
-3                      32:48                     0.67
-4                      29:51                     0.57
-5                      27:53                       0.5

故而得知,不同情况下战场优势带来的上场人数比值,可以根据次编写简单的分段处理代码。

问题二:上场的单位质量。假设战场无优势,双方上场人数为1:1,那么个体单位质量平均高的一方肯定有优势。单位质量平均 =  (部队强度/部队数量)(理论上再引入方差概念更好,后续再优化吧)。根据官方代码:
  1. #script_party_calculate_strength:
  2.   # INPUT: arg1 = party_id, arg2 = exclude leader
  3.   # OUTPUT: reg0 = strength
  4.   
  5.   ("party_calculate_strength",
  6.     [
  7.       (store_script_param_1, ":party"), #Party_id
  8.       (store_script_param_2, ":exclude_leader"), #Party_id
  9.       
  10.       (assign, reg0,0),
  11.       (party_get_num_companion_stacks, ":num_stacks", ":party"),
  12.       (assign, ":first_stack", 0),
  13.       (try_begin),
  14.         (neq, ":exclude_leader", 0),
  15.         (assign, ":first_stack", 1),
  16.       (try_end),
  17.       (try_for_range, ":i_stack", ":first_stack", ":num_stacks"),
  18.         (party_stack_get_troop_id, ":stack_troop",":party", ":i_stack"),
  19.         (store_character_level, ":stack_strength", ":stack_troop"),
  20.         (val_add, ":stack_strength", 4), #new was 12 (patch 1.125)
  21.         (val_mul, ":stack_strength", ":stack_strength"),
  22.         (val_mul, ":stack_strength", 2), #new (patch 1.125)
  23.         (val_div, ":stack_strength", 100),
  24.         (val_max, ":stack_strength", 1), #new (patch 1.125)
  25.         (try_begin),
  26.           (neg|troop_is_hero, ":stack_troop"),
  27.           (party_stack_get_size, ":stack_size",":party",":i_stack"),
  28.           (party_stack_get_num_wounded, ":num_wounded",":party",":i_stack"),                    
  29.           (val_sub, ":stack_size", ":num_wounded"),
  30.           (val_mul, ":stack_strength", ":stack_size"),
  31.         (else_try),
  32.           (troop_is_wounded, ":stack_troop"), #hero & wounded
  33.           (assign, ":stack_strength", 0),
  34.         (try_end),
  35.         (val_add, reg0, ":stack_strength"),
  36.       (try_end),
  37.       (party_set_slot, ":party", slot_party_cached_strength, reg0),
  38.   ]),
复制代码
得出官方计算公式   部队强度 =∑(个体单位强度)   , 个体单位强度 = (2* ((个体单位等级+4)^2)))/100, 根据该2次指数函数可知单位等级高,强度就越大,且斜率上升。带入丝骑(28)与新兵(4)的等级计算,丝骑个体单位强度 = 20.48 , 新兵个体单位强度 = 1.28,一个骑士可以打20个农民。官方代码默认等级越高,装备越来好,不考虑装备影响,故暂时也不讨论装备质量对个体单位强度影响,只考虑等级。后续代码编写,调用官方函数”script_party_calculate_strength“,计算参战双方部队个体平均质量.
战场随机出现三种情况:(1)、平均质量较高一方,上场单位数量大,获得极大优势。(2).平均质量较高一方,上场数量少,其优势随着另一方上场数量增大而较小。(3).双方上场平均质量质量与数量势均力敌。
自定义函数:

设个体平均质量较高一方的平均质量为X1,数量为Y1 。个体平均质量较低一方的平均质量为X2,数量为Y2。设给与平均质量较高的增益数为Z。
设立方程 :Z = ((X1-X)^2)*(Y1/Y2)
由方程计算得知,个体平均质量较高的一方,其增益随着双方质量差与双方数量比例变化,如果质量差大,且数量比例大,那么会获得极大的增益,满足情况(1)。如果个体平均质量较高的一方,数量不占优势,其增益数随着另一方数量增大而减小,增益极限趋向于零,满足情况(2)。双方质量差极限接近0,那么增益极限等于0,满足条件情况(3),若双方质量差很小,数量比例接近1:1,那么所获得增益很小,也符合情况(3)

如题所上编写代码,#c为添加部分

后续为官方代码,不动。
  1. (
  2.     "order_attack_2",mnf_disable_all_keys,
  3.     "{s4}^^Your casualties: {s8}^^Enemy casualties: {s9}",
  4.     "none",
  5.     [
  6.       (set_background_mesh, "mesh_pic_charge"),
  7.       
  8.       (call_script, "script_party_calculate_strength", "p_main_party", 1), #exclude player #玩家部队单位强度
  9.       (assign, ":player_party_strength", reg0),
  10.       (display_message, "@player_party_strength = {reg0}", 0xFFFFFFFF),

  11.       (call_script, "script_party_calculate_strength", "p_collective_enemy", 0),#敌方部队单位强度
  12.       (assign, ":enemy_party_strength", reg0),
  13.       (display_message, "@enemy_party_strength = {reg0}", 0xFFFFFFFF),
  14.       
  15.       (party_collect_attachments_to_party, "p_main_party", "p_collective_ally"),
  16.       (call_script, "script_party_calculate_strength", "p_collective_ally", 1), #友军部队单位强度
  17.       (assign, ":total_player_and_followers_strength", reg0),
  18.       (display_message, "@total_player_and_followers_strength = {reg0}", 0xFFFFFFFF),
  19.       
  20.      
  21.       ## CC
  22.       (party_get_num_companions, ":num_p_main_party", "p_main_party"),##玩家部队单位数量
  23.       (party_get_num_companions, ":num_p_collective_ally", "p_collective_ally"),#我军部队单位数量(包含了玩家部队单位数量+友军部队单位数量)
  24.       (party_get_num_companions, ":num_p_collective_enemy", "p_collective_enemy"),#敌方部队单位数量
  25.       (assign,":num_total_player_and_followers",":num_p_collective_ally"),#我方总计单位数量 = 我军部队单位数量

  26.       (assign,reg4,":num_p_main_party"),
  27.       (display_message, "@num_p_main_party= {reg4}", 0xFFFFFFFF),
  28.       (assign,reg4,":num_p_collective_enemy"),
  29.       (display_message, "@num_p_collective_enemy= {reg4}", 0xFFFFFFFF),
  30.       (assign,reg4,":num_total_player_and_followers"),
  31.       (display_message, "@num_total_player_and_followers= {reg4}", 0xFFFFFFFF),      
  32.       
  33.       (store_div,":average_strength_our",":total_player_and_followers_strength",":num_total_player_and_followers"),#我单位平均部队强度
  34.       (store_div,":average_strength_enemy",":enemy_party_strength",":num_p_collective_enemy"),#敌方单位平均部队强度
  35.       
  36.       (assign,reg4,":average_strength_our"),
  37.       (display_message, "@average_strength_our= {reg4}", 0xFFFFFFFF),
  38.       (assign,reg4,":average_strength_enemy"),
  39.       (display_message, "@average_strength_enemy= {reg4}", 0xFFFFFFFF),
  40.       

  41.             
  42.       ## 根据R大关于战术技能与战场优势详解编写的分段处理程序 https://bbs.mountblade.com.cn/forum.php?mod=viewthread&tid=102969
  43.       ## 进行双方上场战场人数模拟 最大值2:1
  44.       (call_script, "script_calculate_battle_advantage"),
  45.       (assign,":raw_advantage",reg0),
  46.       
  47.       (try_begin),
  48.         (ge,":raw_advantage",5),
  49.         (val_mul,":num_total_player_and_followers",200),#2
  50.         (val_div,":num_total_player_and_followers",100),
  51.      (else_try),
  52.         (ge,":raw_advantage",4),
  53.         (lt,":raw_advantage",5),
  54.         (val_mul,":num_total_player_and_followers",188),#1.88
  55.         (val_div,":num_total_player_and_followers",100),
  56.       (else_try),
  57.         (ge,":raw_advantage",3),
  58.         (lt,":raw_advantage",4),
  59.         (val_mul,":num_total_player_and_followers",168),#1.68
  60.         (val_div,":num_total_player_and_followers",100),
  61.       (else_try),
  62.         (ge,":raw_advantage",2),
  63.         (lt,":raw_advantage",3),
  64.         (val_mul,":num_total_player_and_followers",139),#1.39
  65.         (val_div,":num_total_player_and_followers",100),
  66.       (else_try),
  67.         (ge,":raw_advantage",1),
  68.         (lt,":raw_advantage",2),
  69.         (val_mul,":num_total_player_and_followers",123),#1.23
  70.         (val_div,":num_total_player_and_followers",100),
  71.       (else_try),
  72.         (gt,":raw_advantage",0),
  73.         (lt,":raw_advantage",1),
  74.         (val_mul,":num_total_player_and_followers",108),#1.08
  75.         (val_div,":num_total_player_and_followers",100),
  76.       (else_try),
  77.         (eq,":raw_advantage",0),
  78.         (val_mul,":num_total_player_and_followers",1),
  79.         (val_mul,":num_p_collective_enemy",1),
  80.       (else_try),
  81.         (ge,":raw_advantage",-1),
  82.         (lt,":raw_advantage",0),
  83.         (val_mul,":num_p_collective_enemy",108),#1.08
  84.         (val_div,":num_p_collective_enemy",100),
  85.       (else_try),
  86.         (ge,":raw_advantage",-2),
  87.         (lt,":raw_advantage",-1),
  88.         (val_mul,":num_p_collective_enemy",123),#1.23
  89.         (val_div,":num_p_collective_enemy",100),
  90.       (else_try),
  91.         (ge,":raw_advantage",-3),
  92.         (lt,":raw_advantage",-2),
  93.         (val_mul,":num_p_collective_enemy",139),#1.39
  94.         (val_div,":num_p_collective_enemy",100),
  95.       (else_try),
  96.         (ge,":raw_advantage",-4),
  97.         (lt,":raw_advantage",-3),
  98.         (val_mul,":num_p_collective_enemy",168),#1.68
  99.         (val_div,":num_p_collective_enemy",100),
  100.       (else_try),
  101.         (ge,":raw_advantage",-5),
  102.         (lt,":raw_advantage",-4),
  103.         (val_mul,":num_p_collective_enemy",188),#1.88
  104.         (val_div,":num_p_collective_enemy",100),
  105.       (else_try),
  106.         (val_mul,":num_p_collective_enemy",200),#2
  107.         (val_div,":num_p_collective_enemy",100),
  108.       (try_end),
  109.       
  110.       (assign,reg4,":num_p_collective_enemy"),
  111.       (display_message, "@num_p_collective_enemy= {reg4}", 0xFFFFFFFF),
  112.       (assign,reg4,":num_total_player_and_followers"),
  113.       (display_message, "@num_total_player_and_followers= {reg4}", 0xFFFFFFFF),     
  114.       
  115.       
  116.        # 设定公式:双方其中一方,平均强度较高的一方获得”平均强度增益“  平均强度增益 = ((高平均强度-低平均强度)^2 )*(高平均强度部队单位数量/低平均强度部队单位数量)
  117.       (try_begin),
  118.         (gt,":average_strength_our",":average_strength_enemy"),
  119.         (store_sub,":diff_val",":average_strength_our",":average_strength_enemy"),
  120.         (val_mul,":diff_val",":diff_val"),
  121.         (store_mul,":temp_data",":diff_val",":num_total_player_and_followers"),
  122.         (store_div,":gain",":temp_data",":num_p_collective_enemy"),
  123.         (val_add,":total_player_and_followers_strength",":gain"),
  124.       (else_try),
  125.         (lt,":average_strength_our",":average_strength_enemy"),
  126.         (store_sub,":diff_val",":average_strength_enemy",":average_strength_our"),
  127.         (val_mul,":diff_val",":diff_val"),
  128.         (store_mul,":temp_data",":diff_val",":num_p_collective_enemy"),
  129.         (store_div,":gain",":temp_data",":num_total_player_and_followers"),
  130.         (val_add,":enemy_party_strength",":gain"),
  131.       (else_try),
  132.         (eq,":average_strength_our",":average_strength_enemy"),
  133.       (try_end),
  134.       
  135.       (assign,reg4,":total_player_and_followers_strength"),
  136.       (display_message, "@total_player_and_followers_strength = {reg4}", 0xFFFFFFFF),
  137.       
  138.       (assign,reg4,":enemy_party_strength"),
  139.       (display_message, "@enemy_party_strength= {reg4}", 0xFFFFFFFF),
  140.       
  141.       (assign,reg4,":total_player_and_followers_strength"),
  142.       (display_message, "@Player and followers strength = {reg4}", 0xFFFFFFFF),
  143.       
  144.       (try_begin),
  145.         (lt,":enemy_party_strength",200),
  146.         (store_mul, ":enemy_party_strength_mult_10", ":enemy_party_strength", 10),
  147.         (ge, ":total_player_and_followers_strength", ":enemy_party_strength_mult_10"),
  148.         (assign, ":enemy_party_strength", 0),
  149.         (display_message, "@In the face of your mighty army, the enemy runs like rats, without any counterattack, leaving your army to slaughter", 0xFFFFFFFF),
  150.      (else_try),
  151.         (lt,":enemy_party_strength",200),
  152.         (store_mul, ":enemy_party_strength_mult_10", ":enemy_party_strength", 7),
  153.         (ge, ":total_player_and_followers_strength", ":enemy_party_strength_mult_10"),
  154.         (gt,":average_strength_our",":average_strength_enemy"),
  155.         (store_mul,":temp_data",":average_strength_our",10),
  156.         (store_div,":temp_data",":temp_data",":average_strength_enemy"),
  157.         (ge,":temp_data",15),
  158.         (assign, ":enemy_party_strength", 0),
  159.         (display_message, "@In the face of your mighty army, the enemy runs like rats, without any counterattack, leaving your army to slaughter", 0xFFFFFFFF),
  160.       (try_end),

  161.       
  162.       ## CC 后续为官方代码,不动。
复制代码
  1.   (
  2.     "join_order_attack",mnf_disable_all_keys,
  3.     "{s4}^^Your casualties: {s8}^^Allies' casualties: {s9}^^Enemy casualties: {s10}",
  4.     "none",
  5.     [
  6.      ## CC
  7.       (call_script, "script_party_calculate_strength", "p_main_party", 1), #skip player
  8.       (assign, ":player_party_strength", reg0),
  9.       #(val_div, ":player_party_strength", 5),#官方原程序对部队强度进行除于5处理,暂时先屏蔽,后面再处理
  10.       (display_message, "@player_party_strength = {reg0}", 0xFFFFFFFF),

  11.       (call_script, "script_party_calculate_strength", "p_collective_friends", 0),#p_collective_friends友军部队单位party 包括 玩家+友方
  12.       (assign, ":friend_party_strength", reg0),
  13.       #(val_div, ":friend_party_strength", 5),#官方原程序对部队强度进行除于5处理,暂时先屏蔽,后面再处理
  14.       (display_message, "@friend_party_strength = {reg0}", 0xFFFFFFFF),
  15.       
  16.       (call_script, "script_party_calculate_strength", "p_collective_enemy", 0),#敌方部队单位party
  17.       (assign, ":enemy_party_strength", reg0),
  18.       #(val_div, ":enemy_party_strength", 5),#官方原程序对部队强度进行除于5处理,暂时先屏蔽,后面再处理
  19.       (display_message, "@enemy_party_strength = {reg0}", 0xFFFFFFFF),
  20.       
  21.       ## CC
  22.       
  23.       (party_get_num_companions, ":num_p_main_party", "p_main_party"),#玩家部队单位数量
  24.       (party_get_num_companions, ":num_p_collective_friends", "p_collective_friends"),#友军部队单位数量 = (玩家单位数量+友军单位数量)
  25.       (party_get_num_companions, ":num_p_collective_enemy", "p_collective_enemy"),#敌方部队单位数量
  26.       (assign,":num_total_player_and_followers",":num_p_collective_friends"),#我方总计单位数量 = (玩家单位数量+友军单位数量)
  27.       (assign,":total_player_and_followers_strength",":friend_party_strength"),#我方部队单位强度 = (玩家部队强度+友军强度)
  28.       
  29.       (assign,reg4,":num_p_main_party"),
  30.       (display_message, "@num_p_main_party= {reg4}", 0xFFFFFFFF),
  31.       (assign,reg4,":num_p_collective_friends"),
  32.       (display_message, "@num_p_collective_friends= {reg4}", 0xFFFFFFFF),
  33.       (assign,reg4,":num_p_collective_enemy"),
  34.       (display_message, "@num_p_collective_enemy= {reg4}", 0xFFFFFFFF),   
  35.       (assign,reg4,":num_total_player_and_followers"),
  36.       (display_message, "@num_total_player_and_followers= {reg4}", 0xFFFFFFFF),   
  37.       
  38.       #计算并保留比例数据 玩家单位数量比例 =  玩家部队单位数量/我方单位数量
  39.       (store_mul,":num_num_p_main_party_100",":num_p_main_party",100),
  40.       (store_div,":scale_num_p_main",":num_num_p_main_party_100",":num_total_player_and_followers"),
  41.       
  42.       (assign,reg4,":scale_num_p_main"),
  43.       (display_message, "@scale_num_p_main= {reg4}", 0xFFFFFFFF),
  44.       
  45.        #计算我单位平均部队强度
  46.       (store_div,":average_strength_our",":total_player_and_followers_strength",":num_total_player_and_followers"),#我单位平均部队强度
  47.       (store_div,":average_strength_enemy",":enemy_party_strength",":num_p_collective_enemy"),#敌方单位平均部队强度
  48.       
  49.       (assign,reg4,":average_strength_our"),
  50.       (display_message, "@average_strength_our= {reg4}", 0xFFFFFFFF),
  51.       (assign,reg4,":average_strength_enemy"),
  52.       (display_message, "@average_strength_enemy= {reg4}", 0xFFFFFFFF),
  53.       
  54.       
  55.        ## 根据R大关于战术技能与战场优势详解编写的分段处理程序 https://bbs.mountblade.com.cn/forum.php?mod=viewthread&tid=102969
  56.        ## 对人数进行校正
  57.       (call_script, "script_calculate_battle_advantage"),
  58.       (assign,":raw_advantage",reg0),
  59.       
  60.       (try_begin),
  61.         (ge,":raw_advantage",5),
  62.         (val_mul,":num_total_player_and_followers",200),#2
  63.         (val_div,":num_total_player_and_followers",100),
  64.      (else_try),
  65.         (ge,":raw_advantage",4),
  66.         (lt,":raw_advantage",5),
  67.         (val_mul,":num_total_player_and_followers",188),#1.88
  68.         (val_div,":num_total_player_and_followers",100),
  69.       (else_try),
  70.         (ge,":raw_advantage",3),
  71.         (lt,":raw_advantage",4),
  72.         (val_mul,":num_total_player_and_followers",168),#1.68
  73.         (val_div,":num_total_player_and_followers",100),
  74.       (else_try),
  75.         (ge,":raw_advantage",2),
  76.         (lt,":raw_advantage",3),
  77.         (val_mul,":num_total_player_and_followers",139),#1.39
  78.         (val_div,":num_total_player_and_followers",100),
  79.       (else_try),
  80.         (ge,":raw_advantage",1),
  81.         (lt,":raw_advantage",2),
  82.         (val_mul,":num_total_player_and_followers",123),#1.23
  83.         (val_div,":num_total_player_and_followers",100),
  84.       (else_try),
  85.         (gt,":raw_advantage",0),
  86.         (lt,":raw_advantage",1),
  87.         (val_mul,":num_total_player_and_followers",108),#1.08
  88.         (val_div,":num_total_player_and_followers",100),
  89.       (else_try),
  90.         (eq,":raw_advantage",0),
  91.         (val_mul,":num_total_player_and_followers",1),
  92.         (val_mul,":num_p_collective_enemy",1),
  93.       (else_try),
  94.         (ge,":raw_advantage",-1),
  95.         (lt,":raw_advantage",0),
  96.         (val_mul,":num_p_collective_enemy",108),#1.08
  97.         (val_div,":num_p_collective_enemy",100),
  98.       (else_try),
  99.         (ge,":raw_advantage",-2),
  100.         (lt,":raw_advantage",-1),
  101.         (val_mul,":num_p_collective_enemy",123),#1.23
  102.         (val_div,":num_p_collective_enemy",100),
  103.       (else_try),
  104.         (ge,":raw_advantage",-3),
  105.         (lt,":raw_advantage",-2),
  106.         (val_mul,":num_p_collective_enemy",139),#1.39
  107.         (val_div,":num_p_collective_enemy",100),
  108.       (else_try),
  109.         (ge,":raw_advantage",-4),
  110.         (lt,":raw_advantage",-3),
  111.         (val_mul,":num_p_collective_enemy",168),#1.68
  112.         (val_div,":num_p_collective_enemy",100),
  113.       (else_try),
  114.         (ge,":raw_advantage",-5),
  115.         (lt,":raw_advantage",-4),
  116.         (val_mul,":num_p_collective_enemy",188),#1.88
  117.         (val_div,":num_p_collective_enemy",100),
  118.       (else_try),
  119.         (val_mul,":num_p_collective_enemy",200),#2
  120.         (val_div,":num_p_collective_enemy",100),
  121.       (try_end),
  122.       
  123.       (assign,reg4,":num_total_player_and_followers"),
  124.       (display_message, "@num_total_player_and_followers = {reg4}", 0xFFFFFFFF),
  125.       
  126.       (assign,reg4,":num_p_collective_enemy"),
  127.       (display_message, "@num_p_collective_enemy= {reg4}", 0xFFFFFFFF),
  128.       
  129.       
  130.        # 设定公式:双方其中一方,平均强度较高的一方获得”平均强度增益“  平均强度增益 = ((高平均强度-低平均强度)^2 )*(高平均强度部队单位数量/低平均强度部队单位数量)
  131.       (try_begin),
  132.         (gt,":average_strength_our",":average_strength_enemy"),
  133.         (store_sub,":diff_val",":average_strength_our",":average_strength_enemy"),
  134.         (val_mul,":diff_val",":diff_val"),
  135.         (store_mul,":temp_data",":diff_val",":num_total_player_and_followers"),
  136.         (store_div,":gain",":temp_data",":num_p_collective_enemy"),
  137.         (val_add,":total_player_and_followers_strength",":gain"),
  138.       (else_try),
  139.         (lt,":average_strength_our",":average_strength_enemy"),
  140.         (store_sub,":diff_val",":average_strength_enemy",":average_strength_our"),
  141.         (val_mul,":diff_val",":diff_val"),
  142.         (store_mul,":temp_data",":diff_val",":num_p_collective_enemy"),
  143.         (store_div,":gain",":temp_data",":num_total_player_and_followers"),
  144.         (val_add,":enemy_party_strength",":gain"),
  145.       (else_try),
  146.         (eq,":average_strength_our",":average_strength_enemy"),
  147.       (try_end),
  148.       
  149.       (assign,reg4,":total_player_and_followers_strength"),
  150.       (display_message, "@total_player_and_followers_strength = {reg4}", 0xFFFFFFFF),
  151.       
  152.       (assign,reg4,":enemy_party_strength"),
  153.       (display_message, "@enemy_party_strength= {reg4}", 0xFFFFFFFF),
  154.       
  155.       #过滤处理
  156.       (try_begin),
  157.         (lt,":enemy_party_strength",200),
  158.         (store_mul, ":enemy_party_strength_mult_10", ":enemy_party_strength", 10),
  159.         (ge, ":total_player_and_followers_strength", ":enemy_party_strength_mult_10"),
  160.         (assign, ":enemy_party_strength", 0),
  161.         (display_message, "@In the face of your mighty army, the enemy runs like rats, without any counterattack, leaving your army to slaughter", 0xFFFFFFFF),
  162.      (else_try),
  163.         (lt,":enemy_party_strength",200),
  164.         (store_mul, ":enemy_party_strength_mult_10", ":enemy_party_strength", 7),
  165.         (ge, ":total_player_and_followers_strength", ":enemy_party_strength_mult_10"),
  166.         (gt,":average_strength_our",":average_strength_enemy"),
  167.         (store_mul,":temp_data",":average_strength_our",10),
  168.         (store_div,":temp_data",":temp_data",":average_strength_enemy"),
  169.         (ge,":temp_data",15),
  170.         (assign, ":enemy_party_strength", 0),
  171.         (display_message, "@In the face of your mighty army, the enemy runs like rats, without any counterattack, leaving your army to slaughter", 0xFFFFFFFF),
  172.       (try_end),
  173.       
  174.             
  175.       #根据比例系数重新计算玩家与友方部队强度
  176.       (store_mul,":player_party_strength",":total_player_and_followers_strength",":scale_num_p_main"),
  177.       (store_div,":player_party_strength",":player_party_strength",100),
  178.       (assign,":friend_party_strength",":total_player_and_followers_strength"),
  179.       
  180.       (assign,reg4,":player_party_strength"),
  181.       (display_message, "@player_party_strength= {reg4}", 0xFFFFFFFF),
  182.       (assign,reg4,":friend_party_strength"),
  183.       (display_message, "@friend_party_strength= {reg4}", 0xFFFFFFFF),  
  184.       (assign,reg4,":enemy_party_strength"),
  185.       (display_message, "@enemy_party_strength=  {reg4}", 0xFFFFFFFF),
  186.       
  187.       #官方原程序对部队强度进行除于5处理,这里重新开启
  188.       (val_div, ":player_party_strength", 5),
  189.       (val_div, ":friend_party_strength", 5),
  190.       (val_div, ":enemy_party_strength", 5),
  191.       
  192.       ## CC 后续官方原程序 不修改
复制代码



代码首先读取双方部队强度,获得双方部队的数量,计算好双方单位平均强度。先根据战场优势,对数量进行校正。双方其中一方,平均强度较高的一方获得”平均强度增益“ ,得出新的双方部队强度,最后进行R大处理,R大代码中我增加了阈值滤波处理,数值为200,约为10个丝骑。



评分

参与人数 1第纳尔 +10 互助 +2 魅力 +5 收起 理由
幼稚园殺手 + 10 + 2 + 5 文章不错,继续努力!

查看全部评分

鲜花鸡蛋

幼稚园殺手  在2022-4-6 19:56  送朵鲜花  并说:我非常同意你的观点,送朵鲜花鼓励一下

48

主题

2460

帖子

1548

积分

子爵[版主]

吟游诗人

Rank: 7Rank: 7Rank: 7

UID
3054380
第纳尔
18714
精华
2
互助
44
荣誉
39
贡献
706
魅力
916
注册时间
2019-1-18

骑砍中文站APP会员勋章骑友真人秀Ⅶ勋章剧本设计大奖赛骑友真人秀Ⅷ勋章战团正版勋章维京征服正版勋章火与剑正版勋章拿破仑正版勋章原版正版勋章霸主正版勋章

QQ
鲜花(449) 鸡蛋(2)
发表于 2022-4-6 19:24:55 来自手机 | 显示全部楼层

52

主题

852

帖子

296

积分

见习骑士

游骑士战队[YQS]
联机ID:Apple_PAI

Rank: 3

UID
3218444
第纳尔
5
精华
0
互助
8
荣誉
0
贡献
0
魅力
6
注册时间
2021-1-30

霸主正版勋章拿破仑正版勋章

鲜花(89) 鸡蛋(0)
发表于 2022-4-8 18:26:08 | 显示全部楼层
等,四分之一伤算上了吗
苹果派真好吃嘿嘿嘿

2

主题

15

帖子

50

积分

扈从

Rank: 2Rank: 2

UID
3304622
第纳尔
318
精华
0
互助
7
荣誉
1
贡献
0
魅力
5
注册时间
2021-12-28
鲜花(5) 鸡蛋(0)
 楼主| 发表于 2022-4-8 18:48:57 | 显示全部楼层
NEW_SHIT 发表于 2022-4-8 18:26
等,四分之一伤算上了吗

没有哦,没有考虑到,如果要算,相当于我方每个士兵每次只会受到四分一伤害,那估计得专门做实验,比如一个4分之1伤害的丝骑个体战斗力能等于多少个百分百伤害的丝骑才能计算。

52

主题

852

帖子

296

积分

见习骑士

游骑士战队[YQS]
联机ID:Apple_PAI

Rank: 3

UID
3218444
第纳尔
5
精华
0
互助
8
荣誉
0
贡献
0
魅力
6
注册时间
2021-1-30

霸主正版勋章拿破仑正版勋章

鲜花(89) 鸡蛋(0)
发表于 2022-4-8 23:17:20 | 显示全部楼层

希望加入捏如果太复杂就算了qwq
苹果派真好吃嘿嘿嘿
您需要登录后才可以回帖 登录 | 注册(Register!)

本版积分规则

Archiver|手机版|小黑屋|骑马与砍杀中文站

GMT+8, 2022-8-12 04:21 , Processed in 0.120359 second(s), 20 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表