-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.py
109 lines (98 loc) · 2.24 KB
/
types.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import smartpy as sp
## Config
#
TGameConfig = sp.TRecord(
paused=sp.TBool,
owners=sp.TMap(sp.TAddress, sp.TNat),
summon_cost=sp.TMutez,
minimum_loot=sp.TMutez,
hero_health_initial=sp.TNat,
hero_strength_initial=sp.TNat,
pair_battle_cooldown=sp.TInt,
battle_turn_timeout=sp.TInt,
battle_experience_min=sp.TNat,
battle_experience_max=sp.TNat,
platform_loot_percentage=sp.TNat,
datastore_address=sp.TAddress,
randomizer_address=sp.TAddress,
supported_game_modes=sp.TSet(sp.TString),
)
## Hero
#
THeroUid = sp.TPair(sp.TAddress, sp.TNat)
THeroCharacter = sp.TRecord(
name=sp.TString,
story=sp.TString,
battle_ready=sp.TBool
)
THeroAttributes = sp.TRecord(
health=sp.TNat,
strength=sp.TNat,
experience=sp.TNat,
experience_total=sp.TNat,
)
THeroItem = sp.TRecord(
token_id=sp.TNat,
token_address=sp.TAddress,
item_type=sp.TString, # Broadsword, Fabriel, Shield, etc.
item_offensive=sp.TBool, # Offensive or defensive
item_power=sp.TNat # How powerful is the item
)
THeroItems = sp.TList(THeroItem)
THeroBattles = sp.TRecord(
latest=sp.TTimestamp,
battles=sp.TSet(sp.TString)
)
THero = sp.TRecord(
owner=sp.TAddress,
token_id=sp.TNat,
token_address=sp.TAddress,
summoned=sp.TTimestamp,
suited=sp.TBool,
battling=sp.TBool,
battles=sp.TMap(THeroUid, THeroBattles),
character=THeroCharacter,
attrs=THeroAttributes,
items=THeroItems,
meta=sp.TMap(sp.TString, sp.TBytes)
)
## Battle
#
TTurn = sp.TRecord(
hero=THeroUid,
damage=sp.TNat,
timestamp=sp.TTimestamp
)
TTurns = sp.TRecord(
latest=sp.TOption(sp.TTimestamp),
turns=sp.TList(TTurn)
)
TBattle = sp.TRecord(
bid=sp.TString,
victor=sp.TOption(THeroUid),
looser=sp.TOption(THeroUid),
challenger=THeroUid,
challenged=THeroUid,
challenger_damage=sp.TNat,
challenged_damage=sp.TNat,
started=sp.TBool,
finished=sp.TBool,
resolved=sp.TBool,
mode=sp.TString,
loot=sp.TMutez,
turn=THeroUid,
turns=TTurns,
challenge_time=sp.TTimestamp,
start_time=sp.TOption(sp.TTimestamp),
finish_time=sp.TOption(sp.TTimestamp),
experience_gained=sp.TNat,
)
## Other
#
TTransferTokensParam = sp.TRecord(
sender=sp.TAddress,
receiver=sp.TAddress,
token_address=sp.TAddress,
token_ids=sp.TList(sp.TNat),
amount=sp.TNat
)