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.
|
/* Make user and settings available for everyone through root scope.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
habitrpg.controller("RootCtrl", ['$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) {
|
function($scope, $rootScope, $location, User, $http, $state, $stateParams, Notification, Groups) {
|
||||||
$rootScope.modals = {};
|
$rootScope.modals = {};
|
||||||
$rootScope.modals.achievements = {};
|
$rootScope.modals.achievements = {};
|
||||||
$rootScope.User = User;
|
$rootScope.User = User;
|
||||||
@@ -150,12 +150,13 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
|
|||||||
$rootScope.applyingAction = true;
|
$rootScope.applyingAction = true;
|
||||||
$scope.spell = spell;
|
$scope.spell = spell;
|
||||||
if (spell.target == 'self') {
|
if (spell.target == 'self') {
|
||||||
debugger
|
|
||||||
var tasks = User.user.habits.concat(User.user.dailys).concat(User.user.todos);
|
var tasks = User.user.habits.concat(User.user.dailys).concat(User.user.todos);
|
||||||
User.user.tasks = _.object(_.pluck(tasks,'id'), tasks);
|
User.user.tasks = _.object(_.pluck(tasks,'id'), tasks);
|
||||||
$scope.castEnd(null, 'self');
|
$scope.castEnd(null, 'self');
|
||||||
} else if (spell.target == 'party') {
|
} 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);
|
Group.findOne({type: 'party', members: {'$in': [user._id]}}).populate('members').exec(cb);
|
||||||
},
|
},
|
||||||
function(group, cb) {
|
function(group, cb) {
|
||||||
|
if (!group) group = {members:[user]};
|
||||||
spell.cast(user, group.members);
|
spell.cast(user, group.members);
|
||||||
var series = _.reduce(group.members, function(m,v){
|
var series = _.transform(group.members, function(m,v,k){
|
||||||
m.push(function(cb2){v.save(cb2);})
|
m[k] = function(cb2){v.save(cb2);}
|
||||||
return m;
|
});
|
||||||
}, []);
|
|
||||||
async.series(series, cb);
|
async.series(series, cb);
|
||||||
|
},
|
||||||
|
function(whatever, cb){
|
||||||
|
user.save(cb);
|
||||||
}
|
}
|
||||||
], done);
|
], done);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -223,11 +223,11 @@ var UserSchema = new Schema({
|
|||||||
name: String,
|
name: String,
|
||||||
},
|
},
|
||||||
stats: {
|
stats: {
|
||||||
hp: Number,
|
hp: {type: Number, 'default': 50},
|
||||||
mp: Number,
|
mp: {type: Number, 'default': 10},
|
||||||
exp: Number,
|
exp: {type: Number, 'default': 0},
|
||||||
gp: Number,
|
gp: {type: Number, 'default': 0},
|
||||||
lvl: Number,
|
lvl: {type: Number, 'default': 1},
|
||||||
|
|
||||||
// Class System
|
// Class System
|
||||||
'class': {type: String, enum: ['warrior','rogue','wizard','rogue'], 'default': 'warrior'},
|
'class': {type: String, enum: ['warrior','rogue','wizard','rogue'], 'default': 'warrior'},
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
span(ng-show='user.history.exp')
|
span(ng-show='user.history.exp')
|
||||||
a(ng-click='toggleChart("exp")', tooltip='Progress')
|
a(ng-click='toggleChart("exp")', tooltip='Progress')
|
||||||
i.icon-signal
|
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)}}%;')
|
.bar(style='width: {{percent(user.stats.mp, user.stats.int+10)}}%;')
|
||||||
span.meter-text
|
span.meter-text
|
||||||
i.icon-fire
|
i.icon-fire
|
||||||
|
|||||||
Reference in New Issue
Block a user