Skip to content

Commit

Permalink
fix broken card editing: action cards no ability
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickwieth committed Dec 14, 2023
1 parent 23b8f1e commit 8d327bb
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions src/views/CardCreatorPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,20 @@ export default {
this.abilities
);
}
// if an ability was created, but it has no effect, then this should be fixed
if (newModel.Abilities.length > 0) {
let effectsList = R.flatten(R.map(
x => R.values(R.pluck("Effects", x)),
newModel.Abilities))
if (R.any(y => y === undefined, effectsList)) {
this.notifyFail(
"Useless Ability",
"Card has an Ability, which does not do anything. Please add an Effect to the Ability."
);
return;
}
}
} else if (this.model.type === "Action") {
// check if the old effects should be restored
if (this.mode == Mode.EDIT && !this.clearAbilities && R.isEmpty(this.abilities)) {
Expand All @@ -1183,20 +1197,15 @@ export default {
this.abilities
);
}
}
// if an ability was created, but it has no effect, then this should be fixed
if (newModel.Abilities.length > 0) {
let effectsList = R.flatten(R.map(
x => R.values(R.pluck("Effects", x)),
newModel.Abilities))
if (R.any(y => y === undefined, effectsList)) {
// if an ability was created, but it has no effect, then this should be fixed
if (newModel.Effects.length == 0) {
console.log("newmodel", newModel)
this.notifyFail(
"Useless Ability",
"Card has an Ability, which does not do anything. Please add an Effect to the Ability."
"No Effects",
"Card has no effect. Maybe you forgot to add an effect?"
);
return;
}
}
Expand Down

0 comments on commit 8d327bb

Please sign in to comment.