Skip to content

Commit

Permalink
graves W + buff yasuo Q
Browse files Browse the repository at this point in the history
  • Loading branch information
HoangTran0410 committed Sep 11, 2024
1 parent 9bb326c commit d944831
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 157 deletions.
Binary file added assets/images/champions/graves.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/spells/graves_W.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/game/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Camera from './gameObject/map/Camera.js';
import FogOfWar from './gameObject/map/FogOfWar.js';
import TerrainMap from './gameObject/map/TerrainMap.js';
import InGameHUD from './hud/InGameHUD.js';
import { ChampionPreset, MonsterPreset, getChampionPresetRandom } from './preset.js';
import { MonsterPreset, getChampionPresetRandom } from './preset.js';
import Monster from './gameObject/attackableUnits/Monster.js';
import ObjectManager from './managers/ObjectManager.js';
import EventManager from '../managers/EventManager.js';
Expand Down
109 changes: 109 additions & 0 deletions src/game/gameObject/spells/Graves_W.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import { Circle, Rectangle } from '../../../../libs/quadtree.js';
import AssetManager from '../../../managers/AssetManager.js';
import VectorUtils from '../../../utils/vector.utils.js';
import { PredefinedFilters } from '../../managers/ObjectManager.js';
import Nearsight from '../buffs/Nearsight.js';
import Slow from '../buffs/Slow.js';
import { PredefinedParticleSystems } from '../helpers/ParticleSystem.js';
import Spell from '../Spell.js';
import SpellObject from '../SpellObject.js';

export default class Graves_W extends Spell {
image = AssetManager.getAsset('spell_graves_w');
name = 'Bom mù (Graves_W)';
description =
'Tạo một làn khói tại khu vực chỉ định, <span class="buff">Giảm tầm nhìn</span> và <span class="buff">Làm chậm 40%</span> tất cả kẻ địch / đồng minh trong khu vực';
coolDown = 5000;

range = 350;

onSpellCast() {
let { from, to } = VectorUtils.getVectorWithMaxRange(
this.owner.position,
this.game.worldMouse,
this.range
);

let obj = new Graves_W_Object(this.owner);
obj.position = to;
this.game.objectManager.addObject(obj);
}

drawPreview() {
super.drawPreview(this.range);
}
}

export class Graves_W_Object extends SpellObject {
position = createVector();
range = 100;
curRange = 0;
lifeTime = 5000;
age = 0;

particleSystem = PredefinedParticleSystems.smoke([200, 200, 200], 0.8, 0.5);

onAdded() {
this.game.objectManager.addObject(this.particleSystem);

let pos = this.position;
let size = this.range / 2;
for (let i = 0; i < 10; i++) {
this.particleSystem.addParticle({
x: pos.x + random(-size, size),
y: pos.y + random(-size, size),
size: random(15, 30),
opacity: random(100, 200),
});
}
}

update() {
this.age += deltaTime;
if (this.age >= this.lifeTime) {
this.toRemove = true;
this.particleSystem.toRemove = true;
}

this.curRange = lerp(this.curRange, this.range, 0.08);

let enemies = this.game.objectManager.queryObjects({
area: new Circle({
x: this.position.x,
y: this.position.y,
r: this.curRange,
}),
filters: [
PredefinedFilters.canTakeDamage,
// PredefinedFilters.canTakeDamageFromTeam(this.owner.teamId),
],
});

enemies.forEach(enemy => {
if (!enemy.hasBuff(Nearsight)) {
let nearsight = new Nearsight(500, this.owner, enemy);
enemy.addBuff(nearsight);

let slow = new Slow(500, this.owner, enemy);
slow.percent = 0.4;
enemy.addBuff(slow);
}
});
}
draw() {
push();
stroke(100);
fill(100, 40);
circle(this.position.x, this.position.y, this.curRange * 2);
pop();
}
getDisplayBoundingBox() {
return new Rectangle({
x: this.position.x - this.range,
y: this.position.y - this.range,
w: this.range * 2,
h: this.range * 2,
data: this,
});
}
}
8 changes: 5 additions & 3 deletions src/game/gameObject/spells/Yasuo_Q.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ export default class Yasuo_Q extends Spell {
coolDown = 3500;
manaCost = 20;

coolDownIfHit = 800;
coolDownIfHit = 500;
hitStackCount = 0;
lastHitTime = 0;
timeToResetHitStack = 3000;
timeToResetHitStack = 3500;

changeState(newState) {
this.phase = newState;
Expand All @@ -47,7 +47,7 @@ export default class Yasuo_Q extends Spell {
// Q1, Q2
if (this.phase == this.PHASES.Q1 || this.phase == this.PHASES.Q2) {
const stunTime = 300,
range = 150,
range = 200,
rayWidth = 30;

let obj = new Yasuo_Q_Object(this.owner);
Expand Down Expand Up @@ -84,6 +84,8 @@ export default class Yasuo_Q extends Spell {
tornado.airBorneTime = airBorneTime;
tornado.speed = speed;
this.game.objectManager.addObject(tornado);

this.changeState(this.PHASES.Q1);
}
}

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 @@ -34,3 +34,4 @@ export { default as Malphite_R } from './Malphite_R.js';
export { default as Olaf_Q } from './Olaf_Q.js';
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';
172 changes: 19 additions & 153 deletions src/game/preset.js
Original file line number Diff line number Diff line change
@@ -1,155 +1,22 @@
import * as AllSpells from './gameObject/spells/index.js';

export const ChampionPreset = {
yasuo: {
name: 'Yasuo',
avatar: 'champ_yasuo',
spells: [
AllSpells.Heal,
AllSpells.Yasuo_Q,
AllSpells.Yasuo_W,
AllSpells.Yasuo_E,
AllSpells.Yasuo_R,
AllSpells.Flash,
AllSpells.Ghost,
],
},
lux: {
name: 'Lux',
avatar: 'champ_lux',
spells: [
AllSpells.Heal,
AllSpells.Lux_Q,
AllSpells.Yasuo_W,
AllSpells.Lux_E,
AllSpells.Lux_R,
AllSpells.Flash,
AllSpells.Ghost,
],
},
blitzcrank: {
name: 'Blitzcrank',
avatar: 'champ_blitzcrank',
spells: [
AllSpells.Heal,
AllSpells.Blitzcrank_Q,
AllSpells.Blitzcrank_W,
AllSpells.Veigar_E,
AllSpells.Blitzcrank_R,
AllSpells.Flash,
AllSpells.Ghost,
],
},
ashe: {
name: 'Ashe',
avatar: 'champ_ashe',
spells: [
AllSpells.Heal,
AllSpells.Ashe_W,
AllSpells.Ashe_W,
AllSpells.Yasuo_W,
AllSpells.Ashe_R,
AllSpells.Flash,
AllSpells.Ghost,
],
},
teemo: {
name: 'Teemo',
avatar: 'champ_teemo',
spells: [
AllSpells.Heal,
AllSpells.Blitzcrank_Q,
AllSpells.Blitzcrank_W,
AllSpells.Teemo_R,
AllSpells.Teemo_R,
AllSpells.Flash,
AllSpells.Ghost,
],
},
leblanc: {
name: 'Leblanc',
avatar: 'champ_leblanc',
spells: [
AllSpells.Heal,
AllSpells.Blitzcrank_Q,
AllSpells.Leblanc_W,
AllSpells.Leblanc_E,
AllSpells.Leblanc_W,
AllSpells.Flash,
AllSpells.Ghost,
],
},
leesin: {
name: 'Lee Sin',
avatar: 'champ_leesin',
spells: [
AllSpells.Heal,
AllSpells.LeeSin_Q,
AllSpells.LeeSin_Q,
AllSpells.LeeSin_E,
AllSpells.LeeSin_R,
AllSpells.Flash,
AllSpells.Ghost,
],
},
chogath: {
name: 'Cho Gath',
avatar: 'champ_chogath',
spells: [
AllSpells.Heal,
AllSpells.ChoGath_Q,
AllSpells.ChoGath_W,
AllSpells.Yasuo_E,
AllSpells.Yasuo_R,
AllSpells.Flash,
AllSpells.Ghost,
],
},
ahri: {
name: 'Ahri',
avatar: 'champ_ahri',
spells: [
AllSpells.Heal,
AllSpells.Ahri_Q,
AllSpells.Ahri_W,
AllSpells.Ahri_E,
AllSpells.Ahri_R,
AllSpells.Flash,
AllSpells.Ghost,
],
},
shaco: {
name: 'Shaco',
avatar: 'champ_shaco',
spells: [
AllSpells.Heal,
AllSpells.Shaco_Q,
AllSpells.Shaco_W,
AllSpells.Shaco_E,
AllSpells.Shaco_R,
AllSpells.Flash,
AllSpells.Ghost,
],
},
olaf: {
name: 'Olaf',
avatar: 'champ_olaf',
spells: [
AllSpells.Heal,
AllSpells.Olaf_Q,
AllSpells.Olaf_Q,
AllSpells.Olaf_Q,
AllSpells.Olaf_Q,
AllSpells.Flash,
AllSpells.Ghost,
],
},
};

export const getChampionPresetRandom = () => {
return {
name: 'Random',
avatar: random(Object.values(ChampionPreset).map(x => x.avatar)),
avatar: random([
'champ_yasuo',
'champ_lux',
'champ_blitzcrank',
'champ_ashe',
'champ_teemo',
'champ_leblanc',
'champ_leesin',
'champ_chogath',
'champ_ahri',
'champ_shaco',
'champ_olaf',
'champ_graves',
]),
spells: [
AllSpells.Heal,
...Array.from({ length: 4 })
Expand All @@ -163,12 +30,6 @@ export const getChampionPresetRandom = () => {
};
};

export const getRandomChampionPreset = () => {
const keys = Object.keys(ChampionPreset);
const randomKey = keys[Math.floor(Math.random() * keys.length)];
return ChampionPreset[randomKey];
};

export const SpellGroups = [
{
name: 'Yasuo',
Expand Down Expand Up @@ -242,6 +103,11 @@ export const SpellGroups = [
image: 'champ_zed',
spells: [AllSpells.Zed_W],
},
{
name: 'Graves',
image: 'champ_graves',
spells: [AllSpells.Graves_W],
},
{
name: 'Phép Bổ Trợ',
image: '',
Expand Down
2 changes: 2 additions & 0 deletions src/managers/AssetManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const AssetPaths = {
champ_olaf: 'assets/images/champions/olaf.png',
champ_malphite: 'assets/images/champions/malphite.png',
champ_veigar: 'assets/images/champions/veigar.png',
champ_graves: 'assets/images/champions/graves.png',

// spells
spell_stealthward: 'assets/images/spells/stealthward.png',
Expand Down Expand Up @@ -63,6 +64,7 @@ const AssetPaths = {
spell_olaf_q: 'assets/images/spells/olaf_q.png',
spell_zed_w: 'assets/images/spells/zed_w.png',
spell_zed_w2: 'assets/images/spells/zed_w2.png',
spell_graves_w: 'assets/images/spells/graves_w.png',

// buffs
buff_silence: 'assets/images/buffs/silence.png',
Expand Down

0 comments on commit d944831

Please sign in to comment.