156 lines
5.2 KiB
Dart
156 lines
5.2 KiB
Dart
import 'package:wolf_dart/classes/cardinal_direction.dart';
|
|
import 'package:wolf_dart/features/difficulty/difficulty.dart';
|
|
|
|
abstract class MapObject {
|
|
// --- Player Spawns ---
|
|
static const int playerNorth = 19;
|
|
static const int playerEast = 20;
|
|
static const int playerSouth = 21;
|
|
static const int playerWest = 22;
|
|
|
|
// --- Static Decorations ---
|
|
static const int waterPuddle = 23;
|
|
static const int greenBarrel = 24;
|
|
static const int chairTable = 25;
|
|
static const int floorLamp = 26;
|
|
static const int chandelier = 27;
|
|
static const int hangingSkeleton = 28;
|
|
static const int dogFoodDecoration = 29;
|
|
static const int whiteColumn = 30;
|
|
static const int pottedPlant = 31;
|
|
static const int blueSkeleton = 32;
|
|
static const int vent = 33;
|
|
static const int kitchenCans = 34;
|
|
static const int exitSign = 35;
|
|
static const int brownPlant = 36;
|
|
static const int bowl = 37;
|
|
static const int armoredSuit = 38;
|
|
static const int emptyCage = 39;
|
|
static const int cageWithSkeleton = 40;
|
|
static const int bones = 41;
|
|
static const int goldenKeyBowl = 42;
|
|
|
|
// --- Collectibles ---
|
|
static const int goldKey = 43;
|
|
static const int silverKey = 44;
|
|
static const int bed = 45;
|
|
static const int basket = 46;
|
|
static const int food = 47;
|
|
static const int medkit = 48;
|
|
static const int ammoClip = 49;
|
|
static const int machineGun = 50;
|
|
static const int chainGun = 51;
|
|
static const int cross = 52;
|
|
static const int chalice = 53;
|
|
static const int chest = 54;
|
|
static const int crown = 55;
|
|
static const int extraLife = 56;
|
|
|
|
// --- Environmental ---
|
|
static const int bloodPoolSmall = 57;
|
|
static const int barrel = 58;
|
|
static const int wellFull = 59;
|
|
static const int wellEmpty = 60;
|
|
static const int bloodPoolLarge = 61;
|
|
static const int flag = 62;
|
|
static const int aardwolfSign = 63;
|
|
static const int bonesAndSkull = 64;
|
|
static const int wallHanging = 65;
|
|
static const int stove = 66;
|
|
static const int spearRack = 67;
|
|
static const int vines = 68;
|
|
|
|
// --- Logic & Triggers ---
|
|
static const int pushwallTrigger = 98;
|
|
static const int secretExitTrigger = 99;
|
|
static const int normalExitTrigger = 100;
|
|
|
|
// --- Enemy Base IDs (Easy, North) ---
|
|
static const int _guardBase = 108;
|
|
static const int _officerBase = 126; // WL6 only
|
|
static const int _ssBase = 144; // WL6 only
|
|
static const int _dogBase = 162;
|
|
static const int _mutantBase = 180; // Episode 2+
|
|
|
|
// Bosses (Shared between WL1 and WL6)
|
|
static const int bossHansGrosse = 214;
|
|
|
|
// WL6 Exclusive Bosses
|
|
static const int bossDrSchabbs = 215;
|
|
static const int bossTransGrosse = 216;
|
|
static const int bossUbermutant = 217;
|
|
static const int bossDeathKnight = 218;
|
|
static const int bossMechaHitler = 219;
|
|
static const int bossHitlerGhost = 220;
|
|
static const int bossGretelGrosse = 221;
|
|
static const int bossGiftmacher = 222;
|
|
static const int bossFettgesicht = 223;
|
|
|
|
// --- Enemy Range Constants ---
|
|
static const int guardStart = 108;
|
|
static const int officerStart = 126;
|
|
static const int ssStart = 144;
|
|
static const int dogStart = 162;
|
|
static const int mutantStart = 180;
|
|
|
|
/// Returns true if the object ID exists in the Shareware version.
|
|
static bool isSharewareCompatible(int id) {
|
|
// WL1 only had Guards (108-125), Dogs (162-179), and Hans Grosse (214)
|
|
if (id >= 126 && id < 162) return false; // No Officers or SS
|
|
if (id >= 180 && id < 214) return false; // No Mutants
|
|
if (id > 214) return false; // No other bosses
|
|
return true;
|
|
}
|
|
|
|
/// Resolves which enemy type a map ID belongs to.
|
|
static String getEnemyType(int id) {
|
|
if (id >= 108 && id <= 125) return "Guard";
|
|
if (id >= 126 && id <= 143) return "Officer";
|
|
if (id >= 144 && id <= 161) return "SS";
|
|
if (id >= 162 && id <= 179) return "Dog";
|
|
if (id >= 180 && id <= 197) return "Mutant";
|
|
return "Unknown";
|
|
}
|
|
|
|
/// Checks if an object should be spawned based on chosen difficulty.
|
|
static bool shouldSpawn(int id, Difficulty selectedDifficulty) {
|
|
if (id < 108 || id > 213) return true; // Items/Players/Bosses always spawn
|
|
|
|
// Enemy blocks are 18 IDs wide (e.g., 108-125 for Guards)
|
|
int relativeId = (id - 108) % 18;
|
|
|
|
// 0-3: Easy, 4-7: Medium, 8-11: Hard
|
|
if (relativeId < 4) return true; // Easy spawns on everything
|
|
if (relativeId < 8) {
|
|
return selectedDifficulty != Difficulty.canIPlayDaddy; // Medium/Hard
|
|
}
|
|
if (relativeId < 12) {
|
|
return selectedDifficulty == Difficulty.iAmDeathIncarnate; // Hard only
|
|
}
|
|
|
|
// 12-15 are typically "Ambush" versions of the Easy/Medium/Hard guards
|
|
return true;
|
|
}
|
|
|
|
/// Determines the spawn orientation of an enemy or player.
|
|
/// Determines the spawn orientation of an enemy or player.
|
|
static double getAngle(int id) {
|
|
// Player spawn angles
|
|
switch (id) {
|
|
case playerNorth:
|
|
return CardinalDirection.north.radians;
|
|
case playerEast:
|
|
return CardinalDirection.east.radians;
|
|
case playerSouth:
|
|
return CardinalDirection.south.radians;
|
|
case playerWest:
|
|
return CardinalDirection.west.radians;
|
|
}
|
|
|
|
if (id < 108 || id > 213) return 0.0;
|
|
|
|
// Enemy directions are mapped in groups of 4
|
|
return CardinalDirection.fromEnemyIndex(id - 108).radians;
|
|
}
|
|
}
|