Ever-Success implemented
This commit is contained in:
parent
8c7a8f9777
commit
108936324c
1 changed files with 9 additions and 2 deletions
|
@ -82,9 +82,16 @@
|
||||||
// Probe-Function: checks, whether a given "effort" is succesfull, according to the rules of DS
|
// Probe-Function: checks, whether a given "effort" is succesfull, according to the rules of DS
|
||||||
// Not yet implemented: Tests for values larger than 20
|
// Not yet implemented: Tests for values larger than 20
|
||||||
var dice = function(probe) {
|
var dice = function(probe) {
|
||||||
|
console.log(probe);
|
||||||
var diceval = Math.floor(Math.random() * (21 - 1)) + 1;
|
var diceval = Math.floor(Math.random() * (21 - 1)) + 1;
|
||||||
if ( diceval <= probe ) {
|
if ( diceval <= probe ) {
|
||||||
|
if (diceval == 1) {
|
||||||
|
alert ("Immersieg!");
|
||||||
|
return probe;
|
||||||
|
}
|
||||||
|
else {
|
||||||
return diceval;
|
return diceval;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (diceval === 20) {
|
if (diceval === 20) {
|
||||||
|
@ -160,7 +167,7 @@
|
||||||
var output=$('#output');
|
var output=$('#output');
|
||||||
output.html(this.info.cname+" greift "+enem.info.cname+" an!<br>");
|
output.html(this.info.cname+" greift "+enem.info.cname+" an!<br>");
|
||||||
var attack_val = dice(this.battle[this.att]);
|
var attack_val = dice(this.battle[this.att]);
|
||||||
if (! attack_val ) {
|
if (attack_val == 0 ) {
|
||||||
output.append('Angriff Fehlgeschlagen!<br>');
|
output.append('Angriff Fehlgeschlagen!<br>');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in a new issue