Refactor crPos to be a V3

This commit is contained in:
2025-10-10 13:47:31 +01:00
parent 98ece551c7
commit 49fb982877
58 changed files with 375 additions and 307 deletions
+3 -2
View File
@@ -1,5 +1,6 @@
module Dodge.Creature.Damage (applyCreatureDamage) where
import Linear
import Dodge.Material.Damage
import Data.List
import Dodge.Creature.Mass
@@ -25,11 +26,11 @@ applyPiercingDamage cr dm w
= f . makeSpark NormalSpark p1 (argV (p1 - p)) $ w
| otherwise = f . damageHP cr (_dmAmount dm) $ w
where
f = cWorld . lWorld . creatures . ix (_crID cr) . crPos +~ _dmVector dm
f = cWorld . lWorld . creatures . ix (_crID cr) . crPos . _xy +~ _dmVector dm
/ V2 x x
x = crMass (_crType cr)
p = _dmPos dm
p1 = p + 2 *.* squashNormalizeV (p - _crPos cr)
p1 = p + 2 *.* squashNormalizeV (p - cr ^. crPos . _xy)
damageHP :: Creature -> Int -> World -> World
damageHP cr x =