@@ -63,6 +63,7 @@ App.KL.Game.Phase.Play.draw.canvas.board(
63
63
img: VoxBox
64
64
): VoxBox
65
65
open game
66
+ let team = App.KL.Game.Phase.Draft.to_team(game@players, user) <> App.KL.Game.Team.neutral
66
67
let map = game@board
67
68
let mouse_coord = Hexagonal.Axial.from_screen_xy(mouse, App.KL.Constants.hexagon_radius, U32.to_i32(screen@fst) / 4, U32.to_i32(screen@snd) / 4)
68
69
let indicators = App.KL.Game.Phase.Play.Draw.canvas.get_indicators(preview, mouse_coord, user, game)
@@ -74,8 +75,8 @@ App.KL.Game.Phase.Play.draw.canvas.board(
74
75
let img = App.KL.Game.Phase.Play.draw.canvas.grid(coord, game@moment, screen, img)
75
76
let img = App.KL.Game.Phase.Play.draw.canvas.tile.terrain(tile@terrain, preview@picks, indicator, coord, screen, img)
76
77
let img = App.KL.Game.Phase.Play.draw.canvas.tile.indicator(indicator, coord, screen, img)
77
- let img = App.KL.Game.Phase.Play.draw.canvas.tile.creature(game, tile@creature, coord, ap_used, screen, img)
78
- let img = App.KL.Game.Phase.Play.draw.canvas.tile.token(game, tile@token, coord, screen, img)
78
+ let img = App.KL.Game.Phase.Play.draw.canvas.tile.creature(game, tile@creature, coord, ap_used, screen, user, img)
79
+ let img = App.KL.Game.Phase.Play.draw.canvas.tile.token(game, tile@token, coord, screen, team, img)
79
80
img
80
81
img
81
82
@@ -102,26 +103,40 @@ App.KL.Game.Phase.Play.draw.canvas.tile.token(
102
103
token: Maybe<App.KL.Game.Token>,
103
104
token_coord: Hexagonal.Axial,
104
105
screen: Pair<U32, U32>
106
+ team: App.KL.Game.Team
105
107
img: VoxBox
106
108
): VoxBox
107
109
without token: img
108
- let col = case App.KL.Game.Token.get_dominance(token) as team {
109
- none: Col32.new(100,100,100,255)
110
- some:
111
- case team.value {
112
- blue: Col32.new(0, 0, 255, 255)
113
- red: Col32.new(255, 0, 0, 255)
114
- } default Col32.new(100,100,100,255)
115
- }
110
+ let col =
111
+ case App.KL.Game.Token.get_dominance(token) as team {
112
+ none: Col32.new(100,100,100,255)
113
+ some:
114
+ if App.KL.Game.Team.eql(team, team.value) then
115
+ Col32.new(0, 0, 255, 255)
116
+ else
117
+ if App.KL.Game.Team.eql(App.KL.Game.Team.neutral, team.value) then
118
+ Col32.new(100,100,100,255)
119
+ else
120
+ Col32.new(255, 0, 0, 255)
121
+ }
122
+
116
123
let coords = Hexagonal.Axial.range(token_coord, token@range)
124
+ let board = game@board
117
125
for coord in coords with img:
118
- let {cx, cy} =
119
- Hexagonal.Axial.to_screen_xy(coord, App.KL.Constants.hexagon_radius, U32.to_i32(screen@fst) / 4, U32.to_i32(screen@snd) / 4)
126
+ let tile = Hexagonal.Axial.Map.get!(coord, board)
127
+ case tile {
128
+ none:
129
+ img
130
+ some:
131
+ let {cx, cy} =
132
+ Hexagonal.Axial.to_screen_xy(coord, App.KL.Constants.hexagon_radius, U32.to_i32(screen@fst) / 4, U32.to_i32(screen@snd) / 4)
133
+
134
+ if Hexagonal.Axial.eql(coord, token_coord) then
135
+ VoxBox.Draw.square(cx,cy,App.KL.Constants.z_index.token,10,10,col,img)
136
+ else
137
+ VoxBox.Draw.square(cx,cy,App.KL.Constants.z_index.token,5,5,col,img)
138
+ }
120
139
121
- if Hexagonal.Axial.eql(coord, token_coord) then
122
- VoxBox.Draw.square(cx,cy,App.KL.Constants.z_index.token,10,10,col,img)
123
- else
124
- VoxBox.Draw.square(cx,cy,App.KL.Constants.z_index.token,5,5,col,img)
125
140
img
126
141
127
142
@@ -268,11 +283,13 @@ App.KL.Game.Phase.Play.draw.canvas.tile.creature(
268
283
coord: Hexagonal.Axial,
269
284
ap_used: Maybe<Pair<String, I32>>
270
285
screen: Pair<U32,U32>
286
+ user_id: String
271
287
img: VoxBox
272
288
): VoxBox
273
289
case creature {
274
290
none: img
275
291
some:
292
+ let team = App.KL.Game.Phase.Draft.to_team(game@players, user_id)
276
293
let hero = creature.value@hero
277
294
let draw_pose = App.KL.Game.Phase.Play.draw.canvas.tile.creature.get_draw_pose(game, coord)
278
295
let {draw_coord, draw_voxbox} = hero@draw@vbox_img(draw_pose)
@@ -291,7 +308,7 @@ App.KL.Game.Phase.Play.draw.canvas.tile.creature(
291
308
none:
292
309
img
293
310
some:
294
- let img = App.KL.Game.Phase.Play.Bar.show_hp(cx - 17, (cy - height), creature.value, img)
311
+ let img = App.KL.Game.Phase.Play.Bar.show_hp(cx - 17, (cy - height), user_id, team <> App.KL.Game.Team.neutral, creature.value, img)
295
312
let img = App.KL.Game.Phase.Play.draw.ap(img_x - 12, (img_y - height) - 3, creature.value, ap_used, img)
296
313
img
297
314
}
0 commit comments