mirror of
https://github.com/DieReicheErethons/Brewery.git
synced 2025-01-05 18:37:40 +01:00
Fixed random Words
This commit is contained in:
parent
d00c7888f9
commit
dd83ef55ad
28
config.yml
28
config.yml
@ -160,7 +160,7 @@ cooked:
|
||||
# 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.
|
||||
|
||||
# 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.
|
||||
# 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
|
||||
@ -299,7 +299,7 @@ words:
|
||||
|
||||
- replace: -space
|
||||
to: ''
|
||||
percentage: 40
|
||||
percentage: 30
|
||||
alcohol: 35
|
||||
|
||||
- replace: -space
|
||||
@ -322,12 +322,12 @@ words:
|
||||
|
||||
- replace: -random
|
||||
to: lu
|
||||
percentage: 60
|
||||
percentage: 20
|
||||
alcohol: 40
|
||||
|
||||
- replace: -random
|
||||
to: blub
|
||||
percentage: 60
|
||||
percentage: 20
|
||||
alcohol: 70
|
||||
|
||||
- replace: -random
|
||||
@ -340,20 +340,6 @@ words:
|
||||
percentage: 50
|
||||
alcohol: 80
|
||||
|
||||
- replace: -random
|
||||
to: ''
|
||||
percentage: 30
|
||||
|
||||
- replace: -random
|
||||
to: ''
|
||||
percentage: 50
|
||||
alcohol: 50
|
||||
|
||||
- replace: -random
|
||||
to: ''
|
||||
percentage: 50
|
||||
alcohol: 70
|
||||
|
||||
- replace: -random
|
||||
to: ' '
|
||||
percentage: 100
|
||||
@ -381,15 +367,15 @@ words:
|
||||
|
||||
- replace: -random
|
||||
to: ' *hicks* '
|
||||
percentage: 20
|
||||
percentage: 15
|
||||
alcohol: 40
|
||||
|
||||
- replace: -space
|
||||
to: ' *hicks* '
|
||||
percentage: 20
|
||||
percentage: 5
|
||||
alcohol: 20
|
||||
|
||||
- replace: -end
|
||||
to: ' *hicks*'
|
||||
percentage: 70
|
||||
alcohol: 30
|
||||
alcohol: 50
|
@ -82,6 +82,9 @@ public class Words {
|
||||
// each "from" "match"es "pre"
|
||||
// Not yet ignoring case :(
|
||||
public String distort(String words) {
|
||||
String from = this.from;
|
||||
String to = this.to;
|
||||
|
||||
if (from.equalsIgnoreCase("-end")) {
|
||||
from = words;
|
||||
to = words + to;
|
||||
@ -92,12 +95,8 @@ public class Words {
|
||||
from = " ";
|
||||
} else if (from.equalsIgnoreCase("-random")) {
|
||||
// inserts "to" on a random position in "words"
|
||||
int charIndex = (int) (Math.random() * 100.0);
|
||||
P.p.log("random: " + charIndex);
|
||||
charIndex *= (words.length() - 1);
|
||||
charIndex /= 100;
|
||||
P.p.log("charIndex: " + charIndex);
|
||||
if (charIndex > words.length() / 2) {
|
||||
int charIndex = (int) (Math.random() * (words.length() - 1));
|
||||
if (charIndex < words.length() / 2) {
|
||||
from = words.substring(charIndex);
|
||||
to = to + from;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user