2025-01-12 23:33:20 +00:00
|
|
|
signature ENEMY_PATCH =
|
|
|
|
|
sig
|
|
|
|
|
datatype enemy_patch =
|
|
|
|
|
W_HEALTH of int
|
|
|
|
|
| W_X of int
|
|
|
|
|
| W_Y of int
|
2025-02-13 11:24:44 +00:00
|
|
|
| W_X_AXIS of EntityType.x_axis
|
|
|
|
|
| W_Y_AXIS of EntityType.y_axis
|
2025-01-25 08:41:42 +00:00
|
|
|
| W_PLAT_ID of int
|
2025-01-26 13:23:20 +00:00
|
|
|
| W_NEXT_PLAT_ID of int
|
2025-02-11 19:38:02 +00:00
|
|
|
| W_BAT_REST of int
|
2025-02-11 23:54:13 +00:00
|
|
|
| W_BAT_MAX_Y of int
|
|
|
|
|
| W_BAT_MIN_Y of int
|
2025-02-13 11:24:44 +00:00
|
|
|
| W_BAT_DIR_Y of EnemyType.bat_dir_y
|
2025-02-15 08:13:36 +00:00
|
|
|
| W_FACING of EntityType.facing
|
2025-02-15 12:34:10 +00:00
|
|
|
| W_SHIELD_ON of bool
|
2025-01-12 23:33:20 +00:00
|
|
|
|
2025-02-13 11:24:44 +00:00
|
|
|
val withPatch: EnemyType.enemy * enemy_patch -> EnemyType.enemy
|
2025-01-12 23:33:20 +00:00
|
|
|
|
2025-02-13 11:24:44 +00:00
|
|
|
val withPatches: EnemyType.enemy * enemy_patch list -> EnemyType.enemy
|
2025-01-12 23:33:20 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
structure EnemyPatch: ENEMY_PATCH =
|
2025-01-12 23:28:03 +00:00
|
|
|
struct
|
|
|
|
|
datatype enemy_patch =
|
|
|
|
|
W_HEALTH of int
|
|
|
|
|
| W_X of int
|
|
|
|
|
| W_Y of int
|
2025-02-13 11:24:44 +00:00
|
|
|
| W_X_AXIS of EntityType.x_axis
|
|
|
|
|
| W_Y_AXIS of EntityType.y_axis
|
2025-01-25 08:41:42 +00:00
|
|
|
| W_PLAT_ID of int
|
2025-01-26 13:23:20 +00:00
|
|
|
| W_NEXT_PLAT_ID of int
|
2025-02-11 19:38:02 +00:00
|
|
|
| W_BAT_REST of int
|
2025-02-11 23:54:13 +00:00
|
|
|
| W_BAT_MAX_Y of int
|
|
|
|
|
| W_BAT_MIN_Y of int
|
2025-02-13 11:24:44 +00:00
|
|
|
| W_BAT_DIR_Y of EnemyType.bat_dir_y
|
2025-02-15 08:13:36 +00:00
|
|
|
| W_FACING of EntityType.facing
|
2025-02-15 12:34:10 +00:00
|
|
|
| W_SHIELD_ON of bool
|
2025-01-12 23:28:03 +00:00
|
|
|
|
2025-02-11 18:05:44 +00:00
|
|
|
fun mkEnemy
|
2025-02-11 23:54:13 +00:00
|
|
|
( id
|
|
|
|
|
, health
|
|
|
|
|
, x
|
|
|
|
|
, y
|
|
|
|
|
, xAxis
|
|
|
|
|
, yAxis
|
|
|
|
|
, variant
|
|
|
|
|
, platID
|
|
|
|
|
, nextPlatID
|
|
|
|
|
, batRest
|
|
|
|
|
, batDirY
|
|
|
|
|
, batMaxY
|
|
|
|
|
, batMinY
|
2025-02-15 08:13:36 +00:00
|
|
|
, facing
|
2025-02-15 12:34:10 +00:00
|
|
|
, shieldOn
|
2025-02-11 23:54:13 +00:00
|
|
|
) =
|
2025-01-14 11:50:27 +00:00
|
|
|
{ id = id
|
|
|
|
|
, health = health
|
|
|
|
|
, x = x
|
|
|
|
|
, y = y
|
|
|
|
|
, xAxis = xAxis
|
|
|
|
|
, yAxis = yAxis
|
|
|
|
|
, variant = variant
|
2025-01-25 08:41:42 +00:00
|
|
|
, platID = platID
|
2025-01-26 13:23:20 +00:00
|
|
|
, nextPlatID = nextPlatID
|
2025-02-11 18:05:44 +00:00
|
|
|
, batRest = batRest
|
2025-02-11 23:54:13 +00:00
|
|
|
, batDirY = batDirY
|
|
|
|
|
, batMaxY = batMaxY
|
|
|
|
|
, batMinY = batMinY
|
2025-02-15 08:13:36 +00:00
|
|
|
, facing = facing
|
2025-02-15 12:34:10 +00:00
|
|
|
, shieldOn = shieldOn
|
2025-01-14 11:50:27 +00:00
|
|
|
}
|
2025-01-12 23:28:03 +00:00
|
|
|
|
|
|
|
|
fun withPatch (enemy, patch) =
|
|
|
|
|
let
|
2025-02-11 23:54:13 +00:00
|
|
|
val
|
|
|
|
|
{ id
|
|
|
|
|
, health
|
|
|
|
|
, x
|
|
|
|
|
, y
|
|
|
|
|
, xAxis
|
|
|
|
|
, yAxis
|
|
|
|
|
, variant
|
|
|
|
|
, platID
|
|
|
|
|
, nextPlatID
|
|
|
|
|
, batRest
|
|
|
|
|
, batDirY
|
|
|
|
|
, batMaxY
|
|
|
|
|
, batMinY
|
2025-02-15 08:13:36 +00:00
|
|
|
, facing
|
2025-02-15 12:34:10 +00:00
|
|
|
, shieldOn
|
2025-02-11 23:54:13 +00:00
|
|
|
} = enemy
|
2025-01-12 23:28:03 +00:00
|
|
|
in
|
|
|
|
|
case patch of
|
2025-01-25 08:41:42 +00:00
|
|
|
W_HEALTH health =>
|
2025-02-11 18:05:44 +00:00
|
|
|
mkEnemy
|
|
|
|
|
( id
|
|
|
|
|
, health
|
|
|
|
|
, x
|
|
|
|
|
, y
|
|
|
|
|
, xAxis
|
|
|
|
|
, yAxis
|
|
|
|
|
, variant
|
|
|
|
|
, platID
|
|
|
|
|
, nextPlatID
|
|
|
|
|
, batRest
|
2025-02-11 23:54:13 +00:00
|
|
|
, batDirY
|
|
|
|
|
, batMaxY
|
|
|
|
|
, batMinY
|
2025-02-15 08:13:36 +00:00
|
|
|
, facing
|
2025-02-15 12:34:10 +00:00
|
|
|
, shieldOn
|
2025-02-11 18:05:44 +00:00
|
|
|
)
|
2025-01-27 23:41:59 +00:00
|
|
|
| W_X x =>
|
2025-02-11 18:05:44 +00:00
|
|
|
mkEnemy
|
|
|
|
|
( id
|
|
|
|
|
, health
|
|
|
|
|
, x
|
|
|
|
|
, y
|
|
|
|
|
, xAxis
|
|
|
|
|
, yAxis
|
|
|
|
|
, variant
|
|
|
|
|
, platID
|
|
|
|
|
, nextPlatID
|
|
|
|
|
, batRest
|
2025-02-11 23:54:13 +00:00
|
|
|
, batDirY
|
|
|
|
|
, batMaxY
|
|
|
|
|
, batMinY
|
2025-02-15 08:13:36 +00:00
|
|
|
, facing
|
2025-02-15 12:34:10 +00:00
|
|
|
, shieldOn
|
2025-02-11 18:05:44 +00:00
|
|
|
)
|
2025-01-25 08:41:42 +00:00
|
|
|
| W_X_AXIS xAxis =>
|
2025-02-11 18:05:44 +00:00
|
|
|
mkEnemy
|
|
|
|
|
( id
|
|
|
|
|
, health
|
|
|
|
|
, x
|
|
|
|
|
, y
|
|
|
|
|
, xAxis
|
|
|
|
|
, yAxis
|
|
|
|
|
, variant
|
|
|
|
|
, platID
|
|
|
|
|
, nextPlatID
|
|
|
|
|
, batRest
|
2025-02-11 23:54:13 +00:00
|
|
|
, batDirY
|
|
|
|
|
, batMaxY
|
|
|
|
|
, batMinY
|
2025-02-15 08:13:36 +00:00
|
|
|
, facing
|
2025-02-15 12:34:10 +00:00
|
|
|
, shieldOn
|
2025-02-11 18:05:44 +00:00
|
|
|
)
|
2025-01-27 23:41:59 +00:00
|
|
|
| W_Y y =>
|
2025-02-11 18:05:44 +00:00
|
|
|
mkEnemy
|
|
|
|
|
( id
|
|
|
|
|
, health
|
|
|
|
|
, x
|
|
|
|
|
, y
|
|
|
|
|
, xAxis
|
|
|
|
|
, yAxis
|
|
|
|
|
, variant
|
|
|
|
|
, platID
|
|
|
|
|
, nextPlatID
|
|
|
|
|
, batRest
|
2025-02-11 23:54:13 +00:00
|
|
|
, batDirY
|
|
|
|
|
, batMaxY
|
|
|
|
|
, batMinY
|
2025-02-15 08:13:36 +00:00
|
|
|
, facing
|
2025-02-15 12:34:10 +00:00
|
|
|
, shieldOn
|
2025-02-11 18:05:44 +00:00
|
|
|
)
|
2025-01-25 08:41:42 +00:00
|
|
|
| W_Y_AXIS yAxis =>
|
2025-02-11 18:05:44 +00:00
|
|
|
mkEnemy
|
|
|
|
|
( id
|
|
|
|
|
, health
|
|
|
|
|
, x
|
|
|
|
|
, y
|
|
|
|
|
, xAxis
|
|
|
|
|
, yAxis
|
|
|
|
|
, variant
|
|
|
|
|
, platID
|
|
|
|
|
, nextPlatID
|
|
|
|
|
, batRest
|
2025-02-11 23:54:13 +00:00
|
|
|
, batDirY
|
|
|
|
|
, batMaxY
|
|
|
|
|
, batMinY
|
2025-02-15 08:13:36 +00:00
|
|
|
, facing
|
2025-02-15 12:34:10 +00:00
|
|
|
, shieldOn
|
2025-02-11 18:05:44 +00:00
|
|
|
)
|
2025-01-25 08:41:42 +00:00
|
|
|
| W_PLAT_ID platID =>
|
2025-02-11 18:05:44 +00:00
|
|
|
mkEnemy
|
|
|
|
|
( id
|
|
|
|
|
, health
|
|
|
|
|
, x
|
|
|
|
|
, y
|
|
|
|
|
, xAxis
|
|
|
|
|
, yAxis
|
|
|
|
|
, variant
|
|
|
|
|
, platID
|
|
|
|
|
, nextPlatID
|
|
|
|
|
, batRest
|
2025-02-11 23:54:13 +00:00
|
|
|
, batDirY
|
|
|
|
|
, batMaxY
|
|
|
|
|
, batMinY
|
2025-02-15 08:13:36 +00:00
|
|
|
, facing
|
2025-02-15 12:34:10 +00:00
|
|
|
, shieldOn
|
2025-02-11 18:05:44 +00:00
|
|
|
)
|
2025-01-26 13:23:20 +00:00
|
|
|
| W_NEXT_PLAT_ID nextPlatID =>
|
2025-02-11 18:05:44 +00:00
|
|
|
mkEnemy
|
|
|
|
|
( id
|
|
|
|
|
, health
|
|
|
|
|
, x
|
|
|
|
|
, y
|
|
|
|
|
, xAxis
|
|
|
|
|
, yAxis
|
|
|
|
|
, variant
|
|
|
|
|
, platID
|
|
|
|
|
, nextPlatID
|
|
|
|
|
, batRest
|
2025-02-11 23:54:13 +00:00
|
|
|
, batDirY
|
|
|
|
|
, batMaxY
|
|
|
|
|
, batMinY
|
2025-02-15 08:13:36 +00:00
|
|
|
, facing
|
2025-02-15 12:34:10 +00:00
|
|
|
, shieldOn
|
2025-02-11 18:05:44 +00:00
|
|
|
)
|
2025-02-11 19:38:02 +00:00
|
|
|
| W_BAT_REST batRest =>
|
|
|
|
|
mkEnemy
|
|
|
|
|
( id
|
|
|
|
|
, health
|
|
|
|
|
, x
|
|
|
|
|
, y
|
|
|
|
|
, xAxis
|
|
|
|
|
, yAxis
|
|
|
|
|
, variant
|
|
|
|
|
, platID
|
|
|
|
|
, nextPlatID
|
|
|
|
|
, batRest
|
2025-02-11 23:54:13 +00:00
|
|
|
, batDirY
|
|
|
|
|
, batMaxY
|
|
|
|
|
, batMinY
|
2025-02-15 08:13:36 +00:00
|
|
|
, facing
|
2025-02-15 12:34:10 +00:00
|
|
|
, shieldOn
|
2025-02-11 23:54:13 +00:00
|
|
|
)
|
|
|
|
|
| W_BAT_MAX_Y batMaxY =>
|
|
|
|
|
mkEnemy
|
|
|
|
|
( id
|
|
|
|
|
, health
|
|
|
|
|
, x
|
|
|
|
|
, y
|
|
|
|
|
, xAxis
|
|
|
|
|
, yAxis
|
|
|
|
|
, variant
|
|
|
|
|
, platID
|
|
|
|
|
, nextPlatID
|
|
|
|
|
, batRest
|
|
|
|
|
, batDirY
|
|
|
|
|
, batMaxY
|
|
|
|
|
, batMinY
|
2025-02-15 08:13:36 +00:00
|
|
|
, facing
|
2025-02-15 12:34:10 +00:00
|
|
|
, shieldOn
|
2025-02-11 23:54:13 +00:00
|
|
|
)
|
|
|
|
|
| W_BAT_MIN_Y batMinY =>
|
|
|
|
|
mkEnemy
|
|
|
|
|
( id
|
|
|
|
|
, health
|
|
|
|
|
, x
|
|
|
|
|
, y
|
|
|
|
|
, xAxis
|
|
|
|
|
, yAxis
|
|
|
|
|
, variant
|
|
|
|
|
, platID
|
|
|
|
|
, nextPlatID
|
|
|
|
|
, batRest
|
|
|
|
|
, batDirY
|
|
|
|
|
, batMaxY
|
|
|
|
|
, batMinY
|
2025-02-15 08:13:36 +00:00
|
|
|
, facing
|
2025-02-15 12:34:10 +00:00
|
|
|
, shieldOn
|
2025-02-11 23:54:13 +00:00
|
|
|
)
|
|
|
|
|
| W_BAT_DIR_Y batDirY =>
|
|
|
|
|
mkEnemy
|
|
|
|
|
( id
|
|
|
|
|
, health
|
|
|
|
|
, x
|
|
|
|
|
, y
|
|
|
|
|
, xAxis
|
|
|
|
|
, yAxis
|
|
|
|
|
, variant
|
|
|
|
|
, platID
|
|
|
|
|
, nextPlatID
|
|
|
|
|
, batRest
|
|
|
|
|
, batDirY
|
|
|
|
|
, batMaxY
|
|
|
|
|
, batMinY
|
2025-02-15 08:13:36 +00:00
|
|
|
, facing
|
2025-02-15 12:34:10 +00:00
|
|
|
, shieldOn
|
2025-02-15 08:13:36 +00:00
|
|
|
)
|
|
|
|
|
| W_FACING facing =>
|
|
|
|
|
mkEnemy
|
|
|
|
|
( id
|
|
|
|
|
, health
|
|
|
|
|
, x
|
|
|
|
|
, y
|
|
|
|
|
, xAxis
|
|
|
|
|
, yAxis
|
|
|
|
|
, variant
|
|
|
|
|
, platID
|
|
|
|
|
, nextPlatID
|
|
|
|
|
, batRest
|
|
|
|
|
, batDirY
|
|
|
|
|
, batMaxY
|
|
|
|
|
, batMinY
|
|
|
|
|
, facing
|
2025-02-15 12:34:10 +00:00
|
|
|
, shieldOn
|
|
|
|
|
)
|
|
|
|
|
| W_SHIELD_ON shieldOn =>
|
|
|
|
|
mkEnemy
|
|
|
|
|
( id
|
|
|
|
|
, health
|
|
|
|
|
, x
|
|
|
|
|
, y
|
|
|
|
|
, xAxis
|
|
|
|
|
, yAxis
|
|
|
|
|
, variant
|
|
|
|
|
, platID
|
|
|
|
|
, nextPlatID
|
|
|
|
|
, batRest
|
|
|
|
|
, batDirY
|
|
|
|
|
, batMaxY
|
|
|
|
|
, batMinY
|
|
|
|
|
, facing
|
|
|
|
|
, shieldOn
|
2025-02-11 19:38:02 +00:00
|
|
|
)
|
2025-01-12 23:28:03 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
fun withPatches (enemy, lst) =
|
|
|
|
|
case lst of
|
|
|
|
|
hd :: tl =>
|
|
|
|
|
let val enemy = withPatch (enemy, hd)
|
|
|
|
|
in withPatches (enemy, tl)
|
|
|
|
|
end
|
|
|
|
|
| [] => enemy
|
|
|
|
|
end
|