Browse Source

started work on pumpkn ability

tags/v0.1.7^2
Big Bad Waffle 6 years ago
parent
commit
4cd35d0924
12 changed files with 114 additions and 72 deletions
  1. +3
    -4
      src/client/js/rendering/renderer.js
  2. +5
    -5
      src/server/components/mob.js
  3. +6
    -7
      src/server/config/eventPhases/phaseSpawnMob.js
  4. BIN
     
  5. BIN
     
  6. BIN
     
  7. BIN
     
  8. +2
    -3
      src/server/mods/event-halloween/index.js
  9. +7
    -4
      src/server/mods/event-halloween/maps/tutorial/events/halloweenBoss.js
  10. +0
    -12
      src/server/mods/event-halloween/maps/tutorial/map.json
  11. +0
    -37
      src/server/mods/event-halloween/spells/scatterPumpkinPieces.js
  12. +91
    -0
      src/server/mods/event-halloween/spells/spellScatterPumpkinPieces.js

+ 3
- 4
src/client/js/rendering/renderer.js View File

@@ -727,7 +727,7 @@ define([
}

var bigSheets = ['bosses', 'bigObjects', 'animBigObjects'];
if (bigSheets.indexOf(obj.sheetName) > -1) {
if ((bigSheets.indexOf(obj.sheetName) > -1) || (obj.sheetName.indexOf('bosses') > -1)) {
obj.layerName = 'mobs';
w = 24;
h = 24;
@@ -741,8 +741,7 @@ define([
sprite.width = obj.w || scale;
sprite.height = obj.h || scale;

var bigSheets = ['bosses', 'bigObjects', 'animBigObjects'];
if (bigSheets.indexOf(obj.sheetName) > -1) {
if ((bigSheets.indexOf(obj.sheetName) > -1) || (obj.sheetName.indexOf('bosses') > -1)) {
sprite.x -= scale;
sprite.y -= (scale * 2);
}
@@ -842,4 +841,4 @@ define([
this.renderer.render(this.stage);
}
};
});
});

+ 5
- 5
src/server/components/mob.js View File

@@ -1,6 +1,6 @@
define([
'items/generator'
], function(
], function (
itemGenerator
) {
var abs = Math.abs.bind(Math);
@@ -19,14 +19,14 @@ define([

walkDistance: 1,

init: function(blueprint) {
init: function (blueprint) {
this.physics = this.obj.instance.physics;

this.originX = this.obj.x;
this.originY = this.obj.y;
},

update: function() {
update: function () {
var target = null;
if (this.obj.aggro)
target = this.obj.aggro.getHighest();
@@ -79,7 +79,7 @@ define([
});
}
},
fight: function(target) {
fight: function (target) {
if (this.target != target) {
this.obj.clearQueue();
this.target = target;
@@ -174,4 +174,4 @@ define([
});
}
};
});
});

+ 6
- 7
src/server/config/eventPhases/phaseSpawnMob.js View File

@@ -1,13 +1,13 @@
define([
'../../world/mobBuilder'
], function(
], function (
mobBuilder
) {
return {
spawnRect: null,
mobs: null,

init: function() {
init: function () {
var objects = this.instance.objects;
var spawnRect = this.spawnRect;

@@ -16,7 +16,7 @@ define([

var usedSpots = ['-1,-1'];

this.mobs.forEach(function(l) {
this.mobs.forEach(function (l) {
var amount = l.amount || 1;
delete l.amount;

@@ -66,14 +66,13 @@ define([
var mob = objects.buildObjects([{
x: x,
y: y,
sheetName: 'mobs',
sheetName: l.sheetName || 'mobs',
cell: l.cell,
name: l.name
}]);
mobBuilder.build(mob, l);
this.spawnAnimation(mob);


if (l.id) {
var id = l.id.split('$').join(i);
mob.id = id;
@@ -123,7 +122,7 @@ define([
this.end = true;
},

spawnAnimation: function(mob) {
spawnAnimation: function (mob) {
this.instance.syncer.queue('onGetObject', {
x: mob.x,
y: mob.y,
@@ -135,4 +134,4 @@ define([
});
}
};
});
});

BIN
View File


BIN
View File


BIN
View File


BIN
View File


+ 2
- 3
src/server/mods/event-halloween/index.js View File

@@ -14,7 +14,7 @@ define([
extraScripts: [
'maps/tutorial/events/halloween.js',
'mtx/summonPumpkinSkeleton.js',
'spells/scatterPumpkinPieces.js'
'spells/spellScatterPumpkinPieces.js'
],

mapFile: null,
@@ -47,9 +47,7 @@ define([
beforeGetSpellsInfo: function (spells) {
spells.push({
name: 'scatter pumpkin pieces',
description: 'Absorbs the life-force of your enemies.',
type: 'scatterPumpkinPieces',
icon: [0, 0],
animation: 'melee',
particles: {
color: {
@@ -180,6 +178,7 @@ define([

onBeforeGetResourceList: function (list) {
list.push(`${this.folderName}/images/mobs.png`);
list.push(`${this.folderName}/images/bosses.png`);
list.push(`${this.folderName}/images/skins.png`);
},



+ 7
- 4
src/server/mods/event-halloween/maps/tutorial/events/halloweenBoss.js View File

@@ -7,7 +7,7 @@ define([
name: `Beware Lord Squash`,
description: `Snappadoowap.`,
distance: -1,
cron: '0 */4 * * *',
cron: '* * * * *',

events: {

@@ -27,15 +27,18 @@ define([
name: 'Lord Squash',
level: 12,
attackable: true,
cell: 1,
sheetName: `mods/halloween/images/bigMobs.png`,
cell: 0,
sheetName: `server/mods/event-halloween/images/bosses.png`,
id: 'lordSquash',
hpMult: 10,
dmgMult: 2,
pos: {
x: 0,
y: 0
}
},
spells: [{
type: 'scatterPumpkinPieces'
}]
}]
}]
};


+ 0
- 12
src/server/mods/event-halloween/maps/tutorial/map.json View File

@@ -57,18 +57,6 @@
"width":24,
"x":48,
"y":40
},
{
"gid":789,
"height":24,
"id":664,
"name":"blabby",
"rotation":0,
"type":"",
"visible":true,
"width":24,
"x":144,
"y":32
}],
"opacity":1,
"properties":


+ 0
- 37
src/server/mods/event-halloween/spells/scatterPumpkinPieces.js View File

@@ -1,37 +0,0 @@
define([

], function (

) {
var cpnPumpkinChunk = {
type: 'pumpkinChunk',

collisionEnter: function (o) {
if (!o.aggro)
return;

var isPlayer = !!this.caster.player;
var isTargetPlayer = !!o.player;

if ((!this.caster.aggro.canAttack(o)) && (isPlayer == isTargetPlayer))
return;

this.contents.push(o);
}
};

return {
type: 'scatterPumpkinPieces',

cdMax: 5,
manaCost: 0,

cast: function (action) {
//Shoot Chunk

//Make Chunk Lootable

//
}
};
});

+ 91
- 0
src/server/mods/event-halloween/spells/spellScatterPumpkinPieces.js View File

@@ -0,0 +1,91 @@
define([

], function (

) {
var cpnPumpkinChunk = {
type: 'pumpkinChunk',

collisionEnter: function (o) {
if (!o.aggro)
return;

var isPlayer = !!this.caster.player;
var isTargetPlayer = !!o.player;

if ((!this.caster.aggro.canAttack(o)) && (isPlayer == isTargetPlayer))
return;

this.contents.push(o);
}
};

return {
type: 'scatterPumpkinPieces',

cdMax: 5,
manaCost: 0,

range: 10,

cast: function (action) {
this.shootChunk(action);
},

shootChunk: function (action) {
var obj = this.obj;
var speed = 150;
var target = action.target;

var ttl = (Math.sqrt(Math.pow(target.x - obj.x, 2) + Math.pow(target.y - obj.y, 2)) * speed) - 50;

var projectileConfig = {
caster: this.obj.id,
components: [{
idSource: this.obj.id,
idTarget: target.id,
type: 'projectile',
ttl: ttl,
projectileOffset: null,
particles: {
particles: {
color: {
start: ['7a3ad3', '3fa7dd'],
end: ['3fa7dd', '7a3ad3']
},
scale: {
start: {
min: 2,
max: 14
},
end: {
min: 0,
max: 8
}
},
lifetime: {
min: 1,
max: 3
},
alpha: {
start: 0.7,
end: 0
},
randomScale: true,
randomColor: true,
chance: 0.6
}
}
}, {
type: 'attackAnimation',
layer: 'projectiles',
loop: -1,
row: 0,
col: 0
}]
};

this.sendAnimation(projectileConfig);
}
};
});

Loading…
Cancel
Save