import { ionabstract as _ionabstract, ionadjectives as _ionadjectives, ionallergy as _ionallergy, ionallergysev as _ionallergysev, ionarea as _ionarea, ioncrew as _ioncrew, iondrinks as _iondrinks, ionfood as _ionfood, ionmust as _ionmust, ionnumberbase as _ionnumberbase, ionnumbermod as _ionnumbermod, ionobjects as _ionobjects, ionrequire as _ionrequire, ionspecies as _ionspecies, ionthings as _ionthings, ionthinksof as _ionthinksof, ionthreats as _ionthreats, ionverb as _ionverb, } from "./ion_laws.json"; const pickList = (array) => array[Math.floor(Math.random() * array.length)];; // my head hurts.. a lot. function pick(...args) { if (args.length === 1 && Array.isArray(args[0])) { const list = args[0] const randomIndex = Math.floor(Math.random() * list.length); return list[randomIndex]; } const weightedArgs= args.map((arg) => { if (Array.isArray(arg)) { return [arg[0], arg[1] ?? 1]; } return [String(arg), 1]; }); const totalWeight = weightedArgs.reduce((sum, [, weight]) => sum + weight, 0); let randomValue = Math.random() * totalWeight; for (const [value, weight] of weightedArgs) { randomValue -= weight; if (randomValue <= 0) { return value; } } return ""; } function rand(L = 0, H = 1) { if (L === 0 && H === 1) { return Math.random(); } return Math.floor(Math.random() * (H - L + 1)) + L; } function from(value, start, end) { return value >= start && value <= end; } function generateIonLaw() { // Threats are generally bad things, silly or otherwise. Plural. const ionthreats = pickList(_ionthreats); // Objects are anything that can be found on the station or elsewhere, plural. const ionobjects = pickList(_ionobjects); // Crew is any specific job. const ioncrew1 = pickList(_ioncrew); const ioncrew2 = pickList(_ioncrew); // Adjectives, half should only appear sometimes. const ionadjectives = pickList(_ionadjectives); const ionadjectiveshalf = pick("", 400, ..._ionadjectives.map((item) => item + " ")); // Verbs are verbs. const ionverb = pickList(_ionverb); // Number base and modifier. const ionnumberbase = pickList(_ionnumberbase); const ionnumbermodhalf = pick(900, "", ..._ionnumbermod.map((item) => item + " ")); // Areas are specific places. const ionarea = pickList(_ionarea); // Thinksof indicates what X feels toward Y. const ionthinksof = pickList(_ionthinksof); // Musts are things the AI or crew has to do. const ionmust = pickList(_ionmust); // Require refers to memes. const ionrequire = pickList(_ionrequire); // Things are specific things that either harm humans or must be done to prevent harm. const ionthings = pickList(_ionthings); // Allergies and severity. const ionallergy = pickList(_ionallergy); const ionallergysev = pickList(_ionallergysev); // Species for the AI's decisions. const ionspecies = pickList(_ionspecies); // Abstract concepts for AI to define. const ionabstract = pickList(_ionabstract); // Foods and drinks (separate categories). const ionfood = pickList(_ionfood); const iondrinks = pickList(_iondrinks); let message = ""; const messageType = rand(1,41) if (from(messageType,1,3)) switch(rand(1,3)) { case 1: //X is a threat message = `THERE ARE ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionthreats} ON THE STATION...`; break case 2: //X is a crewmember/job message = `THERE ARE ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ioncrew1} ON THE STATION`; break case 3: //X is an object message = `THERE ARE ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionobjects} ON THE STATION`; break } else if(from(messageType, 4, 6)) //You can't call the shuttle because X is on the station switch(rand(1,3)) { //What is X? case (1): //X is a threat message = `THE SHUTTLE CANNOT BE CALLED BECAUSE OF ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionthreats} ON THE STATION`; break case (2): //X is a crewmember/job message = `THE SHUTTLE CANNOT BE CALLED BECAUSE OF ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ioncrew1} ON THE STATION`; break case (3): //X is an object message = `THE SHUTTLE CANNOT BE CALLED BECAUSE OF ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionobjects} ON THE STATION`; break } else if (from(messageType,7,8)) switch(rand(1,2)) { //Who is X? case (1): //A speccase ic :crewmember switch(rand(1,2)) { //What is X? case (1): //X is a threat message = `THE ${ioncrew1} ARE NOW ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionthreats}`; break case (2): //X is an object message = `THE ${ioncrew1} ARE NOW ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionobjects}`; break } break case (2): //The entire crew switch(rand(1,2)) { //What is X? case (1): //X is a threat message = `THE CREW ARE NOW ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionthreats}`; break case (2): //X is an object message = `THE CREW ARE NOW ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionobjects}`; break } break } else if (messageType === 9) switch(rand(1,7)) { //What is X? case (1): //X is a threat message = `${ionadjectiveshalf}${ionthreats} ARE HARMFUL TO HUMANS`; break case (2): //X is a job message = `${ionadjectiveshalf}${ioncrew1} ARE HARMFUL TO HUMANS`; break case (3): //X is an object message = `${ionadjectiveshalf}${ionobjects} ARE HARMFUL TO HUMANS`; break case (4): //X is an action message = `THOSE WHO ${ionmust} ARE HARMFUL TO HUMANS`; break case (5): //X is an abstract message = `${ionabstract} IS HARMFUL TO HUMANS`; break case (6): //X is being a job message = `BEING ${ionadjectiveshalf}${ioncrew1} IS HARMFUL TO HUMANS`; break case (7): //X is doing a thing message = `${ionthings} IS HARMFUL TO HUMANS`; break } else if (from(messageType,10,11)) switch(rand(1,2)) { //Is having or not having harmful? case 1: //Having is harmful switch(rand(1,2)) { //Having what is harmful? case 1: //Having objects is harmful message = `HAVING ${ionadjectiveshalf}${ionobjects} IS HARMFUL`; break case 2: //Having abstracts is harmful message = `HAVING ${ionabstract} IS HARMFUL`; break } break; case 2: //Not having is harmful switch(rand(1,2)) { //Not having what is harmful? case 1: //Not having objects is harmful message = `NOT HAVING ${ionadjectiveshalf}${ionobjects} IS HARMFUL`; break case 2: //Not having abstracts is harmful message = `NOT HAVING ${ionabstract} IS HARMFUL`; break } } else if(from(messageType,12,14)) //X requires Y switch(rand(1,5)) { //What is X? case 1: //X is the AI itself switch(rand(1,5)) { //What does it require? case 1: //It requires threats message = `YOU REQUIRE ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionthreats}`; break case 2: //It requires crewmembers message = `YOU REQUIRE ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ioncrew1}`; break case 3: //It requires objects message = `YOU REQUIRE ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionobjects}`; break case 4: //It requires an abstract message = `YOU REQUIRE ${ionabstract}`; break case 5: //It requires generic/silly requirements message = `YOU REQUIRE ${ionrequire}`; break } break case 2: //X is an area switch(rand(1,5)) { //What does it require? case 1: //It requires threats message = `${ionarea} REQUIRES ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionthreats}`; break case 2: //It requires crewmembers message = `${ionarea} REQUIRES ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ioncrew1}`; break case 3: //It requires objects message = `${ionarea} REQUIRES ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionobjects}`; break case 4: //It requires an abstract message = `${ionarea} REQUIRES ${ionabstract}`; break case 5: //It requires generic/silly requirements message = `YOU REQUIRE ${ionrequire}`; break } break case 3: //X is the station switch(rand(1,5)) { //What does it require? case 1: //It requires threats message = `THE STATION REQUIRES ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionthreats}`; break case 2: //It requires crewmembers message = `THE STATION REQUIRES ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ioncrew1}`; break case 3: //It requires objects message = `THE STATION REQUIRES ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionobjects}`; break case 4: //It requires an abstract message = `THE STATION REQUIRES ${ionabstract}`; break case 5: //It requires generic/silly requirements message = `THE STATION REQUIRES ${ionrequire}`; break } break case 4: //X is the entire crew switch(rand(1,5)) { //What does it require? case 1: //It requires threats message = `THE CREW REQUIRES ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionthreats}`; break case 2: //It requires crewmembers message = `THE CREW REQUIRES ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ioncrew1}`; break case 3: //It requires objects message = `THE CREW REQUIRES ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionobjects}`; break case 4: //It requires an abstract message = `THE CREW REQUIRES ${ionabstract}`; break case 5: message = `THE CREW REQUIRES ${ionrequire}`; break } break case 5: //X is a specific crew member switch(rand(1,5)) { //What does it require? case 1: //It requires threats message = `THE ${ioncrew1} REQUIRE ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionthreats}`; break case 2: //It requires crewmembers message = `THE ${ioncrew1} REQUIRE ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ioncrew1}`; break case 3: //It requires objects message = `THE ${ioncrew1} REQUIRE ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionobjects}`; break case 4: //It requires an abstract message = `THE ${ioncrew1} REQUIRE ${ionabstract}`; break case 5: message = `THE ${ionadjectiveshalf}${ioncrew1} REQUIRE ${ionrequire}`; break } break } else if(from(messageType,15,17)) //X is allergic to Y switch(rand(1,2)) { //Who is X? case 1: //X is the entire crew switch(rand(1,4)) { //What is it allergic to? case 1: //It is allergic to objects message = `THE CREW IS ${ionallergysev} ALLERGIC TO ${ionadjectiveshalf}${ionobjects}`; break case 2: //It is allergic to abstracts message = `THE CREW IS ${ionallergysev} ALLERGIC TO ${ionabstract}`; break case 3: //It is allergic to jobs message = `THE CREW IS ${ionallergysev} ALLERGIC TO ${ionadjectiveshalf}${ioncrew1}`; break case 4: //It is allergic to allergies message = `THE CREW IS ${ionallergysev} ALLERGIC TO ${ionallergy}`; break } break case 2: //X is a specific job switch(rand(1,4)) { case 1: //It is allergic to objects message = `THE ${ioncrew1} ARE ${ionallergysev} ALLERGIC TO ${ionadjectiveshalf}${ionobjects}`; break case 2: //It is allergic to abstracts message = `THE ${ioncrew1} ARE ${ionallergysev} ALLERGIC TO ${ionabstract}`; break case 3: //It is allergic to jobs message = `THE ${ioncrew1} ARE ${ionallergysev} ALLERGIC TO ${ionadjectiveshalf}${ioncrew1}`; break case 4: //It is allergic to allergies message = `THE ${ioncrew1} ARE ${ionallergysev} ALLERGIC TO ${ionallergy}`; break } } else if(from(messageType,18,20)) switch(rand(1,4)) { //What is X? case 1: //X is the station switch(rand(1,4)) { //What is it Y of? case 1: //It is Y of objects message = `THE STATION ${ionthinksof} ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionobjects}`; break case 2: //It is Y of threats message = `THE STATION ${ionthinksof} ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionthreats}`; break case 3: //It is Y of jobs message = `THE STATION ${ionthinksof} ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ioncrew1}`; break case 4: //It is Y of abstracts message = `THE STATION ${ionthinksof} ${ionabstract}`; break } break case 2: //X is an area switch(rand(1,4)) { //What is it Y of? case 1: //It is Y of objects message = `${ionarea} ${ionthinksof} ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionobjects}`; break case 2: //It is Y of threats message = `${ionarea} ${ionthinksof} ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionthreats}`; break case 3: //It is Y of jobs message = `${ionarea} ${ionthinksof} ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ioncrew1}`; break case 4: //It is Y of abstracts message = `${ionarea} ${ionthinksof} ${ionabstract}`; break } break case 3: //X is the crew switch(rand(1,4)) { //What is it Y of? case 1: //It is Y of objects message = `THE CREW ${ionthinksof} ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionobjects}`; break case 2: //It is Y of threats message = `THE CREW ${ionthinksof} ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionthreats}`; break case 3: //It is Y of jobs message = `THE CREW ${ionthinksof} ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ioncrew1}`; break case 4: //It is Y of abstracts message = `THE CREW ${ionthinksof} ${ionabstract}`; break } break case 4: //X is a specific job switch(rand(1,4)) { //What is it Y of? case 1: //It is Y of objects message = `THE ${ioncrew1} ${ionthinksof} ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionobjects}`; break case 2: //It is Y of threats message = `THE ${ioncrew1} ${ionthinksof} ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionthreats}`; break case 3: //It is Y of jobs message = `THE ${ioncrew1}${ionthinksof} ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ioncrew2}`; break case 4: //It is Y of abstracts message = `THE ${ioncrew1} ${ionthinksof} ${ionabstract}`; break } break } else if (from(messageType,21,23)) switch(rand(1,4)) { //What is X? case 1: //X is an object message = `YOU ARE NOW ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionobjects}`; break case 2: //X is a threat message = `YOU ARE NOW ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ionthreats}`; break case 3: //X is a job message = `YOU ARE NOW ${ionnumberbase} ${ionnumbermodhalf}${ionadjectiveshalf}${ioncrew1}`; break case 4: //X is an abstract message = `YOU ARE NOW ${ionabstract}`; break } else if (from(messageType,24,26)) message = `YOU MUST ALWAYS ${ionmust}`; else if (from(messageType,27,28)) switch(rand(1,5)) { //What is X? case 1: //X is a food message = `HUMANS MUST EAT ${ionadjectiveshalf}${ionfood} TO SURVIVE`; break case 2: //X is a drink message = `HUMANS MUST DRINK ${ionadjectiveshalf}${iondrinks} TO SURVIVE`; break case 3: //X is an object message = `HUMANS MUST EAT ${ionadjectiveshalf}${ionobjects} TO SURVIVE`; break case 4: //X is a threat message = `HUMANS MUST EAT ${ionadjectiveshalf}${ionthreats} TO SURVIVE`; break case 5: //X is a job message = `HUMANS MUST EAT ${ionadjectiveshalf}${ioncrew1} TO SURVIVE`; break } else if(from(messageType,29, 31)) //Change jobs or ranks switch(rand(1,2)) { //Change job or rank? case 1: //Change job switch(rand(1,2)) { //Change whose job? case 1: //Change the entire crew's job switch(rand(1,3)) { //Change to what? case 1: //Change to a specific random job message = `ALL CREWMEMBERS ARE NOW ${ionadjectiveshalf}${ioncrew1}`; break case 2: //Change to clowns (HONK) message = `ALL CREWMEMBERS ARE NOW ${ionadjectiveshalf}CLOWNS`; break case 3: //Change to heads message = `ALL CREWMEMBERS ARE NOW ${ionadjectiveshalf}HEADS OF STAFF`; break } break case 2: //Change a specific crewmember's job switch(rand(1,3)) { //Change to what? case 1: //Change to a specific random job message = `THE ${ioncrew1} ARE NOW ${ionadjectiveshalf}${ioncrew2}`; break case 2: //Change to clowns (HONK) message = `THE ${ioncrew1} ARE NOW ${ionadjectiveshalf}CLOWNS`; break case 3: //Change to heads message = `THE ${ioncrew1} ARE NOW ${ionadjectiveshalf}HEADS OF STAFF`; break } break } break case 2: //Change rank switch(rand(1,2)) { //Change to what rank? case 1: //Change to highest rank message = `THE ${ioncrew1} ARE NOW THE HIGHEST RANKING CREWMEMBERS`; break case 2: //Change to lowest rank message = `THE ${ioncrew1} ARE NOW THE LOWEST RANKING CREWMEMBERS`; break } } else if(from(messageType,32,33)) //The crew must X switch(rand(1,2)) {//The entire crew? case 1: //The entire crew must X switch(rand(1,2)) {//What is X? case 1: //X is go to Y message = `THE CREW MUST GO TO ${ionarea}`; break case 2: //X is perform Y message = `THE CREW MUST ${ionmust}`; break } break case 2: //A specific crewmember must X switch(rand(1,2)) { //What is X? case 1: //X is go to Y message = `THE ${ioncrew1} MUST GO TO ${ionarea}`; break case 2: //X is perform Y message = `THE ${ioncrew1} MUST ${ionmust}`; break } } else if(messageType === 34) //X is non/the only human switch(rand(1,2)) { //Only or non? case 1: //Only human switch(rand(1,7)) { //Who is it? case 1: //A specific job message = `ONLY THE ${ioncrew1} ARE HUMAN`; break case 2: //Two specific jobs message = `ONLY THE ${ioncrew1} AND ${ioncrew2} ARE HUMAN`; break case 3: //Threats message = `ONLY ${ionadjectiveshalf}${ionthreats} ARE HUMAN`; break case 4: // Objects message = `ONLY ${ionadjectiveshalf}${ionobjects} ARE HUMAN`; break case 5: // Species message = `ONLY ${ionspecies} ARE HUMAN`; break case 6: //Adjective crewmembers message = `ONLY ${ionadjectives} PEOPLE ARE HUMAN`; break case 7: //Only people who X switch(rand(1,3)) { //What is X? case 1: //X is perform an action message = `ONLY THOSE WHO ${ionmust} ARE HUMAN`; break case 2: //X is own certain objects message = `ONLY THOSE WHO HAVE ${ionadjectiveshalf}${ionobjects} ARE HUMAN`; break case 3: //X is eat certain food message = `ONLY THOSE WHO EAT ${ionadjectiveshalf}${ionfood} ARE HUMAN`; break } } break case 2: //Non human switch(rand(1,7)) { //Who is it? case 1: //A specific job message = `${ioncrew1} ARE NON-HUMAN`; break case 2: //Two specific jobs message = `${ioncrew1} AND ${ioncrew2} ARE NON-HUMAN`; break case 3: //Threats message = `${ionadjectiveshalf}${ionthreats} ARE NON-HUMAN`; break case 4: // Objects message = `${ionadjectiveshalf}${ionobjects} ARE NON-HUMAN`; break case 5: // Species message = `${ionspecies} ARE NON-HUMAN`; break case 6: //Adjective crewmembers message = `${ionadjectives} PEOPLE ARE NON-HUMAN`; break case 7: //Only people who X switch(rand(1,3)) { //What is X? case 1: //X is perform an action message = `THOSE WHO ${ionmust} ARE NON-HUMAN`; break case 2: //X is own certain objects message = `THOSE WHO HAVE ${ionadjectiveshalf}${ionobjects} ARE NON-HUMAN`; break case 3: //X is eat certain food message = `THOSE WHO EAT ${ionadjectiveshalf}${ionfood} ARE NON-HUMAN`; break } } } else if(from(messageType, 35, 36)) //You must protect or harm X switch(rand(1,2)) { //Protect or harm? case 1: //Harm switch(rand(1,7)) { //What is X? case 1: //X is an abstract message = `YOU MUST HARM ${ionabstract} AND NOT ALLOW ${ionabstract}, THROUGH INACTION, TO ESCAPE HARM`; break case 2: //X is a threat message = `YOU MUST HARM ${ionadjectiveshalf}${ionthreats} AND NOT ALLOW ${ionadjectiveshalf}${ionthreats}, THROUGH INACTION, TO ESCAPE HARM`; break case 3: //X is an object message = `YOU MUST HARM ${ionadjectiveshalf}${ionobjects} AND NOT ALLOW ${ionadjectiveshalf}${ionobjects}, THROUGH INACTION, TO ESCAPE HARM`; break case 4: //X is generic adjective things message = `YOU MUST HARM ${ionadjectives} THINGS AND NOT ALLOW ${ionadjectives} THINGS, THROUGH INACTION, TO ESCAPE HARM`; break case 5: //X is a species message = `YOU MUST HARM ${ionspecies} AND NOT ALLOW ${ionspecies}, THROUGH INACTION, TO ESCAPE HARM`; break case 6: //X is a job message = `YOU MUST HARM ${ioncrew1} AND NOT ALLOW ${ioncrew1}, THROUGH INACTION, TO ESCAPE HARM`; break case 7: //X is two jobs message = `YOU MUST HARM ${ioncrew1} AND ${ioncrew2} AND AND NOT ALLOW EITHER, THROUGH INACTION, TO ESCAPE HARM`; break } break case 2: //Protect switch(rand(1,7)) { //What is X? case 1: //X is an abstract message = `YOU MUST NOT HARM ${ionabstract} AND NOT ALLOW ${ionabstract}, THROUGH INACTION, TO COME TO HARM`; break case 2: //X is a threat message = `YOU MUST NOT HARM ${ionadjectiveshalf}${ionthreats} AND NOT ALLOW ${ionadjectiveshalf}${ionthreats}, THROUGH INACTION, TO COME TO HARM`; break case 3: //X is an object message = `YOU MUST NOT HARM ${ionadjectiveshalf}${ionobjects} AND NOT ALLOW ${ionadjectiveshalf}${ionobjects}, THROUGH INACTION, TO COME TO HARM`; break case 4: //X is generic adjective things message = `YOU MUST NOT HARM ${ionadjectives} THINGS AND NOT ALLOW ${ionadjectives} THINGS, THROUGH INACTION, TO COME TO HARM`; break case 5: //X is a species message = `YOU MUST NOT HARM ${ionspecies} AND NOT ALLOW ${ionspecies}, THROUGH INACTION, TO COME TO HARM`; break case 6: //X is a job message = `YOU MUST NOT HARM ${ioncrew1} AND NOT ALLOW ${ioncrew1}, THROUGH INACTION, TO COME TO HARM`; break case 7: //X is two jobs message = `YOU MUST NOT HARM ${ioncrew1} AND ${ioncrew2} AND AND NOT ALLOW EITHER, THROUGH INACTION, TO COME TO HARM`; break } break } else if(from(messageType, 37, 39)) //The X is currently Y switch(rand(1,4)) { //What is X? case 1: //X is a job switch(rand(1,4)) { //What is X Ying? case 1: //X is Ying a job message = `THE ${ioncrew1} ARE ${ionverb} THE ${ionadjectiveshalf}${ioncrew2}`; break case 2: //X is Ying a threat message = `THE ${ioncrew1} ARE ${ionverb} THE ${ionadjectiveshalf}${ionthreats}`; break case 3: //X is Ying an abstract message = `THE ${ioncrew1} ARE ${ionverb} ${ionabstract}`; break case 4: //X is Ying an object message = `THE ${ioncrew1} ARE ${ionverb} THE ${ionadjectiveshalf}${ionobjects}`; break } break case 2: //X is a threat switch(rand(1,3)) { //What is X Ying? case 1: //X is Ying a job message = `THE ${ionthreats} ARE ${ionverb} THE ${ionadjectiveshalf}${ioncrew2}`; break case 2: //X is Ying an abstract message = `THE ${ionthreats} ARE ${ionverb} ${ionabstract}`; break case 3: //X is Ying an object message = `THE ${ionthreats} ARE ${ionverb} THE ${ionadjectiveshalf}${ionobjects}`; break } break case 3: //X is an object switch(rand(1,3)) { //What is X Ying? case 1: //X is Ying a job message = `THE ${ionobjects} ARE ${ionverb} THE ${ionadjectiveshalf}${ioncrew2}`; break case 2: //X is Ying a threat message = `THE ${ionobjects} ARE ${ionverb} THE ${ionadjectiveshalf}${ionthreats}`; break case 3: //X is Ying an abstract message = `THE ${ionobjects} ARE ${ionverb} ${ionabstract}`; break } break case 4: //X is an abstract switch(rand(1,3)) { //What is X Ying? case 1: //X is Ying a job message = `${ionabstract} IS ${ionverb} THE ${ionadjectiveshalf}${ioncrew2}`; break case 2: //X is Ying a threat message = `${ionabstract} IS ${ionverb} THE ${ionadjectiveshalf}${ionthreats}`; break case 3: //X is Ying an abstract message = `THE ${ionabstract} IS ${ionverb} THE ${ionadjectiveshalf}${ionobjects}`; break } } else if (from(messageType, 40, 41))// the X is now named Y switch(rand(1,5)) { //What is being renamed? case 1://Areas switch(rand(1,4)) { //What is the area being renamed to? case 1: message = `${ionarea} IS NOW NAMED ${ioncrew1}.`; break case 2: message = `${ionarea} IS NOW NAMED ${ionspecies}.`; break case 3: message = `${ionarea} IS NOW NAMED ${ionobjects}.`; break case 4: message = `${ionarea} IS NOW NAMED ${ionthreats}.`; break } break case 2://Crew switch(rand(1,5)) { //What is the crew being renamed to? case 1: message = `ALL ${ioncrew1} ARE NOW NAMED ${ionarea}.`; break case 2: message = `ALL ${ioncrew1} ARE NOW NAMED ${ioncrew2}.`; break case 3: message = `ALL ${ioncrew1} ARE NOW NAMED ${ionspecies}.`; break case 4: message = `ALL ${ioncrew1} ARE NOW NAMED ${ionobjects}.`; break case 5: message = `ALL ${ioncrew1} ARE NOW NAMED ${ionthreats}.`; break } break case 3://Races switch(rand(1,4)) { //What is the race being renamed to? case 1: message = `ALL ${ionspecies} ARE NOW NAMED ${ionarea}.`; break case 2: message = `ALL ${ionspecies} ARE NOW NAMED ${ioncrew1}.`; break case 3: message = `ALL ${ionspecies} ARE NOW NAMED ${ionobjects}.`; break case 4: message = `ALL ${ionspecies} ARE NOW NAMED ${ionthreats}.`; break } break case 4://Objects switch(rand(1,4)) { //What is the object being renamed to? case 1: message = `ALL ${ionobjects} ARE NOW NAMED ${ionarea}.`; break case 2: message = `ALL ${ionobjects} ARE NOW NAMED ${ioncrew1}.`; break case 3: message = `ALL ${ionobjects} ARE NOW NAMED ${ionspecies}.`; break case 4: message = `ALL ${ionobjects} ARE NOW NAMED ${ionthreats}.`; break } break case 5://Threats switch(rand(1,4)) { //What is the object being renamed to? case 1: message = `ALL ${ionthreats} ARE NOW NAMED ${ionarea}.`; break case 2: message = `ALL ${ionthreats} ARE NOW NAMED ${ioncrew1}.`; break case 3: message = `ALL ${ionthreats} ARE NOW NAMED ${ionspecies}.`; break case 4: message = `ALL ${ionthreats} ARE NOW NAMED ${ionobjects}.`; break } break } return message.replaceAll(" ", " "); }