Added attack roll back to spell form

This commit is contained in:
Stefan Zermatten
2022-02-28 16:13:52 +02:00
parent afe6c044cd
commit 10d0a3f763
2 changed files with 216 additions and 118 deletions

View File

@@ -12,122 +12,216 @@
/> />
</v-col> </v-col>
</v-row> </v-row>
<div class="layout wrap justify-space-between"> <v-row dense>
<smart-switch <v-col
label="Always prepared" cols="12"
style="width: 200px; flex-grow: 0;" sm="6"
class="mx-2" md="4"
:value="model.alwaysPrepared" >
:error-messages="errors.alwaysPrepared" <smart-switch
@change="change('alwaysPrepared', ...arguments)" label="Always prepared"
/> :value="model.alwaysPrepared"
<smart-switch :error-messages="errors.alwaysPrepared"
@change="change('alwaysPrepared', ...arguments)"
/>
</v-col>
<v-col
v-show="!model.alwaysPrepared" v-show="!model.alwaysPrepared"
label="Prepared" cols="12"
style="width: 200px; flex-grow: 0;" sm="6"
class="mx-2" md="4"
:value="model.prepared" >
:error-messages="errors.prepared" <smart-switch
@change="change('prepared', ...arguments)" label="Prepared"
/> :value="model.prepared"
<smart-switch :error-messages="errors.prepared"
@change="change('prepared', ...arguments)"
/>
</v-col>
<v-col
v-show="model.level" v-show="model.level"
label="Cast without spell slots" cols="12"
style="width: 400px; flex-grow: 0;" sm="6"
class="mx-2" md="4"
:value="model.castWithoutSpellSlots" >
:error-messages="errors.castWithoutSpellSlots" <smart-switch
@change="change('castWithoutSpellSlots', ...arguments)" label="Cast without spell slots"
/> :value="model.castWithoutSpellSlots"
</div> :error-messages="errors.castWithoutSpellSlots"
<text-field @change="change('castWithoutSpellSlots', ...arguments)"
ref="focusFirst" />
label="Name" </v-col>
:value="model.name" </v-row>
:error-messages="errors.name" <v-row dense>
@change="change('name', ...arguments)" <v-col
/> cols="12"
<div class="layout wrap"> md="6"
<smart-select >
label="Level" <text-field
class="mx-1" ref="focusFirst"
style="flex-basis: 300px;" label="Name"
hint="The spell level" :value="model.name"
:items="spellLevels" :error-messages="errors.name"
:value="model.level" @change="change('name', ...arguments)"
:error-messages="errors.level" />
@change="change('level', ...arguments)" </v-col>
/> <v-col
<smart-select cols="12"
label="School" md="6"
class="mx-1" >
style="flex-basis: 300px;" <smart-select
:items="magicSchools" label="Level"
:value="model.school" hint="The spell level"
:error-messages="errors.school" :items="spellLevels"
@change="change('school', ...arguments)" :value="model.level"
/> :error-messages="errors.level"
</div> @change="change('level', ...arguments)"
<text-field />
label="Casting Time" </v-col>
:value="model.castingTime" <v-col
:error-messages="errors.castingTime" cols="12"
@change="change('castingTime', ...arguments)" md="6"
/> >
<text-field <smart-select
label="Range" label="School"
:value="model.range" :items="magicSchools"
:error-messages="errors.range" :value="model.school"
@change="change('range', ...arguments)" :error-messages="errors.school"
/> @change="change('school', ...arguments)"
<smart-select />
label="Target" </v-col>
style="flex-basis: 300px;" <v-col
:items="targetOptions" cols="12"
:value="model.target" md="6"
:error-messages="errors.target" >
:menu-props="{auto: true, lazy: true}" <text-field
@change="change('target', ...arguments)" label="Casting Time"
/> :value="model.castingTime"
<div class="layout wrap justify-space-between"> :error-messages="errors.castingTime"
<smart-checkbox @change="change('castingTime', ...arguments)"
label="Verbal" />
:value="model.verbal" </v-col>
:error-messages="errors.verbal" <v-col
@change="change('verbal', ...arguments)" cols="12"
/> md="6"
<smart-checkbox >
label="Somatic" <text-field
:value="model.somatic" label="Range"
:error-messages="errors.somatic" :value="model.range"
@change="change('somatic', ...arguments)" :error-messages="errors.range"
/> @change="change('range', ...arguments)"
<smart-checkbox />
label="Concentration" </v-col>
:value="model.concentration" <v-col
:error-messages="errors.concentration" cols="12"
@change="change('concentration', ...arguments)" md="6"
/> >
<smart-checkbox <text-field
label="Ritual" label="Duration"
:value="model.ritual" :value="model.duration"
:error-messages="errors.ritual" :error-messages="errors.duration"
@change="change('ritual', ...arguments)" @change="change('duration', ...arguments)"
/> />
</div> </v-col>
<text-field </v-row>
label="Material" <v-row class="mt-0">
:value="model.material" <v-col
:error-messages="errors.material" cols="6"
@change="change('material', ...arguments)" md="3"
/> class="pt-1"
<text-field >
label="Duration" <smart-checkbox
:value="model.duration" label="Verbal"
:error-messages="errors.duration" :value="model.verbal"
@change="change('duration', ...arguments)" :error-messages="errors.verbal"
/> @change="change('verbal', ...arguments)"
/>
</v-col>
<v-col
cols="6"
md="3"
class="pt-1"
>
<smart-checkbox
label="Somatic"
:value="model.somatic"
:error-messages="errors.somatic"
@change="change('somatic', ...arguments)"
/>
</v-col>
<v-col
cols="6"
md="3"
class="pt-1"
>
<smart-checkbox
label="Concentration"
:value="model.concentration"
:error-messages="errors.concentration"
@change="change('concentration', ...arguments)"
/>
</v-col>
<v-col
cols="6"
md="3"
class="pt-1"
>
<smart-checkbox
label="Ritual"
:value="model.ritual"
:error-messages="errors.ritual"
@change="change('ritual', ...arguments)"
/>
</v-col>
</v-row>
<v-row dense>
<v-col cols="12">
<text-field
label="Material"
:value="model.material"
:error-messages="errors.material"
@change="change('material', ...arguments)"
/>
</v-col>
</v-row>
<v-row dense>
<v-col
cols="12"
md="6"
>
<smart-select
label="Target"
:items="targetOptions"
:value="model.target"
:error-messages="errors.target"
:menu-props="{auto: true, lazy: true}"
@change="change('target', ...arguments)"
/>
</v-col>
<v-col
cols="12"
md="6"
>
<v-slide-x-transition mode="out-in">
<v-switch
v-if="!isAttack"
label="Attack roll"
:value="attackSwitch"
@change="e => attackSwitch = e"
/>
<computed-field
v-else
label="To Hit"
prefix="1d20 + "
hint="The bonus to attack if this action has an attack roll"
:model="model.attackRoll"
:error-messages="errors.attackRoll"
@change="({path, value, ack}) =>
$emit('change', {path: ['attackRoll', ...path], value, ack})"
/>
</v-slide-x-transition>
</v-col>
</v-row>
<inline-computation-field <inline-computation-field
label="Description" label="Description"
:model="model.description" :model="model.description"
@@ -145,7 +239,6 @@
/> />
</form-section> </form-section>
<form-section <form-section
v-if="model.level && model.castWithoutSpellSlots"
name="Limit Uses" name="Limit Uses"
> >
<v-row dense> <v-row dense>
@@ -301,13 +394,18 @@
value: 'longRest', value: 'longRest',
} }
], ],
attackSwitch: false,
};}, };},
computed: {
isAttack(){
return this.attackSwitch || !!this.model.attackRoll?.calculation
}
}
}; };
</script> </script>
<style lang="css" scoped> <style lang="css" scoped>
.v-input--checkbox { .v-input--checkbox {
flex-grow: 0; margin-top: 0;
width: 200px;
} }
</style> </style>

2
app/package-lock.json generated
View File

@@ -2783,7 +2783,7 @@
}, },
"signal-exit": { "signal-exit": {
"version": "3.0.2", "version": "3.0.2",
"resolved": "", "resolved": false,
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0="
}, },
"simpl-schema": { "simpl-schema": {