public bool can_use() { TactileLibrary.Data_Equipment item = this.actor.items[Item_Window_1.redirect()].to_equipment; if (!item.is_weapon && this.actor.prf_check(item) && Combat.can_use_item(this.actor, item.Id, false)) { return(true); } return(false); }
public bool CanUse() { TactileLibrary.Data_Equipment item = this.SelectedItemData.to_equipment; if (!item.is_weapon && this.Actor.prf_check(item) && Combat.can_use_item(this.Actor, item.Id, false)) { return(true); } return(false); }
protected void copy_traits(Data_Equipment equipment) { Id = equipment.Id; Name = equipment.Name; Full_Name = equipment.Full_Name; ArticleIndex = equipment.ArticleIndex; Description = equipment.Description; Quick_Desc = equipment.Quick_Desc; Image_Name = equipment.Image_Name; Image_Index = equipment.Image_Index; Uses = equipment.Uses; Cost = equipment.Cost; Prf_Character = new List <int>(equipment.Prf_Character); Prf_Class = new List <int>(equipment.Prf_Class); Prf_Type = new List <int>(equipment.Prf_Type); Skills = new List <int>(equipment.Skills); Status_Inflict = new List <int>(equipment.Status_Inflict); Status_Remove = new List <int>(equipment.Status_Remove); Can_Sell = equipment.Can_Sell; }
/// <summary> /// Checks the Prf data for an item and only returns true if the class check passes /// </summary> /// <param name="item">Item to check</param> public bool prf_check(Data_Equipment item) { // Block use if the class/type are on any of the disabled lists if (item.Prf_Class.Any()) { if (item.Prf_Class.Contains(-Id)) { return(false); } } if (item.Prf_Type.Any()) { foreach (ClassTypes type in Class_Types) { if (item.Prf_Type.Contains(-(int)type)) { return(false); } } } // If there are any positive class/type prf requirements and not just negative ones bool prf_required = false; if (item.Prf_Class.Any()) { if (item.Prf_Class.Contains(Id)) { return(true); } // If there are any prf classes, this class must succeed one of the other tests or this is unusable for (int i = 0; i < item.Prf_Class.Count; i++) { if (item.Prf_Class[i] > 0) { prf_required = true; break; } } } if (item.Prf_Type.Any()) { foreach (ClassTypes type in Class_Types) { if (item.Prf_Type.Contains((int)type)) { return(true); } } // If there are any prf types, this class must succeed one of the other tests or this is unusable (but there are no more tests) for (int i = 0; i < item.Prf_Type.Count; i++) { if (item.Prf_Type[i] > 0) { prf_required = true; break; } } } return(!prf_required); }