move recruitment logic from the adventurer view to the main save data

This commit is contained in:
2023-03-29 00:31:14 +02:00
parent 5b4278cf30
commit 0890efd1ec
5 changed files with 167 additions and 156 deletions
+13
View File
@@ -0,0 +1,13 @@
import type {Adventurer} from "@/classes/Adventurer";
/**
* Get a random adventurer from the pool
* @param adventurerPool
* @returns {Adventurer|null} null if the pool is empty
*/
export function getNewAdventurerForHire(adventurerPool: Array<Adventurer>): Adventurer|null {
if (adventurerPool.length <= 0) return null;
const randomId = adventurerPool.length * Math.random() << 0;
return adventurerPool[randomId];
}