Search in sources :

Example 21 with Character

use of io.github.spugn.Sargo.Objects.Character in project S-argo by Expugn.

the class RecordCrystalv4 method randGoldCharacter.

@Override
protected Character randGoldCharacter() {
    int randIndex = GOLD_BANNERS_V2.get(RNG.nextInt(GOLD_BANNERS_V2.size()));
    Banner randBanner = BANNERS.get(randIndex - 1);
    List<Character> randCharacters = randBanner.getCharacters();
    return randCharacters.get(RNG.nextInt(randCharacters.size()));
}
Also used : Character(io.github.spugn.Sargo.Objects.Character) Banner(io.github.spugn.Sargo.Objects.Banner)

Example 22 with Character

use of io.github.spugn.Sargo.Objects.Character in project S-argo by Expugn.

the class StepUp method randGoldCharacter.

@Override
protected Character randGoldCharacter() {
    int randIndex = GOLD_BANNERS.get(RNG.nextInt(GOLD_BANNERS.size()));
    Banner randBanner = BANNERS.get(randIndex - 1);
    List<Character> randCharacters = randBanner.getCharacters();
    return randCharacters.get(RNG.nextInt(randCharacters.size()));
}
Also used : Character(io.github.spugn.Sargo.Objects.Character) Banner(io.github.spugn.Sargo.Objects.Banner)

Example 23 with Character

use of io.github.spugn.Sargo.Objects.Character in project S-argo by Expugn.

the class CharacterScout method generateImageStrings.

/**
 * Same function as {@link #generateImageString()} but for eleven characters.
 * @see #generateImageString()
 */
private void generateImageStrings() {
    boolean foundDuplicate = false;
    for (int i = 0; i < 11; i++) {
        if (!USER.getCharacterBox().isEmpty()) {
            for (Character userCharacter : USER.getCharacterBox()) {
                if (userCharacter.getPrefix().equals(characters.get(i).getPrefix()) && userCharacter.getRarity() == characters.get(i).getRarity() && userCharacter.getName().equals(characters.get(i).getName())) {
                    foundDuplicate = true;
                    giveHackingCrystals(characters.get(i));
                    characterString += "~~" + characters.get(i).toString() + "~~" + "\n";
                    if (generateImage && !IMAGE_DISABLED)
                        new ImageEditor().drawCharacterImage(characters.get(i).getImagePath(), characters.get(i).getRarity(), true, IS_RARITY_STARS, tempUserDirectory + "/temp_" + i + ".png");
                }
            }
            if (!foundDuplicate) {
                USER.addCharacter(characters.get(i));
                characterString += "**" + characters.get(i).toString() + "**\n";
                if (generateImage && !IMAGE_DISABLED)
                    new ImageEditor().drawCharacterImage(characters.get(i).getImagePath(), characters.get(i).getRarity(), false, IS_RARITY_STARS, tempUserDirectory + "/temp_" + i + ".png");
            }
            foundDuplicate = false;
        } else {
            USER.addCharacter(characters.get(i));
            characterString += "**" + characters.get(i).toString() + "**\n";
            if (generateImage && !IMAGE_DISABLED)
                new ImageEditor().drawCharacterImage(characters.get(i).getImagePath(), characters.get(i).getRarity(), false, IS_RARITY_STARS, tempUserDirectory + "/temp_" + i + ".png");
        }
        imageStrings[i] = tempUserDirectory + "/temp_" + i + ".png";
    }
}
Also used : ImageEditor(io.github.spugn.Sargo.Utilities.ImageEditor) Character(io.github.spugn.Sargo.Objects.Character)

Example 24 with Character

use of io.github.spugn.Sargo.Objects.Character in project S-argo by Expugn.

the class CharacterScout method getCharacter.

/**
 * Determines which character is added to the user's collection
 * depending on the rarity value given.
 *
 * @param rarity  The rarity value of the character.
 * @return  A new {@link Character} from the banner or from
 *          the collection of copper or silver characters.
 */
private Character getCharacter(int rarity) {
    Character character;
    if (rarity == 2) {
        CopperCharacter cC = new CopperCharacter();
        character = cC.getCharacter(RNG.nextInt(cC.getSize()));
    } else if (rarity == 3) {
        SilverCharacter sC = new SilverCharacter();
        character = sC.getCharacter(RNG.nextInt(sC.getSize()));
    } else if (rarity == 4) {
        if (guaranteedScout) {
            double d = RNG.nextDouble();
            if (d < 0.6) {
                character = goldCharacters.get(RNG.nextInt(goldCharacters.size()));
            } else {
                character = randGoldCharacter();
            }
        } else {
            if (goldCharacters.size() > 0) {
                character = goldCharacters.get(RNG.nextInt(goldCharacters.size()));
            } else {
                character = randGoldCharacter();
            }
        }
    } else {
        if (guaranteedScout) {
            double d = RNG.nextDouble();
            if (d < 0.6) {
                character = platinumCharacters.get(RNG.nextInt(platinumCharacters.size()));
            } else {
                character = randGoldCharacter();
            }
        } else {
            character = platinumCharacters.get(RNG.nextInt(platinumCharacters.size()));
        }
    }
    return character;
}
Also used : Character(io.github.spugn.Sargo.Objects.Character)

Example 25 with Character

use of io.github.spugn.Sargo.Objects.Character in project S-argo by Expugn.

the class Event method randGoldCharacter.

@Override
protected Character randGoldCharacter() {
    int randIndex = GOLD_BANNERS.get(RNG.nextInt(GOLD_BANNERS.size()));
    Banner randBanner = BANNERS.get(randIndex - 1);
    List<Character> randCharacters = randBanner.getCharacters();
    return randCharacters.get(RNG.nextInt(randCharacters.size()));
}
Also used : Character(io.github.spugn.Sargo.Objects.Character) Banner(io.github.spugn.Sargo.Objects.Banner)

Aggregations

Character (io.github.spugn.Sargo.Objects.Character)25 Banner (io.github.spugn.Sargo.Objects.Banner)13 ImageEditor (io.github.spugn.Sargo.Utilities.ImageEditor)3 Weapon (io.github.spugn.Sargo.Objects.Weapon)2 UserParser (io.github.spugn.Sargo.XMLParsers.UserParser)2 FailedToReadBannerFileException (io.github.spugn.Sargo.Exceptions.FailedToReadBannerFileException)1 GitHubImage (io.github.spugn.Sargo.Utilities.GitHubImage)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 DecimalFormat (java.text.DecimalFormat)1 Random (java.util.Random)1 XMLEventReader (javax.xml.stream.XMLEventReader)1 XMLInputFactory (javax.xml.stream.XMLInputFactory)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 Attribute (javax.xml.stream.events.Attribute)1 EndElement (javax.xml.stream.events.EndElement)1 StartElement (javax.xml.stream.events.StartElement)1