A defence of multiple inheritance (and things suspeciously close to it).
One day, you wake up with a strange impulse: "I want to make a game". So, you fire up your editor and get typing away. You decide to reach for tools you know well: Lua and LÖVE (just go with okay). This project begins with a few basic functions:
local function hurt(self, amount)
self.health = self.health + amount
end
local function heal(self, amount)
self.health = self.health + amount
end
local function attack(self, other)
other:hurt(self.weapon.power)
end
local function parry(self, other)
local power_diff = self.weapon.power - self.weapon.power
if power_diff >= 0 then
other:hurt(power_diff)
else
self:hurt(-power_diff)
end
end