Skip to content

Commit be0cad6

Browse files
author
Julia Rienitz
committed
Inital commit / proof of concept
0 parents  commit be0cad6

File tree

5 files changed

+159
-0
lines changed

5 files changed

+159
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Würfel Tool für das Rollenspielsystem "Das Schwarze Auge"
2+
3+
Für alle die - wie ich - zu faul zum Rechnen sind.

index.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<title>DSA Würfel Tool</title>
6+
<script src="vue.js"></script>
7+
<meta charset='utf-8'>
8+
<link rel="stylesheet" href="style.css"/>
9+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2, minimum-scale=0.5">
10+
</head>
11+
12+
<body>
13+
<div id="app">
14+
<h1>DSA Würfel Tool</h1>
15+
16+
<input type="button" value="Schleichen" v-on:click="rollSkill('sneek')">
17+
<h2>Results</h2>
18+
<div v-html="logs"></div>
19+
<div></div>
20+
</div>
21+
<footer>
22+
<a href="https://github.com/julia-r/dsa-roll">Auf Github</a>
23+
</footer>
24+
<script src="script.js"></script>
25+
</body>
26+
27+
</html>

script.js

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
2+
var vm = new Vue({
3+
el: '#app',
4+
data: {
5+
myAttributes: {
6+
mu: {
7+
name: "Mut",
8+
value: 14
9+
},
10+
kl:{
11+
name: "Klugheit",
12+
value: 11
13+
},
14+
in: {
15+
name: "Intuition",
16+
value: 14,
17+
},
18+
ch: {
19+
name: "Charisma",
20+
value: 11,
21+
},
22+
ff: {
23+
name: "fingerfertigkeit",
24+
value: 13
25+
},
26+
ge: {
27+
name: "Gewandheit",
28+
value: 14
29+
},
30+
ko: {
31+
name: "Kondition",
32+
value: 13
33+
},
34+
kk: {
35+
name: "Körperkraft",
36+
value: 15
37+
}
38+
},
39+
skills: {
40+
sneek: {
41+
name: "Schleichen",
42+
attributes: ["mu", "in", "ge"],
43+
value: 7
44+
}
45+
},
46+
logs: ""
47+
},
48+
computed: {},
49+
watch: {},
50+
methods: {
51+
rollSkill: function(skillID) {
52+
var self = this;
53+
var roll, thisAttribute, attributeName, attributeValue;
54+
var skillName = self.skills[skillID].name;
55+
var skillValue = self.skills[skillID].value;
56+
var skillCheck = skillValue;
57+
58+
var tempLog = "<h3>Würfele " + skillName +" (" + skillValue + ") </h3>";
59+
for(i = 0; i < 3; i++){
60+
roll = self.rollD20();
61+
thisAttribute = self.skills[skillID].attributes[i];
62+
attributeName = this.myAttributes[thisAttribute].name;
63+
attributeValue = this.myAttributes[thisAttribute].value;
64+
if(roll <= attributeValue){
65+
tempLog += attributeName + " (" + attributeValue + "): <span class='green'>" + roll + "</span> <br>";
66+
}
67+
else {
68+
tempLog += attributeName + " (" + attributeValue + "): <span class='red'>" + roll + "</span> <br>";
69+
skillCheck -= roll - attributeValue;
70+
}
71+
}
72+
if(skillCheck >= 0){
73+
tempLog += "<span class='green'>Erfolg: " + skillCheck + "</span>";
74+
}
75+
else {
76+
tempLog += "<span class='red'>Misserfolg: " + skillCheck + "</span>";
77+
}
78+
self.logs = tempLog;
79+
},
80+
81+
rollD20: function(){
82+
return Math.floor(Math.random()*(20)+1);
83+
}
84+
},
85+
config: {
86+
debug: true
87+
}
88+
});

style.css

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
body {
2+
font-family: Verdana, sans-serif;
3+
font-size: 16px;
4+
margin: 0;
5+
background: #fff;
6+
}
7+
8+
h1, h2, h3 {
9+
margin: 0.4em 0;
10+
}
11+
12+
#app, footer {
13+
padding: 0 10px;
14+
max-width: 900px;
15+
margin: 0 auto;
16+
}
17+
18+
#app {
19+
min-height: 95vh;
20+
padding-bottom: 20px;
21+
box-sizing: border-box;
22+
}
23+
24+
25+
.green {
26+
color: green;
27+
}
28+
.red {
29+
color: red;
30+
}
31+
32+
footer {
33+
clear: left;
34+
margin: 10px auto;
35+
}

vue.js

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)