- 好友
- 1
- 在线时间
- 0 小时
- 最后登录
- 2025-8-21
随仆

- UID
- 3755365
- 第纳尔
- 20
- 精华
- 0
- 互助
- 1
- 荣誉
- 0
- 贡献
- 0
- 魅力
- 0
- 注册时间
- 2025-4-10
 鲜花( 2)  鸡蛋( 0)
|
本帖最后由 云归太华 于 2025-5-22 17:38 编辑
今天又扒了扒代码,终于处理掉了坐镇离谱的伤亡问题了!
("inflict_casualties_to_party",
[
(party_clear, "p_temp_casualties"),
(store_script_param_1, ":party"), #Party_id
(call_script, "script_party_count_fit_regulars", ":party"),
(assign, ":num_fit", reg(0)), #reg(47) = number of fit regulars.
(store_script_param_2, ":num_attack_rounds"), #number of attacks
(try_for_range, ":unused", 0, ":num_attack_rounds"),
(gt, ":num_fit", 0),
(store_random_in_range, ":attacked_troop_rank", 0 , ":num_fit"), #attack troop with rank reg(46)
(assign, reg1, ":attacked_troop_rank"),
(call_script, "script_get_stack_with_rank", ":party", ":attacked_troop_rank"),
(assign, ":attacked_stack", reg(0)), #reg(53) = stack no to attack.
(party_stack_get_troop_id, ":attacked_troop",":party",":attacked_stack"),
(store_character_level, ":troop_toughness", ":attacked_troop"),
(val_add, ":troop_toughness", 5), #troop-toughness = level + 5
(try_begin),
(store_skill_level, ":skill", skl_ironflesh, ":attacked_troop"),
(val_mul, ":skill", 5),
(val_add, ":troop_toughness", ":skill"),
(try_end),
(assign, ":casualty_chance", 10000),
(val_div, ":casualty_chance", ":troop_toughness"), #dying chance
(try_begin),
(store_random_in_range, ":rand_num", 0 ,10000),
(lt, ":rand_num", ":casualty_chance"), #check chance to be a casualty
(store_random_in_range, ":rand_num2", 0, 2), #check if this troop will be wounded or killed
(try_begin),
(troop_is_hero,":attacked_troop"), #currently troop can't be a hero, but no harm in keeping this.
(store_troop_health, ":troop_hp",":attacked_troop"),
(val_sub, ":troop_hp", 45),
(val_max, ":troop_hp", 1),
(troop_set_health, ":attacked_troop", ":troop_hp"),
(else_try),
(lt, ":rand_num2", 1), #wounded
(party_add_members, "p_temp_casualties", ":attacked_troop", 1),
(party_wound_members, "p_temp_casualties", ":attacked_troop", 1),
(party_wound_members, ":party", ":attacked_troop", 1),
(else_try), #killed
(party_add_members, "p_temp_casualties", ":attacked_troop", 1),
(party_remove_members, ":party", ":attacked_troop", 1),
(try_end),
(val_sub, ":num_fit", 1), #adjust number of fit regulars.
(try_end),
(try_end),
]),
真是有点小激动啊,终于找到这狗屎东西了!代码的意思详细的大家可以发给ai翻译,我就简单说说,标蓝的部分是原版的,我翻译为坚韧度,坚韧度原版计算是等级+5,战团等级最高的兵就是丝袜骑士和诺皇了!28级,结果是33坚韧度。
以丝袜为例子,坚韧度为33!
代码中用10000除以33,结果是303!
然后再搞一个0到10000的随机数,随机数小于303,那么就会有伤亡!大致意思就是这个意思!我讲的应该比较明白吧,听懂掌声!
然后我加了一个代码,代码功能就是把铁骨技能算进去了!
新的坚韧度为等级加铁骨技能乘以5!
还是以丝袜和诺皇为例子
新公式!
丝袜的坚韧度为33+5*5=58!
诺皇为33+5*7=68!
天啊,诺皇终于崛起了,唯一一个六级兵啊,你终于雄起了!泪目!
然后是标紫色的部分!
这一段以后就是处理伤亡的部分了,随机数计算之后,士兵的结果是伤还是亡,就有说法了!
第一步代码是去随机数,(store_random_in_range, ":rand_num2", 0, 2),取0到2的随机数,但是是左闭右开,其实就是取0与1!
(lt, ":rand_num2", 1), 这个就是伤的判断,如果取的随机数小于1,那么就是伤!否则就是死!
要想调高伤与死的比例,把随机数范围改大一点就行了!
比如说:(store_random_in_range, ":rand_num2", 0, 2),改成(0,3)!随机数取0,1,2三个数字!
然后(lt, ":rand_num2", 1),改成(lt, ":rand_num2", 2),意思是随机数小于2,就是伤状态!
0,1都满足,伤亡的比例就是2:1了!
原来是1:1!
大致就是这样吧!
|
|