Changes how outcomes of attempts (such as combat) are decided. Probabilities...

Changes how outcomes of attempts (such as combat) are decided.  Probabilities are precomputed and then the outcome of chosen randomly from that list of probabilities (as opposed to deciding based on ad-hoc code for each kind of attempt).
parent 7a1e9ce0
......@@ -25,16 +25,13 @@ resolveActivation creature_ref =
case tool of
DeviceTool {} -> throwError $ DBErrorFlag ToolIs_Innapropriate
Sphere (ChromaliteSubstance c) ->
do x <- linearRoll $ chromalitePotency c
return $ if x == 0 then ExpendTool tool_ref $ NoEffect
else Heal creature_ref x
do weightedPickM $ weightedSet [(1, ExpendTool tool_ref $ NoEffect),
(chromaliteValue c, Heal creature_ref $ chromaliteValue c)]
Sphere (MaterialSubstance m) ->
do x <- linearRoll $ material_construction_value $ materialValue m
return $ ExpendTool tool_ref $ Heal creature_ref x
do return $ ExpendTool tool_ref $ Heal creature_ref $ materialValue m
Sphere (GasSubstance g) ->
do x <- linearRoll $ gasValue g
return $ if x == 0 then ExpendTool tool_ref $ Heal creature_ref 1
else Heal creature_ref 1
do weightedPickM $ weightedSet [(1, ExpendTool tool_ref $ NoEffect),
(gasValue g, Heal creature_ref 1)]
executeActivation :: ActivationOutcome -> DB ()
executeActivation (NoEffect) = return ()
......
......@@ -135,14 +135,14 @@ dbBehave_ (Drop tool_ref) creature_ref =
dbBehave_ (Fire face) creature_ref =
do _ <- move creature_ref =<< turnCreature face creature_ref
ranged_attack_model <- rangedAttackModel creature_ref
_ <- atomic executeAttack $ resolveAttack ranged_attack_model face
_ <- atomic executeAttackChain $ resolveAttackChain ranged_attack_model (Left face)
dbAdvanceTime creature_ref =<< quickActionTime creature_ref
return ()
dbBehave_ (Attack face) creature_ref =
do _ <- move creature_ref =<< turnCreature face creature_ref
melee_attack_model <- meleeAttackModel creature_ref
_ <- atomic executeAttack $ resolveAttack melee_attack_model face
_ <- atomic executeAttackChain $ resolveAttackChain melee_attack_model (Left face)
dbAdvanceTime creature_ref =<< quickActionTime creature_ref
return ()
......
This diff is collapsed.
module Roguestar.Lib.Behavior.DeviceActivation
(DeviceActivationOutcomeType(..),
DeviceActivationOutcome(..),
resolveDeviceActivation)
where
import Roguestar.Lib.DB
import Roguestar.Lib.Creature
import Roguestar.Lib.CreatureData
import Roguestar.Lib.ToolData
import Data.Ratio
data DeviceActivationOutcomeType =
DeviceActivated
| DeviceFailed
| DeviceCriticalFailed
data DeviceActivationOutcome = DeviceActivationOutcome {
dao_outcome_type :: DeviceActivationOutcomeType,
dao_skill_roll :: Integer,
dao_energy :: Integer,
dao_activation_time :: Rational }
-- | Given a device, and a primary and secondary roll, determine the outcome of activating the device.
-- The better the primary roll, the less likely that the device will fail, while the better the secondary
-- roll, the more energy the device will output.
resolveDeviceActivation :: (DBReadable db,DeviceType d) => CreatureAbility -> CreatureAbility -> CreatureAbility -> d -> CreatureRef -> db DeviceActivationOutcome
resolveDeviceActivation primary_ability secondary_ability timing_ability device creature_ref =
do primary_roll <- rollCreatureAbilityScore primary_ability (deviceAccuracy device) creature_ref
secondary_roll <- rollCreatureAbilityScore secondary_ability (deviceOutput device) creature_ref
timing_roll <- rollCreatureAbilityScore timing_ability (deviceSpeed device) creature_ref
let timing = roll_ideal secondary_roll % (roll_ideal timing_roll + roll_ideal secondary_roll)
daoF = case () of
() | roll_actual primary_roll == 0 -> DeviceActivationOutcome DeviceCriticalFailed 0 (deviceOutput device * deviceSize device)
() | roll_actual primary_roll <= deviceSize device -> DeviceActivationOutcome DeviceFailed (roll_actual primary_roll) (deviceOutput device)
() | otherwise -> DeviceActivationOutcome DeviceActivated (roll_actual primary_roll * deviceSize device) (roll_actual secondary_roll)
return $ daoF timing
......@@ -124,14 +124,17 @@ data TeleportJumpOutcome =
resolveTeleportJump :: (DBReadable db) => CreatureRef -> Facing -> db TeleportJumpOutcome
resolveTeleportJump creature_ref face = liftM (fromMaybe TeleportJumpFailed) $ runMaybeT $
do start_location <- lift $ DetailedTravel.whereIs creature_ref
jump_roll <- liftM roll_log $ lift $ rollCreatureAbilityScore JumpSkill 0 creature_ref
landing_position <- lift $ randomTeleportLanding jump_roll (asParent $ detail start_location) (detail start_location) $
offsetPosition (facingToRelative7 face) $ detail start_location
case () of
() | jump_roll <= 0 -> return TeleportJumpFailed
() | otherwise -> return $ TeleportJumpGood creature_ref $ Standing { standing_plane = asParent (detail start_location),
standing_position = landing_position,
standing_facing = face }
jump_roll <- lift $ getCreatureAbilityScore JumpSkill creature_ref
landing_position <- lift $ randomTeleportLanding (jump_roll `div` 5 + 1)
(asParent $ detail start_location)
(detail start_location) $
offsetPosition (facingToRelative7 face) $ detail start_location
let good = TeleportJumpGood creature_ref $ Standing { standing_plane = asParent (detail start_location),
standing_position = landing_position,
standing_facing = face }
bad = TeleportJumpFailed
lift $ weightedPickM $ weightedSet [(jump_roll,good),
(5,bad)]
-- | Execute a resolved teleport jump.
executeTeleportJump :: TeleportJumpOutcome -> DB ()
......
......@@ -3,9 +3,8 @@
module Roguestar.Lib.Creature
(generateInitialPlayerCreature,
newCreature,
Roll(..),
RollComponents(..),
rollCreatureAbilityScore,
getCreatureSpecial,
getCreatureAbilityScore,
getCurrentCreature,
getCreatureFaction,
injureCreature,
......@@ -30,6 +29,7 @@ import Roguestar.Lib.Core.Plane
import Roguestar.Lib.Data.PlayerState
import Roguestar.Lib.DetailedLocation
import Roguestar.Lib.Logging
import qualified Data.Set as Set
-- |
-- Generates a new Creature from the specified species.
......@@ -58,32 +58,14 @@ newCreature faction species loc =
do creature <- generateCreature faction species
dbAddCreature creature loc
data RollComponents = RollComponents {
component_base :: Integer,
component_other_situation_bonus :: Integer,
component_terrain_affinity_bonus :: Integer }
deriving (Show)
data Roll = Roll {
roll_ideal :: Integer,
roll_actual :: Integer,
roll_ideal_components :: RollComponents,
roll_actual_components :: RollComponents,
roll_log :: Integer }
deriving (Show)
getCreatureSpecial :: (DBReadable db) => CreatureSpecial -> CreatureRef -> db Bool
getCreatureSpecial special creature_ref = liftM (Set.member special . creature_specials) $ dbGetCreature creature_ref
rollCreatureAbilityScore :: (DBReadable db) => CreatureAbility -> Integer -> CreatureRef -> db Roll
rollCreatureAbilityScore score other_ideal creature_ref =
do raw_ideal <- liftM (creatureAbilityScore score) $ dbGetCreature creature_ref
getCreatureAbilityScore :: (DBReadable db) => CreatureAbility -> CreatureRef -> db Integer
getCreatureAbilityScore ability creature_ref =
do raw_ideal <- liftM (creatureAbilityScore ability) $ dbGetCreature creature_ref
terrain_ideal <- getTerrainAffinity creature_ref
let ideal = raw_ideal + other_ideal + terrain_ideal
actual <- linearRoll ideal
[raw_actual, other_actual, terrain_actual] <- fixedSumLinearRoll [raw_ideal, other_ideal, terrain_ideal] actual
logarithmic <- logRoll ideal
let result = Roll ideal (if raw_actual == 0 then 0 else actual)
(RollComponents raw_ideal other_ideal terrain_ideal)
(RollComponents raw_actual other_actual terrain_actual) logarithmic
logDB log_creature DEBUG $ "rollCreatureAbilityScore; result=" ++ show result
return result
return $ raw_ideal + terrain_ideal
-- | Ability bonus based on being good at working on specific types of terrain.
getTerrainAffinity :: (DBReadable db) => CreatureRef -> db Integer
......
......@@ -2,6 +2,7 @@
module Roguestar.Lib.CreatureData
(Creature(..),
CreatureTrait(..),
CreatureSpecial(..),
CreatureInteractionMode(..),
CreatureAbility(..),
CreatureEndo(..),
......@@ -18,10 +19,13 @@ import Data.Maybe
import Roguestar.Lib.FactionData
import Data.Monoid
import qualified Data.Map as Map
import qualified Data.Set as Set
import Data.List as List
import Roguestar.Lib.SpeciesData
import Roguestar.Lib.TerrainData
data Creature = Creature { creature_traits :: Map.Map CreatureTrait Integer,
creature_specials :: Set.Set CreatureSpecial,
creature_species :: Species,
creature_random_id :: Integer, -- random number attached to the creature, not unique
creature_damage :: Integer,
......@@ -34,6 +38,7 @@ data Creature = Creature { creature_traits :: Map.Map CreatureTrait Integer,
empty_creature :: Creature
empty_creature = Creature {
creature_traits = Map.empty,
creature_specials = Set.empty,
creature_species = error "empty_creature: undefined creature_species",
creature_random_id = error "empty_creature: undefined creature_random_id",
creature_damage = 0,
......@@ -80,6 +85,17 @@ instance CreatureEndo CreatureTrait where
instance CreatureScore CreatureTrait where
rawScore trait c = fromMaybe 0 $ Map.lookup trait (creature_traits c)
data CreatureSpecial =
Hover
| Teleportation
deriving (Eq,Read,Show,Ord)
instance CreatureEndo CreatureSpecial where
applyToCreature special c = c { creature_specials = Set.insert special $ creature_specials c }
instance CreatureScore CreatureSpecial where
rawScore special c = if Set.member special (creature_specials c) then 1 else 0
-- | Combat modes:
-- Melee is armed close-quarters combat with bladed or blunt weapons
-- Ranged is combat with projectile weapons
......@@ -94,7 +110,6 @@ data CreatureAbility =
| DefenseSkill CreatureInteractionMode
| DamageSkill CreatureInteractionMode
| DamageReductionTrait CreatureInteractionMode
| ReloadSkill CreatureInteractionMode
| TerrainAffinity Terrain
| HideSkill
| SpotSkill
......@@ -111,8 +126,8 @@ instance CreatureScore CharacterClass where
-- | Calculator to determine how many ranks a creature has in an ability.
-- Number of aptitude points plus n times number of ability points
figureAbility :: [CreatureTrait] -> Creature -> Integer
figureAbility traits c = round $ (realToFrac x :: Double) ** (1.0 / realToFrac (length traits))
where x = product (map ((+1) . flip rawScore c) traits)
figureAbility [] c = 1
figureAbility traits c = 1 + sum (map (flip rawScore c) traits) `div` List.genericLength traits
creatureAbilityScore :: CreatureAbility -> Creature -> Integer
creatureAbilityScore ToughnessTrait = figureAbility [Caution,Fortitude]
......@@ -120,7 +135,6 @@ creatureAbilityScore (AttackSkill _) = figureAbility [Aggression,Dexterity]
creatureAbilityScore (DefenseSkill _) = figureAbility [Caution,Dexterity]
creatureAbilityScore (DamageSkill _) = figureAbility [Aggression,Bulk]
creatureAbilityScore (DamageReductionTrait _) = figureAbility [Caution,Bulk]
creatureAbilityScore (ReloadSkill _) = figureAbility [Aggression,Speed]
creatureAbilityScore (TerrainAffinity _) = figureAbility []
creatureAbilityScore HideSkill = figureAbility [Aggression,Perception]
creatureAbilityScore SpotSkill = figureAbility [Caution,Perception]
......
......@@ -2,7 +2,6 @@
module Roguestar.Lib.HTML.Mustache (renderPage, roguestar_muconfig) where
import Text.Hastache
import Data.ByteString as BS
import Data.Text.Lazy as T
import Data.Aeson as Aeson
import Data.Attoparsec.Number as AesonNumber
......
......@@ -50,17 +50,17 @@ needsGas (PrepareMake _ _ _ Nothing) = True
needsGas _ = False
hasChromalite :: Tool -> Maybe Chromalite
hasChromalite (DeviceTool _ d) = Just $ deviceChromalite d
hasChromalite (DeviceTool _ d) = Just $ device_chromalite d
hasChromalite (Sphere (ChromaliteSubstance s)) = Just s
hasChromalite _ = Nothing
hasMaterial :: Tool -> Maybe Material
hasMaterial (DeviceTool _ d) = Just $ deviceMaterial d
hasMaterial (DeviceTool _ d) = Just $ device_material d
hasMaterial (Sphere (MaterialSubstance s)) = Just s
hasMaterial _ = Nothing
hasGas :: Tool -> Maybe Gas
hasGas (DeviceTool _ d) = Just $ deviceGas d
hasGas (DeviceTool _ d) = Just $ device_gas d
hasGas (Sphere (GasSubstance s)) = Just s
hasGas _ = Nothing
......
......@@ -120,10 +120,10 @@ createGame config game_state =
return new_uuid
retrieveGame :: BS.ByteString -> GameConfiguration -> GameState -> IO (Maybe Game)
retrieveGame uuid config game_state =
retrieveGame existing_uuid config game_state =
do cleanupGameState config game_state
atomically $
do m_g <- liftM (Map.lookup uuid) $ readTVar (game_state_gamelist game_state)
do m_g <- liftM (Map.lookup existing_uuid) $ readTVar (game_state_gamelist game_state)
case m_g of
Just g -> writeTVar (game_last_touched g) (game_config_current_clock_time_seconds config)
Nothing -> return ()
......
......@@ -9,9 +9,19 @@ import Roguestar.Lib.CreatureData
import Roguestar.Lib.SpeciesData
data SpeciesData = SpeciesData {
species_traits :: [(CreatureTrait,Integer)] }
species_traits :: [(CreatureTrait,Integer)],
species_specials :: [CreatureSpecial] }
speciesInfo :: Species -> SpeciesData
speciesInfo RedRecreant = SpeciesData [(Aggression,3),(Bulk,3),(Caution,3),(Dexterity,3),(Fortitude,2),(Perception,12),(Speed,2)]
speciesInfo BlueRecreant = SpeciesData [(Aggression,3),(Bulk,6),(Caution,6),(Dexterity,3),(Fortitude,25),(Perception,3),(Speed,4)]
speciesInfo RedRecreant = SpeciesData
[(Aggression, 5),
(Bulk, 1),
(Caution, 4),
(Dexterity, 4),
(Fortitude, 2),
(Perception, 5),
(Speed, 10)]
[Hover,
Teleportation]
speciesInfo BlueRecreant = speciesInfo RedRecreant
......@@ -6,7 +6,8 @@ module Roguestar.Lib.Substances
Chromalite(..),
Solid(..),
materialValue,
MaterialValue(..),
chromaliteValue,
gasValue,
Substance(..),
SubstanceType(toSubstance),
coerceSubstance,
......@@ -15,13 +16,9 @@ module Roguestar.Lib.Substances
isChromalite,
substances,
prettySubstance,
gasValue,
chromaliteAlignment,
chromalitePotency,
substanceValue)
where
import Roguestar.Lib.Alignment
import Data.Maybe
import qualified Data.Text as T
......@@ -44,8 +41,8 @@ prettySubstance (ChromaliteSubstance x) = T.pack $ show x
data Solid = MaterialSolid Material
| ChromaliteSolid Chromalite
deriving (Read,Show,Eq,Ord)
data Gas =
data Gas =
Water
| Hydrogen
| Helium
......@@ -61,8 +58,8 @@ data Gas =
| Ammonia
| Iodine
| Chlorine deriving (Eq,Enum,Ord,Show,Read,Bounded)
data Material =
data Material =
Aluminum
| Titanium
| Palladium
......@@ -87,14 +84,7 @@ data Material =
| Nickel
deriving (Eq,Enum,Ord,Show,Read,Bounded)
--
-- Chromalite is an engineered, crystaline metamaterial capable of storing many times it's own rest mass energy.
-- Precisely how many times is indicated by the chromalitePotency function.
--
-- Because any accidental release of this energy would obviously be catastrophic, chromalite is itself intelligent
-- and capable of adapting to stressful situations to avoid any such accidental release.
--
data Chromalite =
data Chromalite =
Rutilium -- red Chromalite
| Crudnium -- green Chromalite
| Pteulanium -- blue Chromalite
......@@ -130,52 +120,47 @@ gasValue Xenon = 60
gasValue Radon = 70
gasValue Iodine = 100
data MaterialValue = MaterialValue {
material_construction_value :: Integer, -- value of material for constructing buildings, pipes, casings for gadgets, etc
material_critical_value :: Integer, -- value of material for critical purposes, such as miniature electronic components
material_scarcity :: Integer } -- scarcity of material
materialValue :: Material -> MaterialValue
materialValue Aluminum = MaterialValue 50 20 6
materialValue Titanium = MaterialValue 70 15 15
materialValue Palladium = MaterialValue 30 30 65
materialValue Molybdenum = MaterialValue 18 55 40
materialValue Lead = MaterialValue 15 7 31
materialValue Copper = MaterialValue 40 40 18
materialValue Iron = MaterialValue 25 15 10
materialValue Cobalt = MaterialValue 30 35 30
materialValue Zirconium = MaterialValue 12 50 23
materialValue Gold = MaterialValue 20 35 83
materialValue Silver = MaterialValue 10 20 80
materialValue Platinum = MaterialValue 22 40 81
materialValue Zinc = MaterialValue 35 25 26
materialValue Uranium = MaterialValue 5 90 37
materialValue Plutonium = MaterialValue 1 100 100
materialValue Thorium = MaterialValue 20 80 33
materialValue Diamond = MaterialValue 100 100 90
materialValue Carbon = MaterialValue 60 20 20
materialValue Wood = MaterialValue 25 1 3
materialValue Plastic = MaterialValue 30 10 1
materialValue Silicon = MaterialValue 25 50 5
materialValue Nickel = MaterialValue 25 45 25
chromaliteAlignment :: Chromalite -> Alignment
chromaliteAlignment Rutilium = (Chaotic,Strategic)
chromaliteAlignment Crudnium = (Neutral,Strategic)
chromaliteAlignment Pteulanium = (Lawful,Strategic)
chromaliteAlignment Caerulite = (Lawful,Tactical)
chromaliteAlignment Ionidium = (Neutral,Tactical)
chromaliteAlignment Aurite = (Chaotic,Tactical)
chromaliteAlignment Argentate = (Lawful,Diplomatic)
chromaliteAlignment Trabanate = (Neutral,Diplomatic)
chromaliteAlignment Arumate = (Chaotic,Diplomatic)
chromaliteAlignment Candonium = (Lawful,Indifferent)
chromaliteAlignment Canitium = (Neutral,Indifferent)
chromaliteAlignment Infuscanoid = (Chaotic,Indifferent)
chromaliteAlignment Endurium = (Evil,Strategic)
chromaliteAlignment Malignite = (Evil,Tactical)
chromaliteAlignment Diabolite = (Evil,Diplomatic)
chromaliteAlignment Bectonite = (Evil,Indifferent)
materialValue :: Material -> Integer
materialValue Wood = 1
materialValue Plastic = 3
materialValue Lead = 5
materialValue Carbon = 8
materialValue Silicon = 9
materialValue Iron = 11
materialValue Zinc = 13
materialValue Palladium = 15
materialValue Nickel = 17
materialValue Aluminum = 19
materialValue Molybdenum = 22
materialValue Copper = 23
materialValue Silver = 25
materialValue Cobalt = 28
materialValue Titanium = 31
materialValue Gold = 39
materialValue Zirconium = 45
materialValue Platinum = 48
materialValue Thorium = 50
materialValue Uranium = 80
materialValue Plutonium = 90
materialValue Diamond = 100
chromaliteValue :: Chromalite -> Integer
chromaliteValue Rutilium = 14
chromaliteValue Crudnium = 16
chromaliteValue Pteulanium = 18
chromaliteValue Caerulite = 26
chromaliteValue Ionidium = 29
chromaliteValue Aurite = 32
chromaliteValue Argentate = 36
chromaliteValue Trabanate = 37
chromaliteValue Arumate = 46
chromaliteValue Candonium = 49
chromaliteValue Canitium = 55
chromaliteValue Infuscanoid = 65
chromaliteValue Endurium = 75
chromaliteValue Malignite = 85
chromaliteValue Diabolite = 95
chromaliteValue Bectonite = 100
class SubstanceType a where
toSubstance :: a -> Substance
......@@ -196,15 +181,14 @@ isChromalite = isJust . (`asTypeOf` (undefined :: Maybe Chromalite)) . coerceSub
substanceValue :: (SubstanceType a) => a -> Integer
substanceValue a = case toSubstance a of
GasSubstance x -> gasValue x + 10
MaterialSubstance x -> (nom + crit) * scarce
where MaterialValue nom crit scarce = materialValue x
ChromaliteSubstance x -> 1000 + 2 * chromalitePotency x ^ 2
MaterialSubstance x -> materialValue x * 10
ChromaliteSubstance x -> 1000 + chromaliteValue x * 100
instance SubstanceType Gas where
toSubstance = GasSubstance
fromSubstance (GasSubstance x) = Just x
fromSubstance _ = Nothing
instance SubstanceType Material where
toSubstance x = MaterialSubstance x
fromSubstance (MaterialSubstance x) = Just x
......@@ -226,5 +210,3 @@ instance SubstanceType Solid where
fromSubstance (ChromaliteSubstance x) = Just $ ChromaliteSolid x
fromSubstance _ = Nothing
chromalitePotency :: Chromalite -> Integer
chromalitePotency = alignmentPotency . chromaliteAlignment
......@@ -8,7 +8,7 @@ module Roguestar.Lib.Tool
availableWields,
getWielded,
deleteTool,
toolDurability)
toolValue)
where
import Prelude hiding (getContents)
......@@ -77,12 +77,10 @@ deleteTool :: ToolRef -> DB ()
deleteTool tool_ref = dbUnsafeDeleteObject tool_ref $
(error "deleteTool: impossible case: tools shouldn't contain anything" :: forall m. (DBReadable m) => Reference () -> m Planar)
toolDurability :: (DBReadable db) => ToolRef -> db Integer
toolDurability tool_ref =
toolValue :: (DBReadable db) => ToolRef -> db Integer
toolValue tool_ref =
do t <- dbGetTool tool_ref
return $ case t of
DeviceTool _ d -> deviceDurability d
Sphere (MaterialSubstance m) -> material_construction_value (materialValue m) + 10
Sphere (GasSubstance {}) -> 10
Sphere (ChromaliteSubstance {}) -> 110
DeviceTool _ d -> deviceValue d
Sphere substance -> substanceValue substance
......@@ -6,20 +6,11 @@ module Roguestar.Lib.ToolData
toolName,
fromSphere,
sphere,
Device,
PseudoDevice(..),
Device(..),
DeviceKind(..),
DeviceFunction(..),
DeviceType(..),
deviceName,
deviceOutput,
deviceAccuracy,
deviceSpeed,
deviceDurability,
deviceSize,
deviceChromalite,
deviceMaterial,
deviceGas,
deviceValue,
improvised,
phase_pistol,
phaser,
......@@ -75,30 +66,6 @@ data Device = Device {
device_size :: Integer }
deriving (Eq,Read,Show)
-- | Anything that operates like a device, but isn't. For example, an unarmed attack.
data PseudoDevice = PseudoDevice {
pdevice_accuracy :: Integer,
pdevice_output :: Integer,
pdevice_speed :: Integer,
pdevice_size :: Integer }
class DeviceType d where
toPseudoDevice :: d -> PseudoDevice
instance DeviceType Device where
toPseudoDevice d = let chromalite = chromalitePotency $ device_chromalite d
gas = gasValue $ device_gas d
material = material_critical_value $ materialValue $ device_material d
size = device_size d
in PseudoDevice {
pdevice_accuracy = min chromalite material + chromalite,
pdevice_output = min chromalite gas + chromalite,
pdevice_speed = gas + material,
pdevice_size = size }
instance DeviceType PseudoDevice where
toPseudoDevice = id
device :: T.Text -> DeviceKind -> Chromalite -> Material -> Gas -> Tool
device s dk c m g = DeviceTool func (Device s c m g size)
where (func,size) = kindToFunction dk
......@@ -124,26 +91,8 @@ kinetic_sabre = device "kinetic_sabre" Sabre Ionidium Aluminum Nitrogen
deviceName :: Device -> T.Text
deviceName = device_name
deviceDurability :: Device -> Integer
deviceDurability d = device_size d * (material_construction_value $ materialValue $ device_material d)
deviceOutput :: (DeviceType d) => d -> Integer
deviceOutput = pdevice_output . toPseudoDevice
deviceAccuracy :: (DeviceType d) => d -> Integer
deviceAccuracy = pdevice_accuracy . toPseudoDevice
deviceSpeed :: (DeviceType d) => d -> Integer
deviceSpeed = pdevice_speed . toPseudoDevice
deviceSize :: (DeviceType d) => d -> Integer
deviceSize = pdevice_size . toPseudoDevice
deviceChromalite :: Device -> Chromalite
deviceChromalite = device_chromalite
deviceMaterial :: Device -> Material
deviceMaterial = device_material
deviceValue :: Device -> Integer
deviceValue d = device_size d * (gasValue $ device_gas d) +
(materialValue $ device_material d) +
(chromaliteValue $ device_chromalite d)
deviceGas :: Device -> Gas
deviceGas = device_gas
......@@ -83,7 +83,7 @@ testSetPlayerState =
do setPlayerState (GameOver PlayerIsVictorious)
playerState
case m_pstate of
Left err -> assert False "testSetPlayerState (failed in monad)"
Left _ -> assert False "testSetPlayerState (failed in monad)"
Right (pstate,_) -> assertEqual pstate (GameOver PlayerIsVictorious) "testSetPlayerState"
testLocal :: UnitTest
......@@ -92,7 +92,7 @@ testLocal =
do local id $ setPlayerState (GameOver PlayerIsVictorious)
playerState
case m_pstate of
Left err -> assert False "testLocal (failed in monad)"
Left _ -> assert False "testLocal (failed in monad)"
Right (pstate,_) -> assertEqual pstate (SpeciesSelectionState Nothing) "testLocal"
testPickRandomClearSite :: UnitTest
......
......@@ -2,8 +2,6 @@
import Prelude
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BS8
import qualified Data.ByteString.Lazy as LBS
import qualified Data.ByteString.Lazy.Char8 as LBS8
import qualified Data.Text as T
import qualified Data.Text.Lazy as LT
......
......@@ -99,7 +99,6 @@ library
Roguestar.Lib.Behavior.Make,
Roguestar.Lib.Activate,
Roguestar.Lib.Contact,
Roguestar.Lib.Behavior.DeviceActivation,
Roguestar.Lib.Planet,
Roguestar.Lib.PlanetData,
Roguestar.Lib.Logging,
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="32"
height="32"
id="svg2"
version="1.1"
inkscape:version="0.48.3.1 r9886"
sodipodi:docname="bead-bright.svg">
<defs
id="defs4">
<linearGradient
id="linearGradient3884">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop3886" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop3888" />
</linearGradient>
<linearGradient
id="linearGradient3851">
<stop
style="stop-color:#ffffff;stop-opacity:0.77876109;"
offset="0"
id="stop3853" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop3855" />
</linearGradient>
<linearGradient
id="linearGradient3811">
<stop
style="stop-color:#ffffff;stop-opacity:0.50442475;"
offset="0"
id="stop3813" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop3815" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3811"
id="linearGradient3817"
x1="-7.3598676"
y1="-6.4650121"
x2="8.6924143"