mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-01 03:30:25 +00:00
classes: fixes & balancing of spells
This commit is contained in:
parent
64db3041da
commit
ce04027802
4 changed files with 88 additions and 46 deletions
78
dist/habitrpg-shared.js
vendored
78
dist/habitrpg-shared.js
vendored
|
|
@ -9999,6 +9999,20 @@ var global=self;/**
|
|||
*/
|
||||
|
||||
|
||||
crit = function(user, stat, chance) {
|
||||
if (stat == null) {
|
||||
stat = 'per';
|
||||
}
|
||||
if (chance == null) {
|
||||
chance = .03;
|
||||
}
|
||||
if (user.fns.predictableRandom() <= chance) {
|
||||
return 1.5 + (.05 * user._statsComputed[stat]);
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
api.spells = {
|
||||
wizard: {
|
||||
fireball: {
|
||||
|
|
@ -10008,7 +10022,8 @@ var global=self;/**
|
|||
target: 'task',
|
||||
notes: 'With a crack, flames burst from your staff, scorching a task. You deal much higher damage to the task and gain additional xp.',
|
||||
cast: function(user, target) {
|
||||
return target.value += user.stats.int + crit(user);
|
||||
target.value += user._statsComputed.int * .2;
|
||||
return user.stats.exp += Math.abs(target.value);
|
||||
}
|
||||
},
|
||||
lightning: {
|
||||
|
|
@ -10018,7 +10033,7 @@ var global=self;/**
|
|||
target: 'task',
|
||||
notes: 'A bolt a lightning pierces through a task. There is a high chance of a critical hit.',
|
||||
cast: function(user, target) {
|
||||
return target.value += user.stats.per * 2 + crit(user);
|
||||
return target.value += user._statsComputed.int * .3 * crit(user, 'per');
|
||||
}
|
||||
},
|
||||
frost: {
|
||||
|
|
@ -10029,7 +10044,7 @@ var global=self;/**
|
|||
notes: "Ice forms of the party's tasks, slowing them down and opening them up to more attacks. Your party gains a buff to xp.",
|
||||
cast: function(user, target) {
|
||||
return _.each(target, function(member) {
|
||||
return member.stats.buffs.int = user.stats.int;
|
||||
return member.stats.buffs.int = user._statsComputed.int / 2;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
@ -10041,7 +10056,7 @@ var global=self;/**
|
|||
notes: "Unearthly shadows form and wisp around your party, concealing their presence. Under the shroud, your party can sneak up on tasks, dealing more critical hits.",
|
||||
cast: function(user, target) {
|
||||
return _.each(target, function(member) {
|
||||
return member.stats.buffs.per = user.stats.per;
|
||||
return member.stats.buffs.str = user._statsComputed.str / 2;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -10054,7 +10069,7 @@ var global=self;/**
|
|||
target: 'task',
|
||||
notes: "You savagely hit a single task with all of your might, beating it into submission. The task's redness decreases.",
|
||||
cast: function(user, target) {
|
||||
return target.value -= user.stat.str;
|
||||
return target.value += user._statsComputed.str * .3;
|
||||
}
|
||||
},
|
||||
defensiveStance: {
|
||||
|
|
@ -10064,7 +10079,7 @@ var global=self;/**
|
|||
target: 'self',
|
||||
notes: "You take a moment to relax your body and enter a defensive stance to ready yourself for the tasks' next onslaught. Reduced damage from dailies at the end of the day.",
|
||||
cast: function(user, target) {
|
||||
return user.stats.buffs.con = user.stats.con / 2;
|
||||
return user.stats.buffs.con = user._statsComputed.con / 2;
|
||||
}
|
||||
},
|
||||
valorousPresence: {
|
||||
|
|
@ -10075,7 +10090,7 @@ var global=self;/**
|
|||
notes: "Your presence emboldens the party. Their newfound courage gives them a boost of strength. Party members gain a buff to their STR.",
|
||||
cast: function(user, target) {
|
||||
return _.each(target, function(member) {
|
||||
return member.stats.buffs.str = user.stats.str / 2;
|
||||
return member.stats.buffs.str = user._statsComputed.str / 2;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
@ -10087,7 +10102,7 @@ var global=self;/**
|
|||
notes: "Your gaze strikes fear into the hearts of your party's enemies. The party gains a moderate boost to defense.",
|
||||
cast: function(user, target) {
|
||||
return _.each(target, function(member) {
|
||||
return member.stats.buffs.con = user.stats.con / 2;
|
||||
return member.stats.buffs.con = user._statsComputed.con / 2;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -10100,7 +10115,7 @@ var global=self;/**
|
|||
target: 'task',
|
||||
notes: "Your nimble fingers run through the task's pockets and 'find' some treasures for yourself. You gain an increased gold bonus on the task and a higher chance of an item drop.",
|
||||
cast: function(user, target) {
|
||||
return user.stats.gp += user.stats.per * target.value;
|
||||
return user.stats.gp += (user._statsComputed.per / 2) * Math.abs(target.value);
|
||||
}
|
||||
},
|
||||
backStab: {
|
||||
|
|
@ -10108,11 +10123,11 @@ var global=self;/**
|
|||
mana: 15,
|
||||
lvl: 7,
|
||||
target: 'task',
|
||||
notes: "Without a sound, you sweep behind a task and stab it in the back. You deal higher damage to the stat, with a higher chance of a critical hit.",
|
||||
notes: "Without a sound, you sweep behind a task and stab it in the back. You deal higher damage to the task, with a higher chance of a critical hit.",
|
||||
cast: function(user, target) {
|
||||
var _crit;
|
||||
_crit = crit(user);
|
||||
target.value -= user.stats.str;
|
||||
_crit = crit(user, 'per', .5);
|
||||
target.value += _crit / 2;
|
||||
user.stats.exp += _crit;
|
||||
return user.stats.gp += _crit;
|
||||
}
|
||||
|
|
@ -10125,7 +10140,7 @@ var global=self;/**
|
|||
notes: "You share your thievery tools with the party to aid them in 'acquiring' more gold. The party's gold bonus for tasks is buffed for a day.",
|
||||
cast: function(user, target) {
|
||||
return _.each(target, function(member) {
|
||||
return member.stats.buffs.per = user.stats.per / 2;
|
||||
return member.stats.buffs.per = user._statsComputed.per / 2;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
@ -10137,7 +10152,7 @@ var global=self;/**
|
|||
notes: "You hurry your step and dance circles around your party's enemies. You assist your party, helping them do extra damage to a number of tasks equal to half your strength.",
|
||||
cast: function(user, target) {
|
||||
return _.each(target, function(member) {
|
||||
return member.stats.buffs.str = user.stats.str / 2;
|
||||
return member.stats.buffs.str = user._statsComputed.str / 2;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -10150,7 +10165,10 @@ var global=self;/**
|
|||
target: 'self',
|
||||
notes: 'Light covers your body, healing your wounds. You gain a boost to your health.',
|
||||
cast: function(user, target) {
|
||||
return user.stats.hp += user.stats.con + user.stats.int;
|
||||
user.stats.hp += user._statsComputed.con + user._statsComputed.int;
|
||||
if (user.stats.hp > 50) {
|
||||
return user.stats.hp = 50;
|
||||
}
|
||||
}
|
||||
},
|
||||
brightness: {
|
||||
|
|
@ -10161,7 +10179,10 @@ var global=self;/**
|
|||
notes: "You cast a burst of light that blinds all of your tasks. The redness of your tasks is reduced",
|
||||
cast: function(user, target) {
|
||||
return _.each(user.tasks, function(target) {
|
||||
return target.value -= user.stats.int;
|
||||
if (target.type === 'reward') {
|
||||
return;
|
||||
}
|
||||
return target.value += user._statsComputed.int * .1;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
@ -10173,7 +10194,7 @@ var global=self;/**
|
|||
notes: "A magical aura surrounds your party members, protecting them from damage. Your party members gain a buff to their defense.",
|
||||
cast: function(user, target) {
|
||||
return _.each(target, function(member) {
|
||||
return member.stats.buffs.con = user.stats.con / 2;
|
||||
return member.stats.buffs.con = user._statsComputed.con / 2;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
@ -10185,17 +10206,16 @@ var global=self;/**
|
|||
notes: "Soothing light envelops your party and heals them of their injuries. Your party members gain a boost to their health.",
|
||||
cast: function(user, target) {
|
||||
return _.each(target, function(member) {
|
||||
return member.stats.hp += user.con / 2;
|
||||
member.stats.hp += user._statsComputed.con / 2 + user._statsComputed.int / 2;
|
||||
if (member.stats.hp > 50) {
|
||||
return member.stats.hp = 50;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
crit = function(user) {
|
||||
return Math.random() * user.stats.per + 1;
|
||||
};
|
||||
|
||||
_.each(api.spells, function(spellClass) {
|
||||
return _.each(spellClass, function(spell, k) {
|
||||
var _cast;
|
||||
|
|
@ -11852,6 +11872,13 @@ var process=require("__browserify_process");(function() {
|
|||
user.stats.mp = user._statsComputed.maxMP;
|
||||
}
|
||||
if (user.preferences.sleep === true) {
|
||||
user.stats.buffs = {
|
||||
str: 0,
|
||||
int: 0,
|
||||
per: 0,
|
||||
con: 0,
|
||||
stealth: 0
|
||||
};
|
||||
return;
|
||||
}
|
||||
todoTally = 0;
|
||||
|
|
@ -11931,6 +11958,13 @@ var process=require("__browserify_process");(function() {
|
|||
if (typeof user.markModified === "function") {
|
||||
user.markModified('dailys');
|
||||
}
|
||||
user.stats.buffs = {
|
||||
str: 0,
|
||||
int: 0,
|
||||
per: 0,
|
||||
con: 0,
|
||||
stealth: 0
|
||||
};
|
||||
return user;
|
||||
},
|
||||
preenUserHistory: function(minHistLen) {
|
||||
|
|
|
|||
|
|
@ -207,6 +207,10 @@ api.potion = type: 'potion', text: "Health Potion", notes: "Recover 15 Health (I
|
|||
Note, user.stats.mp is docked after automatically (it's appended to functions automatically down below in an _.each)
|
||||
###
|
||||
|
||||
crit = (user, stat='per', chance=.03) ->
|
||||
if user.fns.predictableRandom() <= chance then 1.5 + (.05*user._statsComputed[stat])
|
||||
else 1
|
||||
|
||||
api.spells =
|
||||
wizard:
|
||||
fireball:
|
||||
|
|
@ -216,7 +220,8 @@ api.spells =
|
|||
target: 'task'
|
||||
notes: 'With a crack, flames burst from your staff, scorching a task. You deal much higher damage to the task and gain additional xp.'
|
||||
cast: (user, target) ->
|
||||
target.value += user.stats.int + crit(user)
|
||||
target.value += user._statsComputed.int*.2
|
||||
user.stats.exp += Math.abs(target.value)
|
||||
lightning:
|
||||
text: 'Lightning Strike'
|
||||
mana: 15
|
||||
|
|
@ -224,7 +229,7 @@ api.spells =
|
|||
target: 'task'
|
||||
notes: 'A bolt a lightning pierces through a task. There is a high chance of a critical hit.'
|
||||
cast: (user, target) ->
|
||||
target.value += user.stats.per*2 + crit(user)
|
||||
target.value += user._statsComputed.int*.3 * crit(user, 'per')
|
||||
frost:
|
||||
text: 'Chilling Frost'
|
||||
mana: 35
|
||||
|
|
@ -234,7 +239,7 @@ api.spells =
|
|||
cast: (user, target) ->
|
||||
## lasts for 24 hours ##
|
||||
_.each target, (member) ->
|
||||
member.stats.buffs.int = user.stats.int
|
||||
member.stats.buffs.int = user._statsComputed.int/2
|
||||
darkness:
|
||||
text: 'Shroud of Darkness'
|
||||
mana: 30
|
||||
|
|
@ -244,7 +249,7 @@ api.spells =
|
|||
cast: (user, target) ->
|
||||
## lasts for 24 hours ##
|
||||
_.each target, (member) ->
|
||||
member.stats.buffs.per = user.stats.per
|
||||
member.stats.buffs.str = user._statsComputed.str/2
|
||||
|
||||
warrior:
|
||||
smash:
|
||||
|
|
@ -254,7 +259,7 @@ api.spells =
|
|||
target: 'task'
|
||||
notes: "You savagely hit a single task with all of your might, beating it into submission. The task's redness decreases."
|
||||
cast: (user, target) ->
|
||||
target.value -= user.stat.str
|
||||
target.value += user._statsComputed.str*.3
|
||||
defensiveStance:
|
||||
text: 'Defensive Stance'
|
||||
mana: 25
|
||||
|
|
@ -263,7 +268,7 @@ api.spells =
|
|||
notes: "You take a moment to relax your body and enter a defensive stance to ready yourself for the tasks' next onslaught. Reduced damage from dailies at the end of the day."
|
||||
cast: (user, target) ->
|
||||
## Only affects health loss at cron from dailies ##
|
||||
user.stats.buffs.con = user.stats.con/2
|
||||
user.stats.buffs.con = user._statsComputed.con/2
|
||||
valorousPresence:
|
||||
text: 'Valorous Presence'
|
||||
mana: 20
|
||||
|
|
@ -273,7 +278,7 @@ api.spells =
|
|||
cast: (user, target) ->
|
||||
## lasts 24 hours ##
|
||||
_.each target, (member) ->
|
||||
member.stats.buffs.str = user.stats.str/2
|
||||
member.stats.buffs.str = user._statsComputed.str/2
|
||||
intimidate:
|
||||
text: 'Intimidating Gaze'
|
||||
mana: 15
|
||||
|
|
@ -283,7 +288,7 @@ api.spells =
|
|||
cast: (user, target) ->
|
||||
## lasts 24 hours ##
|
||||
_.each target, (member) ->
|
||||
member.stats.buffs.con = user.stats.con/2
|
||||
member.stats.buffs.con = user._statsComputed.con/2
|
||||
|
||||
rogue:
|
||||
pickPocket:
|
||||
|
|
@ -293,16 +298,16 @@ api.spells =
|
|||
target: 'task'
|
||||
notes: "Your nimble fingers run through the task's pockets and 'find' some treasures for yourself. You gain an increased gold bonus on the task and a higher chance of an item drop."
|
||||
cast: (user, target) ->
|
||||
user.stats.gp += user.stats.per * target.value
|
||||
user.stats.gp += (user._statsComputed.per/2) * Math.abs(target.value)
|
||||
backStab:
|
||||
text: 'Backstab'
|
||||
mana: 15
|
||||
lvl: 7
|
||||
target: 'task'
|
||||
notes: "Without a sound, you sweep behind a task and stab it in the back. You deal higher damage to the stat, with a higher chance of a critical hit."
|
||||
notes: "Without a sound, you sweep behind a task and stab it in the back. You deal higher damage to the task, with a higher chance of a critical hit."
|
||||
cast: (user, target) ->
|
||||
_crit = crit(user)
|
||||
target.value -= user.stats.str
|
||||
_crit = crit(user, 'per', .5)
|
||||
target.value += _crit/2
|
||||
user.stats.exp += _crit
|
||||
user.stats.gp += _crit
|
||||
stealth:
|
||||
|
|
@ -314,7 +319,7 @@ api.spells =
|
|||
cast: (user, target) ->
|
||||
## lasts 24 hours ##
|
||||
_.each target, (member) ->
|
||||
member.stats.buffs.per = user.stats.per/2
|
||||
member.stats.buffs.per = user._statsComputed.per/2
|
||||
speedburst:
|
||||
text: 'Burst of Speed'
|
||||
mana: 25
|
||||
|
|
@ -326,7 +331,7 @@ api.spells =
|
|||
# the effect lasts 24 hours, or when until the party member has used the effected number of tasks. whichever occurs sooner.
|
||||
# the 24 hour limit is to help prevent it stacking on a player who has been absent for a long time.
|
||||
_.each target, (member) ->
|
||||
member.stats.buffs.str = user.stats.str/2
|
||||
member.stats.buffs.str = user._statsComputed.str/2
|
||||
|
||||
healer:
|
||||
heal:
|
||||
|
|
@ -336,7 +341,8 @@ api.spells =
|
|||
target: 'self'
|
||||
notes: 'Light covers your body, healing your wounds. You gain a boost to your health.'
|
||||
cast: (user, target) ->
|
||||
user.stats.hp += user.stats.con + user.stats.int
|
||||
user.stats.hp += user._statsComputed.con + user._statsComputed.int
|
||||
user.stats.hp = 50 if user.stats.hp > 50
|
||||
brightness:
|
||||
text: 'Searing Brightness'
|
||||
mana: 15
|
||||
|
|
@ -345,7 +351,8 @@ api.spells =
|
|||
notes: "You cast a burst of light that blinds all of your tasks. The redness of your tasks is reduced"
|
||||
cast: (user, target) ->
|
||||
_.each user.tasks, (target) ->
|
||||
target.value -= user.stats.int
|
||||
return if target.type is 'reward'
|
||||
target.value += user._statsComputed.int*.1
|
||||
protectAura:
|
||||
text: 'Protective Aura'
|
||||
mana: 30
|
||||
|
|
@ -355,7 +362,7 @@ api.spells =
|
|||
cast: (user, target) ->
|
||||
## lasts 24 hours ##
|
||||
_.each target, (member) ->
|
||||
member.stats.buffs.con = user.stats.con/2
|
||||
member.stats.buffs.con = user._statsComputed.con/2
|
||||
heallAll:
|
||||
text: 'Blessing'
|
||||
mana: 25
|
||||
|
|
@ -364,9 +371,8 @@ api.spells =
|
|||
notes: "Soothing light envelops your party and heals them of their injuries. Your party members gain a boost to their health."
|
||||
cast: (user, target) ->
|
||||
_.each target, (member) ->
|
||||
member.stats.hp += user.con/2
|
||||
|
||||
crit = (user) -> (Math.random() * user.stats.per + 1)
|
||||
member.stats.hp += (user._statsComputed.con/2 + user._statsComputed.int/2)
|
||||
member.stats.hp = 50 if member.stats.hp > 50
|
||||
|
||||
# Intercept all spells to reduce user.stats.mp after casting the spell
|
||||
_.each api.spells, (spellClass) ->
|
||||
|
|
|
|||
|
|
@ -994,9 +994,11 @@ api.wrap = (user) ->
|
|||
|
||||
# User is resting at the inn. Used to be we un-checked each daily without performing calculation (see commits before fb29e35)
|
||||
# but to prevent abusing the inn (http://goo.gl/GDb9x) we now do *not* calculate dailies, and simply set lastCron to today
|
||||
return if user.preferences.sleep is true
|
||||
if user.preferences.sleep is true
|
||||
user.stats.buffs = {str:0,int:0,per:0,con:0,stealth:0}
|
||||
return
|
||||
|
||||
# Tally each task
|
||||
# Tally each task
|
||||
todoTally = 0
|
||||
user.todos.concat(user.dailys).forEach (task) ->
|
||||
return unless task
|
||||
|
|
@ -1045,6 +1047,7 @@ api.wrap = (user) ->
|
|||
user.fns.preenUserHistory()
|
||||
user.markModified? 'history'
|
||||
user.markModified? 'dailys' # covers dailys.*.history
|
||||
user.stats.buffs = {str:0,int:0,per:0,con:0,stealth:0}
|
||||
user
|
||||
|
||||
# Registered users with some history
|
||||
|
|
|
|||
|
|
@ -105,8 +105,7 @@ angular.module('userServices', []).
|
|||
if (status >= 400) {
|
||||
data =
|
||||
data.needRefresh ? "The site has been updated and the page needs to refresh. The last action has not been recorded, please refresh and try again." :
|
||||
data ? data :
|
||||
'Something went wrong, please refresh your browser or upgrade the mobile app';
|
||||
data ? (data.err ? data.err : data) : 'Something went wrong, please refresh your browser or upgrade the mobile app';
|
||||
alert(data);
|
||||
// Clear the queue. Better if we can hunt down the problem op, but this is the easiest solution
|
||||
settings.sync.queue = settings.sync.sent = [];
|
||||
|
|
|
|||
Loading…
Reference in a new issue