mirror of
https://github.com/thepaperpilot/Planar-Pioneers.git
synced 2024-11-24 09:21:45 +00:00
Prevent duplicate influences
This commit is contained in:
parent
a4d1e73762
commit
d3520ed9a2
1 changed files with 12 additions and 1 deletions
|
@ -38,6 +38,9 @@ import {
|
|||
} from "./projEntry";
|
||||
import type { ResourceState, Resources, PortalState } from "./projEntry";
|
||||
import { getColor, getName, sfc32 } from "./utils";
|
||||
import { useToast } from "vue-toastification";
|
||||
|
||||
const toast = useToast();
|
||||
|
||||
export type Treasure = GenericAchievement & {
|
||||
update?: (diff: number) => void;
|
||||
|
@ -68,7 +71,7 @@ export function createPlane(
|
|||
if (influences.some(i => i.type === "decreaseDiff")) {
|
||||
difficultyRand = difficultyRand / 2;
|
||||
}
|
||||
const difficulty = random() + tierIndex + 1;
|
||||
const difficulty = difficultyRand + tierIndex + 1;
|
||||
const rewardsLevel = influences.some(i => i.type === "increaseRewards")
|
||||
? difficulty + 1
|
||||
: difficulty;
|
||||
|
@ -408,6 +411,14 @@ export function createPlane(
|
|||
influenceTreasures.push(randomInfluence);
|
||||
description = `Gain a new portal influence`;
|
||||
onComplete = () => {
|
||||
if (randomInfluence in main.influenceNodes.value) {
|
||||
toast.warning(
|
||||
"Error: ignoring duplicate portal influence (" +
|
||||
influenceTypes[randomInfluence].display +
|
||||
")"
|
||||
);
|
||||
return;
|
||||
}
|
||||
const node = {
|
||||
id: getUniqueNodeID(main.board),
|
||||
position: {
|
||||
|
|
Loading…
Reference in a new issue