Skip to content

Commit

Permalink
Merge branch 'devnet' of github.com:DecentralCardGame/frontend into d…
Browse files Browse the repository at this point in the history
…evnet
  • Loading branch information
lxgr-linux committed Dec 16, 2023
2 parents daafd05 + 8d327bb commit 6446024
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 6446024

Please sign in to comment.