-
Notifications
You must be signed in to change notification settings - Fork 4
/
common_test.py
44 lines (37 loc) · 1.37 KB
/
common_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from actor import DoNothingActor
from compositecore import Composite
import dungeonlevelfactory
from equipment import Equipment
from gamestate import GameState, GameStateDummy
import gametime
from graphic import CharPrinter
from inventory import Inventory
from player import new_player
from position import DungeonLevel, Position
from stats import DataPoint, DataTypes
from vision import Vision
__author__ = 'co'
dungeon1 = ["#####",
"#._.#",
"#.#.#",
"#...#",
"#####"]
def get_test_level():
return dungeonlevelfactory.dungeon_level_from_lines(dungeon1)
def get_dummy_actor():
dummy_actor = Composite()
dummy_actor.set_child(DoNothingActor())
dummy_actor.set_child(Equipment())
dummy_actor.set_child(DataPoint(DataTypes.ENERGY, -gametime.single_turn))
dummy_actor.set_child(DataPoint(DataTypes.OFFENCIVE_ATTACK_CHANCE, 0.0))
dummy_actor.set_child(DataPoint(DataTypes.COUNTER_ATTACK_CHANCE, 0.0))
dummy_actor.set_child(DataPoint(DataTypes.DEFENCIVE_ATTACK_CHANCE, 0.0))
dummy_actor.set_child(DataPoint(DataTypes.CRIT_CHANCE, 0.0))
return dummy_actor
def get_dummy_player():
game_state_dummy = GameStateDummy()
dummy_actor = game_state_dummy.player
dummy_actor.dungeon_level.value = get_test_level()
dummy_actor.set_child(Position())
dummy_actor.position.value = (1, 1)
return dummy_actor