public ActionCharacterPropertySet(Guid guid, List <string> path, CharProperty from, CharProperty to) { if (path is null) { throw new ArgumentNullException(nameof(path)); } if (path.Count <= 0) { throw new ArgumentOutOfRangeException(nameof(path)); } if ((from is null) && (to is null)) { throw new ArgumentNullException(nameof(to)); } if (from is not null) { from = from.copy(); } if (to is not null) { to = to.copy(); } this.guid = guid; this.path = new List <string>(path); this.from = from; this.to = to; }
public override void rebase(CampaignState state) { if (!state.characters.characters.ContainsKey(this.guid)) { throw new ArgumentOutOfRangeException(); } try { CharProperty prop = state.characters.characters[this.guid].get_property(this.path); this.from = prop.copy(); } catch (ArgumentOutOfRangeException) { this.from = null; } }