Skip to content

Commit

Permalink
zed E - WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
HoangTran0410 committed Sep 19, 2024
1 parent a21429a commit f7296c7
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 4 deletions.
75 changes: 75 additions & 0 deletions src/game/gameObject/spells/Zed_E.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import { Rectangle } from '../../../../libs/quadtree.js';
import AssetManager from '../../../managers/AssetManager.js';
import BuffAddType from '../../enums/BuffAddType.js';
import Buff from '../Buff.js';
import ParticleSystem from '../helpers/ParticleSystem.js';
import Spell from '../Spell.js';
import SpellObject from '../SpellObject.js';

export default class Zed_E extends Spell {
image = AssetManager.getAsset('spell_zed_e');
name = 'Đường kiếm bóng tối (Zed_E)';
description =
'Xoay lưỡi kiếm xung quanh bản thân. Gây <span class="damage">15 sát thương</span> và <span class="buff">Làm chậm 30%</span> các kẻ địch trong <span class="time">1 giây</span>';
coolDown = 1000;

onSpellCast() {
const obj = new Zed_E_Object(this.owner);
this.game.objectManager.addObject(obj);
}
}

export class Zed_E_Object extends SpellObject {
angle = 0;
radius = 100;

particleSystem = new ParticleSystem({
getParticlePosFn: p => p.position,
getParticleSizeFn: p => 10,
isDeadFn: p => p.lifeSpan <= 0,
updateFn: p => {
p.position.add(p.velocity);
p.lifeSpan -= deltaTime;
},
drawFn: p => {
let alpha = map(p.lifeSpan, 0, p.lifeTime, 100, 255);
stroke(255, 234, 79, alpha);
strokeWeight(random(3, 8));
let len = p.velocity.copy().setMag(random(5, 10));
line(p.position.x, p.position.y, p.position.x + len.x, p.position.y + len.y);
},
});

onAdded() {}
onRemoved() {}
update() {
this.position.set(this.owner.position.x, this.owner.position.y);

this.angle += 0.5;
if (this.angle > 2 * Math.PI) {
this.toRemove = true;
}
}

draw() {
// draw 2 blades on each side of the owner
push();
translate(this.position.x, this.position.y);
rotate(this.angle);

fill(200);
rect(-this.radius, -5, this.radius * 2, 10);

pop();
}

getDisplayBoundingBox() {
return new Rectangle({
x: this.position.x - this.radius,
y: this.position.y - this.radius,
w: this.radius * 2,
h: this.radius * 2,
data: this,
});
}
}
2 changes: 0 additions & 2 deletions src/game/gameObject/spells/Zed_Q.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { Circle, Rectangle } from '../../../../libs/quadtree.js';
import AssetManager from '../../../managers/AssetManager.js';
import VectorUtils from '../../../utils/vector.utils.js';
import BuffAddType from '../../enums/BuffAddType.js';
import { PredefinedFilters } from '../../managers/ObjectManager.js';
import Buff from '../Buff.js';
import Slow from '../buffs/Slow.js';
import ParticleSystem from '../helpers/ParticleSystem.js';
import TrailSystem from '../helpers/TrailSystem.js';
Expand Down
1 change: 1 addition & 0 deletions src/game/gameObject/spells/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ export { default as StealthWard } from './StealthWard.js';
export { default as Zed_W } from './Zed_W.js';
export { default as Graves_W } from './Graves_W.js';
export { default as Zed_Q } from './Zed_Q.js';
export { default as Zed_E } from './Zed_E.js';
6 changes: 5 additions & 1 deletion src/game/preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ export const SpellGroups = [
name: 'Zed',
image: 'champ_zed',
background: './assets/images/champions/background/zed.png',
spells: [AllSpells.Zed_Q, AllSpells.Zed_W],
spells: [
AllSpells.Zed_Q,
AllSpells.Zed_W,
// AllSpells.Zed_E
],
},
{
name: 'Graves',
Expand Down
2 changes: 1 addition & 1 deletion src/managers/AssetManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const AssetPaths = {
champ_leblanc: 'assets/images/champions/leblanc.png',
champ_leesin: 'assets/images/champions/leesin.png',
champ_chogath: 'assets/images/champions/chogath.png',
champ_ahri: 'assets/images/champions/ahri.png',
champ_shaco: 'assets/images/champions/shaco.png',
champ_olaf: 'assets/images/champions/olaf.png',
champ_malphite: 'assets/images/champions/malphite.png',
Expand Down Expand Up @@ -65,6 +64,7 @@ const AssetPaths = {
spell_zed_q: 'assets/images/spells/zed_q.png',
spell_zed_w: 'assets/images/spells/zed_w.png',
spell_zed_w2: 'assets/images/spells/zed_w2.png',
spell_zed_e: 'assets/images/spells/zed_e.png',
spell_graves_w: 'assets/images/spells/graves_w.png',

// buffs
Expand Down

0 comments on commit f7296c7

Please sign in to comment.