Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Be polite.

  • Loading branch information...
commit 4191fcba7863694bc30c656e7635044611420eed 1 parent 105f275
@clanehin authored
View
2  roguestar-engine/src/AttributeGeneration.hs
@@ -11,7 +11,7 @@ import Data.Monoid
import Control.Monad
-- | Description of the random data to be generated.
-data AttributeGenerator a =
+data AttributeGenerator a =
AttributeAlways {
attribute_actual :: a,
attribute_min_max :: (Integer,Integer) }
View
3  roguestar-engine/src/BeginGame.hs
@@ -34,6 +34,7 @@ homeBiome Myrmidon = DesertBiome
homeBiome Perennial = GrasslandBiome
homeBiome Recreant = TundraBiome
homeBiome Reptilian = ForestBiome
+homeBiome DustVortex = DesertBiome
startingEquipmentByClass :: CharacterClass -> [Tool]
startingEquipmentByClass Barbarian = [kinetic_fleuret]
@@ -47,6 +48,7 @@ startingEquipmentByClass Scout = [phase_pistol]
startingEquipmentByClass Shepherd = [sphere Wood]
startingEquipmentByClass Thief = [sphere Platinum]
startingEquipmentByClass Warrior = [phaser,kinetic_fleuret]
+startingEquipmentByClass StarChild = [sphere Diamond]
startingEquipmentBySpecies :: Species -> [Tool]
startingEquipmentBySpecies Anachronid = [sphere Radon]
@@ -61,6 +63,7 @@ startingEquipmentBySpecies Myrmidon = [sphere Krypton]
startingEquipmentBySpecies Perennial = [sphere Wood]
startingEquipmentBySpecies Recreant = [sphere Malignite]
startingEquipmentBySpecies Reptilian = [sphere Oxygen]
+startingEquipmentBySpecies DustVortex = []
dbCreateStartingPlane :: Creature -> DB PlaneRef
dbCreateStartingPlane creature =
View
2  roguestar-engine/src/Creature.hs
@@ -46,7 +46,7 @@ generateCreature faction species = generateAttributes faction species $ mconcat
generateInitialPlayerCreature :: Species -> DB ()
generateInitialPlayerCreature species =
do newc <- generateCreature Player species
- dbSetStartingRace species
+ dbSetStartingSpecies species
setPlayerState (ClassSelectionState newc)
-- |
View
9 roguestar-engine/src/CreatureAttribute.hs
@@ -28,12 +28,11 @@ x & y = CreatureAttribute $ Endo $ applyToCreature x . applyToCreature y
type CreatureAttributeGenerator = AttributeGenerator CreatureAttribute
-- |
--- Generate a ratio of males to females with any gender dimorphism.
--- 'gender (1%3) [attributeStatic 5 Speed] [attributeStatic 5 Mindfulness]' generates a
--- creature with a 1:2 male:female ratio, faster males, and more mindful females.
+-- Generate a ratio of males to females.
--
-gender :: Rational -> [CreatureAttributeGenerator] -> [CreatureAttributeGenerator] -> CreatureAttributeGenerator
-gender r male_dimorphism female_dimorphism = AG.attributeChoice r (CreatureAttribute.attributeStatic 1 Male:male_dimorphism) (CreatureAttribute.attributeStatic 1 Female:female_dimorphism)
+gender :: Rational -> CreatureAttributeGenerator
+gender r = AG.attributeChoice r [CreatureAttribute.attributeStatic 1 Male]
+ [CreatureAttribute.attributeStatic 1 Female]
attributeStatic :: (CreatureEndo a) => Integer -> a -> CreatureAttributeGenerator
attributeStatic n a = AG.attributeStatic n (CreatureAttribute $ Endo $ applyToCreature a)
View
22 roguestar-engine/src/DB.hs
@@ -39,8 +39,8 @@ module DB
dbGetAncestors,
dbWhere,
dbGetContents,
- dbSetStartingRace,
- dbGetStartingRace,
+ dbSetStartingSpecies,
+ dbGetStartingSpecies,
ro, atomic,
logDB,
mapRO, filterRO, sortByRO,
@@ -89,7 +89,7 @@ data DB_History = DB_History {
data DB_BaseType = DB_BaseType { db_player_state :: PlayerState,
db_next_object_ref :: Integer,
- db_starting_race :: Maybe Species,
+ db_starting_species :: Maybe Species,
db_creatures :: Map CreatureRef Creature,
db_planes :: Map PlaneRef Plane,
db_tools :: Map ToolRef Tool,
@@ -212,9 +212,9 @@ atomic action ro_action =
--
initial_db :: DB_BaseType
initial_db = DB_BaseType {
- db_player_state = RaceSelectionState,
+ db_player_state = SpeciesSelectionState,
db_next_object_ref = 0,
- db_starting_race = Nothing,
+ db_starting_species = Nothing,
db_creatures = Map.fromList [],
db_planes = Map.fromList [],
db_tools = Map.fromList [],
@@ -568,16 +568,16 @@ dbNextTurn refs =
Map.lookup (generalizeReference r) (db_time_coordinates db))) refs)
-- |
--- Answers the starting race.
+-- Answers the starting species.
--
-dbGetStartingRace :: DB (Maybe Species)
-dbGetStartingRace = do gets db_starting_race
+dbGetStartingSpecies :: DB (Maybe Species)
+dbGetStartingSpecies = do gets db_starting_species
-- |
--- Sets the starting race.
+-- Sets the starting species.
--
-dbSetStartingRace :: Species -> DB ()
-dbSetStartingRace the_species = modify (\db -> db { db_starting_race = Just the_species })
+dbSetStartingSpecies :: Species -> DB ()
+dbSetStartingSpecies the_species = modify (\db -> db { db_starting_species = Just the_species })
-- |
-- Takes a snapshot of a SnapshotEvent in progress.
View
2  roguestar-engine/src/DBErrorFlag.hs
@@ -6,7 +6,7 @@ data ErrorFlag =
BuildingApproachWrongAngle -- some buildings (like stargates) are sensitive to the angle of approach
| NothingAtFeet -- tried to pick something up, but there is nothing at your feet
| NothingInInventory -- tried to perform an inventory action, but your inventory is empty
- | NotStanding -- the player is not standing on anything (e.g. race selection state)
+ | NotStanding -- the player is not standing on anything (e.g. species selection state)
| NoStargateAddress -- tried to move through the stargate network, but there was no destination
| NoToolWielded -- tried to perform an action that requires a wielded tool
| ToolIs_NotAtFeet -- tried to pick something up, but it isn't at your feet
View
2  roguestar-engine/src/Main.hs
@@ -13,8 +13,6 @@ import Data.Version
import Paths_roguestar_engine
import Data.List (intersperse)
import System.Log.Logger
-import Logging
-import Control.Monad
roguestar_version_number :: String
roguestar_version_number = concat $
View
4 roguestar-engine/src/PlayerState.hs
@@ -15,7 +15,7 @@ import MakeData
import TravelData
data PlayerState =
- RaceSelectionState
+ SpeciesSelectionState
| ClassSelectionState Creature
| PlayerCreatureTurn CreatureRef CreatureTurnMode
| SnapshotEvent SnapshotEvent
@@ -83,7 +83,7 @@ creatureOf state = case state of
SnapshotEvent event -> subjectOf event
GameOver -> Nothing
ClassSelectionState {} -> Nothing
- RaceSelectionState {} -> Nothing
+ SpeciesSelectionState {} -> Nothing
-- | Get the subject creature of a 'SnapshotEvent', that is, the creature taking action.
subjectOf :: SnapshotEvent -> Maybe CreatureRef
View
34 roguestar-engine/src/Protocol.hs
@@ -132,13 +132,13 @@ dbOldestSnapshotOnly =
-- Perform an action assuming the database is in the DBRaceSelectionState,
-- otherwise returns an error message.
--
-dbRequiresRaceSelectionState :: (DBReadable db) => db a -> db a
-dbRequiresRaceSelectionState action =
+dbRequiresSpeciesSelectionState :: (DBReadable db) => db a -> db a
+dbRequiresSpeciesSelectionState action =
do dbOldestSnapshotOnly
state <- playerState
case state of
- RaceSelectionState -> action
- _ -> throwError $ DBError $ "protocol-error: not in race selection state (" ++ show state ++ ")"
+ SpeciesSelectionState -> action
+ _ -> throwError $ DBError $ "protocol-error: not in species selection state (" ++ show state ++ ")"
-- |
-- Perform an action assuming the database is in the DBClassSelectionState,
@@ -215,7 +215,7 @@ dbDispatchQuery :: (DBReadable db) => [B.ByteString] -> db B.ByteString
dbDispatchQuery ["state"] =
do state <- playerState
return $ case state of
- RaceSelectionState -> "answer: state race-selection"
+ SpeciesSelectionState -> "answer: state species-selection"
ClassSelectionState {} -> "answer: state class-selection"
PlayerCreatureTurn _ NormalMode -> "answer: state player-turn"
PlayerCreatureTurn _ MoveMode -> "answer: state move"
@@ -320,9 +320,9 @@ dbDispatchQuery ["new-character-class"] =
SnapshotEvent event -> "answer: new-character-class " `B.append` maybe "nothing" (B.pack . show) (bump_event_new_class event)
_ -> "answer: new-character-class nothing"
-dbDispatchQuery ["player-races","0"] =
- return ("begin-table player-races 0 name\n" `B.append`
- B.unlines (map B.pack player_race_names) `B.append`
+dbDispatchQuery ["player-species","0"] =
+ return ("begin-table player-species 0 name\n" `B.append`
+ B.unlines (map B.pack player_species_names) `B.append`
"end-table")
dbDispatchQuery ["visible-terrain","0"] =
@@ -489,11 +489,11 @@ dbDispatchQuery unrecognized = return $ "protocol-error: unrecognized query `" `
dbDispatchAction :: [B.ByteString] -> DB ()
dbDispatchAction ["continue"] = dbPopOldestSnapshot
-dbDispatchAction ["select-race",race_name] =
- dbRequiresRaceSelectionState $ dbSelectPlayerRace race_name
+dbDispatchAction ["select-species",species_name] =
+ dbRequiresSpeciesSelectionState $ dbSelectPlayerRace species_name
dbDispatchAction ["reroll"] =
- dbRequiresClassSelectionState $ dbRerollRace
+ dbRequiresClassSelectionState $ dbRerollSpecies
dbDispatchAction ["select-class",class_name] =
dbRequiresClassSelectionState $ dbSelectPlayerClass class_name
@@ -645,9 +645,9 @@ dbDispatchAction ["up"] =
dbDispatchAction unrecognized = throwError $ DBError $ ("protocol-error: unrecognized action `" ++ (B.unpack $ B.unwords unrecognized) ++ "`")
dbSelectPlayerRace :: B.ByteString -> DB ()
-dbSelectPlayerRace race_name =
- case find (\s -> B.map toLower (B.pack $ show s) == race_name) player_species of
- Nothing -> throwError $ DBError $ "protocol-error: unrecognized race '" ++ B.unpack race_name ++ "'"
+dbSelectPlayerRace species_name =
+ case find (\s -> B.map toLower (B.pack $ show s) == species_name) player_species of
+ Nothing -> throwError $ DBError $ "protocol-error: unrecognized species '" ++ B.unpack species_name ++ "'"
Just species -> generateInitialPlayerCreature species
dbSelectPlayerClass :: B.ByteString -> Creature -> DB ()
@@ -657,9 +657,9 @@ dbSelectPlayerClass class_name creature =
Nothing -> throwError $ DBError $ "protocol-error: unrecognized or invalid class '" ++ B.unpack class_name ++ "'"
Just the_class -> dbBeginGame creature the_class
-dbRerollRace :: Creature -> DB ()
-dbRerollRace _ = do starting_race <- dbGetStartingRace
- generateInitialPlayerCreature $ fromJust starting_race
+dbRerollSpecies :: Creature -> DB ()
+dbRerollSpecies _ = do starting_species <- dbGetStartingSpecies
+ generateInitialPlayerCreature $ fromJust starting_species
dbQueryPlayerStats :: (DBReadable db) => Creature -> db B.ByteString
dbQueryPlayerStats creature = return $ playerStatsTable creature
View
32 roguestar-engine/src/Species.hs
@@ -1,6 +1,6 @@
module Species
- (player_race_names,
+ (player_species_names,
SpeciesData(..),
speciesInfo)
where
@@ -13,8 +13,8 @@ import CreatureAttribute
import Data.Monoid
import TerrainData
-player_race_names :: [String]
-player_race_names = map (map toLower . show) player_species
+player_species_names :: [String]
+player_species_names = map (map toLower . show) player_species
data SpeciesData = SpeciesData {
species_recurring_attributes :: CreatureAttribute,
@@ -33,12 +33,10 @@ surpriseAptitudes = mconcat $ map (\a -> attributeChoice 0.05 [attributeMinMax (
speciesInfo :: Species -> SpeciesData
speciesInfo Anachronid = SpeciesData (Speed & Mindfulness & SpotSkill) [
- gender 0.8
- [aptitudeBlock 1 10 [Speed,Mindfulness],
- attributeStatic 2 SpotSkill]
- [aptitudeBlock 10 25 [Speed,Mindfulness],
- attributeStatic 15 SpotSkill,
- surpriseAptitudes],
+ gender 0.0,
+ aptitudeBlock 10 25 [Speed,Mindfulness],
+ attributeStatic 15 SpotSkill,
+ surpriseAptitudes,
attributeStatic 1 $ FavoredClass Barbarian,
attributeStatic 1 $ FavoredClass Pirate]
@@ -47,7 +45,7 @@ speciesInfo Androsynth = SpeciesData (Strength & Intellect) [
attributeStatic 1 $ FavoredClass Engineer]
speciesInfo Ascendant = SpeciesData (Strength & Mindfulness) [
- gender 0.45 [] [],
+ gender 0.5,
aptitudeBlock 5 15 [Strength,Mindfulness],
surpriseAptitudes,
attributeStatic 10 JumpSkill,
@@ -55,7 +53,7 @@ speciesInfo Ascendant = SpeciesData (Strength & Mindfulness) [
attributeStatic 1 $ FavoredClass ForceAdept]
speciesInfo Caduceator = SpeciesData (Strength & Charisma) [
- gender 0.6 [] [],
+ gender 0.5,
aptitudeBlock 5 15 [Strength,Charisma],
surpriseAptitudes,
attributeStatic 1 $ FavoredClass Consular]
@@ -66,12 +64,12 @@ speciesInfo DustVortex = SpeciesData (Speed & Mindfulness) [
attributeStatic 1 $ FavoredClass Barbarian]
speciesInfo Encephalon = SpeciesData (Constitution & Intellect) [
- gender 0.95 [] [],
+ gender 0.5,
aptitudeBlock 3 20 [Constitution,Intellect],
attributeStatic 1 $ FavoredClass Engineer]
speciesInfo Hellion = SpeciesData (Strength & Perception) [
- gender 0.5 [] [],
+ gender 0.5,
aptitudeBlock 5 15 [Strength,Perception],
surpriseAptitudes,
attributeStatic 5 $ HideSkill,
@@ -81,7 +79,7 @@ speciesInfo Hellion = SpeciesData (Strength & Perception) [
attributeStatic 1 $ FavoredClass Pirate]
speciesInfo Goliath = SpeciesData (Constitution & Perception) [
- gender 0.55 [] [],
+ gender 0.5,
aptitudeBlock 3 20 [Constitution,Perception],
surpriseAptitudes,
attributeStatic 4 $ DamageReductionTrait Melee,
@@ -92,14 +90,14 @@ speciesInfo Goliath = SpeciesData (Constitution & Perception) [
attributeStatic 1 $ FavoredClass Scout]
speciesInfo Kraken = SpeciesData (Constitution & Charisma) [
- gender 0.5 [] [],
+ gender 0.5,
aptitudeBlock 3 20 [Constitution,Charisma],
attributeStatic 1 $ TerrainAffinity Water,
surpriseAptitudes,
attributeStatic 1 $ FavoredClass Consular]
speciesInfo Myrmidon = SpeciesData (Speed & Intellect) [
- gender 0.0 [] [],
+ gender 0.0,
aptitudeBlock 5 15 [Speed,Intellect],
surpriseAptitudes,
attributeStatic 1 $ FavoredClass Barbarian,
@@ -127,7 +125,7 @@ speciesInfo Recreant = SpeciesData (Speed & Perception) [
attributeStatic 1 $ FavoredClass Scout]
speciesInfo Reptilian = SpeciesData (Speed & Charisma) [
- gender 0.35 [] [],
+ gender 0.5,
aptitudeBlock 5 15 [Speed,Charisma],
surpriseAptitudes,
attributeStatic 5 $ AttackSkill Unarmed,
View
46 roguestar-gl/src/Actions.hs
@@ -6,7 +6,7 @@ module Actions
(takeUserInputAction,
getValidActions,
ActionInput(..),
- select_race_action_names,
+ select_species_action_names,
select_base_class_action_names,
make_what_action_names,
executeContinueAction,
@@ -102,7 +102,7 @@ executeContinueAction action_input =
-- In this case the action executes because the state is actually select-person-to-call-state and Carl
-- is actually listed under the "name" header of the "people" table.
--
--- In practice this function is used for things like the race-selection-state and the class-selection-state
+-- In practice this function is used for things like the species-selection-state and the class-selection-state
-- where we select from a predifined list of possible choices, but the engine further restricts the choices.
-- Each possible choice is it's own action that will only return action_valid if it is listed in the appropriate
-- table from the engine.
@@ -149,7 +149,7 @@ player_turn_states :: [B.ByteString]
player_turn_states = ["player-turn","move","attack","fire","jump","turn","clear-terrain"]
menu_states :: [B.ByteString]
-menu_states = ["race-selection","class-selection","pickup","drop","wield","make","make-finished","make-what"]
+menu_states = ["species-selection","class-selection","pickup","drop","wield","make","make-finished","make-what"]
selectable_menu_states :: [B.ByteString]
selectable_menu_states = if all (`elem` menu_states) states then states else error "selectable_menu_states: inconsistent with menu_states"
@@ -241,9 +241,9 @@ make_what_actions = map makeWhatAction make_what_action_names
make_end_action :: (B.ByteString,Action)
make_end_action = stateLinkedAction ["make-finished"] "make-end"
-selectRaceAction :: B.ByteString -> (B.ByteString,Action)
-selectRaceAction s =
- (s,selectTableAction ("player-races","0","name") "race-selection" "select-race" s)
+selectSpeciesAction :: B.ByteString -> (B.ByteString,Action)
+selectSpeciesAction s =
+ (s,selectTableAction ("player-species","0","name") "species-selection" "select-species" s)
selectBaseClassAction :: B.ByteString -> (B.ByteString,Action)
selectBaseClassAction s =
@@ -307,22 +307,22 @@ quality_super = setQualityAction Super
Lists of Known Actions
----------------------------------------------------------}
-select_race_action_names :: [B.ByteString]
-select_race_action_names = [--"anachronid",
- "androsynth",
- "ascendant",
- "caduceator",
- "encephalon",
- --"goliath",
- "hellion",
- --"kraken",
- --"myrmidon",
- --"perennial",
- "recreant",
- "reptilian"]
-
-select_race_actions :: [(B.ByteString,Action)]
-select_race_actions = map selectRaceAction select_race_action_names
+select_species_action_names :: [B.ByteString]
+select_species_action_names = [--"anachronid",
+ "androsynth",
+ "ascendant",
+ "caduceator",
+ "encephalon",
+ --"goliath",
+ "hellion",
+ --"kraken",
+ --"myrmidon",
+ --"perennial",
+ "recreant",
+ "reptilian"]
+
+select_species_actions :: [(B.ByteString,Action)]
+select_species_actions = map selectSpeciesAction select_species_action_names
select_base_class_action_names :: [B.ByteString]
select_base_class_action_names = ["barbarian",
@@ -347,7 +347,7 @@ all_actions = [continue_action,quit_action,reroll_action,
next_action,prev_action,normal_action,select_menu_action,
zoom_in_action,zoom_out_action,sky_on_action,sky_off_action,
quality_bad,quality_poor,quality_good,quality_super] ++
- select_race_actions ++
+ select_species_actions ++
select_base_class_actions ++
direction_actions ++
make_what_actions ++
View
10 roguestar-gl/src/AnimationMenus.hs
@@ -24,7 +24,7 @@ type MenuHandler e m = FRP e (MenuSwitch m) () SceneLayerInfo
-- Header for menu states. This will automatically switch away to an approprate menu if the provided state predicate does not match.
menuStateHeader :: (FRPModel m) => (B.ByteString -> Bool) -> MenuHandler e m
menuStateHeader f = genericStateHeader switchTo f >>> arr (const $ roguestarSceneLayerInfo mempty basic_camera)
- where switchTo "race-selection" = menuRaceSelection
+ where switchTo "species-selection" = menuSpeciesSelection
switchTo "class-selection" = menuClassSelection
switchTo "pickup" = toolMenuSelection
switchTo "drop" = toolMenuSelection
@@ -37,12 +37,12 @@ menuStateHeader f = genericStateHeader switchTo f >>> arr (const $ roguestarScen
menuDispatch :: (FRPModel m) => MenuHandler e m
menuDispatch = menuStateHeader (const False) >>> arr (const $ roguestarSceneLayerInfo mempty basic_camera)
-menuRaceSelection :: (FRPModel m) => MenuHandler e m
-menuRaceSelection = proc s ->
- do result <- menuStateHeader (== "race-selection") -< s
+menuSpeciesSelection :: (FRPModel m) => MenuHandler e m
+menuSpeciesSelection = proc s ->
+ do result <- menuStateHeader (== "species-selection") -< s
requestPrintTextMode -< Unlimited
clearPrintTextA -< Just ()
- printMenuA select_race_action_names -< ()
+ printMenuA select_species_action_names -< ()
printTextA -< Just (Query,"Select a Species:")
returnA -< result
Please sign in to comment.
Something went wrong with that request. Please try again.