HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<html>
<head>
<title>Attrapez les tous !</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
</head>
<body>
<main class="container">
<div class='shooting-star' id="star"></div>
<div class="intro__item col col-hori-center">
<div class="pokeball" id="pokeball">
<div class="ball"></div>
</div>
<span>Press space to start</span>
</div>
<img class="logo" id="logo" src="https://upload.wikimedia.org/wikipedia/commons/thumb/9/98/International_Pok%C3%A9mon_logo.svg/2000px-International_Pok%C3%A9mon_logo.svg.png" alt="">
<div class="pres__item col col-verti-center col-hori-center">
<button class="button_default" data-popup="pokemonAdd" id="addPokemon">Ajouter un pokemon à mon pokédex</button>
<p class="tip" id="tip"></p>
<ul class="row wrap row-hori-center pokemon__list">
<li class="character col nowrap col-hori-center" data-name="Carapuce" data-type="eau" data-strength="5" data-maxDamages="32" data-damages="0" data-experience="6" data-id="95" data-img="https://docs.google.com/uc?export=download&id=1Cn-lDwQPYnBDI2pCrnI60UVExaez2hbd">
<img class="pokemon" src="https://docs.google.com/uc?export=download&id=1Cn-lDwQPYnBDI2pCrnI60UVExaez2hbd" alt="Carapuce">
<h4>Carapuce</h4>
<span class="type eau"></span>
</li>
<li class="character col nowrap col-hori-center" data-name="Salameche" data-type="feu" data-strength="5" data-maxDamages="28" data-damages="0" data-experience="6" data-id="96" data-img="https://docs.google.com/uc?export=download&id=1xgj8s92MO4c6QS-AYNkdHyuHqdsi1C3P">
<img class="pokemon" src="https://docs.google.com/uc?export=download&id=1xgj8s92MO4c6QS-AYNkdHyuHqdsi1C3P" alt="Salameche">
<h4>Salameche</h4>
<span class="type feu"></span>
</li>
</ul>
</div>
<div class="scene__fight col col-hori-center col-verti-center">
<div class="scene">
<div class="box-top-left box-info box-info-pokemon2">
<div class="title__text row nowrap row-hori-between">
<h2 class="title">Pokemon name</h2>
<span class="level">Lvl.<i>60</i></span>
</div>
<div class="life-bar life-bar2"></div>
</div>
<div class="box-circle box-top-right">
<div class="deadSpace">
<img class="pokemon pokemon-fighter2 pokemon-fighter" data-transition="300" src="https://vignette3.wikia.nocookie.net/ssbb/images/7/79/Squirtle_Rojo_Fuego_y_Verde_Hoja.png/revision/latest?cb=20130907041944&path-prefix=es" alt="">
</div>
</div>
<div class="box-bottom-right box-info box-info-pokemon1">
<div class="title__text row nowrap row-hori-between">
<h2 class="title">Pokemon name</h2>
<span class="level">Lvl.<i>60</i></span>
</div>
<div class="life-bar life-bar1"></div>
</div>
<div class="box-circle box-bottom-left">
<div class="deadSpace">
<img src="https://vignette3.wikia.nocookie.net/ssbb/images/7/79/Squirtle_Rojo_Fuego_y_Verde_Hoja.png/revision/latest?cb=20130907041944&path-prefix=es" class="pokemon pokemon-fighter1 pokemon-fighter" data-transition="300" alt="">
</div>
</div>
<div class="bottom-menu row nowrap">
<div class="info-fight">
<p id="action-descr">Que doit faire le pokémon ?</p>
</div>
<div class="action-fight">
<ul class="button-action row wrap">
<li id="attack"><span>Attaquer</span></li>
<li><span style="opacity: 0.3">Pokemons</span></li>
<li id="heal"><span>Objet</span></li>
<li id="leak"><span>Fuite</span></li>
</ul>
</div>
</div>
</div>
</div>
<div class="popup_pokemon" id="pokemonInfo">
<div class="popup_overlay" data-close-popup></div>
<div class="popup_container">
<span class="closed" data-close-popup></span>
<div class="card">
<span class="type" id="PTypeIco"></span>
<img class="pokemon_card" id="PImg" src="" alt="">
<header class="card_header col col-hori-center col-verti-center">
<h3 id="PName">Pikachu</h3>
<div>
<div class="hp_bar"></div>
</div>
<p><span>HP <i id="PLife">10</i>/<i id="PMax">20</i></span> <span>Lvl. <i id="PLevel">1</i></span></p>
</header>
<div class="card_body col nowrap">
<div class="stats row nowrap row-hori-between">
<div class="col col-hori-center">
<span class="data" id="PType">Vol</span>
<small>Type</small>
</div>
<div class="col col-hori-center middle">
<span class="data" id="PStrength">8</span>
<small>Force</small>
</div>
<div class="col col-hori-center">
<span class="data" id="PExperience">1670</span>
<small>Experience</small>
</div>
</div>
<div class="actions col nowrap col-hori-center" data-pokemon-action>
<button class="button_default" id="chooseFighter">Choisir Pikachu pour le combat</button>
<button class="button_default" id="deleteFighter">Retirer de mon sac</button>
</div>
</div>
</div>
</div>
</div>
<div class="popup_pokemon" id="pokemonAdd">
<div class="popup_overlay" data-close-popup></div>
<div class="popup_list">
<ul class="pokemon_lists">
<li class="pokemonRandom" data-strength="8" data-maxDamages="30" data-typeId="1" data-typeName="feu" data-img="https://docs.google.com/uc?export=download&id=1xgj8s92MO4c6QS-AYNkdHyuHqdsi1C3P">
<img src="https://docs.google.com/uc?export=download&id=1xgj8s92MO4c6QS-AYNkdHyuHqdsi1C3P" alt="">
</li>
<li class="pokemonRandom" data-strength="5" data-maxDamages="45" data-typeId="4" data-typeName="normal" data-img="https://docs.google.com/uc?export=download&id=1c_zUMtZRLs7IW7maosLk2TCEwp4AjHhG">
<img src="https://docs.google.com/uc?export=download&id=1c_zUMtZRLs7IW7maosLk2TCEwp4AjHhG" alt="">
</li>
<li class="pokemonRandom" data-strength="3" data-maxDamages="20" data-typeId="7" data-typeName="poison" data-img="https://docs.google.com/uc?export=download&id=1s2EIEL0WON_Z76v8bbPdm6_DG9QGt7C0">
<img src="https://docs.google.com/uc?export=download&id=1s2EIEL0WON_Z76v8bbPdm6_DG9QGt7C0" alt="">
</li>
<li class="pokemonRandom" data-strength="5" data-maxDamages="40" data-typeId="3" data-typeName="plante" data-img="https://docs.google.com/uc?export=download&id=1etny28fQ892L7oXhYmXc2hebmscjjr4A">
<img src="https://docs.google.com/uc?export=download&id=1etny28fQ892L7oXhYmXc2hebmscjjr4A" alt="">
</li>
<li class="pokemonRandom" data-strength="3" data-maxDamages="18" data-typeId="11" data-typeName="insecte" data-img="https://docs.google.com/uc?export=download&id=1y9itDmplq4EPPOZNvvgjSfc_3VxwQV0x">
<img src="https://docs.google.com/uc?export=download&id=1y9itDmplq4EPPOZNvvgjSfc_3VxwQV0x" alt="">
</li>
<li class="pokemonRandom" data-strength="8" data-maxDamages="48" data-typeId="2" data-typeName="eau" data-img="https://docs.google.com/uc?export=download&id=14uuxvH-v9S5Yoe673UkSxkaDjDVR8Nr8">
<img src="https://docs.google.com/uc?export=download&id=14uuxvH-v9S5Yoe673UkSxkaDjDVR8Nr8" alt="">
</li>
<li class="pokemonRandom" data-strength="6" data-maxDamages="34" data-typeId="2" data-typeName="eau" data-img="https://docs.google.com/uc?export=download&id=1D5Z33EuHtM_4vXNx8t6SLmv2S6-wCMQH">
<img src="https://docs.google.com/uc?export=download&id=1D5Z33EuHtM_4vXNx8t6SLmv2S6-wCMQH" alt="">
</li>
<li class="pokemonRandom" data-strength="5" data-maxDamages="25" data-typeId="4" data-typeName="normal" data-img="https://docs.google.com/uc?export=download&id=1O_zmuQ6QJf0ZBhShzdzZUQLWtzspqnm9">
<img src="https://docs.google.com/uc?export=download&id=1O_zmuQ6QJf0ZBhShzdzZUQLWtzspqnm9" alt="">
</li>
</ul>
</div>
<div class="popup_container">
<span class="closed" data-close-popup></span>
<div class="card">
<form action="./" method="POST" id="formAddPokemon">
<input type="hidden" name="typeName" id="pokemonTypeName" value="">
<div class="pokemon_addImg"></div>
<header class="card_header col col-hori-center col-verti-center">
<input required="required" onpaste="return false;" type="text" id="pokemonName" name="name" autocomplete="off" spellcheck="false" placeholder="Nom du pokemon">
<div>
<div class="hp_bar"></div>
</div>
<input required="required" min="1" max="100" type="number" id="pokemonMaxDamages" name="maxDamages" placeholder="Vie maximale">
</header>
<div class="card_body col nowrap">
<div class="stats row nowrap row-hori-between">
<div class="col col-hori-center">
<select required="required" id="pokemonTypeId" name="typeId">
<option value="">Type</option>
<option data-pokemonType="feu" value="1">Feu</option>
<option data-pokemonType="eau" value="2">Eau</option>
<option data-pokemonType="plante" value="3">Plante</option>
<option data-pokemonType="normal" value="4">Normal</option>
<option data-pokemonType="electrik" value="5">Electrik</option>
<option data-pokemonType="glace" value="6">Glace</option>
<option data-pokemonType="poison" value="7">Poison</option>
<option data-pokemonType="sol" value="8">Sol</option>
<option data-pokemonType="vol" value="9">Vol</option>
<option data-pokemonType="psy" value="10">Psy</option>
<option data-pokemonType="insecte" value="11">Insecte</option>
<option data-pokemonType="roche" value="12">Roche</option>
<option data-pokemonType="spectre" value="13">Spectre</option>
<option data-pokemonType="dragon" value="14">Dragon</option>
<option data-pokemonType="tenebre" value="15">Tenebre</option>
<option data-pokemonType="acier" value="16">Acier</option>
</select>
</div>
<div class="col col-hori-center middle">
<select required="required" id="pokemonStrength" name="strength">
<option value="">Force</option>
<option data-pokemonForce="1" value="1">1</option>
<option data-pokemonForce="2" value="2">2</option>
<option data-pokemonForce="3" value="3">3</option>
<option data-pokemonForce="4" value="4">4</option>
<option data-pokemonForce="5" value="5">5</option>
<option data-pokemonForce="6" value="6">6</option>
<option data-pokemonForce="7" value="7">7</option>
<option data-pokemonForce="8" value="8">8</option>
<option data-pokemonForce="9" value="9">9</option>
<option data-pokemonForce="10" value="10">10</option>
</select>
</div>
<div class="col col-hori-center">
<input required="required" type="text" value="Experience : 0" readonly="readonly" disabled="disabled" name="experience">
</div>
</div>
<div class="actions row wrap row-hori-center">
<button type="submit" class="button_default">Ajouter</button>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="scene__overlay"></div>
</main>
<audio id="intro-song" src="https://docs.google.com/uc?export=download&id=1DZYG3uP1KLiiLWck_od3HInmfdCNxui5"></audio>
<audio id="open-song" src="https://docs.google.com/uc?export=download&id=1y6TL98X5qAc5LYBzak0OUGOGiGsHDAiA"></audio>
<audio id="click-song" src="https://docs.google.com/uc?export=download&id=1nj35QHAulriS-GCUCz4dUQC7CZexENjB"></audio>
<audio id="city-song" src="https://docs.google.com/uc?export=download&id=1t9L-txyi4NlzurX2V9FKX9sfDyWf30ys"></audio>
<audio id="super-song" src="https://docs.google.com/uc?export=download&id=1kE-DilmxEQ24HibrIhNso-ptXaXgEknM"></audio>
<audio id="experience-song" src="https://docs.google.com/uc?export=download&id=1iHH1_cu3LUwE_t38kHSu7b3CAcm5OFu5"></audio>
<audio id="charge-song" src="https://docs.google.com/uc?export=download&id=1VmPDGdcMk4BFK9rKVVxlR20QcPtrNjhN"></audio>
<audio id="dead-song" src="https://docs.google.com/uc?export=download&id=1YAIWW19CGgWeT4yMcB4uMndn9azGIQ1M"></audio>
<audio id="low-hp" src="https://docs.google.com/uc?export=download&id=16Tma834yH30N5iWVPlcNiRGoXK2Z0ya4"></audio>
<audio id="fuite-song" src="https://docs.google.com/uc?export=download&id=1jr4FlpC8p1DYe4MZhG-ZzXCkiDe3aeSG"></audio>
<audio id="loose-song" src="https://docs.google.com/uc?export=download&id=1tQLjSZ2ZKIQrmGjRB2VDd3KM_aTIzmGV"></audio>
<audio id="healing-song" src="https://docs.google.com/uc?export=download&id=1gVgEYCXxxai6d0dC54GULKtCZHQfCwGB"></audio>
<audio id="victory-song" src="https://docs.google.com/uc?export=download&id=1lQpfiJwGWkRzDAW78xDhAUjC6649UMFo"></audio>
<audio id="fight-song" src="https://docs.google.com/uc?export=download&id=1XJ2BQvUQ7K1qW4VPBJbNDMU4Xsr3Xd_j"></audio>
</body>
</html>
.shooting-star{width:16px;height:16px}.shooting-star:after{content:'';position:absolute;top:-1px;left:-1px;width:1px;height:1px;-webkit-box-shadow:1px 1px transparent,2px 1px transparent,3px 1px transparent,4px 1px transparent,5px 1px transparent,6px 1px transparent,7px 1px transparent,8px 1px #606060,9px 1px #606060,10px 1px transparent,11px 1px transparent,12px 1px transparent,13px 1px transparent,14px 1px transparent,15px 1px transparent,16px 1px transparent,1px 2px transparent,2px 2px transparent,3px 2px transparent,4px 2px transparent,5px 2px transparent,6px 2px transparent,7px 2px #606060,8px 2px #a8a8a8,9px 2px #a8a8a8,10px 2px #606060,11px 2px transparent,12px 2px transparent,13px 2px transparent,14px 2px transparent,15px 2px transparent,16px 2px transparent,1px 3px transparent,2px 3px transparent,3px 3px transparent,4px 3px transparent,5px 3px transparent,6px 3px transparent,7px 3px #606060,8px 3px #a8a8a8,9px 3px #a8a8a8,10px 3px #606060,11px 3px transparent,12px 3px transparent,13px 3px transparent,14px 3px transparent,15px 3px transparent,16px 3px transparent,1px 4px transparent,2px 4px transparent,3px 4px transparent,4px 4px transparent,5px 4px transparent,6px 4px #606060,7px 4px #a8a8a8,8px 4px #a8a8a8,9px 4px #a8a8a8,10px 4px #a8a8a8,11px 4px #606060,12px 4px transparent,13px 4px transparent,14px 4px transparent,15px 4px transparent,16px 4px transparent,1px 5px #606060,2px 5px #606060,3px 5px #606060,4px 5px #606060,5px 5px #606060,6px 5px #606060,7px 5px #a8a8a8,8px 5px #a8a8a8,9px 5px #a8a8a8,10px 5px #a8a8a8,11px 5px #606060,12px 5px #606060,13px 5px #606060,14px 5px #606060,15px 5px #606060,16px 5px #606060,1px 6px #606060,2px 6px #a8a8a8,3px 6px #a8a8a8,4px 6px #a8a8a8,5px 6px #a8a8a8,6px 6px #a8a8a8,7px 6px #a8a8a8,8px 6px #a8a8a8,9px 6px #a8a8a8,10px 6px #a8a8a8,11px 6px #a8a8a8,12px 6px #a8a8a8,13px 6px #a8a8a8,14px 6px #a8a8a8,15px 6px #a8a8a8,16px 6px #606060,1px 7px transparent,2px 7px #606060,3px 7px #a8a8a8,4px 7px #a8a8a8,5px 7px #a8a8a8,6px 7px #a8a8a8,7px 7px #a8a8a8,8px 7px #a8a8a8,9px 7px #a8a8a8,10px 7px #a8a8a8,11px 7px #a8a8a8,12px 7px #a8a8a8,13px 7px #a8a8a8,14px 7px #a8a8a8,15px 7px #606060,16px 7px transparent,1px 8px transparent,2px 8px transparent,3px 8px #606060,4px 8px #a8a8a8,5px 8px #a8a8a8,6px 8px #a8a8a8,7px 8px #a8a8a8,8px 8px #a8a8a8,9px 8px #a8a8a8,10px 8px #a8a8a8,11px 8px #a8a8a8,12px 8px #a8a8a8,13px 8px #a8a8a8,14px 8px #606060,15px 8px transparent,16px 8px transparent,1px 9px transparent,2px 9px transparent,3px 9px transparent,4px 9px #606060,5px 9px #a8a8a8,6px 9px #a8a8a8,7px 9px #a8a8a8,8px 9px #a8a8a8,9px 9px #a8a8a8,10px 9px #a8a8a8,11px 9px #a8a8a8,12px 9px #a8a8a8,13px 9px #606060,14px 9px transparent,15px 9px transparent,16px 9px transparent,1px 10px transparent,2px 10px transparent,3px 10px transparent,4px 10px #606060,5px 10px #a8a8a8,6px 10px #a8a8a8,7px 10px #a8a8a8,8px 10px #a8a8a8,9px 10px #a8a8a8,10px 10px #a8a8a8,11px 10px #a8a8a8,12px 10px #a8a8a8,13px 10px #606060,14px 10px transparent,15px 10px transparent,16px 10px transparent,1px 11px transparent,2px 11px transparent,3px 11px #606060,4px 11px #a8a8a8,5px 11px #a8a8a8,6px 11px #a8a8a8,7px 11px #a8a8a8,8px 11px #a8a8a8,9px 11px #a8a8a8,10px 11px #a8a8a8,11px 11px #a8a8a8,12px 11px #a8a8a8,13px 11px #a8a8a8,14px 11px #606060,15px 11px transparent,16px 11px transparent,1px 12px transparent,2px 12px transparent,3px 12px #606060,4px 12px #a8a8a8,5px 12px #a8a8a8,6px 12px #a8a8a8,7px 12px #a8a8a8,8px 12px #a8a8a8,9px 12px #a8a8a8,10px 12px #a8a8a8,11px 12px #a8a8a8,12px 12px #a8a8a8,13px 12px #a8a8a8,14px 12px #606060,15px 12px transparent,16px 12px transparent,1px 13px transparent,2px 13px #606060,3px 13px #a8a8a8,4px 13px #a8a8a8,5px 13px #a8a8a8,6px 13px #a8a8a8,7px 13px #a8a8a8,8px 13px #606060,9px 13px #606060,10px 13px #a8a8a8,11px 13px #a8a8a8,12px 13px #a8a8a8,13px 13px #a8a8a8,14px 13px #a8a8a8,15px 13px #606060,16px 13px transparent,1px 14px transparent,2px 14px #606060,3px 14px #a8a8a8,4px 14px #a8a8a8,5px 14px #a8a8a8,6px 14px #606060,7px 14px #606060,8px 14px transparent,9px 14px transparent,10px 14px #606060,11px 14px #606060,12px 14px #a8a8a8,13px 14px #a8a8a8,14px 14px #a8a8a8,15px 14px #606060,16px 14px transparent,1px 15px #606060,2px 15px #a8a8a8,3px 15px #a8a8a8,4px 15px #606060,5px 15px #606060,6px 15px transparent,7px 15px transparent,8px 15px transparent,9px 15px transparent,10px 15px transparent,11px 15px transparent,12px 15px #606060,13px 15px #606060,14px 15px #a8a8a8,15px 15px #a8a8a8,16px 15px #606060,1px 16px #606060,2px 16px #606060,3px 16px #606060,4px 16px transparent,5px 16px transparent,6px 16px transparent,7px 16px transparent,8px 16px transparent,9px 16px transparent,10px 16px transparent,11px 16px transparent,12px 16px transparent,13px 16px transparent,14px 16px #606060,15px 16px #606060,16px 16px #606060;box-shadow:1px 1px transparent,2px 1px transparent,3px 1px transparent,4px 1px transparent,5px 1px transparent,6px 1px transparent,7px 1px transparent,8px 1px #606060,9px 1px #606060,10px 1px transparent,11px 1px transparent,12px 1px transparent,13px 1px transparent,14px 1px transparent,15px 1px transparent,16px 1px transparent,1px 2px transparent,2px 2px transparent,3px 2px transparent,4px 2px transparent,5px 2px transparent,6px 2px transparent,7px 2px #606060,8px 2px #a8a8a8,9px 2px #a8a8a8,10px 2px #606060,11px 2px transparent,12px 2px transparent,13px 2px transparent,14px 2px transparent,15px 2px transparent,16px 2px transparent,1px 3px transparent,2px 3px transparent,3px 3px transparent,4px 3px transparent,5px 3px transparent,6px 3px transparent,7px 3px #606060,8px 3px #a8a8a8,9px 3px #a8a8a8,10px 3px #606060,11px 3px transparent,12px 3px transparent,13px 3px transparent,14px 3px transparent,15px 3px transparent,16px 3px transparent,1px 4px transparent,2px 4px transparent,3px 4px transparent,4px 4px transparent,5px 4px transparent,6px 4px #606060,7px 4px #a8a8a8,8px 4px #a8a8a8,9px 4px #a8a8a8,10px 4px #a8a8a8,11px 4px #606060,12px 4px transparent,13px 4px transparent,14px 4px transparent,15px 4px transparent,16px 4px transparent,1px 5px #606060,2px 5px #606060,3px 5px #606060,4px 5px #606060,5px 5px #606060,6px 5px #606060,7px 5px #a8a8a8,8px 5px #a8a8a8,9px 5px #a8a8a8,10px 5px #a8a8a8,11px 5px #606060,12px 5px #606060,13px 5px #606060,14px 5px #606060,15px 5px #606060,16px 5px #606060,1px 6px #606060,2px 6px #a8a8a8,3px 6px #a8a8a8,4px 6px #a8a8a8,5px 6px #a8a8a8,6px 6px #a8a8a8,7px 6px #a8a8a8,8px 6px #a8a8a8,9px 6px #a8a8a8,10px 6px #a8a8a8,11px 6px #a8a8a8,12px 6px #a8a8a8,13px 6px #a8a8a8,14px 6px #a8a8a8,15px 6px #a8a8a8,16px 6px #606060,1px 7px transparent,2px 7px #606060,3px 7px #a8a8a8,4px 7px #a8a8a8,5px 7px #a8a8a8,6px 7px #a8a8a8,7px 7px #a8a8a8,8px 7px #a8a8a8,9px 7px #a8a8a8,10px 7px #a8a8a8,11px 7px #a8a8a8,12px 7px #a8a8a8,13px 7px #a8a8a8,14px 7px #a8a8a8,15px 7px #606060,16px 7px transparent,1px 8px transparent,2px 8px transparent,3px 8px #606060,4px 8px #a8a8a8,5px 8px #a8a8a8,6px 8px #a8a8a8,7px 8px #a8a8a8,8px 8px #a8a8a8,9px 8px #a8a8a8,10px 8px #a8a8a8,11px 8px #a8a8a8,12px 8px #a8a8a8,13px 8px #a8a8a8,14px 8px #606060,15px 8px transparent,16px 8px transparent,1px 9px transparent,2px 9px transparent,3px 9px transparent,4px 9px #606060,5px 9px #a8a8a8,6px 9px #a8a8a8,7px 9px #a8a8a8,8px 9px #a8a8a8,9px 9px #a8a8a8,10px 9px #a8a8a8,11px 9px #a8a8a8,12px 9px #a8a8a8,13px 9px #606060,14px 9px transparent,15px 9px transparent,16px 9px transparent,1px 10px transparent,2px 10px transparent,3px 10px transparent,4px 10px #606060,5px 10px #a8a8a8,6px 10px #a8a8a8,7px 10px #a8a8a8,8px 10px #a8a8a8,9px 10px #a8a8a8,10px 10px #a8a8a8,11px 10px #a8a8a8,12px 10px #a8a8a8,13px 10px #606060,14px 10px transparent,15px 10px transparent,16px 10px transparent,1px 11px transparent,2px 11px transparent,3px 11px #606060,4px 11px #a8a8a8,5px 11px #a8a8a8,6px 11px #a8a8a8,7px 11px #a8a8a8,8px 11px #a8a8a8,9px 11px #a8a8a8,10px 11px #a8a8a8,11px 11px #a8a8a8,12px 11px #a8a8a8,13px 11px #a8a8a8,14px 11px #606060,15px 11px transparent,16px 11px transparent,1px 12px transparent,2px 12px transparent,3px 12px #606060,4px 12px #a8a8a8,5px 12px #a8a8a8,6px 12px #a8a8a8,7px 12px #a8a8a8,8px 12px #a8a8a8,9px 12px #a8a8a8,10px 12px #a8a8a8,11px 12px #a8a8a8,12px 12px #a8a8a8,13px 12px #a8a8a8,14px 12px #606060,15px 12px transparent,16px 12px transparent,1px 13px transparent,2px 13px #606060,3px 13px #a8a8a8,4px 13px #a8a8a8,5px 13px #a8a8a8,6px 13px #a8a8a8,7px 13px #a8a8a8,8px 13px #606060,9px 13px #606060,10px 13px #a8a8a8,11px 13px #a8a8a8,12px 13px #a8a8a8,13px 13px #a8a8a8,14px 13px #a8a8a8,15px 13px #606060,16px 13px transparent,1px 14px transparent,2px 14px #606060,3px 14px #a8a8a8,4px 14px #a8a8a8,5px 14px #a8a8a8,6px 14px #606060,7px 14px #606060,8px 14px transparent,9px 14px transparent,10px 14px #606060,11px 14px #606060,12px 14px #a8a8a8,13px 14px #a8a8a8,14px 14px #a8a8a8,15px 14px #606060,16px 14px transparent,1px 15px #606060,2px 15px #a8a8a8,3px 15px #a8a8a8,4px 15px #606060,5px 15px #606060,6px 15px transparent,7px 15px transparent,8px 15px transparent,9px 15px transparent,10px 15px transparent,11px 15px transparent,12px 15px #606060,13px 15px #606060,14px 15px #a8a8a8,15px 15px #a8a8a8,16px 15px #606060,1px 16px #606060,2px 16px #606060,3px 16px #606060,4px 16px transparent,5px 16px transparent,6px 16px transparent,7px 16px transparent,8px 16px transparent,9px 16px transparent,10px 16px transparent,11px 16px transparent,12px 16px transparent,13px 16px transparent,14px 16px #606060,15px 16px #606060,16px 16px #606060}@font-face{font-family:'Pokemon GB';src:url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/142927/Pokemon_GB.eot?#iefix) format("embedded-opentype"),url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/142927/Pokemon_GB.woff) format("woff"),url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/142927/Pokemon_GB.ttf) format("truetype"),url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/142927/Pokemon_GB.svg#PokemonGB) format("svg");font-weight:400}.col,.row{display:-webkit-box;display:-ms-flexbox;display:flex}.row{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.col{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.wrap{-ms-flex-wrap:wrap;flex-wrap:wrap}.nowrap{-ms-flex-wrap:nowrap;flex-wrap:nowrap}.row-verti-center{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.col-verti-center{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.row-hori-center{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.col-hori-center{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.row-hori-between{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.col-hori-between{-webkit-box-align:space-between;-ms-flex-align:space-between;align-items:space-between}.row-verti-between{-webkit-box-align:space-between;-ms-flex-align:space-between;align-items:space-between}.col-verti-between{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.row-hori-around{-ms-flex-pack:distribute;justify-content:space-around}.col-hori-around{-webkit-box-align:space-around;-ms-flex-align:space-around;align-items:space-around}.row-verti-around{-webkit-box-align:space-around;-ms-flex-align:space-around;align-items:space-around}.col-verti-around{-ms-flex-pack:distribute;justify-content:space-around}.button_default{color:grey;border-radius:3px;-webkit-box-shadow:0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24);box-shadow:0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24);font-family:"Open Sans",sans-serif;display:inline-block;padding:10px 20px;font-size:14px;position:relative;cursor:pointer;text-align:center;text-decoration:none;border:0;margin:0;font-weight:700;outline:0;background-color:transparent;border:2px solid grey;margin:15px auto;border-radius:21px}a,abbr,acronym,address,applet,article,aside,audio,big,blockquote,body,canvas,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,iframe,img,ins,kbd,label,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,time,tt,u,ul,var,video{margin:0;padding:0;border:0;font:inherit;font-size:100%;vertical-align:baseline}html{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}strong{font-weight:700}blockquote:after,blockquote:before,q:after,q:before{content:"";content:none}a img{border:none}i{font-style:normal!important}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}body,html{font-family:"Pokemon GB"}.popup_pokemon{position:fixed;width:100%;z-index:999999;height:100vh;top:0;right:0;bottom:0;left:0;overflow-y:hidden;background-color:rgba(255,255,255,.75);visibility:hidden;filter:alpha(Opacity=0);opacity:0;-moz-transition:none .5s ease 0s;-o-transition:none .5s ease 0s;-webkit-transition:none .5s ease;-webkit-transition-delay:0s;-webkit-transition:none .5s ease 0s;transition:none .5s ease 0s;-webkit-transition-property:visibility,opacity;transition-property:visibility,opacity;-moz-transition:none .5s ease 0s;-o-transition:none .5s ease 0s;-webkit-transition:none .5s ease;-webkit-transition-delay:0s;transition:none .5s ease 0s;-webkit-transition-property:opacity,visibility,width;transition-property:opacity,visibility,width}.popup_pokemon.active{visibility:visible;filter:alpha(enabled=false);opacity:1}.popup_pokemon>.popup_overlay{height:100%;width:100%;z-index:0}.popup_pokemon>.popup_list{position:absolute;top:0;right:0;height:100%;width:200px;overflow-y:scroll;background-color:grey}.popup_pokemon>.popup_list>ul.pokemon_lists{width:100%;height:1200px;padding:15px 5px;-webkit-box-sizing:border-box;box-sizing:border-box}.popup_pokemon>.popup_list>ul.pokemon_lists li.pokemonRandom{cursor:pointer;padding-bottom:15px;border-bottom:1px solid #e8e8e8;margin-bottom:10px;width:100%;height:120px;overflow:hidden;text-align:center}.popup_pokemon>.popup_list>ul.pokemon_lists li.pokemonRandom img{display:block;max-height:120px;margin:0 auto}.popup_pokemon>.popup_container{position:absolute;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);width:80%;-webkit-box-shadow:0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24);box-shadow:0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24);height:auto;width:400px;top:50%;left:50%}.popup_pokemon>.popup_container div.card{padding:15px;font-family:'Open Sans',sans-serif;width:100%;background-color:#fff;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative}.popup_pokemon>.popup_container div.card img.pokemon_card{position:absolute;top:0;left:50%;max-height:100px;-webkit-transform:translate(-50%,-95%);transform:translate(-50%,-95%)}.popup_pokemon>.popup_container div.card div.pokemon_addImg{position:absolute;top:0;left:50%;height:120px;width:120px;-webkit-transform:translate(-50%,-95%);transform:translate(-50%,-95%)}.popup_pokemon>.popup_container div.card div.pokemon_addImg>div{width:100%;height:100%;cursor:pointer;border:1px solid #e8e8e8;background-color:rgba(255,255,255,.6);border-radius:50%;text-align:center;display:block}.popup_pokemon>.popup_container div.card div.pokemon_addImg>div span{line-height:120px;text-align:center;font-size:13px}.popup_pokemon>.popup_container div.card header.card_header{text-align:center}.popup_pokemon>.popup_container div.card header.card_header h3{line-height:30px;text-align:center}.popup_pokemon>.popup_container div.card header.card_header>div{display:block;width:170px;height:5px;border-radius:10px;margin:10px 0;-webkit-box-sizing:border-box;box-sizing:border-box;border:1px solid #e8e8e8}.popup_pokemon>.popup_container div.card header.card_header>div div.hp_bar{width:100%;height:100%;background-color:#6aedb6}.popup_pokemon>.popup_container div.card header.card_header span{font-size:10px;color:#444}.popup_pokemon>.popup_container div.card div.card_body{width:100%;padding:20px 0;overflow:hidden;padding-bottom:0}.popup_pokemon>.popup_container div.card div.stats{padding-bottom:20px;border-bottom:1px solid #e8e8e8}.popup_pokemon>.popup_container div.card div.stats>div{width:33%;-webkit-box-sizing:border-box;box-sizing:border-box}.popup_pokemon>.popup_container div.card div.stats .middle{padding:0 15px;border-left:1px solid;border-right:1px solid;border-color:#e8e8e8}.popup_pokemon>.popup_container div.card div.stats small{font-size:11px;color:grey}.popup_pokemon>.popup_container div.card div.stats span.data{color:#4d7073;font-size:14px;padding-bottom:5px}.popup_pokemon>.popup_container div.card div.stats span:first-letter{text-transform:uppercase}.popup_pokemon>.popup_container div.card div.actions button:first-child{margin-top:30px}.popup_pokemon>.popup_container div.card div.actions span{margin-top:30px}.popup_pokemon span.closed{position:absolute;width:18px;height:18px;top:10px;right:10px;z-index:2;cursor:pointer}.popup_pokemon span.closed:after,.popup_pokemon span.closed:before{content:'';height:2px;border-radius:7px;position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);width:100%;background-color:#000}.popup_pokemon span.closed:before{-webkit-transform:translate(-50%,-50%) rotate(45deg);transform:translate(-50%,-50%) rotate(45deg)}.popup_pokemon span.closed:after{-webkit-transform:translate(-50%,-50%) rotate(-45deg);transform:translate(-50%,-50%) rotate(-45deg)}.popup_pokemon span.type{position:absolute;width:25px;height:25px;top:10px;left:10px;z-index:2;margin:0}.popup_pokemon form input[type=file]{visibility:hidden}.popup_pokemon form header.card_header input{border:0;outline:0;text-align:center}.popup_pokemon form .middle{border:0!important}.popup_pokemon form div.stats input,.popup_pokemon form div.stats select{width:100%;border:1px solid #e8e8e8;outline:0;margin:0;padding:10px 4px;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Open Sans",sans-serif}main.container{width:100%;height:100vh;position:relative;overflow-y:hidden;background-color:#ecf0f1}main.container div.shooting-star{width:30px;height:30px;position:absolute;right:-16px;top:-36px;z-index:99999}main.container div.shooting-star.active{-webkit-animation:starswipe .9s linear 0s;animation:starswipe .9s linear 0s}@-webkit-keyframes starswipe{from{top:-36px;right:-16px}to{top:100%;right:100%}}@keyframes starswipe{from{top:-36px;right:-16px}to{top:100%;right:100%}}main.container p.tip{padding:17px 15px;text-align:center}main.container div.intro__item{position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);text-align:center;z-index:3;-moz-transition:none 2s ease 0s;-o-transition:none 2s ease 0s;-webkit-transition:none 2s ease;-webkit-transition-delay:0s;-webkit-transition:none 2s ease 0s;transition:none 2s ease 0s;-webkit-transition-property:visibility,opacity;transition-property:visibility,opacity}main.container div.intro__item span{font-family:'Pokemon GB';padding-top:30px;color:#000;-webkit-animation:blink 1s infinite 0s;animation:blink 1s infinite 0s}main.container div.intro__item.active{visibility:hidden;filter:alpha(Opacity=0);opacity:0}main.container div.pres__item{position:absolute;top:115px;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%);width:80%;max-width:1024px;visibility:hidden;filter:alpha(Opacity=0);opacity:0}main.container div.pres__item.active{visibility:visible;filter:alpha(enabled=false);opacity:1}div.pokeball{width:200px;height:200px;cursor:pointer;border-radius:50%;overflow:hidden;border:10px solid #000;position:relative;-webkit-animation:fall .25s ease-in-out 0s,shake 1.25s cubic-bezier(.36,.07,.19,.97) 3;animation:fall .25s ease-in-out 0s,shake 1.25s cubic-bezier(.36,.07,.19,.97) 3;background-color:#fff}div.pokeball,div.pokeball *{-webkit-box-sizing:border-box;box-sizing:border-box}div.pokeball::before{width:100%;height:50%;left:0;right:0;background-color:red;content:'';position:absolute}div.pokeball::after{width:100%;left:0;right:0;background-color:#000;height:20px;content:'';position:absolute;top:calc(50% - 10px)}div.pokeball div.ball{width:60px;height:60px;position:absolute;top:50%;left:50%;background-color:#7f8c8d;z-index:2;border:10px solid #fff;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);border-radius:50%;-webkit-box-shadow:0 0 0 10px #000;box-shadow:0 0 0 10px #000}@-webkit-keyframes fall{0%{top:-200px}60%{top:0}80%{top:-20px}100%{top:0}}@keyframes fall{0%{top:-200px}60%{top:0}80%{top:-20px}100%{top:0}}@-webkit-keyframes shake{0%{-webkit-transform:translate(0,0) rotate(0);transform:translate(0,0) rotate(0)}20%{-webkit-transform:translate(-10px,0) rotate(-20deg);transform:translate(-10px,0) rotate(-20deg)}30%{-webkit-transform:translate(10px,0) rotate(20deg);transform:translate(10px,0) rotate(20deg)}50%{-webkit-transform:translate(-10px,0) rotate(-20deg);transform:translate(-10px,0) rotate(-20deg)}60%{-webkit-transform:translate(10px,0) rotate(20deg);transform:translate(10px,0) rotate(20deg)}100%{-webkit-transform:translate(0,0) rotate(0);transform:translate(0,0) rotate(0)}}@keyframes shake{0%{-webkit-transform:translate(0,0) rotate(0);transform:translate(0,0) rotate(0)}20%{-webkit-transform:translate(-10px,0) rotate(-20deg);transform:translate(-10px,0) rotate(-20deg)}30%{-webkit-transform:translate(10px,0) rotate(20deg);transform:translate(10px,0) rotate(20deg)}50%{-webkit-transform:translate(-10px,0) rotate(-20deg);transform:translate(-10px,0) rotate(-20deg)}60%{-webkit-transform:translate(10px,0) rotate(20deg);transform:translate(10px,0) rotate(20deg)}100%{-webkit-transform:translate(0,0) rotate(0);transform:translate(0,0) rotate(0)}}img.logo{width:300px;position:absolute;top:60px;left:50%;visibility:hidden;filter:alpha(Opacity=0);opacity:0;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);-moz-transition:none 2s ease 0s;-o-transition:none 2s ease 0s;-webkit-transition:none 2s ease;-webkit-transition-delay:0s;-webkit-transition:none 2s ease 0s;transition:none 2s ease 0s;-webkit-transition-property:visibility,opacity;transition-property:visibility,opacity}img.logo.active{visibility:visible;filter:alpha(enabled=false);opacity:1;-webkit-animation:up 2s linear 0s,blink 3s linear infinite 0s;animation:up 2s linear 0s,blink 3s linear infinite 0s}@-webkit-keyframes up{0%{top:50%}60%{top:50%}100%{top:60px}}@keyframes up{0%{top:50%}60%{top:50%}100%{top:60px}}img.pokemon{max-height:100px}ul.pokemon__list{width:100%}ul.pokemon__list li.character{width:25%;overflow:hidden;text-align:center;padding:25px 10px;-webkit-box-sizing:border-box;box-sizing:border-box;cursor:pointer;visibility:hidden;filter:alpha(Opacity=0);opacity:0;-moz-transition:none .3s ease 0s;-o-transition:none .3s ease 0s;-webkit-transition:none .3s ease;-webkit-transition-delay:0s;-webkit-transition:none .3s ease 0s;transition:none .3s ease 0s;-webkit-transition-property:visibility,opacity;transition-property:visibility,opacity}ul.pokemon__list li.character img.pokemon:hover{-webkit-animation:updown .5s linear infinite 0s;animation:updown .5s linear infinite 0s}@-webkit-keyframes updown{0%,100%{-webkit-transform:translateY(0);transform:translateY(0)}50%{-webkit-transform:translateY(-10px);transform:translateY(-10px)}}@keyframes updown{0%,100%{-webkit-transform:translateY(0);transform:translateY(0)}50%{-webkit-transform:translateY(-10px);transform:translateY(-10px)}}ul.pokemon__list li.character h4{text-align:center;padding:10px 0;overflow:hidden}ul.pokemon__list li.character.active{visibility:visible;filter:alpha(enabled=false);opacity:1}ul.pokemon__list li.character.fighter{filter:alpha(Opacity=45);opacity:.45}span.type{display:inline-block;height:30px;width:30px;margin:10px;background-image:url(https://docs.google.com/uc?export=download&id=1UICTMJfUJnHayjFCW49shF4IsaLGlAgp);background-repeat:no-repeat;background-size:500% 400%}span.type.electrik{background-position:100% 0}span.type.roche{background-position:100% 66%}span.type.tenebre{background-position:50% 0}span.type.plante{background-position:100% 33%}span.type.feu{background-position:25% 33%}span.type.glace{background-position:25% 66%}span.type.normal{background-position:25% 0}span.type.eau{background-position:63% 100%}span.type.acier{background-position:37% 100%}span.type.dragon{background-position:75% 0}span.type.psy{background-position:75% 66%}span.type.spectre{background-position:75% 33%}span.type.vol{background-position:50% 33%}span.type.poison{background-position:50% 66%}span.type.sol{background-position:0 66%}span.type.combat{background-position:0 33%}@-webkit-keyframes blink{0%{opacity:0}10%{opacity:1}20%{opacity:1}30%{opacity:0}40%{opacity:1}90%{opacity:1}100%{opacity:0}}@keyframes blink{0%{opacity:0}10%{opacity:1}20%{opacity:1}30%{opacity:0}40%{opacity:1}90%{opacity:1}100%{opacity:0}}div.scene__fight{width:100%;overflow:hidden;position:fixed;height:100vh;z-index:99;visibility:hidden;-moz-transition:-moz-transform 1s ease 0s;-o-transition:-o-transform 1s ease 0s;-webkit-transition:-webkit-transform 1s ease;-webkit-transition-delay:0s;-webkit-transition:-webkit-transform 1s ease 0s;transition:-webkit-transform 1s ease 0s;transition:transform 1s ease 0s;transition:transform 1s ease 0s,-webkit-transform 1s ease 0s;background-color:#444}div.scene__fight.active{-webkit-animation:rot .3s linear 6 0s;animation:rot .3s linear 6 0s;visibility:visible}@-webkit-keyframes rot{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes rot{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}div.scene__overlay{width:100%;height:100vh;background-color:#000;position:fixed;z-index:9999;top:0;left:0;right:0;bottom:0;visibility:hidden;filter:alpha(Opacity=0);opacity:0;-moz-transition:none 1s ease 0s;-o-transition:none 1s ease 0s;-webkit-transition:none 1s ease;-webkit-transition-delay:0s;-webkit-transition:none 1s ease 0s;transition:none 1s ease 0s;-webkit-transition-property:visibility,opacity;transition-property:visibility,opacity}div.scene__overlay.active{visibility:visible;filter:alpha(enabled=false);opacity:1}div.scene{position:relative;margin:auto;display:block;width:600px;height:420px;background:#f8f8f8;z-index:1}div.scene div.box-info{position:absolute;width:50%;height:15%;padding:10px;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:10px;z-index:2;background:#fff;overflow:hidden;border:6px solid #506860}div.scene div.box-info.box-top-left{top:8%;left:8%}div.scene div.box-info.box-bottom-right{bottom:8%;right:8%}div.scene div.box-info>div{margin-bottom:5px}div.scene div.box-info h2,div.scene div.box-info span{font-size:12px;word-wrap:nowrap}div.scene div.box-info h2.title{text-align:left}div.scene div.box-info span.level{text-align:right}div.scene div.box-info div.life-bar{width:100%;height:12px;border-radius:20px;background:#f80;opacity:.5;-moz-transition:width .3s ease 0s;-o-transition:width .3s ease 0s;-webkit-transition:width .3s ease;-webkit-transition-delay:0s;-webkit-transition:width .3s ease 0s;transition:width .3s ease 0s}div.scene div.box-circle{position:absolute;width:40%;z-index:1;overflow:hidden;padding-top:200px}div.scene div.box-circle>div{position:relative;height:105px;width:100%;background:#e0e0e0;text-align:center;border-radius:50%}div.scene div.box-circle img.pokemon{position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-80%);transform:translate(-50%,-80%);-moz-transition:-moz-transform .3s ease 0s;-o-transition:-o-transform .3s ease 0s;-webkit-transition:-webkit-transform .3s ease;-webkit-transition-delay:0s;-webkit-transition:-webkit-transform .3s ease 0s;transition:-webkit-transform .3s ease 0s;transition:transform .3s ease 0s;transition:transform .3s ease 0s,-webkit-transform .3s ease 0s;-webkit-animation-delay:0s;animation-delay:0s;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-timing-function:linear;animation-timing-function:linear;-webkit-animation-iteration-count:1;animation-iteration-count:1}div.scene div.box-circle img.pokemon.pokemon-fighter1.charge{-webkit-animation-name:chargeA;animation-name:chargeA}div.scene div.box-circle img.pokemon.pokemon-fighter2.charge{-webkit-animation-name:chargeB;animation-name:chargeB}div.scene div.box-circle img.pokemon.hurt{-webkit-animation-duration:.1s;animation-duration:.1s;-webkit-animation-iteration-count:6;animation-iteration-count:6;-webkit-animation-name:hit;animation-name:hit}div.scene div.box-circle img.pokemon.dead{-webkit-transform:translate(-50%,100%);transform:translate(-50%,100%)}@-webkit-keyframes chargeA{0%,100%{-webkit-transform:translate(-50%,-80%);transform:translate(-50%,-80%)}50%{-webkit-transform:translate(0,-100%);transform:translate(0,-100%)}}@keyframes chargeA{0%,100%{-webkit-transform:translate(-50%,-80%);transform:translate(-50%,-80%)}50%{-webkit-transform:translate(0,-100%);transform:translate(0,-100%)}}@-webkit-keyframes chargeB{0%,100%{-webkit-transform:translate(-50%,-80%);transform:translate(-50%,-80%)}50%{-webkit-transform:translate(-100%,-50%);transform:translate(-100%,-50%)}}@keyframes chargeB{0%,100%{-webkit-transform:translate(-50%,-80%);transform:translate(-50%,-80%)}50%{-webkit-transform:translate(-100%,-50%);transform:translate(-100%,-50%)}}@-webkit-keyframes hit{0%,100%{opacity:1}50%{opacity:0}}@keyframes hit{0%,100%{opacity:1}50%{opacity:0}}div.scene div.box-circle.box-bottom-left{bottom:10%;left:8%}div.scene div.box-circle.box-top-right{top:-25%;right:8%}div.scene div.bottom-menu{overflow:hidden;width:100%;height:100px;background-color:#00f;position:absolute;left:0;right:0;-webkit-box-sizing:border-box;box-sizing:border-box;border:solid 6px #ceb46d;background-color:#285068;color:#fff;bottom:-100px}div.scene div.bottom-menu>div{height:100%;-webkit-box-sizing:border-box;box-sizing:border-box}div.scene div.bottom-menu div.info-fight{width:400px}div.scene div.bottom-menu div.action-fight{width:200px}div.scene div.bottom-menu div.info-fight{padding:20px 10px}div.scene div.bottom-menu div.info-fight p{font-size:12px;line-height:25px}div.scene div.bottom-menu div.info-fight p:first-letter{text-transform:uppercase}div.scene div.bottom-menu div.action-fight{border-left:solid 6px #6f677f;background-color:#f8f8f8;padding:3px}div.scene div.bottom-menu div.action-fight>ul{height:100%;width:100%}div.scene div.bottom-menu div.action-fight ul.button-action li{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:50%;height:50%;color:#000;text-align:center;line-height:50px;font-size:11px;cursor:pointer}div.scene div.bottom-menu div.action-fight ul.button-action li:hover span{-webkit-animation:blinkr .3s linear infinite 0s;animation:blinkr .3s linear infinite 0s}@-webkit-keyframes blinkr{0%,100%{opacity:1;color:#000}50%{opacity:0;color:#f80}}@keyframes blinkr{0%,100%{opacity:1;color:#000}50%{opacity:0;color:#f80}}
const pokeball = document.getElementById("pokeball");
const tip = document.getElementById("tip");
const actionDescr = document.getElementById("action-descr");
const tiempoBetweenText = 300;
const closedPopup = document.querySelectorAll("[data-close-popup]");
var pokemons = document.querySelectorAll(".character");
const btnChoose = document.getElementById("chooseFighter");
const randomPokemons = document.querySelectorAll(".pokemonRandom");
var pokemon1, pokemon2;
var gameStarted = false;
var flag = false;
function activePopup(popupID) {
document.getElementById(popupID).classList.add("active");
}
closedPopup.forEach(function(el) {
el.addEventListener("click", function() {
var parent = this.parentNode;
var flagC = false;
while (!flagC) {
if (parent.classList.contains("popup_pokemon")) {
parent.classList.remove("active");
flagC = true;
} else {
parent = parent.parentNode;
}
}
});
});
document.getElementById("deleteFighter").addEventListener(
"click",
function(e) {
e.preventDefault();
var id = this.parentElement.getAttribute("data-pokemon-action");
var fighter = document.querySelector('[data-id="' + id + '"]');
document.getElementById("pokemonInfo").classList.remove("active");
fighter.remove();
return false;
},
false
);
document.getElementById("pokemonTypeId").addEventListener(
"change",
function(e) {
var r = this.value;
var d = document.querySelector('[data-pokemonType][value="' + r + '"]');
document.getElementById("pokemonTypeName").value = d.getAttribute(
"data-pokemonType"
);
},
false
);
document.getElementById("formAddPokemon").addEventListener(
"submit",
function(e) {
e.preventDefault();
var name = document.getElementById("pokemonName").value;
var maxDamages = document.getElementById("pokemonMaxDamages").value;
var typeId = document.getElementById("pokemonTypeId").value;
var strength = document.getElementById("pokemonStrength").value;
var typeName = document.getElementById("pokemonTypeName").value;
if (document.querySelector(".pokemon_addImg").querySelector("img")) {
var img = document
.querySelector(".pokemon_addImg")
.querySelector("img")
.getAttribute("src");
} else {
var img =
"https://docs.google.com/uc?export=download&id=15tR19msQTxt1PH7sb5TzneRaGI7lbUxY";
}
document.getElementById("pokemonAdd").classList.remove("active");
var div = document.createElement("div");
div.innerHTML =
'<li class="character col nowrap col-hori-center active" data-name="' +
name +
'" data-type="' +
typeName +
'" data-strength="' +
strength +
'" data-maxdamages="' +
maxDamages +
'" data-damages="0" data-experience="0" data-id="' +
Math.random() +
'" data-img="' +
img +
'"><img class="pokemon" src="' +
img +
'" alt="' +
name +
'"><h4>' +
name +
'</h4><span class="type ' +
typeName +
'"></span></li>';
document.querySelector(".pokemon__list").append(div.firstElementChild);
setTimeout(function() {
pokemons = document.querySelectorAll(".character");
pokemons.forEach(function(element, index) {
element.addEventListener(
"click",
function(e) {
e.preventDefault();
showPopupPokemon(this.getAttribute("data-id"));
},
false
);
});
document
.querySelectorAll("[data-pokemonType]")
.forEach(function(element, index) {
element.removeAttribute("selected");
});
document
.querySelectorAll("[data-pokemonForce]")
.forEach(function(element, index) {
element.removeAttribute("selected");
});
document.getElementById("formAddPokemon").reset();
document.querySelector(".pokemon_addImg").innerHTML = "";
}, 500);
},
false
);
randomPokemons.forEach(function(element, index) {
element.addEventListener(
"click",
function(e) {
e.preventDefault();
document
.querySelectorAll("[data-pokemonType]")
.forEach(function(element, index) {
element.removeAttribute("selected");
});
document
.querySelectorAll("[data-pokemonForce]")
.forEach(function(element, index) {
element.removeAttribute("selected");
});
var imgRandom = this.getAttribute("data-img");
var strRandom = this.getAttribute("data-strength");
var maxRandom = this.getAttribute("data-maxdamages");
var typeNameRandom = this.getAttribute("data-typeName");
document.getElementById("pokemonMaxDamages").value = maxRandom;
document.getElementById("pokemonTypeName").value = typeNameRandom;
document
.querySelector('[data-pokemonType="' + typeNameRandom + '"]')
.setAttribute("selected", "selected");
document
.querySelector('[data-pokemonForce="' + strRandom + '"]')
.setAttribute("selected", "selected");
var img = document.createElement("img");
img.src = imgRandom;
img.style.maxHeight = "100px";
var div = document.createElement("div");
div.append(img);
document.querySelector(".pokemon_addImg").innerHTML = div.innerHTML;
},
false
);
});
function play(id) {
var audio = document.getElementById(id);
audio.play();
}
document.addEventListener(
"click",
function() {
play("click-song");
},
false
);
function pause(id) {
var audio = document.getElementById(id);
audio.pause();
}
function stop(id) {
var audio = document.getElementById(id);
audio.pause();
audio.currentTime = 0;
}
function startGame(event) {
if (!gameStarted) {
event.preventDefault();
gameStarted = true;
play("open-song");
document.querySelector(".intro__item").classList.add("active");
setTimeout(function() {
play("intro-song");
document.getElementById("logo").classList.add("active");
document.getElementById("star").classList.add("active");
}, 2000);
var $time = 0;
setTimeout(function() {
tip.textContent = "Choisis ton premier combattant";
document.querySelector(".pres__item").classList.add("active");
document.querySelector("main").style.overflowY = "scroll";
pokemons.forEach(function(element, index) {
setTimeout(function() {
element.classList.add("active");
}, $time);
$time = $time + 250;
});
}, 2000 + 2000);
}
}
pokeball.addEventListener(
"click",
function(e) {
e.stopPropagation();
startGame(e);
},
false
);
window.addEventListener(
"keydown",
function(e) {
if (e.keyCode === 0 || e.keyCode === 32) {
startGame(e);
}
},
false
);
pokemons.forEach(function(element, index) {
element.addEventListener(
"click",
function(e) {
e.preventDefault();
showPopupPokemon(this.getAttribute("data-id"));
},
false
);
});
document.getElementById("addPokemon").addEventListener(
"click",
function(e) {
e.preventDefault();
activePopup(this.getAttribute("data-popup"));
},
false
);
function showPopupPokemon(id) {
var li = document.querySelector('[data-id="' + id + '"]');
if (li) {
var img = document.getElementById("PImg");
var name = document.getElementById("PName");
var life = document.getElementById("PLife");
var max = document.getElementById("PMax");
var level = document.getElementById("PLevel");
var id = document.querySelector("[data-pokemon-action]");
var type = document.getElementById("PType");
var typeIco = document.getElementById("PTypeIco");
var strength = document.getElementById("PStrength");
var experience = document.getElementById("PExperience");
typeIco.removeAttribute("class");
typeIco.classList.add("type");
var lifeBar = document.querySelector(".hp_bar");
var hp = parseFloat(
li.getAttribute("data-maxDamages") - li.getAttribute("data-damages")
);
img.src = li.getAttribute("data-img");
max.textContent = li.getAttribute("data-maxDamages");
experience.textContent = li.getAttribute("data-experience");
strength.textContent = li.getAttribute("data-strength");
life.textContent = hp;
type.textContent = li.getAttribute("data-type");
typeIco.classList.add(li.getAttribute("data-type"));
id.setAttribute("data-pokemon-action", li.getAttribute("data-id"));
name.textContent = li.getAttribute("data-name");
var newBtnChoose = document.createElement("button");
newBtnChoose.classList.add("button_default");
newBtnChoose.setAttribute("id", "chooseFighter");
var firstElement = document.querySelector("[data-pokemon-action]")
.firstElementChild;
if (hp <= 0) {
span = document.createElement("span");
span.textContent = li.getAttribute("data-name") + " est K.O";
firstElement.parentNode.replaceChild(span, firstElement);
} else if (!pokemon1) {
newBtnChoose.textContent =
"Choisir " + li.getAttribute("data-name") + " pour le combat";
firstElement.parentNode.replaceChild(newBtnChoose, firstElement);
} else {
if (pokemon1.options.id == li.getAttribute("data-id")) {
newBtnChoose.textContent =
"Retirer " + li.getAttribute("data-name") + " du combat";
firstElement.parentNode.replaceChild(newBtnChoose, firstElement);
} else {
newBtnChoose.textContent =
"Choisir " + li.getAttribute("data-name") + " pour le combat";
firstElement.parentNode.replaceChild(newBtnChoose, firstElement);
}
}
var w = hp;
w = w / li.getAttribute("data-maxDamages") * 100;
lifeBar.style.width = w + "%";
if (w > 75) {
lifeBar.style.backgroundColor = "#6aedb6";
} else if (w <= 75 && w >= 25) {
lifeBar.style.backgroundColor = "#f80";
} else if (w < 25) {
lifeBar.style.backgroundColor = "#c0392b";
}
setTimeout(function() {
activePopup("pokemonInfo");
}, 200);
if (document.getElementById("chooseFighter")) {
document.getElementById("chooseFighter").addEventListener(
"click",
function(e) {
e.preventDefault();
var id = this.parentElement.getAttribute("data-pokemon-action");
var li = document.querySelector('[data-id="' + id + '"]');
if (!pokemon1) {
li.classList.add("fighter");
newPokemon(li, 1);
this.textContent =
"Retirer " + pokemon1.options.name + " du combat";
tip.textContent = "Choisis ton deuxième combattant";
document
.getElementById("pokemonInfo")
.classList.remove("active");
} else {
if (parseInt(pokemon1.options.id) == id) {
li.classList.remove("fighter");
btnChoose.textContent =
"Choisir " + pokemon1.options.name + " pour le combat";
pokemon1 = null;
tip.textContent = "Choisis ton premier combattant";
} else {
li.classList.add("fighter");
newPokemon(li, 2);
document
.getElementById("pokemonInfo")
.classList.remove("active");
tip.textContent = "Le combat va commencer !";
startFight(pokemon1, pokemon2);
var timer = 3;
var second = setInterval(function() {
timer = timer - 1;
if (timer == 0) {
clearInterval(second);
stop("intro-song");
stop("city-song");
play("fight-song");
document
.querySelector(".scene__fight")
.classList.add("active");
document.querySelector("main").style.overflow =
"hidden";
}
}, 1000);
}
}
},
false
);
}
} else {
return false;
}
}
function newPokemon(li, order) {
if (order == 1) {
pokemon1 = new pokemon({
strength: parseInt(li.getAttribute("data-strength")),
name: li.getAttribute("data-name"),
maxDamages: parseInt(li.getAttribute("data-maxDamages")),
damages: parseInt(li.getAttribute("data-damages")),
experience: parseInt(li.getAttribute("data-experience")),
img: li.getAttribute("data-img"),
id: li.getAttribute("data-id"),
fighter: "1"
});
return pokemon1;
} else {
pokemon2 = new pokemon({
strength: parseInt(li.getAttribute("data-strength")),
name: li.getAttribute("data-name"),
maxDamages: parseInt(li.getAttribute("data-maxDamages")),
damages: parseInt(li.getAttribute("data-damages")),
experience: parseInt(li.getAttribute("data-experience")),
img: li.getAttribute("data-img"),
id: li.getAttribute("data-id"),
fighter: "2"
});
return pokemon2;
}
}
var cc, inAction, widthTransitionLifeBar, deathTransition, usedHeal, endBattle;
function startFight(pok1, pok2) {
if (document.querySelector(".hurt")) {
document.querySelector(".hurt").classList.remove("hurt");
}
if (document.querySelector(".dead")) {
document.querySelector(".dead").classList.remove("dead");
}
if (document.querySelector(".charge")) {
document.querySelector(".charge").classList.remove("charge");
}
actionDescr.textContent = "Que doit faire le pokémon ?";
inAction = false;
widthTransitionLifeBar = 300;
deathTransition = 300;
usedHeal = false;
endBattle = false;
displayPokemon(pok1, "1");
displayPokemon(pok2, "2");
}
function checkLifeBar(fighter, w) {
if (w > 75) {
stop("low-hp");
document.querySelector(".life-bar" + fighter).style.backgroundColor =
"#6aedb6";
} else if (w <= 75 && w >= 25) {
stop("low-hp");
document.querySelector(".life-bar" + fighter).style.backgroundColor =
"#f80";
} else if (w < 25) {
if (parseInt(fighter) == 1) {
play("low-hp");
}
document.querySelector(".life-bar" + fighter).style.backgroundColor =
"#c0392b";
}
}
function displayPokemon(pokemon, fighter) {
var pokemon__name = document
.querySelector(".box-info-pokemon" + fighter)
.querySelector(".title");
var pokemon__level = document
.querySelector(".box-info-pokemon" + fighter)
.querySelector("i");
var pokemon__img = document.querySelector(".pokemon-fighter" + fighter);
var w = pokemon.options.maxDamages - pokemon.options.damages;
w = w / pokemon.options.maxDamages * 100;
document.querySelector(".life-bar" + pokemon.options.fighter).style.width =
w + "%";
checkLifeBar(pokemon.options.fighter, w);
pokemon__name.textContent = pokemon.options.name;
pokemon__level.textContent = pokemon.options.level;
pokemon__img.src = pokemon.options.img;
}
(function() {
this.pokemon = function() {
var defaults = {
name: "",
strength: 6,
damages: 0,
maxDamages: 30,
experience: 0,
img: null,
level: 1,
id: null,
fighter: null,
dead: false
};
if (arguments[0] && typeof arguments[0] === "object") {
this.options = extendDefaults(defaults, arguments[0]);
}
function extendDefaults(source, properties) {
var property;
for (property in properties) {
if (properties.hasOwnProperty(property)) {
source[property] = properties[property];
}
}
return source;
}
};
})();
function doSetTimeout(letter, $timerLetter) {
setTimeout(function() {
var fragment = document.createElement("span");
fragment.textContent = letter;
actionDescr.append(fragment);
}, $timerLetter);
}
var pass = false;
function addText(text, t = 45) {
var s = text;
actionDescr.innerHTML = "";
var $timerLetter = 0;
for (var i = 0; i < s.length; i++) {
var letter = s.charAt(i);
doSetTimeout(letter, $timerLetter);
$timerLetter = $timerLetter + t;
}
return $timerLetter;
}
function getRandomArbitrary(min, max) {
return Math.floor(Math.random() * (max - min) + min);
}
function attack(pokemonA, pokemonB) {
inAction = true;
document
.querySelectorAll(".pokemon-fighter")
.forEach(function(element, index) {
element.classList.remove("charge");
element.classList.remove("hurt");
});
setTimeout(function() {
hit(pokemonA, pokemonB);
}, addText(pokemonA.options.name + " attaque charge !") + tiempoBetweenText);
}
var s;
function hit(pokemonA, pokemonB) {
var tiempo, hurtDuration, chargeDuration, time;
var pokemonFighter = document.querySelector(
".pokemon-fighter" + pokemonA.options.fighter
);
var pokemonHurt = document.querySelector(
".pokemon-fighter" + pokemonB.options.fighter
);
cc = false;
if (getRandomArbitrary(0, 8) == getRandomArbitrary(0, 8)) {
fail();
return false;
}
var str = pokemonA.options.strength;
if (getRandomArbitrary(0, 5) == getRandomArbitrary(0, 5)) {
cc = true;
str = str * 2;
}
var exp = pokemonA.options.experience;
var isDead = false;
var miniT = 300;
var w = pokemonB.options.maxDamages - (pokemonB.options.damages + str);
w = w / pokemonB.options.maxDamages * 100;
pokemonB.options.damages = parseInt(pokemonB.options.damages + str);
pokemonA.options.experience = pokemonA.options.experience + 1;
play("charge-song");
pokemonFighter.classList.add("charge");
chargeDuration = window
.getComputedStyle(pokemonFighter, null)
.getPropertyValue("animation-duration");
chargeDuration = parseInt(chargeDuration.replace(/\D/g, "")) * 100;
step = window
.getComputedStyle(pokemonFighter, null)
.getPropertyValue("animation-iteration-count");
chargeDuration = chargeDuration * step;
time = chargeDuration;
var actionTime = setTimeout(function() {
play("super-song");
document
.querySelector(".pokemon-fighter" + pokemonB.options.fighter)
.classList.add("hurt");
hurtDuration = window
.getComputedStyle(pokemonHurt, null)
.getPropertyValue("animation-duration");
hurtDuration = parseInt(hurtDuration.replace(/\D/g, "")) * 100;
step = window
.getComputedStyle(pokemonHurt, null)
.getPropertyValue("animation-iteration-count");
hurtDuration = hurtDuration * step;
tiempo = tiempo + hurtDuration;
time = time + tiempo;
updateLife(tiempo);
}, (tiempo = chargeDuration + tiempoBetweenText));
function updateLife(t) {
setTimeout(function() {
time = time + t;
if (pokemonB.options.damages >= pokemonB.options.maxDamages) {
pokemonB.options.damages = pokemonB.options.maxDamages;
document.querySelector(
".life-bar" + pokemonB.options.fighter
).style.width =
"0%";
isDead = pokemonB;
} else {
document.querySelector(
".life-bar" + pokemonB.options.fighter
).style.width =
w + "%";
}
checkLifeBar(pokemonB.options.fighter, w);
if (cc) {
criticalAttack(widthTransitionLifeBar);
} else {
setProperty(widthTransitionLifeBar);
}
}, t);
}
function fail() {
setTimeout(function() {
if (pokemonA.options.fighter == "1") {
attack(pokemonB, pokemonA);
} else if (pokemonA.options.fighter == "2") {
setTimeout(function() {
inAction = false;
}, addText("Que doit faire le pokemon ?") + tiempoBetweenText);
}
}, addText(pokemonA.options.name + " a raté son attaque !") +
tiempoBetweenText +
300);
// 300 because you need to see the fail
}
function criticalAttack(t) {
setTimeout(function() {
var x = addText("Coup critique !");
time = time + t + x;
setProperty(t + x + tiempoBetweenText);
}, t);
}
function setProperty(t) {
setTimeout(function() {
if (isDead) {
dead(addText(pokemonB.options.name + " est K.O !"));
} else {
setTimeout(function() {
finishAction(pokemonA, pokemonB);
}, tiempoBetweenText);
}
}, t);
}
function dead(t) {
play("dead-song");
document
.querySelector(".pokemon-fighter" + pokemonB.options.fighter)
.classList.add("dead");
stop("low-hp");
setTimeout(function() {
time = time + t + deathTransition;
finishAction(pokemonA, pokemonB);
}, deathTransition + t + tiempoBetweenText);
}
function finishAction(pokemonA, pokemonB) {
if (isDead) {
pokemonB.options.dead = true;
}
if (isDead) {
stop("fight-song");
if (isDead == pokemon2) {
play("victory-song");
var u = addText("Felicitation, vous remportez le match !");
setTimeout(function() {
endBattle = true;
}, u);
} else if (isDead == pokemon1) {
play("loose-song");
var u = addText("Mince, vous avez perdu le match !");
setTimeout(function() {
endBattle = true;
}, u);
}
updateDb([pokemonA, pokemonB], "attack");
var timer = 0;
s = setInterval(function() {
timer = timer + 1000;
if (timer == 12000) {
leak();
clearInterval(s);
}
}, 1000);
return false;
} else if (pokemonA.options.fighter == "1") {
pokemon1 = pokemonA;
pokemon2 = pokemonB;
if (
!usedHeal &&
parseInt(pokemonB.options.damages + pokemonA.options.strength) >=
pokemonB.options.maxDamages
) {
if (getRandomArbitrary(0, 2) == getRandomArbitrary(0, 2)) {
heal(pokemonB, pokemonA);
} else {
attack(pokemonB, pokemonA);
}
} else {
attack(pokemonB, pokemonA);
}
} else {
pokemon1 = pokemonB;
pokemon2 = pokemonA;
x = addText("Que doit faire le pokémon ?");
setTimeout(function() {
inAction = false;
}, x);
}
updateDb([pokemonA, pokemonB], "attack");
}
}
function heal(pokemonA, pokemonB) {
inAction = true;
if (pokemonA.options.damages == 0) {
var x = addText(pokemonA.options.name + " a déjà toute sa vie !");
setTimeout(function() {
x = addText("Que doit faire le pokémon ?");
setTimeout(function() {
inAction = false;
}, x);
}, x + tiempoBetweenText);
return true;
}
pokemonA.options.damages = pokemonA.options.damages - 15;
if (pokemonA.options.damages < 0) {
pokemonA.options.damages = 0;
}
if (pokemonA.options.fighter == "1") {
pokemon1 = pokemonA;
var x = addText("Vous utilisez une potion !");
} else if (pokemonA.options.fighter == "2") {
usedHeal = true;
pokemon2 = pokemonA;
var x = addText(pokemonA.options.name + " utilise une baie !");
}
setTimeout(function() {
play("healing-song");
var w = pokemonA.options.maxDamages - pokemonA.options.damages;
w = w / pokemonA.options.maxDamages * 100;
document.querySelector(
".life-bar" + pokemonA.options.fighter
).style.width =
w + "%";
checkLifeBar(pokemonA.options.fighter, w);
if (pokemonA.options.fighter == "1") {
setTimeout(function() {
if (
!usedHeal &&
parseInt(pokemonB.options.damages + pokemonA.options.strength) >=
pokemonB.options.maxDamages
) {
if (getRandomArbitrary(0, 2) == getRandomArbitrary(0, 2)) {
heal(pokemonB, pokemonA);
} else {
attack(pokemonB, pokemonA);
}
} else {
attack(pokemonB, pokemonA);
}
}, widthTransitionLifeBar + tiempoBetweenText);
} else {
setTimeout(function() {
var x = addText("Que doit faire le pokémon ?");
setTimeout(function() {
inAction = false;
}, x);
}, widthTransitionLifeBar + tiempoBetweenText);
}
updateDb([pokemonA, pokemonB], "heal");
}, x + tiempoBetweenText);
}
function leak() {
stop("fight-song");
stop("victory-song");
stop("loose-song");
stop("low-hp");
if (s) {
clearInterval(s);
s = null;
}
tip.textContent = "Choisis ton premier combattant";
var fighter1 = document.querySelector(
'.character[data-id="' + pokemon1.options.id + '"]'
);
var fighter2 = document.querySelector(
'.character[data-id="' + pokemon2.options.id + '"]'
);
fighter1.setAttribute("data-damages", pokemon1.options.damages);
fighter1.setAttribute("data-experience", pokemon1.options.experience);
fighter2.setAttribute("data-damages", pokemon2.options.damages);
fighter2.setAttribute("data-experience", pokemon2.options.experience);
pokemon1 = pokemon2 = null;
pokemons.forEach(function(element, index) {
element.classList.remove("fighter");
});
document.querySelector(".scene__overlay").classList.add("active");
setTimeout(function() {
document.querySelector(".scene__fight").classList.remove("active");
play("city-song");
setTimeout(function() {
document.querySelector(".scene__overlay").classList.remove("active");
}, 300);
}, 1000);
}
function updateDb(pokemons, action) {
// update ajax if you want...
}
document.getElementById("leak").addEventListener(
"click",
function(e) {
e.preventDefault();
if (!inAction || endBattle) {
if (endBattle) {
leak();
} else {
var timeFuiteSound = 1000;
setTimeout(function() {
play("fuite-song");
setTimeout(function() {
leak();
}, timeFuiteSound);
}, addText("Vous prenez la fuite !"));
}
}
},
false
);
document.getElementById("heal").addEventListener(
"click",
function(e) {
e.preventDefault();
if (!inAction) {
heal(pokemon1, pokemon2);
}
},
false
);
document.getElementById("attack").addEventListener(
"click",
function(e) {
if (!inAction) {
attack(pokemon1, pokemon2, e);
}
},
false
);
Also see: Tab Triggers