┌─┐ ║"│ └┬┘ ┌┼┐ │ ┌───────┐ ┌────┐ ┌┴┐ │web-API│ │Core│ Attacker / Defender └───┬───┘ └──┬─┘ │ **Attacker** selects target and option of attack ┌┴┐ │ │───────────────────────────────────────────────────────────────────────────────>│ │ │ │ │ │ │ │ │ │ ""calculateRoll(//State, State, RollRequest, Environment//)"" ┌┴┐ │ │ │ ──────────────────────────────────────────────────────────────────>│ │ │ │ │ └┬┘ │ │ │ ""//Roll//"" │ │ │ │ <───────────────────────────────────────────────────────────────────│ │ └┬┘ │ │ provide the roll to **Attacker** │ │ │<────────────────────────────────────────────────────────────────────────────────│ │ │ │ │ │ **Attacker** confirms the attack ┌┴┐ │ │───────────────────────────────────────────────────────────────────────────────>│ │ │ │ │ │ │ │ │ │ ────┐ │ │ │ │ │ Init the attack state │ │ │ │ <───┘ Store ""Attacker's //Roll//"" │ │ │ │ │ │ └┬┘ │ │ ask **Defender** about defence option │ │ │<────────────────────────────────────────────────────────────────────────────────│ │ │ │ │ │ **Defender** selects defence option ┌┴┐ │ │───────────────────────────────────────────────────────────────────────────────>│ │ │ │ │ │ │ │ │ │ ""calculateRoll(//State, State, RollRequest, Environment//)"" ┌┴┐ │ │ │ ──────────────────────────────────────────────────────────────────>│ │ │ │ │ └┬┘ │ │ │ ""//Roll//"" │ │ │ │ <───────────────────────────────────────────────────────────────────│ │ └┬┘ │ │ provide the roll to **Defender** │ │ │<────────────────────────────────────────────────────────────────────────────────│ │ │ │ │ │ **Defender** confirms defence option ┌┴┐ │ │───────────────────────────────────────────────────────────────────────────────>│ │ │ │ │ │ │ │ │ │ ────┐ │ │ │ │ │ Update the attack state │ │ │ │ <───┘ Store ""Defender's //Roll//"" │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╔═════╧═╧════════════════════════════╗ │ ════════════════════════════════════════╪══════════════════════════════════════════════════════════════════════════╣ Parallel for Attacker and Defender ╠════════════════════════════════════════╪══════════════════════════════════════════════════════════════════════════ │ ╚═════╤═╤════════════════════════════╝ │ │ │ │ │ │ │ │ │ ╔═══════╤═════════════════════╪════════════════════════════════════════════════════════════════════════════════╪═╪═════════════════════════════════════════════════════════════════════╪════════════╗ ║ LOOP │ until **Actor** confirms his Test │ │ │ ║ ╟───────┘ │ │ │ │ ║ ║ │ │ │ ────┐ │ ║ ║ │ │ │ │ get dice value() │ ║ ║ │ │ │ <───┘ │ ║ ║ │ │ │ │ ║ ║ │ │ │ ""makeDramaticTest(//__dice__, Roll//)"" ┌┴┐ ║ ║ │ │ │ ──────────────────────────────────────────────────────────────────>│ │ ║ ║ │ │ │ └┬┘ ║ ║ │ │ │ ""//RollResult//"" │ ║ ║ │ │ │ <───────────────────────────────────────────────────────────────────│ ║ ║ │ │ │ │ ║ ║ │provide roll result and modify options to **Actor** and ask him about an action │ │ │ ║ ║ │<───────────────────────────────────────────────────────────────────────────────│ │ │ ║ ║ │ │ │ │ ║ ║ │ │ │ │ ║ ║ ╔══════╤════════════╪════════════════════════════════════════════════════════════════════════════════╪═╪═══════════════════════════════════════════════╗ │ ║ ║ ║ ALT │ **Actor** modifies test result (reroll, reverse, use selected value) │ │ ║ │ ║ ║ ╟──────┘ │ │ │ ║ │ ║ ║ ║ │ **Actor** confirms roll modify option │ │ ║ │ ║ ║ ║ │───────────────────────────────────────────────────────────────────────────────>│ │ ║ │ ║ ║ ╠═══════════════════╪════════════════════════════════════════════════════════════════════════════════╪═╪═══════════════════════════════════════════════╣ │ ║ ║ ║ [**Actor** confirms roll result] │ │ ║ │ ║ ║ ║ │ **Actor** confirms roll result │ │ ║ │ ║ ║ ║ │───────────────────────────────────────────────────────────────────────────────>│ │ ║ │ ║ ║ ║ │ │ │ ║ │ ║ ║ ║ │ │ │ ────┐ ║ │ ║ ║ ║ │ │ │ │ Update the attack state ║ │ ║ ║ ║ │ │ │ <───┘ Store ""Actor's //RollResult//"" ║ │ ║ ║ ║ │ │ │ ║ │ ║ ║ ╚═══════════════════╪════════════════════════════════════════════════════════════════════════════════╪═╪═══════════════════════════════════════════════╝ │ ║ ╚═════════════════════════════╪════════════════════════════════════════════════════════════════════════════════╪═╪═════════════════════════════════════════════════════════════════════╪════════════╝ │ └┬┘ │ │ │ │ │ │ ╔═════════════╗ │ ════════════════════════════════════════╪═════════════════════════════════════════════════════════════════════════════════╪═══╣ Syncronized ╠════════════════════════════════════════════════════╪══════════════════════════════════════════════════════════════════════════ │ │ ╚═════════════╝ │ │ │ │ Once ""Attacker's and Defender's //RollResult//"" are stored ┌┴┐ │ ───────────────────────────────────────────────────────────────────────────────────────────────────────────────>│ │ │ │ │ │ │ │ │ │ ""makeAttack(//Opposed, Opposed//)"" ┌┴┐ │ │ │ ──────────────────────────────────────────────────────────────────>│ │ │ │ │ │ │ │ │ │ │ │ ────┐ │ │ │ │ │ │ ""makeOpposedTest(//Opposed, Opposed//): //OpposedResult//"" │ │ │ │ │ <───┘ │ │ │ │ │ │ │ │ │ │ ────┐ │ │ │ │ │ │ ""resolve the attack"" │ │ │ │ │ <───┘ │ │ │ └┬┘ │ │ │ ""Attacker's //AttackResult//, Defender's //AttackResult//"" │ │ │ │ <───────────────────────────────────────────────────────────────────│ │ │ │ │ │ │ │ ────┐ │ │ │ │ │ Update the attack state │ │ │ │ <───┘ Store ""//AttackResults//"" │ │ │ │ │ │ │ │ │ │ │ │ │ ╔══════╤════════════╪════════════════════════════════════════════════════════════════════════════════╪═╪════════════╗ │ ║ OPT │ for loser │ │ │ ║ │ ╟──────┘ │ │ │ ║ │ ║ │ notify about lost opposite test │ │ ║ │ ║ │<───────────────────────────────────────────────────────────────────────────────│ │ ║ │ ╚═══════════════════╪════════════════════════════════════════════════════════════════════════════════╪═╪════════════╝ │ │ │ │ │ │ │ │ │ ╔══════╤══════════════════════╪════════════════════════════════════════════════════════════════════════════════╪═╪═════════════════════════════════════════════════════════════════════╪══════════════════════╗ ║ OPT │ for winner │ │ │ │ ║ ╟──────┘ │ └┬┘ │ ║ ║ │ notify about won opposite test and provide attack resolve options │ │ ║ ║ │<────────────────────────────────────────────────────────────────────────────────│ │ ║ ║ │ │ │ ║ ║ │ │ │ ║ ║ ╔══════╤════════════╪═════════════════════════════════════════════════════════════════════════════════╪══════════════════════════════════════════════════════════════════════╪════════════╗ ║ ║ ║ OPT │ winner selects to apply damage │ │ ║ ║ ║ ╟──────┘ │ │ │ ║ ║ ║ ║ │ **Actor** confirms attack resolve option ┌┴┐ │ ║ ║ ║ ║ │───────────────────────────────────────────────────────────────────────────────>│ │ │ ║ ║ ║ ║ │ │ │ │ ║ ║ ║ ║ │ │ │ applyDamage(targetState, AttackDamage) │ ║ ║ ║ ║ │ │ │ ───────────────────────────────────────────────────────────────────>│ ║ ║ ║ ╚═══════════════════╪════════════════════════════════════════════════════════════════════════════════╪═╪═════════════════════════════════════════════════════════════════════╪════════════╝ ║ ║ │ │ │ │ ║ ║ │ │ │ ""changeState(//__winnner__, WinnerState, ResolveAttackOption//)"" ┌┴┐ ║ ║ │ │ │ ──────────────────────────────────────────────────────────────────>│ │ ║ ║ │ │ │ └┬┘ ║ ║ │ │ │ new ""//WinnerState//"" │ ║ ║ │ │ │ <───────────────────────────────────────────────────────────────────│ ║ ║ │ │ │ │ ║ ║ │ │ │ ""changeState(//__loser__, LoserState, ResolveAttackOption//)"" ┌┴┐ ║ ║ │ │ │ ──────────────────────────────────────────────────────────────────>│ │ ║ ║ │ │ │ └┬┘ ║ ║ │ │ │ new ""//LoserState//"" │ ║ ║ │ │ │ <───────────────────────────────────────────────────────────────────│ ║ ║ │ │ │ │ ║ ║ │ │ │ ────┐ │ ║ ║ │ │ │ │ Resolve the attack state │ ║ ║ │ │ │ <───┘ Store new ""//AttackerState//"" and ""//DefenderState//"" │ ║ ║ │ │ │ │ ║ ║ │ └┬┘ │ ║ ║ │ provide new **Attacker** and **Defender** states │ │ ║ ║ │<────────────────────────────────────────────────────────────────────────────────│ │ ║ ╚═════════════════════════════╪═════════════════════════════════════════════════════════════════════════════════╪══════════════════════════════════════════════════════════════════════╪══════════════════════╝ Attacker / Defender ┌───┴───┐ ┌──┴─┐ ┌─┐ │web-API│ │Core│ ║"│ └───────┘ └────┘ └┬┘ ┌┼┐ │ ┌┴┐