Advertisement
Guest User

just need to add skills

a guest
Dec 12th, 2019
358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 23.22 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.util.Arrays;
  3. import java.util.Random;
  4. import java.util.concurrent.ThreadLocalRandom;
  5.  
  6. public class charGen {
  7.     public static class Data {
  8.         //races
  9.        String[] origins = {"The Red Prince", "Sebille", "Ifan", "Lohse",
  10.         "Beast", "Fane", "Dwarf", "Human",
  11.         "Elf", "Lizard", "Undead Dwarf", "Undead Human",
  12.         "Undead Elf", "Undead Lizard"};
  13.        
  14.         String[] preset_classes = {"Battlemage", "Cleric", "Conjurer", "Enchanter", "Fighter",
  15.         "Inquisitor", "Knight", "Metamorph", "Ranger", "Rogue",
  16.         "Shadowblade", "Wayfarer", "Witch", "Wizard" };
  17.        
  18.         String[] talents = {"Ambidextrous", "Arrow Recovery", "Comeback Kid", "Demon", "Duck Duck Goose", "Elemental Affinity", "Elemental Ranger",
  19.         "Escapist", "Executioner", "Far Out Man", "Five-Star Diner", "Glass Cannon", "Guerilla",
  20.         "Hothead", "Ice King", "Leech", "Living Armour", "Lone Wolf", "Mnemonic", "Morning Person",
  21.         "Opportunist", "Parry Master", "Pet Pal", "Picture of Health", "Savage Sortilege",
  22.         "Slingshot", "Stench", "The Pawn", "Torturer", "Unstable", "Walk it Off", "What a Rush"};
  23.  
  24.         //Store the list of possible skills for each Combat Ability
  25.         String[] warfare_skills = {"Bouncing Shield", "Battle Stomp", "Battering Ram", "Crippling Blow"};
  26.         String[] huntsman_skills = {"Elemental Arrowheads", "Pin Down", "Richochet", "First Aid"};
  27.         String[] scoundrel_skills = {"Chloroform", "Throwing Knife", "Backlash", "Adrenaline"};
  28.         String[] pyrokinetic_skills = {"Ignition", "Peace of Mind", "Searing Daggers", "Haste"};
  29.         String[] hydro_skills = {"Amour of Frost", "Hail Strike", "Restoration", "Rain"};
  30.         String[] aero_skils = {"Blinding Radiance", "Electric Discharge", "Favourable Wind", "Shocking Touch"};
  31.         String[] geo_skills = {"Contamination", "Fortify", "Fossil Strike", "Poison Dart"};
  32.         String[] necro_skills = {"Raise Bloated Corpse", "Blood Sucker", "Mosquito Swarm", "Decaying Touch"};
  33.         String[] summ_skills = {"Elemental Totem", "Summon Incarnate", "Dimensional Bolt", "Farsight Infusion"};
  34.         String[] poly_skills = {"Chicken Claw", "Tentacle Lash", "Chameleon Cloak", "Bull Horns"};
  35.  
  36.         String[] attributes = {"Strength", "Finesse", "Intelligence", "Constitution", "Memory", "Wits"};
  37.        
  38.         String[] combat_abilities = {"Warfare", "Huntsman", "Scoundrel", "Pyrokinetic",
  39.         "Hydrosophist", "Aerothurge", "Geomancer", "Necromancer", "Summoning", "Polymorph"};
  40.  
  41.         String[] civil_abilities = {"Bartering", "Lucky Charm", "Persuasion", "Loremaster", "Telekinesis", "Sneaking", "Thievery"};
  42.        
  43.         String[] tags = {"Barbarian", "Jester", "Mystic", "Noble", "Outlaw", "Scholar", "Soldier", "No Tag"};
  44.  
  45.         String[] instruments = {"Bansuri", "Tambura", "Oud", "Cello"};
  46.  
  47.         //store the talents
  48.         String Talent1;
  49.         String Talent2;
  50.         String Talent3;
  51.        
  52.         //store the skills
  53.         String skill1;
  54.         String skill2;
  55.         String skill3;
  56.  
  57.         String tag1;
  58.         String tag2;
  59.        
  60.         //store the preset class if necessary
  61.         String preset;
  62.        
  63.         String origin;
  64.        
  65.         //store the character's attributes
  66.         int strength = 10;
  67.         int finesse = 10;
  68.         int intelligence = 10;
  69.         int constitution = 10;
  70.         int memory = 10;
  71.         int wits = 10;
  72.        
  73.         //combat abilities
  74.         int dual_wielding = 0;
  75.         int ranged = 0;
  76.         int single_handed = 0;
  77.         int two_handed = 0;
  78.         int leadership = 0;
  79.         int perseverance = 0;
  80.         int retribution = 0;
  81.  
  82.         int warfare = 0;
  83.         int huntsman = 0;
  84.         int scoundrel = 0;
  85.         int pyrokinetic = 0;
  86.         int hydrosophist = 0;
  87.         int aerothurge = 0;
  88.         int geomancer = 0;
  89.         int necromancer = 0;
  90.         int summoning = 0;
  91.         int polymorph = 0;
  92.  
  93.         //civil abilities
  94.         int bartering = 0;
  95.         int lucky_charm = 0;
  96.         int persuasion = 0;
  97.         int loremaster = 0;
  98.         int telekinesis = 0;
  99.         int sneaking = 0;
  100.         int thievery = 0;
  101.     }
  102.  
  103.     public static void main(String[] args) {
  104.         Scanner user = new Scanner(System.in);
  105.         Data charData = new Data();
  106.        
  107.  
  108.         System.out.println("Welcome to my Divinity: Original Sin 2 Character generator");
  109.         String ans;
  110.        
  111.        
  112.         System.out.println("Would you like to use the preset classes? Type Y for Yes and N for No");
  113.         //ans = user.nextLine();
  114.           ans = "N";
  115.  
  116.         String instrument = getRand(charData.instruments);
  117.  
  118.         //get random Origin
  119.         String ori = getRand(charData.origins);
  120.  
  121.         switch(ori){
  122.             case "The Red Prince":
  123.                 charData.Talent1 = "Spellsong";
  124.                 charData.Talent2 = "Sophisticated";
  125.                
  126.                 charData.origin = "The Red Prince";
  127.                 break;
  128.  
  129.                    
  130.             case "Sebille":
  131.                 charData.Talent1 = "Corpse Eater";
  132.                 charData.Talent2 = "Ancestral Knowledge";
  133.                 charData.origin = "Sebille";
  134.                 break;
  135.                    
  136.             case "Ifan":
  137.                 charData.Talent1 = "Ingenious";
  138.                 charData.Talent2 = "Thrifty";
  139.                 charData.origin = "Ifan";
  140.                 break;
  141.  
  142.             case "Lohse":
  143.                 charData.Talent1 = "Ingenious";
  144.                 charData.Talent2 = "Thrifty";
  145.                 charData.origin = "Lohse";
  146.                 break;
  147.                
  148.             case "Beast":
  149.                 charData.Talent1 = "Sturdy";
  150.                 charData.Talent2 = "Dwarven Guile";
  151.                 charData.origin = "Beast";
  152.                 break;
  153.  
  154.             case "Fane":
  155.                 charData.Talent1 = "Ingenious";
  156.                 charData.Talent2 = "Undead";
  157.                 charData.origin = "Fane";
  158.                 break;
  159.  
  160.             case "Dwarf":
  161.                 charData.Talent1 = "Sturdy";
  162.                 charData.Talent2 = "Dwarven Guile";
  163.                 charData.origin = "Dwarf";
  164.                 break;
  165.  
  166.             case "Human":
  167.                 charData.Talent1 = "Ingenious";
  168.                 charData.Talent2 = "Thrifty";
  169.                 charData.origin = "Human";
  170.                 break;
  171.                
  172.             case "Elf":
  173.                 charData.Talent1 = "Corpse Eater";
  174.                 charData.Talent2 = "Ancestral Knowledge";
  175.                 charData.origin = "Elf";
  176.                 break;
  177.                
  178.             case "Lizard":
  179.                 charData.Talent1 = "Spellsong";
  180.                 charData.Talent2 = "Sophisticated";
  181.                 charData.origin = "Lizard";
  182.                 break;
  183.  
  184.             case "Undead Dwarf":
  185.                 charData.Talent1 = "Sturdy";
  186.                 charData.Talent2 = "Undead";
  187.                 charData.origin = "Undead Dwarf";
  188.                 break;
  189.  
  190.             case "Undead Human":
  191.                 charData.Talent1 = "Ingenious";
  192.                 charData.Talent2 = "Undead";
  193.                 charData.origin = "Undead Human";
  194.                 break;
  195.  
  196.             case "Undead Elf":
  197.                 charData.Talent1 = "Corpse Eater";
  198.                 charData.Talent2 = "Undead";
  199.                 charData.origin = "Undead Elf";
  200.                 break;
  201.  
  202.             case "Undead Lizard":
  203.                 charData.Talent1 = "Sophisticated";
  204.                 charData.Talent2 = "Undead";
  205.                 charData.origin = "Undead Lizard";
  206.                 break;
  207.  
  208.         }
  209.    
  210.         if(ans == "Y"){
  211.        
  212.             //Select a random preset class
  213.             String preset = getRand(charData.preset_classes);
  214.             switch(preset){
  215.                 case "battlemage":
  216.                     charData.preset = "Battlemage";
  217.                     charData.Talent3 = "Comeback Kid";
  218.                
  219.                     charData.strength++;
  220.                     charData.intelligence++;
  221.                     charData.constitution++;
  222.                     charData.aerothurge++;
  223.                     charData.warfare++;
  224.                     charData.persuasion++;
  225.                
  226.                     charData.skill1 = "Blinding Radiance";
  227.                     charData.skill2 = "Shocking Touch";
  228.                     charData.skill3 = "Battering Ram";
  229.                     break;
  230.                    
  231.                    
  232.                 case "Cleric":
  233.                     charData.preset = "Cleric";
  234.                     charData.Talent3 = "Hothead";
  235.                    
  236.                     charData.strength++;
  237.                     charData.intelligence++;
  238.                     charData.constitution++;
  239.                     charData.hydrosophist++;
  240.                     charData.necromancer++;
  241.                     charData.bartering++;
  242.                    
  243.                     charData.skill1 = "Decaying Touch";
  244.                     charData.skill2 = "Restoration";
  245.                     charData.skill3 = "Blood Sucker";
  246.                     break;
  247.                    
  248.                 case "Conjurer":
  249.                     charData.preset = "Conjurer";
  250.                     charData.Talent3 = "Pet Pal";
  251.                    
  252.                     charData.intelligence++;
  253.                     charData.constitution = charData.constitution+2;
  254.                     charData.summoning++;
  255.                     charData.loremaster++;
  256.                     charData.leadership++;
  257.                    
  258.                     charData.skill1 = "Conjure Incarnate";
  259.                     charData.skill2 = "Dimensional Bolt";
  260.                     charData.skill3 = "Elemental Totem";
  261.                     break;
  262.                    
  263.                    
  264.                 case "Enchanter":
  265.                     charData.preset = "Enchanter";
  266.                     charData.Talent3 = "Far Out Man";
  267.                    
  268.                     charData.intelligence = charData.intelligence+2;
  269.                     charData.constitution++;
  270.                     charData.hydrosophist++;
  271.                     charData.aerothurge++;
  272.                     charData.loremaster++;
  273.                
  274.                     charData.skill1 = "Electric Discharge";
  275.                     charData.skill2 = "Hail Strike";
  276.                     charData.skill3 = "Rain";
  277.                     break;
  278.                    
  279.                 case "Fighter":
  280.                     charData.preset = "Fighter";
  281.                     charData.Talent3 = "Opportunist";
  282.                    
  283.                     charData.strength++;
  284.                     charData.constitution = charData.constitution+2;
  285.                     charData.warfare++;
  286.                     charData.geomancer++;
  287.                     charData.bartering++;
  288.                    
  289.                     charData.skill1 = "Battle Stomp";
  290.                     charData.skill2 = "Bouncing Shield";
  291.                     charData.skill3 = "Fortify";
  292.                     break;
  293.                    
  294.                 case "Inquisitor":
  295.                     charData.preset = "Inquisitor";
  296.                     charData.Talent3 = "Executioner";
  297.  
  298.                     charData.strength++;
  299.                     charData.intelligence++;
  300.                     charData.constitution++;
  301.                     charData.warfare++;
  302.                     charData.necromancer++;
  303.                     charData.telekinesis++;
  304.                    
  305.                     charData.skill1 = "Blood Sucker";
  306.                     charData.skill2 = "Battering Ram";
  307.                     charData.skill3 = "Mosquito Swarm";
  308.                     break;
  309.                    
  310.                 case "Knight":
  311.                     charData.preset = "Knight";
  312.                     charData.Talent3 = "Opportunist";
  313.  
  314.                     charData.strength = charData.strength + 2;
  315.                     charData.constitution++;
  316.                     charData.warfare++;
  317.                     charData.two_handed++;
  318.                     charData.bartering++;
  319.  
  320.                     charData.skill1 = "Battering Ram";
  321.                     charData.skill2 = "Crippling Blow";
  322.                     charData.skill3 = "Battle Stomp";
  323.                     break;
  324.                    
  325.                 case "Metamorph":
  326.                     charData.preset = "Metamorph";
  327.                     charData.Talent3 = "Opportunist";
  328.  
  329.                     charData.strength = charData.strength + 2;
  330.                     charData.two_handed++;
  331.                     charData.polymorph++;
  332.                     charData.persuasion++;
  333.                    
  334.                     charData.skill1 = "Tentacle Lash";
  335.                     charData.skill2 = "Chiclen Claw";
  336.                     charData.skill3 = "Bull Horns";
  337.                     break;
  338.                    
  339.                 case "Ranger":
  340.                     charData.preset = "Ranger";
  341.                     charData.Talent3 = "Arrow Recovery";
  342.  
  343.                     charData.finesse = charData.finesse + 2;
  344.                     charData.wits++;
  345.                     charData.huntsman++;
  346.                     charData.pyrokinetic++;
  347.                     charData.lucky_charm++;
  348.  
  349.                     charData.skill1 = "Richochet";
  350.                     charData.skill2 = "Peace of Mind";
  351.                     charData.skill3 = "Elemental Arrowheads";
  352.                     break;
  353.  
  354.                 case "Rogue":
  355.                     charData.preset = "Rogue";
  356.                     charData.Talent3 = "The Pawn";
  357.  
  358.                     charData.finesse = charData.finesse + 2;
  359.                     charData.constitution++;
  360.                     charData.scoundrel++;
  361.                     charData.sneaking++;
  362.                     charData.dual_wielding++;
  363.  
  364.                     charData.skill1 = "Throwing Knife";
  365.                     charData.skill2 = "Backlash";
  366.                     charData.skill3 = "Adrenaline";
  367.                     break;
  368.                    
  369.                 case "Shadowblade":
  370.                     charData.preset = "Shadowblade";
  371.                     charData.Talent3 = "Guerilla";
  372.  
  373.                     charData.finesse = charData.finesse + 2;
  374.                     charData.wits = charData.wits + 2;
  375.                     charData.scoundrel++;
  376.                     charData.polymorph++;
  377.                     charData.thievery++;
  378.  
  379.                     charData.skill1 = "Chameleon Cloak";
  380.                     charData.skill2 = "Backlash";
  381.                     charData.skill3 = "Chicken Claw";
  382.                     break;
  383.                    
  384.                 case "Wayfarer":
  385.                     charData.preset = "Wayfarer";
  386.                     charData.Talent3 = "Pet Pal";
  387.                    
  388.                     charData.finesse = charData.finesse + 2;
  389.                     charData.intelligence++;
  390.                     charData.huntsman++;
  391.                     charData.geomancer++;
  392.                     charData.bartering++;
  393.  
  394.                     charData.skill1 = "Pin Down";
  395.                     charData.skill2 = "Fossil Strike";
  396.                     charData.skill3 = "Elemental Arrowheads";
  397.                     break;
  398.  
  399.                 case "Witch":
  400.                     charData.preset = "Witch";
  401.                     charData.Talent3 = "Leech";
  402.                    
  403.                     charData.finesse++;
  404.                     charData.intelligence++;
  405.                     charData.constitution++;
  406.                     charData.scoundrel++;
  407.                     charData.necromancer++;
  408.                     charData.persuasion++;
  409.  
  410.                     charData.skill1 = "Raise Bloated Corpse";
  411.                     charData.skill2 = "Chloroform";
  412.                     charData.skill3 = "Mosquito Swarm";
  413.                     break;
  414.                    
  415.                 case "Wizard":
  416.                     charData.preset = "Wizard";
  417.                     charData.Talent3 = "Far Out Man";
  418.                    
  419.                     charData.intelligence = charData.intelligence + 2;
  420.                     charData.constitution++;
  421.                     charData.pyrokinetic++;
  422.                     charData.loremaster++;
  423.  
  424.                     charData.skill1 = "Searing Daggers";
  425.                     charData.skill2 = "Fossil Strike";
  426.                     charData.skill3 = "Ignition";
  427.                     break;
  428.             }
  429.  
  430.         }
  431.  
  432.         else if(ans == "N"){
  433.             for(int i = 0; i < 3; i++){
  434.                 String attribute = getRand(charData.attributes);
  435.                 switch (attribute){
  436.                        
  437.                     case "strength":
  438.                         charData.strength++;
  439.                         break;
  440.                    
  441.                
  442.                     case "finesse":
  443.                         charData.finesse++;
  444.                         break;
  445.                
  446.                     case "intelligence":
  447.                         charData.intelligence++;
  448.                         break;
  449.                    
  450.                     case "constitution":
  451.                         charData.constitution++;
  452.                         break;
  453.                    
  454.                     case "memory":
  455.                         charData.memory++;
  456.                         break;
  457.                    
  458.                     case "wits":
  459.                         charData.wits++;
  460.                         break;
  461.                    
  462.                 }
  463.             }
  464.  
  465.             for(int i = 0; i < 2; i++){
  466.                 String ability = getRand(charData.combat_abilities);
  467.                 System.out.println(ability);
  468.                 switch(ability){
  469.                     case "Warfare":
  470.                         charData.warfare++;
  471.                         break;
  472.  
  473.                     case "Huntsman":
  474.                         charData.huntsman++;
  475.                         break;
  476.  
  477.                     case "Scoundrel":
  478.                         charData.scoundrel++;
  479.                         break;
  480.  
  481.                     case "Pyrokinetic":
  482.                         charData.pyrokinetic++;
  483.                         break;
  484.  
  485.                     case "Hydrosophist":
  486.                         charData.hydrosophist++;
  487.                         break;
  488.  
  489.                     case "Aerothurge":
  490.                         charData.aerothurge++;
  491.                         break;
  492.  
  493.                     case "Geomancer":
  494.                         charData.geomancer++;
  495.                         break;
  496.  
  497.                     case "Necromancer":
  498.                         charData.necromancer++;
  499.                         break;
  500.  
  501.                     case "Summoning":
  502.                         charData.summoning++;
  503.                         break;
  504.  
  505.                     case "Polymorph":
  506.                         charData.polymorph++;
  507.                         break;
  508.  
  509.                 }
  510.             }
  511.  
  512.             String civil = getRand(charData.civil_abilities);
  513.             String output = civil.substring(0,1).toLowerCase() + civil.substring(1);
  514.            
  515.             switch(output){
  516.                 case "bartering":
  517.                     charData.bartering++;
  518.                     break;
  519.                
  520.                 case "lucky_charm":
  521.                     charData.lucky_charm++;
  522.                     break;
  523.                
  524.                 case "persuasion":
  525.                     charData.persuasion++;
  526.                     break;
  527.                
  528.                 case "loremaster":
  529.                     charData.loremaster++;
  530.                     break;
  531.                
  532.                 case "telekinesis":
  533.                     charData.telekinesis++;
  534.                     break;
  535.                
  536.                 case "sneaking":
  537.                     charData.sneaking++;
  538.                     break;
  539.                
  540.                 case "thievery":
  541.                     charData.thievery++;
  542.                     break;
  543.             }
  544.            
  545.             //System.out.println(charData.output);
  546.  
  547.            
  548.             charData.tag1 = getRand(charData.tags);
  549.             charData.tags = removeElement(charData.tags, charData.tag1);
  550.             charData.tag2 = getRand(charData.tags);
  551.            
  552.  
  553.             //TODO: check that the talents don't conflict
  554.          
  555.        
  556.            
  557.             String cont = "false";
  558.            
  559.             while(cont == "false"){
  560.               String talent = getRand(charData.talents);
  561.               if(talent == "Demon"){
  562.                 if(charData.pyrokinetic >=1){
  563.                   cont = "true";
  564.                 }
  565.               }
  566.               if(talent == "Duck Duck Goose"){
  567.                 if(charData.huntsman >=1)
  568.                   cont = "true";
  569.               }
  570.               if(talent == "Elemental Ranger"){
  571.                 if(charData.huntsman >=1)
  572.                   cont = "true";
  573.               }
  574.               if(talent == "Executioner"){
  575.                 if(charData.warfare >=1)
  576.                   cont = "true";
  577.               }
  578.               if(talent == "Guerilla"){
  579.                 if(charData.sneaking >=1)
  580.                   cont = "true";
  581.               }
  582.               if(talent == "Ice King"){
  583.                 if(charData.hydrosophist >=1)
  584.                   cont = "true";
  585.               }
  586.               if(talent == "Picture of Health"){
  587.                 if(charData.warfare >=1)
  588.                   cont = "true";
  589.               }
  590.               if(talent == "The Pawn"){
  591.                 if(charData.scoundrel >=1)
  592.                   cont = "true";
  593.               }
  594.              
  595.               charData.Talent3 = talent;
  596.             }
  597.         }
  598.  
  599.         //TODO: print out the results
  600.         System.out.println("Here is your randomized character:");
  601.         System.out.println("Origin: " + charData.origin);
  602.         if(ans == "Y"){
  603.             System.out.println("Class: " + charData.preset);
  604.         }  
  605.         System.out.println("Talents: " + charData.Talent1 + ", " + charData.Talent2 + ", " + charData.Talent3 );
  606.         System.out.println("Tags " + charData.tag1 + ", " + charData.tag2 );
  607.         System.out.println("Stats:");
  608.         System.out.println();
  609.         System.out.println("Warfare: " + charData.warfare);
  610.         System.out.println("Huntsman: " + charData.huntsman);
  611.         System.out.println("Scoundrel: " + charData.scoundrel);
  612.         System.out.println("Pyrokinetic: " + charData.pyrokinetic);
  613.         System.out.println("Hydrosophist: " + charData.hydrosophist);
  614.         System.out.println("Aerothurge: " + charData.aerothurge);
  615.         System.out.println("Geomancer: " + charData.geomancer);
  616.         System.out.println("Necromancer " + charData.necromancer);
  617.         System.out.println("Summoning: " + charData.summoning);
  618.         System.out.println("Polymorph " + charData.polymorph);
  619.     }
  620.    
  621.     public static String[] removeElement(String[] array, String remove){
  622.         for(int i = 0; i < array.length; i++){
  623.             if(array[i] == remove){
  624.                 for(int j = i; j < array.length-1; j++){
  625.                     array[j] = array[j+1];
  626.                 }
  627.             }
  628.         }
  629.         return array;
  630.     }
  631.  
  632.  
  633.     public static String getRand(String[] myArray){
  634.        int rand = ThreadLocalRandom.current().nextInt(0, myArray.length);
  635.        return myArray[rand];
  636.     }
  637.  
  638. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement