diff --git a/src/task-109.js b/src/task-109.js index de43806..a9b6b2a 100644 --- a/src/task-109.js +++ b/src/task-109.js @@ -1,37 +1,22 @@ -import {base} from './task-lib.js'; +/* -function replenish(_, game_context) { - game_context.tasks[109].quantity += 1; - return game_context; -} +Take x Reed -function collect(_, game_context) { - const {quantity} = game_context.tasks[109]; - game_context.supply.reed += quantity; - game_context.tasks[109].quantity = 0; - return game_context; -} +*/ +import task from './lib-task.js'; -export default base.createMachine({ - initial: 'idle', - states: { - idle: { - on: { - 'task.replenish': { - actions: [ - {type: 'game-update', params: {updater: replenish}}, - {type: 'ack'} - ] - }, - 'task.selected': { - actions: [ - {type: 'game-update', params: {updater: collect}}, - {type: 'task-complete'} - ] - } - } - } +export default task({ + id: '109', + replenish: (_, game) => { + game.tasks[109].quantity += 1; + return game; + }, + execute: (_, game) => { + const {quantity} = game.tasks[109]; + game.supply.reed += quantity; + game.tasks[109].quantity = 0; + return game; } }); diff --git a/src/task-110.js b/src/task-110.js index cb74c3a..a08bc30 100644 --- a/src/task-110.js +++ b/src/task-110.js @@ -1,36 +1,22 @@ -import {base} from './task-lib.js'; +/* -function replenish(_, game_context) { - game_context.tasks[110].quantity += 1; - return game_context; -} +Fishing +Take x Food -function collect(_, game_context) { - const {quantity} = game_context.tasks[110]; - game_context.supply.food += quantity; - game_context.tasks[110].quantity = 0; - return game_context; -} +*/ +import task from './lib-task.js'; -export default base.createMachine({ - initial: 'idle', - states: { - idle: { - on: { - 'task.replenish': { - actions: [ - {type: 'game-update', params: {updater: replenish}}, - {type: 'ack'} - ] - }, - 'task.selected': { - actions: [ - {type: 'game-update', params: {updater: collect}}, - {type: 'task-complete'} - ] - } - } - } +export default task({ + id: '110', + replenish: (_, game) => { + game.tasks[110].quantity += 1; + return game; + }, + execute: (_, game) => { + const {quantity} = game.tasks[110]; + game.supply.food += quantity; + game.tasks[110].quantity = 0; + return game; } }); diff --git a/src/task-111.js b/src/task-111.js index 81258a1..79394c0 100644 --- a/src/task-111.js +++ b/src/task-111.js @@ -1,20 +1,13 @@ -import {base} from './task-lib.js'; +/* -export default base.createMachine({ - initial: 'idle', - states: { - idle: { - on: { - 'task.selected': { - actions: { - type: 'abort', - params: { - task_id: 111, - err: 'TODO' - } - } - } - } - } - } +Fences + +*/ + +import task from './lib-task.js'; + +export default task({ + id: '111', + todo: true }); + diff --git a/src/task-112.js b/src/task-112.js index 56bd69e..7a777c4 100644 --- a/src/task-112.js +++ b/src/task-112.js @@ -1,20 +1,13 @@ -import {base} from './task-lib.js'; +/* -export default base.createMachine({ - initial: 'idle', - states: { - idle: { - on: { - 'task.selected': { - actions: { - type: 'abort', - params: { - task_id: 112, - err: 'TODO' - } - } - } - } - } - } +Major Improvement + +*/ + +import task from './lib-task.js'; + +export default task({ + id: '112', + todo: true }); + diff --git a/src/task-114.js b/src/task-114.js index 1a6c352..1079d0d 100644 --- a/src/task-114.js +++ b/src/task-114.js @@ -4,35 +4,15 @@ */ -import {base} from './task-lib.js'; +import task from './lib-task.js'; -function replenish(_, game_context) { - game_context.tasks[114].quantity += 1; - return game_context; -} - -export default base.createMachine({ - initial: 'idle', - states: { - idle: { - on: { - 'task.replenish': { - actions: [ - {type: 'game-update', params: {updater: replenish}}, - {type: 'ack'} - ] - }, - 'task.selected': { - actions: { - type: 'abort', - params: { - task_id: 114, - err: 'TODO' - } - } - } - } - } +export default task({ + id: '114', + todo: true, + replenish: (_, game) => { + game.tasks[114].quantity += 1; + return game; } -}); +}) + diff --git a/src/task-115.js b/src/task-115.js index b672b95..11282ed 100644 --- a/src/task-115.js +++ b/src/task-115.js @@ -1,25 +1,13 @@ /* - Family growth + +Family growth + */ -import {base} from './task-lib.js'; +import task from './lib-task.js'; -export default base.createMachine({ - initial: 'idle', - states: { - idle: { - on: { - 'task.selected': { - actions: { - type: 'abort', - params: { - task_id: 115, - err: 'TODO' - } - } - } - } - } - } +export default task({ + id: '115', + todo: true });