×
Create a new article
Write your page title here:
We currently have 770 articles on Angry Birds Wiki. Type your article name above or create one of the articles listed here!



    Angry Birds Wiki
    770Articles

    Module:AB2 rank feathers

    Revision as of 21:56, 22 August 2021 by fandom:angrybirds>Ytxmobile (compute feathers)
    This wiki has been automatically closed because there have been no edits or log actions made within the last 60 days. If you are a user (who is not the bureaucrat) that wishes for this wiki to be reopened, please request that at Requests for reopening wikis. If this wiki is not reopened within 6 months it may be deleted. Note: If you are a bureaucrat on this wiki, you can go to Special:ManageWiki and uncheck the "Closed" box to reopen it.

    This module allows you to obtain number of feathers at each single rank, and number of feathers in total to promote all birds to a certain rank.

    Get number of birds

    {{#invoke:AB2 rank feathers|getNumBirds}}

    gives: Lua error in package.lua at line 80: module 'Dev:Arguments' not found.

    Get single rank feathers

    {{#invoke:AB2 rank feathers|getSingleFeathers|<rank>}}
    • <rank>: a positive integer.

    Examples

    • {{#invoke:AB2 rank feathers|getSingleFeathers|2}}
      gives: Lua error in package.lua at line 80: module 'Dev:Arguments' not found.
    • {{#invoke:AB2 rank feathers|getSingleFeathers|10}}
      gives: Lua error in package.lua at line 80: module 'Dev:Arguments' not found.
    • {{#invoke:AB2 rank feathers|getSingleFeathers|51}}
      gives: Lua error in package.lua at line 80: module 'Dev:Arguments' not found.
    • {{#invoke:AB2 rank feathers|getSingleFeathers|100}}
      gives: Lua error in package.lua at line 80: module 'Dev:Arguments' not found.

    Get accumulated feathers (for all Lua error in package.lua at line 80: module 'Dev:Arguments' not found. birds)

    {{#invoke:AB2 rank feathers|getAccumulatedFeathers|<rank>}}
    • <rank>: a positive integer.

    Examples

    • {{#invoke:AB2 rank feathers|getAccumulatedFeathers|2}}
      gives: Lua error in package.lua at line 80: module 'Dev:Arguments' not found.
    • {{#invoke:AB2 rank feathers|getAccumulatedFeathers|10}}
      gives: Lua error in package.lua at line 80: module 'Dev:Arguments' not found.
    • {{#invoke:AB2 rank feathers|getAccumulatedFeathers|51}}
      gives: Lua error in package.lua at line 80: module 'Dev:Arguments' not found.
    • {{#invoke:AB2 rank feathers|getAccumulatedFeathers|100}}
      gives: Lua error in package.lua at line 80: module 'Dev:Arguments' not found.

    See also

    Angry Birds 2 modules
    Templates

    References


    local getArgs = require('Module:Common').getArgs
    
    local singleFeathers = {
    	0,                                               -- Vanilla (1)
    	100,   250,   550,   950,   1400,  1600,  1800,  -- Vanilla (2-8)
    	1900,  2100,  2300,  2400,  2600,  2900,  3100,  -- Elder (9-15)
    	3300,  3500,  3700,  3900,  5000,  6000,  7000,  -- Master (16-22)
    	9000,  12000, 15000, 17000, 18000, 19000, 23000, -- Pristine (23-29)
    	30000, 35000, 40000, 45000, 50000, 50000, 50000, -- Epic (30-36)
    	50000, 50000, 50000, 50000, 50000, 50000, 50000, -- Ancient (37-43)
    	50000, 50000, 50000, 50000, 50000, 50000, 50000, -- Mythic (44-50)
    	50000,                                           -- Legendary (51+)
    }
    
    -- compute accumulated feathers
    local numBirds = 7
    local accumulatedFeathers = (function()
    	local accumulatedFeathers = {0}
    	for i = 2, #singleFeathers do
    		table.insert(accumulatedFeathers, singleFeathers[i] * numBirds + accumulatedFeathers[i-1])
    	end
    	
    	return accumulatedFeathers
    end)()
    
    local p = {}
    
    p.getSingleFeathers = function(frame)
    	local args = getArgs(frame)
    	local rank = tonumber(args[1])
    	
    	if rank < 1 then
    		return 0
    	elseif rank > #singleFeathers then
    		rank = #singleFeathers
    	end
    	return singleFeathers[rank]
    end
    
    p.getAccumulatedFeathers = function(frame)
    	local args = getArgs(frame)
    	local rank = tonumber(args[1])
    	
    	if rank < 1 then
    		return 0
    	elseif rank > #singleFeathers then
    		local result = accumulatedFeathers[#singleFeathers]
    		result = result + (rank - #singleFeathers) * singleFeathers[#singleFeathers] * numBirds
    		return result
    	end
    	return accumulatedFeathers[rank]
    end
    
    return p
    
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.