public void randomEquipment(int lvCap, gameChar ownedChar) //random setter with known lv and owner { eqName = "random equipment"; description = "random equipment"; eqtype = (eqType)(Random.Range(0, gameChar.wearingNum)); owner = ownedChar; lv = lvCap; int randNum = Random.Range(0, 100); // rand a number and distribute percentage if (randNum < 20) { rank = 1; } else if (randNum < 60) { rank = 2; } else if (randNum < 90) { rank = 3; } else { rank = 4; } for (int i = 0; i < rank; i++) { attribute attr = (attribute)(Random.Range(0, 5f)); float attrVal = (Random.Range(1, 10) * lv); attributePair[i] = new Pair <attribute, float>(attr, attrVal); } }
public equipment(eqType equipType) { eqtype = equipType; eqName = ""; description = ""; lv = 1; rank = 1; for (int i = 0; i < 4; i++) { attributePair[i] = new Pair <attribute, float>((attribute)0, 0); } }
public equipment(string name, gameChar ownedBy, string eqDescription, int lvCap, eqType equipType, int eqRank, Pair <attribute, float>[] attrPair) { eqtype = equipType; eqName = name; owner = ownedBy; description = eqDescription; lv = lvCap; if (eqRank > 4) { eqRank = 4; } rank = eqRank; for (int i = 0; i < 4; i++) { attributePair[i] = attrPair[i]; } }