// Used by a cheat button in the battle scene public void IncreaseHPMax(int increase) { int tempMax = HPMax; BStats.UpdateMax(increase, 0); hp += HPMax - tempMax; }
/// <summary> /// Alter BattleStats when equipping an item. /// Also called when using for tomes. /// All items have BattleStats. /// </summary> /// <param name="name">the item to equip as an InvNames</param> public void Equip(InvNames name) { // First: Calculate new stats // retrieve bstats of item to remove, if one exists. If not, remains null. BattleStats remove = null; InvItem returnToStashItem = null; // compare kind of equip item to all the equipped items foreach (InvItem item in Equipment.Contents) { if (item.Slot == InvData.Data[name].Slot) { remove = ((InvEqItem)InvData.Data[item.Name]).BStats; returnToStashItem = item; break; } } // retrieve bstats of item to add BattleStats add = (InvData.Data[name] as InvEqItem).BStats; // Reduce hero stats by the remove InvItem (if not null). Increase by the add InvItem. BStats.Equip(add, remove); // Second: move items from inventories // remove 1 of EQUIPPED item from partyStash if (BattleLoader.Party.Inventory.ContainsItem(name)) { BattleLoader.Party.Inventory.RemoveInvItem(name, 1); } // remove UNEQUIPPED item from Equipment, add 1 to partyStash if (returnToStashItem != null) { Equipment.RemoveInvItem(returnToStashItem.Name, 1); BattleLoader.Party.Inventory.AddInvItem(returnToStashItem.Name, 1); } // add EQUIPPED item to hero's Equipment Equipment.AddInvItem(name, 1); }