private int Status(int index, int turn = 1, int intensity = 1) { bool changed = false; if (status[index].rank < turn) { status[index].rank = turn; if (status[index].maxRank < turn) { status[index].maxRank = turn; } changed = true; } if (status[index].tier < intensity) { status[index].tier = intensity; changed = true; } if (changed) { status[index].desc = PerkLoad.Effect(status[index].name, status[index].rank, status[index].tier).desc; return(0); } return(-1); }
/// <summary> /// /// </summary> /// <param name="name">name of the perk</param> /// <param name="turn">rank that will be given to the perk and will be used /// as a turn counter until the perk is no longer in effect</param> /// <param name="intensity">will be set as the perk's tier, if applicable, /// will increase the effect of the perk</param> /// <returns>-1: no changes, 0: perk was updated, 1: perk was added</returns> internal int Status(string aname, int turn = 1, int intensity = 1) { int index = status.FindIndex(item => item.name == aname); if (index > -1) { return(Status(index, turn, intensity)); } return(Status(PerkLoad.Effect(aname, turn, intensity), true)); }