Linting
This commit is contained in:
+50
-45
@@ -24,31 +24,34 @@ import qualified Data.Set as S
|
||||
import Data.Graph.Inductive.Graph hiding ((&))
|
||||
import Data.List
|
||||
|
||||
defaultWall = Wall { _wlLine = [(0,0),(50,0)]
|
||||
, _wlID = 0
|
||||
, _wlColor = greyN 0.6
|
||||
, _wlDraw = Nothing
|
||||
, _wlSeen = False
|
||||
, _wlIsSeeThrough = False
|
||||
}
|
||||
defaultAutoDoor = Door { _wlLine = [(0,0),(50,0)]
|
||||
, _wlID = 0
|
||||
, _doorMech = id
|
||||
, _wlColor = light $ dim $ dim $ dim $ yellow
|
||||
, _wlDraw = Nothing
|
||||
, _wlSeen = False
|
||||
, _wlIsSeeThrough = False
|
||||
, _doorPathable = True
|
||||
}
|
||||
defaultDoor = Door { _wlLine = [(0,0),(50,0)]
|
||||
, _wlID = 0
|
||||
, _doorMech = id
|
||||
, _wlColor = light $ dim $ dim $ dim $ yellow
|
||||
, _wlDraw = Nothing
|
||||
, _wlSeen = False
|
||||
, _wlIsSeeThrough = False
|
||||
, _doorPathable = False
|
||||
}
|
||||
defaultWall = Wall
|
||||
{ _wlLine = [(0,0),(50,0)]
|
||||
, _wlID = 0
|
||||
, _wlColor = greyN 0.6
|
||||
, _wlDraw = Nothing
|
||||
, _wlSeen = False
|
||||
, _wlIsSeeThrough = False
|
||||
}
|
||||
defaultAutoDoor = Door
|
||||
{ _wlLine = [(0,0),(50,0)]
|
||||
, _wlID = 0
|
||||
, _doorMech = id
|
||||
, _wlColor = light $ dim $ dim $ dim $ yellow
|
||||
, _wlDraw = Nothing
|
||||
, _wlSeen = False
|
||||
, _wlIsSeeThrough = False
|
||||
, _doorPathable = True
|
||||
}
|
||||
defaultDoor = Door
|
||||
{ _wlLine = [(0,0),(50,0)]
|
||||
, _wlID = 0
|
||||
, _doorMech = id
|
||||
, _wlColor = light $ dim $ dim $ dim $ yellow
|
||||
, _wlDraw = Nothing
|
||||
, _wlSeen = False
|
||||
, _wlIsSeeThrough = False
|
||||
, _doorPathable = False
|
||||
}
|
||||
defaultCreature :: Creature
|
||||
defaultCreature = Creature
|
||||
{ _crPos = (0,0)
|
||||
@@ -68,14 +71,15 @@ defaultCreature = Creature
|
||||
, _crCorpse = onLayer CorpseLayer $ color (greyN 0.5) $ circleSolid 10
|
||||
, _crIsAnimate = True
|
||||
}
|
||||
defaultState = CrSt { _goals = []
|
||||
, _stance = Stance {_carriage=Walking 0 0,_posture=AtEase}
|
||||
, _faction = NoFaction
|
||||
, _crDamage = []
|
||||
, _crPastDamage = 0
|
||||
, _crSpState = GenCr
|
||||
, _crApplyDamage = defaultApplyDamage'
|
||||
}
|
||||
defaultState = CrSt
|
||||
{ _goals = []
|
||||
, _stance = Stance {_carriage=Walking 0 0,_posture=AtEase}
|
||||
, _faction = NoFaction
|
||||
, _crDamage = []
|
||||
, _crPastDamage = 0
|
||||
, _crSpState = GenCr
|
||||
, _crApplyDamage = defaultApplyDamage
|
||||
}
|
||||
defaultEquipment = Equipment
|
||||
{ _itIdentity = Generic
|
||||
, _itName = "genericEquipment"
|
||||
@@ -108,16 +112,17 @@ defaultConsumable = Consumable
|
||||
, _itEffect = wpRecock
|
||||
, _itHammer = HammerUp
|
||||
}
|
||||
defaultApplyDamage' :: [DamageType] -> Creature -> (World -> World, Creature)
|
||||
defaultApplyDamage' ds cr = (id, doPoisonDam $ foldr (\d c -> snd $ defaultApplyDamage d c) cr ds')
|
||||
where (ps,ds') = partition isPoison ds
|
||||
isPoison (PoisonDam {}) = True
|
||||
isPoison _ = False
|
||||
poisonDam = quot (max 0 (sum (map _dmAmount ps) - 0)) 10
|
||||
doPoisonDam = over crHP (\hp -> hp - poisonDam)
|
||||
defaultApplyDamage :: [DamageType] -> Creature -> (World -> World, Creature)
|
||||
defaultApplyDamage ds cr = (id, doPoisonDam $ foldr (\d c -> snd $ applyIndividualDamage d c) cr ds')
|
||||
where
|
||||
(ps,ds') = partition isPoison ds
|
||||
isPoison (PoisonDam {}) = True
|
||||
isPoison _ = False
|
||||
poisonDam = quot (max 0 (sum (map _dmAmount ps))) 10
|
||||
doPoisonDam = over crHP (\hp -> hp - poisonDam)
|
||||
|
||||
defaultApplyDamage :: DamageType -> Creature -> (World -> World, Creature)
|
||||
defaultApplyDamage (Concussive amount from push pushexp pushRad) cr
|
||||
applyIndividualDamage :: DamageType -> Creature -> (World -> World, Creature)
|
||||
applyIndividualDamage (Concussive amount from push pushexp pushRad) cr
|
||||
= ( id
|
||||
, over crHP (\hp -> hp - amount)
|
||||
$ over crPos (+.+ (pushAmount *.* safeNormalizeV (_crPos cr -.- from)))
|
||||
@@ -127,14 +132,14 @@ defaultApplyDamage (Concussive amount from push pushexp pushRad) cr
|
||||
= 0
|
||||
| otherwise = min 5 $
|
||||
(push*5*pushRad / (dist (_crPos cr) from * _crMass cr))**pushexp
|
||||
defaultApplyDamage (TorqueDam amount rot) cr
|
||||
applyIndividualDamage (TorqueDam amount rot) cr
|
||||
= ( id
|
||||
, over crHP (\hp -> hp - amount) $ over crDir (+ rot) cr)
|
||||
defaultApplyDamage (PushDam amount pback) cr
|
||||
applyIndividualDamage (PushDam amount pback) cr
|
||||
= ( id
|
||||
, over crHP (\hp -> hp - amount) $ over crPos (+.+ ((1/_crMass cr) *.* pback )) cr
|
||||
)
|
||||
defaultApplyDamage dt cr
|
||||
applyIndividualDamage dt cr
|
||||
= ( id , over crHP (\hp -> hp - _dmAmount dt) cr )
|
||||
defaultFlIt = FlIt {_flItRot=0,_flIt = defaultIt, _flItPos = (0,0), _flItID = 0}
|
||||
defaultIt = Consumable
|
||||
|
||||
Reference in New Issue
Block a user