Skip to content

Commit 950a9b3

Browse files
committed
✨(mapScript/*) 支持CP
1 parent 697a244 commit 950a9b3

File tree

6 files changed

+50
-37
lines changed

6 files changed

+50
-37
lines changed

scripts/mapScript/1001.kts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
@file:Depends("mapScript/shared/hexed")
2-
@file:Depends("coreMindustry/utilMapRule", "参数平衡")
32

43
package mapScript
54

@@ -11,8 +10,7 @@ import mindustry.game.Schematic
1110
import mindustry.game.Schematics
1211
import mindustry.game.Team
1312
import mindustry.type.ItemStack
14-
import mindustry.world.blocks.defense.turrets.ItemTurret
15-
import mindustry.world.blocks.storage.CoreBlock
13+
import org.intellij.lang.annotations.Language
1614
import kotlin.time.Duration.Companion.minutes
1715

1816
/** @author WayZer */
@@ -74,13 +72,18 @@ registerGenerator(
7472
}
7573
}
7674

77-
val mapRule = contextScript<coreMindustry.UtilMapRule>()
75+
@Language("JSON5")
76+
val patch = """
77+
{
78+
"name": "Hexed-1001-Balance",
79+
"block.core-nucleus.unitType": "emanate",
80+
"block.foreshadow.ammoTypes.surge-alloy.damage": 350, // origin 1350
81+
"block.ripple.ammoTypes.plastanium": "-",
82+
}
83+
""".trimIndent()
84+
mapPatches = listOf(patch)
85+
7886
onEnable {
79-
mapRule.registerMapRule((Blocks.coreNucleus as CoreBlock)::unitType) { UnitTypes.emanate }
80-
mapRule.registerMapRule((Blocks.foreshadow as ItemTurret).ammoTypes[Items.surgeAlloy]::damage) { it / 4 }
81-
mapRule.registerMapRule((Blocks.ripple as ItemTurret)::ammoTypes) {
82-
it.copy().apply { remove(Items.plastanium) }
83-
}
8487
HexData.extraLoadout.add {
8588
val tileSize = tilesize.toFloat()
8689
repeat(6) {

scripts/mapScript/1003.kts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
@file:Depends("mapScript/shared/hexed")
2-
@file:Depends("coreMindustry/utilMapRule", "参数平衡")
32

43
package mapScript
54

@@ -14,6 +13,7 @@ import mindustry.game.Team
1413
import mindustry.type.ItemStack
1514
import mindustry.world.blocks.defense.turrets.ItemTurret
1615
import mindustry.world.blocks.environment.Floor
16+
import org.intellij.lang.annotations.Language
1717
import kotlin.time.Duration.Companion.minutes
1818

1919
/** @author WayZer */
@@ -91,15 +91,18 @@ registerGenerator(
9191
genRound("initHexData") { HexData.init(generator.chunkCenters, coreSchema) }
9292
}
9393

94+
@Language("JSON5")
95+
val patch = """
96+
{
97+
"name": "Hexed-1001-Balance",
98+
"block.core-nucleus.unitType": "emanate",
99+
"block.foreshadow.ammoTypes.surge-alloy.damage": 350, // origin 1350
100+
"block.ripple.ammoTypes.plastanium": "-",
101+
}
102+
""".trimIndent()
103+
mapPatches = listOf(patch)
94104

95-
val mapRule = contextScript<coreMindustry.UtilMapRule>()
96105
onEnable {
97-
mapRule.registerMapRule(UnitTypes.gamma::health) { 2000f }
98-
mapRule.registerMapRule(UnitTypes.gamma::armor) { 500f }
99-
mapRule.registerMapRule((Blocks.foreshadow as ItemTurret).ammoTypes[Items.surgeAlloy]::damage) { it / 4 }
100-
mapRule.registerMapRule((Blocks.ripple as ItemTurret)::ammoTypes) {
101-
it.copy().apply { remove(Items.plastanium) }
102-
}
103106
HexData.extraLoadout.add {
104107
val tileSize = tilesize.toFloat()
105108
repeat(6) {

scripts/mapScript/1009.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
@file:Depends("mapScript/shared/hexed")
2-
@file:Depends("coreMindustry/utilMapRule", "参数平衡")
32

43
package mapScript
54

scripts/mapScript/13545.kts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
@file:Depends("coreMindustry/menu", "调用菜单")
2-
@file:Depends("coreMindustry/utilMapRule", "修改核心单位")
32
@file:Depends("coreMindustry/util/spawnAround")
43

54
/**@author WayZer*/
@@ -12,8 +11,8 @@ import mindustry.game.Team
1211
import mindustry.gen.Iconc
1312
import mindustry.net.Administration
1413
import mindustry.world.blocks.storage.CoreBlock
14+
import org.intellij.lang.annotations.Language
1515

16-
name = "CoreWar"
1716
modeIntroduce(
1817
"招兵买马 CoreWar", """
1918
点击核心可以打开菜单
@@ -24,6 +23,17 @@ modeIntroduce(
2423
""".trimIndent()
2524
)
2625

26+
@Language("JSON5")
27+
val patch = """
28+
{
29+
"name": "CoreWar",
30+
"block.core-foundation.unitType": "alpha",
31+
"block.core-nucleus.unitType": "alpha",
32+
"block.core-nucleus.itemCapacity": 1000000,
33+
}
34+
""".trimIndent()
35+
mapPatches = listOf(patch)
36+
2737
data class TeamData(val team: Team) {
2838
var blockDamageMultiplier by team.rules()::blockDamageMultiplier
2939
var blockHealthMultiplier by team.rules()::blockHealthMultiplier
@@ -54,14 +64,6 @@ listen<EventType.TapEvent> {
5464
}
5565

5666
onEnable {
57-
if ((Blocks.coreNucleus as CoreBlock).unitType != UnitTypes.alpha) {
58-
contextScript<coreMindustry.UtilMapRule>().apply {
59-
registerMapRule((Blocks.coreFoundation as CoreBlock)::unitType) { UnitTypes.alpha }
60-
registerMapRule((Blocks.coreNucleus as CoreBlock)::unitType) { UnitTypes.alpha }
61-
registerMapRule(Blocks.coreNucleus::itemCapacity) { 1000_000 }
62-
}
63-
state.teams.getActive().forEach { it.core()?.storageCapacity = 1000_000 }
64-
}
6567
state.rules.bannedBlocks.add(Blocks.deconstructor)
6668
Call.setRules(state.rules)
6769
loop(Dispatchers.game) {

scripts/mapScript/999.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
@file:Depends("coreMindustry/utilMapRule", "参数平衡")
2-
31
package mapScript
42

53
import arc.math.Mathf

scripts/mapScript/tags/autoExchange.kts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
@file:Depends("coreMindustry/utilMapRule", "修改核心容量")
2-
31
package mapScript.tags
42

53
import mindustry.game.EventType.Trigger
64
import mindustry.game.Team
75
import mindustry.type.Item
86
import mindustry.world.blocks.storage.CoreBlock
7+
import org.intellij.lang.annotations.Language
98

109
registerMapTag("@autoExchange")
1110
modeIntroduce(
@@ -23,13 +22,22 @@ modeIntroduce(
2322
""".trimIndent()
2423
)
2524

25+
val cores = content?.run {
26+
blocks().filterIsInstance<CoreBlock>().map {
27+
"""block.${it.name}.itemCapacity: ${it.itemCapacity * 10},"""
28+
}
29+
}.orEmpty()
30+
@Language("JSON5")
31+
val patch = """
32+
{
33+
"name": "CoreWar",
34+
${cores.joinToString("\n")}
35+
}
36+
""".trimIndent()
37+
mapPatches = listOf(patch)
38+
2639
val score = IntArray(Team.all.size)
2740
onEnableForGame {
28-
contextScript<coreMindustry.UtilMapRule>().apply {
29-
content.blocks().filterIsInstance<CoreBlock>().forEach { core ->
30-
registerMapRule(core::itemCapacity) { it * 10 }
31-
}
32-
}
3341
score.fill(0)
3442
state.teams.getActive().forEach {
3543
score[it.team.id] = it.team.items().get(Items.copper)

0 commit comments

Comments
 (0)