Use wielded items to calculate damage
Use whatever items the character has wielded, if any, to calculate the damage they deal when attacking. Currently this shortcuts handedness to just use the *first* item they have equipped, which is fine since it's currently only possible to equip something in the right hand.
This commit is contained in:
		
							parent
							
								
									6622dd3018
								
							
						
					
					
						commit
						8ecefddbd4
					
				
					 2 changed files with 35 additions and 26 deletions
				
			
		|  | @ -238,7 +238,7 @@ handleCommand ShowInventory = showPanel InventoryPanel >> continue | |||
| handleCommand Wield = do | ||||
|   uses (character . inventory . backpack) | ||||
|        (V.mapMaybe (\item -> | ||||
|                       (WieldedItem item) <$> item ^. Item.itemType . wieldable)) | ||||
|                       WieldedItem item <$> item ^. Item.itemType . wieldable)) | ||||
|     >>= \case | ||||
|       Empty -> say_ ["wield", "nothing"] | ||||
|       wieldables -> | ||||
|  | @ -431,7 +431,7 @@ attackAt pos = | |||
|       $ \(MenuResult creature) -> attackCreature creature | ||||
|  where | ||||
|   attackCreature (creatureID, creature) = do | ||||
|     charDamage <- use $ character . characterDamage | ||||
|     charDamage <- uses character characterDamage | ||||
|     let creature' = Creature.damage charDamage creature | ||||
|         msgParams = object ["creature" A..= creature'] | ||||
|     if Creature.isDead creature' | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue