generated from acm-ndsu/byte_le_engine
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/dev' into quinn
- Loading branch information
Showing
13 changed files
with
219 additions
and
96 deletions.
There are no files selected for viewing
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,48 @@ | ||
from game.common.game_object import GameObject | ||
from game.common.enums import * | ||
from game.common.map import Map | ||
import random | ||
import json | ||
|
||
|
||
class Contract(GameObject): | ||
def __init__(self, name=None, region=None, cities=None): | ||
super().__init__() | ||
self.object_type = ObjectType.contract | ||
|
||
# if no name is supplied it will generate a random one | ||
self.name = self.generateName() if not name else name | ||
# region is region enum | ||
self.region = region | ||
|
||
# cities is a list of strings representing the keys for the nodes within the graph | ||
self.cities = cities | ||
|
||
def to_json(self): | ||
data = super().to_json() | ||
data['name'] = self.name | ||
data['region'] = self.region | ||
data['cities'] = self.cities | ||
return data | ||
|
||
def from_json(self,data): | ||
super().from_json(data) | ||
self.name = data['name'] | ||
self.region = data['region'] | ||
self.cities = data['cities'] | ||
|
||
# generates a random name, has no effect on gameplay other than lols | ||
def generateName(self): | ||
verb = ["Deliver ", "Transport ", "Drop off ", "Ship "] | ||
quantity = ["a lot ", "several ", "one ", "a few "] | ||
adjective = ["big ", "small ", "happy ", "sad ", "angry "] | ||
noun = ["lobsters", "cd players", "power converers sourced from Tosche station", "Patented Skinner Burgers"] | ||
# Literally making code worse for a joke | ||
index = random.randrange(len(noun)) | ||
if index == 3: | ||
return random.choice(verb) + random.choice(quantity) + "of" + noun[index] | ||
else: | ||
return random.choice(verb) + random.choice(quantity) + "of " + random.choice(adjective) + noun[index] | ||
|
||
def __eq__(self, other): | ||
return isinstance(other, self.__class__) and self.name == other.name and self.region == other.region and self.cities == other.cities |
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 was deleted.
Oops, something went wrong.
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
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,51 @@ | ||
from game.common.node import Node | ||
from game.common.enums import Region | ||
from game.common.stats import GameStats | ||
|
||
|
||
class Grass_Lands(Node): | ||
def __init__(self): | ||
super().__init__() | ||
self.region = Region.grass_lands | ||
self.reward_modifier = GameStats.region_reward_modifier[self.region] | ||
self.difficulty_modifier = GameStats.node_difficulty_modifier[self.region] | ||
|
||
|
||
class Nord_Dakotia(Node): | ||
def __init__(self): | ||
super().__init__() | ||
self.region = Region.nord_dakotia | ||
self.reward_modifier = GameStats.region_reward_modifier[self.region] | ||
self.difficulty_modifier = GameStats.region_difficulty_modifier[self.region] | ||
|
||
|
||
class Mobave_Desert(Node): | ||
def __init__(self): | ||
super().__init__() | ||
self.region = Region.mobave_desert | ||
self.reward_modifier = GameStats.region_reward_modifier[self.region] | ||
self.difficulty_modifier = GameStats.region_difficulty_modifier[self.region] | ||
|
||
|
||
class Mount_Vroom(Node): | ||
def __init__(self): | ||
super().__init__() | ||
self.region = Region.mount_vroom | ||
self.reward_modifier = GameStats.region_reward_modifier[self.region] | ||
self.difficulty_modifier = GameStats.region_difficulty_modifier[self.region] | ||
|
||
|
||
class Loblantis(Node): | ||
def __init__(self): | ||
super().__init__() | ||
self.region = Region.loblantis | ||
self.reward_modifier = GameStats.region_reward_modifier[self.region] | ||
self.difficulty_modifier = GameStats.region_difficulty_modifier[self.region] | ||
|
||
|
||
class Tropical_Cop_Land(Node): | ||
def __init__(self): | ||
super().__init__() | ||
self.region = Region.tropical_cop_land | ||
self.reward_modifier = GameStats.region_reward_modifier[self.region] | ||
self.difficulty_modifier = GameStats.region_difficulty_modifier[self.region] |
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 |
---|---|---|
@@ -1,21 +1,21 @@ | ||
from game.common.enums import LocationType | ||
from game.common.enums import Region | ||
|
||
|
||
class GameStats: | ||
location_reward_modifier = { | ||
LocationType.grass_lands: .5, | ||
LocationType.nord_dakotia: .6, | ||
LocationType.mobave_desert: .7, | ||
LocationType.mount_vroom: .8, | ||
LocationType.loblantis: .8, | ||
LocationType.tropical_cop_land: .9, | ||
region_reward_modifier = { | ||
Region.grass_lands: .5, | ||
Region.nord_dakotia: .6, | ||
Region.mobave_desert: .7, | ||
Region.mount_vroom: .8, | ||
Region.loblantis: .8, | ||
Region.tropical_cop_land: .9, | ||
} | ||
|
||
location_difficulty_modifier = { | ||
LocationType.grass_lands: .5, | ||
LocationType.nord_dakotia: .6, | ||
LocationType.mobave_desert: .7, | ||
LocationType.mount_vroom: .8, | ||
LocationType.loblantis: .8, | ||
LocationType.tropical_cop_land: .9, | ||
region_difficulty_modifier = { | ||
Region.grass_lands: .5, | ||
Region.nord_dakotia: .6, | ||
Region.mobave_desert: .7, | ||
Region.mount_vroom: .8, | ||
Region.loblantis: .8, | ||
Region.tropical_cop_land: .9, | ||
} |
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
Oops, something went wrong.