Debian Codegraph @

units/medic/unit-medic.lua

raw
1 -- ____ _ __
2 -- / __ )____ _____ | | / /___ ___________
3 -- / __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
4 -- / /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
5 -- /_____/\____/____/ |__/|__/\__,_/_/ /____/
6 --
7 -- A futuristic real-time strategy game.
8 -- This file is part of Bos Wars.
9 --
10 -- unit-medic.lua - Define the used elites unit-types.
11 --
12 -- (c) Copyright 2001-2007 by Francois Beerten, Lutz Sammer, and
13 -- Crestez Leonard
14 --
15 -- This program is free software; you can redistribute it and/or modify
16 -- it under the terms of the GNU General Public License as published by
17 -- the Free Software Foundation; either version 2 of the License, or
18 -- (at your option) any later version.
19 --
20 -- This program is distributed in the hope that it will be useful,
21 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
22 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 -- GNU General Public License for more details.
24 --
25 -- You should have received a copy of the GNU General Public License
26 -- along with this program; if not, write to the Free Software
27 -- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 --
29
30
31 DefineAnimations("animations-medic", {
32 Still = {"frame 0", "wait 1", },
33 Move = {"unbreakable begin", "frame 5", "move 2", "wait 2",
34 "frame 5", "move 2", "wait 2", "frame 5", "move 2", "wait 2",
35 "frame 5", "move 2", "wait 2", "frame 10", "move 2", "wait 2",
36 "frame 10", "move 2", "wait 2", "frame 10", "move 2", "wait 2",
37 "frame 10", "move 2", "wait 2", "frame 15", "move 2", "wait 2",
38 "frame 15", "move 2", "wait 2", "frame 15", "move 2", "wait 2",
39 "frame 15", "move 2", "wait 2", "frame 20", "move 2", "wait 2",
40 "frame 20", "move 2", "wait 2", "frame 20", "move 2", "wait 2",
41 "frame 20", "move 2", "unbreakable end", "wait 2", },
42 Attack = {"unbreakable begin", "frame 25", "wait 4",
43 "frame 30", "sound medic-attack", "attack", "wait 4",
44 "frame 0", "unbreakable end", "wait 1", },
45 Death = {"unbreakable begin", "frame 40", "wait 2", "frame 45",
46 "wait 2", "frame 50", "wait 2", "frame 55", "unbreakable end", "wait 2", },
47 })
48
49 DefineIcon({
50 Name = "icon-medic",
51 Size = {46, 38},
52 Frame = 0,
53 File = "units/medic/ico_medic.png"})
54 DefineIcon({
55 Name = "icon-heal",
56 Size = {46, 38},
57 Frame = 0,
58 File = "units/medic/ico_heal.png"})
59
60 MakeSound("medic-selected", "units/medic/medic_select.wav")
61 MakeSound("medic-acknowledge", "units/medic/medic_action.wav")
62 MakeSound("medic-ready", "units/medic/medic.ready.wav")
63 MakeSound("medic-help", "units/medic/medic.underattack.wav")
64 MakeSound("medic-die", "units/medic/medic_die.wav")
65 MakeSound("medic-attack", "units/medic/medic_attack.wav")
66
67 DefineMissileType("missile-heal", {
68 File = "units/medic/heal.png",
69 Size = {32, 32}, Frames = 5, NumDirections = 1, DrawLevel = 50,
70 Class = "missile-class-stay", Sleep = 2, Speed = 32, Range = 15})
71
72 DefineSpell("spell-healing",
73 "showname", "Bandage",
74 "chargecost", 3,
75 "range", 1,
76 "target", "unit",
77 "action", {
78 {"spawn-missile", "missile", "missile-heal",
79 "start-point", {"base", "target"}},
80 {"adjust-vitals", "hit-points", 1}
81 },
82 "condition", {
83 "Organic", "only",
84 "Building", "false",
85 "self", "false",
86 "HitPoints", {MaxValuePercent = 100}
87 },
88 "sound-when-cast", "medic-attack",
89 "autocast", {
90 "range", 6,
91 "condition", {
92 "alliance", "only",
93 "HitPoints", {MaxValuePercent = 90}
94 }
95 }
96 )
97
98 DefineUnitType("unit-medic", {
99 Name = "Medic",
100 Image = {"file", "units/medic/unit_medic.png", "size", {64, 64}},
101 Shadow = {"file", "units/medic/unit_medic_s.png", "size", {64, 64}},
102 Animations = "animations-medic",
103 Icon = "icon-medic",
104 Flip = true,
105 EnergyValue = 2500,
106 MagmaValue = 2000,
107 HitPoints = 25,
108 MaxCharge = 100,
109 CanCastSpell = {"spell-healing"},
110 DrawLevel = 25,
111 TileSize = {1, 1},
112 BoxSize = {17, 28},
113 SightRange = 3,
114 ComputerReactionRange = 6,
115 PersonReactionRange = 6,
116 Armor = 1,
117 BasicDamage = 0,
118 PiercingDamage = 0,
119 Missile = "missile-none",
120 MaxAttackRange = 1,
121 Priority = 60,
122 Points = 50,
123 Corpse = "unit-dead-body5",
124 Type = "land",
125 CanTargetLand = true,
126 Organic = true,
127 SelectableByRectangle = true,
128 CanCastSpell = {"spell-healing"},
129 AutoCastActive = {"spell-healing"},
130 Sounds = {
131 "selected", "medic-selected",
132 "acknowledge", "medic-acknowledge",
133 "ready", "medic-ready",
134 "help", "medic-help",
135 "dead", "medic-die"}
136 })
137
138 DefineHumanCorpse("medic", nil, true)
139
140 DefineAllow("unit-medic", AllowAll)
141
142 DefineButton({
143 Pos = 1, Level = 0, Icon = "icon-medic",
144 Action = "train-unit", Value = "unit-medic",
145 Hint = "TRAIN ~!MEDIC",
146 ForUnit = {"unit-hosp"}})
147
148 DefineButton({
149 Pos = 3, Level = 0, Icon = "icon-heal",
150 Action = "cast-spell", Value = "spell-healing",
151 Allowed = "check-true", Hint = "~!BANDAGE",
152 ForUnit = {"unit-medic"}})