-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Felix Naumann
committed
Jan 26, 2024
1 parent
edf0353
commit f16ef63
Showing
14 changed files
with
112 additions
and
62 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,14 @@ | ||
<schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xpath"> | ||
<pattern> | ||
|
||
|
||
<rule context="root/rules/enabledGlobalPunishments"> | ||
<assert test="not(exists(endPunishment))"> | ||
End Punishment exists, but it may not (DUMMY RULE) | ||
<rule context="root/rules/enabledRules/noDeath"> | ||
<assert test="not(exists(punishments/deathPunishment))"> | ||
NoDeath rule cannnot contain the Death punishment. | ||
</assert> | ||
</rule> | ||
<rule context="root/goals/mobGoal/mobs"> | ||
<assert test="not(exists(WITHER))"> | ||
Wither may not be selected in MobGoal (DUMMY RULE) | ||
<rule context="root/rules"> | ||
<assert test="not(exists(enabledRules/noDeath) and exists(enabledGlobalPunishments/deathPunishment))"> | ||
Global Death punishment and NoDeath rule cannot be both active. | ||
</assert> | ||
</rule> | ||
<!--rule context="root"> | ||
<assert test="false"> | ||
test | ||
</assert> | ||
</rule--> | ||
<!--rule context="root/rules"> | ||
<assert test="exists(NoDamage)"> | ||
NoDamage does not exist! (This is just a test rule, not an actual rule) | ||
</assert> | ||
</rule> | ||
<rule context="root/rules/NoDeath"> | ||
<assert test="not(exists(punishments/Death))"> | ||
NoDeath rule should not contain the Death punishment. | ||
</assert> | ||
</rule> | ||
<rule context="rules/RandomDrops/materialRandomizations"> | ||
<assert test="count(randomize/@from) = count(distinct-values(randomize/@from))"> | ||
Two entries cannot have the same key. | ||
</assert> | ||
</rule--> | ||
<!--rule context="rules/RandomDrops/materialRandomizations" > | ||
<let name="uniqueFromValues" value="distinct-values(randomize/@from)"/> | ||
<assert test="count(randomize/@from) = count($uniqueFromValues)"> | ||
Duplicate entries found for 'from' key: <value-of select="string-join($uniqueFromValues[. = current()/@from], ', ')". | ||
</assert> | ||
</rule--> | ||
</pattern> | ||
</schema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
builder_website/src/components/punishments/RandomEffectPunishment.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<template> | ||
<DefaultPunishment v-bind="props" v-slot="slotProps" @clear-on-disabled="clearOnDisabled"> | ||
<div v-if="slotProps.punishable.active.value"> | ||
<div class="flex items-center space-x-4"> | ||
<p>Effects at once:</p> | ||
<InputNumber input-style="width:32px" v-model="effectsAtOnce" show-buttons mode="decimal" :min="minEffectsAtOnce" :max="maxEffectsAtOnce" :disabled="randomizeEffectsAtOnce"/> | ||
<Checkbox v-model="randomizeEffectsAtOnce" :binary="true" input-id="randomizeEffectsAtOnce"/> | ||
<label for="randomizeEffectsAtOnce" class="ml-2">Randomize every time?</label> | ||
</div> | ||
</div> | ||
</DefaultPunishment> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import DefaultPunishment, { type PunishmentProps } from './DefaultPunishment.vue'; | ||
import InputNumber from 'primevue/inputnumber'; | ||
import Checkbox from 'primevue/checkbox'; | ||
import { ref, watch } from 'vue'; | ||
import { useConfigStore, useJSONSchemaConfigStore } from '@/main'; | ||
import { usePunishableCommons } from './Punishable'; | ||
const props = defineProps<PunishmentProps>() | ||
const model = useConfigStore().model | ||
const jsonSchema = useJSONSchemaConfigStore() | ||
const { getPunishmentBasePath } = usePunishableCommons() | ||
const minEffectsAtOnce = jsonSchema.RandomEffectPunishmentConfig.properties.effectsAtOnce.minimum | ||
const maxEffectsAtOnce = jsonSchema.RandomEffectPunishmentConfig.properties.effectsAtOnce.maximum | ||
const defaultEffectsAtOnce = jsonSchema.RandomEffectPunishmentConfig.properties.effectsAtOnce.default | ||
const effectsAtOnce = ref(defaultEffectsAtOnce) | ||
watch(effectsAtOnce, (newEffectsAtOnce) => { | ||
getPunishmentBasePath(model, props).randomEffectPunishment!.effectsAtOnce = newEffectsAtOnce | ||
}) | ||
const defaultRandomizeEffectsAtOnce = jsonSchema.RandomEffectPunishmentConfig.properties.randomizeEffectsAtOnce.default | ||
const randomizeEffectsAtOnce = ref(defaultRandomizeEffectsAtOnce) | ||
watch(randomizeEffectsAtOnce, (isRandomizeEffectsAtOnce) => { | ||
effectsAtOnce.value = defaultEffectsAtOnce | ||
getPunishmentBasePath(model, props).randomEffectPunishment!.randomizeEffectsAtOnce = isRandomizeEffectsAtOnce | ||
}) | ||
function clearOnDisabled() { | ||
effectsAtOnce.value = defaultEffectsAtOnce | ||
randomizeEffectsAtOnce.value = defaultRandomizeEffectsAtOnce | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
{ | ||
"rules": { | ||
"enabledRules": { | ||
"noBlockBreak": { | ||
"noDeath": { | ||
"punishments": { | ||
"healthPunishment": { | ||
"affects": "All", | ||
"heartsLost": 1, | ||
"randomizeHeartsLost": false | ||
"deathPunishment": { | ||
|
||
} | ||
} | ||
} | ||
}, | ||
"enabledGlobalPunishments": { | ||
"deathPunishment": { | ||
|
||
} | ||
} | ||
} | ||
} |