Widget:Summon Simulator/JP/20170901

<!doctype html> FFBE Gacha Simulator - exviuswiki.com     /**		 * FFBE JP Gacha Simulator v2.3 *		 * https://exviuswiki.com */

var banner_rate = [ // offbanner - 74.25% ['3', 58],			['4', 14.25],			['5', 2],

// featured - 25.75% ['3_ft', 20], ['4_ft', 4.75], ['5_ft', 1] ];

var guarantee_rate = [ // offbanner - 48.75% ['4', 47.5],			['5', 1.25],

// featured - 51.25% ['4_ft', 47.5], ['5_ft', 3.75] ];

var step2_rate = [ ['3', 56.5],           ['4', 14.25],            ['5', 3],            ['3_ft', 20], ['4_ft', 4.75], ['5_ft', 1.5] ];

var step2guarantee_rate = [ ['4', 46.25],           ['5', 1.875],            ['4_ft', 46.25], ['5_ft', 5.625] ];

var step3guarantee_rate = [ ['5', 66.66],           ['5_ft', 33.33] ];

var step4_rate = [ ['3', 56.25],           ['4', 14.25],            ['5', 4],            ['3_ft', 18.75], ['4_ft', 4.75], ['5_ft', 2] ];

var step4guarantee_rate = [ ['4', 45],           ['5', 2.5],            ['4_ft', 45], ['5_ft', 7.5] ];

var step5_rate = [ ['3', 54],           ['4', 14.25],            ['5', 6],            ['3_ft', 18], ['4_ft', 4.75], ['5_ft', 3] ];

var step5guarantee_rate = [ ['4', 42.5],           ['5', 3.75],            ['4_ft', 42.5], ['5_ft', 11.25] ];

var units = [ { name: 'Sephiroth',               base: 5, featured: true }, { name: 'Lila',            base: 5, featured: true }, { name: 'Kid Rydia',               base: 5, featured: false }, { name: 'Helmless Kain',               base: 5, featured: false }, { name: 'CG Lid',              base: 5, featured: false }, { name: 'CG Fina',             base: 5, featured: false }, { name: 'Kunshira',                base: 5, featured: false }, { name: 'Aranea',              base: 5, featured: false }, { name: 'Prompto',             base: 5, featured: false }, { name: 'Basch',               base: 5, featured: false }, { name: 'Gabranth',            base: 5, featured: false }, { name: 'CG Jake',             base: 5, featured: false }, { name: 'Emperor Shera',               base: 5, featured: false }, { name: 'Yuna',            base: 5, featured: false }, { name: 'Lulu',            base: 5, featured: false }, { name: 'CG Sakura',               base: 5, featured: false }, { name: 'Beatrix',             base: 5, featured: false }, { name: 'Eiko',            base: 5, featured: false }, { name: 'CG Lasswell',             base: 5, featured: false }, { name: 'Jiraiya',                 base: 5, featured: false }, { name: 'Gladiolus',              base: 5, featured: false }, { name: 'Duke',            base: 5, featured: false }, { name: 'Cloud',               base: 5, featured: false }, { name: 'Elfried',             base: 5, featured: false }, { name: 'Roy',             base: 5, featured: false }, { name: 'Ayaka',               base: 5, featured: false }, { name: 'Nyx',             base: 5, featured: false }, { name: 'Onion Knight',            base: 5, featured: false }, { name: 'Prishe',              base: 5, featured: false }, { name: 'Balthier',            base: 5, featured: false }, { name: 'Veritas of the Light',				base: 5, featured: false }, { name: 'Veritas of the Dark',				base: 5, featured: false }, { name: 'Veritas of the Flame',				base: 5, featured: false }, { name: 'Mercenary Ramza',				base: 5, featured: false }, { name: 'Knight Delita',				base: 5, featured: false }, { name: 'Lunera',				base: 5, featured: false }, { name: 'Tidus',				base: 5, featured: false }, { name: 'Seabreeze Dark Fina',				base: 5, featured: false }, { name: 'Fohlen',				base: 5, featured: false }, { name: 'Wilhelm',				base: 5, featured: false }, { name: 'Rem',				base: 5, featured: false }, { name: 'Aileen',				base: 5, featured: false }, { name: 'Trance Terra',				base: 5, featured: false }, { name: 'Orlandeau',				base: 5, featured: false }, { name: 'Queen',				base: 5, featured: false }, { name: 'Emperor',				base: 5, featured: false }, { name: 'Marie',				base: 5, featured: false }, { name: 'Ace',					base: 5, featured: false }, { name: 'Dark Fina',			base: 5, featured: false }, { name: 'Noctis',				base: 5, featured: false }, { name: 'Gilgamesh',			base: 5, featured: false }, { name: 'Luneth',				base: 5, featured: false }, { name: 'Dark Knight Cecil',	base: 5, featured: false }, { name: 'Delita',				base: 5, featured: false }, { name: 'Ramza',				base: 5, featured: false }, { name: 'Lightning',			base: 5, featured: false }, { name: 'Shylt',                base: 4, featured: true }, { name: 'Yang',                base: 4, featured: false }, { name: 'Killian',                 base: 4, featured: false }, { name: 'Wado',                base: 4, featured: false }, { name: 'Vayne',                   base: 4, featured: false }, { name: 'Drace',                   base: 4, featured: false }, { name: 'Ozetta',                  base: 4, featured: false }, { name: 'Seymour',                 base: 4, featured: false }, { name: 'Vern',                base: 4, featured: false }, { name: 'Sedona',                  base: 4, featured: false }, { name: 'Steiner',                 base: 4, featured: false }, { name: 'Kaede',                   base: 4, featured: false }, { name: 'Ohga',                base: 4, featured: false }, { name: 'Cor',                 base: 4, featured: false }, { name: 'Olif',                base: 4, featured: false }, { name: 'Mystea',                 base: 4, featured: false }, { name: 'William',                 base: 4, featured: false }, { name: 'Chloe',                   base: 4, featured: false }, { name: 'Gouken',                  base: 4, featured: false }, { name: 'Sylvia',                  base: 4, featured: false }, { name: 'Glauca',                  base: 4, featured: false }, { name: 'Crowe',                   base: 4, featured: false }, { name: 'Aura',                base: 4, featured: false }, { name: 'Aria',                base: 4, featured: false }, { name: 'Desch',                   base: 4, featured: false }, { name: 'Werei',                   base: 4, featured: false }, { name: 'Veritas of the Heavens',				base: 4, featured: false }, { name: 'Veritas of the Waters',				base: 4, featured: false }, { name: 'Veritas of the Earth',				base: 4, featured: false }, { name: 'Victoria',				base: 4, featured: false }, { name: 'Meliadoul',				base: 4, featured: false }, { name: 'Orran',				base: 4, featured: false }, { name: 'Bran',				base: 4, featured: false }, { name: 'Helena',				base: 4, featured: false }, { name: 'Ashe',				base: 4, featured: false }, { name: 'Rasler',				base: 4, featured: false }, { name: 'Rikku',				base: 4, featured: false }, { name: 'Beach Time Fina',				base: 4, featured: false }, { name: 'Ilias',				base: 4, featured: false }, { name: 'Amelia',				base: 4, featured: false }, { name: 'Grace',				base: 4, featured: false }, { name: 'King',				base: 4, featured: false }, { name: 'Sozhe',				base: 4, featured: false }, { name: 'Setzer',				base: 4, featured: false }, { name: 'Soleil',				base: 4, featured: false }, { name: 'Nine',				base: 4, featured: false }, { name: 'Shine',				base: 4, featured: false }, { name: 'Leon',					base: 4, featured: false }, { name: 'Rosa',					base: 4, featured: false }, { name: 'Hope',					base: 4, featured: false }, { name: 'Vanille',				base: 4, featured: false }, { name: 'Gaffgarion',			base: 4, featured: false }, { name: 'Agrias',				base: 4, featured: false }, { name: 'Garnet',				base: 4, featured: false }, { name: 'Chizuru',				base: 4, featured: false }, { name: 'Warrior of Light',		base: 4, featured: false }, { name: 'Luka',					base: 4, featured: false }, { name: 'Mercedes',				base: 4, featured: false }, { name: 'Refia',				base: 4, featured: false }, { name: 'Seven',				base: 4, featured: false }, { name: 'Snow',					base: 4, featured: false }, { name: 'Mim',                 base: 3, featured: true }, { name: 'Edward',                  base: 3, featured: false }, { name: 'Erwin',                   base: 3, featured: false }, { name: 'Larsa',                   base: 3, featured: false }, { name: 'Riley',                   base: 3, featured: false }, { name: 'Black Waltz 3',                   base: 3, featured: false }, { name: 'Otogiri',                 base: 3, featured: false }, { name: 'Iris',                base: 3, featured: false }, { name: 'Shaly',                   base: 3, featured: false }, { name: 'Ryunan',                  base: 3, featured: false }, { name: 'Conrad',                  base: 3, featured: false }, { name: 'Amy',                 base: 3, featured: false }, { name: 'Kamui',                   base: 3, featured: false }, { name: 'Yuri',                base: 3, featured: false }, { name: 'Libertus',                base: 3, featured: false }, { name: 'Grom',                base: 3, featured: false }, { name: 'Sara',                base: 3, featured: false }, { name: 'Kupipi',                  base: 3, featured: false }, { name: 'Timothy',				base: 3, featured: false }, { name: 'Ruggles',				base: 3, featured: false }, { name: 'Wakka',				base: 3, featured: false }, { name: 'Summer Lid',				base: 3, featured: false }, { name: 'Camille',				base: 3, featured: false }, { name: 'Abel',				base: 3, featured: false }, { name: 'Jean',				base: 3, featured: false }, { name: 'Sice',				base: 3, featured: false }, { name: 'Heltich',				base: 3, featured: false }, { name: 'Ulrica',				base: 3, featured: false }, { name: 'Gau',				base: 3, featured: false }, { name: 'Ovelia',				base: 3, featured: false }, { name: 'Lawrence',				base: 3, featured: false }, { name: 'Eight',				base: 3, featured: false }, { name: 'Cinque',				base: 3, featured: false }, { name: 'Shera',				base: 3, featured: false }, { name: 'Kefka',				base: 3, featured: false }, { name: 'Terra',				base: 3, featured: false }, { name: 'Guy',					base: 3, featured: false }, { name: 'Elle',					base: 3, featured: false }, { name: 'Faris',				base: 3, featured: false }, { name: 'Ingus',				base: 3, featured: false }, { name: 'Arc',					base: 3, featured: false }, { name: 'Jack',					base: 3, featured: false }, { name: 'Trey',					base: 3, featured: false }, { name: 'Edge',					base: 3, featured: false }, { name: 'Fang',					base: 3, featured: false }, { name: 'Sazh',					base: 3, featured: false }, { name: 'Mustadio',				base: 3, featured: false }, { name: 'Alma',					base: 3, featured: false }, { name: 'Ludmille',				base: 3, featured: false }, { name: 'Charlotte',			base: 3, featured: false }, { name: 'Amarant',				base: 3, featured: false }, { name: 'Freya',				base: 3, featured: false }, { name: 'Hayate',				base: 3, featured: false }, { name: 'Rakshasa',				base: 3, featured: false }, { name: 'Tellah',				base: 3, featured: false }, { name: 'Lenna',				base: 3, featured: false }, { name: 'Celes',				base: 3, featured: false }, { name: 'Gilbert',				base: 3, featured: false }, { name: 'Leo',					base: 3, featured: false }, { name: 'Locke',				base: 3, featured: false }, { name: 'Artemios',				base: 3, featured: false }, { name: 'Xiao',					base: 3, featured: false }, { name: 'Golbez',				base: 3, featured: false }, { name: 'Miyuki',				base: 3, featured: false }, { name: 'Medius',				base: 3, featured: false }, { name: 'Roselia',				base: 3, featured: false }, { name: 'Cerius',				base: 3, featured: false }, { name: 'Duane',				base: 3, featured: false }, { name: 'Vaan',					base: 3, featured: false }, { name: 'Zidane',				base: 3, featured: false }, { name: 'Firion',				base: 3, featured: false }, { name: 'Bartz',				base: 3, featured: false }, { name: 'Cecil',				base: 3, featured: false }, { name: 'Cloud of Darkness',	base: 3, featured: false }, { name: 'Kuja',					base: 3, featured: false }, { name: 'Exdeath',				base: 3, featured: false }, { name: 'Garland',				base: 3, featured: false }, { name: 'Lani',					base: 3, featured: false }, { name: 'Galuf',				base: 3, featured: false }, { name: 'Russell',				base: 3, featured: false }, { name: 'Bedile',				base: 3, featured: false }, { name: 'Luna',					base: 3, featured: false }, { name: 'Anzelm',				base: 3, featured: false }, { name: 'Clyne',				base: 3, featured: false }, { name: 'Cyan',					base: 3, featured: false }, { name: 'Rydia',				base: 3, featured: false }, { name: 'Shantotto',			base: 3, featured: false }, { name: 'Fran',					base: 3, featured: false }, { name: 'Edgar',				base: 3, featured: false }, { name: 'Kain',					base: 3, featured: false }, { name: 'Krile',				base: 3, featured: false }, { name: 'Shadow',				base: 3, featured: false }, { name: 'Sabin',				base: 3, featured: false }, { name: 'Maria',				base: 3, featured: false }, { name: 'Penelo',				base: 3, featured: false }, { name: 'Vivi',					base: 3, featured: false } ];

function arrayColumn(arr, n) { return arr.map(x=> x[n]); }

function summon(num) { $('.gacha-result').text("");

$('.loading img').attr("src", "").attr("src", $('.loading img').data("src")); $('.loading').show;

var wikiresult = ""; var total_5 = 0; var total_4 = 0; var total_3 = 0;

for (i = 1; i <= num; i++) { // randomize base var random;

if (num == 11 && i == 1) { // guarantee pull random = chance.weighted(arrayColumn(guarantee_rate, 0), arrayColumn(guarantee_rate, 1)); }				else{ random = chance.weighted(arrayColumn(banner_rate, 0), arrayColumn(banner_rate, 1)); }

var banner = random.split("_"); var rarity = parseInt(banner[0]); var featured = banner[1] == 'ft' ? true : false;

if (rarity == 5) { total_5++; }				else if (rarity == 4) { total_4++; }				else if (rarity == 3) { total_3++; }

// randomize selection within pool var pool = _.where(units, {base: rarity, featured: featured});

var result = chance.integer({min: 0, max: pool.length - 1}); var name = pool[result]['name'];

if (i == 1) { wikiresult += ' ' + name + ' ' + rarity + '_star '; wikiresult += ' '; }				else if (i % 2 == 0) { wikiresult += ''; wikiresult += ' ' + name + ' ' + rarity + '_star '; }				else if (i % 2 == 1){ wikiresult += ' ' + name + ' ' + rarity + '_star '; wikiresult += ' '; }			}			var bold = document.createElement('b'); bold.setAttribute('style', 'font-size:24px') bold.innerText = total_5; var wikitext = ' ';

$.ajax({				url: "//exvius.gamepedia.com/api.php?action=parse&format=json&prop=text&contentmodel=wikitext&text=" + wikitext,				dataType: "json"			}) .done(function( data ) {				result = data.parse.text["*"];				result = result.replace(/3_star/g, " &#9733;&#9733;&#9733;  ");				result = result.replace(/4_star/g, "  &#9733;&#9733;&#9733;&#9733;  ");				result = result.replace(/5_star/g, "  &#9733; &#9733; &#9733; &#9733; &#9733;  ");				$('.gacha-result').html(result);

$('.loading img').attr("src", ""); $('.loading').hide; });		}

function repeatSummon { $('.gacha-result').text("");

$('.loading img').attr("src", "").attr("src", $('.loading img').data("src")); $('.loading').show;

var obtained_5 = []; var obtained_4 = []; var obtained_3 = []; var lapis = 0;

var trigger = false;

while (trigger == false) { lapis += 5000;

for (i = 1; i <= 11; i++) { // randomize base var random;

if (i == 1) { // guarantee pull random = chance.weighted(arrayColumn(guarantee_rate, 0), arrayColumn(guarantee_rate, 1)); }					else{ random = chance.weighted(arrayColumn(banner_rate, 0), arrayColumn(banner_rate, 1)); }

var banner = random.split("_"); var rarity = parseInt(banner[0]); var featured = banner[1] == 'ft' ? true : false;

// randomize selection within pool var pool = _.where(units, {base: rarity, featured: featured});

var result = chance.integer({min: 0, max: pool.length - 1}); var name = pool[result]['name'];

if (rarity == 5) { obtained_5.push(name); trigger = true; }					else if (rarity == 4) { obtained_4.push(name); }					else if (rarity == 3) { obtained_3.push(name); }				}			}

result = 'Attempts = ' + lapis / 5000 + ' '; result += 'Lapis used = ' + lapis + ' '; result += '5&#9733; (' + obtained_5.length + ') = '; for (i = 0; i < obtained_5.length; i++) { result += obtained_5[i] + ' '; }			result += ' '; result += '4&#9733; (' + obtained_4.length + ') = '; for (i = 0; i < obtained_4.length; i++) { result += obtained_4[i] + ' '; }			result += ' '; result += '3&#9733; (' + obtained_3.length + ') = '; for (i = 0; i < obtained_3.length; i++) { result += obtained_3[i] + ' '; }

$('.gacha-result').html(result);

$('.loading img').attr("src", ""); $('.loading').hide; }

function stepSummon { $('.gacha-result').text("");

$('.loading img').attr("src", "").attr("src", $('.loading img').data("src")); $('.loading').show; var result = "";

for (step = 1; step <= 5; step++) { var obtained_5 = []; var obtained_4 = []; var obtained_3 = []; for (i = 1; i <= 11; i++) { // randomize base var random; if (step == 1) { if (i == 1) { // guarantee pull random = chance.weighted(arrayColumn(guarantee_rate, 0), arrayColumn(guarantee_rate, 1)); obtained_5.push("Trust Moogle"); }   					else{ random = chance.weighted(arrayColumn(banner_rate, 0), arrayColumn(banner_rate, 1)); }                   }                    else if (step == 2) { if (i == 1) { // guarantee pull random = chance.weighted(arrayColumn(step2guarantee_rate, 0), arrayColumn(step2guarantee_rate, 1)); }   					else{ random = chance.weighted(arrayColumn(step2_rate, 0), arrayColumn(step2_rate, 1)); }                   }                    else if (step == 3) { if (i == 1) { // guarantee pull random = chance.weighted(arrayColumn(guarantee_rate, 0), arrayColumn(guarantee_rate, 1)); }                       else if (i == 11) { // guarantee pull random = chance.weighted(arrayColumn(step3guarantee_rate, 0), arrayColumn(step3guarantee_rate, 1)); }   					else{ random = chance.weighted(arrayColumn(banner_rate, 0), arrayColumn(banner_rate, 1)); }                   }                    else if (step == 4) { if (i == 1) { // guarantee pull random = chance.weighted(arrayColumn(step4guarantee_rate, 0), arrayColumn(step4guarantee_rate, 1)); }                       else if (i == 11) { // guarantee pull random = "4_ft"; }   					else{ random = chance.weighted(arrayColumn(step4_rate, 0), arrayColumn(step4_rate, 1)); }                   }                    else if (step == 5) { if (i == 1) { // guarantee pull random = chance.weighted(arrayColumn(step5guarantee_rate, 0), arrayColumn(step5guarantee_rate, 1)); }                       else if (i == 11) { // guarantee pull random = "5_ft"; }   					else{ random = chance.weighted(arrayColumn(step5_rate, 0), arrayColumn(step5_rate, 1)); }                   }

var banner = random.split("_"); var rarity = parseInt(banner[0]); var featured = banner[1] == 'ft' ? true : false;

// randomize selection within pool var pool = _.where(units, {base: rarity, featured: featured});

var rng = chance.integer({min: 0, max: pool.length - 1}); var name = pool[rng]['name'];

if (rarity == 5) { obtained_5.push(name); }					else if (rarity == 4) { obtained_4.push(name); }					else if (rarity == 3) { obtained_3.push(name); }				}   			result += 'Step ' + step +' '; result += '5&#9733; (' + obtained_5.length + ') = '; for (i = 0; i < obtained_5.length; i++) { result += obtained_5[i] + ' '; }   			result += ' '; result += '4&#9733; (' + obtained_4.length + ') = '; for (i = 0; i < obtained_4.length; i++) { result += obtained_4[i] + ' '; }   			result += ' '; result += '3&#9733; (' + obtained_3.length + ') = '; for (i = 0; i < obtained_3.length; i++) { result += obtained_3[i] + ' '; }               result += '  '; }

$('.gacha-result').html(result);

$('.loading img').attr("src", ""); $('.loading').hide; }		Summon (1) Summon (3) Summon (10+1) Repeat 10+1 until one or more 5★ is found 5 Steps Summon  Loading...