mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
prevent skills/spells being cast on rewards and group plan tasks (#8995)
This commit is contained in:
@@ -5,6 +5,7 @@ div(v-if='user.stats.lvl > 10')
|
|||||||
.col-8.details
|
.col-8.details
|
||||||
p.title {{spell.text()}}
|
p.title {{spell.text()}}
|
||||||
p.notes {{ `Click on a ${spell.target} to cast!`}}
|
p.notes {{ `Click on a ${spell.target} to cast!`}}
|
||||||
|
// @TODO make that translatable
|
||||||
.col-4.mana
|
.col-4.mana
|
||||||
.img(:class='`shop_${spell.key} shop-sprite item-img`')
|
.img(:class='`shop_${spell.key} shop-sprite item-img`')
|
||||||
|
|
||||||
@@ -240,30 +241,31 @@ export default {
|
|||||||
this.spell = spell;
|
this.spell = spell;
|
||||||
|
|
||||||
if (spell.target === 'self') {
|
if (spell.target === 'self') {
|
||||||
this.castEnd(null, 'self');
|
this.castEnd(null, spell.target);
|
||||||
} else if (spell.target === 'party') {
|
} else if (spell.target === 'party') {
|
||||||
if (!this.user.party._id) {
|
if (!this.user.party._id) {
|
||||||
let party = [this.user];
|
let party = [this.user];
|
||||||
this.castEnd(party, 'party');
|
this.castEnd(party, spell.target);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let party = this.$store.state.party.members;
|
let party = this.$store.state.party.members;
|
||||||
party = isArray(party) ? party : [];
|
party = isArray(party) ? party : [];
|
||||||
party = party.concat(this.user);
|
party = party.concat(this.user);
|
||||||
this.castEnd(party, 'party');
|
this.castEnd(party, spell.target);
|
||||||
} else if (spell.target === 'tasks') {
|
} else if (spell.target === 'tasks') {
|
||||||
let userTasks = this.$store.state.tasks.data;
|
let userTasks = this.$store.state.tasks.data;
|
||||||
|
// exclude rewards
|
||||||
let tasks = userTasks.habits
|
let tasks = userTasks.habits
|
||||||
.concat(userTasks.dailys)
|
.concat(userTasks.dailys)
|
||||||
.concat(userTasks.rewards)
|
|
||||||
.concat(userTasks.todos);
|
.concat(userTasks.todos);
|
||||||
// exclude challenge tasks
|
// exclude challenge and group plan tasks
|
||||||
tasks = tasks.filter((task) => {
|
tasks = tasks.filter((task) => {
|
||||||
if (!task.challenge) return true;
|
if (task.challenge && task.challenge.id && !task.challenge.broken) return false;
|
||||||
return !task.challenge.id || task.challenge.broken;
|
if (task.group && task.group.id && !task.group.broken) return false;
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
this.castEnd(tasks, 'tasks');
|
this.castEnd(tasks, spell.target);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async castEnd (target, type) {
|
async castEnd (target, type) {
|
||||||
@@ -273,6 +275,7 @@ export default {
|
|||||||
if (!this.applyingAction) return 'No applying action';
|
if (!this.applyingAction) return 'No applying action';
|
||||||
|
|
||||||
if (this.spell.target !== type) return this.text(this.$t('invalidTarget'));
|
if (this.spell.target !== type) return this.text(this.$t('invalidTarget'));
|
||||||
|
if (target && target.type && target.type === 'reward') return this.text(this.$t('invalidTarget'));
|
||||||
if (target && target.challenge && target.challenge.id) return this.text(this.$t('invalidTarget'));
|
if (target && target.challenge && target.challenge.id) return this.text(this.$t('invalidTarget'));
|
||||||
if (target && target.group && target.group.id) return this.text(this.$t('invalidTarget'));
|
if (target && target.group && target.group.id) return this.text(this.$t('invalidTarget'));
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,7 @@
|
|||||||
"sureReset": "Are you sure? This will reset your character's class and allocated points (you'll get them all back to re-allocate), and costs 3 gems.",
|
"sureReset": "Are you sure? This will reset your character's class and allocated points (you'll get them all back to re-allocate), and costs 3 gems.",
|
||||||
"purchaseFor": "Purchase for <%= cost %> Gems?",
|
"purchaseFor": "Purchase for <%= cost %> Gems?",
|
||||||
"notEnoughMana": "Not enough mana.",
|
"notEnoughMana": "Not enough mana.",
|
||||||
"invalidTarget": "Invalid target",
|
"invalidTarget": "You can't cast a skill on that.",
|
||||||
"youCast": "You cast <%= spell %>.",
|
"youCast": "You cast <%= spell %>.",
|
||||||
"youCastTarget": "You cast <%= spell %> on <%= target %>.",
|
"youCastTarget": "You cast <%= spell %> on <%= target %>.",
|
||||||
"youCastParty": "You cast <%= spell %> for the party.",
|
"youCastParty": "You cast <%= spell %> for the party.",
|
||||||
|
|||||||
Reference in New Issue
Block a user