///
/**
* Fodder is exactly the same as a random room, except:
* 1 - It must be created as needed by a RegionRandom as it attempts to place Tricky rooms.
* 2 - It doesn't count towards a player's maximum remembered rooms
*/
enum RandomLootType {
DROPPED_ITEM,
CHEST
}
interface FodderPossibility {
name : string;
description : Say | string;
objects? : Array; // Always has these objects
randomLootChance? : number; // 0 to 100, chance of having loot on top of the objects
randomLootType? : RandomLootType; // if randomLootChance succeeds, this will be the type of loot in the room
chestType? : Array; // if randomLootType is chest, chest will be generated using this
maxLootRarity? : number;
minLootRarity? : number; // Level of the random loot generated, from 1 to 10
}
class RoomRandomFodder extends RoomRandom {
public constructor (id? : string) {
super(id, true);
}
public cloneInterface (pos : FodderPossibility) {
this.name = pos.name;
this.description = typeof pos.description == "string" ? new Say(pos.description) : pos.description;
if (pos.objects != undefined) {
for (let i = 0; i < pos.objects.length; i++) {
let object = pos.objects[i];
if (object instanceof Thing) {
this.place(object);
} else if (object == Thing || (object).prototype instanceof Thing) {
this.place(new (object)());
} else if (typeof object == "function") {
object = ( object)();
if (object instanceof Thing) {
this.place(object);
}
}
}
}
if (pos.randomLootChance != undefined && (Math.random() * 100) <= pos.randomLootChance) {
// TODO: Add the loot.
}
}
}