public override IQuestAction CreateNew(string source, Quest parentQuest) { // Source must match pattern Match match = Test(source); if (!match.Success) { return(null); } // Get signed value int value; string sign = match.Groups["sign"].Value; if (sign == "+") { value = Parser.ParseInt(match.Groups["amount"].Value); } else if (sign == "-") { value = -Parser.ParseInt(match.Groups["amount"].Value); } else { throw new System.Exception("Invalid sign encountered by ChangeReputeWith action"); } // Factory new action ChangeReputeWith action = new ChangeReputeWith(parentQuest); action.target = new Symbol(match.Groups["target"].Value); action.amount = value; return(action); }
public override IQuestAction CreateNew(string source, Quest parentQuest) { // Source must match pattern Match match = Test(source); if (!match.Success) { return(null); } // Factory new action ChangeReputeWith action = new ChangeReputeWith(parentQuest); action.target = new Symbol(match.Groups["target"].Value); action.amount = Parser.ParseInt(match.Groups["amount"].Value); return(action); }