-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAttackOrder.adept
29 lines (23 loc) · 914 Bytes
/
AttackOrder.adept
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
import 'main.adept'
struct AttackOrder (aggressor CardNetworkID, victim CardNetworkID, randomness int, is_counter bool)
func attackOrder(aggressor, victim CardNetworkID, randomness int = -1, is_counter bool = false) AttackOrder {
order POD AttackOrder
order.aggressor = aggressor
order.victim = victim
order.randomness = randomness
order.is_counter = is_counter
return order
}
func enforceMaxAttacks(this *<AttackOrder> List, aggressor CardNetworkID, amount usize) {
count usize = 0
each AttackOrder in *this, if it.aggressor == aggressor, count++
// Attack count for that card is valid
if count <= amount, return
// Remove first attacks from aggressor in order to meet attack amount limitation
each AttackOrder in *this {
if it.aggressor == aggressor {
this.remove(idx--)
if --count <= amount, return
}
}
}