Created
July 4, 2016 21:10
-
-
Save vgaltes/c7050947af0670cef422d19861689417 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let rec applyRules value rules characterFrom playerTo distance = | |
match rules with | |
| [] -> value | |
| x::xs -> | |
let result = x characterFrom playerTo distance value | |
match result with | |
| None -> 0 | |
| Some v -> applyRules v xs characterFrom playerTo distance | |
let interactWith characterFrom characterTo action distance = | |
match action with | |
| Attack amount -> | |
let damage = applyRules amount attackRules characterFrom characterTo distance | |
{characterTo with Health = characterto.Health - damage} | |
| Heal amount -> | |
let healing = applyRules amount healRules characterFrom characterTo distance | |
{characterTo with Health = characterto.Health + healing} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment