-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpirate.lua
More file actions
41 lines (32 loc) · 708 Bytes
/
Copy pathpirate.lua
File metadata and controls
41 lines (32 loc) · 708 Bytes
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
local pirate = {}
local ship = require("ship")
local crit = 0.05
local dodge = 0.1
local hp = 30
local function oneOrNone()
local roll = math.random(0, 1)
if roll == 1 then
return 1
else
return 0
end
end
local Pirate = {}
function Pirate:new()
print("New Pirate\n")
local armor = oneOrNone()
local numAmmo = oneOrNone()
local weapons = {}
ship.getRandomGunMaybe(weapons)
local o = ship.newShip(dodge, crit, armor, hp, numAmmo, weapons)
o.shipType = "pirate"
o.maxHp = hp
return o
end
function Pirate:addWeapon(weaponName)
self.weapons[weaponName] = true
end
function pirate.newPirate()
return Pirate:new()
end
return pirate