- 好友
- 0
- 在线时间
- 0 小时
- 最后登录
- 2024-11-19
平民
- UID
- 3713555
- 第纳尔
- 5
- 精华
- 0
- 互助
- 0
- 荣誉
- 0
- 贡献
- 0
- 魅力
- 0
- 注册时间
- 2024-11-10
鲜花( 1) 鸡蛋( 0)
|
适用于战团的原帖改进算法:
- (assign, ":min_slot", 105), ##最小值SLOT
- (assign, ":min_item_id", 0), ##最小值物品ID
- (assign, ":min_item_modifier", 0), ##最小值物品质量
- (assign, ":min_item_value", 0), ##最小值物品价值
- (party_get_num_companion_stacks, ":num_stacks", ":enemy_party"),
- (try_for_range, ":i_stack", 0, ":num_stacks"), ##算法循环开始
- (party_stack_get_troop_id, ":stack_troop", ":enemy_party", ":i_stack"),
- (neg|troop_is_hero, ":stack_troop"),
- (party_stack_get_size, ":stack_size", ":enemy_party", ":i_stack"),
- (try_for_range, ":unused", 0, ":stack_size"),
- (assign, ":loop_control", 0), ##循环控制初始化
- (assign, ":cur_loot_slot", ":min_slot"),
- (troop_loot_troop, "trp_temp_troop", ":stack_troop", ":loot_probability"),
- (troop_get_inventory_slot, ":cur_item_id", "trp_temp_troop", ":cur_loot_slot"), ##取当前物品ID
- (neg|eq, ":cur_item_id", -1), ##核心算法分界线,撸满96件时才开始下面核心算法,撸不满或者撸满后继续撸没撸到就只执行上面5条操作
- (try_begin),
- (eq, ":min_item_value", 0), ##保证下面这些指针初始化只进行一次
- (troop_sort_inventory, "trp_temp_troop"), ##指针初始化时把物品栏排序一下,整个过程就一次,否则也坑爹了
- (store_add, ":unused_1", "trp_temp_array_b", 1),
- (try_for_range, ":init_point_trp", "trp_temp_array_a", ":unused_1"), ##指针trp初始化开始,与原版相同,不过原版这三个trp装东西,我们装指针,只用两个
- (troop_clear_inventory, ":init_point_trp"),
- (store_skill_level, ":init_point_skl1", "skl_inventory_management", ":init_point_trp"),
- (store_sub, ":init_point_skl2", 10, ":init_point_skl1"),
- (troop_raise_skill, ":init_point_trp", "skl_inventory_management", ":init_point_skl2"),
- (try_end), ##指针trp初始化结束
- (try_for_range, ":init_point_slot", 10, 106), ##指针初始化开始,为trp_temp_troop和trp_temp_array_a和trp_temp_array_b建立指针
- (troop_get_inventory_slot, ":init_point_itemid", "trp_temp_troop", ":init_point_slot"),
- (troop_get_inventory_slot_modifier, ":init_point_itemmod", "trp_temp_troop", ":init_point_slot"),
- (call_script, "script_get_item_value_with_imod", ":init_point_itemid", ":init_point_itemmod",), ##
- (assign, ":init_point_itemval", reg0),
- (val_div, ":init_point_itemval", 100),
- (val_max, ":init_point_itemval", 1),
- (store_sub, ":unused_1", ":init_point_slot", 1),
- (troop_set_inventory_slot, "trp_temp_array_a", ":init_point_slot", ":unused_1"),
- (assign, ":cur_item_value", ":init_point_itemval"), ###
- (troop_set_inventory_slot, "trp_temp_array_b", ":init_point_slot", ":cur_item_value"),
- (try_end), ##指针初始化结束
- (assign, ":min_slot", ":init_point_slot"),
- (assign, ":min_item_id", ":init_point_itemid"),
- (assign, ":min_item_modifier", ":init_point_itemmod"),
- (assign, ":min_item_value", ":init_point_itemval"),
- (troop_set_inventory_slot, "trp_temp_troop", ":min_slot", -1), ##暂存最小值,抛弃最小值
- (else_try),
- (troop_get_inventory_slot_modifier, ":cur_item_modifier", "trp_temp_troop", ":cur_loot_slot"), ##取当前物品质量
- (call_script, "script_get_item_value_with_imod", ":cur_item_id", ":cur_item_modifier"), ##
- (assign, ":cur_item_value", reg0),
- (val_div, ":cur_item_value", 100),
- (val_max, ":cur_item_value", 1), ##得到当前物品价值
- (try_for_range, ":unused_1", 0, 95), ##价值比较开始
- (eq, ":loop_control", 0), ##控制比较次数
- (try_begin),
- (eq, ":unused_1", 0),
- (neg|gt, ":cur_item_value", ":min_item_value"), ##当前物品低于最小值,直接抛弃
- (troop_set_inventory_slot, "trp_temp_troop", ":min_slot", -1),
- (assign, ":loop_control", 1),
- (else_try),
- (troop_get_inventory_slot, ":next_item_slot", "trp_temp_array_a", ":cur_loot_slot"), ##取下一件物品SLOT,就是比当前大一点的物品
- (troop_get_inventory_slot, ":next_item_value", "trp_temp_array_b", ":next_item_slot"), ##取下一件物品价值
- (try_begin),
- (neg|gt, ":cur_item_value", ":next_item_value"), ##当前物品低于下一件的直接暂存,指针关系保持不变
- (try_begin),
- (eq, ":unused_1", 0),
- (assign, ":min_slot", ":cur_loot_slot"),
- (assign, ":min_item_id", ":cur_item_id"),
- (assign, ":min_item_modifier", ":cur_item_modifier"),
- (assign, ":min_item_value", ":cur_item_value"),
- (try_end),
- (troop_set_inventory_slot, "trp_temp_troop", ":min_slot", -1),
- (assign, ":loop_control", 1),
- (else_try),
- (try_begin), ##当前物品高于下一件的,使第一个下一件成为最小值并暂存
- (eq, ":unused_1", 0),
- (assign, ":min_slot", ":next_item_slot"),
- (troop_get_inventory_slot, ":min_item_id", "trp_temp_troop", ":min_slot"),
- (troop_get_inventory_slot_modifier, ":min_item_modifier", "trp_temp_troop", ":min_slot"),
- (assign, ":min_item_value", ":next_item_value"),
- (troop_set_inventory_slot, "trp_temp_troop", ":min_slot", -1),
- (assign, ":last_item_slot", 0),
- (try_end),
- (troop_set_inventory_slot, "trp_temp_array_a", ":last_item_slot", ":next_item_slot"), ##指针修正开始,暂存指针
- (assign, ":last_item_slot", ":next_item_slot"),
- (troop_get_inventory_slot, ":next_item_next", "trp_temp_array_a", ":next_item_slot"),
- (troop_set_inventory_slot, "trp_temp_array_a", ":cur_loot_slot", ":next_item_next"),
- (troop_set_inventory_slot, "trp_temp_array_a", ":next_item_slot", ":cur_loot_slot"), ##指针修正结束,最小值物品抛弃,其他按序指向下一个
- (try_end),
- (try_end),
- (try_end),
- (try_end), ##核心算法结束
- (try_end),
- (try_end), ##算法循环结束
- (try_begin), ##把最小值物品放回去
- (neg|eq, ":min_item_value", 0),
- (troop_add_item, "trp_temp_troop", ":min_item_id", ":min_item_modifier"),
- (try_end),
复制代码 |
|