Module:GetRandomCreature: Difference between revisions

Jump to navigation Jump to search
9,418 bytes removed ,  22:12, 8 August 2019
no edit summary
mNo edit summary
No edit summary
Line 1: Line 1:
local p = {}
local p = {}
local colorparse = require'Module:ColorParse'


function p.Main(frame)
function p.qudlook(frame)
  local buildcode=string.lower(frame)
  local genotype
  local subtype
  local classcalled
  local extname
  local attributes = {}
  local bonus = {}
  local exts = {}
  if (string.len(buildcode)>=8) then
  --[Check Genotype Code, and then subtype code]
    local genotypeC = string.match(buildcode,'%w')
    local subtypeC = string.sub(buildcode,2,2)
    if (genotypeC == 'a') then
      genotype="True Kin"
      classcalled = "Caste: "
      extname = "Implants: "
      subtype = p.TrueKinSubtype(subtypeC)
    elseif (genotypeC == 'b') then
      genotype="Mutated Human"
      classcalled = "Calling: "
      extname = "Mutations: "
      subtype = p.MutantSubtype(subtypeC)
    else
      print("The genotype code " .. genotypeC .. " does not exist!")
    end
    --[Check if subtype worked]
    if (subtype == nil) then
      print("Couldn't find subtype " ..subtypeC)
    else
    --[get attributes and put it in a table]
      local attributesC = string.sub(buildcode,2,8)
      local i = 1
      for char in string.gmatch(attributesC, "%w") do
        attributes[i] = tonumber(string.byte(char))-91
        i = i+1
      end
      --[Mutations/Implants hooray.....]
      --if >8 chars, and have an even set of chars
      if (buildcode:len() >=10 and buildcode:len()%2 ==0) then
      local i = 1
      local extstring = buildcode:sub(9)
        for chars in string.gmatch(extstring,"%w%w") do
            exts[i] = p.getexts(chars)
            i=i+1
        end
      end
      --calculate bonus
      bonus=p.getbonus(subtype)
      --make the dang sheet
      p.MakeUpSheet(buildcode, genotype, subtype, classcalled, extname, attributes,bonus,exts)
    end
  else
    print("This build code is too short(<8 chars)!")
  end
end


function p.TrueKinSubtype(code)
local bordercolor
--[1 NAME, stats (2 STR, 3 AGI, 4 TUF, 5 INT, 6 WIL, 7 EGO),]--
local padding
--[8 Skills, Resist(9 ACID, 10 ELEC, 11 COLD, 12 HEAT, 13 BLEED), 14 bonusstart]--
local bottomtext
local caste= {
  --[The Toxic Arboreta of Ekuemekiyye, the Holy City]
  ['a'] = {"Horticulturist", 0,0,0,3,0,0,"Harvestry, Axe Proficiency, Steady Hands, Draw a Bead, Wilderness Lore: Jungles",0,0,0,0,2, "Start with a bio-scanning bracelet"},
  ['b'] = {"Priest of All Suns", 0,0,0,0,0,3,"Cudgel Proficiency, Heal, Snake Oiler, Intimidate, Wilderness Lore: Jungles",0,0,0,0,2,"Start with a smiling sun mask"},
  ['c'] = {"Priest of All Moons", 0,0,2,0,2,0,"Axe Proficiency, Butchery, Lionheart, Poison Tolerance, Wilderness Lore: Jungles",0,0,0,0,2, "Start with a frowning moon mask"},
  ['d'] = {"Syzygyrior", 0,3,0,0,0,0,"Offhand Strikes, Ambidexterity, Wayfaring: Jungle",0,0,0,0,0, "Start with a bio-scanning bracelet"},
  --[he Ice-Sheathed Arcology of Ibul]
  ['e'] = {"Artifex", 0,0,0,3,0,0,"Repair, Disassemble,Deploy Turret, Tinker I, Tinker II",0,0,15,0,0,""},
  ['f'] = {"Consul", 0,0,0,0,0,3,"Inspiring Presence, Proselytize",0,0,15,0,0, ""},
  ['g'] = {"Praetorian", 2,0,1,0,1,0,"Long Blade Proficiency, Shield Slam, Steady Hands, Draw a Bead", 0,0,15,0,0,""},
  ['h'] = {"Eunuch", 0,2,0,2,0,0,"Hobble, Weak Spotter, Spry, Hurdle",0,0,15,0,0,""},
  --[The Crustal Mortars of Yawningmoon]
  ['i'] = {"Child of the Hearth", 3,0,0,0,0,0,"Slam, Calloused, Strapping Shoulders",0,0,0,15,0, ""},
  ['j'] = {"Child of the Wheel", 1,2,0,0,0,1,"Short Blades Proficiency, Cleave, Offhand Strikes, Iron Mind",0,0,0,15,0,""},
  ['k'] = {"Child of the Deep", 0,0,3,0,0,0,"Tank, Strapping Shoulders, Shake It Off, Wilderness Lore: Mountains, Wilderness Long: Canyons",0,0,0,15,0, ""},
  ['l'] = {"Fuming God-Child", 0,0,0,0,4,0,"Fasting Way, Lionheart, Poison Tolerance, Intimidate",0,0,0,15,0, ""}
}
return caste[code]
end


function p.MutantSubtype(code)
--[Determine border color]--
--[NAME, stats (STR, AGI, TUF, INT, WIL, EGO),]--
local bordercolorin = frame.args['bordercolor']
--[Skills, Resist(ACID, ELEC, COLD, HEAT, BLEED), bonusstart]--
if bordercolorin == nil or bordercolorin == 'c' then
local calling = {
   bordercolor = ''
  ['a'] = {"Apostle", 0,0,0,0,0,2,"Intimidate, Proselytize, Tactful",0,0,0,0,0, ""},
elseif bordercolorin == 'y' then
  ['b'] = {"Arconaut", 0,2,0,0,0,0,"Short Blades Proficiency, Scavenger, Spry",0,0,0,0,0,"Start with random junk and artifacts"},
bordercolor='white-border'
  ['c'] = {"Greybeard", -1,0,0,0,3,0,"Cudgel Proficiency, Berate, Calloused",0,0,0,0,0, "Start with +100 bear reputation"},
else
   ['d'] = {"Gunslinger", 0,2,0,0,0,0,"Weak Spotter",0,0,0,0,0, "Start with +200 reputation with mysterious strangers"},
   error('bordercolor not set to either "c" or "y"',0)
  ['e'] = {"Marauder", 2,0,0,0,0,0,"Dismember, Charge, Butchery",0,0,0,0,0,""},
  ['f'] = {"Pilgrim", 0,0,0,0,2,0,"Meditate, Fasting Way, Iron Mind, Mind's Compass",0,0,0,0,0, ""},
  ['g'] = {"Nomad", 0,0,2,0,0,0,"Mind's Compass, Wilderness Lore: Salt Pans, Harvestry,Weathered", 0,0,15,15,0,"Starts with +200 Issachari reputation"},
  ['h'] = {"Scholar", 0,0,0,2,0,0,"Gadget Inspector, Heal, Harvestry, Hurdle, Tactful",0,0,0,0,0,""},
  ['i'] = {"Tinker", 0,0,0,2,0,0,"Gadget Inspector, Lay Mine, Disassemble, Repair, Tinker I",0,0,0,0,0, "Begins with a number of random artifacts and scrap and +100 Barathrumites reputation"},
  ['j'] = {"Warden", 2,0,0,0,0,0,"Long Blades Proficiency, Shield Slam, Steady Hands, Draw a Bead, Pistol Proficiency",0,0,0,0,0,"Starts with +300 Warden reputation"},
   ['k'] = {"Water Merchant", 0,0,0,0,0,2,"Menacing Stare, Snake Oiler",0,0,0,0,0, "Starts with trade goods and a merchant's token"},
  ['l'] = {"Watervine Farmer", 0,0,2,0,0,0,"Cooking and Gathering, Harvestry, Axe Proficiency, Wilderness Lore: Salt Marshes",0,0,0,0,0, "Starts with +100 reputation with the villagers of Joppa and a farmer's token"}
}
return calling[code]
end
end


function p.getexts(code,subtypeC)
--[Determine Title Color]--
  local muts = {
local titlein= frame.args['title']
    ['aa'] = {"Chimera", 0,0,0,0,0,0},
local title = colorparse.parse('&amp;y'.. titlein)
    ['ab'] = {"Esper", 0,0,0,0,0,0},
    ['uu'] = {"Unstable Genome",0,0,0,0,0,0},
    ['ba'] = {"Adrenal Control", 0,0,0,0,0,0},
    ['bb'] = {"Burrowing Claws", 0,0,0,0,0,0},
    ['bc'] = {"Carapace", 0,0,0,0,0,0},
    ['b6'] = {"Carnivorous",0,0,0,0,0,0},
    ['bd'] = {"Corrosive Gas Generation", 0,0,0,0,0,0},
    ['be'] = {"Double-muscled", 2,0,0,0,0,0},
    ['bf'] = {"Electrical Generation", 0,0,0,0,0,0},
    ['bg'] = {"Electromagnetic Pulse",0,0,0,0,0,0},
    ['bh'] = {"Flaming Hands", 0,0,0,0,0,0},
    ['bi'] = {"Freezing Hands", 0,0,0,0,0,0},
    ['bj'] = {"Heightened Hearing", 0,0,0,0,0,0},
    ['bk'] = {"Heightened Quickness",0,0,-1,0,0,0},
    ['bl'] = {"Horns", 0,0,0,0,0,0},
    ['bm'] = {"Metamorphosis", 0,0,0,0,0,0},
    ['bn'] = {"Multiple Arms", 0,0,0,0,0,0},
    ['bo'] = {"Multiple Legs",0,0,0,0,0,0},
    ['bp'] = {"Night Vision", 0,0,0,0,0,0},
    ['bq'] = {"Phasing", 0,0,0,0,0,0},
    ['br'] = {"Photosynthetic Skin", 0,0,0,0,0,0},
    ['bs'] = {"Quills",0,0,0,0,0,0},
    ['bt'] = {"Regeneration", 0,0,0,0,0,0},
    ['bu'] = {"Sleep Gas Generation", 2,0,0,0,0,0},
    ['bv'] = {"Slime Glands", 0,0,0,0,0,0},
    ['bw'] = {"Spinnerets",0,0,0,0,0,0},
    ['bx'] = {"Stinger (Confusing Venom)", 0,0,0,0,0,0},
    ['by'] = {"Stinger (Paralyzing Venom)", 0,0,0,0,0,0},
    ['bz'] = {"Stinger (Poisoning Venom)", 0,0,0,0,0,0},
    ['b1'] = {"Thick Fur",0,0,0,0,0,0},
    ['b2'] = {"Triple-jointed", -1,2,0,0,0,0},
    ['b3'] = {"Two-headed",0,0,0,0,0,0},
    ['b4'] = {"Two-hearted", 0,0,2,0,0,0},
    ['b5'] = {"Wings", 0,0,0,0,0,0},
    --[phys defects]
    ['ca'] = {"Albino", 0,0,0,0,0,0},
    ['cb'] = {"Amphibious",0,0,0,0,0,0},
    ['cc'] = {"Analgesia", 0,0,0,0,0,0},
    ['cd'] = {"Beak", 0,0,0,0,0,-1},
    ['ce'] = {"Cold-Blooded", 0,0,0,0,0,0},
    ['cf'] = {"Brittle Bones",0,0,0,0,0,0},
    ['cg'] = {"Electromagnetic Impulse", 0,0,0,0,0,0},
    ['ch'] = {"Hemophilia", 0,0,0,0,0,0},
    ['ci'] = {"Hooks for Feet", 0,0,0,0,0,0},
    ['cj'] = {"Myopia",0,0,0,0,0,0},
    ['ck'] = {"Spontaneous Combustion", 0,0,0,0,0,0},
    --[mental muts]
    ['da'] = {"Beguiling", 0,0,0,0,0,0},
    ['db'] = {"Burgeoning",0,0,0,0,0,0},
    ['dc'] = {"Clairvoyance", 0,0,0,0,0,0},
    ['dd'] = {"Confusion", 0,0,0,0,0,0},
    ['de'] = {"Cryokinesis",0,0,0,0,0,0},
    ['df'] = {"Domination", 0,0,0,0,0,0},
    ['dg'] = {"Disintegration", 0,0,0,0,0,0},
    ['dh'] = {"Ego Projection", 0,0,0,0,0,0},
    ['di'] = {"Force Bubble",0,0,0,0,0,0},
    ['dj'] = {"Force Wall", 0,0,0,0,0,0},
    ['dk'] = {"Kindle", 0,0,0,0,0,0},
    ['dl'] = {"Light Manipulation", 0,0,0,0,0,0},
    ['dm'] = {"Mass Mind",0,0,0,0,0,0},
    ['dn'] = {"Mental Mirror", 0,0,0,0,0,0},
    ['do'] = {"Precognition", 0,0,0,0,0,0},
    ['dp'] = {"Psychometry",0,0,0,0,0,0},
    ['dq'] = {"Pyrokinesis", 0,0,0,0,0,0},
    ['dr'] = {"Sense Psychic", 0,0,0,0,0,0},
    ['ds'] = {"Space-Time Vortex",0,0,0,0,0,0},
    ['dt'] = {"Stunning Force", 0,0,0,0,0,0},
    ['du'] = {"Sunder Mind", 0,0,0,0,0,0},
    ['dv'] = {"Syphon Vim", 0,0,0,0,0,0},
    ['dw'] = {"Telepathy",0,0,0,0,0,0},
    ['dx'] = {"Teleportation", 0,0,0,0,0,0},
    ['dy'] = {"Teleport Other", 0,0,0,0,0,0},
    ['dz'] = {"Time Dilation", 0,0,0,0,0,0},
    ['d1'] = {"Temporal Fugue",0,0,0,0,0,0},
    --[mental defects]
    ['ea'] = {"Amnesia", 0,0,0,0,0,0},
    ['eb'] = {"Blinking Tic", 0,0,0,0,0,0},
    ['ec'] = {"Evil Twin",0,0,0,0,0,0},
    ['ed'] = {"Narcolepsy", 0,0,0,0,0,0},
    ['ee'] = {"Pack Rat", 0,0,0,0,0,0},
    ['ef'] = {"Socially Repugnant",0,0,0,0,0,0},
    ['eg'] = {"Unwelcome Germination", 0,0,0,0,0,0},
    --[cybernetics (to be added)]
    ['00'] = {"", 0,0,1,0,0,0},
    ['01'] = {"dermal insulation",0,0,0,0,0,0},
    ['04'] = {'optical bioscanner',0,0,0,0,0,0},
    ['05'] = {'optical technoscanner', 0,0,0,0,0,0},
    ['06'] = {'night vision', 0,0,0,0,0,0},
    ['07'] = {'hyper-elastic ankle tendons', 0,0,0,0,0,0},
    ['08'] = {'parabolic muscular subroutine', 0,0,0,0,0,0},
    ['09'] = {'translucent skin', 0,0,0,0,0,0},
    ['11'] = {'stabilizer arm locks', 0,0,0,0,0,0},
    ['12'] = {'rapid release finger flexors', 0,0,0,0,0,0},
    ['13'] = {'carbide hand bones', 0,0,0,0,0,0},
    ['14'] = {'pentaceps', 0,0,0,0,0,0},
    ['15'] = {'inflatable axons', 0,0,0,0,0,0},
    -- subtypes A-D, E-H, I-L
    ['16'] = { 'nocturnal apex', 'cherubic visage', 'air current microsensor', 0,0,0,0,0,0}
  }
  return muts[code]
end


function p.getImplants(code,subtypeC)
--[Determine qud text]--
local text = frame.args['text']
local qudtext = frame:extensionTag{ name='poem', content=colorparse.parse('&amp;y' .. text) }


--[Determine body padding]--
local paddingin = frame.args['padding']
if paddingin == nil or paddingin == '' then
  padding = '1.5'
else
  padding = paddingin
end
end


function p.getbonus(subtype)
--[Determine bottomtext]--
--STR, AGI, TOUGH,INT, WILL, EGO
local bottomin = frame.args['bottomtext']
local bonus = {}
if bottomin == nil or bottomin == '' then
bonus[1] = subtype[2]
  bottomtext= 'Perfect'
bonus[2] = subtype[3]
elseif bottomin == 'none' then
bonus[3] = subtype[4]
  bottomtext= ''
bonus[4] = subtype[5]
else
bonus[5] = subtype[6]
  bottomtext= bottomin
bonus[6] = subtype[7]
return bonus
end
end
local parsedbottomtext=colorparse.parse('&amp;Y'..bottomtext)


function p.MakeUpSheet(code, geno, subtype, classcalled, extname,attributes, bonus,exts)
--[Return html]--
print("Code: " .. code:upper())
local html = {
print("Genotype: " .. geno)
  '<div class="qud-box-wrapper' ..bordercolor..'">',
print(""..classcalled .. subtype[1])
    '<div class="qud-box">',
print("Strength: " .. tostring(attributes[1] .."+"..bonus[1].. " Agility: " .. tostring(attributes[2]).."+"..bonus[2]))
      '<span class="qud-box-header"><b>' .. title .. '</b></span>',
print("Toughness: " .. attributes[3].."+"..bonus[3] .. " Intelligence: " .. attributes[4].."+"..bonus[4])
'<div class="qud-box-content" style="font-weight:bold; line-height:1.5em; padding:0em '..padding..'em;">'..qudtext..'</div>',
print("Willpower: " .. attributes[5] .."+"..bonus[5].. " Ego: " .. attributes[6].."+"..bonus[6])
'<span class="qud-box-footer-left">'..parsedbottomtext..'</span></div></div>'
local mutstring = ""
  }
for _,ext in ipairs(exts) do
 
mutstring = mutstring .. ", "..ext[1]
return html .. '\n'
end
end
print(extname .. mutstring:sub(3))
print("Skills: " .. subtype[8])


 
return p
end
p.Main("BEAAAAAABBBH01")

Navigation menu