diff --git a/src/app/project/game-model/characters/Character.ts b/src/app/project/game-model/characters/Character.ts index 07acf19..9934a79 100644 --- a/src/app/project/game-model/characters/Character.ts +++ b/src/app/project/game-model/characters/Character.ts @@ -1,9 +1,24 @@ import {ModelComponent} from "../ModelComponent"; import {ModelComponentType} from "../ModelComponentType"; +import {SimpleTemplateGamesystem} from "../gamesystems/SimpleTemplateGamesystem"; export class Character extends ModelComponent{ + private characterSpecificGamesystems: SimpleTemplateGamesystem[] = [] + constructor(componentName: string, componentDescription: string) { super(componentName, componentDescription, ModelComponentType.CHARACTER); } + + addCharacterSpecificGamesystem(templateGamesystem: SimpleTemplateGamesystem) { + if(!this.isGamesystemCharacterSpecific(templateGamesystem.componentName)) { + this.characterSpecificGamesystems.push(templateGamesystem); + templateGamesystem.addReferenceKey(this); + } + } + + private isGamesystemCharacterSpecific(gamesystemName: string) { + const characterSpecificGamesystem = this.characterSpecificGamesystems.find(gamesystem => gamesystem.componentName === gamesystemName); + return characterSpecificGamesystem != undefined + } } diff --git a/src/app/project/game-model/gamesystems/SimpleTemplateGamesystem.ts b/src/app/project/game-model/gamesystems/SimpleTemplateGamesystem.ts index 4e635ae..6eabd03 100644 --- a/src/app/project/game-model/gamesystems/SimpleTemplateGamesystem.ts +++ b/src/app/project/game-model/gamesystems/SimpleTemplateGamesystem.ts @@ -5,6 +5,7 @@ import {SimpleTransition} from "./transitions/SimpleTransition"; import {SimpleState} from "./states/SimpleState"; import {SimpleTemplateTransition} from "./transitions/SimpleTemplateTransition"; import {TemplateType} from "../TemplateType"; +import {state} from "@angular/animations"; export class SimpleTemplateGamesystem extends Gamesystem, SimpleTemplateTransition> { @@ -52,4 +53,22 @@ export class SimpleTemplateGamesystem extends Gamesystem { + if(!state.conditionMap.has(reference)) { + state.conditionMap.set(reference, state.conditions.concat()) + } + }) + + this.transitions.forEach(transition => { + if(!transition.conditions.has(reference)) { + transition.conditions.set(reference, transition.scriptAccountConditions.concat()) + } + + if(!transition.actions.has(reference)) { + transition.actions.set(reference, transition.scriptAccountActions.concat()) + } + }) + } + } diff --git a/src/app/project/game-model/gamesystems/states/SimpleTemplateState.ts b/src/app/project/game-model/gamesystems/states/SimpleTemplateState.ts index f10055c..52bb80c 100644 --- a/src/app/project/game-model/gamesystems/states/SimpleTemplateState.ts +++ b/src/app/project/game-model/gamesystems/states/SimpleTemplateState.ts @@ -3,6 +3,6 @@ import {ScriptAccountCondition} from "../conditions/ScriptAccountCondition"; export class SimpleTemplateState extends SimpleState { - conditionMap: Map = new Map() + conditionMap: Map = new Map() }