survivors: adding new "melee" weapon

This commit is contained in:
Sheldan
2025-09-06 00:50:45 +02:00
parent 71b2afacc4
commit 33310100f7
4 changed files with 142 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
import type {ChanceEntry, Item} from "./interfaces.ts";
import {Player} from "./Player.ts";
import {randomItem} from "./utils.ts";
import {HomingPistol, Pistol, SpreadWeapon} from "./weapons.ts";
import {Dagger, HomingPistol, Pistol, SpreadWeapon} from "./weapons.ts";
import type {World} from "./World.ts";
export enum Rarity {
@@ -40,6 +40,7 @@ export class ItemManagement {
this.ITEMS.push(new HomingPistolItem())
this.ITEMS.push(new PistolItem())
this.ITEMS.push(new SpreadWeaponItem())
this.ITEMS.push(new DaggerWeaponItem())
}
}
@@ -91,7 +92,7 @@ export class SpeedUp extends BaseItem {
}
getRarity(): Rarity {
return Rarity.COMMON;
return Rarity.LEGENDARY;
}
}
@@ -155,3 +156,19 @@ export class SpreadWeaponItem extends BaseItem {
}
}
export class DaggerWeaponItem extends BaseItem {
pickup(player: Player, world: World) {
player.addWeapon(Dagger.createDagger(world))
super.pickup(player, world)
}
name() {
return 'dagger'
}
getRarity(): Rarity {
return Rarity.EPIC;
}
}