Add basic booster
This commit is contained in:
@@ -57,18 +57,17 @@ blinkAction
|
||||
:: Creature
|
||||
-> World
|
||||
-> World
|
||||
blinkAction cr w
|
||||
= soundOnce teleSound
|
||||
. set (creatures . ix n . crPos) p3
|
||||
. blinkShockwave n p3
|
||||
$ inverseShockwaveAt cp 40 2 2 2 w
|
||||
blinkAction cr w = soundOnce teleSound
|
||||
. set (creatures . ix cid . crPos) p3
|
||||
. blinkShockwave cid p3
|
||||
$ inverseShockwaveAt cpos 40 2 2 2 w
|
||||
where
|
||||
n = _crID cr
|
||||
p1 = _cameraCenter w +.+ (1 / _cameraZoom w) *.* rotateV (_cameraRot w) (_mousePos w)
|
||||
cp = _crPos $ _creatures w IM.! n
|
||||
p2 = reflectPointWalls cp p1 $ wallsAlongLine cp p1 w
|
||||
r = 1.5 * _crRad (_creatures w IM.! n)
|
||||
p3 = maybe p1 ((\p -> moveAmountToward p r cp) . fst) p2
|
||||
cid = _crID cr
|
||||
p1 = mouseWorldPos w
|
||||
cpos = _crPos cr
|
||||
p2 = reflectPointWalls cpos p1 $ wallsAlongLine cpos p1 w
|
||||
r = 1.5 * _crRad cr
|
||||
p3 = maybe p1 (mvPointTowardAtSpeed r cpos . fst) p2
|
||||
|
||||
blinkShockwave
|
||||
:: Int -- ^ Blinking creature ID.
|
||||
@@ -77,14 +76,6 @@ blinkShockwave
|
||||
-> World
|
||||
blinkShockwave i p = makeShockwaveAt [i] p 60 1 2 cyan
|
||||
|
||||
moveAmountToward
|
||||
:: Point2 -- ^ Start point
|
||||
-> Float -- ^ Fraction to move along
|
||||
-> Point2 -- ^ End point
|
||||
-> Point2
|
||||
moveAmountToward p1 am p2
|
||||
= p1 +.+ am *.* errorNormalizeV 44 (p2 -.- p1)
|
||||
|
||||
{- | Get your creature to drop the item under the cursor. -}
|
||||
youDropItem :: World -> World
|
||||
youDropItem w = case yourItem w of
|
||||
|
||||
@@ -15,7 +15,7 @@ interpWith x a b = x *.* a +.+ (1 - x) *.* b
|
||||
|
||||
invertEncircleDistP :: Float -> Creature -> Point2 -> Creature -> Point2
|
||||
invertEncircleDistP d tcr cenp cr = ypos +.+
|
||||
d *.* (reflectIn (cenp -.- ypos) $ safeNormalizeV (cpos -.- cenp))
|
||||
d *.* reflectIn (cenp -.- ypos) (safeNormalizeV (cpos -.- cenp))
|
||||
where
|
||||
cpos = _crPos cr
|
||||
ypos = _crPos tcr
|
||||
@@ -226,7 +226,7 @@ flockFunc f targFunc cr = reader $ \w -> case targFunc cr w of
|
||||
Nothing -> cr
|
||||
Just crTarg -> cr & crActionPlan . crImpulse .~ mvPointMeleeTarg p cr crTarg
|
||||
where
|
||||
cenp = _crGroupCenter $ _creatureGroups w IM.! (_crGroupID (_crGroup cr))
|
||||
cenp = _crGroupCenter $ _creatureGroups w IM.! _crGroupID (_crGroup cr)
|
||||
p = f crTarg cenp cr
|
||||
|
||||
flockCenterFunc
|
||||
@@ -238,7 +238,7 @@ flockCenterFunc f targFunc cr = reader $ \w -> case targFunc cr w of
|
||||
Nothing -> cr
|
||||
Just crTarg -> cr & crActionPlan . crImpulse .~ mvPointMeleeTarg p cr crTarg
|
||||
where
|
||||
cenp = _crGroupCenter $ _creatureGroups w IM.! (_crGroupID (_crGroup cr))
|
||||
cenp = _crGroupCenter $ _creatureGroups w IM.! _crGroupID (_crGroup cr)
|
||||
p = f crTarg cenp cr
|
||||
|
||||
flockPointTargetR
|
||||
|
||||
@@ -31,7 +31,7 @@ import Control.Monad.Reader
|
||||
swarmCrit :: Creature
|
||||
swarmCrit = defaultCreature
|
||||
{ _crUpdate = stateUpdate $ impulsiveAIR $
|
||||
flockToPointUsing (encircleDistP (100)) (meleeHeadingMove 0.1 0.1 (pi/4) 3.9)
|
||||
flockToPointUsing (encircleDistP 100) (meleeHeadingMove 0.1 0.1 (pi/4) 3.9)
|
||||
>=> return . (crMeleeCooldown . _Just %~ max 0 . subtract 1)
|
||||
>=> basicPerceptionUpdateR [0]
|
||||
>=> doStrategyActionsR
|
||||
|
||||
Reference in New Issue
Block a user