require "WeaverOOP"
enity=class:new()
enity.name="Enity"
enity.maxHp=100
enity.hp=100
enity.mana=1000
enity.damage=10
enity.defence=1
enity.accuracy=75
function enity.speak(enity2)
print("Hi! I'm "..self.name.."! I have "..tostring(self.hp).." hp out of "..tostring(self.maxHp).." left! I also have "..tostring(self.mana).." left!")
end
function enity.damage(enity2, target)
for i=1, self.accuracy do
if math.random(1, 100)==15 then
target.hp=self.damage-target.defence
end
end
end
character=object.new(enity)
character:speak()
character:damage(character)
character:speak()
class={}
class.__index=class
object={}
object.__index=class
function class:new()
local class2={}
class2.__index=class
return class2
end
function object.new(class2)
local object2=class2
object2.__index=class2
return object
end