@@ -1,7 +1,7 @@ | |||||
define([ | define([ | ||||
], function( | ], function( | ||||
) { | ) { | ||||
return { | return { | ||||
type: 'follower', | type: 'follower', | ||||
@@ -9,6 +9,7 @@ define([ | |||||
master: null, | master: null, | ||||
lifetime: -1, | lifetime: -1, | ||||
maxDistance: 10, | |||||
fGetHighest: { | fGetHighest: { | ||||
inCombat: null, | inCombat: null, | ||||
@@ -16,8 +17,6 @@ define([ | |||||
}, | }, | ||||
bindEvents: function() { | bindEvents: function() { | ||||
this.lifetime = 100; | |||||
this.fGetHighest.inCombat = this.master.aggro.getHighest.bind(this.master.aggro); | this.fGetHighest.inCombat = this.master.aggro.getHighest.bind(this.master.aggro); | ||||
this.fGetHighest.outOfCombat = this.returnNoAggro.bind(this); | this.fGetHighest.outOfCombat = this.returnNoAggro.bind(this); | ||||
}, | }, | ||||
@@ -49,10 +48,12 @@ define([ | |||||
}, | }, | ||||
update: function() { | update: function() { | ||||
this.lifetime--; | |||||
if (this.lifetime <= 0) { | |||||
this.despawn(); | |||||
return; | |||||
if (this.lifetime > 0) { | |||||
this.lifetime--; | |||||
if (this.lifetime <= 0) { | |||||
this.despawn(); | |||||
return; | |||||
} | |||||
} | } | ||||
var obj = this.obj; | var obj = this.obj; | ||||
@@ -63,9 +64,11 @@ define([ | |||||
return; | return; | ||||
} | } | ||||
var maxDistance = this.maxDistance; | |||||
var doMove = ( | var doMove = ( | ||||
(Math.abs(obj.x - master.x) >= 10) || | |||||
(Math.abs(obj.y - master.y) >= 10) | |||||
(Math.abs(obj.x - master.x) >= maxDistance) || | |||||
(Math.abs(obj.y - master.y) >= maxDistance) | |||||
); | ); | ||||
if (doMove) { | if (doMove) { | ||||
@@ -71,7 +71,9 @@ define([ | |||||
sheetName: 'mobs', | sheetName: 'mobs', | ||||
name: 'Squiggle', | name: 'Squiggle', | ||||
properties: { | properties: { | ||||
cpnFollower: {} | |||||
cpnFollower: { | |||||
lifetime: 100 | |||||
} | |||||
}, | }, | ||||
extraProperties: { | extraProperties: { | ||||
follower: { | follower: { | ||||
@@ -25,6 +25,7 @@ define([ | |||||
beforeGetResourceList: function(list) { | beforeGetResourceList: function(list) { | ||||
list.push(`${this.folderName}/images/inGameSprite.png`); | list.push(`${this.folderName}/images/inGameSprite.png`); | ||||
list.push(`${this.folderName}/images/abilityIcons.png`); | list.push(`${this.folderName}/images/abilityIcons.png`); | ||||
list.push(`${this.folderName}/images/mobs.png`); | |||||
}, | }, | ||||
beforeGetClasses: function(classes) { | beforeGetClasses: function(classes) { | ||||
@@ -72,39 +73,40 @@ define([ | |||||
spells['harvest life'] = { | spells['harvest life'] = { | ||||
statType: ['str', 'int'], | statType: ['str', 'int'], | ||||
statMult: 0.1, | statMult: 0.1, | ||||
element: 'arcane', | |||||
element: 'physical', | |||||
auto: true, | auto: true, | ||||
cdMax: 7, | cdMax: 7, | ||||
manaCost: 0, | manaCost: 0, | ||||
range: 9, | range: 9, | ||||
random: { | random: { | ||||
damage: [2, 4] | |||||
damage: [2, 4], | |||||
healPercent: [10, 20] | |||||
} | } | ||||
}; | }; | ||||
spells['summon skeleton'] = { | spells['summon skeleton'] = { | ||||
statType: ['str', 'int'], | statType: ['str', 'int'], | ||||
statMult: 0.1, | statMult: 0.1, | ||||
element: 'arcane', | |||||
auto: true, | |||||
element: 'physical', | |||||
cdMax: 7, | cdMax: 7, | ||||
manaCost: 0, | manaCost: 0, | ||||
range: 9, | range: 9, | ||||
random: { | random: { | ||||
damage: [2, 4] | |||||
damage: [2, 4], | |||||
life: [100, 200] | |||||
} | } | ||||
}; | }; | ||||
spells['blood barrier'] = { | spells['blood barrier'] = { | ||||
statType: ['str', 'int'], | statType: ['str', 'int'], | ||||
statMult: 0.1, | statMult: 0.1, | ||||
element: 'arcane', | |||||
auto: true, | |||||
element: 'physical', | |||||
cdMax: 7, | cdMax: 7, | ||||
manaCost: 0, | manaCost: 0, | ||||
range: 9, | range: 9, | ||||
random: { | random: { | ||||
damage: [2, 4] | |||||
damage: [2, 4], | |||||
shieldPercentage: [50, 150] | |||||
} | } | ||||
}; | }; | ||||
}, | }, | ||||
@@ -147,7 +149,7 @@ define([ | |||||
spells.push({ | spells.push({ | ||||
name: 'Summon Skeleton', | name: 'Summon Skeleton', | ||||
description: 'Absorbs the life-force of your enemies.', | |||||
description: 'Summons a skeletal warrior to assist you in combat.', | |||||
type: 'summonSkeleton', | type: 'summonSkeleton', | ||||
icon: [1, 0], | icon: [1, 0], | ||||
spritesheet: `${this.folderName}/images/abilityIcons.png`, | spritesheet: `${this.folderName}/images/abilityIcons.png`, | ||||
@@ -182,7 +184,7 @@ define([ | |||||
spells.push({ | spells.push({ | ||||
name: 'Blood Barrier', | name: 'Blood Barrier', | ||||
description: 'Absorbs the life-force of your enemies.', | |||||
description: 'Sacrifice some life force to grant a protective barrier around an ally.', | |||||
type: 'bloodBarrier', | type: 'bloodBarrier', | ||||
icon: [2, 0], | icon: [2, 0], | ||||
spritesheet: `${this.folderName}/images/abilityIcons.png`, | spritesheet: `${this.folderName}/images/abilityIcons.png`, | ||||
@@ -12,6 +12,7 @@ define([ | |||||
range: 1, | range: 1, | ||||
damage: 1, | damage: 1, | ||||
healMultiplier: 0.1, | |||||
col: 4, | col: 4, | ||||
row: 1, | row: 1, | ||||
@@ -44,11 +45,18 @@ define([ | |||||
return true; | return true; | ||||
}, | }, | ||||
explode: function(target) { | explode: function(target) { | ||||
if ((this.obj.destroyed) || (target.destroyed)) | |||||
var obj = this.obj; | |||||
if ((obj.destroyed) || (target.destroyed)) | |||||
return; | return; | ||||
var damage = this.getDamage(target); | var damage = this.getDamage(target); | ||||
target.stats.takeDamage(damage, this.threatMult, this.obj); | |||||
target.stats.takeDamage(damage, this.threatMult, obj); | |||||
var healAmount = damage.amount * this.healMultiplier; | |||||
obj.stats.getHp({ | |||||
amount: healAmount | |||||
}, obj); | |||||
} | } | ||||
}; | }; | ||||
}); | }); |
@@ -15,7 +15,25 @@ define([ | |||||
needLos: true, | needLos: true, | ||||
minions: [], | |||||
cast: function(action) { | cast: function(action) { | ||||
var currentMinion = this.minions[0]; | |||||
if (currentMinion) { | |||||
currentMinion.destroyed = true; | |||||
this.minions = []; | |||||
this.obj.syncer.queue('onGetObject', { | |||||
x: currentMinion.x, | |||||
y: currentMinion.y, | |||||
components: [{ | |||||
type: 'attackAnimation', | |||||
row: 0, | |||||
col: 4 | |||||
}] | |||||
}); | |||||
} | |||||
var obj = this.obj; | var obj = this.obj; | ||||
var target = action.target; | var target = action.target; | ||||
@@ -26,10 +44,12 @@ define([ | |||||
x: target.x, | x: target.x, | ||||
y: target.y, | y: target.y, | ||||
cell: 0, | cell: 0, | ||||
spriteSheet: `${this.folderName}/images/mobs.png`, | |||||
sheetName: `${this.folderName}/images/mobs.png`, | |||||
name: 'Skeletal Minion', | name: 'Skeletal Minion', | ||||
properties: { | properties: { | ||||
cpnFollower: {} | |||||
cpnFollower: { | |||||
maxDistance: 3 | |||||
} | |||||
}, | }, | ||||
extraProperties: { | extraProperties: { | ||||
follower: { | follower: { | ||||
@@ -57,7 +77,22 @@ define([ | |||||
mob.follower.bindEvents(); | mob.follower.bindEvents(); | ||||
this.minions.push(mob); | |||||
return true; | return true; | ||||
}, | |||||
update: function() { | |||||
var minions = this.minions; | |||||
var mLen = minions.length; | |||||
for (var i = 0; i < mLen; i++) { | |||||
var m = minions[i]; | |||||
if (m.destroyed) { | |||||
minions.splice(i, 1); | |||||
i--; | |||||
mLen--; | |||||
} | |||||
} | |||||
} | } | ||||
}; | }; | ||||
}); | }); |