Compare commits

...

1 commit

Author SHA1 Message Date
Kazhnuz
4e8af1fd5f a 2021-10-05 21:03:43 +02:00
7 changed files with 383 additions and 4 deletions

View file

View file

@ -0,0 +1,36 @@
{
"data": [
{
"name":"Rat",
"level":1,
"size":"tiny",
"trait":"predateur",
"pow1":"",
"pow2":""
},
{
"name":"Souris",
"level":1,
"size":"tiny",
"trait":"craintif",
"pow1":"",
"pow2":""
},
{
"name":"Chat",
"level":1,
"size":"small",
"trait":"predateur",
"pow1":"",
"pow2":""
},
{
"name":"Chien",
"level":1,
"size":"medium",
"trait":"predateur",
"pow1":"Woof: Aboie tout le temps et casse les pieds",
"pow2":"Est-ce que ça se mange ?"
}
]
}

View file

@ -0,0 +1,30 @@
{
"files": [
{"title":"Animaux", "file":"animals.json"}
],
"stats": [
"tiny":{
"boost1":["DIS", "FIN"],
"boost2":[],
"malus1":["PHY"],
"malus2":["AUR"],
"VIG":-1, "JET":1, "PSY":1
}
],
"traits": [
"predateur":{"boost1":"PHY", "boost2":"INS", "malus":"FIN"},
"craintif":{"boost1":"DIS", "boost2":"FIN", "malus":"REL"},
"domestique":{"boost1":"REL", "boost2":"AUR", }
],
"levels": [
{"base":40, "boost1":15, "boost2":5, "malus1":15, "malus2":10, "dice":2},
{"base":50, "boost1":20, "boost2":10, "malus1":15, "malus2":10, "dice":2},
{"base":50, "boost1":20, "boost2":10, "malus1":15, "malus2":10, "dice":2},
{"base":60, "boost1":20, "boost2":10, "malus1":15, "malus2":10, "dice":2},
{"base":70, "boost1":20, "boost2":10, "malus1":15, "malus2":10, "dice":2},
],
"dices": ["1D2", "1D4", "1D6", "1D8", "1D12", "1D20"]
}

View file

@ -12,11 +12,11 @@ Les utilisateurs font un pacte avec certains nombres d'éléments qui pourront e
|:--:|:--:|:--:|
| Grands élémentaires | Commune | INT, HAB |
### Niveau 0 (pouvoir de base)
### Niveau 0
| Pacte élémentaire |
|:---:|
| Obtient un élément principal (eau, feu, terre, air) qui devient lélément principal de lélémentariste, qui lui confère naturellement une résistance élémentaire (lélément fait -50 % de dégâts). |
| Compétence | Pouvoir de base |
|:----|:---:|
| -</br>- | **Pacte élémentaire**<br /> Obtient un élément principal (eau, feu, terre, air) qui devient lélément principal de lélémentariste, qui lui confère naturellement une résistance élémentaire (lélément fait -50 % de dégâts). |
### Niveau 1 (1 xp)

226
static/bestiaire.html Normal file
View file

@ -0,0 +1,226 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>Rulebook</title>
<!-- meta -->
<meta name="description" content="">
<meta name="author" content="">
<!--=include includes/_links.html -->
<script src="bestiaire.js"></script>
<style>
td.details-control {
cursor: pointer;
color:rgba(0,0,0,0.2);
}
tr.shown td.details-control {
color:rgba(0,0,0,0.8);
}
#datatable > tbody > tr:not(.even):not(.odd) > td {
padding:0;
}
.card-datatable {
background-color:white;
padding:1rem;
}
table.dataTable {
border-radius:3px;
border:1px solid rgba(0,0,0,0.3);
box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.2);
}
table.dataTable table td {
background-color:rgba(0,0,0,0.025);
}
ul.pagination li {
margin-left:0px;
}
</style>
</head>
<body>
<div id="wrapper">
<!--=include includes/_headerbar.html -->
<div class="container mt-2">
<!--=include includes/_breadcrumb.html -->
<div class="row">
<main class="col-md-12">
<p><a class="btn btn-secondary" href="index.html"><i class="fa fa-caret-left"></i> Retour</a></p>
<div class="card card-brown card-datatable">
<table id="datatable" class="table table-card card-brown">
<thead>
<tr>
<th>Nom</th>
<th>PV</th>
<th>PE</th>
<th>FOR</th>
<th>CON</th>
<th>HAB</th>
<th>INT</th>
<th>SAG</th>
<th>VOL</th>
<th>CHA</th>
<th>DIS</th>
<th>REL</th>
<th>PER</th>
<th><i class="fa fa-file"></i></th>
</tr>
</thead>
</table>
</div>
</main>
</div>
</div>
</div>
<!--=include includes/_footer.html -->
<script>
function format ( d ) {
// `d` is the original data object for the row
return '<table cellpadding="11" cellspacing="0" border="0" style="width:100%;">'+
'<tr>'+
'<td><strong>Armures:</strong></td>'+
'<td>5 (physique) ; 1 (speciale) ; 2 (mentale)</td>'+
'</tr>'+
'<tr>'+
'<td><strong>Dés:</strong></td>'+
'<td>1D4 (VIG) ; 1D3 (JET) ; 1D4 (PSY)</td>'+
'</tr>'+
'<tr>'+
'<td><strong>Pouvoir:</strong></td>'+
'<td>' + d.pow1 + ' </td>'+
'</tr>'+
'<tr>'+
'<td><strong>Pouvoir:</strong></td>'+
'<td>' + d.pow2 + '</td>'+
'</tr>'+
'</table>';
}
$(document).ready(function() {
var table = $('#datatable').DataTable( {
"ajax": '/datas/creatures/animals.json',
"columns": [
{ "data": "name" },
{ "data": "level",
"render": function ( data, type, row, meta ) {
console.table(row);
return getPV(data, row.size, row.trait);
} },
{ "data": "level",
"render": function ( data, type, row, meta ) {
console.table(row);
return getPE(data, row.size, row.trait);
} },
{ "data": "level",
"render": function ( data, type, row, meta ) {
console.table(row);
return getStat("FOR", data, row.size, row.trait);
} },
{ "data": "level",
"render": function ( data, type, row, meta ) {
console.table(row);
return getStat("CON", data, row.size, row.trait);
} },
{ "data": "level",
"render": function ( data, type, row, meta ) {
console.table(row);
return getStat("HAB", data, row.size, row.trait);
} },
{ "data": "level",
"render": function ( data, type, row, meta ) {
console.table(row);
return getStat("INT", data, row.size, row.trait);
} },
{ "data": "level",
"render": function ( data, type, row, meta ) {
console.table(row);
return getStat("SAG", data, row.size, row.trait);
} },
{ "data": "level",
"render": function ( data, type, row, meta ) {
console.table(row);
return getStat("VOL", data, row.size, row.trait);
} },
{ "data": "level",
"render": function ( data, type, row, meta ) {
console.table(row);
return getStat("CHA", data, row.size, row.trait);
} },
{ "data": "level",
"render": function ( data, type, row, meta ) {
console.table(row);
return getStat("DIS", data, row.size, row.trait);
} },
{ "data": "level",
"render": function ( data, type, row, meta ) {
console.table(row);
return getStat("REL", data, row.size, row.trait);
} },
{ "data": "level",
"render": function ( data, type, row, meta ) {
console.table(row);
return getStat("PER", data, row.size, row.trait);
} },
{
"className": 'details-control',
"orderable": false,
"data": null,
"defaultContent": '<i class="fa fa-plus-square"></i>'
}
]
});
// Add event listener for opening and closing details
$('#datatable tbody').on('click', 'td.details-control', function () {
var tr = $(this).closest('tr');
var row = table.row( tr );
if ( row.child.isShown() ) {
// This row is already open - close it
row.child.hide();
tr.removeClass('shown');
}
else {
// Open this row
row.child( format(row.data()) ).show();
tr.addClass('shown');
}
} );
} );
// $(document).ready(function () {
// $.getJSON('/datas/creatures/animals.json', function(data) {
// $("#dataheader").text(data["name"])
// console.log("test")
// });
// });
// $.getJSON( "datas/creatures/animals.json", function( data ) {
// var items = [];
// $.each( data, function( key, val ) {
// items.push( "<li id='" + key + "'>" + val + "</li>" );
// });
//
// $( "<ul/>", {
// "class": "my-new-list",
// html: items.join( "" )
// }).appendTo( "body" );
// });
</script>
</body>
</html>

85
static/bestiaire.js Normal file
View file

@ -0,0 +1,85 @@
let data = {
"files": [
{"title":"Animaux", "file":"animals.json"}
],
"archetypes": {
"tiny":{
"pv":10, "pe":20,
"FOR":30, "INT":50, "CHA":40,
"CON":20, "SAG":80, "DIS":80,
"HAB":90, "VOL":40, "REL":50,
"PER":50,
"PHY":0, "SPE":0, "MEN":0,
"VIG":-2, "JET":1, "PSY":1
},
"small":{
"pv":15, "pe":20,
"FOR":40, "INT":50, "CHA":35,
"CON":30, "SAG":50, "DIS":70,
"HAB":80, "VOL":45, "REL":50,
"PER":50,
"VIG":0, "JET":0, "PSY":0
},
"medium":{
"pv":35, "pe":20,
"FOR":50, "INT":40, "CHA":50,
"CON":40, "SAG":40, "DIS":50,
"HAB":60, "VOL":50, "REL":50,
"PER":50,
"VIG":1, "JET":0, "PSY":0
},
},
"traits": {
"predateur":{"boost1":"PHY", "boost2":"INS", "malus":"FIN", "pv":0, "pe":0},
"craintif":{"boost1":"DIS", "boost2":"FIN", "malus":"", "pv":10, "pe":-10},
"domestique":{"boost1":"REL", "boost2":"AUR", "malus":"INS", "pv":-10, "pe":0}
},
"levels": [
{"base":0, "min":10, "max":70, "boost1":15, "boost2":5, "malus":-15, "dice":2, "pv":1},
{"base":10, "min":10, "max":70, "boost1":20, "boost2":10, "malus":-15, "dice":2, "pv":1.25},
{"base":10, "min":10, "max":70, "boost1":20, "boost2":10, "malus":-15, "dice":3, "pv":1.5},
{"base":20, "min":10, "max":70, "boost1":20, "boost2":10, "malus":-15, "dice":3, "pv":2},
{"base":20, "min":10, "max":70, "boost1":20, "boost2":10, "malus":-15, "dice":3, "pv":3}
],
"dices": ["1D2", "1D4", "1D6", "1D8", "1D12", "1D20"]
}
function getPV(level, size, trait) {
var levelData = getLevelData(level);
var sizeData = getSizeData(size);
var traitData = getTraitData(trait);
return Math.floor((sizeData.pv + traitData.pv) * levelData.pv);
}
function getPE(level, size, trait) {
var levelData = getLevelData(level);
var sizeData = getSizeData(size);
var traitData = getTraitData(trait);
return Math.floor((sizeData.pe + traitData.pe) * levelData.pv);
}
function getLevelData(level) {
var levelValue = Math.min(Math.max(0, level - 1), 4)
var allLevelsData = data["levels"]
return allLevelsData[levelValue]
}
function getSizeData(size) {
var allSizeData = data["stats"]
return allSizeData[size]
}
function getTraitData(trait) {
var allTraitsData = data["traits"]
return allTraitsData[trait]
}
function getStat(type, level, size, trait) {
var levelData = getLevelData(level);
var sizeData = getSizeData(size);
var traitData = getTraitData(trait);
return sizeData[type] + levelData.base;
}

View file

@ -6,6 +6,8 @@
<link rel="stylesheet" href="dep/fork-awesome/css/fork-awesome.min.css">
<script src="dep/jquery/jquery.js"></script>
<script src="dep/bootstrap/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs4/dt-1.10.25/datatables.min.css"/>
<script type="text/javascript" src="https://cdn.datatables.net/v/bs4/dt-1.10.25/datatables.min.js"></script>
<!-- style and js -->
<link rel="stylesheet" href="style.css">