//Move a unit from the field to the bench, //adding it to the appropriate data structure //and updating the synergies //ENSURE THAT YOU UPDATE THE GRID POSITION THIS CHARACTER IS CURRENTLY ON protected virtual void FieldToBench(int u_Index) { Character unit = field_Units[u_Index]; field_Units.Remove(unit); bench_Units.Add(unit); foreach (Character c in field_Units) { if (unit.name == c.name && unit != c) { return; } } foreach (ATTRIBUTES o in unit.attributes) { if (p_Attributes.ContainsKey(o)) { p_Attributes[o]--; } CheckAttributes(o); if (p_Attributes[o] == 0) { p_Attributes.Remove(o); } } SetText(); }
//When a unit is moved, evaluate the buffs on the current board and //change what the player has accordingly //ENSURE THAT YOU UPDATE THE GRID POSITION THIS CHARACTER IS CURRENTLY ON protected virtual void BenchToField(int u_Index) { Character unit = bench_Units[u_Index]; bench_Units.Remove(unit); field_Units.Add(unit); foreach (Character c in field_Units) { if (unit.name == c.name && c != unit) { return; } } foreach (ATTRIBUTES o in unit.attributes) { if (p_Attributes.ContainsKey(o)) { p_Attributes[o]++; } else { p_Attributes.Add(o, 1); } CheckAttributes(o); } SetText(); }