-
Notifications
You must be signed in to change notification settings - Fork 0
/
CardBlueprint.adept
89 lines (76 loc) · 2.97 KB
/
CardBlueprint.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
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
import 'main.adept'
import 'CardUsage.adept'
struct CardBlueprint (
name, title, description String,
kind CardKind,
cost, hp, attack int,
offense Offense,
defense Defense,
ct CardTextures,
traits CardTraits
) {
func clone CardBlueprint {
blueprint POD CardBlueprint
blueprint.name = this.name.clone()
blueprint.description = this.description.clone()
blueprint.kind = this.kind
blueprint.cost = this.cost
blueprint.hp = this.hp
blueprint.offense = POD this.offense
blueprint.defense = POD this.defense
blueprint.attack = this.attack
blueprint.ct = this.ct
blueprint.traits = this.traits
return blueprint
}
func print {
print("%" % this.name)
print(" title: %" % this.title)
print(" description: %" % this.description)
print(" kind: %" % toString(this.kind))
print(" cost: %" % this.cost)
print(" hp: %" % this.hp)
print(" attack: %" % this.attack)
print(" offense: %" % this.offense.toString())
print(" defense: %" % this.defense.toString())
print(" textures: %" % (this.ct.portrait != &textures.placeholder))
print(" traits: %" % this.traits.toString(false))
}
func toString(include_title_and_description bool = false) String {
result String
if include_title_and_description {
result.append("%" % this.name + "\n")
result.append(" title %" % this.title.replace('\n'ub, " ") + "\n")
result.append(" description %" % this.description.replace('\n'ub, " ") + "\n")
}
result.append("kind %" % toString(this.kind) + "\n")
result.append("cost %" % this.cost + "\n")
if this.kind == CardKind::CREATURE, result.append("hp %" % this.hp + "\n")
if this.attack != 0 || this.kind == CardKind::CREATURE {
result.append("attack %" % this.attack + "\n")
}
if this.kind == CardKind::CREATURE {
result.append("offense %" % this.offense.toString() + "\n")
result.append("defense %" % this.defense.toString() + "\n")
}
result.append("%" % this.traits.toString(true))
return result.commit()
}
}
func addBlueprint(this *<CardBlueprint> List, name, title, description String, kind CardKind, cost, hp, attack int,
offense Offense, defense Defense, ct *CardTextures, traits *CardTraits) successful {
unless this.add(), return false
blueprint *CardBlueprint = this.items at (this.length - 1)
blueprint.name = name.clone()
blueprint.title = title.clone()
blueprint.description = description.clone()
blueprint.kind = kind
blueprint.cost = cost
blueprint.hp = hp
blueprint.attack = attack
blueprint.offense = POD offense
blueprint.defense = POD defense
blueprint.ct = POD *ct
blueprint.traits = POD *traits
return true
}