mirror of
https://github.com/exituser/Brewery.git
synced 2026-09-17 08:59:01 +00:00
Fixed random Words
This commit is contained in:
+7
-21
@@ -160,7 +160,7 @@ cooked:
|
|||||||
# words: Wörter und Buchstaben die bei Chatten während Trunkenheit ersetzt werden sollen.
|
# words: Wörter und Buchstaben die bei Chatten während Trunkenheit ersetzt werden sollen.
|
||||||
# Diese werden von oben nach unten gelesen und in dieser Reihenfolge wird ein geschriebener Satz dann verändert.
|
# Diese werden von oben nach unten gelesen und in dieser Reihenfolge wird ein geschriebener Satz dann verändert.
|
||||||
|
|
||||||
# replace: Zu ersetzendes Wort oder Buchstabe. (Besondere: "-space": ersetzt Leerzeichen, "-random": Eine zufällige Position, "-start": Ganz am Anfang, "-end": Ganz ans Ende.)
|
# replace: Zu ersetzendes Wort oder Buchstabe. (Besondere: "-space": ersetzt Leerzeichen, "-random": Einfügen in zufällige Position, "-start": Ganz am Anfang, "-end": Ganz ans Ende.)
|
||||||
# to: In welches Wort es ersetzt werden soll.
|
# to: In welches Wort es ersetzt werden soll.
|
||||||
# pre: Wörter und Buchstaben vor dem gesuchten Wort (durch "," getrennt)
|
# pre: Wörter und Buchstaben vor dem gesuchten Wort (durch "," getrennt)
|
||||||
# match: true = eines der "pre"-Wörter muss vor dem gesuchten Wort stehen, false = keines der "pre" Wörter darf vor dem gesuchten stehen
|
# match: true = eines der "pre"-Wörter muss vor dem gesuchten Wort stehen, false = keines der "pre" Wörter darf vor dem gesuchten stehen
|
||||||
@@ -299,7 +299,7 @@ words:
|
|||||||
|
|
||||||
- replace: -space
|
- replace: -space
|
||||||
to: ''
|
to: ''
|
||||||
percentage: 40
|
percentage: 30
|
||||||
alcohol: 35
|
alcohol: 35
|
||||||
|
|
||||||
- replace: -space
|
- replace: -space
|
||||||
@@ -322,12 +322,12 @@ words:
|
|||||||
|
|
||||||
- replace: -random
|
- replace: -random
|
||||||
to: lu
|
to: lu
|
||||||
percentage: 60
|
percentage: 20
|
||||||
alcohol: 40
|
alcohol: 40
|
||||||
|
|
||||||
- replace: -random
|
- replace: -random
|
||||||
to: blub
|
to: blub
|
||||||
percentage: 60
|
percentage: 20
|
||||||
alcohol: 70
|
alcohol: 70
|
||||||
|
|
||||||
- replace: -random
|
- replace: -random
|
||||||
@@ -340,20 +340,6 @@ words:
|
|||||||
percentage: 50
|
percentage: 50
|
||||||
alcohol: 80
|
alcohol: 80
|
||||||
|
|
||||||
- replace: -random
|
|
||||||
to: ''
|
|
||||||
percentage: 30
|
|
||||||
|
|
||||||
- replace: -random
|
|
||||||
to: ''
|
|
||||||
percentage: 50
|
|
||||||
alcohol: 50
|
|
||||||
|
|
||||||
- replace: -random
|
|
||||||
to: ''
|
|
||||||
percentage: 50
|
|
||||||
alcohol: 70
|
|
||||||
|
|
||||||
- replace: -random
|
- replace: -random
|
||||||
to: ' '
|
to: ' '
|
||||||
percentage: 100
|
percentage: 100
|
||||||
@@ -381,15 +367,15 @@ words:
|
|||||||
|
|
||||||
- replace: -random
|
- replace: -random
|
||||||
to: ' *hicks* '
|
to: ' *hicks* '
|
||||||
percentage: 20
|
percentage: 15
|
||||||
alcohol: 40
|
alcohol: 40
|
||||||
|
|
||||||
- replace: -space
|
- replace: -space
|
||||||
to: ' *hicks* '
|
to: ' *hicks* '
|
||||||
percentage: 20
|
percentage: 5
|
||||||
alcohol: 20
|
alcohol: 20
|
||||||
|
|
||||||
- replace: -end
|
- replace: -end
|
||||||
to: ' *hicks*'
|
to: ' *hicks*'
|
||||||
percentage: 70
|
percentage: 70
|
||||||
alcohol: 30
|
alcohol: 50
|
||||||
@@ -82,6 +82,9 @@ public class Words {
|
|||||||
// each "from" "match"es "pre"
|
// each "from" "match"es "pre"
|
||||||
// Not yet ignoring case :(
|
// Not yet ignoring case :(
|
||||||
public String distort(String words) {
|
public String distort(String words) {
|
||||||
|
String from = this.from;
|
||||||
|
String to = this.to;
|
||||||
|
|
||||||
if (from.equalsIgnoreCase("-end")) {
|
if (from.equalsIgnoreCase("-end")) {
|
||||||
from = words;
|
from = words;
|
||||||
to = words + to;
|
to = words + to;
|
||||||
@@ -92,12 +95,8 @@ public class Words {
|
|||||||
from = " ";
|
from = " ";
|
||||||
} else if (from.equalsIgnoreCase("-random")) {
|
} else if (from.equalsIgnoreCase("-random")) {
|
||||||
// inserts "to" on a random position in "words"
|
// inserts "to" on a random position in "words"
|
||||||
int charIndex = (int) (Math.random() * 100.0);
|
int charIndex = (int) (Math.random() * (words.length() - 1));
|
||||||
P.p.log("random: " + charIndex);
|
if (charIndex < words.length() / 2) {
|
||||||
charIndex *= (words.length() - 1);
|
|
||||||
charIndex /= 100;
|
|
||||||
P.p.log("charIndex: " + charIndex);
|
|
||||||
if (charIndex > words.length() / 2) {
|
|
||||||
from = words.substring(charIndex);
|
from = words.substring(charIndex);
|
||||||
to = to + from;
|
to = to + from;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user