Add skill system, level-ups, and new enemy types
This commit is contained in:
@@ -4,6 +4,7 @@ import { Player } from './Player';
|
||||
import { Fireball } from './Fireball';
|
||||
import { playSound } from './SoundManager';
|
||||
import { loadGLB } from './MeshLoader';
|
||||
import { fireballDamage, fireballCooldown, fireballRadius, teleportCooldown } from './Skills';
|
||||
|
||||
export class Staff extends Weapon {
|
||||
constructor() {
|
||||
@@ -52,7 +53,11 @@ export class Staff extends Weapon {
|
||||
}
|
||||
|
||||
skill1(groundPoint: THREE.Vector3, player: Player): void {
|
||||
const level = player.game.skillSystem.getLevel('fireball');
|
||||
if (level <= 0) return;
|
||||
if (this.cooldown1 > 0) return;
|
||||
|
||||
this.COOLDOWN1_TIME = fireballCooldown(level);
|
||||
this.cooldown1 = this.COOLDOWN1_TIME;
|
||||
|
||||
// Spawn at staff height, fly toward the cursor point
|
||||
@@ -66,13 +71,19 @@ export class Staff extends Weapon {
|
||||
dir.setY(0);
|
||||
|
||||
const fb = new Fireball(spawnPos, dir);
|
||||
fb.damage = fireballDamage(level);
|
||||
fb.explosionRadius = fireballRadius(level);
|
||||
player.game.scene.add(fb.body);
|
||||
player.game.fireballs.push(fb);
|
||||
playSound('fireball', 0.5);
|
||||
}
|
||||
|
||||
skill2(groundPoint: THREE.Vector3, player: Player): void {
|
||||
const level = player.game.skillSystem.getLevel('teleport');
|
||||
if (level <= 0) return;
|
||||
if (this.cooldown2 > 0) return;
|
||||
|
||||
this.COOLDOWN2_TIME = teleportCooldown(level);
|
||||
this.cooldown2 = this.COOLDOWN2_TIME;
|
||||
|
||||
const newPos = groundPoint.clone();
|
||||
|
||||
Reference in New Issue
Block a user