mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
Split out spells into separate modules
This commit is contained in:
70
common/script/src/content/spells/healer.js
Normal file
70
common/script/src/content/spells/healer.js
Normal file
@@ -0,0 +1,70 @@
|
||||
import t from '../helpers/translator';
|
||||
import {diminishingReturns, calculateBonus, setSpellDefaults} from './spell-helper';
|
||||
import {each} from 'lodash';
|
||||
|
||||
let heal = {
|
||||
mana: 15,
|
||||
lvl: 11,
|
||||
target: 'self',
|
||||
cast: (user, target) => {
|
||||
user.stats.hp += (user._statsComputed.con + user._statsComputed.int + 5) * .075;
|
||||
if (user.stats.hp > 50) {
|
||||
return user.stats.hp = 50;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let brightness = {
|
||||
mana: 15,
|
||||
lvl: 12,
|
||||
target: 'self',
|
||||
cast: (user, target) => {
|
||||
return each(user.tasks, (target) => {
|
||||
if (target.type === 'reward') {
|
||||
return;
|
||||
}
|
||||
return target.value += 4 * (user._statsComputed.int / (user._statsComputed.int + 40));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
let protectAura = {
|
||||
mana: 30,
|
||||
lvl: 13,
|
||||
target: 'party',
|
||||
cast: (user, target) => {
|
||||
return each(target, (member) => {
|
||||
var base, bonus;
|
||||
bonus = user._statsComputed.con - user.stats.buffs.con;
|
||||
if ((base = member.stats.buffs).con == null) {
|
||||
base.con = 0;
|
||||
}
|
||||
return member.stats.buffs.con += Math.ceil(diminishingReturns(bonus, 200, 200));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
let healAll = {
|
||||
mana: 25,
|
||||
lvl: 14,
|
||||
target: 'party',
|
||||
cast: (user, target) => {
|
||||
return each(target, (member) => {
|
||||
member.stats.hp += (user._statsComputed.con + user._statsComputed.int + 5) * .04;
|
||||
if (member.stats.hp > 50) {
|
||||
return member.stats.hp = 50;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
let healer = {
|
||||
heal: heal,
|
||||
brightness: brightness,
|
||||
protectAura: protectAura,
|
||||
healAll: healAll,
|
||||
};
|
||||
|
||||
setSpellDefaults('healer', healer);
|
||||
|
||||
export default healer;
|
||||
Reference in New Issue
Block a user