| 1 |
-- ____ _ __ |
| 2 |
-- / __ )____ _____ | | / /___ ___________ |
| 3 |
-- / __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/ |
| 4 |
-- / /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ ) |
| 5 |
-- /_____/\____/____/ |__/|__/\__,_/_/ /____/ |
| 6 |
-- |
| 7 |
-- A futuristic real-time strategy game. |
| 8 |
-- This file is part of Bos Wars. |
| 9 |
-- |
| 10 |
-- unit-cannon.lua - Define the cannon unit. |
| 11 |
-- |
| 12 |
-- (c) Copyright 2004-2010 by Francois Beerten. |
| 13 |
-- |
| 14 |
-- This program is free software; you can redistribute it and/or modify |
| 15 |
-- it under the terms of the GNU General Public License as published by |
| 16 |
-- the Free Software Foundation; either version 2 of the License, or |
| 17 |
-- (at your option) any later version. |
| 18 |
-- |
| 19 |
-- This program is distributed in the hope that it will be useful, |
| 20 |
-- but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 |
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 |
-- GNU General Public License for more details. |
| 23 |
-- |
| 24 |
-- You should have received a copy of the GNU General Public License |
| 25 |
-- along with this program; if not, write to the Free Software |
| 26 |
-- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 27 |
-- |
| 28 |
|
| 29 |
DefineAnimations("animations-cannon", { |
| 30 |
Still = {"frame 5", "wait 1", }, |
| 31 |
Attack = {"unbreakable begin", "frame 5", "wait 5", |
| 32 |
"frame 5", "sound bazoo-attack", "attack", "wait 1", |
| 33 |
"frame 10", "wait 15", |
| 34 |
"frame 5", "wait 170", "frame 5", "unbreakable end", "wait 1", }, |
| 35 |
Death = {"unbreakable begin", "frame 10", "unbreakable end", "wait 50", }, |
| 36 |
}) |
| 37 |
|
| 38 |
DefineIcon({ |
| 39 |
Name = "icon-cannon", |
| 40 |
Size = {46, 38}, |
| 41 |
Frame = 0, |
| 42 |
File = "units/cannon/cannon_i.png"}) |
| 43 |
|
| 44 |
DefineIcon({ |
| 45 |
Name = "icon-cannon_b", |
| 46 |
Size = {46, 38}, |
| 47 |
Frame = 0, |
| 48 |
File = "units/cannon/cannon_i.png"}) |
| 49 |
|
| 50 |
DefineConstruction("construction-cannon", { |
| 51 |
Constructions = { |
| 52 |
{Percent = 0, File = "main", Frame = 0}, |
| 53 |
{Percent = 10, File = "main", Frame = 0}, |
| 54 |
{Percent = 20, File = "main", Frame = 1}, |
| 55 |
{Percent = 30, File = "main", Frame = 2}, |
| 56 |
{Percent = 40, File = "main", Frame = 3}, |
| 57 |
{Percent = 50, File = "main", Frame = 4}, |
| 58 |
{Percent = 60, File = "main", Frame = 5}, |
| 59 |
{Percent = 70, File = "main", Frame = 6}, |
| 60 |
{Percent = 80, File = "main", Frame = 7}, |
| 61 |
{Percent = 90, File = "main", Frame = 7} |
| 62 |
} |
| 63 |
}) |
| 64 |
|
| 65 |
DefineMissileType("missile-cannon", { |
| 66 |
File = "units/cannon/weapon.png", |
| 67 |
Size = {128, 128}, Frames = 6, NumDirections = 1, |
| 68 |
ImpactSound = "rocket-impact", DrawLevel = 150, |
| 69 |
Class = "missile-class-point-to-point", Sleep = 1, |
| 70 |
Speed = 20, Range = 3}) |
| 71 |
|
| 72 |
MakeSound("cannon-ready", GetCurrentLuaPath().."/cannon.completed.wav") |
| 73 |
MakeSound("cannon-help", GetCurrentLuaPath().."/cannon.underattack.wav") |
| 74 |
MakeSound("cannon-selected", GetCurrentLuaPath().."/cannon_selected.wav") |
| 75 |
|
| 76 |
DefineUnitType("unit-cannon", { |
| 77 |
Name = "Cannon", |
| 78 |
Image = {"file", "units/cannon/cannon.png", "size", {128, 128},}, |
| 79 |
Offset = {0, -20}, |
| 80 |
Shadow = {"file", "units/cannon/cannon_s.png", "size", {128, 128}}, |
| 81 |
Animations = "animations-cannon", |
| 82 |
Icon = "icon-cannon", |
| 83 |
EnergyValue = 17000, |
| 84 |
MagmaValue = 8500, |
| 85 |
RepairHp = 2, |
| 86 |
Construction = "construction-cannon", |
| 87 |
HitPoints = 160, |
| 88 |
DrawLevel = 25, |
| 89 |
TileSize = {2, 2}, |
| 90 |
BoxSize = {64, 58}, |
| 91 |
SightRange = 6, |
| 92 |
ComputerReactionRange = 16, |
| 93 |
PersonReactionRange = 6, |
| 94 |
Armor = 10, |
| 95 |
BasicDamage = 40, |
| 96 |
PiercingDamage = 16, |
| 97 |
MaxAttackRange = 27, |
| 98 |
Missile = "missile-cannon", |
| 99 |
Priority = 20, |
| 100 |
AnnoyComputerFactor = 45, |
| 101 |
Points = 100, |
| 102 |
ExplodeWhenKilled = "missile-160x128-explosion", |
| 103 |
RightMouseAction = "attack", |
| 104 |
CanAttack = true, |
| 105 |
CanTargetLand = true, |
| 106 |
CanTargetAir = false, |
| 107 |
CanTargetSea = true, |
| 108 |
NumDirections = 8, |
| 109 |
Corpse = "build-dead-cannon", |
| 110 |
Type = "land", |
| 111 |
Building = true, |
| 112 |
VisibleUnderFog = true, |
| 113 |
CanHarvestFrom = true, |
| 114 |
Sounds = { |
| 115 |
"selected", "cannon-selected", |
| 116 |
"help", "cannon-help", |
| 117 |
"ready", "cannon-ready" |
| 118 |
} |
| 119 |
}) |
| 120 |
|
| 121 |
DefineAnimations("animations-dead-cannon", { |
| 122 |
Death = {"unbreakable begin", "wait 1", "frame 0", "wait 2000", |
| 123 |
"frame 1", "wait 2000", "frame 2", "wait 2000", "frame 2", "wait 1", |
| 124 |
"unbreakable end", "wait 1", }, |
| 125 |
}) |
| 126 |
|
| 127 |
DefineUnitType("build-dead-cannon", { |
| 128 |
Name = "CannonCrater", |
| 129 |
Image = {"file", GetCurrentLuaPath().."/cannon_c.png", "size", {128, 128}}, |
| 130 |
Animations = "animations-dead-cannon", |
| 131 |
Icon = "icon-cancel", |
| 132 |
HitPoints = 999, |
| 133 |
DrawLevel = 10, |
| 134 |
TileSize = {2, 2}, |
| 135 |
BoxSize = {220, 156}, |
| 136 |
SightRange = 1, |
| 137 |
BasicDamage = 0, |
| 138 |
PiercingDamage = 0, |
| 139 |
Missile = "missile-none", |
| 140 |
Priority = 0, |
| 141 |
Type = "land", |
| 142 |
Building = true, |
| 143 |
Vanishes = true |
| 144 |
}) |
| 145 |
|
| 146 |
|
| 147 |
DefineAllow("unit-cannon", AllowAll) |
| 148 |
|
| 149 |
DefineButton({ |
| 150 |
Pos = 3, Level = 3, Icon = "icon-cannon_b", Action = "build", |
| 151 |
Value = "unit-cannon", Hint = "BUILD ~!CANNON", |
| 152 |
ForUnit = {"unit-engineer"}}) |
| 153 |
-- DefineButton for the 'stop' and 'attack' actions are defined in buttons.lua. |
| 154 |
|
| 155 |
|