mirror of
https://github.com/YouHaveTrouble/GuildMaster.git
synced 2026-05-12 06:26:59 +00:00
rough draft for quest phase system
This commit is contained in:
+1
-1
@@ -66,7 +66,7 @@ import {version} from "@/../package.json";
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {defineComponent} from "vue";
|
import {defineComponent} from "vue";
|
||||||
import {Adventurer} from "@/classes/Adventurer";
|
import {Adventurer} from "@/classes/Adventurer";
|
||||||
import {getQuestWithRewards, Quest} from "@/classes/Quest";
|
import {getQuestWithRewards, Quest} from "@/classes/quests/Quest";
|
||||||
import {Guild} from "@/classes/Guild";
|
import {Guild} from "@/classes/Guild";
|
||||||
import {getFromString, QuestRank} from "@/classes/QuestRank";
|
import {getFromString, QuestRank} from "@/classes/QuestRank";
|
||||||
import {
|
import {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import {Guild} from "@/classes/Guild";
|
import {Guild} from "@/classes/Guild";
|
||||||
import {Adventurer} from "@/classes/Adventurer";
|
import {Adventurer} from "@/classes/Adventurer";
|
||||||
import {Quest} from "@/classes/Quest";
|
import {Quest} from "@/classes/quests/Quest";
|
||||||
import {getFromString, QuestRank} from "@/classes/QuestRank";
|
import {getFromString, QuestRank} from "@/classes/QuestRank";
|
||||||
|
|
||||||
export class GameData {
|
export class GameData {
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import type {Adventurer} from "@/classes/Adventurer";
|
||||||
|
import {PhaseType} from "@/classes/quests/QuestPhaseType";
|
||||||
|
|
||||||
|
export default abstract class QuestPhase {
|
||||||
|
|
||||||
|
type: PhaseType;
|
||||||
|
points: number;
|
||||||
|
maxPoints: number;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
type: PhaseType,
|
||||||
|
maxPoints: number = 1,
|
||||||
|
points: number = 0,
|
||||||
|
) {
|
||||||
|
this.type = type;
|
||||||
|
this.points = points;
|
||||||
|
this.maxPoints = maxPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get how many points should be added each tick based on adventurers on a task.
|
||||||
|
*/
|
||||||
|
abstract getPointIncrement(adventurers: Array<Adventurer>): number;
|
||||||
|
|
||||||
|
public tick(adventurers: Array<Adventurer> = []) {
|
||||||
|
if (this.completed()) return;
|
||||||
|
const pointsToAdd = this.getPointIncrement(adventurers);
|
||||||
|
this.points = Math.max(Math.min(this.points + pointsToAdd, this.maxPoints), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public completed(): boolean {
|
||||||
|
return this.points >= this.maxPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
export enum PhaseType {
|
||||||
|
|
||||||
|
TRAVEL = "travel",
|
||||||
|
FIGHT = "fight",
|
||||||
|
GATHER = "gather",
|
||||||
|
PHYSICAL = "physical",
|
||||||
|
MENTAL = "mental",
|
||||||
|
|
||||||
|
}
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type {Quest} from "@/classes/Quest";
|
import type {Quest} from "@/classes/quests/Quest";
|
||||||
import AdventurerComponent from "@/components/AdventurerMiniComponent.vue";
|
import AdventurerComponent from "@/components/AdventurerMiniComponent.vue";
|
||||||
import type {Adventurer} from "@/classes/Adventurer";
|
import type {Adventurer} from "@/classes/Adventurer";
|
||||||
import {defineComponent, type PropType} from "vue";
|
import {defineComponent, type PropType} from "vue";
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
import {defineComponent, type PropType} from "vue";
|
import {defineComponent, type PropType} from "vue";
|
||||||
import AdventurerComponent from "@/components/AdventurerMiniComponent.vue";
|
import AdventurerComponent from "@/components/AdventurerMiniComponent.vue";
|
||||||
import type {Adventurer} from "@/classes/Adventurer";
|
import type {Adventurer} from "@/classes/Adventurer";
|
||||||
import type {Quest} from "@/classes/Quest";
|
import type {Quest} from "@/classes/quests/Quest";
|
||||||
import {Guild} from "@/classes/Guild";
|
import {Guild} from "@/classes/Guild";
|
||||||
import QuestMissive from "@/components/QuestMissive.vue";
|
import QuestMissive from "@/components/QuestMissive.vue";
|
||||||
import QuestGroup from "@/components/QuestGroup.vue";
|
import QuestGroup from "@/components/QuestGroup.vue";
|
||||||
|
|||||||
Reference in New Issue
Block a user