mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
classes: misc spell-casting fixes, support party spells
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
/* Make user and settings available for everyone through root scope.
|
||||
*/
|
||||
|
||||
habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$http', '$state', '$stateParams', 'Notification',
|
||||
function($scope, $rootScope, $location, User, $http, $state, $stateParams, Notification) {
|
||||
habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$http', '$state', '$stateParams', 'Notification', 'Groups',
|
||||
function($scope, $rootScope, $location, User, $http, $state, $stateParams, Notification, Groups) {
|
||||
$rootScope.modals = {};
|
||||
$rootScope.modals.achievements = {};
|
||||
$rootScope.User = User;
|
||||
@@ -150,12 +150,13 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
|
||||
$rootScope.applyingAction = true;
|
||||
$scope.spell = spell;
|
||||
if (spell.target == 'self') {
|
||||
debugger
|
||||
var tasks = User.user.habits.concat(User.user.dailys).concat(User.user.todos);
|
||||
User.user.tasks = _.object(_.pluck(tasks,'id'), tasks);
|
||||
$scope.castEnd(null, 'self');
|
||||
} else if (spell.target == 'party') {
|
||||
//TODO $scope.castEnd()
|
||||
var party = Groups.party();
|
||||
party = (_.isArray(party) ? party : []).concat(User.user);
|
||||
$scope.castEnd(party, 'party');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -517,12 +517,15 @@ api.cast = function(req, res) {
|
||||
Group.findOne({type: 'party', members: {'$in': [user._id]}}).populate('members').exec(cb);
|
||||
},
|
||||
function(group, cb) {
|
||||
if (!group) group = {members:[user]};
|
||||
spell.cast(user, group.members);
|
||||
var series = _.reduce(group.members, function(m,v){
|
||||
m.push(function(cb2){v.save(cb2);})
|
||||
return m;
|
||||
}, []);
|
||||
var series = _.transform(group.members, function(m,v,k){
|
||||
m[k] = function(cb2){v.save(cb2);}
|
||||
});
|
||||
async.series(series, cb);
|
||||
},
|
||||
function(whatever, cb){
|
||||
user.save(cb);
|
||||
}
|
||||
], done);
|
||||
break;
|
||||
|
||||
@@ -223,11 +223,11 @@ var UserSchema = new Schema({
|
||||
name: String,
|
||||
},
|
||||
stats: {
|
||||
hp: Number,
|
||||
mp: Number,
|
||||
exp: Number,
|
||||
gp: Number,
|
||||
lvl: Number,
|
||||
hp: {type: Number, 'default': 50},
|
||||
mp: {type: Number, 'default': 10},
|
||||
exp: {type: Number, 'default': 0},
|
||||
gp: {type: Number, 'default': 0},
|
||||
lvl: {type: Number, 'default': 1},
|
||||
|
||||
// Class System
|
||||
'class': {type: String, enum: ['warrior','rogue','wizard','rogue'], 'default': 'warrior'},
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
span(ng-show='user.history.exp')
|
||||
a(ng-click='toggleChart("exp")', tooltip='Progress')
|
||||
i.icon-signal
|
||||
.meter.mana(title='Mana', ng-if='user.stats.class')
|
||||
.meter.mana(title='Mana', ng-if='user.flags.classSelected')
|
||||
.bar(style='width: {{percent(user.stats.mp, user.stats.int+10)}}%;')
|
||||
span.meter-text
|
||||
i.icon-fire
|
||||
|
||||
Reference in New Issue
Block a user