// tInUse1 <-> tInUse2 public static void swapPosition(C_Hero h, int posX, int posY) { A_Talisman t = h.in_useTalismans[posY]; h.in_useTalismans[posY] = h.in_useTalismans[posX]; h.in_useTalismans[posX] = t; }
public static bool buy(A_Talisman talisman, C_Hero hero) { int price = 0; string str = talisman.GetType().Name; str = str.Substring(str.Length - 2, 2); switch (str) { case "1S": price = 800; break; case "2M": price = 1600; break; case "3G": price = 3200; break; case "4U": price = 6400; break; } if (hero.gold >= price) { hero.inv_talismans.Add(talisman); findId(hero); hero.gold -= price; return(true); } return(false); }
//move from inv to tInUSe public static void moveToOrder(C_Hero h, int pos, A_Talisman t) { if (h.in_useTalismans[pos] == null) { h.in_useTalismans[pos] = t; dell(h, t); } else { h.inv_talismans.Add(h.inv_talismans[pos]); h.in_useTalismans[pos] = t; dell(h, t); } findId(h); }
public static void sell(A_Talisman talisman, C_Hero hero) { int price = 0; string str = talisman.GetType().Name; str = str.Substring(str.Length - 2, 2); switch (str) { case "1S": price = 200; break; case "2M": price = 400; break; case "3G": price = 800; break; case "4U": price = 1600; break; } hero.gold += price; dell(hero, talisman); findId(hero); }
//dell from inv public static void dell(C_Hero h, A_Talisman t) { h.inv_talismans.Remove(h.inv_talismans.Find(x => x.id == t.id)); // findId's in inv findId(h); }
public static void reCharge(A_Talisman t, int val) { t.currEne += val; }
//re charge talisman funcs public static int reChargePrice(A_Talisman t, int val) { return(Convert.ToInt32(val * 1.8)); }