generated from acm-ndsu/byte_le_engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added game board and stats file * fixed imports * added obfuscate method * added lethal list * added unit tests * added lethal list to json methods * add logic for test based on game stats * initial map objects * removed unnecessary changes * added collidable property to map object * fixed mistakes, old implementation * unnecessary parameter removed * Created gun object, enums, stats, to string * added pattern, missing cooldown * added level, inheritance from item * added object types * moved gun object, added object types * removed .vs dir Co-authored-by: unknown <[email protected]> Co-authored-by: Christopher Parks <[email protected]>
- Loading branch information
1 parent
2cbd4b7
commit 16e628a
Showing
6 changed files
with
126 additions
and
2 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
from game.common.enums import * | ||
from game.common.stats import GameStats | ||
from game.common.items.item import Item | ||
|
||
class Gun(Item): | ||
def __init__(self, gun_type, level): | ||
super().__init__() | ||
self.object_type = ObjectType.gun | ||
|
||
self.gun_type = gun_type | ||
# Leveling subject to change | ||
self.level = level | ||
self.pattern = GameStats.gun_stats[gun_type]['pattern'] | ||
self.damage = (round(GameStats.gun_stats[gun_type]['damage'] | ||
* (GameStats.gun_stats[gun_type]['level_mod'] ** self.level), 1) | ||
if self.level > GunLevel.level_zero else 0) | ||
self.fire_rate = (round(GameStats.gun_stats[gun_type]['fire_rate'] | ||
* (GameStats.gun_stats[gun_type]['level_mod'] ** self.level)) | ||
if self.level > GunLevel.level_zero else 0) | ||
self.range = (round(GameStats.gun_stats[gun_type]['range'] | ||
* (GameStats.gun_stats[gun_type]['level_mod'] ** self.level)) | ||
if self.level > GunLevel.level_zero else 0) | ||
self.mag_size = (round(GameStats.gun_stats[gun_type]['mag_size'] | ||
* (GameStats.gun_stats[gun_type]['level_mod'] ** self.level)) | ||
if self.level > GunLevel.level_zero else 0) | ||
self.reload_speed = (round(GameStats.gun_stats[gun_type]['reload_speed'] | ||
* (GameStats.gun_stats[gun_type]['level_mod'] ** self.level)) | ||
if self.level > GunLevel.level_zero else 0) | ||
if self.level > GunLevel.level_zero: | ||
self.cooldown = GameStats.gun_stats[gun_type]['cooldown'] | ||
self.cooldown['max'] = round(self.cooldown['max'] | ||
* (GameStats.gun_stats[gun_type]['level_mod'] ** self.level)) | ||
else: | ||
self.cooldown = {'max': 0, 'rate': 0} | ||
|
||
def to_json(self): | ||
data = super().to_json() | ||
data['gun_type'] = self.gun_type | ||
data['level'] = self.level | ||
data['pattern'] = self.pattern | ||
data['damage'] = self.damage | ||
data['fire_rate'] = self.fire_rate | ||
data['range'] = self.range | ||
data['mag_size'] = self.mag_size | ||
data['reload_speed'] = self.reload_speed | ||
data['cooldown'] = self.cooldown | ||
|
||
return data | ||
|
||
def from_json(self, data): | ||
super().from_json(data) | ||
self.gun_type = data['gun_type'] | ||
self.level = data['level'] | ||
self.pattern = data['pattern'] | ||
self.damage = data['damage'] | ||
self.fire_rate = data['fire_rate'] | ||
self.range = data['range'] | ||
self.mag_size = data['mag_size'] | ||
self.reload_speed = data['reload_speed'] | ||
self.cooldown = data['cooldown'] | ||
|
||
def __str__(self): | ||
return f""" | ||
Gun Type: {self.gun_type} | ||
Level: {self.level} | ||
Pattern: {self.pattern} | ||
Damage: {self.damage} | ||
Fire Rate: {self.fire_rate} | ||
Range: {self.range} | ||
Mag Size: {self.mag_size} | ||
Reload Speed: {self.reload_speed} | ||
Cooldown: {self.cooldown} | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters