123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- using System;
- [Serializable]
- public class InvStat
- {
- public static string GetName(InvStat.Identifier i)
- {
- return i.ToString();
- }
- public static string GetDescription(InvStat.Identifier i)
- {
- switch (i)
- {
- case InvStat.Identifier.Strength:
- return "Strength increases melee damage";
- case InvStat.Identifier.Constitution:
- return "Constitution increases health";
- case InvStat.Identifier.Agility:
- return "Agility increases armor";
- case InvStat.Identifier.Intelligence:
- return "Intelligence increases mana";
- case InvStat.Identifier.Damage:
- return "Damage adds to the amount of damage done in combat";
- case InvStat.Identifier.Crit:
- return "Crit increases the chance of landing a critical strike";
- case InvStat.Identifier.Armor:
- return "Armor protects from damage";
- case InvStat.Identifier.Health:
- return "Health prolongs life";
- case InvStat.Identifier.Mana:
- return "Mana increases the number of spells that can be cast";
- default:
- return null;
- }
- }
- public static int CompareArmor(InvStat a, InvStat b)
- {
- int num = (int)a.id;
- int num2 = (int)b.id;
- if (a.id == InvStat.Identifier.Armor)
- {
- num -= 10000;
- }
- else if (a.id == InvStat.Identifier.Damage)
- {
- num -= 5000;
- }
- if (b.id == InvStat.Identifier.Armor)
- {
- num2 -= 10000;
- }
- else if (b.id == InvStat.Identifier.Damage)
- {
- num2 -= 5000;
- }
- if (a.amount < 0)
- {
- num += 1000;
- }
- if (b.amount < 0)
- {
- num2 += 1000;
- }
- if (a.modifier == InvStat.Modifier.Percent)
- {
- num += 100;
- }
- if (b.modifier == InvStat.Modifier.Percent)
- {
- num2 += 100;
- }
- if (num < num2)
- {
- return -1;
- }
- if (num > num2)
- {
- return 1;
- }
- return 0;
- }
- public static int CompareWeapon(InvStat a, InvStat b)
- {
- int num = (int)a.id;
- int num2 = (int)b.id;
- if (a.id == InvStat.Identifier.Damage)
- {
- num -= 10000;
- }
- else if (a.id == InvStat.Identifier.Armor)
- {
- num -= 5000;
- }
- if (b.id == InvStat.Identifier.Damage)
- {
- num2 -= 10000;
- }
- else if (b.id == InvStat.Identifier.Armor)
- {
- num2 -= 5000;
- }
- if (a.amount < 0)
- {
- num += 1000;
- }
- if (b.amount < 0)
- {
- num2 += 1000;
- }
- if (a.modifier == InvStat.Modifier.Percent)
- {
- num += 100;
- }
- if (b.modifier == InvStat.Modifier.Percent)
- {
- num2 += 100;
- }
- if (num < num2)
- {
- return -1;
- }
- if (num > num2)
- {
- return 1;
- }
- return 0;
- }
- public InvStat.Identifier id;
- public InvStat.Modifier modifier;
- public int amount;
- public enum Identifier
- {
- Strength,
- Constitution,
- Agility,
- Intelligence,
- Damage,
- Crit,
- Armor,
- Health,
- Mana,
- Other
- }
- public enum Modifier
- {
- Added,
- Percent
- }
- }
|