Skip to content
This repository has been archived by the owner on Nov 8, 2020. It is now read-only.

Commit

Permalink
Abilities Update 1
Browse files Browse the repository at this point in the history
- Adjusted return values of the calc_all method  of gamers.lua
- Adjusted template
- Created file for #12 (incl some simple tests)
  • Loading branch information
creyD committed May 3, 2017
1 parent e5fa33a commit b218cd6
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 3 deletions.
32 changes: 32 additions & 0 deletions lua_testbay/abilities.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
--[[
Testclass for "Filthy Peasants" peasant
©LazyProggers
]]--

-- LIBARIES (uncomment to use)
-- require "peasant" -- Peasant class for peasant creation, deletion, adjustment
require "gamer" -- Class for global variables and some player content

-- Start of the abilities.lua program

-- VARIABLES

-- FUNCTIONS
function ability1(gpower, civilisation)
if (gpower > 20) then
print("Ability 1 takes effect")
else
print("Not enough power for that Sir.")
end
end

-- TESTING AREA
print(gpower)
ability1(gpower, civilisation)

--[[
Notes:
Known errors:
]]--
17 changes: 16 additions & 1 deletion lua_testbay/gamer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ gpower = 0 gawe = 0 gworship = 0 glove = 0 gfear = 0 ghatred = 0
playerstats = {gawe, gworship, glove, gfear, ghatred} -- Create array for some cases of storage of the variables/ Idea for storage

-- FUNCTIONS
function calc_power(civilisation)
calc_all(civilisation)
-- gpower = algorithm to calculate the power
return gpower
end

function calc_gawe(civilisation) -- This function adds up the awe of the civilisation
for i, peasant in ipairs(civilisation) do
gawe = peasant.awe + gawe
Expand Down Expand Up @@ -56,10 +62,19 @@ function calc_all(civilisation) -- This function adds up all the values for one
gfear = peasant.fear + gfear
ghatred = peasant.hatred + ghatred
end
return -- No value jet
return gawe, gworship, glove, gfear, ghatred
end

-- TESTING AREA
peasant1 = birth(peasant1)
peasant2 = birth(peasant2)
peasant3 = birth(peasant3)
change_love(peasant1, 20)
change_love(peasant2, -12)
change_love(peasant3, 130)
civilisation = {peasant1, peasant2, peasant3}
calc_glove(civilisation)

--[[
peasant1 = birth(peasant1)
change_love(peasant1, 20)
Expand Down
4 changes: 2 additions & 2 deletions lua_testbay/template_luascript.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
]]--

-- LIBARIES (uncomment to use)
-- require "peasant" Peasant class for peasant creation, deletion, adjustment
-- require "gamer" Class for global variables and some player content
-- require "peasant" -- Peasant class for peasant creation, deletion, adjustment
-- require "gamer" -- Class for global variables and some player content

-- Start of the NAME.lua program

Expand Down

0 comments on commit b218cd6

Please sign in to comment.