Skip to content

API documentation

Jaeyoung edited this page Oct 6, 2020 · 5 revisions

Documentation

This is documentation of fields and method in our program. BE CAREFUL ABOUT STATIC AND NON-STATIC FIELD AND METHOD.

Methods

waitingTime(int t)

public static void waitingTime(int t)

Description

makes the Program stops for a while for amount t. t = 1000 is 1 second.

Return

Returns nothing


randomNum(int a, int b)

public static int randomNum(int a, int b)

Description

returns a random number greater than equal to a and less than equal to b thus inclusive.

Return

Returns int x that a ≤ x ≤ b


percentProb(int a)

public static boolean percentProb(int a)

Description

input a% and results in true or false based on the probability. If true, within the probability. If false, outside the probability.

Return

Returns boolean type : true or false


scanChar()

public static char scanChar()

Description

scanning a character typed from keyboard

Return

Returns char type


scanString()

public static String scanString()

Description

scanning a String value from keyboard

Return

Returns String type


scanInt()

public static int scanInt()

Description

scanning a int value from keyboard

Return

Returns int type


stop()

public static void stop()

Description

just Program needed for scanner. NOT ACTUALLY USED

Return

Returns nothing


Fields

static String name; //Character name

static String classType; //Character class

static int lv; //level

static int age; // age

static int str; //strength

static int wis; //wisdom

static int agi; //agility

static int hpMax; //maximum HP

static int hpNow; //current HP

static int mpMax; //maximum MP

static int mpNow; //current MP

static int coin; //money

static int currentPart; //current part in the story

static String currentState; //tells what the character is doing idle, fighting, shopping, etc.

Methods

makeStats(multiple parameters)

public static void makeStats(String nameChoice, String classTypeChoice, int lvChoice, int ageChoice, int strChoice, int wisChoice, int agiChoice, int hpMaxChoice, int hpNowChoice, int mpMaxChoice, int mpNowChoice, int atkChoice, int coinChoice)

Description

declaring field, creating a character

Return

returns nothing


statPage()

public static void statPage()

Description

printing out stats of the character

Return

Nothing


healHP(int healAmount)

public static void healHP(int healAmount)

Description

healing HP using a potion, skill, etc. Int heal amount is needed and it will heal the character in that amount. If the healing amount is above the healing amount, the current hp will be set to max.

Return

nothing


healMP(int healAmount)

public static void healHP(int healAmount)

Description

healing MP using a potion, skill, etc. Int heal amount is needed and it will heal the character in that amount. If the healing amount is above the healing amount, the current mp will be set to max.

Return

nothing


normalAttackDamageCounter()

public static int normalAttackDamageCounter()

Description

counts damage/attack amount of the character and returns the amount of damage

Return

int


Fields

public static ArrayList<ArrayList<String>> weapon = new ArrayList<ArrayList<String>>(); //arraylist that stores weapons

public static ArrayList<ArrayList<String>> potion = new ArrayList<ArrayList<String>>(); //arraylist that stores potions

public static ArrayList<ArrayList<String>> otherItem = new ArrayList<ArrayList<String>>(); //arraylist that stores items

constants for weapon's array order

public static final int WEAPONID = 0;

public static final int WEAPONNAME = 1;

public static final int WEAPONTYPE = 2;

public static final int WEAPONDAMAGE = 3;

public static final int WEAPONCURRENTDURABILITY = 4;

public static final int WEAPONDURABILITY = 5;

public static final int WEAPONSPECIAL = 6;

public static final int WEAPONSPECIALTYPE = 7;

public static final int WEAPONDESCRIPTION = 8;

public static final int WEAPONSTATE = 9;

constants for potion's array order

public static final int POTIONID = 0;

public static final int POTIONNAME = 1;

public static final int POTIONTYPE = 2;

public static final int POTIONDHP = 3;

public static final int POTIONMP = 4;

public static final int POTIONDESCRIPTION = 5;

public static final int POTIONQUANTITY = 6;

constants for item's array order

public static final int OTHERITEMID = 0;

public static final int OTHERITEMNAME = 1;

public static final int OTHERITEMTYPE = 2;

public static final int OTHERITEMQUANTITY = 3;

public static int currentEquipedWeapon = -1;//int value that shows what number(item ID) of Weapon is equiped. -1 if not equipped

Methods

setInventoryItem (int itemID, int quantity)

public static void setInventoryItem (int itemID, int quantity)

Description

add certain amount of item with certain quantity. Potions are stackable. Just type in the ID and number of item

Return

Nothing


haveItem(int ID)

public static boolean haveItem(int ID)

Description

Search for inventory if the user has item with specific item ID. Returns true if present, false if not present

Return

boolean


haveItemNum(int ID)

public static int haveItemNum(int ID)

Description

solely used only for potion and stackable item so item from ID 3000 and above. Returns the number of position of the item where it is present. Returns -1 if not present

Return

int


showInventory()

public static void showInventory()

Description

Text UI for inventory. RECOMMEND USING THIS FOR UI FOR INVENTORY.

Return

Nothing


getWeapons()

public static void getWeapons()

Description

UI for displaying weapons

Return

nothing


getPotions()

public static void getPotions()

Description

UI for displaying potions

Return

Nothing


getOtherItem()

public static void getOtherItem()

Description

UI for displaying other items

Return

Nothing


printSpecificWeapon(int inventoryItemID)

public static void printSpecificWeapon(int inventoryItemID)

Description

print specific weapon detail based on the order number in arraylist

Return

nothing


printSpecificPotion(int inventoryItemID)

public static void printSpecificPotion(int inventoryItemID)

Description

print specific potion detail based on the order number in arraylist

Return

nothing


printSpecificOtherItem(int inventoryItemID)

public static void printSpecificOtherItem(int inventoryItemID)

Description

print specific item detail based on the order number in arraylist

Return

Nothing


updateEquiped()

public static void updateEquiped()

Description

check which number(position) of weapon is equiped. Returns -1 if not equiped.

Return

Nothing


equipItem(int itemEquipNum, int itemType)

public static void equipItem(int itemEquipNum, int itemType)

Description

equips item in position itemEquipNum. itemType: 1= weapon, 2=armor

Return

Nothing


usePotion()

public static void usePotion()

Description

UI for using potion. RECOMMEND USING

Return

Nothing


getWeaponName(int inventoryItemID)

public static String getWeaponName(int inventoryItemID)

Description

get name of the potion. If invetoryItemID is -1, returns "null"

Return

String


setWeaponName(int inventoryItemID, String changedName)

public static void setWeaponName(int inventoryItemID, String changedName)

Description

sets name of the weapon of ID into changedName. If invetoryItemID is -1 nothing happens

Return

Nothing


getWeaponDamage(int inventoryItemID)

public static int getWeaponDamage(int inventoryItemID)

Description

returns the damage of weapon with specified ID

Return

int


setWeaponDamage(int inventoryItemID, int changedDamage)

public static void setWeaponDamage(int inventoryItemID, int changedDamage)

Description

set the weapon damage into changedDamage

Return

nothing


getWeaponCurrentDurability(int inventoryItemID)

public static int getWeaponCurrentDurability(int inventoryItemID)

Description

gets current durabiltiy of the weapon

Return

int


Description
Return

Description
Return

Description
Return

Description
Return

Description
Return

Description
Return

Description
Return

Description
Return

Description
Return
Clone this wiki locally