Parcourir la source

Merge branch 'master' into 'master'

Master

See merge request tompeur/ecr19-t3-e!14
KREBS-CHEVRESSON CLEMENT il y a 6 ans
Parent
commit
9866e42082

+ 57 - 0
src/control/ctrlEvents.js

@@ -0,0 +1,57 @@
+/*
+possibleEvents : liste des evenements possibles avec leurs ponderations
+      - event : evenement
+      - weight : ponderations
+*/
+
+let possibleEvents = [];
+
+
+function resetPossibleEvents() {
+  possibleEvents = [];
+}
+
+
+function addPossibleEvent(pEvent) {
+  possibleEvents.push(
+    {
+      pEvent : pEvent,
+      weight : getEventWeight(pEvent)
+    }
+  );
+}
+
+// à faire
+function getEventWeight(pEvent) {
+  let weight = 1;
+  return weight;
+}
+
+
+function testPossibleEvent(pEvent) {
+  if (
+    (clergy.wealth <= pEvent.clergy.wealth) &&
+    (clergy.influence <= pEvent.clergy.influence) &&
+    (nobility.wealth <= pEvent.nobility.wealth) &&
+    (nobility.influence <= pEvent.nobility.influence) &&
+    (nobility.army <= pEvent.nobility.army) &&
+    (people.wealth <= pEvent.people.wealth) &&
+    (people.wellBeing <= pEvent.people.wellBeing)
+  ) {
+    return true;
+  }
+  return false;
+}
+
+
+function allPossibleEvents() {
+
+  resetPossibleEvents();
+
+  for (let i = 0; i < events.length; i++) {
+    let currentEvents = events[i];
+    if (testPossibleEvent(currentEvents)) {
+      addPossibleEvents(currentEvents);
+    }
+  }
+}

+ 22 - 0
src/control/ctrlGameLaws.js

@@ -0,0 +1,22 @@
+function addPlayerLaw(pLaw) {
+  playerLaws.push(pLaw);
+}
+
+function removePlayerLaw(pLaw) {
+  for (var i = 0; i < playerLaws.length; i++) {
+    if (playerLaws[i] == pLaw) {
+      playerLaws.splice(i, 1);
+      break;
+    }
+  }
+}
+
+function getPlayerLawsByType(pPlayerLawType) {
+  let playerLawsOfTheType = [];
+  for (var i = 0; i < playerLaws.length; i++) {
+    if (playerLaws[i].type == pPlayerLawType) {
+      playerLawsOfTheType.push(playerLaws[i]);
+    }
+  }
+  return playerLawsOfTheType;
+}

+ 0 - 0
src/control/ctrlIndicators.js


+ 13 - 1
src/control/ctrlLaws.js

@@ -1,3 +1,14 @@
+<<<<<<< HEAD
+function getLawsByType(pLawType) {
+  let lawsOfTheType = [];
+  for (var i = 0; i < laws.length; i++) {
+    if (laws[i].type == pLawType) {
+      lawsOfTheType.push(laws[i]);
+    }
+  }
+  return lawsOfTheType;
+}
+=======
 let laws = [];
 
 function addLaw(law) {
@@ -14,4 +25,5 @@ function removeLaw(law) {
         }
         i++;
     }
-}
+}
+>>>>>>> eeb7ff6d99e2ccaf8b19c6a80bbf40f10c387570

+ 3 - 0
src/control/round.js

@@ -0,0 +1,3 @@
+function newRound(){
+  
+}

+ 3 - 0
src/control/utils.js

@@ -0,0 +1,3 @@
+function randInt(min, max) {
+  return Math.floor(Math.random() * (max - min + 1) ) + min;
+}

+ 15 - 0
src/model/events.js

@@ -0,0 +1,15 @@
+let events = [
+  {
+    name : "Nom de l'evenement",
+    threshold : {
+      clergy : { wealth : 0, influence : 0 },
+      nobility : { wealth : 0 , influence : 0 , army : 0 },
+      people : { wealth : 0 , wellBeing : 0 }
+    },
+    coefficient : {
+      clergy : { wealth : 0, influence : 0 },
+      nobility : { wealth : 0 , influence : 0 , army : 0 },
+      people : { wealth : 0 , wellBeing : 0 }
+    }
+  },
+]

+ 6 - 0
src/model/game.js

@@ -0,0 +1,6 @@
+let playerTaxes = {
+  clergy : 15,
+  nobility : 25
+}
+
+let playerLaws = [];

+ 24 - 0
src/model/indicators.js

@@ -1,6 +1,8 @@
 // INDICATEURS
 
 /*
+<<<<<<< HEAD
+=======
 TOTAL
 
 < contient l'influence et la richesse max >
@@ -8,14 +10,20 @@ TOTAL
 const total = { wealth : 100 , influence : 100 };
 
 /*
+>>>>>>> eeb7ff6d99e2ccaf8b19c6a80bbf40f10c387570
 CLERGE :
   - richesse : relatif a la noblesse et au peuple
   - influence : relatif a la noblesse
 
 OBJET : { INT: wealth | INT: influence }
 */
+<<<<<<< HEAD
+let clergy = { wealth : 0 , influence : 0 };
+
+=======
 
 let clergy = { wealth : 0 , influence : 0 };
+>>>>>>> eeb7ff6d99e2ccaf8b19c6a80bbf40f10c387570
 
 /*
 NOBLESSE :
@@ -25,8 +33,13 @@ NOBLESSE :
 
 OBJET : { INT: wealth | INT: influence | INT: army }
 */
+<<<<<<< HEAD
+let nobility = { wealth : 0 , influence : 0 , army : 0 };
+
+=======
 
 let nobility = { wealth : 0 , influence : 0 , army : 0 };
+>>>>>>> eeb7ff6d99e2ccaf8b19c6a80bbf40f10c387570
 
 /*
 PEUPLE :
@@ -35,6 +48,16 @@ PEUPLE :
 
 OBJET : { INT: wealth | INT: wellBeing }
 */
+<<<<<<< HEAD
+let people = { wealth : 0 , wellBeing : 0 };
+
+
+// Tour de jeu actuel
+let round = 0;
+
+
+// Score actuel
+=======
 
 let people = { wealth : 0 , wellBeing : 0 };
 
@@ -44,4 +67,5 @@ let round = 0;
 
 // Score actuel
 
+>>>>>>> eeb7ff6d99e2ccaf8b19c6a80bbf40f10c387570
 let score = 0;

+ 14 - 0
src/model/laws.js

@@ -0,0 +1,14 @@
+let lawsTypes = ["nom du type 1","nom du type 2"];
+
+let laws = [
+  {
+    name : "Nom de la loie",
+    type : "nom du type",
+    effect : {
+      clergy : { wealth : 50, influence : 60 },
+      nobility : { wealth : -10 , influence : 33 , army : 69 },
+      people : { wealth : -420 , wellBeing : 1337 }
+    },
+    description : "Description de la loi précise est pédagogique"
+  },
+];

+ 11 - 0
src/view/game.html

@@ -2,6 +2,16 @@
 <html lang="fr">
   <head>
     <meta charset="utf-8">
+<<<<<<< HEAD
+    <title>Tompeur</title>
+  </head>
+  <body>
+    <canvas id="main" width="300" height="300"></canvas>
+  </body>
+  <!-- script load -->
+  <script type="text/javascript" src="../model/javascript.js"></script>
+</html>
+=======
     <title>Home</title>
     <link rel="stylesheet" type="text/css" href="style.css">
   </head>
@@ -39,3 +49,4 @@
 <script type="text/javascript" src="../js/eventCTRL.js"></script>
 <script type="text/javascript" src="../js/turn.js"></script>
 <script type="text/javascript" src="../js/start.js"></script>
+>>>>>>> eeb7ff6d99e2ccaf8b19c6a80bbf40f10c387570

+ 0 - 16
src/view/style.css

@@ -1,16 +0,0 @@
-body {
-	display: flex;
-}
-
-.flexRow {
-	display: flex;
-	flex-direction: row;
-}
-
-div {
-	border: solid 1px red;
-}
-
-.indicator {
-	margin-right: 5rem;
-}

+ 0 - 31
src/view/styleacc.css

@@ -1,31 +0,0 @@
-*{
-    margin: 0;
-    padding: 0;
-}
-
-div
-{
-    display: flex;
-    flex-direction: column;
-    border: solid;
-    width: 50%;
-    height: 200px;
-    border-width: thin;
-    box-sizing: border-box;
-    justify-content: center;
-    align-items: center;
-
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    left: 0;
-    right: 0;
-    margin: auto;
-}
-button
-{
-    width: 8em;
-    margin: 2em;
-    background-color: aquamarine;
-    border-color: black;
-}

+ 0 - 11
src/view/tuto.html

@@ -1,11 +0,0 @@
-<!DOCTYPE html>
-    <html>
-        <head>
-            <title>Tutoriel</title>
-            <link rel="stylesheet" type="text/css" href="styletuto.css">
-        </head>
-
-        <body>
-            <h1>A faire...</h1>
-        </body>
-    </html>