gpt4 book ai didi

java - 想要修改格式相同的代码行中的整数

转载 作者:行者123 更新时间:2023-11-30 05:50:39 25 4
gpt4 key购买 nike

作为前言,我是这个论坛的新手,这是我的第一篇文章,因此请原谅有关帖子格式或类似问题的任何问题。所以我正在修改《全面 war 第三纪元 DaC》游戏。我正在寻求提高单位招募速度,并且我已经想出了如何做到这一点,但游戏中单位的绝对数量意味着需要几个小时才能手动检查和修改所有数字。我正在寻找一种方法来输入带有库存编号的文本文件,并让它返回具有不同编号的文本文件。我要修改的代码如下。

我对编码还很陌生,并且我已经尝试使用 J 选项 Pane 来解决这个问题,但这是一个非常史诗般的失败。

capability
{
wall_level 3
tower_level 1
gate_strength 3
free_upkeep bonus 2
recruits_morale_bonus bonus 3 requires event_counter is_the_ai 1
law_bonus bonus 1
recruitment_slots 2
population_growth_bonus bonus -2 requires factions { all, } and event_counter AI_growth 1
recruit_pool "Dorwinion Militia Swordsmen" 1 0.12 2 0 requires factions { byzantium, } and region_religion northmen 25 and hidden_resource grasland
recruit_pool "Dorwinion Militia Swordsmen" 0 0.1 1 0 requires factions { byzantium, } and region_religion northmen 25 and hidden_resource forest
recruit_pool "Dorwinion Militia Swordsmen" 0 0.05 1 0 requires factions { byzantium, } and region_religion northmen 25 and hidden_resource desert or hidden_resource mountains
recruit_pool "Dorwinion Militia Archers" 1 0.12 2 0 requires factions { byzantium, } and region_religion northmen 25 and hidden_resource grasland
recruit_pool "Dorwinion Militia Archers" 0 0.1 1 0 requires factions { byzantium, } and region_religion northmen 25 and hidden_resource forest
recruit_pool "Dorwinion Militia Archers" 0 0.05 1 0 requires factions { byzantium, } and region_religion northmen 25 and hidden_resource desert or hidden_resource mountains
recruit_pool "Amroth Infantry Javelinmen" 1 0.12 2 0 requires factions { denmark, } and region_religion islam 25 and hidden_resource coast
recruit_pool "Misty Snaga Javelinmen" 1 0.15 2 0 requires factions { france, } and region_religion catholic 15
recruit_pool "Rohan Militia Spearmen" 1 0.14 2 0 requires factions { milan, } and region_religion northmen 15 and hidden_resource grasland or hidden_resource forest or hidden_resource mountains
recruit_pool "Rohan Militia Spearmen" 1 0.06 1 0 requires factions { milan, } and region_religion northmen 15 and hidden_resource desert
recruit_pool "Rohan Scouts" 1 0.14 2 0 requires factions { milan, } and region_religion northmen 15 and hidden_resource grasland
recruit_pool "Rohan Scouts" 1 0.12 1 0 requires factions { milan, } and region_religion northmen 15 and hidden_resource forest
recruit_pool "Rohan Scouts" 1 0.06 1 0 requires factions { milan, } and region_religion northmen 15 and hidden_resource desert or hidden_resource mountains
recruit_pool "Breeland Militia Spearmen" 1 0.1 2 1 requires factions { normans, } and region_religion wildmen 25 and hidden_resource grasland and not resource sugar
recruit_pool "Breeland Militia Spearmen" 0 0.09 1 1 requires factions { normans, } and region_religion wildmen 25 and hidden_resource forest and not resource sugar
recruit_pool "Breeland Militia Spearmen" 0 0.02 1 1 requires factions { normans, } and region_religion wildmen 25 and hidden_resource desert and not resource sugar
recruit_pool "Breeland Militia Spearmen" 0 0.04 1 1 requires factions { normans, } and region_religion wildmen 25 and hidden_resource mountains and not resource sugar
recruit_pool "Breeland Militia Archers" 1 0.1 2 1 requires factions { normans, } and region_religion wildmen 25 and hidden_resource grasland and not resource sugar
recruit_pool "Breeland Militia Archers" 0 0.09 1 1 requires factions { normans, } and region_religion wildmen 25 and hidden_resource forest and not resource sugar
recruit_pool "Breeland Militia Archers" 0 0.02 1 1 requires factions { normans, } and region_religion wildmen 25 and hidden_resource desert and not resource sugar
recruit_pool "Breeland Militia Archers" 0 0.04 1 1 requires factions { normans, } and region_religion wildmen 25 and hidden_resource mountains and not resource sugar
recruit_pool "Anduin Hobbit Skirmishers" 1 0.07 1 0 requires factions { turks, } and hidden_resource Vale and hidden_resource HiddenH
recruit_pool "Anduin Hobbit Skirmishers" 1 0.07 1 0 requires factions { turks, } and hidden_resource Vale and hidden_resource HiddenJ
recruit_pool "Anduin Hobbit Skirmishers" 1 0.07 1 0 requires factions { turks, } and hidden_resource Vale and hidden_resource HiddenE
recruit_pool "Anduin Hobbit Shortbowmen" 1 0.1 1 0 requires factions { turks, } and hidden_resource Vale and hidden_resource HiddenH
recruit_pool "Anduin Hobbit Shortbowmen" 1 0.1 1 0 requires factions { turks, } and hidden_resource Vale and hidden_resource HiddenJ
recruit_pool "Anduin Hobbit Shortbowmen" 1 0.1 1 0 requires factions { turks, } and hidden_resource Vale and hidden_resource HiddenE
recruit_pool "Khand Militia Spearmen" 1 0.1 1 0 requires factions { khand, } and not event_counter civil_war 1 and region_religion orthodox 15 and hidden_resource desert or hidden_resource grasland
recruit_pool "Khand Militia Spearmen" 1 0.05 1 0 requires factions { khand, } and not event_counter civil_war 1 and region_religion orthodox 15 and hidden_resource forest or hidden_resource mountains
recruit_pool "Khand Militia Archers" 1 0.1 1 0 requires factions { khand, } and not event_counter civil_war 1 and region_religion orthodox 15 and hidden_resource desert or hidden_resource grasland
recruit_pool "Khand Militia Archers" 1 0.1 1 0 requires factions { khand, } and not event_counter civil_war 1 and region_religion orthodox 15 and hidden_resource forest or hidden_resource mountains
recruit_pool "Khand Axemen Cavalry" 1 0.15 2 0 requires factions { khand, } and not event_counter civil_war 1 and region_religion orthodox 15 and hidden_resource desert or hidden_resource grasland
recruit_pool "Khand Axemen Cavalry" 1 0.1 1 0 requires factions { khand, } and not event_counter civil_war 1 and region_religion orthodox 15 and hidden_resource forest or hidden_resource mountains
recruit_pool "Khand Militia Spearmen" 1 0.1 1 0 requires factions { khand, } and event_counter civil_war 1 and region_religion nomadic 15 and hidden_resource desert or hidden_resource grasland
recruit_pool "Khand Militia Spearmen" 1 0.05 1 0 requires factions { khand, } and event_counter civil_war 1 and region_religion nomadic 15 and hidden_resource forest or hidden_resource mountains
recruit_pool "Khand Militia Archers" 1 0.15 1 0 requires factions { khand, } and event_counter civil_war 1 and region_religion nomadic 15 and hidden_resource desert or hidden_resource grasland
recruit_pool "Khand Militia Archers" 1 0.1 1 0 requires factions { khand, } and event_counter civil_war 1 and region_religion nomadic 15 and hidden_resource forest or hidden_resource mountains
recruit_pool "Khand Axemen Cavalry" 1 0.15 2 0 requires factions { khand, } and event_counter civil_war 1 and region_religion nomadic 15 and hidden_resource desert or hidden_resource grasland
recruit_pool "Khand Axemen Cavalry" 1 0.1 1 0 requires factions { khand, } and event_counter civil_war 1 and region_religion nomadic 15 and hidden_resource forest or hidden_resource mountains
recruit_pool "Rhovanion Light Spearmen" 1 0.1 1 0 requires factions { scotland, } and region_religion northmen 25 and hidden_resource Rhovanion
recruit_pool "Rhovanion Light Spearmen" 1 0.1 1 0 requires factions { scotland, } and region_religion northmen 25 and hidden_resource Celduin
recruit_pool "Rhovanion Light Spearmen" 1 0.1 1 0 requires factions { scotland, } and region_religion northmen 25 and hidden_resource NorthEast
recruit_pool "Dale Medium Axemen" 1 0.12 2 1 requires factions { scotland, } and region_religion northmen 15 and hidden_resource grasland or hidden_resource forest
recruit_pool "Dale Medium Axemen" 0 0.08 1 0 requires factions { scotland, } and region_religion northmen 15 and hidden_resource desert or hidden_resource mountains
recruit_pool "Dale Militia Shortbowmen" 1 0.12 2 1 requires factions { scotland, } and region_religion northmen 15 and hidden_resource grasland or hidden_resource forest
recruit_pool "Dale Militia Shortbowmen" 1 0.08 1 0 requires factions { scotland, } and region_religion northmen 15 and hidden_resource desert or hidden_resource mountains
recruit_pool "Dale Heavy Javelinmen" 1 0.12 2 1 requires factions { scotland, } and region_religion northmen 15 and hidden_resource grasland or hidden_resource forest
recruit_pool "Dale Heavy Javelinmen" 1 0.08 1 0 requires factions { scotland, } and region_religion northmen 15 and hidden_resource desert or hidden_resource mountains
recruit_pool "Umbar Corsair Swordsmen" 1 0.13 2 0 requires factions { russia, } and region_religion kings 5 and hidden_resource coast
recruit_pool "Umbar Corsair Archers" 1 0.13 2 0 requires factions { russia, } and region_religion kings 5 and hidden_resource coast
recruit_pool "Harad Militia Spearmen" 1 0.1 2 0 requires factions { spain, } and region_religion orthodox 15 and hidden_resource desert or hidden_resource grasland
recruit_pool "Harad Militia Spearmen" 1 0.05 1 0 requires factions { spain, } and region_religion orthodox 15 and hidden_resource forest or hidden_resource mountains
recruit_pool "Harad Militia Archers" 1 0.11 2 0 requires factions { spain, } and region_religion orthodox 15 and hidden_resource desert or hidden_resource grasland
recruit_pool "Harad Militia Archers" 1 0.06 2 0 requires factions { spain, } and region_religion orthodox 15 and hidden_resource forest or hidden_resource mountains
recruit_pool "Rhun Militia Swordsmen" 1 0.12 2 0 requires factions { venice, } and region_religion orthodox 15 and hidden_resource desert or hidden_resource grasland
recruit_pool "Rhun Militia Swordsmen" 0 0.08 2 0 requires factions { venice, } and region_religion orthodox 15 and hidden_resource forest or hidden_resource mountains
recruit_pool "Rhun Militia Archers" 1 0.12 2 0 requires factions { venice, } and region_religion orthodox 15 and hidden_resource desert or hidden_resource grasland
recruit_pool "Rhun Militia Archers" 0 0.08 1 0 requires factions { venice, } and region_religion orthodox 15 and hidden_resource forest or hidden_resource mountains
recruit_pool "Rhun Javelinmen" 1 0.12 2 0 requires factions { venice, } and region_religion orthodox 15 and hidden_resource Rhovanion and event_counter balchoth_clan_joins 1
recruit_pool "Mordor Militia Spearmen" 1 0.22 3 0 requires factions { england, france, } and region_religion catholic 15 and hidden_resource mountains or hidden_resource forest or hidden_resource grasland
recruit_pool "Mordor Militia Spearmen" 0 0.11 2 0 requires factions { england, france, } and region_religion catholic 15 and hidden_resource desert
recruit_pool "Mordor Militia Archers" 1 0.22 3 0 requires factions { england, } and region_religion catholic 15 and hidden_resource mountains or hidden_resource forest or hidden_resource grasland
recruit_pool "Mordor Militia Archers" 0 0.11 2 0 requires factions { england, } and region_religion catholic 15 and hidden_resource desert
recruit_pool "Mordor Infantry Swordsmen" 1 0.22 3 0 requires factions { england, } and region_religion catholic 15 and hidden_resource mountains or hidden_resource forest or hidden_resource grasland
recruit_pool "Mordor Infantry Swordsmen" 0 0.11 2 0 requires factions { england, } and region_religion catholic 15 and hidden_resource desert
recruit_pool "Guldur Militia Archers" 1 0.22 3 0 requires factions { poland, } and region_religion catholic 15 and hidden_resource mountains or hidden_resource forest or hidden_resource grasland
recruit_pool "Guldur Militia Archers" 0 0.11 2 0 requires factions { poland, } and region_religion catholic 15 and hidden_resource desert
recruit_pool "Guldur Militia Swordsmen" 1 0.22 3 0 requires factions { poland, } and region_religion catholic 15 and hidden_resource mountains or hidden_resource forest or hidden_resource grasland
recruit_pool "Guldur Militia Swordsmen" 0 0.11 2 0 requires factions { poland, } and region_religion catholic 15 and hidden_resource desert
recruit_pool "Mordor Infantry Swordsmen" 1 0.22 3 0 requires factions { poland, } and region_religion catholic 15 and hidden_resource mountains or hidden_resource forest or hidden_resource grasland
recruit_pool "Mordor Infantry Swordsmen" 0 0.11 2 0 requires factions { poland, } and region_religion catholic 15 and hidden_resource desert
recruit_pool "Misty Snaga Archers" 1 0.22 3 0 requires factions { hre, } and region_religion catholic 15 and hidden_resource mountains
recruit_pool "Misty Snaga Archers" 1 0.17 2 0 requires factions { hre, } and region_religion catholic 15 and hidden_resource grasland or hidden_resource forest
recruit_pool "Misty Snaga Archers" 0 0.12 1 0 requires factions { hre, } and region_religion catholic 15 and hidden_resource desert
recruit_pool "Misty Snaga Javelinmen" 1 0.22 3 0 requires factions { hre, } and region_religion catholic 15 and hidden_resource mountains
recruit_pool "Misty Snaga Javelinmen" 1 0.17 2 0 requires factions { hre, } and region_religion catholic 15 and hidden_resource grasland or hidden_resource forest
recruit_pool "Misty Snaga Javelinmen" 0 0.12 1 0 requires factions { hre, } and region_religion catholic 15 and hidden_resource desert
recruit_pool "Angmar Snaga Swordsmen" 1 0.22 3 0 requires factions { portugal, hre, } and region_religion catholic 15 and hidden_resource mountains
recruit_pool "Angmar Snaga Swordsmen" 1 0.17 2 0 requires factions { portugal, hre, } and region_religion catholic 15 and hidden_resource grasland or hidden_resource forest
recruit_pool "Angmar Snaga Swordsmen" 0 0.12 1 0 requires factions { portugal, hre, } and region_religion catholic 15 and hidden_resource desert
recruit_pool "Angmar Orc Medium Axemen" 1 0.22 3 0 requires factions { portugal, france, } and region_religion catholic 15 and hidden_resource mountains
recruit_pool "Angmar Orc Medium Axemen" 0 0.17 2 0 requires factions { portugal, france, } and region_religion catholic 15 and hidden_resource grasland or hidden_resource forest
recruit_pool "Angmar Orc Medium Axemen" 0 0.12 1 0 requires factions { portugal, france, } and region_religion catholic 15 and hidden_resource desert
recruit_pool "Anduin Farmers" 1 0.12 2 0 requires factions { timurids, } and region_religion northmen 15 and hidden_resource mountains or hidden_resource grasland or hidden_resource forest
recruit_pool "Anduin Farmers" 0 0.02 1 0 requires factions { timurids, } and region_religion northmen 15 and hidden_resource desert
recruit_pool "Anduin Hobbit Skirmishers" 1 0.1 1 0 requires factions { timurids, } and region_religion northmen 15 and hidden_resource Vale and hidden_resource HiddenF
recruit_pool "Anduin Hobbit Skirmishers" 1 0.1 1 0 requires factions { timurids, } and region_religion northmen 15 and hidden_resource Vale and hidden_resource HiddenG
recruit_pool "Anduin Hobbit Shortbowmen" 1 0.1 1 0 requires factions { timurids, } and region_religion northmen 15 and hidden_resource Vale and hidden_resource HiddenF
recruit_pool "Anduin Hobbit Shortbowmen" 1 0.1 1 0 requires factions { timurids, } and region_religion northmen 15 and hidden_resource Vale and hidden_resource HiddenG
recruit_pool "Wildmen Bandits" 1 0.14 2 0 requires factions { teutonic_order, } and region_religion wildmen 15 and hidden_resource mountains or hidden_resource grasland or hidden_resource forest
recruit_pool "Wildmen Bandits" 1 0.06 1 0 requires factions { teutonic_order, } and region_religion wildmen 15 and hidden_resource desert
recruit_pool "Enedwaith Medium Archers" 1 0.14 2 0 requires factions { teutonic_order, } and region_religion wildmen 15 and hidden_resource grasland or hidden_resource mountains or hidden_resource forest
recruit_pool "Enedwaith Medium Archers" 0 0.06 1 0 requires factions { teutonic_order, } and region_religion wildmen 15 and hidden_resource desert
recruit_pool "Enedwaith Vorn Spearmen" 1 0.15 2 0 requires factions { teutonic_order, } and region_religion wildmen 15 and hidden_resource Miniriath and hidden_resource HiddenA
recruit_pool "Enedwaith Vorn Spearmen" 1 0.15 2 0 requires factions { teutonic_order, } and region_religion wildmen 15 and hidden_resource Miniriath and hidden_resource HiddenD
recruit_pool "Dunland Militia Spearmen" 1 0.13 2 0 requires factions { aztecs, } and region_religion wildmen 15 and hidden_resource mountains or hidden_resource grasland or hidden_resource forest
recruit_pool "Dunland Militia Spearmen" 0 0.05 1 0 requires factions { aztecs, } and region_religion wildmen 15 and hidden_resource desert
recruit_pool "Dunland Militia Axemen" 1 0.13 2 0 requires factions { aztecs, } and region_religion wildmen 15 and hidden_resource mountains or hidden_resource grasland or hidden_resource forest
recruit_pool "Dunland Militia Axemen" 0 0.05 1 0 requires factions { aztecs, } and region_religion wildmen 15 and hidden_resource desert
recruit_pool "Breeland City Elites" 1 0.055 1 0 requires factions { normans, } and region_religion wildmen 65

}

假设我想直接更改这行代码中“recruit_pool”之后的数字“recruit_pool“Breeland Militia Archers”1 0.1 2 1需要派系{normans,}和region_religion wildmen 25和hidden_​​resource草地而不是资源糖”这样它就会变成:“recruit_pool“Breeland Militia Archers”3 1 3 1需要派系{normans,}和region_religion wildmen 25和hidden_​​resourcegrasland而不是资源糖”,但对代码中的每一行都执行此操作。我不想手动执行此操作,因为上面的代码只是我正在修改的数百种 .txt 方法中的一种。预先感谢您的帮助。

最佳答案

搜索和替换模式的一种非常简单的方法是正则表达式。几乎每种编程语言都有正则表达式。您可以非常轻松地搜索某事的出现并替换其部分内容。

在 Perl(一种脚本语言)中,使用它非常容易。

关于java - 想要修改格式相同的代码行中的整数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53965910/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com