骑马与砍杀之改进的战利品掠夺方法
(2010-09-24 01:27:32)
标签:
骑马与砍杀改进战利品掠夺方法游戏 |
分类: 骑马与砍杀图文攻略教程 |
战利品是这样生成的:战后,有一个叫trp_temp_troop的兵种去挨个掠夺战败方所有人(英雄除外)。
然后以物品栏的形式呈现在你面前,战利品界面左侧的物品栏就是该兵种的物品栏。
这里有一个问题,就是他挨个掠夺所有敌人的时候,很可能掠夺到一半的时候,战利品栏就满了(96件就满)。然后即使继续掠夺剩下的人,也无法将掠夺到的装备塞到战利品了。而敌人是乱序排列的,高级兵很可能就排在后面,而被后掠夺,接着很可能战利品栏已经满了,无法掠夺这些高级兵的装备了,然后因为先掠夺低级兵而导致战利品整体质量低下。
而且就算是掠夺单一兵种,比如敌人是300个海寇,掠夺每个海寇,得到的装备也都不一样的,很可能掠夺前面的海寇掠夺的是海寇的鞋子,盾牌等不值钱的玩意,掠夺后面海寇的时候掠夺的是铠甲,头盔等值钱的玩意。所以这和敌人排序与否的关系不大。
这个必须扩大战利品的格子数来解决,比如扩大到3倍,也就是288格,然后从中选择最贵的96件装备放回到trp_temp_troop里。但是又不能直接扩大物品栏的格子数,因为最高10级物品管理拥有的物品栏就是最大的物品栏,格子数是96格。把物品管理改得超过10是没有用的,实际还是只有96格。
这就需要采用变通的方式来解决。1个人去掠夺不够,那就派3个人去掠夺(物品管理都为10)。3个人物品栏加起来就有288格了。
完了之后,从3个人的物品栏里选择最贵的96件放到trp_temp_troop里,就能保证所掠夺的战利品质量最高。
这里面没有任何作弊修改的成分,我只是改变了掠夺规则,因为战利品还是那一堆战利品,我并没有提高战利品的质量,也没有提高掠夺几率,更没有增加新的战利品。唯一的区别是:原版里把那一堆战利品的前96件拿出来供你选择,我改成从那一堆战利品里挑选最贵的96件来供你选择。
相关的代码,打开module_scripts.py,找到下面一段:
替换成:
## CC
(store_add, ":temp_array_c_plus_one", "trp_temp_array_c", 1),
":cur_troop", "trp_temp_array_a", ":temp_array_c_plus_one"), (try_for_range,
":cur_troop"), # clear_inventory (troop_clear_inventory,
(store_skill_level, ":cur_level", skl_inventory_management, ":cur_troop"), # raise skl_inventory_management level to 10
":dest_level", 10, ":cur_level"), (store_sub,
":cur_troop", skl_inventory_management, ":dest_level"), (troop_raise_skill,
"script_copy_inventory", "trp_temp_troop", "trp_temp_array_a"), (try_end),
(call_script,
":num_stacks", ":enemy_party"),
(party_get_num_companion_stacks,
":i_stack", 0, ":num_stacks"), (try_for_range,
":stack_troop",":enemy_party",":i_stack"), (party_stack_get_troop_id,
":stack_troop"), (neg|troop_is_hero,
":stack_size",":enemy_party",":i_stack"), (party_stack_get_size,
":unused", 0, ":stack_size"), (try_for_range,
":inv_cap_a", "trp_temp_array_a"), (try_begin),
(store_free_inventory_capacity,
":inv_cap_a", 0), (gt,
"trp_temp_array_a", ":stack_troop", ":loot_probability"), (troop_loot_troop,
":inv_cap_b", "trp_temp_array_b"), (else_try),
(store_free_inventory_capacity,
":inv_cap_b", 0), (gt,
"trp_temp_array_b", ":stack_troop", ":loot_probability"), (troop_loot_troop,
"trp_temp_array_c", ":stack_troop", ":loot_probability"), (else_try),
(troop_loot_troop,
"trp_temp_troop"), (try_end),
(try_end),
(try_end),
(troop_clear_inventory,
":unused", 0, 96), # for 96 times (try_for_range,
(assign, ":best_score", 0), # find the best item
":best_troop", -1), (assign,
":best_slot", -1), (assign,
":cur_troop", "trp_temp_array_a", ":temp_array_c_plus_one"), (try_for_range,
":inv_cap", ":cur_troop"), (troop_get_inventory_capacity,
":i_slot", 10, ":inv_cap"), (try_for_range,
":item", ":cur_troop", ":i_slot"), (troop_get_inventory_slot,
":imod", ":cur_troop", ":i_slot"), (troop_get_inventory_slot_modifier,
":item", -1), (gt,
"script_get_item_value_with_imod", ":item", ":imod"), (call_script,
":score", reg0), (assign,
":score", 100), (val_div,
":score",1), (val_max,
":score", ":best_score"), (gt,
":best_score", ":score"), (assign,
":best_troop", ":cur_troop"), (assign,
":best_slot", ":i_slot"), (assign,
":best_score", 0), (try_end),
(try_end),
(gt,
# already found
(troop_get_inventory_slot, ":item", ":best_troop", ":best_slot"),
":imod", ":best_troop", ":best_slot"), (troop_get_inventory_slot_modifier,
"trp_temp_troop", ":item", ":imod"), # add to trp_temp_troop (troop_add_item,
(troop_set_inventory_slot, ":best_troop", ":best_slot", -1), # remove it
(try_end),
## CC
然后是这段代码里用到的2个script: script_copy_inventory和script_get_item_value_with_imod。如果你的MOD里有的话就不用加了。如果没有就加在module_scripts.py的最后面。
(点击展开 / 收起)
"copy_inventory", (
":source"), [
(store_script_param_1,
":target"), (store_script_param_2,
":target"),
(troop_clear_inventory,
":inv_cap", ":source"), (troop_get_inventory_capacity,
":i_slot", 0, ":inv_cap"), (try_for_range,
":item", ":source", ":i_slot"), (troop_get_inventory_slot,
":target", ":i_slot", ":item"), (troop_set_inventory_slot,
":imod", ":source", ":i_slot"), (troop_get_inventory_slot_modifier,
":target", ":i_slot", ":imod"), (troop_set_inventory_slot_modifier,
":amount", ":source", ":i_slot"), (troop_inventory_slot_get_item_amount,
":amount", 0), (gt,
":target", ":i_slot", ":amount"), (troop_inventory_slot_set_item_amount,
(try_end),
]),
注意:去掉这里imod_c r a c k e d里的空格。(点击展开 / 收起)
("get_item_value_with_imod",
# returns the sell price based on the item's money value and its imod [
(store_script_param, ":item", 1),
":imod", 2), (store_script_param,
":score", ":item"), (store_item_value,
":imod", imod_plain), (try_begin),
(eq,
":imod_multiplier", 100), (assign,
":imod", imod_c r a c k e d), (else_try),
(eq,
":imod_multiplier", 50), (assign,
":imod", imod_rusty), (else_try),
(eq,
":imod_multiplier", 55), (assign,
":imod", imod_bent), (else_try),
(eq,
":imod_multiplier", 65), (assign,
":imod", imod_chipped), (else_try),
(eq,
":imod_multiplier", 72), (assign,
":imod", imod_battered), (else_try),
(eq,
":imod_multiplier", 75), (assign,
":imod", imod_poor), (else_try),
(eq,
":imod_multiplier", 80), (assign,
":imod", imod_crude), (else_try),
(eq,
":imod_multiplier", 83), (assign,
":imod", imod_old), (else_try),
(eq,
":imod_multiplier", 86), (assign,
":imod", imod_cheap), (else_try),
(eq,
":imod_multiplier", 90), (assign,
":imod", imod_fine), (else_try),
(eq,
":imod_multiplier", 190), (assign,
":imod", imod_well_made), (else_try),
(eq,
":imod_multiplier", 250), (assign,
":imod", imod_sharp), (else_try),
(eq,
":imod_multiplier", 160), (assign,
":imod", imod_balanced), (else_try),
(eq,
":imod_multiplier", 350), (assign,
":imod", imod_tempered), (else_try),
(eq,
":imod_multiplier", 670), (assign,
":imod", imod_deadly), (else_try),
(eq,
":imod_multiplier", 850), (assign,
":imod", imod_exquisite), (else_try),
(eq,
":imod_multiplier", 1450), (assign,
":imod", imod_masterwork), (else_try),
(eq,
":imod_multiplier", 1750), (assign,
":imod", imod_heavy), (else_try),
(eq,
":imod_multiplier", 190), (assign,
":imod", imod_strong), (else_try),
(eq,
":imod_multiplier", 490), (assign,
":imod", imod_powerful), (else_try),
(eq,
":imod_multiplier", 320), (assign,
":imod", imod_tattered), (else_try),
(eq,
":imod_multiplier", 50), (assign,
":imod", imod_ragged), (else_try),
(eq,
":imod_multiplier", 70), (assign,
":imod", imod_rough), (else_try),
(eq,
":imod_multiplier", 60), (assign,
":imod", imod_sturdy), (else_try),
(eq,
":imod_multiplier", 170), (assign,
":imod", imod_thick), (else_try),
(eq,
":imod_multiplier", 260), (assign,
":imod", imod_hardened), (else_try),
(eq,
":imod_multiplier", 390), (assign,
":imod", imod_reinforced), (else_try),
(eq,
":imod_multiplier", 650), (assign,
":imod", imod_superb), (else_try),
(eq,
":imod_multiplier", 250), (assign,
":imod", imod_lordly), (else_try),
(eq,
":imod_multiplier", 1150), (assign,
":imod", imod_lame), (else_try),
(eq,
":imod_multiplier", 40), (assign,
":imod", imod_swaybacked), (else_try),
(eq,
":imod_multiplier", 60), (assign,
":imod", imod_stubborn), (else_try),
(eq,
":imod_multiplier", 90), (assign,
":imod", imod_timid), (else_try),
(eq,
":imod_multiplier", 180), (assign,
":imod", imod_meek), (else_try),
(eq,
":imod_multiplier", 180), (assign,
":imod", imod_spirited), (else_try),
(eq,
":imod_multiplier", 650), (assign,
":imod", imod_champion), (else_try),
(eq,
":imod_multiplier", 1450), (assign,
":imod", imod_fresh), (else_try),
(eq,
":imod_multiplier", 100), (assign,
":imod", imod_day_old), (else_try),
(eq,
":imod_multiplier", 100), (assign,
":imod", imod_two_day_old), (else_try),
(eq,
":imod_multiplier", 90), (assign,
":imod", imod_smelling), (else_try),
(eq,
":imod_multiplier", 40), (assign,
":imod", imod_rotten), (else_try),
(eq,
":imod_multiplier", 5), (assign,
":imod", imod_large_bag), (else_try),
(eq,
":imod_multiplier", 190), (assign,
":score", ":imod_multiplier"), (try_end),
(val_mul,
":score"), (assign, reg0,
]),