• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Difference between revisions of "Module:EnemyShipData"

From Kancolle Wiki
Jump to navigation Jump to search
(Created page with "local BaseData = require("Module:BaseData") local EnemyShipData = BaseData() function EnemyShipData:name() if self._suffix then return self:base_name() .. " " .. self._su...")
 
m
Line 130: Line 130:
 
function EnemyShipData:range()
 
function EnemyShipData:range()
 
return self._range
 
return self._range
 +
end
 +
 +
function EnemyShipData:as_rating()
 +
    return self._as_rating
 
end
 
end
 
   
 
   

Revision as of 21:26, 14 April 2015

Documentation for this module may be created at Module:EnemyShipData/doc

local BaseData = require("Module:BaseData")
local EnemyShipData = BaseData()
 
function EnemyShipData:name()
	if self._suffix then
		return self:base_name() .. " " .. self._suffix
	else
		return self:base_name()
	end
end
 
function EnemyShipData:base_name()
	return self._name
end
 
function EnemyShipData:link()
	if self._page then
		return self._page, self:name()
	elseif self._suffix then
		return self:base_name(), self:name()
	else
		return self:name()
	end
end
 
function EnemyShipData:localized_name()
	return self._localized_name
end
 
function EnemyShipData:nick()
	return self._nick
end
 
function EnemyShipData:japanese_name()
	return self._japanese_name
end
 
function EnemyShipData:japanese_nick()
	return self._japanese_nick
end
 
function EnemyShipData:reading()
	return self._reading
end
 
function EnemyShipData:reading_nick()
	return self._reading_nick
end

function EnemyShipData:battle_card()
	return self._battle_card
end
 
function EnemyShipData:hp()
	return self._hp
end

function EnemyShipData:firepower()
	return self._firepower
end

function EnemyShipData:torpedo()
	return self._torpedo
end

function EnemyShipData:aa()
	return self._aa
end

function EnemyShipData:armor()
	return self._armor
end

function EnemyShipData:asw()
	return self._asw
end

function EnemyShipData:evasion()
	return self._evasion
end

function EnemyShipData:los()
	return self._los
end

function EnemyShipData:luck()
	return self._luck
end

function EnemyShipData:slot(slot)
	if self._equipment then
		local equipment_slot = self._equipment[slot]
		if equipment_slot then
			return equipment_slot.equipment, equipment_slot.size
		end
	end
	return nil
end
 
function EnemyShipData:slots()
	if self._equipment then
		return #self._equipment
	end
	return nil
end
 
function EnemyShipData:total_space()
	if not self._equipment then
		return nil
	end
	local total_space = 0
	local size
	for _, v in ipairs(self._equipment) do
		size = v["size"]
		if size == nil then
			total_space = nil
			break
		elseif size == false then
		else
			total_space = total_space + size
		end
	end
	return total_space
end
 
function EnemyShipData:speed()
	return self._speed
end
 
function EnemyShipData:range()
	return self._range
end

function EnemyShipData:as_rating()
    return self._as_rating
end
 
function EnemyShipData:create(ship)
	ship = ship or {}
	setmetatable(ship, ship)
	ship.__index = self
	return ship
end
 
EnemyShipData.__call = EnemyShipData.create
 
return EnemyShipData