Commit ed0e7b9 Picoseconds
committed
1 parent 1675f7b commit ed0e7b9 Copy full SHA for ed0e7b9
File tree 2 files changed +14
-3
lines changed
2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 1
1
import weapons from './weapons.json' ;
2
2
import items from './items.json' ;
3
3
import { ItemType } from './UpgradeItems' ;
4
+ import { WeaponVariant } from '../moomoo/Weapons' ;
4
5
5
6
/**
6
7
* An enum containing the names of all the items. Saves you the effort of differentiating weapon items and other items
@@ -88,9 +89,19 @@ function getWeaponAttackDetails(item: Weapons): AttackDetails {
88
89
return { kbMultiplier : weapon ?. knock || 1 , attackRange : weapon ?. range || 10 } ;
89
90
}
90
91
91
- function getWeaponDamage ( item : Weapons ) {
92
+ function getWeaponDamage ( item : Weapons , weaponVariant : WeaponVariant ) {
92
93
let weapon = weapons . find ( weapon => weapon . id == item ) ;
93
- return weapon ?. dmg || 0 ;
94
+ let baseDamage = weapon ?. dmg || 0 ;
95
+
96
+ switch ( weaponVariant ) {
97
+ case WeaponVariant . Normal :
98
+ return baseDamage ;
99
+ case WeaponVariant . Gold :
100
+ return baseDamage * 1.1 ;
101
+ case WeaponVariant . Diamond :
102
+ case WeaponVariant . Ruby :
103
+ return baseDamage * 1.18 ;
104
+ }
94
105
}
95
106
96
107
function getItemCost ( item : ItemType ) {
Original file line number Diff line number Diff line change @@ -374,7 +374,7 @@ export default class Game {
374
374
) ;
375
375
376
376
for ( let hitPlayer of hitPlayers ) {
377
- hitPlayer . health -= getWeaponDamage ( player . weapon ) ;
377
+ hitPlayer . health -= getWeaponDamage ( player . weapon , player . weaponVariant ) ;
378
378
if ( hitPlayer . health <= 0 && hitPlayer . client ) {
379
379
this . killPlayer ( hitPlayer ) ;
380
380
} else {
You can’t perform that action at this time.
0 commit comments