Wednesday, September 30, 2009

Item.java

import java.util.ArrayList;
enum type {KEY, ARMOR, WEAPON, POTION}
enum armor_type {RING, NECKLACE, MEDDALION, AMULET, GLOVES, LEGGINGS, BODYARMOR}
enum armor_str {NULL, WEAK, OK, DECENT, MEDIUM, GOOD, STRONG}
enum wep_type {DAGGER, CLUB, SWORD, AXE, WARHAMMER, BATTLEAXE}
enum wep_str {NULL, WEAK, OK, DECENT, MEDIUM, GOOD, STRONG}
enum potion_type {NULL, ACID, POISON, HEALTH}
enum potion_str {NULL, WEAK, MEDIUM, STRONG}
enum key_doors {}
public class Item
{

public Item(String n, String d)
{
types.add("key");
types.add("armor");
types.add("weapon");
types.add("potion");
armor_types.add("ring");
armor_types.add("necklace");
armor_types.add("maddalion");
armor_types.add("amulet");
armor_types.add("leggings");
armor_types.add("body armor");
armor_strs.add("zero");
armor_strs.add("weak");
armor_strs.add("ok");
armor_strs.add("decent");
armor_strs.add("medium");
armor_strs.add("good");
armor_strs.add("strong");
weapon_types.add("dagger");
weapon_types.add("club");
weapon_types.add("sword");
weapon_types.add("axe");
weapon_types.add("war hammer");
weapon_types.add("battle axe");
weapon_strs.add("zero");
weapon_strs.add("weak");
weapon_strs.add("ok");
weapon_strs.add("decent");
weapon_strs.add("medium");
weapon_strs.add("good");
weapon_strs.add("strong");
potion_types.add("empty");
potion_types.add("acid");
potion_types.add("poison");
potion_types.add("health");
potion_strs.add("zero");
potion_strs.add("weak");
potion_strs.add("medium");
potion_strs.add("strong");
name = n;
description = d;
}


public type getItemType() {
return itemType;
}


public void setItemType(type itemType) {
this.itemType = itemType;
}


public armor_type getArmorType() {
return armorType;
}


public void setArmorType(armor_type armorType) {
this.armorType = armorType;
}


public armor_str getArmorStr() {
return armorStr;
}


public void setArmorStr(armor_str armorStr) {
this.armorStr = armorStr;
}


public wep_type getWepType() {
return wepType;
}


public void setWepType(wep_type wepType) {
this.wepType = wepType;
}


public wep_str getWepStr() {
return wepStr;
}


public void setWepStr(wep_str wepStr) {
this.wepStr = wepStr;
}


public String getName() {
return name;
}


public String name = "";
public String description = "There is nothing special about this item.";
private type itemType;
private armor_type armorType;
private armor_str armorStr;
private wep_type wepType;
private potion_type potionType;
private potion_str potionStr;
private key_doors location;
private wep_str wepStr;
private int wepDam;
private int armorProtec;
private int potionPow;
public ArrayList types = new ArrayList();
public ArrayList armor_types = new ArrayList();
public ArrayList armor_strs = new ArrayList();
public ArrayList weapon_types = new ArrayList();
public ArrayList weapon_strs = new ArrayList();
public ArrayList potion_types = new ArrayList();
public ArrayList potion_strs = new ArrayList();
public ArrayList doors = new ArrayList();
public boolean canPickup = true;
public ArrayList get_type()
{
ArrayList outTypeInfo = new ArrayList();
outTypeInfo.add(itemType);
switch(itemType)
{
case KEY:
{
outTypeInfo.add(location);
}
case ARMOR:
{
outTypeInfo.add(armorType);
}
case WEAPON:
{
outTypeInfo.add(wepType);
}
case POTION:
{
outTypeInfo.add(potionType);
}
}
return outTypeInfo;
}
public void calc_wepInfo()
{
switch(wepType)
{
case DAGGER:
{
int start = 1;
int variation = 0;
variation = (int) ( (( (Math.random()*(start*7)) + (Math.random()*(start*7)) )/2) - (int)(Math.random()*3) );
switch(wepStr)
{
case NULL:
{
start *= 0;
}
case WEAK:
{
start *= 1;
}
case OK:
{
start *= 2;
}
case DECENT:
{
start *= 3;
}
case MEDIUM:
{
start *= 4;
}
case GOOD:
{
start *= 5;
}
case STRONG:
{
start *= 6;
}
}
wepDam = start - variation;
}
case CLUB:
{
int start = 2;
int variation = 0;
variation = (int) ( (( (Math.random()*(start*7)) + (Math.random()*(start*7)) )/2) - (int)(Math.random()*3) );
switch(wepStr)
{
case NULL:
{
start *= 0;
}
case WEAK:
{
start *= 1;
}
case OK:
{
start *= 2;
}
case DECENT:
{
start *= 3;
}
case MEDIUM:
{
start *= 4;
}
case GOOD:
{
start *= 5;
}
case STRONG:
{
start *= 6;
}
}
wepDam = start - variation;
}
case SWORD:
{
int start = 4;
int variation = 0;
variation = (int) ( (( (Math.random()*(start*7)) + (Math.random()*(start*7)) )/2) - (int)(Math.random()*3) );
switch(wepStr)
{
case NULL:
{
start *= 0;
}
case WEAK:
{
start *= 1;
}
case OK:
{
start *= 2;
}
case DECENT:
{
start *= 3;
}
case MEDIUM:
{
start *= 4;
}
case GOOD:
{
start *= 5;
}
case STRONG:
{
start *= 6;
}
}
wepDam = start - variation;
}
case AXE:
{
int start = 3;
int variation = 0;
variation = (int) ( (( (Math.random()*(start*7)) + (Math.random()*(start*7)) )/2) - (int)(Math.random()*3) );
switch(wepStr)
{
case NULL:
{
start *= 0;
}
case WEAK:
{
start *= 1;
}
case OK:
{
start *= 2;
}
case DECENT:
{
start *= 3;
}
case MEDIUM:
{
start *= 4;
}
case GOOD:
{
start *= 5;
}
case STRONG:
{
start *= 6;
}
}
wepDam = start - variation;
}
case WARHAMMER:
{
int start = 5;
int variation = 0;
variation = (int) ( (( (Math.random()*(start*7)) + (Math.random()*(start*7)) )/2) - (int)(Math.random()*3) );
switch(wepStr)
{
case NULL:
{
start *= 0;
}
case WEAK:
{
start *= 1;
}
case OK:
{
start *= 2;
}
case DECENT:
{
start *= 3;
}
case MEDIUM:
{
start *= 4;
}
case GOOD:
{
start *= 5;
}
case STRONG:
{
start *= 6;
}
}
wepDam = start - variation;
}
case BATTLEAXE:
{
int start = 5;
int variation = 0;
variation = (int) ( (( (Math.random()*(start*7)) + (Math.random()*(start*7)) )/2) - (int)(Math.random()*3) );
switch(wepStr)
{
case NULL:
{
start *= 0;
}
case WEAK:
{
start *= 1;
}
case OK:
{
start *= 2;
}
case DECENT:
{
start *= 3;
}
case MEDIUM:
{
start *= 4;
}
case GOOD:
{
start *= 5;
}
case STRONG:
{
start *= 6;
}
}
wepDam = start - variation;
}
}
if(wepDam < 0)
{
wepDam = 0;
}
}
public void calc_armorInfo()
{
switch(armorType)
{
case RING:
{
int start = 1;
int variation = 0;
variation = (int) ( (( (Math.random()*(start*7)) + (Math.random()*(start*7)) )/2) - (int)(Math.random()*3) );
switch(armorStr)
{
case NULL:
{
start *= 0;
}
case WEAK:
{
start *= 1;
}
case OK:
{
start *= 2;
}
case DECENT:
{
start *= 3;
}
case MEDIUM:
{
start *= 4;
}
case GOOD:
{
start *= 5;
}
case STRONG:
{
start *= 6;
}
}
armorProtec = start - variation;
}
case NECKLACE:
{
int start = 2;
int variation = 0;
variation = (int) ( (( (Math.random()*(start*7)) + (Math.random()*(start*7)) )/2) - (int)(Math.random()*3) );
switch(armorStr)
{
case NULL:
{
start *= 0;
}
case WEAK:
{
start *= 1;
}
case OK:
{
start *= 2;
}
case DECENT:
{
start *= 3;
}
case MEDIUM:
{
start *= 4;
}
case GOOD:
{
start *= 5;
}
case STRONG:
{
start *= 6;
}
}
armorProtec = start - variation;
}
case MEDDALION:
{
int start = 2;
int variation = 0;
variation = (int) ( (( (Math.random()*(start*7)) + (Math.random()*(start*7)) )/2) - (int)(Math.random()*3) );
switch(armorStr)
{
case NULL:
{
start *= 0;
}
case WEAK:
{
start *= 1;
}
case OK:
{
start *= 2;
}
case DECENT:
{
start *= 3;
}
case MEDIUM:
{
start *= 4;
}
case GOOD:
{
start *= 5;
}
case STRONG:
{
start *= 6;
}
}
armorProtec = start - variation;
}
case AMULET:
{
int start = 2;
int variation = 0;
variation = (int) ( (( (Math.random()*(start*7)) + (Math.random()*(start*7)) )/2) - (int)(Math.random()*3) );
switch(armorStr)
{
case NULL:
{
start *= 0;
}
case WEAK:
{
start *= 1;
}
case OK:
{
start *= 2;
}
case DECENT:
{
start *= 3;
}
case MEDIUM:
{
start *= 4;
}
case GOOD:
{
start *= 5;
}
case STRONG:
{
start *= 6;
}
}
armorProtec = start - variation;
}
case GLOVES:
{
int start = 3;
int variation = 0;
variation = (int) ( (( (Math.random()*(start*7)) + (Math.random()*(start*7)) )/2) - (int)(Math.random()*3) );
switch(armorStr)
{
case NULL:
{
start *= 0;
}
case WEAK:
{
start *= 1;
}
case OK:
{
start *= 2;
}
case DECENT:
{
start *= 3;
}
case MEDIUM:
{
start *= 4;
}
case GOOD:
{
start *= 5;
}
case STRONG:
{
start *= 6;
}
}
armorProtec = start - variation;
}
case LEGGINGS:
{
int start = 4;
int variation = 0;
variation = (int) ( (( (Math.random()*(start*7)) + (Math.random()*(start*7)) )/2) - (int)(Math.random()*3) );
switch(armorStr)
{
case NULL:
{
start *= 0;
}
case WEAK:
{
start *= 1;
}
case OK:
{
start *= 2;
}
case DECENT:
{
start *= 3;
}
case MEDIUM:
{
start *= 4;
}
case GOOD:
{
start *= 5;
}
case STRONG:
{
start *= 6;
}
}
armorProtec = start - variation;
}
case BODYARMOR:
{
int start = 5;
int variation = 0;
variation = (int) ( (( (Math.random()*(start*7)) + (Math.random()*(start*7)) )/2) - (int)(Math.random()*3) );
switch(armorStr)
{
case NULL:
{
start *= 0;
}
case WEAK:
{
start *= 1;
}
case OK:
{
start *= 2;
}
case DECENT:
{
start *= 3;
}
case MEDIUM:
{
start *= 4;
}
case GOOD:
{
start *= 5;
}
case STRONG:
{
start *= 6;
}
}
armorProtec = start - variation;
}
}
if(armorProtec < 0)
{
armorProtec = 0;
}
}
public void calc_potionInfo()
{
switch(potionType)
{
case NULL:
{
potionPow = 0;
}
case ACID:
{
int start = 3;
int variation = 0;
variation = (int) ( (( (Math.random()*(start*5)) + (Math.random()*(start*5)) )/2) - (int)(Math.random()*3) );
switch(potionStr)
{
case NULL:
{
potionPow = 0;
}
case WEAK:
{
start*=2;
}
case MEDIUM:
{
start*=5;
}
case STRONG:
{
start*=10;
}
}
potionPow = start - variation;
}
case POISON:
{
int start = 3;
int variation = 0;
variation = (int) ( (( (Math.random()*(start*5)) + (Math.random()*(start*5)) )/2) - (int)(Math.random()*3) );
switch(potionStr)
{
case NULL:
{
potionPow = 0;
}
case WEAK:
{
start*=2;
}
case MEDIUM:
{
start*=5;
}
case STRONG:
{
start*=10;
}
}
potionPow = start - variation;
}
case HEALTH:
{
int start = 1;
int variation = 0;
variation = (int) ( (( (Math.random()*(start*5)) + (Math.random()*(start*5)) )/2) - (int)(Math.random()*3) );
switch(potionStr)
{
case NULL:
{
potionPow = 0;
}
case WEAK:
{
start*=2;
}
case MEDIUM:
{
start*=5;
}
case STRONG:
{
start*=10;
}
}
potionPow = start - variation;
}
}
}
}

No comments:

Post a Comment