Initial commit with a mostly working engine.

Basic commands are being parsed. I think the only weird part is the
'use' command because it needs to possibly target two things. A tiny
test example is provided in __main__, this will probably be broken out
later.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2021-11-18 11:31:21 -08:00
commit dd2128beb1
15 changed files with 1650 additions and 0 deletions

View File

@@ -0,0 +1,98 @@
from agame.trigger import *
def test_get_item():
cases = [
("get item", "item"),
("take item", "item"),
("grab item", "item"),
("pick up item", "item"),
("pickup item", "item"),
("get the item", "item"),
("take the item", "item"),
("grab the item", "item"),
("pick up the item", "item"),
("pickup the item", "item"),
("get a item", "item"),
("take a item", "item"),
("grab a item", "item"),
("pick up a item", "item"),
("pickup a item", "item"),
("get an item", "item"),
("take an item", "item"),
("grab an item", "item"),
("pick up an item", "item"),
("pickup an item", "item"),
("get item", "item"),
("take item", "item"),
("grab item", "item"),
("pick up item", "item"),
("pickup item", "item"),
("get the item", "item"),
("take the item", "item"),
("grab the item", "item"),
("pick up the item", "item"),
("pickup the item", "item"),
("get a item", "item"),
("take a item", "item"),
("grab a item", "item"),
("pick up a item", "item"),
("pickup a item", "item"),
("get an item", "item"),
("take an item", "item"),
("grab an item", "item"),
("pick up an item", "item"),
("pickup an item", "item"),
]
pat = GetTrigger.pattern()
for (line, expected) in cases:
line = line.strip()
match = pat.fullmatch(line)
assert match is not None
assert match["item"] == expected
def test_use_item():
cases = [
("use item", "item"),
("use the item", "item"),
("use a item", "item"),
("use an item", "item"),
("use item", "item"),
("use the item", "item"),
("use a item", "item"),
("use an item", "item"),
("use an item", "item"),
]
pat = UseTrigger.pattern()
for (line, expected) in cases:
line = line.strip()
match = pat.fullmatch(line)
assert match is not None
assert match["item"] == expected
def test_use_item_with():
cases = [
("use item with other item", "item", "other item"),
("use the item with an other item", "item", "other item"),
("use a item with a other item", "item", "other item"),
("use an item with the other item", "item", "other item"),
("use item with other item", "item", "other item"),
("use the item with an other item", "item", "other item"),
("use a item with a other item", "item", "other item"),
("use an item with the other item", "item", "other item"),
]
pat = UseTrigger.pattern()
for (line, item, other_item) in cases:
match = pat.fullmatch(line)
assert match is not None
assert match["item"] == item
assert match["target"] == other_item
# TODO : put
# TODO : look