Implement Interactionstructure
All checks were successful
E2E Testing / test (push) Successful in 1m32s

This commit is contained in:
Sebastian Böckelmann 2024-05-11 17:11:13 +02:00
parent 49e12d7046
commit bcd06d894f
13 changed files with 149 additions and 3 deletions

View File

@ -1,12 +1,14 @@
import {ScriptAccount} from "../../scriptAccounts/ScriptAccount";
import {ScriptAccountCondition} from "../conditions/ScriptAccountCondition";
import {Action} from "../../interactions/actions/Action";
import {CharacterDependency} from "../../interactions/CharacterDependency";
export class ScriptAccountAction {
export class ScriptAccountAction extends Action{
scriptAccount: ScriptAccount
changingValue: number = 0;
constructor(scriptAccount: ScriptAccount, changingValue: number) {
super(CharacterDependency.NONE);
this.scriptAccount = scriptAccount;
this.changingValue = changingValue;
}

View File

@ -1,11 +1,15 @@
import {ScriptAccount} from "../../scriptAccounts/ScriptAccount";
export class ScriptAccountCondition {
import {Condition} from "../../interactions/condition/Condition";
import {CharacterDependency} from "../../interactions/CharacterDependency";
export class ScriptAccountCondition extends Condition{
scriptAccount: ScriptAccount
minValue: number
maxValue: number
private constructor(scriptAccount: ScriptAccount, minValue: number, maxValue: number) {
super(CharacterDependency.NONE);
this.scriptAccount = scriptAccount;
this.minValue = minValue;
this.maxValue = maxValue;

View File

@ -0,0 +1,18 @@
import {Character} from "../characters/Character";
import {Condition} from "./condition/Condition";
export abstract class AbstractInteraction {
sourceCharacter: Character
targetCharacter: Character
conditions: Condition[] = []
interactionLabel: string
constructor(sourceCharacter: Character, targetCharacter: Character, interactionLabel: string) {
this.sourceCharacter = sourceCharacter;
this.targetCharacter = targetCharacter;
this.interactionLabel = interactionLabel;
}
}

View File

@ -0,0 +1,5 @@
export enum CharacterDependency {
SRC,
TARGET,
NONE
}

View File

@ -0,0 +1,14 @@
import {Character} from "../characters/Character";
import {Condition} from "./condition/Condition";
import {Action} from "./actions/Action";
import {AbstractInteraction} from "./AbstractInteraction";
export class Interaction extends AbstractInteraction{
actions: Action[] = []
constructor(sourceCharacter: Character, targetCharacter: Character, interactionLabel: string) {
super(sourceCharacter, targetCharacter, interactionLabel);
}
}

View File

@ -0,0 +1,13 @@
import {Interaction} from "./Interaction";
import {AbstractInteraction} from "./AbstractInteraction";
import {Character} from "../characters/Character";
export class InteractionSequences extends AbstractInteraction {
interactions: Interaction[] = []
constructor(sourceCharacter: Character, targetCharacter: Character, interactionLabel: string) {
super(sourceCharacter, targetCharacter, interactionLabel);
}
}

View File

@ -0,0 +1,11 @@
import {CharacterDependency} from "../CharacterDependency";
export abstract class Action {
characterDependency: CharacterDependency
constructor(characterDependency: CharacterDependency) {
this.characterDependency = characterDependency;
}
}

View File

@ -0,0 +1,15 @@
import {Action} from "./Action";
import {Item} from "../../inventory/Item";
import {CharacterDependency} from "../CharacterDependency";
export class InventoryItemAction extends Action {
item: Item
valueChange: number
constructor(characterDependency: CharacterDependency, item: Item, valueChange: number) {
super(characterDependency);
this.item = item;
this.valueChange = valueChange;
}
}

View File

@ -0,0 +1,10 @@
import {CharacterDependency} from "../CharacterDependency";
export abstract class Condition {
characterDependency: CharacterDependency
constructor(characterDependency: CharacterDependency) {
this.characterDependency = characterDependency;
}
}

View File

@ -0,0 +1,13 @@
import {Gamesystem} from "../../gamesystems/Gamesystem";
import {State} from "../../gamesystems/states/State";
export class GamesystemCondition {
targetGamesystem: Gamesystem<any, any>
requieredState: State<any>;
constructor(targetGamesystem: Gamesystem<any, any>, requieredState: State<any>) {
this.targetGamesystem = targetGamesystem;
this.requieredState = requieredState;
}
}

View File

@ -0,0 +1,15 @@
import {Condition} from "./Condition";
import {Character} from "../../characters/Character";
import {CharacterDependency} from "../CharacterDependency";
export abstract class InventoryCondition extends Condition {
minValue: number
maxValue: number
constructor(characterDependency: CharacterDependency, minValue: number, maxValue: number) {
super(characterDependency);
this.minValue = minValue;
this.maxValue = maxValue;
}
}

View File

@ -0,0 +1,13 @@
import {InventoryCondition} from "./InventoryCondition";
import {Item} from "../../inventory/Item";
import {CharacterDependency} from "../CharacterDependency";
export class InventoryItemCondition extends InventoryCondition {
item: Item
constructor(characterDependency: CharacterDependency, minValue: number, maxValue: number, item: Item) {
super(characterDependency, minValue, maxValue);
this.item = item;
}
}

View File

@ -0,0 +1,13 @@
import {InventoryCondition} from "./InventoryCondition";
import {ItemGroup} from "../../inventory/ItemGroup";
import {CharacterDependency} from "../CharacterDependency";
export class InventoryItemgroupCondition extends InventoryCondition {
itemgroup: ItemGroup
constructor(characterDependency: CharacterDependency, minValue: number, maxValue: number, itemgroup: ItemGroup) {
super(characterDependency, minValue, maxValue);
this.itemgroup = itemgroup;
}
}